akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define M 1000000007
using namespace std;

int dp[10005][2][2];

void DP(string A, string B, string C){
  
  while(A.size()<B.size()) A='0'+A;
  
  int ans=0;
  
  for(int i=0;i<A.size();i++){
    
    if(i+C.size()-1>=A.size()) break;
    
    memset(dp,0,sizeof(dp));
    
    for(int j=A[0];j<=B[0];j++){
      int a=1, b=1;
      if(j==A[0]) a=0;
      if(j==B[0]) b=0;
      if(!i){
	a=1, b=1;
	if(C[0]==A[0]) a=0;
	if(C[0]==B[0]) b=0;
	if(C[0]<A[0]) continue;
	if(B[0]<C[0]) continue;
	dp[1][a][b]++;
	break;
      }
      dp[1][a][b]++;
    }
    
    for(int j=1;j<A.size();j++){
      
      for(int k=0;k<2;k++){
	for(int l=0;l<2;l++){
	  
	  if(!dp[j][k][l]) continue;
	  
	  for(int num='0';num<='9';num++){
	    
	    if(i<=j&&j<=i+C.size()-1){
	      num=C[j-i];
	      if(k==0&&num<A[j]) break;
	      if(l==0&&num>B[j]) break;
	    }
	    
	    if(k==0&&num<A[j]) continue;
	    if(l==0&&num>B[j]) continue;
	    
	    int nk=k, nl=l;
	    if(!nk&&A[j]<num) nk=1;
	    if(!nl&&B[j]>num) nl=1;
	    
	    dp[j+1][nk][nl]=(dp[j+1][nk][nl]+dp[j][k][l])%M;
	    
	    if(i<=j&&j<=i+C.size()-1) break;
	  }
	  
	}
      }
      
    }
    
    for(int j=0;j<2;j++)
      for(int k=0;k<2;k++) ans=(ans+dp[A.size()][j][k])%M;
    
  }
  
  cout<<ans<<endl;
}

int dp2[10005][2][2][2];

void DP2(string A, string B, string C){
  
  int ans=0;
  
  if(A=="0") ans=1;
  
  while(A.size()<B.size()) A='0'+A;
  
  for(int i=1;i<A.size();i++){ // i?????????????????????????????¨?????????
    
    memset(dp2,0,sizeof(dp2));
    
    for(int j=A[0];j<=B[0];j++){
      int a=1, b=1;
      if(j==A[0]) a=0;
      if(j==B[0]) b=0;
      if(j=='0') dp2[1][a][b][0]++;
      else dp2[1][a][b][1]++;
    }
    
    for(int j=1;j<A.size();j++){
      
      for(int k=0;k<2;k++)
	
	for(int l=0;l<2;l++){
	  
	  for(int m=0;m<2;m++){
	    
	    if(!dp2[j][k][l][m]) continue;
	    
	    if(j==i){
	      
	      int nk=k, nl=l;
	      
	      if( nk == 0 && '0' < A[j] ) continue;
	      if( nl == 0 && '0' < B[j] ) nl=1;
	      
	      dp2[j+1][nk][nl][m]=(dp2[j+1][nk][nl][m]+dp2[j][k][l][m])%M;
	      
	    }else{
	      
	      for(int num='0';num<='9';num++){
		
		int nk=k, nl=l;
		
		if( nk == 0 && num < A[j] ) continue;
		if( nl == 0 && B[j] < num ) continue;
		
		if( nk == 0 && A[j] < num ) nk=1;
		if( nl == 0 && num < B[j] ) nl=1;
		
		if(m==0){
		  
		  if(num=='0') dp2[j+1][nk][nl][0]=(dp2[j+1][nk][nl][0]+dp2[j][k][l][0])%M;
		  //else if(j!=(int)A.size()-1) dp2[j+1][nk][nl][1]=(dp2[j+1][nk][nl][1]+dp2[j][k][l][0])%M;
		  else if(j<=i) dp2[j+1][nk][nl][1]=(dp2[j+1][nk][nl][1]+dp2[j][k][l][0])%M;
		}
		else dp2[j+1][nk][nl][1]=(dp2[j+1][nk][nl][1]+dp2[j][k][l][1])%M;
		
	      }
	      
	    }
	    
	  }
	}
      
    }
    
    /*
      
      1000
      0099
    
      1000
      0100

     */
    
    for(int j=0;j<2;j++)
      for(int k=0;k<2;k++) ans=(ans+dp2[A.size()][j][k][1])%M;
    
  }
  
  cout<<ans<<endl;
}

string A, B, C;

int main(){

  cin>>A>>B>>C;

  if(C=="0") DP2(A, B, C);
  
  else DP(A, B, C);
    
  return 0;
}

Measured memory_bytes: 3536
#include <stdio.h>

int main(void)
{
    int n;
    int i;
    int x[100];
    scanf("%d",&n);
    for(i = 0;i < n;++i){
        scanf("%d",&x[i]);
    }
    for(i = n-1;i >= 0;--i){
        if(i != n-1 ){
                printf(" ");
        }
        printf("%d",x[i]);       
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 1032
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
#define LINF 1e18


int main() {
    string S,T; cin >> S >> T;
    vector<int> s(26,-1), t(26,-1);

    REP(i,S.size()){
        int x = S[i] - 'a';
        int y = T[i] - 'a';
        if(s[x] == -1){
            if(t[y] == -1){
                s[x] = y;
                t[y] = x;
            }else{
                cout << "No" << endl;
                return 0;
            }
        }else{
            if(s[x]!=y || t[y]!=x){
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3896
#include <cstdio>
using namespace std;

using i64 = long long;

#define REP(i, stop) for (int i = 0, i##_len = stop; i < i##_len; ++i)

inline int read() {
	int r = 0;
	while (true) {
		char c = getchar_unlocked();
		if (c & 16) {
			r = r * 10 + c - 48;
		} else {
			return r;
		}
	}
}

// x shoud be greater than or equal to zero
inline void write(i64 x) {
	char d[20];
	int i = 0;
	while (true) {
		d[i] = x % 10 + 48;
		x /= 10;
		++i;
		if (x <= 0) break;
	}
	while (i--) {
		putchar(d[i]);
	}
}

int A[100001];
signed main() {
	int n = read();
	REP(i, n + 1) {
		A[i] = read();
	}
	i64 s = 0;
	int a0;
	int a1 = A[0];
	REP(i, n) {
		a0 = a1;
		a1 = A[i + 1];
		int b = read();
		int m = a0 < b ? a0 : b;
		s += m;
		b -= m;
		m = a1 < b ? a1 : b;
		s += m;
		a1 -= m;
	}
	write(s);
}


Measured memory_bytes: 512
using System;

namespace _20190622_ABC
{
    class Program
    {
        static void Main(string[] args)
        {
            var S = int.Parse(Console.ReadLine());
            int S1, S2, S3, S4;

            S1 = S / 1000;
            S2 = (S - S1 * 1000) / 100;
            S3 = (S - S1 * 1000 - S2 * 100) / 10;
            S4 = (S - S1 * 1000 - S2 * 100 - S3 * 10);
          
            if(S1 == S2 || S2 == S3 || S3 == S4) Console.WriteLine("Bad");
            else Console.WriteLine("Good");
        }
    }
}

Measured memory_bytes: 13140
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
def resolve():
    N, M = lr()
    if N%2 == 1:
        for i in range(0, M):
            print(f'{2+i} {1+2*M-i}')
    else:
        k = N//4
        for i in range(M):
            if i < k:
                print(f'{i+1} {N-i}')
            else:
                print(f'{i+2} {N-i}')
resolve()

Measured memory_bytes: 79868
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;
public class Program
{
    public static void Main(string[] args)
    {
        int a = Int32.Parse(Console.ReadLine());
        int b = Int32.Parse(Console.ReadLine());
        int c = Int32.Parse(Console.ReadLine());
        int x = Int32.Parse(Console.ReadLine());

        int ans = 0;
        for (int i = 0; i <= a; i++)
        {
            for (int j = 0; j <= b; j++)
            {
                for (int k = 0; k <= c; k++)
                {
                    if (x == ((i*500) + (j*100) + (k*50))){
                        ans++;                        
                    }
                }                
            }
        }
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
namespace io{
    const int l=1<<20;
    char buf[l],*s,*t,c;
    inline void gc(){
        if(s==t){
            t=(s=buf)+fread(buf,1,l,stdin);
            c=s==t?EOF:*s++;
        }else c=*s++;
    }
    template<class IT>inline void gi(IT &x){
        x=0;gc();while(c<'0'||c>'9')gc();
        while('0'<=c&&c<='9'){x=(x<<1)+(x<<3)+(c^48);gc();}
    }
    char buf0[20];int a;
    template<class IT>inline void pi(IT x){
        if(x<0){putchar('-');x=-x;}
        do buf0[++a]=x%10+48;while(x/=10);
        while(a)putchar(buf0[a--]);
        putchar('\n');
    }
};
using io::gi;
using io::pi;
typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<int,ll > pil;
typedef pair<ll ,int> pli;
typedef pair<ll ,ll > pll;
typedef vector<int> vi;
typedef vector<ll > vl;
#define pque priority_queue
#define rep(i,l,r) for(i=(l);i<=(r);++i)
#define per(i,l,r) for(i=(l);i>=(r);--i)
#define REP(i,l,r) for(i=(l);i< (r);++i)
#define PER(i,l,r) for(i=(l);i> (r);--i)
#define mp make_pair
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define fi first
#define se second
template<class IT>inline void cmax(IT &a,IT b){if(a<b)a=b;}
template<class IT>inline void cmin(IT &a,IT b){if(b<a)a=b;}
const int N=100005;
pii b[N<<1];
pii a[N];int v[N];
int main(){
    //freopen("a.in","r",stdin);
    //freopen("a.out","w",stdout);
    int n,i,t=0;ll sa=0ll,sb=0ll,sc=0ll;
    scanf("%d",&n);
    rep(i,1,n){
		scanf("%d%d",&a[i].fi,&a[i].se);
		sa+=a[i].fi;
		sb+=a[i].se;
	}
	rep(i,1,n){
		b[++t]=mp(a[i].fi,i);
		b[++t]=mp(a[i].se,i);
	}
	sort(b+1,b+t+1);
	//rep(i,1,t)printf("%d %d\n",b[i].fi,b[i].se);
	rep(i,1,n)sc+=b[i].fi;
	rep(i,1,n){
		if(  v[b[i].se])break;
		else v[b[i].se]=1;
	}
	//printf("%d\n",i>n);
	if(i>n){
		if(b[n].se==b[n+1].se)sc+=min(b[n+1].fi-b[n-1].fi,b[n+2].fi-b[n].fi);
		else sc+=b[n+1].fi-b[n].fi;
	}
	//printf("sc=%lld\n",sc);
	printf("%lld",min(min(sa,sb),sc));
    return 0;
}

Measured memory_bytes: 2944
import math
n = int(input())
s_list = []
for i in range(n):
    l = list(input())
    l.sort()
    s = ''.join(map(str, l))
    s_list.append(s)
    #print(s)
s_list.sort()
#print(s_list)

old_s = ""
length = 1
num = 0
for s in s_list:
    if old_s == s:
        length += 1
    else:
        if length > 1:
          #print(math.factorial(length) // (math.factorial(length - 2) * math.factorial(2)))
          num += math.factorial(length) // (math.factorial(length - 2) * math.factorial(2))
        old_s = s
        length = 1
if length > 1:
	num += math.factorial(length) // (math.factorial(length - 2) * math.factorial(2))
print(num)

Measured memory_bytes: 11468
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)


int main() {
  int n,m;
  cin >> n>>m;
  
  if(n<=m){
     cout<<"unsafe"<<endl;
  }
  else{
    cout<<"safe"<<endl;
  }
  
  
}







Measured memory_bytes: 3624
import java.util.*;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt(),w = sc.nextInt();
        String[] s = new String[h];
        for(int i = 0;i<h;i++){
            s[i] = sc.next();
        }
        sc.close();
        for(int i =0;i<2*h;i++){
            System.out.println(s[i/2]);
        }
    }
}

Measured memory_bytes: 22612
import sys
from fractions import gcd
def input(): return sys.stdin.readline().strip()


def make_divisors(n):
    divisors = []
    divisors2 = []
    for i in range(1, int(round(n**0.5))+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors

def main():
    N, M = map(int, input().split())
    divisors = make_divisors(M)
    while True:
        d = divisors.pop()
        if M >= N * d:
            print(d)
            return




if __name__ == "__main__":
    main()


Measured memory_bytes: 64748
#include<stdio.h>
int main(void)
{
 int n,m,a;
 scanf("%d %d",&n,&m);
 a=0;
 a=m/n;
 if(n>m) a=1;
 else if(m%n!=0&&m>n) a++;
 printf("%d\n",a);
 return 0;
}


Measured memory_bytes: 2148
// ABC082_A.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//

//#include "stdafx.h"
#include <iostream>
//#include <windows.h>
using namespace std;

int main()
{
	int a,b;
	double average;
	int average_int;
	std::cin >>a >> b; //スペースで区切られたものを別々に入力
//	std::cout << a / b;
	average = double(a+b)/2;
	average_int = int(average);
	if ((average - average_int) != 0)
	{
		std::cout << average_int + 1;
	}
	else {
		std::cout << average_int;
	}

//	Sleep(2000);

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <deque>
#include <set>
#include <iomanip>
#include <utility>
using namespace std;
#define ll long long

int main() {
	int A, P; cin >> A >> P;
	cout << (3*A+P)/2 << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
    int n,k;
    cin >> n >> k;
    vector<int> p(n);
    for(int i = 0;i < n;i++){
          cin >> p[i];
    }
    int ans = 0;
    sort(p.begin(),p.end());
    for(int i = 0;i < k;i++){
          ans += p[i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 3620
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

#define rep(i, n) for (int i = 0; i < (n); ++i)

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

int main()
{
  int N, M, X, Y;
  cin >> N >> M >> X >> Y;

  int mx = -100;
  rep(i, N)
  {
    int x;
    cin >> x;
    mx = std::max(mx, x);
  }

  int mn = 100;
  rep(i, M)
  {
    int y;
    cin >> y;
    mn = std::min(mn, y);
  }

  if (mx >= mn || mx >= Y || mn <= X)
  {
    cout << "War" << endl;
  }
  else
  {
    cout << "No War" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < n; i++)

using namespace std;

void solve() {
  long N, M, K;
  cin >> N >> M >> K;
  for (long n = 0; n <= N; n++) for (long m = 0; m <= M; m++) {
    long tmp = n * m + (N-n) * (M-m);
    if (tmp == K) {
      cout << "Yes" << endl;
      return;
    }
  }
  cout << "No" << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll a,b,c,d,ans;
    cin>>a>>b>>c>>d;
    ans=max(a*c,max(a*d,max(b*c,b*d)));
    cout<<ans<<endl;
}

Measured memory_bytes: 3660
#include <iostream>
#include <limits>

int main() {
    int n{};
    std::cin >> n;
    if(n<2) return 1;
    int val[n]{}, mins[n-1]{}, max{std::numeric_limits<int>().min()}, maxdiff{max};
    for(auto i=0; i<n; i++) {
        int v{};
        std::cin >> v;
        val[i] = v;
        mins[i] = v;
        if(i>0) mins[i] = (mins[i-1]<v) ? mins[i-1] : mins[i];
    }
    for(auto i=n-1; i>0; i--) {
        max = (val[i]>max) ? val[i] : max;
        int diff{max-mins[i-1]};
        maxdiff = (diff>maxdiff) ? diff : maxdiff;
    }
    std::cout << maxdiff << std::endl;
}



Measured memory_bytes: 4668
#include<bits/stdc++.h>

using namespace std;

typedef long long int li;
typedef long double ld;
typedef vector<li> vi;
typedef pair<li,li> pi;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define B begin()
#define E end()
#define f(i,l,r) for(li i=l;i<=r;++i)
#define fr(i,l,r) for(li i=l;i>=r;--i)
#define u_map unordered_map
#define endl "\n"
#define debug(x) cerr<<#x<<" = "<<x<<endl

li fastpow(li base,li exp,li M) 
{
    li res=1;
    while(exp>0) {
        if(exp&1)
            res=(res*base)%M;

        base=(base*base)%M;
        exp>>=1;
    }
    return res;
}

void solve()
{
    li n;

    cin>>n;

    if(n)
        cout<<0;
    else
        cout<<1;
}

int main()
{    
    //remove this in kickstart

    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    li t=1;

    // cin>>t;

    f(i,1,t)
    {
        // cout<<"Case #"<<i<<": ";

        solve();
    }

    return 0;
}

Measured memory_bytes: 3600
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdlib>
#include <string>
#include <cstdio>
#include <algorithm>
#include <math.h>
#include <vector>

using namespace std;

struct Node {
    int key;
    Node* parent;
    Node* left;
    Node* right;
};

Node* root=nullptr;

void firstPrint(Node *node) {
    if (node == nullptr) {
	return;
    }
    printf(" %d", node->key);
    firstPrint(node->left);
    firstPrint(node->right);
}

void middlePrint(Node *node) {
    if (node == nullptr) {
	return;
    }
    middlePrint(node->left);
    printf(" %d", node->key);
    middlePrint(node->right);
}

void insert(int key) {
    Node* node = (Node*)calloc(1, sizeof(Node));
    node->key = key;
    if (root == nullptr) {
	root = node;
	node->parent = nullptr;
	return;
    }

    Node* p = root;
    Node* parent=p->parent;
    while (p !=nullptr) {
	if (p->key < key) {
	    parent = p;
	    p = p->right;
	}
	else if (p->key > key) {
	    parent = p;
	    p = p->left;
	}
	else {
	    return;
	}
    }

    node->parent = parent;

    if (parent->key < key) {
	parent->right = node;
    }
    else if (parent->key > key) {
	parent->left = node;
    }

}

bool find(int key) {
    bool isFind = false;
    Node* p = root;
    while (p != nullptr) {
	if (p->key == key) {
	    isFind = true;
	    break;
	}
	else if (p->key > key) {
	    p = p->left;
	}
	else {
	    p = p->right;
	}
    }

    return isFind;

}

void print(Node *node) {
    middlePrint(node); printf("\n");
    firstPrint(node); printf("\n");
}


int main() {

    //cin.tie(0);
    //ios::sync_with_stdio(false);

    int m; scanf("%d", &m);
    string str;
    for (int i = 0; i < m; i++) {
	cin >> str;
	
	//insert
	if (str =="insert") {
	    int key; scanf("%d", &key);
	    insert(key);
	}
	//find
	else if (str[0] == 'f') {
	    int key; scanf("%d", &key);
	    if (find(key)) {
		printf("yes\n");
	    }
	    else {
		printf("no\n");
	    }
	}
	//print
	else {
	    print(root);
	}
    }

    return 0;

}




Measured memory_bytes: 22008
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

ll knapsack(ll n, ll W, vll w, vll v){
    vvll dp(n + 1, vll (W + 1, 0));
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= W; j++) {
            if(j - w[i] >= 0) {
                chmax(dp[i][j], dp[i - 1][j - w[i]] + v[i]);
            }
            chmax(dp[i][j], dp[i - 1][j]);
        }
    }
    return dp[n][W];
}

int main() {
    
    ll n,W;
    cin>>n>>W;
    vll w(n+1),v(n+1);
    rep(i,n)cin>>w[i+1]>>v[i+1];
    fin(knapsack(n,W,w,v));
}


Measured memory_bytes: 80256
#include <iostream>
#include <vector>
#include <algorithm>

int main(){
   int N, K;
   std::cin >> N >> K;
   std::vector<int> H(N);
   for(int i=0; i<N; ++i)
      std::cin >> H[i];

   std::sort(H.begin(),H.end());

   long long ans = 0;
   for(int i=0; i<N-K; ++i)
      ans += H[i];

   std::cout << ans << std::endl;
   return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>
#include <complex>
#include <queue>
using namespace std;
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define print(x) cout<<(x)<<'\n'
#define print_vec(v) rep(i,v.size()){if(i!=0)cout<<" ";cout<<v[i];}cout<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";rep(i,v.size())cout<<" "<<v[i];cout<<'\n'
#define pb push_back
#define mp make_pair
#define MOD 1000000007 //10^9+7
#define fi first
#define sc second
using ll=long long;
using pll=pair<ll,ll>;
using vll=vector<ll>;
using vvll=vector<vll>;
using vstr=vector<string>;

ll N,K,X,Y;

void solve() {
    cin >> N >> K >> X >> Y;
    ll ans = 0;
    ans += X*min(N,K);
    ans += Y*max(0LL,N-K);
    print(ans);
}
 
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
	cout<<fixed<<setprecision(20);
    //int q; cin >> q;
	//while (q--)
		solve();
    return 0;
}

Measured memory_bytes: 3552
#include<stdio.h>
#include<string.h>

int main(void){
    char S[256];
    char T[256];
    int len;
    gets(S);
    gets(T);

    len = strlen(S);
    if(strncmp(S, T, len) == 0){
        if(T[len+1] == 0){
            printf("Yes");
        }else{
            printf("No");
        }
    }else{
        printf("No");
    }

    return 0;
}

Measured memory_bytes: 1572
#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;

const double PI = 3.1415926535897932384626433832795;

const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { -1, 0, 1, 0 };

int gcd(int x, int y) { return y ? gcd(y, x % y) : abs(x); }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : abs(x); }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	int n;
	cin >> n;

	vector<int> h(n);
	for (auto &v : h) {
		cin >> v;
	}

	int ans = 1;
	int ma = h[0];
	for (int i = 1; i < n; i++) {
		if (ma <= h[i]) {
			ans++;

			ma = max(ma, h[i]);
		}
	}

	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
n = int(input())
x = [input().split() for i in range(n)]
x = [[x[i][0], int(x[i][1]), i+1] for i in range(n)]

x.sort()

while len(x) > 0:
   if (x.count(x[0][0]) == 1):
      y = x.pop(0)
      print(y[2])
   else:
      yy = [z for z in x if z[0] == x[0][0]]
      yy.sort(reverse=True)
      [print(z[2]) for z in yy]
      x = [z for z in x if z not in yy]


Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<functional>
#include<map>
#include<cmath>
#include<iomanip>

using namespace std;

typedef long long ll;

int main()
{
  int n, k;
  string s;
  cin >> n >> s >> k;
  char c = s[k - 1];

  for (int i = 0; i < n; i++)
  {
    if(s[i] != c) s[i] = '*';
  }
  
  cout << s << endl;
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
#include <map>
#include <cmath>
#include <iomanip>
typedef  long long ll;
using namespace std;

int main(void) {
	double x1, x2, y1 ,y2, d;
	cin >> x1 >> y1 >> x2 >> y2;

	d = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1) ;
	d = sqrt(d);
	cout << fixed << std::setprecision(10) << d << endl;

	return 0;
}


Measured memory_bytes: 3288
#include<stdio.h>
int N, K, A[200200];
int main(){
	scanf("%d%d",&N,&K);
	for(int i=0; i<N; i++){
		scanf("%d", A+i);
		if(i >= K){
			puts(A[i]>A[i-K]?"Yes":"No");
		}
	}
	return 0;
}

Measured memory_bytes: 2440
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<vector<ll> > Graph;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1e16;

int n,m;
ll dp[1100][5000];

int main(){
    cin >> n >> m;
    vector<ll>a(m),b(m),c(m,0);
    rep(i,m){
        cin >> a[i] >> b[i];
        rep(j,b[i]){
            int t;
            cin >> t;
            t--;
            c[i]+=(1<<t);
        }
    }
    rep(i,1010){
        rep(j,4500){
            dp[i][j]=INF;
        }
    }
    dp[0][0]=0;
    rep(i,m){
        rep(j,1<<n){
            chmin(dp[i+1][j],dp[i][j]);
            chmin(dp[i+1][j|c[i]],dp[i][j]+a[i]);
        }
    }
    if(dp[m][(1<<n)-1]==INF){
        cout << -1 << endl;
    }
    else{
        cout << dp[m][(1<<n)-1] << endl;
    }

    return 0;
}



Measured memory_bytes: 41344
#include <bits/stdc++.h>
#define FOR(i, k, n) for(int i = (k); i < (n); i++)
#define FORe(i, k, n) for(int i = (k); i <= (n); i++)
#define FORr(i, k, n) for(int i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(int i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;
using ll = long long;

const int INF = 1001001001;
const int mod = 1000000007;

class mint{
  public:
  ll x;
  mint(ll x = 0):x((x % mod + mod) % mod){};
  mint pow(ll y) const {
    mint res(1);
    mint a(x);
    while(y>0){
      if(y&1) res *= a;
      a *= a;
      y >>= 1;
    }
    return res;
  }
  mint inv() const{ return pow(mod-2); }
  mint& operator+= (const mint a) noexcept {
    if((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-= (const mint a) noexcept {
    if((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*= (const mint a) noexcept {
    (x *= a.x) %= mod;
    return *this;
  }
  mint& operator/= (const mint a) noexcept {
    return (*this) *= a.inv();
  }
  mint operator+ (const mint a) const noexcept {
    mint res(*this);
    return res += a;
  }
  mint operator- (const mint a) const noexcept {
    mint res(*this);
    return res -= a;
  }
  mint operator* (const mint a) const noexcept {
    mint res(*this);
    return res *= a;
  }
  mint operator/ (const mint a) const noexcept{
    mint res(*this);
    return res /= a;
  }
};

class comb{
  public:
  vector<mint> fact, ifact;
  comb(int n): fact(n+1), ifact(n+1){
    fact[0] = 1;
    for(int i = 1; i <= n; i++) fact[i] = fact[i-1] * i;
    ifact[n] = fact[n].inv();
    for(int i = n; i >= 1; i--) ifact[i-1] = ifact[i] * i;
  }
  mint operator()(int n, int k) const noexcept{
    if(k < 0 || n < k) return 0;
    return fact[n] * ifact[k] * ifact[n-k];
  }
};

int main(void){
  int n, a, b;
  cin >> n >> a >> b;
  mint ans = mint(2).pow(n) - 1;
  mint xa = 1, xb = 1, ia = 1, ib = 1;
  REP(i, a){
    xa *= (n - i);
    ia *= (a - i);
  }
  REP(i, b){
    xb *= (n - i);
    ib *= (b - i);
  }
  ans -= xa * ia.inv() + xb * ib.inv();
  cout << ans.x << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

typedef long long ll;
typedef pair<ll,ll> P;

ll dp[111][2][5];

int main(){
	cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);

	string str;cin >> str;
	ll K;cin >> K;

	dp[0][0][0] = 1;
	REP(i, str.size()){
		REP(smaller, 2){
			REP(zeroNum, 5){
				REP(nxtNum, 10){
					ll nxtZeroNum = zeroNum;
					if(nxtNum != 0)nxtZeroNum = min(4LL, zeroNum+1);
					if(smaller == 0){
						if(nxtNum == str[i] - '0'){
							dp[i+1][smaller][nxtZeroNum] += dp[i][smaller][zeroNum];
						}
						else if(nxtNum <= str[i] - '0'){
							dp[i+1][1][nxtZeroNum] += dp[i][smaller][zeroNum];
						}
					}
					else{
						dp[i+1][smaller][nxtZeroNum] += dp[i][smaller][zeroNum];
					}
				}
			}
		}
	}

	cout << dp[str.size()][1][K] + dp[str.size()][0][K] << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	int n;
	cin >> n;
	
	vector<int> p(n);
	for(int i = 0; i < n; ++i) {
		cin >> p[i];
		p[i]--;
	}
	
	int ans = 0;
	for(int i = 0; i < n; ++i) {
		if( p[i] == i ) {
			if( i < n - 1 ) swap(p[i], p[i + 1]);
			else swap(p[i - 1], p[i]);
			
			ans++;
		}
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i,n) for (ll i = 0; i < (n); ++i)

const string YES = "Yes";
const string NO = "No";

void solve(std::string S){
    if(S.at(2) == S.at(3) && S.at(4) == S.at(5)){
        cout << YES << endl;
    }else{
        cout << NO << endl;
    }
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			var cin = new Scanner2();
			int n = cin.Int();
			int m = cin.Int();

			var ss = new HashSet<int>[m];
			for (int i = 0; i < m; i++) {
				ss[i] = new HashSet<int>();

				int k = cin.Int();
				for (int j = 0; j < k; j++) {
					ss[i].Add(cin.Int() - 1);
				}
			}

			var ps = cin.ArrayInt(m);

			int ans = 0;
			for (int i = 0; i < 1 << n; i++) {
				bool allOn = true;
				for (int j = 0; j < m; j++) {
					int count = 0;
					foreach (int s in ss[j]) {
						if ((i & (1 << s)) != 0) {
							++count;
						}
					}

					if (count % 2 != ps[j]) {
						allOn = false;
						break;
					}
				}

				if (allOn) {
					++ans;
				}
			}

			Console.WriteLine(ans);
		}
	}


	public class Scanner2
	{
		private readonly char[] delimiter_ = new char[] { ' ' };
		private readonly string filePath_;
		private readonly Func<string> reader_;
		private string[] buf_;
		private int index_;

		public Scanner2(string file = "")
		{
			if (string.IsNullOrWhiteSpace(file)) {
				reader_ = Console.ReadLine;
			} else {
				filePath_ = file;
				var fs = new StreamReader(file);
				reader_ = fs.ReadLine;
			}
			buf_ = new string[0];
			index_ = 0;
		}

		public string Next()
		{
			if (index_ < buf_.Length) {
				return buf_[index_++];
			}

			string st = reader_();
			while (st == "") {
				st = reader_();
			}

			buf_ = st.Split(delimiter_, StringSplitOptions.RemoveEmptyEntries);
			if (buf_.Length == 0) {
				return Next();
			}

			index_ = 0;
			return buf_[index_++];
		}

		public int Int() => int.Parse(Next());
		public long Long() => long.Parse(Next());
		public double Double() => double.Parse(Next());

		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Int() + add;
			}
			return Array;
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Long() + add;
			}
			return Array;
		}

		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Double() + add;
			}
			return Array;
		}

		public void Save(string text)
		{
			if (string.IsNullOrWhiteSpace(filePath_)) {
				return;
			}

			File.WriteAllText(filePath_ + "_output.txt", text);
		}
	}
}

Measured memory_bytes: 13396
#include <iostream>
using namespace std;

int main(){
    int N;
    cin >> N;
    int a[110]={0};
    int i,j;
    for(i=0; i<N; i++){
        cin >> a[i];
    }

    int tmp;
    for(i=0; i<N-1; i++){
        for(j=N-1; j>i; j--){
            if(a[j]>a[j-1]){
                tmp=a[j];
                a[j]=a[j-1];
                a[j-1]=tmp;
            }
        }
    }

    int Apoint=0,Bpoint=0;
    for(i=0; i<N; i+=2){
        Apoint+=a[i];
        Bpoint+=a[i+1];
    }

    cout << Apoint-Bpoint << endl;

    return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <algorithm>

#define  rep(i, N) for(int (i) = 0; (i) < (N); (i)++)
#define rep2(i, s, e) for(int (i) = s; (i) < e; (i) ++)

using namespace std;

typedef pair<int, int> pint;
int N, M, Q;

int main() {
    cin >> N >> M >> Q;
    vector<vector<int>> counts(N + 1, vector<int>(N + 1));
    rep(i, M) {
        int l, r;
        cin >> l >> r;
        counts[l][r]++;
    }
    rep(i, N) {
        rep(j, N) {
            counts[i + 1][j + 1] += counts[i + 1][j] + counts[i][j + 1] - counts[i][j];
        }
    }

    vector<pint> qs(Q);

    rep(i, Q) {
        int l, r;
        cin >> l >> r;
        qs[i] = {l, r};
    }
    rep(i, Q) {
        int l, r;
        l = qs[i].first;
        r = qs[i].second;
        cout << counts[r][r] - counts[l - 1][r] - counts[r][l - 1] + counts[l - 1][l - 1] << endl;
    }
    return 0;
}


Measured memory_bytes: 2688
S=list(input())
l=sorted(list(set(S)))
for (i,j) in zip(range(len(l)),range(97,97+26)):
    if chr(j) !=l[i]:
        print(chr(j))
        exit()
    elif chr(j) == 'z':
        print('None')
        exit()
print(chr(j+1))


Measured memory_bytes: 3956
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String n = sc.next();
        String m = sc.next();
        StringBuilder sbN = new StringBuilder();
        StringBuilder sbM = new StringBuilder();
        
        for (int i = 0; i < Integer.parseInt(n); i++) {
            sbN.append(m);
        }
        for (int i = 0; i < Integer.parseInt(m); i++) {
            sbM.append(n);
        }
        if (sbN.toString().compareTo(sbM.toString()) < 0) {
            System.out.println(sbN.toString());
        } else {
            System.out.println(sbM.toString());
        }
    }
}


Measured memory_bytes: 22996
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n; i >= 0; --i)
#define FOR(i, n, m) for (int i = m; i < n; i++)
#define MM(i, n, m) for (int i = m; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

typedef long long ll;

/**
 * C問以降は ll を使う.
 * double型にするのを忘れない.
 * nC2の求め方 (1/2)*n*(n-1)
 * vector<型> 変数名(要素数, 初期値)
 * pair<型, 型> 変数名
 * map<型, 型> 変数名  // 連想配列
 * priority_queue<型> 変数名  // 最大値から出てくるヒープ
*/
struct Node {
    int key;
    Node *right, *left, *parent;
};

Node *root, *NIL;

Node * find(Node *u, int k) {
    while(u != NIL && k != u->key) {
        if (k < u->key) u = u->left;
        else u = u->right;
    }
    return u;
}

void insert(int k) {
    // y: parent
    Node *y = NIL;
    Node *x = root;
    // z: myself
    Node *z;

    z = (Node *)malloc(sizeof(Node));
    z -> key = k;
    z -> left = NIL;
    z -> right = NIL;

    while( x != NIL) {
        y = x;
        if (z -> key < x -> key) {
            x = x->left;
        } else {
            x = x->right;
        }
    }

    z -> parent = y;
    if( y == NIL) {
        root = z;
    } else {
        if (z->key < y->key) {
            y->left = z;
        } else {
            y->right = z;
        }
    }
}
void inorder(Node *u) {
    if (u==NIL) return;
    inorder(u->left);
    printf(" %d", u->key);
    inorder(u->right);
}
void preorder(Node *u) {
    if (u==NIL) return;
    printf(" %d", u->key);
    preorder(u->left);
    preorder(u->right);
}

int main()
{
    int n;
    cin >> n;

    REP(i, n) {
        string com;
        cin >> com;
        if(com[0] == 'f') {
            int x;
            cin >> x;
            Node *t = find(root, x);
            if(t != NIL) printf("yes\n");
            else printf("no\n");
        } else if (com == "insert") {
            int x;
            cin >> x;
            insert(x);
        } else if(com == "print") {
            inorder(root);
            cout << endl;
            preorder(root);
            cout << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 22036
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <fstream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functional>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <cstdint>
#include <chrono>

using namespace std;
#define     lp(i,a,n)     for(ll i=a;i<n;i++)
#define     lp2(i,n,a)    for(ll i=a-1;i>=n;i--)
#define     all(arr,n)      arr,arr+n
#define     allv(v)         (v).begin(),(v).end()
#define     rallv(v)        (v).rbegin(),(v).rend()
#define     m_p             make_pair
#define     ll              long long
#define     pii             pair<int,int>
#define     vi              vector<int>
#define     vll             vector<ll>
#define     vii             vector<pii>
#define     sz(x)           (int)x.size()
#define     pb              push_back
#define     endl            '\n'
#define     Endl            '\n'
#define     f               first
#define     s               second
#define     mem(dp,n)       memset(dp,n,sizeof dp)
template<typename T>void max_self(T &a,T b){a=max(a,b);}
template<typename T>void min_self(T &a,T b){a=min(a,b);}
int dx[] = { 1 , 0 ,-1 , 0 ,-1 ,-1 , 1 , 1 };
int dy[] = { 0 , 1 , 0 ,-1 ,-1 , 1 ,-1 , 1 };
int KnightX[] = { 2, 1, -1, -2, -2, -1, 1, 2 };
int KnightY[] = { 1, 2, 2, 1, -1, -2, -2, -1 };
void fast(){
    std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(
        vector<string> __attribute__ ((unused)) args,
        __attribute__ ((unused)) int idx,
        __attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
const ll mxN=2e5+1,oo=0x3f3f3f3f,MOD=1e9;
const long double PI = acos(-1),eps=1.0e-14;

void solve(){
    string s;
    cin>>s;
    if(s.back()=='s')
        s+="es";
    else
        s+="s";
    cout<<s<<endl;
}
int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    fast();
    int t=1;
    while(t--)
        solve();
    return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <algorithm> // sort
#include <string.h> // sort

#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;
using namespace std;



int main(){
    //std::ifstream in("resource/input.txt");
    //std::cin.rdbuf(in.rdbuf());
	string s;

	int al[26] = {};

	while(getline(cin, s)){
		//s = "This is a pen.";
		REP(i,s.size())
		{
			if(!isalpha(s[i]))continue;
			s[i] = tolower(s[i]);
			int num = s[i] - 'a';
			++al[num];
		}
	}


	REP(i,26)
	{
		char a = i + 'a'; 
		cout << a << " : " << al[i] << endl;
	}

	return 0;


}




Measured memory_bytes: 3208
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007 

int main() {
	ll n,m;
	cin>>n>>m;
	ll ans=0;
	ll cnt=0;
	ll a[1020];
	for(ll i=0;i<n;i++){
		ll now;
		cin>>now;
		a[i]=now;
		cnt+=now;
	}
	ll cnt2=0;
	for(ll i=0;i<n;i++){
		ll ma=a[i];
	if(ma*4*m>=cnt){
		cnt2++;
	}
	}
	if(cnt2>=m){
		cout << "Yes";
	}
	else{
		cout << "No";
	}
	return 0;
}

Measured memory_bytes: 3580
#include<iostream>

using namespace std;

int main() {
  int a, b;

  // 面積
  int area;

  // 周の長さ
  int lap;

  cin >> a >> b;

  area = a * b;
  
  lap = (a + a) + (b + b);

  cout << area << " "<< lap << endl;

  
  return 0;
}


Measured memory_bytes: 3092
#include <bits/stdc++.h>

using namespace std;

#define all(x) x.begin(), x.end()
#define sz(x) (int) x.size()
#define pb push_back
#define endl '\n'
#define snd second
#define fst first
#define fastio cin.tie(NULL),cout.sync_with_stdio(true)

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector <int> vi;
typedef pair <ll, int> ii;
typedef pair <ii,int> iii;

const int mod = 1e9 + 7;
const int N = 100005;

void solve(){
	ll k, t = 0;
	cin >> k;
	for(ll i = 1, j = 1; j <= 1e6; i = (i*10) % k, j++){
		t = (t + (7*i)) % k;
		if((t % k) == 0){
			cout << j << endl;
			return ;
		}
	}
	cout << -1 << endl;
}

int main(){
	fastio;
	int t = 1;
	//cin >> t;
	while(t--)
		solve();
	return 0;
}


Measured memory_bytes: 3616
def r(a,s)
(1..13).each{|i|
if a.include?(s+" #{i}\n")==false
puts s+" #{i}"
end
}
end

n=gets.to_i
a=[]
n.times{
a.push(gets)
}

r(a,"S")
r(a,"H")
r(a,"C")
r(a,"D")

Measured memory_bytes: 8616
#include<stdio.h>
#include<string.h>
int main()
{
   int i,c=0,k,j;
   scanf("%d",&k);
   for(i=1;i<=k;i+=2)
   {
       for(j=2;j<=k;j+=2)
        c++;
   }
printf("%d\n",c);


    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=1;(i)<(int)(n);(i)++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
using namespace std;
using ll = long long;
using Int = long long;

const int MOD = 1000000007;
const ll INF = numeric_limits<ll>::max();
const int inf = 1e8;

//少数点表示
//cout <<std::fixed << std::setprecision(14)

int main(){
    cin.tie( 0 ); ios::sync_with_stdio( false );
    int a,b;
    cin >> a >> b;
    rep(i,4){
        if(i!=a && i!=b){
            cout << i;
            return 0;
        }
    }


}

Measured memory_bytes: 256
#include <bits/stdc++.h>

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef long long ll;

int main() {
    ll N, A, B;
    cin >> N >> A >> B;
    vector<ll> h(N);
    rep(i, N) cin >> h[i];

    ll ng = 0, ok = 1000000000;
    while (ok - ng > 1) {
        ll mid = (ok + ng) / 2;
        vector<int> rem;
        rep(i, N) {
            if (h[i] - B * mid > 0) rem.push_back(h[i] - B * mid);
        }

        if (rem.size() == 0) {
            ok = mid;
            continue;
        }

        ll cnt = 0;
        rep(i, rem.size()) {
            cnt += rem[i] / (A - B);
            if (rem[i] % (A - B)) cnt++;
        }

        if (cnt <= mid) ok = mid;
        else ng = mid;
    }

    cout << ok << endl;
}

Measured memory_bytes: 1992
#include <bits/stdc++.h>
using namespace std;

int main(){
    int N,K;
    cin >> N >> K;
    /*初期値1
    2倍又はプラスKを計N回*/
    int ans = 1;
    for(int i= 0; i < N; i++){
        if(ans * 2 < ans + K){
            ans *= 2;
        }
        else{
            ans += K;
        }
    }
    cout << ans << endl;

}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#include <numeric>
#define IINF 1000000000
#define INF 3223372036854775807
#define MOD 1000000007
#define mod 1000000007
#define INT_MAX_ 2147483647
#define EPS (1e-10)
#define REP(i, a, n) fo-r (ll i = a; i < (ll)(n); i++)
#define REPE(i, a, n) for (ll i = a; i <= (ll)(n); i++)
//#define rep(i,n)for (ll i = 0; i < (ll)(n); i++)
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
#define me memset
#define bit(n,k) ((n>>k)&1)
#define lg length()
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<int,int>Pin;
typedef pair<ll,ll>Pll;
template<class T> using V=vector<T>;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T> >;
long long GCD(long long a, long long b) {return b?GCD(b,a%b):a;}
long long LCM(long long a, long long b) {return a/GCD(a,b)*b;}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
#define invp(a,p)pom(a,p-2,p)
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
int ddx[8]={-1,0,1,0,1,1,-1,-1};
int ddy[8]={0,-1,0,1,1,-1,1,-1};
ll cmp1(pair<Pll,ll> a,pair<Pll,ll> b){
        return a.fi.se>b.fi.se;
}
ll cmp2(pair<ll,ll> a,pair<ll,ll> b){
    if(a.se!=b.se)
        return a.se<b.se;
    else
        return a.fi<b.fi;
}
//----------------------------------------------------------------------

//----------------------------------------------------------------------
int main(int argc, char * argv[]){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------  
    //ll begin_t=clock();
    //freopen("big.txt", "r", stdin);
    //freopen("out3.txt", "w", stdout);
    //------------------------------
    string s,t;cin>>s>>t;
    ll ans=INF;
    for(ll i=0;i<s.lg-t.lg+1;i++){
        string ss=s.substr(i,t.lg);
        ll res=0;
        for(ll j=0;j<t.lg;j++){
            if(t[j]!=ss[j])res++;
        }
        chmin(ans,res);
    }
    cout<<ans<<endl;
    //------------------------------
    //fclose(stdin);
    //fclose(stdout);
    //ll end_t=clock();cout<<"time="<<end_t-begin_t<<"ms"<<endl;
    //------------------------------- 
    return 0;
}
//----------------------------------------------------------------------











































Measured memory_bytes: 3648
#include <iostream>

using namespace std;

int main() {

	int a, b, c, N;

	cin >> N;

	for(int i=0; i<N; i++) {
		cin >> a >> b >> c;
		if(a*a==b*b+c*c)
			cout << "YES" << endl;
		else if(b*b==c*c+a*a)
			cout << "YES" << endl;
		else if(c*c==a*a+b*b)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
}

Measured memory_bytes: 0
package main
import . "fmt"
func main() {
  var a,b,k,d int
  Scan(&a,&b,&k)
  d = gcd(a,b)
  for i:=d;i>0;i-- {
    if d%i == 0 { k-- }
    if k == 0 {
      d = i
      break
    }
  }
  Println(d)
}
func gcd(x int,y int) int {
  if x < y { return gcd(y,x) }
  if x%y == 0 { return y }
  return gcd(y,x%y)
}

Measured memory_bytes: 512