akhauriyash/Code-Regression huggingface dataset:
/*
ID: tohoast1
TASK: gymnastics
LANG: C++
*/
#include <bits/stdc++.h>
#define speedup ios_base::sync_with_stdio(NULL)
#define fin freopen("allcodefs.in", "r", stdin)
#define fout freopen("allcodefs.out", "w", stdout)
#define FILENAME
#define PUBG push_back
#define p_b pop_back
#define mp make_pair
#define fi first
#define se second
#define cls clear
#define INF const int ci = 1e6 + 100
#define K_INF 1e9 + 7
#define time cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"
#define MIN_INT -999999999
#define MOD 1000000007
#define d109 1000000000
#define basay break
#define bmbr exit(0)

using namespace std;
typedef long long LL;
typedef long L;
typedef unsigned long long ULL;
typedef unsigned long UL;
typedef string STR;
int N, x, mx;
STR s;

int main() {
    #ifdef FILENAMEs
        fin;
        fout;
    #endif // FILENAME
    cin >> N >> s;
    for (int i = 0 ; i < N ; ++ i) {
        if (s[i] == 'I') {
            x ++;
            mx = max(mx, x);
        }
        else {
            x --;
            mx = max(mx, x);
        }
    }
    cout << mx;
    ///time;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int M=5005;
int n,k,sum,a[M],dp[M];
void in()
{
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;++i)scanf("%d",&a[i]),a[i]=min(a[i],k),sum+=a[i];
}
void ac()
{
	sort(a,a+n+1);dp[0]=1;
	for(int i=n,flag=1;i>=0;flag=1,sum-=a[i--])
	{
		for(int j=k-1;j>=k-sum&&j>=0;--j)if(dp[j])flag=0;
		if(flag)printf("%d",i),exit(0);
		for(int j=k;j>=a[i];--j)dp[j]|=dp[j-a[i]];
	}
}
int main(){in();ac();}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define co(n) cout<<n<<endl
#define all(n) (n).begin(),(n).end()
#define pb(n,m) n.push_back(m)
#define fix(n) cout<<fixed<<setprecision(n);
using namespace std;
//using bint=boost::multiprecision::cpp_int;
typedef long long ll;
typedef unsigned long long ull;

int main(){
  double a,b,c,d,n; cin>>a>>b>>c>>d;
  n=pow(pow(abs(a-c),2)+pow(abs(b-d),2),0.5);
  fix(12);
  co(n);
  return 0;
}


Measured memory_bytes: 3448
MOD = 10**9+7
l = input()
dp0 = 0; dp1 = 1

for a in l:
    if a == '0':
        dp0 = dp0*3%MOD
    else:
        dp0 = (dp0*3+dp1) % MOD
        dp1 = dp1*2%MOD
print((dp0+dp1)%MOD)

Measured memory_bytes: 39536
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
#include <numeric>
#include <time.h>
#include <chrono>
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define REP(i,a,b) for(ll i=a;i>b;i--)
#define CST(x) cout<<fixed<<setprecision(x)//小数点以下の桁数指定
#define ct(a) cout<<a<<endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define repl(i,l,r) for(int i=(1);i<(r);i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
static const double pi = 3.141592653589793;
using namespace std;
typedef long long ll;
const ll MOD = 998244353;
const ll INF = 1e9 + 7;
const ll mod = 1e9 + 7;

int N;
ll A[200001], B[200001];

int main() {


	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);
	
	cin >> N;
	FOR(i, 0, N) {
		cin >> A[i] >> B[i];
	}
	sort(A, A + N); sort(B, B + N);

	if (N % 2 == 1) {
		cout << B[(N - 1) / 2] - A[(N - 1) / 2]+1 << endl;
	}
	else {
		cout << 1+B[N / 2] + B[N / 2 - 1] - A[N / 2] - A[N / 2 - 1]<<endl;
	}



	return 0;
}


Measured memory_bytes: 6772
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
typedef long long ll;

int main(){
    string S;
    cin >> S;
    int SIZE = S.size();
    int cnt = 0;
    for(int i=0;i<SIZE;i++){
        if(S.at(i) == '0') cnt = cnt + 1;
    }
    cout << 2 * min(cnt,SIZE - cnt) << endl;
}

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


int main()
{
    string s, t;cin>>s>>t;
    int a, b;cin>>a>>b;
    string u;cin>>u;
    if(u==s){
        a-=1;
    }
    if(u==t){
        b-=1;
    }

    cout<<a<<" "<<b;

    return 0;
}

Measured memory_bytes: 256
def calc(n):
    return (1 + n) / 2

def solve():
    n, k = map(int, input().split())

    p = list(map(int, input().split()))

    sum = [0.0]

    for e in p:
        sum.append(sum[-1] + calc(e))

    ans = 0.0
    for i in range(k, len(sum)):
       ans = max(ans, sum[i] - sum[i - k]) 

    print(ans)

def main():
    solve()
    pass

if __name__ == '__main__':
    main()

Measured memory_bytes: 24548
#include<bits/stdc++.h>
using namespace std;
using ll = long long;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("YES")
#define p_no() p("NO")

const ll mod = 1e9 + 7;
const ll inf = 1e18;

ll ll_pow(ll a, ll n){
    ll ans = 1;
    FOR(i, 0, n){
        ans *= a;
        ans %= 13;
    }
    return ans;
}

// a^b mod p
ll mod_pow(ll a, ll b){
    if(b==0) return 1;
 
    // 肩が奇数
    if(b%2==1){
        return a * mod_pow(a, b-1) % 13;
    }
    else{
        return mod_pow(a*a % mod, b/2) % 13;
    }
}

// 左からDP ver

ll dp[100010][13];

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

    // input
    string s; cin >> s;
    ll L = s.size();

    // 左から0桁目
    char c = s[0];
    if(c=='?'){
        FOR(i, 0, 10){
            dp[0][i] = 1;
        }
    }else{
        ll v = c - '0';
        dp[0][v] = 1;
    }

    // 左からi桁目
    FOR(i, 1, L){
        char c = s[i];
        ll v;
        if(c=='?'){
            v = -1;
        }else{
            v = c - '0';
        }

        if(c=='?'){
            FOR(r, 0, 13){
                FOR(v, 0, 10){
                    // v
                    ll j = (r*10+v)%13;
                    dp[i][j] += dp[i-1][r];
                    dp[i][j] %= mod;
                }
            }
        }
        else{
            FOR(r, 0, 13){
                // v
                ll j = (r*10+v)%13;
                dp[i][j] += dp[i-1][r];
                dp[i][j] %= mod;
            }
        }
    }

    ll ans = dp[L-1][5];
    p(ans);
    
    return 0;
}


Measured memory_bytes: 10704
#include<bits/stdc++.h>
using namespace std;
int main(){
    long n; cin>>n;
    string s; cin>>s;
    s.insert(0,"0");
    vector<string> c={"SS","WW","SW","WS"};
    for(auto x:c){
        string a(n+1,0);
        a[0]=x[0],a[1]=x[1];
        for(int i=1;i<=n;i++){
                long nx=(i+1)%(n+1);
                if(i==n){
                        if(a[i]!=a[nx]){
                                a[0]='0';
                                break;
                        }
                }
                bool j;
                if(s[i]=='o')
                        j=true;
                else
                        j=false;
                if(a[i]=='W')
                        j=!j;
                if(j)
                        a[nx]=a[i-1];
                else{
                        if(a[i-1]=='S')
                                a[nx]='W';
                        else
                                a[nx]='S';
                }
        }
        if(a[0]==a[1]){
                        for(int j=1;j<=n;j++)
                                cout<<a[j];
                        return 0;
        }
    }
    cout<<-1;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update

using namespace std;
//using namespace __gnu_pbds;
//typedef tree<
//        pair<long long, int>, // change type
//        null_type,
//        less<pair<long long, int> >, // change type
//        rb_tree_tag,
//        tree_order_statistics_node_update>
//        ordered_set;

//template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;


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...);
}

#ifdef LOCAL
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) ;
#endif


typedef long long ll;
#define rep(i, start, end) for(int i = start; i < end; ++i)
#define sz(x) (int)((x).size())
#define pb push_back
#define all(x) x.begin(), x.end()
#define clr(d, v) memset(d, v, sizeof(d))
#define pii pair<int, int>
//#define debug(x) cerr << #x << " : " << (x) << " "
const double PI = 3.14159265358979323846;
const double eps = (1e-8);
int isGreater(long double x, long double y)
{
    if (abs(x - y) < eps)
        return 0;
    if (x > y)
        return 1;
    return -1;
}


bool overflow(ll x, ll y)
{
    return x >= LLONG_MAX/y;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
//    freopen("AC.txt", "w", stdout);
#endif
    ll a;
    long double b;
    cin >> a >> b;
    cout << (ll)(a * b + eps) << '\n';
}

Measured memory_bytes: 3788
N = int(input())
B_list = list(map(int, input().split()))

A_list = [0]*(N+1)
A_list[0] = B_list[0]
A_list[1] = B_list[0]

for i in range(1, N-1):
    A_list[i + 1] = B_list[i]
    if A_list[i + 1] < A_list[i]:
        A_list[i] = A_list[i + 1]
    
print(sum(A_list))

Measured memory_bytes: 3064
#include <iostream>
#include <string>

using namespace std;

int main() {
    int a[4];
    string input;

    cin >> input;
    for (int i = 0; i < 4; i++) { a[i] = input[i] - '0'; }

    for (int i = 0 ; i < (1 << 3); i++) {
        int sum = a[0];
        string s;
        s += (char)('0' + a[0]);
        for (int j = 0; j < 3; j++) {
            if (i & (1 << j)) {
                sum += a[j+1];
                s += '+';
                s += (char)('0' + a[j+1]);
            }
            else {
                sum -= a[j+1];
                s += '-';
                s += (char)('0' + a[j+1]);
            }
        }
        if (sum == 7) {
            cout << s + "=7" << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 380
#![allow(non_snake_case)]
#![allow(unused_imports)]
#![allow(dead_code)]

use proconio::{input, fastout};
use proconio::marker::*;
use whiteread::parse_line;
use std::collections::*;
use num::*;
use num_traits::*;
use superslice::*;
use std::ops::*;

use itertools::Itertools;
use itertools_num::ItertoolsNum;


#[fastout]
fn solve() {
    const MOD: usize = 1_000_000_007;
    const INF: usize = std::usize::MAX;
    
    input!{
        d: usize,
    }

    let ans = match d {
        22 => "Christmas Eve Eve Eve",
        23 => "Christmas Eve Eve",
        24 => "Christmas Eve",
        _ => "Christmas"
    };

    println!("{}", ans);
}

fn main() {
    solve()
}

#[cfg(test)]
mod test {
    use super::solve;
}


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

int main()
{
    char c;
    scanf("%c", &c);
    if (c == 'a' || c =='e' || c == 'i' || c == 'o' || c =='u') {
        printf("vowel\n");
    } else {
        printf("consonant\n");
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,h,a;
  cin >> n >> h;
  for(int i=0;i<h;i++){
    cin >> a;
    n-=a;
  }
  if(n>0)cout << "No" << endl;
  else cout << "Yes" << endl;
}


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

using namespace std;

int main(){
    long double a, b, x;

    cin >> a >> b >> x;

    long double S = x / a;
    long double rad;
    if(S >= a * b /2){
        long double h = 2 * (a* b - S) / a;
        rad = atan2(h, a);
    }
    else{
        long double alpha = 2 * S / b;
        rad = atan2(b, alpha);
    }

    long double PI = acos(-1);
    double deg = rad / (2 * PI) * 360;
    printf("%.10f\n", deg);
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
#define N 1005
#define ll long long
#define MOD 1000000007
int n,b;
int main()
{
	scanf("%d",&n);
	if(n&1) b=(n-1)/2+1;
	else b=n/2;
	double ans=1.0*b/n;
	printf("%.6f",ans);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a) for(int i=0; i<(int)(a); i++)
typedef long long ll;
const ll INF = 1LL<<60;

int main()
{
  int n; cin>>n;
  vector<ll> a(n);
  rep(i, n) cin>>a[i];
  ll ans = 0;
  rep(i, n) {
    if (i > 0) {
      if (a[i-1] > 0 && a[i] > 0) {
        ans++;
        a[i-1]--;
        a[i]--;
      }
    }
    ans += a[i]/2;
    a[i] = a[i]%2;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>                        
#define pb push_back                            
#define mp make_pair                            
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)((x).size())
#define endl "\n"
#define jonathan ios_base::sync_with_stdio(0)
#define livingston cin.tie(0)
using namespace std;                            
                                                
void yes() {cout << "YES" << endl;}                                               
void no() {cout << "NO" << endl;}                                                        
                                                
int dx[] = {1, 0, -1, 0, -1, -1, 1, 1};         
int dy[] = {0, 1, 0, -1, -1, 1, -1, 1}; 

const long long INF = 8e18 + 8;
const double EPS = 1e-9;
const long long MOD = 998244353;

void solve() {
    int n, k; cin >> n >> k;
    vector<int> a(n);
    int sum = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        sum += a[i];
    }
    long long dp[sum + 1][n + 1];
    for (int i = 0; i < sum + 1; i++) {
        for (int j = 0; j < n + 1; j++) {
            dp[i][j] = 0;
        }
    }
    dp[0][0] = 1;
    for (int i = 0; i < n; i++) {
        for (int s = sum; s >= 0; s--) {
            for (int t = i + 1; t >= 1; t--) {
                if (s - a[i] >= 0) {
                    dp[s][t] += dp[s - a[i]][t - 1];
                }
            }
        }
    }
    long long ans = 0;
    for (int t = 1; t <= n; t++) {
        if (t * k <= sum) {
            ans += dp[t * k][t];
        }
    }
    cout << ans << endl;
}

int main() {
    jonathan; 
    livingston;
    bool tests = 0;
    int t = 1;
    if (tests) cin >> t;
    for (int i = 1; i <= t; i++) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 4572
import java.util.*;

public class Main {
public static void main(String[] args) {
		
		Scanner keyboard = new Scanner(System.in); 
		
		int H  = keyboard.nextInt();
		int W = keyboard.nextInt();
		int h  = keyboard.nextInt();
		int w = keyboard.nextInt();

		System.out.println((H-h)*(W-w));
		keyboard.close();	
	}
}

Measured memory_bytes: 21844
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
 
R = INT()
print(2*R*pi)

Measured memory_bytes: 10040
import java.util.Scanner;

//Altair and Vega
public class Main{

	public static class Point {
		public double x;
		public double y;
		public Point(double x_, double y_) {
			x = x_; y=y_;
		}
	}
	public static Point sub(Point p1, Point p2) {
		return new Point(p1.x-p2.x, p1.y-p2.y);
	}
	public static double extp(Point p1, Point p2) {
		return p1.x*p2.y - p2.x*p1.y;
	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int t = sc.nextInt();
		while(t--!=0){
			Point[] p = new Point[3];
			for(int i=0;i<3;i++)p[i]=new Point(sc.nextDouble(), sc.nextDouble());
			Point p1 = new Point(sc.nextDouble(), sc.nextDouble());
			Point p2 = new Point(sc.nextDouble(), sc.nextDouble());
			boolean in1 = false;
			boolean in2 = false;
			boolean right = true;
			boolean left = true;
			boolean right2 = true;
			boolean left2 = true;
			for(int i=0;i<3;i++){
				Point base = sub(p[(i+1)%3], p[i]);
				Point bec = sub(p1, p[i]);
				Point bec2 = sub(p2, p[i]);
				if(extp(base, bec)<0) left = false;
				else right = false;
				if(extp(base, bec2)<0) left2 = false;
				else right2 = false;
			}
			in1 = left|right;
			in2 = left2|right2;
			System.out.println(in1!=in2?"OK":"NG");
		}
	}
}

Measured memory_bytes: 13000
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
long long a[10]={9};
int main()
{
	long long n,k,i,j,t;
	for (i=1;i<10;i++) a[i]=10*a[i-1];
	while (cin>>n>>k&&n)
	{
		stringstream ss;
		string s;
		i=0;t=1;n--;
		while (n-a[i]*(i+1)>0) {n-=a[i]*(i+1);i++;}
		for (j=0;j<i;j++) t*=10;
		t+=n/(i+1);n%=i+1;
		for (j=t;j<t+k;j++) ss<<j;
		s=ss.str();
		cout<<s.substr(n,k)<<endl;
	}
	return 0;
}

Measured memory_bytes: 1220
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <cstring>
using namespace std;

int main (){
	priority_queue<int> A;
	string s;
	int a;
	while(cin>>s){
		if(s[0]=='i') {
			cin>>a;
			A.push(a);
		}
		else if(s[1]=='x'){
			a=A.top();
			A.pop();
			cout<<a<<endl;
		}
		else return 0;
	}
	return 0;
}


Measured memory_bytes: 6872
h,w = map(int,input().split())
s = []
ans = [["#"]*w for _ in range(h)]
s.append(["."]*(w+2))
for i in range(h):
    s.append(["."] + list(input()) + ["."])
s.append(["."]*(w+2))
dx = [0,1,1,1,0,-1,-1,-1]
dy = [-1,-1,0,1,1,1,0,-1]
for i in range(1,h+1):
    for j in range(1,w+1):
        if s[i][j] == ".":
            count = 0
            for k in range(8):
                if s[i+dx[k]][j+dy[k]] == "#":
                    count += 1 
            ans[i-1][j-1] = str(count)
for i in range(h):
    print("".join(ans[i]))


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b,d,r;
  double f;
  cin>>a>>b;
  d=a/b;
  r=a%b;
  f=1.0*a/b;
  printf("%d %d %lf",d,r,f);
}


Measured memory_bytes: 3192
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef int ll;
typedef long double ld;
const ll N = 200005;
char en = '\n';
ll inf = 1e16;
ll mod = 1e9 + 7;
ll power(ll x, ll n, ll mod) {
  ll res = 1;
  x %= mod;
  while (n) {
    if (n & 1)
      res = (res * x) % mod;
    x = (x * x) % mod;
    n >>= 1;
  }
  return res;
}

int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  ll n;
  cin >> n;

  ll res[n + 5];
  memset(res, 0, sizeof(res));

  for (ll x = 1; x <= 100; x++) {
    for (ll y = 1; y <= 100; y++) {
      for (ll z = 1; z <= 100; z++) {
        ll val = x * x + y * y + z * z + x * y + y * z + x * z;
        if (val <= n)
          res[val]++;
      }
    }
  }

  for (ll i = 1; i <= n; i++)
    cout << res[i] << en;

  return 0;
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
#define rer(i,l,n) for(int i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define pb(a) push_back(a)
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pii;
/*
int main(){
	int c=0;
	string s;
	while(cin>>s){
		//if(s=="0") break;
		if(s.find("apple")==0) s.replace(0,5,"peach");
		else if(s.find("peach")==0) s.replace(0,5,"apple");
		if(c==0) cout<<s;
		else cout<<" "<<s;
		c++;
	}
	cout<<endl;
}
*/
/*
vector<string> split(const string &s,char c=' '){
	vector<string> ret;
	stringstream ss(s);
	string t;
	while(getline(ss,t,c)){
		ret.pb(t);
	}
	return ret;
}

int main(){
	string s,ans;
	getline(cin,s);
	vector<string> str=split(s,' ');
	rep(i,0,str.size()){
		string ss=str[i];
		if(i) ans+=" ";
		if(ss.find("apple")==0) ss.replace(0,5,"peach");
		else if(ss.find("peach")==0) ss.replace(0,5,"apple");
		ans+=ss;
	}
	o(ans);
}*/

int main(){
	string s;
	getline(cin,s);
	string kw[2]={"apple","peach"};
	string cw[2]={"changetopeac","changetoappl"};
	rep(i,0,2){
		while(1){
			if(s.find(kw[i])!=string::npos){
				s.replace(s.find(kw[i]),5,cw[i]);
			}
			else break;
		}
	}
	//o(s);
	rep(i,0,2){
		while(1){
			if(s.find(cw[i])!=string::npos){
				s.replace(s.find(cw[i]),12,kw[1-i]);
			}
			else break;
		}
	}
	o(s);
}

Measured memory_bytes: 1208
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq

n = int(input())
a = list(map(int, input().split()))

p = [i-a[i] for i in range(n)]
q = [a[i]+i for i in range(n)]

pp = Counter(p)
qq = Counter(q)

ans = 0
for d in pp.items():
    ans += d[1] * qq[d[0]]

print(ans)








Measured memory_bytes: 63640
import sys
sys.setrecursionlimit(100000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

def main():
    S = input()
    flag = True
    if S[0] != 'A' or S[2:-1].count('C') != 1:
        flag = False
    for i in range(len(S)):
        if S[i] not in 'ACabcdefghijklmnopqrstuvwxyz':
            flag = False
            break
    print('AC' if flag else 'WA')
if __name__ == '__main__':
    main()



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

int main()
{
  ll n;
  cin>>n;
  ll A[n];
  for(ll i = 0;i < n;i++)
    cin>>A[i];
  ll sum = 0;
  for(ll i = 1;i < n;i++)
  {
    if(A[i] < A[i-1])
    {
      sum = sum + A[i-1] - A[i];
      A[i] = A[i-1];
    }
  }
  cout<<sum<<"\n";
}
  


Measured memory_bytes: 5148
#include <stdio.h>

int main( void ) {
	char factStr[ 21 ][ 20 ] = { [ 13 ] = "6227020800", "87178291200", "1307674368000", "20922789888000", "355687428096000", "6402373705728000", "121645100408832000", "2432902008176640000" };
	int n, fact;

	scanf( "%d", &n );

	if ( n < 13 ) {
		for ( fact = 1; n; fact *= n-- ) ;

		printf( "%d\n", fact );
	} else
		printf( "%s\n", factStr[ n ] );

	return 0;
}

Measured memory_bytes: 576
//Sinhov : "Hi stalker!"
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <iomanip>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define mod 1000000007
int main() {
    ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
    string s,s1;
    ll flag=0;
    cin>>s;
    for(ll i=0;i<s.length()/2;i++)
        if(s[i]!=s[s.length()-i-1])
            flag=1;
    if(flag)
        cout<<"No";
    else
        cout<<"Yes";
    return 0;
}

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

int main() {
    vector<int> num;
    for(int i=0;i<3;i++) {
        int x;cin>>x;
        num.push_back(x);
    }
    sort(num.begin(),num.end());
    if(num[0]==5 && num[1]==5 && num[2]==7) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}


Measured memory_bytes: 256
import itertools

A=range(0,int(input())+1)
B=range(0,int(input())+1)
C=range(0,int(input())+1)
X=int(input())

cnt=0

for a,b,c in itertools.product(A,B,C):
    if 500*a+100*b+50*c==X:
        cnt += 1
    
print(cnt)

Measured memory_bytes: 3060
from itertools import combinations
import numpy as np
# t = [1, 2, 3, 4]
# a = list(combinations(t, 1))
# print(a[0][0] == 1)
# print(t[a[0]])

h, w, k = map(int, input().split())
c_m = [list(input()) for _ in range(h)]
c_m = np.array(c_m)
result = 0
for i in range(1, h+1):
    chs = list(combinations(range(h), i))
    for ch in chs:
        c_1 = c_m.copy()
        for ch_i in ch:
            c_1[ch_i] = 'r'
        for j in range(1, w+1):
            whs = (combinations(range(w), j))
            for wh in whs:
                c_2 = c_1.copy()
                for wh_i in wh:
                    c_2[:,wh_i] = 'r'
                if np.sum(c_2=='#') == k: result += 1


for i in range(1, h+1):
    chs = list(combinations(range(h), i))
    for ch in chs:
        c_1 = c_m.copy()
        for ch_i in ch:
            c_1[ch_i] = 'r'
        if np.sum(c_1=='#') == k: result += 1

for i in range(1, w+1):
    chs = list(combinations(range(w), i))
    for ch in chs:
        c_1 = c_m.copy()
        for ch_i in ch:
            c_1[:,ch_i] = 'r'
        if np.sum(c_1=='#') == k: result += 1

if np.sum(c_m=='#') == k: result += 1
print(result)


Measured memory_bytes: 27152
n=int(input())
ans=sum((1+n-l+1)*(n-l+1)//2 for l in range(1,n+1))
###print(ans)
for i in range(n-1):
    x,y=map(int,input().split())
    if x>y:x,y=y,x
    ans-=x*(n+1-y)
print(ans)

Measured memory_bytes: 8964
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<ll,ll> P;
#define pb push_back
#define ft first
#define sd second
#define mp make_pair
#define fr(i,n) for(int i=0;i<n;i++)
#define Fr(i,n) for(int i=0;i++<n;)
#define ifr(i,n) for(int i=n-1;i>=0;i--)
#define iFr(i,n) for(int i=n;i>0;i--)

ll orde[100010]={};

bool od(ll a,ll b){
  return orde[a]>orde[b];
}

int main(){
  vector<ll> c[100010],p[100010],ord;
  set<ll> p2[100010];
  ll n,m,a,b,ind[100010]={},rt;
  cin>>n>>m;
  fr(i,n+m-1){
    cin>>a>>b;
    ind[b]++;
    c[a].pb(b);
    p[b].pb(a);
    p2[b].emplace(a);
  }
  Fr(i,n) if(ind[i]==0) rt=i;
  queue<ll> q;
  q.push(rt);
  while(!q.empty()){
    a=q.front();
    q.pop();
    ord.pb(a);
    fr(i,c[a].size()){
      if(p2[c[a][i]].size()==1) q.push(c[a][i]);
      else p2[c[a][i]].erase(a);
    }
  }
  fr(i,n) orde[ord[i]]=i;
  Fr(i,n){
    if(i==rt){cout<<0<<endl;continue;}
    sort(p[i].begin(),p[i].end(),od);
    cout<<p[i][0]<<endl;
  }
}

Measured memory_bytes: 23668
#ifdef DEBUG

#else

#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus >= 201703L
#        pragma GCC target("avx2")
#    else
#        pragma GCC target("avx")
#    endif

#endif
// 実数の場合
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;
typedef long double Ld;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

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

    int n;
    cin >> n;
    set<string> aa;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;

        aa.insert(s);
    }

    cout << aa.size() << endl;

    return 0;
}


Measured memory_bytes: 19120
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
#include <string>
#include <string.h>
#include <map>
using namespace std;
int h,w;
char maze[21][21]{};
int dx[]={0,0,-1,1};
int dy[]={-1,1,0,0};

bool valid(int i , int j)
{
    return i>=0 && i<h && j>=0 && j<w && maze[i][j]=='.';
}


int maxStep = 0 ;

void bfs(int i , int j )
{

vector<vector<int>> dist(h, vector<int>(w , 1000000));
queue<pair<int,int>> q;
q.push({i,j});
dist[i][j] = 0 ;

while(!q.empty())
{
    int h = q.front().first;
    int v = q.front().second;
    q.pop();
    for(int k = 0 ; k<4 ; k++)
    {
        int x = h+dx[k];
        int y= v+dy[k];
        if(valid(x,y))
        {
            if(dist[x][y]==1000000)
            {
                q.push({x,y});  //put the node on the queue
                dist[x][y] =dist[h][v] + 1; //current level in the tree/graph
                maxStep = max(dist[x][y],maxStep);
            }
        }
    }
}
}

int main()
{

    cin>>h>>w;

    for(int i = 0 ; i<h ; i++)
    for(int j = 0 ; j<w ; j++)
    cin>>maze[i][j];

    for(int i = 0 ; i<h ; i++)
    {
        for(int j = 0 ; j<w ; j++)
        {
            if(maze[i][j]!='.')continue;
            bfs(i,j);
        }
    }
    cout<<maxStep<<endl;

    return 0;
}


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

int main() {
  int N, count = 0;
  string color;

  cin >> N;

  for(int i = 0; i<N; i++){
    cin >> color;
    if(color == "Y"){
      count += 1;
    }
  }

  if(count > 0){
    cout << "Four" << endl;
  }else{
    cout << "Three" << endl;
  }

}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<algorithm>



int main(void){
	int n;
	int m1;
	int answer=0;
	std::vector<int> num(100000);
	scanf("%d",&n);
	for(int lp=0;lp<n;lp++){
		scanf("%d",&num[lp]);
		num[lp]--;
	}

	int at1=0;
	bool frag=false;
	for(at1=0;at1<n;at1++){
		if(num[at1]==at1){
			at1++;
			answer++;
		}
	}
	std::cout<<answer<<std::endl;
	return 0;
}


Measured memory_bytes: 640
// if Ans is to like maximize or minimize after a particular day without having to 
// take any consecutive same element O(N * choices^2)

#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define input freopen("1.txt","r",stdin);
#define output freopen("output.txt","w",stdout);
#define ll long long int
#define pb push_back
#define ppb pop_back
#define eb emplace_back
#define vi vector<int>
#define vii vector<vi>
#define vl vector<ll>
#define vll vector<vl>
#define pii pair<int, int>
#define pll pair<ll,ll>
#define mp make_pair
#define vpi vector<pii>
#define vpl vector<pll> 
using namespace std;
 
const int p=1e9+7;
const int maxn=1e5+2;
int DP[maxn][3];
int cost[maxn][3];

void solve(int cur, int N) {
    if(cur == N) {
        cout << max({DP[N][0], DP[N][1], DP[N][2]}) << "\n";
        return; 
    }
    ++cur;
    DP[cur][0] = max(DP[cur-1][1] + cost[cur][0], DP[cur-1][2] + cost[cur][0]);
    DP[cur][1] = max(DP[cur-1][0] + cost[cur][1], DP[cur-1][2] + cost[cur][1]);
    DP[cur][2] = max(DP[cur-1][0] + cost[cur][2], DP[cur-1][1] + cost[cur][2]);
    solve(cur, N);
}

int main() {
    fast 
    // input output
    int t=1; 
    // cin>>t;  
    int N; cin >> N;
    DP[0][0] = DP[0][1] = DP[0][2] = 0;
    for(int i = 1; i <= N; i++) {
        DP[i][0] = DP[i][1] = DP[i][2] = 0;
        cin >> cost[i][0] >> cost[i][1] >> cost[i][2];
    }
    while(t--) solve(0, N);
    // for(int i = 0; i <= N; i++) cout << DP[i][0] << " " << DP[i][1] << " " << DP[i][2] <<"\n";
    return 0;
}

Measured memory_bytes: 5948
#include <bits/stdc++.h>
#define rep(i, z, n) for(int i = z; i < n; i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
//const int64_t INF = 1LL << 60;
const int INF = 1 << 29;
//const int MODINF = 1000000007;
using namespace std;

int main(){
    int N, K;
    cin >> N >> K;
    vector<int> V(N), W(N);
    rep(i, 0, N) cin >> V.at(i);
    W = V;
    reverse(all(W));
    int ans_max = 0;
    rep(i, 0, min(N, K) + 1){
        rep(j, 0, min(N, K) + 1 - i){
            vector<int> X(0);
            rep(k, 0, i){
                X.push_back(V.at(k));
            }
            rep(k, 0, j){
                X.push_back(W.at(k));
            }
            sort(all(X));
            //rep(k, 0, X.size()) cout << X.at(k) << " ";
            //cout << endl;
            
            int l = 0, ans = 0;
            rep(k, 0, X.size()){
                if (X.at(k) < 0 && l < K - X.size()){
                    l++;
                    continue;
                }
                else ans += X.at(k);
            }
            ans_max = max(ans_max, ans);
        }
    }
    cout << ans_max << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define ll long long
using namespace std;
void qmax(int &x,int y) {if (x<y) x=y;}
void qmin(int &x,int y) {if (x>y) x=y;}
inline ll read()
{
	char s;
	ll k=0,base=1;
	while((s=getchar())!='-'&&s!=EOF&&!(isdigit(s)));
	if(s==EOF)exit(0);
	if(s=='-')base=-1,s=getchar();
	while(isdigit(s)){k=k*10+(s^'0');s=getchar();}
	return k*base;
}
ll n,a[2],ans,sum,flag;
int main()
{
	flag=0;
	n=read();sum=1e16;
	for (int i=1;i<=n;i++)
	{
		a[0]=read();a[1]=read();
		if (a[0]!=a[1]) flag=1;
		ans+=a[0];
		if (a[0]>a[1]) sum=min(sum,a[1]); 
	}
	if (!flag){puts("0");return 0;} 
	ans=ans-sum;printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end());
#define vecmin(A) *min_element(A.begin(),A.end());
#define vecmax(A) *max_element(A.begin(),A.end());
typedef long long ll;
typedef vector<int> vec;

int main(){
  int d,g;
  cin >> d >> g;
  vec p(d),c(d);
  rep(i,d) cin >> p[i] >> c[i];
  int ans = pow(10,9);
  for(int i=0;i<pow(2,d);i++){//iでbit全探索
    int t = g;//iごとの目標スコア
    int s = 0;//iごとの必要ステップ
    for(int j=0;j<d;j++){//iのjケタ目
      bool bit = (i>>j)&1;
      if(bit){
        t -= c[j];
        t -= p[j]*(j+1)*100;
        s += p[j];
      }
    }//j
    
    if(t>0){//残っていたら追加処理
      stack<int> r;//残りの問題を詰め込む
      for(int j=0;j<d;j++){//iのjケタ目
        bool bit = (i>>j)&1;
      	if(!bit)rep(k,p[j]) r.push((j+1)*100);
      }
      while(t>0){
        if(r.empty()) break;
        t -= r.top();
        r.pop();
        s ++;
      }//j
    }
    ans = min(ans,s);
  }//i
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int H,N,i;
    int A[100000];
    cin>>H>>N;
    for(i=0;i<N;i++){
        cin>>A[i];
    }
    i=0;
    while(i<N){
        H-=A[i];
        i++;
    }
    if(H<=0)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    }


Measured memory_bytes: 640
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<vector>
#include<queue>
#include<bitset>
#include<string>
#include<stack>
#include<set>
#include<unordered_set>
#include<map>
#include<unordered_map>
#include<cstring>
#include<complex>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<algorithm>
#include<list>
#include<functional>
#include<cassert>
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define y0 y12
#define y1 y22
#define INF 1987654321
#define PI 3.141592653589793238462643383279502884
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))
#define MEM0(a) memset((a),0,sizeof(a));
#define MEM_1(a) memset((a),-1,sizeof(a));
#define ALL(a) a.begin(),a.end()
#define SYNC ios_base::sync_with_stdio(false);cin.tie(0)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef double db;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef pair<ld, ld> Pd;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<double> Vd;
typedef vector<Pi> VPi;
typedef vector<Pll> VPll;
typedef vector<Pd> VPd;
typedef tuple<int, int, int> iii;
typedef tuple<int,int,int,int> iiii;
typedef tuple<ll, ll, ll> LLL;
typedef vector<iii> Viii;
typedef vector<LLL> VLLL;
typedef complex<double> base;
const ll MOD = 1000000007;
ll POW(ll a, ll b, ll MMM = MOD) {ll ret=1; for(;b;b>>=1,a=(a*a)%MMM)if(b&1)ret=(ret*a)% MMM; return ret; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { if (a == 0 || b == 0)return a + b; return a*(b / gcd(a, b)); }
int dx[] = { 0,1,0,-1,1,1,-1,-1 }, dy[] = { 1,0,-1,0,1,-1,1,-1 };

Vi v[100001];
bool chk[100001],fin[100001];
int cnt[100001];
void dfs(int N,int p)
{
	chk[N]=1;
	for(int next:v[N])
	{
		if(!chk[next])dfs(next,N);
	}
	for(int next:v[N])
	{
		if(fin[next])continue;
		if(next==p)
		{
			if(cnt[N]&1)printf("%d %d\n",N,next);
			else
			{
				printf("%d %d\n",next,N);
				cnt[next]++;
			}
		}
		else
		{
			printf("%d %d\n",next,N);
			cnt[next]++;
		}
	}
	fin[N]=1;
}
int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	if(m&1)return !printf("-1");
	fup(i,1,m,1)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		v[x].pb(y);
		v[y].pb(x);
	}
	dfs(1,-1);
}

Measured memory_bytes: 15232
module Main (main) where

import qualified Data.ByteString.Char8     as C8
import           Data.Maybe

main :: IO ()
main = do
  [n,a,b] <- readInts
  print . showAnswer $ solve (n,a,b)

type Input  = (Int, Int, Int)
type Output = Int

solve :: Input -> Output
solve (n,a,b) = if a' < b then a' else b
  where
    a' = n*a

showAnswer :: Output -> Answer
showAnswer = Number

-- utils
readInts :: IO [Int]
readInts = map (fst . fromJust . C8.readInt) . C8.words <$> C8.getLine

data Answer
  = YesNo Bool
  | YESNO Bool
  | AB Bool
  | Number Int
  | Compare Ordering

instance Show Answer where
  show (YesNo b)   = if b then "Yes" else "No"
  show (YESNO b)   = if b then "YES" else "NO"
  show (AB b)      = if b then "A"   else "B"
  show (Number i)  = show i
  show (Compare o)
    | o == EQ = "="
    | o == LT = "<"
    | o == GT = ">"

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

using namespace std;

vector<int> zFunction(vector<int> s) {
    int n = s.size();
    vector<int> z(n);
    int l = 0, r = 0;
    for (int i = 1; i < n; i++) {
        int &cur = z[i];
        if (i <= r) {
            z[i] = min(r-i+1, z[i-l]);
        }
        while (i+z[i] < n && s[cur] == s[i+cur]) {
            cur++;
        }
        if (i+z[i]-1 > r) {
            l = i,  r = i+z[i]-1;
        }
    }
    return z;
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for (int i = 0; i < n; i++) {
        cin >> b[i];
    }
    vector<int> ans(n, 0);
    for (int bt = 0; bt < 30; bt++) {
        int mask = 1 << bt;
        vector<int> cur(n, -1);
        for (int v = 0; v <= mask; v += mask) {
            vector<int> c;
            for (int i = 0; i < n; i++) {
                c.push_back(v ^ (b[i] & mask));
            }
            for (int tm = 0; tm < 2; tm++) {
                for (int va: a) {
                    c.push_back(va & mask);
                }
            }
            auto z = zFunction(c);
            for (int i = 0; i < n; i++) {
                if (z[n+i] >= n) {
                    cur[i] = v;
                }
            }
        }
        for (int i = 0; i < n; i++) {
            if (cur[i] == -1) {
                ans[i] = -1;
            } else if (ans[i] != -1) {
                ans[i] += cur[i];
            }
        }
    }
    for (int i = 0; i < n; i++) {
        if (ans[i] != -1) {
            cout << i << " " << ans[i] << "\n";
        }
    }
}



Measured memory_bytes: 15096
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <deque>
#include <queue>
#include <functional>
//#include <boost/multiprecision/cpp_int.hpp>

#define rep(i, n) for(int i = 0; i < n; ++i)
#define REP(i, m, n) for(int i = m; i < n; ++i)
#define rrep(i,n) for(int i = n; i >= 0; --i)
#define RREP(i, m, n) for(int i = n; i >= m; --i)
#define llrep(i, n) for(ll i = 0; i < n; ++i)
#define llREP(i, m, n) for(ll i = m; i < n; ++i)
#define llrrep(i,n) for(ll i = n; i >= 0; --i)
#define llRREP(i, m, n) for(ll i = n; i >= m; --i)

using ll = long long;
using ull = unsigned long long;
using pii = std::pair<int, int>;
using pll = std::pair<long long, long long>;
using pil = std::pair<int, long long>;
using pli = std::pair<long long, int>;
using plpii = std::pair<long long, std::pair<int, int>>;
using pdd = std::pair<double, double>;

const long long INF = 1000000000000000001;
const long long _MOD = 1000000007;
const long long MOD = 998244353;
const int ALPHABET = 27;
const double pi = 3.14159265358979;

using namespace std;
//namespace mp = boost::multiprecision;

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

	int n;
	cin >> n;
	cout << (1000 - (n % 1000)) % 1000 << "\n";

	return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
#define PI 3.14159265358979
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repp(i, s, e) for(int i = (s); i <= (e); ++i)
#define sz(x) ((int)x.size())
#define all(x) x.begin(), x.end()
#define FAST_IO() ios::sync_with_stdio(0); cin.tie(0)
template<typename T>
ostream& operator<<(ostream &os, const vector<T> &v) { for (auto x : v) os << x << " "; return os << "\n"; }
template<class U, class V>
ostream& operator<<(ostream &os, const pair<U, V> &p) { return os << "(" << p.first << "," << p.second << ")";}

int main() {
    int N; cin >> N;
    vector<int> A(N + 1);
    rep(i, N) cin >> A[i];
    A[N] = INT_MAX;
    int maxMove = 0, currMove = 0;
    int start = 0;
    while(start < N) {
        if(A[start] >= A[start + 1]) {
            currMove++;
        } else {
            maxMove = max(maxMove, currMove);
            currMove = 0;
        }
        start++;
    }
    cout << maxMove << "\n";
}

Measured memory_bytes: 640
// vvvvvvvvvvvv TEMPLATE vvvvvvvvvvvv
#include <bits/stdc++.h>
using namespace std; using ll = long long; using P = pair<ll, ll>;
const ll linf = 1e18; const double eps = 1e-12, pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define each(i,a) for (auto&& i : a)
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define eb emplace_back
#define all(a) begin(a),end(a)
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)
#define min(x,y) (x < y ? x : y)
#define max(x,y) (x < y ? y : x)
template<typename Head> void out(Head h) { cout << h << endl; } template<typename Head, typename... Tail>void out(Head h, Tail... t) { cout << h << " "; out(t...); }
template<typename T> istream& operator>>(istream& is, vector<T>& v) { each(x,v) is >> x; return is; }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) { rep(i,v.size()) { if (i) os << " "; os << v[i]; } return os; }
template<typename T> ostream& operator<<(ostream& os, const vector<string>& v) { rep(i,v.size()) { if (i) os << endl; os << v[i]; } return os; }
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) { rep(i,v.size()) { if (i) os << endl; os << v[i]; } return os; }
struct yes_no : std::numpunct<char> { string_type do_truename() const { return "Yes"; } string_type do_falsename() const { return "No"; } };
void solve(); int main() {
  ios::sync_with_stdio(false); cin.tie(0); locale loc(locale(), new yes_no); cout.imbue(loc); cout << fixed << setprecision(10) << boolalpha;
  solve();
}
// ^^^^^^^^^^^^ TEMPLATE ^^^^^^^^^^^^
 
template<typename T>
map<T, ll> get_zaatu(vector<T> vals) {
  sort(all(vals));
  vals.erase(unique(all(vals)), vals.end());
  map<T, ll> res;
  rep(i, vals.size()) res[vals[i]] = i;
  return res;
}
template<typename T>
vector<T> zaatu(vector<T> vals) {
  map<T, ll> z = get_zaatu(vals);
  each(x, vals) x = z[x];
  return vals;
}
 
void solve() {
  ll h, w, n; cin >> w >> h >> n;
  vector<ll> X(n), Y(n);
  rep(i, n) {
    cin >> X[i] >> Y[i]; --X[i], --Y[i];
  }
  map<ll, vector<ll>> m;
  ll ans = w;
  rep(i, n) {
    if (Y[i] == 0) {
      chmin(ans, X[i]);
    }
    else {
      m[Y[i]].pb(X[i]);
    }
  }
  each(p, m) sort(all(p.second));
  ll x = 0, y = 0, step = 0;
  each(p, m) {
    ll ny = p.first-1;
    ll nx = x + (ny - y);
    step += ny - y;
    each(xx, p.second) {
      if (xx <= nx) continue;
      if (xx == nx+1) {
        ++nx;
        ++step;
      }
      else {
        break;
      }
    }
    ++nx, ++ny, ++step;
    ll xw = w;
    each(xx, p.second) {
      if (xx > nx) {
        xw = xx;
        break;
      }
    }
    chmin(ans, step + xw - nx);
    x = nx, y = ny;
    // cout << x << " " << y << " " << step << endl;
  }
  cout << ans << endl;
}

Measured memory_bytes: 17024
#include<bits/stdc++.h>
#define ll long long
#define MAXN 55
#define mod 998244353
#define INF 0x3f3f3f3f
#define ld long double
using namespace std;
int num[4005][3]={0};//R,G,B
int main(){
    ios::sync_with_stdio(false);
    #define int ll
    int n;
    cin>>n;
    string s;
    cin>>s;
    int r=0,g=0,b=0;
    for(int i=n-1;i>=0;i--){
        num[i][0]=r;
        num[i][1]=g;
        num[i][2]=b;

        if(s[i]=='R')r+=1;
        if(s[i]=='G')g+=1;
        if(s[i]=='B')b+=1;
    }
    int ans=0;
    for(int i=0;i<n-2;i++){
        for(int j=i+1;j<n-1;j++){
            if(s[i]=='R'){
                if(s[j]=='G'){
                    ans+=num[j][2];
                    if(s[j+j-i]=='B')ans-=1;
                }
                else if(s[j]=='B'){
                    ans+=num[j][1];
                    if(s[j+j-i]=='G')ans-=1;
                }
            }
            if(s[i]=='G'){
                if(s[j]=='R'){
                    ans+=num[j][2];
                    if(s[j+j-i]=='B')ans-=1;
                }
                else if(s[j]=='B'){
                    ans+=num[j][0];
                    if(s[j+j-i]=='R')ans-=1;
                }
            }
            if(s[i]=='B'){
                if(s[j]=='G'){
                    ans+=num[j][0];
                    if(s[j+j-i]=='R')ans-=1;
                }
                else if(s[j]=='R'){
                    ans+=num[j][1];
                    if(s[j+j-i]=='G')ans-=1;
                }
            }
        }
    }

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


Measured memory_bytes: 3680
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <deque>

int main(){
  int N;
  scanf("%d", &N);
  std::set<std::string > mp;
  for (int i=0; i<N; i++){
    std::string s;
    std::cin >> s;
    mp.insert(s);
  }
  std::cout << mp.size() << std::endl;
  return 0;
}


Measured memory_bytes: 15732
#include<bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);

int swaps =0;
int N;
cin>>N;
string C;
cin>>C;

int left =0,right =N-1;
while(left < right)
{
    while((left < N) && (C[left]< 'T'))
     left++;
    while((right > -1) && (C[right]>'T'))
     right--;
    if(left < right)
    {
        int temp = C[left];
        C[left] = C[right];
        C[right] = temp;
        swaps++;
    }
}

cout<<swaps<<endl;
return 0;
}

Measured memory_bytes: 3696
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

int digit[10];

signed main(void){ 
  
  int n,m; cin >> n >> m;
  
  for(int i = 0; i < 10; i++){ digit[i] = -1;}
   
  for(int i = 0; i < m; i++){ 
    
    int s,c; cin >> s >> c; s--;
    if( digit[s] == -1 ){ digit[s] = c;}
    else{
      if( digit[s] != c ){ cout << "-1" << endl; return 0;}
    }
  }
    
  for(int i = 0; i < 1000; i++){ 
    
    int d = i;
    string s = to_string(d);
    //sが目的に合うのか調べる
    
    if((int)s.size() != n ){ continue;}
    
    bool flag = true;
    
    for(int j = 0; j < (int)s.size(); j++){ 
      int c = (int)(s[j]-'0');
      if( digit[j] != c && digit[j] != -1 ){ flag = false; break;}
    }
    
    if( flag ){ cout << i << endl; return 0;}
    
  }
  
  cout << "-1" << endl; return 0;
}
  

Measured memory_bytes: 256