akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define pii pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define mp make_pair
#define bit(n) (1LL<<(n))
#define F first
#define S second
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll INF = 1LL<<60;
const ll mod = (int)1e9 + 7;

/*
テストケース全てに目を通す
テストケースが2個以下だったらなんかある
N最小のコーナーケースがないか調べる
制約をしっかりと確認する（1からNまでの順列、全て異なる値などの制約も含め）
制約のn*mとn,mを読み違えない
操作の逆順を考える
オーバーフローしないか確かめる
Codeforcesではscanfを使う
modの引き算には+modをする
エラー出力は消す
エラー出力を消せ！！！！！
 */

int main() {
    int m1,d1;
    int m2,d2;
    cin >> m1 >> d1;
    cin >> m2 >> d2;
    if(m1==m2)cout << 0;
    else cout << 1;
    


}

/*
cout << fixed;
cout << setprecision(n) << ans;
*/


Measured memory_bytes: 256
N,M=map(int, input().split())
e =[]
for i in range(M):
  p,y = map(int, input().split())
  e.append([p,y,i])
e.sort()

count =1
pre = e[0][0]
for i in e:
  if pre != i[0]:
    count = 1
  i.append(format(str(i[0]), '0>6')+format(str(count), '0>6'))
  count += 1
  pre = i[0]
  
e.sort(key = lambda x:x[2])

for i in e:
  print(i[3])






Measured memory_bytes: 34604
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main(void) {
	int n=0;
	scanf("%d", &n);
	int info[4][3][10] = { 0 };
	int b, f, r, v;
	for (int i = 0; i < n; i++) {
		scanf("%d %d %d %d", &b, &f, &r, &v);
		info[b-1][f-1][r-1] += v;
	}
	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < 3; j++) {
			for (int k = 0; k < 10; k++) {
				printf(" %d", info[i][j][k]);
			}
			printf("\n");
		}
		if (i != 3) {
			printf("####################\n");
		}
	}
	return 0;
}

Measured memory_bytes: 2668
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define gc getchar()
#define pc(x) putchar(x)
template<typename T> void scan(T &x){x = 0;bool _=0;T c=gc;_=c==45;c=_?gc:c;while(c<48||c>57)c=gc;for(;c<48||c>57;c=gc);for(;c>47&&c<58;c=gc)x=(x<<3)+(x<<1)+(c&15);x=_?-x:x;}
template<typename T> void printn(T n){bool _=0;_=n<0;n=_?-n:n;char snum[65];int i=0;do{snum[i++]=n%10+48;n/= 10;}while(n);--i;if (_)pc(45);while(i>=0)pc(snum[i--]);}
template<typename First, typename ... Ints> void scan(First &arg, Ints&... rest){scan(arg);scan(rest...);}
template<typename T> void print(T n){printn(n);pc(10);}
template<typename First, typename ... Ints> void print(First arg, Ints... rest){printn(arg);pc(32);print(rest...);}

using namespace std;
using ll = long long;

int n, ans;
ll d, x, y;

int main(){
	scan(n, d);
	while(n--){
		scan(x, y);
		if(x*x + y*y <= d*d)
			ans++;
	}
	print(ans);
}

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

int n;
char s[11];
int cnt[555];

int main() {
	scanf("%d", &n);
	for(int i=0;i<n;i++) {
		scanf("%s", s);
		cnt[s[0]] ++;
	}
	printf("AC x %d\n", cnt['A']);
	printf("WA x %d\n", cnt['W']);
	printf("TLE x %d\n", cnt['T']);
	printf("RE x %d\n", cnt['R']);
	
	return 0;
}

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

int main()
{   
    int x, y;
    
    for (int i = 1, t; ;t++) {
        cin >> x >> y;
        if (x == 0 && y == 0)   break;
        if (x > y) {
            int n;
            n = x;
            x = y;
            y = n;
        }
        cout << x << ' ' << y << '\n';

    }
    return 0;
}


Measured memory_bytes: 3088
import sys

sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return list(map(int, sys.stdin.readline().split()))
def II(): return int(sys.stdin.readline())
def LS(): return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]

def main():
    n = II()
    ps= LI()
    mins = []
    min_ = 10000000
    for i, v in enumerate(ps):
        if min_ > v:
            mins.append(v)
            min_ = v
        else:
            mins.append(min_)
    count = 0
    for i in range(n):
        if mins[i] >= ps[i]:
            count += 1
    print(count)


if __name__ == '__main__':
    main()

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

int main() {
	int N;
	cin >> N;
	long long ans = 0;
	for (int i = 1; i < N + 1; i++) {
		if ((i % 3) == 0 || (i % 5) == 0) {
			continue;
		} else {
			ans += i;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 3652
"""#################################################################
【ABC121】
B_Can_you_solve_this
#################################################################"""

#インポート
import sys

#入力用
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def II(): return int(input())
def S(): return input()

N, M, C = MI()
B = LI()
cnt = 0
for i in range(N):
    sum = 0
    A = LI()
    for j in range(M):
        sum += A[j] * B[j]
    if sum + C > 0:
        cnt += 1
print(cnt)

Measured memory_bytes: 3064
from bisect import bisect_left
from collections import defaultdict
d = defaultdict(list)

S = input()
T = input()

# 文字列の各文字がどのインデックスにあるか辞書化する
for i in range(len(S)):
    d[S[i]].append(i)


NoFind = False

sequence = 1  # 文字列の連続数
index = -1
for i in range(len(T)):
    if len(d[T[i]]) == 0:
        NoFind = True
        break
    find = bisect_left(d[T[i]], index)
    if find != len(d[T[i]]):
        index = d[T[i]][find] + 1
    else:  # 見つからなかったので文字列を追加
        sequence += 1
        index = -1
        find = bisect_left(d[T[i]], index)
        index = d[T[i]][find] + 1 
            
if NoFind:
    print(-1)
else:
    print(len(S)*(sequence-1) + index)

Measured memory_bytes: 8052
#include<stdio.h>

int main(void){
    
    int N,A,B,NA;

    scanf("%d %d %d",&N,&A,&B);

    NA = N * A;

    if(NA < B){
        printf("%d",NA);
    }else{
        printf("%d",B);
    }
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) (vec).begin(),(vec).end()
#define int long long

signed main(){
    int n;cin>>n;
    if(n%2==1){cout<<0<<endl;return 0;}
    n/=2;
    int ans=0;
    while(n){
        ans+=n/5;
        n/=5;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e8;
int main(){
	int n;
	while(cin>>n,n){
		vi a(n);
		rep(i,n){
			string s;
			cin>>s;
			if(s[1]=='u')a[i]=1;
		}
		int co=0;
		rep(i,a.size()-1)if(a[i]+a[i+1]==0||a[i]+a[i+1]==2)co++;
		cout<<co<<endl;
	}
}

Measured memory_bytes: 1204
import sys, math
import bisect
sys.setrecursionlimit(500000)
MOD = 10**9+7

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]

def main():
    N = ii()
    A, B, C = [sorted(list(mi())) for i in range(3)]
    la = [bisect.bisect_left(A, b) for b in B]
    lc = [N-bisect.bisect_right(C, b) for b in B]
    print(sum(la[i]*lc[i] for i in range(N)))

if __name__ == '__main__':
    main()

Measured memory_bytes: 107784
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

int A[100010];
int main() 
{
	int N, T;
	cin >> N >> T;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	int num = mod, cnt = 0, point = 0;
	for (int i = 0; i < N; i++) {
		num = min(num, A[i]);
		point = max(point, A[i] - num);
	}
	num = mod;
	for (int i = 0; i < N; i++) {
		num = min(num, A[i]);
		if (A[i] - num == point) cnt++;
	}
	cout << cnt << endl;
}

Measured memory_bytes: 640
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
using ll = long long;
using VL=vector<ll>;

#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, m, n) for(int i = m;i < n;i++)
const long long INF =  999999999;

int main(){
  ll h=1,w=1;
  bool start=true;
  while(h!=0 || w!=0){
    if(start)start=false;
    else cout <<endl;
    cin >>h>>w;
    REP(i,h){
      REP(j,w){
        if(i==0 || j==0 || i==h-1 || j==w-1){
          cout <<"#";
        }else{
          cout <<".";
        }
      }
      cout <<endl;
    }
  }
}



Measured memory_bytes: 3092
//tricky question refer h_p_s and revise
// also see editorial
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll M=998244353;
ll dp[3001][3001];
int main ()
{
    ll n,sum;
    cin>>n>>sum;
    vector<ll> v(n);
    for(ll i=0;i<n;i++)
    cin>>v[i];
    memset(dp,0,sizeof(dp));
    dp[0][0]=1;
    for(ll i=1;i<=n;i++)
    {
        for(ll j=0;j<=sum;j++)
        {
            dp[i][j]=(2*dp[i-1][j])%M;
            if(j-v[i-1]>=0)
            {
                dp[i][j]=(dp[i][j]+dp[i-1][j-v[i-1]])%M;
            }
        }
    }
    cout<<dp[n][sum];
    return 0;
}

Measured memory_bytes: 73996
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>
#include <stdbool.h>

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

//qsort(str, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}
int int_sort( const void * a , const void * b ) {return strcmp(( char * )a , ( char * )b );}
int count_digit(int a){int i=0;while(a!=0){a=a/10;i++;}return i;}
int euclid( int a, int b ){int temp;if(a<b){temp=a;a=b;b=temp;}if(b<1)return -1;if(a%b==0) return b;return euclid(b,a%b);}

int main(void){
 
    int x, a, b;
    int j;
    
    scanf("%d%d%d", &x, &a, &b);
    
    if (abs(a-x)<abs(b-x)) {
        printf("A");
    } else {
        printf("B");
    }
    
    return 0;
}



Measured memory_bytes: 1620
def main():
    S=set(list(input()))
    flag=0
    if len(S)%2:
        flag=1
    if ('N' in S and ('W' in S or 'E' in S)) or ('S' in S and ('W' in S or 'E' in S)):
        flag=1
    if len(S)==4:
        flag=0
    print('No' if flag else 'Yes')

main()

Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<vector>
#include <algorithm>
using namespace std;

int main()
{
	// 種類と外周
	int N;
	long long C;
	cin >> N >> C;

	// 位置記録
	vector<long long> x;
	// カロリー記録
	vector<int> v;

	for (int i = 0; i < N; i++) {
		long long x_temp;
		int v_temp;
		cin >> x_temp >> v_temp;
		x.push_back(x_temp);
		v.push_back(v_temp);
	}

	// 時計回り、反時計周りの部分和
	vector<long long> right;
	vector<long long> left;
	right.push_back(v[0]);
	left.push_back(v[N - 1]);

	for (int i = 1; i < N; i++) {
		right.push_back(right[i - 1] + v[i]);
		left.push_back(left[i - 1] + v[N - 1 - i]);
	}
	reverse(left.begin(), left.end());

	//f(a) : v[0]+v[1]+...+v[a]-x[a]の最大値
	vector<long long> r_col;
	vector<long long> l_col;

	r_col.push_back(right[0] - 2 * x[0]);
	l_col.push_back(left[N - 1] - 2 * (C - x[N - 1]));
	for (int i = 1; i < N; i++) {
		r_col.push_back(max(r_col[i - 1], right[i] - 2 * x[i]));
		l_col.push_back(max(l_col[i - 1], left[N - 1 - i] - 2 * (C - x[N - 1 - i])));
	}
	reverse(l_col.begin(), l_col.end());

	long long ans = 0;
	//右回りのみor左回りのみ
	for (int i = 0; i < N; i++) {
		ans = max(ans, right[i] - x[i]);
		ans = max(ans, left[i] - (C - x[i]));
	}

	//両方の時
	for (int i = 0; i < N; i++) {
		if (i < N - 1) ans = max(ans, right[i] - x[i] + l_col[i + 1]);
		if (0 < i) ans = max(ans, left[i] - (C - x[i]) + r_col[i - 1]);
	}
	cout << ans << endl;
	return 0;
}




Measured memory_bytes: 5748
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define reps(i,s,n) for (int i = (s); i <= (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {

    int N, K;
    cin >> N >> K;
    int h[N];
    for(int i = 0; i < N; i++){
        cin >> h[i];
    }
    sort(h, h+N);
    int min_diff = 1e9;
    for(int i = 0; i <= N - K; i++){
        int diff = h[i + (K - 1)] - h[i];
        min_diff = min(min_diff, diff);
    }
    cout << min_diff << endl;

    return 0;
}

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

int main(){
    int H,W;
    while(1){
        cin>>H>>W;
        if(H==0&&W==0)break;
        for(int i=0;i<H;i++){
            for(int j=0;j<W;j++){
                cout<<"#";
            }
            cout<<"\n";
        
        }
        cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 3092
/*author: hyperion_1724
  date: 
*/

//Optional FAST

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")

//Required Libraries

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

//Required namespaces

using namespace std;
using namespace __gnu_pbds;

//Required defines

#define endl '\n'

#define READ(X) cin>>X;
#define READV(X) long long X; cin>>X;
#define READAR(A,N) long long A[N]; for(long long i=0;i<N;i++) {cin>>A[i];}
#define rz(A,N) A.resize(N);
#define sz(X) (long long)(X.size())
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define trav(x,A) for(auto &x:A)
#define FORI(a,b,c) for(long long a=b;a<c;a++)
#define FORD(a,b,c) for(long long a=b;a>c;a--)

//Required typedefs

typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
typedef vector<int> veci;
typedef vector<long long> vecl;

//Required Constants

const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);
const long long INIT=(long long)(1e6+1);

//Required Functions

ll power(ll x,ll y) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2) % MOD; 
    p = (p * p) % MOD; 
  
    return (y%2 == 0)? p : (x * p) % MOD; 
}
ll modInverse(ll a) 
{ 
   return power(a,MOD-2); 
   
}

//Work

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

 
//-----------------------------------------------------------------------------------------------------------//

    READV(H);
    ll ans=0;
    ll prev=1;
    while (H>0)
    {
        ans+=prev;
        H=H/2;
        prev=prev*2;
    }
    cout<<ans<<endl;
    

//-----------------------------------------------------------------------------------------------------------//


    
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
 
int main(void) {
    int n,p;
    
    while (1) {
       scanf("%d%d", &n, &p);
       if (!n && !p) break;
       
       int player[50] = {0};
       int stone = p;
       int i;
       
       for(i = 0; player[i] != p; i = (i+1) % n)
          if(stone > 0){
          stone--;
          player[i]++;
          }
          else if(stone == 0){
          	stone = player[i];
          	player[i] = 0;
          }
       
       printf("%d\n",i);
    }
       return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    ll x,k,d;
    cin>>x>>k>>d;
    
    if(x==0)
    {
        if(k%2==0)
            cout<<"0"<<endl;
        else
            cout<<d<<endl;
    }
    else if(x>0)
    {
        ll c;
        c=x/d;
        if(c>k)
        {
            cout<<x-k*d<<endl;
        }
        else if(c==k)
        {
            cout<<x%d<<endl;
        }
        else
        {
            k=k-c;
            if(k%2==0)
            {
                cout<<x%d<<endl;
            }
            else
            {
                ll ans=(d-x%d);
                cout<<ans<<endl;
            }
        }
    }
    else
    {
        x=x*-1;
        ll c;
        c=x/d;
        if(c>k)
        {
            ll ans=(x-k*d);
            cout<<x-k*d<<endl;
        }
        else if(c==k)
        {
            ll ans=(x%d);
            cout<<ans<<endl;
        }
        else
        {
            k=k-c;
            if(k%2==0)
            {   
                ll ans=(x%d);
                cout<<ans<<endl;
            }
            else
            {
                ll ans=d-x%d;
                cout<<ans<<endl;
            }
        }
    }
    return 0;
}

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

#define select(_1, _2, x, ...) x

#define repn(i, n) for (int i = 0; i < (n); i++)
#define repr(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, ...) select(__VA_ARGS__, repr, repn)(i, __VA_ARGS__)

#define rrepn(i, n) for (int i = (n - 1); i >= 0; i--)
#define rrepr(i, a, b) for (int i = (b - 1); i >= (a); i--)
#define rrep(i, ...) select(__VA_ARGS__, rrepr, rrepn)(i, __VA_ARGS__)

#define umax(m, x) (m = max(m, x));
#define umin(m, x) (m = min(m, x));

#define rng(v) v.begin(), v.end()
#define rrng(v) v.rbegin(), v.rend()

#define debug(x) cerr << #x << " = " << x << endl

using namespace std;

using ll = long long int;

using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vb = vector<bool>;

using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvs = vector<vector<string>>;
using vvb = vector<vector<bool>>;

const int INF = 1e9;
const ll LINF = 1e18;

inline void yn(bool f) { cout << (f ? "Yes" : "No") << endl; }


int main() {
    ll n, m;
    cin >> n >> m;

    vl a(n);
    int sum = 0;
    rep(i, n) {
        cin >> a[i];
        sum += a[i];
    }

    int cnt = 0;

    rep(i, n) {
        if (a[i] >= (double)sum / (double)(4 * m)) {
            cnt++;
        }
    }

    yn(cnt >= m);

    return 0;
}


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

const int INF = 1000000000;

int main()
{
    int h, w;
    cin >> h >> w;
    char c[305][305];
    for(int i = 0; i < h; i++) for(int j = 0; j < w; j++) cin >> c[i][j];
    int ans = 0;
    for(int j = 0; j < w - 1; j++){
        int d[305][305];
        for(int k = 0; k <= h; k++){
            d[k][0] = 0;
            for(int i = 0; i <= h - k; i++){
                if(c[i + k][j] == c[i][j + 1]) d[k][i]++;
                d[k][i + 1] = d[k][i];
            }
        }
        int e[305][305];
        for(int k = 0; k <= h; k++){
            e[k][0] = 0;
            for(int i = 0; i <= h - k; i++){
                if(c[i][j] == c[i + k][j + 1]) e[k][i]++;
                e[k][i + 1] = e[k][i];
            }
        }
        int dp[305][305];
        for(int i = 0; i <= h; i++) for(int j = 0; j <= h; j++) dp[i][j] = INF;
        dp[0][0] = 0;
        for(int l = 0; l <= h; l++){
            for(int r = 0; r <= h; r++){
                if(r > 0){
                    if(r >= l) dp[l][r] = min(dp[l][r], dp[l][r - 1] + e[r - l][l - 1]);
                    else dp[l][r] = min(dp[l][r], dp[l][r - 1] + d[l - r][r - 1]);
                }
                if(l > 0){
                    if(r >= l) dp[l][r] = min(dp[l][r], dp[l - 1][r] + e[r - l][l - 1]);
                    else dp[l][r] = min(dp[l][r], dp[l - 1][r] + d[l - r][r - 1]);
                }
            }
        }
        ans += dp[h][h];
    }
    cout << ans << endl;
}

Measured memory_bytes: 1408
#include <stdio.h>

int main(void){
 int i,j;
 for(i=1;i<10;i++){
  for(j=1;j<10;j++){
   printf("%d",i);
   printf("x%d",j);
   printf("=%d",i*j);
   printf("\n");
  }
 }
 return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>

long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
	const static long long MOD = 1000000007;

	int N, K;
	std::cin >> N >> K;
	COMinit();

	for (int i = 1; i <= K; i++)
	{
		std::cout << (COM(N - K + 1, i) * COM(K - 1, i - 1)) % MOD << '\n';
	}
	return 0;
}

Measured memory_bytes: 12288
n = int(input())
A = [0]*n

for i in range(n):
	A[i] = int(input())

SO = A[:]
SO.sort()

##
def check(mid, now):
	return now >= SO[mid]


def binarySearch(small, big, now):
	mid = (big + small) // 2
	if big == small or big == small + 1:
		if SO[big] == now:
			return big
		else:
			return small
	else:
		if check(mid, now):
			return binarySearch(mid, big, now)
		else:
			return binarySearch(small, mid, now)


##
ans = 0
for i in range(n):
	now = A[i]
	gi = binarySearch(0, n-1, now)
	if i % 2 != gi % 2:
		ans += 1


print(ans // 2)


Measured memory_bytes: 8368
#include <bits/stdc++.h>
#define PI 3.14159265359
#define NIL -1
using namespace std;
const int64_t MOD = 1e9 + 7;

int main() {
	int A, B;
	cin >> A >> B;

	A += B;

	if (A > 9) {
		cout << "error" << endl;
	}
	else {
		cout << A << endl;
	}
}

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

using namespace std;
typedef long long ll;
//typedef unsigned long long ll;

#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<ll, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX / 10;
//const ll INF = (1ll << 31) - 1;
//const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
//typedef pair<int, int> P;
//typedef pair<double, double> P;

bool contain(set<P> &s, P a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);


void print_line(vector<ll> &line) {
    if (line.size() == 0ll) {
        cout << endl;
        return;
    }
    for (ll i = 0; i < line.size(); i++) {
        cout << line[i];
        if (i == line.size() - 1) cout << endl;
        else cout << ' ';
    }
}


typedef priority_queue<long long, vector<long long>, greater<long long>> PQ_ASK;
const int mod = 1000000007;

struct Item {
    int value;
    ll weight;
};

int main() {

    int n;
    ll w;
    cin >> n >> w;

    vector<Item> items(n);
    rep(i, n) cin >> items[i].value >> items[i].weight;

    vector<vector<ll>> dp(n + 1, vector<ll>(10001, INF));
    dp[0][0] = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 10001; j++) {
            if (dp[i][j] == INF) continue;
            {
                // 入れない
                cmin(dp[i + 1][j], dp[i][j]);
            }
            {
                // 入れる
                Item item = items[i];
                int next_value = j + item.value;
                ll now_weight = dp[i][j];
                ll next_weight = now_weight + item.weight;
                assert(next_value <= 10001);
                cmin(dp[i + 1][next_value], next_weight);
            }
        }
    }

    int ans = 0;
    rep(i, 10001) if (dp[n][i] <= w) ans = i;

    cout << ans << endl;
}




Measured memory_bytes: 10796
N = int(input())
D = N if N % 2 == 1 else N+1
edges = [str(i)+" "+str(j) for i in range(1, D)
         for j in range(i+1, D) if i+j != D]
edges2 = [str(v)+" "+str(N) for v in range(1, N)] if N % 2 == 1 else []
print(len(edges)+len(edges2))
print("\n".join(edges+edges2))


Measured memory_bytes: 3440
import java.util.*;
import java.io.*;
import static java.lang.Math.*;

class Main {

    public static void main( final String[] args ) {

	final Scanner stdin = new Scanner( System.in );
	final int n = Integer.parseInt( stdin.nextLine() );

	for ( int t = 0; t < n; t++ ) {

	    final String input = stdin.nextLine();
	    final char[] train = new char[53];
	    int index = 26;
	    train[index] = input.charAt( 0 );
	    
	    for ( int i = 1; i < ( input.length() + 2 ) / 3; i++ ) {
		if ( input.substring( i * 3 - 2, i * 3 ).equals( "->" ) ){
		    index++;
		} else {
		    index--;
		}
		train[index] = input.charAt( i * 3 );
	    }
	    
	    index = 0;
	    while ( train[index] == 0 ) {
		index++;
	    }
	    while ( train[index] > 0 ) {
		System.out.print( train[index] );
		index++;
	    }
	    System.out.println();
	}	
    }    
}

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

using namespace std;

void cldflm()
{
	std::ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

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

int main()
{

	cldflm();

	string str1, str2;

	cin >> str1 >> str2;

	int n = str1.length(), count = 0;

	for (int i = 0; i < n; i++)
	{
		if (str1[i] != str2[i])
			count++;
	}


	cout << count;

	return 0;
}



Measured memory_bytes: 3804
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

# -*- coding: utf-8 -*-


class FactMod():
    '''
    modの値が素数の時のfactと組み合わせを求める
    フェルマーの小定理を用いているため、modが素数以外の時は使えない
    '''

    def __init__(self, n, mod):
        '''
        コンストラクタ
        f:nまでの i!の値を　配列に入れる
        inv: (i!)^-1　の値を配列に入れる
        '''
        self.mod = mod
        self.f = [1]*(n+1)
        for i in range(1, n+1):
            self.f[i] = self.f[i-1]*i % mod

        self.inv = [pow(self.f[-1], mod-2, mod)]
        for i in range(1, n+1)[::-1]:
            self.inv.append(self.inv[-1]*i % mod)
        self.inv.reverse()

    def fact(self, n):
        '''
        n!の値を返す
        '''
        return self.f[n]

    def comb(self, n, r):
        '''
        nCrの値を返す
        '''
        ret = self.f[n] * self.inv[n-r]*self.inv[r]
        ret %= self.mod
        return ret

    def perm(self, n, r):
        """
        nPrの値を返す
        """
        ret = self.f[n] * self.inv[n-r]
        ret %= self.mod
        return ret


X, Y = map(int, input().split())

x = (2*Y-X)/3
y = (2*X-Y)/3

if 0 <= x and x == int(x) and 0 <= y and y == int(y):
    x = int(x)
    y = int(y)
    F = FactMod(x+y+1, 10**9+7)
    ans = F.comb(x+y, x)
else:
    ans = 0
print(ans)


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

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, k;
    cin >> n >> k;
    vector <int> h(n), dp(n+1, 1e9+7);
    for (int i = 0; i < n; ++i) cin >> h[i];
    dp[0] = 0;
    for (int i = 0; i < n; ++i)
        for (int j = 1; j <= k; ++j)
            if (i+j < n)
                dp[i+j] = min(dp[i+j], dp[i]+abs(h[i]-h[i+j]));
    cout << dp[n-1] << '\n';
}


Measured memory_bytes: 3956
#include<cstdio>
using namespace std;
int n,a[200001],sum,b[200001],ans;
inline int rd()
{
	char tmp=getchar();
	int ddd=0;
	while('0'>tmp&&tmp<'9')
	{
		tmp=getchar();
	}
	while('0'<=tmp&&tmp<='9')
	{
		ddd=(ddd<<3)+(ddd<<1)+(tmp^48);
		tmp=getchar();
	}
	return ddd;
}
int main()
{
	n=rd();
	for(int i=1;i<=n;++i)
	{
		a[i]=rd();
	}
	for(int i=n;i>0;--i)
	{
		sum=0;
		for(int j=i<<1;j<=n;j+=i)
		{
			sum+=b[j];
		}
		if(sum%2!=a[i])
		{
			b[i]=1;
			++ans;
		}
	}
	printf("%d\n",ans);
	for(int i=1;i<=n;++i)
	{
		if(b[i])
		{
			printf("%d ",i);
		}
	}
	return 0;
}


Measured memory_bytes: 2304
n=int(input())
abc=[list(map(int,input().split())) for _ in range(n)]
dp=[[0,0,0] for _ in range(n+1)]
for i in range(1,n+1):
    dp[i][0]=max(dp[i-1][1]+abc[i-1][0],dp[i-1][2]+abc[i-1][0])
    dp[i][1]=max(dp[i-1][0]+abc[i-1][1],dp[i-1][2]+abc[i-1][1])
    dp[i][2]=max(dp[i-1][0]+abc[i-1][2],dp[i-1][1]+abc[i-1][2])
print(max(dp[n]))


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

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define pb push_back
#define show_table(n, k, table) rep(i,n){ rep(j,k) cout << table[i][j] << " "; cout << endl;}

template<class T> void chmax(T& a,const T& b){a=max(a,b);}
template<class T> void chmin(T& a,const T& b){a=min(a,b);}

using namespace std;

using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;

const int mod=1e9+7,INF=1<<30;
const double EPS=1e-12,PI=3.1415926535897932384626;
const ll lmod = 1e9+7,LINF=1LL<<60;
const int MAX_N = 100005;

ll a[MAX_N];

int main(){
  int N; cin >> N;
  rep(i,N) scanf("%lld",a+i);
  ll ans = 0LL;
  ans += a[0] - 1;
  ll ma = 1LL;
  REP(i,1,N){
    // ma+1以上ずつ減らす
    if(a[i]==ma+1) ma++;
    else if(a[i]>ma+1){
      ans += (a[i]-1)/(ma+1);
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0; i<(int)(n); i++)
#define REP1(i,a,b) for(int i=a; i<=(int)(b); i++)
#define ALL(x) begin(x),end(x)
#define PB push_back
using namespace std;
typedef int64_t LL;
typedef vector<int> VI;
typedef pair<int,int> PII;

template<class T> inline bool chmax( T &a, const T &b ) { return b>a ? a=b,true : false; }
template<class T> inline bool chmin( T &a, const T &b ) { return b<a ? a=b,true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template<class T, class F=less<T>> void sort_uniq( vector<T> &v, F f=F() ) {
    sort(begin(v),end(v),f);
    v.resize(unique(begin(v),end(v))-begin(v));
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
 	int n;
 	cin >> n;
 	map<int,int> mp;
 	REP(i,n) {
 		int a;
 		cin >> a;
 		mp[a]++;
 	}
 	int ans=0;
 	for ( auto& p:mp ) {
 		int a=p.first;
 		int res=p.second;
 		if ( mp.count(a-1) ) {
 			res+=mp[a-1];
 		}
 		if ( mp.count(a+1) ) {
 			res+=mp[a+1];
 		}
 		chmax(ans, res);
 	}
 	cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3200
#include <iostream>
#include <algorithm>
#include <tuple>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <cassert>

using namespace std;
using ll = long long;

vector<ll> calc_divisor(int n){
    vector<ll> res;
    for(int i = 1; i * i <= n; i++){
        if(n % i == 0){
            res.push_back(i);
            int j = n / i;
            if(j != i) res.push_back(j);
        }
    }
    //sort(res.begin(), res.end());
    return res;
}

int main()
{
    ll n, m;
    cin >> n >> m;
    vector<ll> res = calc_divisor(m);
    ll ans = 1;
    for(auto d : res){
        if(n * d <= m) ans = max(ans, d);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>

int main() {
  int enemy_hp;
  int serval_at;
  int num = 0;
  scanf("%d", &enemy_hp);
  scanf("%d", &serval_at);
  while (enemy_hp>0) {
    enemy_hp -= serval_at;
    num++;
  }
  printf("%d", num);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int n, m, l;
int V;

int vv(int v, int mon)
{
    return v * (l + 1) + mon;
}

vector<int> dijkstra(int s, vector<vector<pair<int, int>>> &edge)
{
    const int INF = 1e9;
    vector<int> d(V, INF);
    d[s] = 0;
    priority_queue<pair<int, int>,vector<pair<int,int>>,greater<pair<int,int>>> que; //cost v
    que.push(make_pair(0, s));

    while (!que.empty())
    {
        auto st = que.top();
        que.pop();
        int v = st.second;
        
        int cost = st.first;
        
        if (d[v] < cost)
            continue;
        for (int i = 0; i < edge[v].size(); i++)
        {
            int to = edge[v][i].second;
            if (cost + edge[v][i].first < d[to])
            {
                d[to] = cost + edge[v][i].first;
                que.push(make_pair(d[to], to));
            }
        }
    }
    return d;
}

int main()
{
    while (true)
    {
        cin >> n >> m >> l;
        if (n == 0)
            break;
        V = n * (l + 1);
        vector<vector<pair<int, int>>> edge(V); //cost,to
        for(int i=0;i<n;i++){
            for(int j=1;j<=l;j++){
                edge[vv(i,j)].push_back(make_pair(0,vv(i,j-1)));
            }
        }
        for (int i = 0; i < m; i++)
        {
            int a, b, d, e;
            cin >> a >> b >> d >> e;
            a--, b--;
            for (int j = 0; j <= l; j++)
            {
                edge[vv(a, j)].push_back(make_pair(e, vv(b, j)));
                edge[vv(b, j)].push_back(make_pair(e, vv(a, j)));
                if (j - d >= 0)
                {
                    edge[vv(a, j)].push_back(make_pair(0, vv(b, j - d)));
                    edge[vv(b, j)].push_back(make_pair(0, vv(a, j - d)));
                }
            }
        }
        vector<int> d = dijkstra(vv(0, l), edge);
        int res = d[vv(n-1,0)];
        cout << res << endl;
    }
    return 0;
}

Measured memory_bytes: 8716
int main() {
    int n,d,x,a[100],sum,i;
    scanf("%d%d%d",&n,&d,&x);
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    sum=0;
    for(i=0;i<n;i++){
        if(d%a[i]==0){
            sum+=d/a[i];
        }else{
            sum+=d/a[i]+1;
        }
    }
    printf("%d\n",sum+x);
	return 0;
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

typedef bitset<800>bs;
bs X;
int H,W,h,w;

int A[888][888];
int a[888][888];

bs latte[888];

bs malta[888][62];

int conv(char c){
   if(isupper(c))return c-'A';
   if(islower(c))return 26+c-'a';
   if(isdigit(c))return 52+c-'0';
   return -1;
}

signed main(){
    cin>>W>>H>>w>>h;

    rep(i,H){
        string s;cin>>s;
        rep(j,W)A[i][j]=conv(s[j]);
    }

    rep(i,h){
        string s;cin>>s;
        rep(j,w)a[i][j]=conv(s[j]);
    }

    rep(i,W)X[i]=1;

    rep(i,H)latte[i]=X;

    rep(i,H)rep(j,W)if(i+h>H||j+w>W)latte[i][j]=0;

    rep(i,H){
        rep(j,W){
            if(A[i][j]>=0)malta[i][A[i][j]][j]=1;
            else rep(k,62)malta[i][k][j]=1;
        }
    }

    for(int j=0;j<h;j++){
        for(int i=j;i<H;i++){
            for(int k=0;k<w;k++){
                if(a[j][k]>=0)latte[i-j]&=malta[i][a[j][k]]>>k;
            }
        }
    }

    int ans=0;
    rep(i,H)rep(j,W)ans+=latte[i][j];
    cout<<ans<<endl;
    return 0;
}

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

int main(){
    int a,b,c,d;
    cin >>a>>b>>c>>d;
    while(1){
        c -= b;
        if(c<=0){
            cout << "Yes" << endl;
            return 0;
        }
        a -= d;
        if(a<=0){
            cout << "No" <<endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3624
#include<iostream>
#include<iomanip>
#define pi acos(-1.0)
#include<cmath>
using namespace std;

int main(){
	double r;
	//double pi = 3.14159265;
	cin >> r;
	cout << setprecision(6) << fixed << r*r*pi << " " << setprecision(6) << fixed << 2*r*pi << endl;
}

Measured memory_bytes: 3232
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <cmath>
#include <cassert>
#include <string>
#include <iostream>

using namespace std;
typedef long long ll;
ll MOD = 1000000007;
typedef pair<int, int> P;
#define INF 1e9

template <class Monoid>
struct SegTree
{
   using Func = function<Monoid(Monoid, Monoid)>;
   const Func F;
   const Monoid UNITY;
   int SIZE_R;
   vector<Monoid> dat;

   SegTree(int n, const Func f, const Monoid &unity) : F(f), UNITY(unity) { init(n); }
   void init(int n)
   {
      SIZE_R = 1;
      while (SIZE_R < n)
         SIZE_R *= 2;
      dat.assign(SIZE_R * 2, UNITY);
   }

   /* set, a is 0-indexed */
   void set(int a, const Monoid &v) { dat[a + SIZE_R] = v; }
   void build()
   {
      for (int k = SIZE_R - 1; k > 0; --k)
         dat[k] = F(dat[k * 2], dat[k * 2 + 1]);
   }

   /* update a, a is 0-indexed */
   void update(int a, const Monoid &v)
   {
      int k = a + SIZE_R;
      dat[k] = v;
      while (k >>= 1)
         dat[k] = F(dat[k * 2], dat[k * 2 + 1]);
   }

   /* get [a, b), a and b are 0-indexed */
   Monoid get(int a, int b)
   {
      Monoid vleft = UNITY, vright = UNITY;
      for (int left = a + SIZE_R, right = b + SIZE_R; left < right; left >>= 1, right >>= 1)
      {
         if (left & 1)
            vleft = F(vleft, dat[left++]);
         if (right & 1)
            vright = F(dat[--right], vright);
      }
      return F(vleft, vright);
   }
   inline Monoid operator[](int a) { return dat[a + SIZE_R]; }

   /* debug */
   void print()
   {
      for (int i = 0; i < SIZE_R; ++i)
      {
         cout << (*this)[i];
         if (i != SIZE_R - 1)
            cout << ",";
      }
      cout << endl;
   }
};

ll a[101010], ruiseki[101010];

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

   int n;
   cin >> n;
   SegTree<int> seg(n, [](int a, int b) { return __gcd(a, b); }, 0);

   for (int u = 0; u < n; u++)
   {
      cin >> a[u];
      seg.set(u, a[u]);
   }
   seg.build();

   int ans = 0;
   for (int i = 0; i < n; i++)
   {
      int a = seg.get(0, i);
      int b = seg.get(i + 1, n);
      ans = max(ans, __gcd(a, b));
   }

   cout << ans << endl;
}

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

const int N = (int) 3e5 + 5;
const long long INF = (long long) 1e18;

int n;
int a[N];
long long dpLeft[N], dpRight[N];

void solveLeft() {
	multiset <int> myset;
	multiset <int> :: iterator it;
	long long res = 0;
	for (int i = 1; i <= n; i++) {
		myset.insert(a[i]);
		res += a[i];
	}	
	dpLeft[n] = res;
	for (int i = n + 1; i <= 2 * n; i++) {
		it = myset.begin();
		if (*it >= a[i]) {
			dpLeft[i] = res;
			continue;
		} else {
			res = res - *it + a[i];
			myset.erase(it);
			myset.insert(a[i]);
			dpLeft[i] = res;
		}
	}
}

void solveRight() {
	multiset <int> myset;
	multiset <int> :: iterator it;
	long long res = 0;
	for (int i = 3 * n; i > 2 * n; i--) {
		myset.insert(a[i]);
		res += a[i];
	}	
	dpRight[2 * n + 1] = res;
	for (int i = 2 * n; i > n; i--) {
		it = myset.end();
		it--;
		if (*it <= a[i]) {
			dpRight[i] = res;
			continue;
		} else {
			res = res - *it + a[i];
			myset.erase(it);
			myset.insert(a[i]);
			dpRight[i] = res;
		}
	}
}

int main() {
	//freopen(".inp", "r", stdin); 
	// freopen(".out", "w", stdout);
	scanf("%d", &n);
	for (int i = 1; i <= 3 * n; i++) {
		scanf("%d", &a[i]);
	}
	solveLeft();
	solveRight();
	long long ans = -INF;
	for (int i = n; i <= 2 * n; i++) {
		ans = max(ans, dpLeft[i] - dpRight[i + 1]);
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 8960
import java.util.*;
import java.math.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
 
        while(sc.hasNext()){
          String str = sc.next();
          str = str.replaceAll("apple", "alefiuahreliuafhlkejhflahefliuahelfahlrkejfhkhiauerwhfalirhgliurahgliuhglkajhgrlajkhglrkjghalkrjghalurghli");
          str = str.replaceAll("peach", "apple");
          str = str.replaceAll("alefiuahreliuafhlkejhflahefliuahelfahlrkejfhkhiauerwhfalirhgliurahgliuhglkajhgrlajkhglrkjghalkrjghalurghli", "peach");
          System.out.print(str);
          if(sc.hasNext()){
            System.out.print(" ");
          }
        }
        System.out.println("");
      }
}

Measured memory_bytes: 20908
#include <bits/stdc++.h>
#define _for(i,b,e) for (common_type_t<decltype(b),decltype(e)> i = (b), i ## __end = (e); i < i ## __end; ++ i)
#define FOR(...)   _for (__VA_ARGS__)
#define rep(i,n)   FOR (i, size_t{}, n)
#define ALL(x)     begin (x), end (x)
using namespace std;
using ll = int64_t;

auto main () -> int
{
  cin.tie (nullptr);
  ios::sync_with_stdio (false);

  ll k;
  size_t n;
  cin >> k >> n;

  vector <ll> a (n);
  rep (i, n) cin >> a[i];

  a.push_back (a[0]);

  vector <ll> d(n);
  rep(i, n)
  {
    d[i] = a[i + 1] - a[i];
    while (d[i] < 0) d[i] += k;
  }
  auto max = * max_element (ALL (d));
  cout << k - max << endl;
}


Measured memory_bytes: 4864
//atcoder.jp/contests/abc152/tasks/abc152_a
#include <bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    long long m, n ;
    cin >> m >> n ;
    if(m == n) cout << "Yes" ;
    else cout << "No";
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n  = sc.nextInt();
        int[] a = new int[n+1];
        long ans = 0;
        for (int i = 0; i < n; i++) {
            int x = sc.nextInt();
            if(x > n) ans++;
            else a[x]++;
        }
        for (int i = 1; i <= n; i++) {
            if(a[i] < i) ans += a[i];
            else ans += (long)a[i] - i;
        }

        System.out.println(ans);
        sc.close();

    }

}


Measured memory_bytes: 50664
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scanln(&n)
	if n == 1 {
		fmt.Println("Hello World")
	} else {
		var a, b int
		fmt.Scanln(&a)
		fmt.Scanln(&b)
		fmt.Println(a + b)
	}
}


Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <iomanip>

#define D(x) cout<< #x <<" = "<<x<<"\n"
#define IL(a,n) for (int i=a; i<n; i++)
#define II() ( { int a ; read(a) ; a; } )
#define LL() ( { Long a ; read(a) ; a; } )
#define DD() ({double a; scanf("%lf", &a); a;})

using namespace std;

//Fast Reader
template<class T>inline bool read(T &x){
    int c=getchar();int sgn=1;
    while(~c&&c<'0'||c>'9'){if(c=='-')sgn=-1;c=getchar();}
    for(x=0;~c&&'0'<=c&&c<='9';c=getchar())x=x*10+c-'0'; 
    x*=sgn; return ~c;
}

typedef long long Long;
typedef vector<int> VI;
typedef vector<VI> VVI;

const int INF=2e9;
const int MX=100005;
const int MOD=1000000007;
const double PI=acos(-1.0);

/*_______________________________________________*/


int main()
{

	int n = II();
	int arr[n];
	for(int i = 0; i<n; i++) arr[i] = II();
	int l2r[n],r2l[n];
	l2r[0] = arr[0];
	r2l[n-1] = arr[n-1];
	for(int i = 1; i<n; i++) l2r[i] = __gcd(arr[i],l2r[i-1]);
	for(int i = n-2; i > -1; i--) r2l[i] = __gcd(arr[i],r2l[i+1]);

	int res = 1;
	for(int i = 1; i<n-1; i++) res = max(res,__gcd(l2r[i-1],r2l[i+1]));
	res = max(res,r2l[1]);
	res = max(res,l2r[n-2]);

	printf("%d\n",res);

	return 0;
}

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


int main(int argc, char const *argv[])
{
	int a, p; cin >> a >> p;
	cout << (a * 3 + p) / 2 << endl;
	return 0;
}


Measured memory_bytes: 256
N, K = [int(x) for x in input().split()]
d = []
nums = [0 for i in range(N)]
for i in range(K):
    d = int(input())
    a = [int(x) for x in input().split()]
    for a_i in a:
        nums[a_i - 1] += 1

count = 0
for num in nums:
    if num == 0:
        count += 1
print(count)



Measured memory_bytes: 9188
#include<bits/stdc++.h>
using namespace std;
int main(){
string s;
cin>>s;
int j=0;
for(int i=0;i<s.size();i++){
    if(s[i]=='7'){
        j=1;
        break;
    }
}
if(j==1){
  cout<<"Yes"<<endl;
}
else if(j==0){
   cout<<"No"<<endl;
}
}


Measured memory_bytes: 3628
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<queue>
#include<cmath>
#include<string>
#include<cstring>
using namespace std;
typedef long long ll;
int main()
{  ll i,n,sum=0,t,t1=0,t2,t3;
   cin>>n;
   for(i=2;i*i<n;i++)
   {  if(n%i==0)
      {   t=n/i;
          t2=i;
          if(t%t2==1)
           sum++;
          if(t%t2==0)
          {   while(t)
              { if(t%t2==0)
                   t=t/t2;
                   if(t%t2==1)
                   { sum++;
                     break;
				   }
				   if(t==1)
				    { sum++;
				      break;
				}
				   if(t%t2!=0)
				    break; 
			  }
		  }
           
	      
	  }
     
   }
    if(i*i==n)
     sum+=2;
     else
     sum++;
     for(i=2;i*i<n-1;i++)
      {  if((n-1)%i==0)
            sum+=2;
      }
	  if(i*i==(n-1))
	  sum+=2;
	else
	sum++;
	if(n==2)
	sum--;
	cout<<sum<<endl;
   
}
   

Measured memory_bytes: 256
#include <ios>
#include <iomanip>
#include <iostream>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>
 
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e9)

#define PI (acos(-1))
#define print(x) cout << x << endl
 
ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
typedef pair <ll,ll> P;
 
int main()
{
    ll N;
    cin >> N;
    ll x = 1;
    string ret = "";
    while(N != 0) {
        if (N % abs(2*x) != 0) {
            N -= x;
            ret = "1" + ret;
        } else {
            ret = "0" + ret;
        }
        x *= -2;
    }
    if (ret.size() == 0) ret = "0";
    print(ret);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int A, B;
int main() {
    cin >> A >> B;
    if(A % 3 == 0 || B % 3 == 0 || (A+B) % 3 == 0) {
        cout << "Possible" << endl;
    }else {
        cout << "Impossible" << endl;
    }
}

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

int main() {
  int n;
  cin >> n;
  
  double a;
  double total = 0;
  for (int i; i < n; i++) {
    cin >> a;
    total += 1 / a;
    
  }
  cout << fixed << setprecision(10);
  cout << 1 / total << endl;
}

Measured memory_bytes: 256
N,M = map(int,input().split())
A = [int(input()) for i in range(M)]
n = 0
if M != 0:
    a = b = A[0]
else:
    a = b = -2
c = 0
ans = [0,1]
for i in range(1,N+1):
    if  i == a:
        c = 0
        n += 1
        b = a
        if n <= M-1:
            a = A[n]
    elif i-2 == b:
        c = ans[-1]
    elif i-1 == b :
        c = ans[-2]
    else:
        c  = ans[-1] + ans[-2]
    c %= 10**9 + 7
    ans.append(c)
print(ans[-1])

Measured memory_bytes: 13684