akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std ;
vector<int>vc;
vector<int>cv;
int l,a,b;
int main ( ) {
int n ;
cin >> n ;
string s ;
cin>>s;
if ( n % 2 != 0 ){
    cout<<"No"<<endl;
    return 0;
}
else if ( n % 2 == 0){
    for(int i = 0 ; i < n/2 ; i ++ ){
        a+= s [ i ];
        b+= s[i+(n/2)];
  ///      cout<<a<<' '<<b<<endl;
    }
    if(a==b){
        cout<<"Yes"<<endl;
        return 0;
    }
    else {
        cout<<"No"<<endl;
    }
}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(int64_t i=0;i<(n);i++)
#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REV(c) reverse((c).begin(),(c).end())
#define YES cout << "YES" << endl;
#define NO cout << "NO" << endl;
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define VIN(n,v) for(int64_t i=0;i<(n);i++){cin >> (v).at(i);}

using namespace std;
typedef int64_t I;
typedef pair<I,I> P;
typedef vector<I> V;

I MOD = pow(10,9)+7;

// 最大公約数
I gcd(I a, I b) {
  return b != 0 ? gcd(b, a % b) : a;
}

// 最小公倍数
I lcm(I a, I b) {
  return a * b / gcd(a, b);
}

int ctoi(char c){
  return c - '0';
}

int main(){
  I n,m;
  cin >> n >> m;
  vector<P> ab(n);
  REP(i,n){
    cin >> ab.at(i).second >> ab.at(i).first;
  }
  SORT(ab);
  REV(ab);
  V an(m+1);
  V anChk(m+1);
  REP(i,m+1){
    an.at(i) = 0;
    anChk.at(i) = 0;
  }
  REP(i,n){
    P p = ab.at(i);
    if (p.second > m){
      continue;
    }
    I c = max(anChk.at(p.second), p.second);
    if (an.at(p.second) == 0){
      an.at(p.second) = p.first;
      anChk.at(p.second) = c;
    }else{
      while(c < m+1){
        if(an.at(c) == 0){
          an.at(c) = p.first;
          anChk.at(p.second) = c;
          break;
        }
        c++;
      }
    }
  }
  I t=0;
  REP(i,m+1){
    t += an.at(i);
  }
  cout << t << endl;
  return 0;
}



Measured memory_bytes: 3328
#include <iostream>
#include <vector>
#include <utility>
#include <map>

using namespace std;

int main() {
    int n;
    while (cin >> n) {
        if (n == 0) break;
        vector< pair<int, long long> > members;
        for (int i = 0; i < n; i++) {
            pair<int, long long> member;
            int id;
            long long cost, count;
            cin >> id >> cost >> count;
            bool exist = false;
            for (int i = 0; i < members.size(); i++) {
                if (members[i].first == id) {
                    members[i].second += cost * count;
                    exist = true;
                }
            }
            if (!exist) {
                member.first = id;
                member.second = cost * count;
                members.push_back(member);
            }
        }
        bool exist = false;
        for (vector< pair<int, long long> >::iterator m_i = members.begin();
                m_i != members.end(); m_i++) {
            if (m_i->second >= 1000000) {
                cout << m_i->first << endl;
                exist = true;
            }
        }
        if (!exist) {
            cout << "NA" << endl;
        }
    }
    return 0;
}
               

            

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

int main()
{
    vector<vector<int> > matrix(10+1,vector<int>(10+1,0));

    int n;
    cin>> n;
    for(int i = 1; i <= n; i++)
    {
        matrix[to_string(i)[0]-'0'][i % 10]++;
    }

    long long int ans = 0;
    for(int i = 0; i < 10; i++)
        for(int j = 0; j < 10; j++)
        ans += (matrix[i][j] * matrix[j][i]);


    cout<< ans;

}


Measured memory_bytes: 3700
// SeeAlso: 

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define MAX 100000
#define NIL -1
#define MOD 1000000007

typedef int _loop_int;
#define rep(i,n) for(int i = 0; i < n; i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define debug(x) cout<<#x<<": "<<x<<endl
#define debig_vec(v) cout<<#v<<":";rep(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

// 最大公約数
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
// 最小公倍数
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}

#define print2D(h, w, arr) rep(i, h) { rep(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> void print(const T& x){cout << setprecision(12) << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}


int main() {
    ll a,b;
    cin >> a >> b;

    ll tower[999];

    tower[0] = 1;
    FOR(i,1,999) {
        tower[i] = tower[i-1] + i + 1;
    }

    for(ll i = 1; i<499500-a; i++) {
        rep(j, 998) {
            if(tower[j]==(i+a) && tower[j+1]==(i+b)) {
                print(i);
                return 0;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 256
def main(n,a):
    a1,a2=a[:n],a[n:]
    a2.reverse()
    d1={}
    d2={}
    for i in range(2**n):
        r1=[]
        r2=[]
        l1=[]
        l2=[]
        for j in range(n):
            if (i>>j)&1:
                r1.append(a1[j])
                r2.append(a2[j])
            else:
                l1.append(a1[j])
                l2.append(a2[j])
        s1=''.join(r1)+'-'+''.join(l1)
        s2=''.join(r2)+'-'+''.join(l2)
        if s1 in d1:d1[s1]+=1
        else:d1[s1]=1
        if s2 in d2:d2[s2]+=1
        else:d2[s2]=1
    ans=0
    for k in d1:
        if k in d2:
            ans+=d1[k]*d2[k]
    return ans

n=int(input())
a=list(input())
#a=list(map(int,input().split()))
#b=list(map(int,input().split()))
#ab=[list(map(int,input().split())) for _ in range(n)]
print(main(n,a))


Measured memory_bytes: 185396
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

ll n;

int main(void){
	scanf("%lld",&n);
	string s="";
	while(1){
		n--;
		s+=('a'+n%26);
		if(n<26)break;
		n/=26;
	}
	reverse(s.begin(),s.end());
	cout << s << endl;
	return 0;
}


Measured memory_bytes: 3688
#include<stdio.h>
int main(void){
    int n,i=0,j=0;
    int a,b,c,d;
    int building[13][11]={};
    scanf("%d",&n);
    while(scanf("%d %d %d %d",&a,&b,&c,&d)==4){
        building[(a-1)*3+b][c]+=d;
        if(i==n-1) break;
        i++;
    }

    for(i=1;i<=12;i++){
        for(j=1;j<=10;j++){
            printf(" %d",building[i][j]);
        }
        printf("\n");
          if(i==3 || i==6 || i==9){
              for(n=0;n<20;n++){
                printf("#");
              }
                    printf("\n");
            }
    }
    return 0;
}


Measured memory_bytes: 2108
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
const lint MOD =1000000007;
const lint MAX = 1000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;
 
 
lint fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() 
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint 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(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return 0;
        }
    }
 
    return 1;
}
   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;
}
    lint lcm(lint a,lint b){
        return a/__gcd(a,b)*b;
    }
     lint gcd(lint a,lint b){
        return __gcd(a,b);
    }    

  int main(){
      lint n;
      cin>>n;
      lint ans=0;
      rep(i,n){
          if((i+1)%3==0||(i+1)%5==0)continue;
          ans+=i+1;
      }
      cout<<ans;
  }
  
     


Measured memory_bytes: 3628
n = int(input())

for i in range(0, n):
    a = int(input())
    b = int(input())
    if len(str(a + b)) > 80:
        print("overflow")
    elif len(str(a)) > 80:
        print("overflow")
    elif len(str(b)) > 80:
        print("overflow")
    else :
        print(a + b)

Measured memory_bytes: 7576
#include<stdio.h>

int main(void){
    int n[3];
    int i;
    int cnt_go = 0;
    int cnt_shichi = 0;

    scanf("%d %d %d", &n[0], &n[1], &n[2]);

    for(i = 0; i < 3; i++){
        if(n[i] == 5){
            cnt_go++;
        }
        if(n[i] == 7){
            cnt_shichi++;
        }
    }

    if(cnt_go == 2 && cnt_shichi == 1){
        puts("YES");
    }
    else{
        puts("NO");
    }


    return 0;
}

Measured memory_bytes: 128
import itertools

N=int(input())
seq = range(1,N+1,1)

allList=list(itertools.permutations(seq))
A=list(map(int, input().split()))
B=list(map(int, input().split()))

a = allList.index(tuple(A))
b = allList.index(tuple(B))

print(abs(a-b))

Measured memory_bytes: 8052
#include <iostream>
#include <iomanip>
#include <string>
typedef long long ll;
using namespace std;
const  ll INF = 1e9;
const  ll MOD = 1e9 + 7;
#define repi(i,n,init) for(ll i=init;i<(n);i++)

int main()
{
    string n;
    cin >> n;
    repi(i,2,0){
        if(n[i]-'0' == 9){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

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

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using mii = map<int, int>;
using msi = map<string, int>;
using pii = pair<int, int>;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << std::fixed << std::setprecision(10);

    int n; cin >> n;
    bool f = false;
    FOR(i, 1, 10) FOR(j, 1, 10) {
        if(i * j == n) {
            f = true;
        }
    }
    if(f) cout << "Yes" << endl;
    else cout << "No" << endl;


    

    return 0;
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define BIT(X, i) ((X>>i)&1)
#define REP(i, a, b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(a) (a).begin(), (a).end()
#define r_all(a) (a).rbegin(), (a).rend()
#define in(x) cin>>x
#define ina(x, n) rep(x_i,n) cin>>x[x_i]
#define outa(x, n) rep(x_i,n) cout<<x[x_i]<<" \n"[x_i==n-1]

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> pll;
typedef vector<pll> vll;
typedef priority_queue<ll> pq;

const int MOD = 1e9+7;
const int INF = (1<<30);
const ll INFL = (1L<<62);

int main() {
  int n, x; cin >> n >> x;
  if (x==1 || x==2*n-1) {
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;
  vl ans(2*n-1); iota(all(ans),1);
  int rot = (x-n+2*n-1)%(2*n-1);
  rotate(ans.begin(),ans.begin()+rot,ans.end());
  rep(i,2*n-1) {
    cout << ans[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 3072
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            // 解答はココに書く
            string[] word = cin.ReadStrArray(2);
            int[] data = cin.ReadIntArray(2);
            string suteta = cin.ReadLine;
            if (word[0] == suteta)
            {
                data[0]--;
            }
            if(word[1] == suteta)
            {
                data[1]--;
            }

            Console.WriteLine("{0} {1}", data[0], data[1]);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}


Measured memory_bytes: 11220
def yakusu(x):
    A=[]
    for i in range(1,x+1):
        if x%i==0:
            A.append(i)
    return(len(A))
    
n=int(input())
ans=0

for j in range(1,n+1,2):
    if yakusu(j)==8:
        ans+=1
print(ans)

Measured memory_bytes: 9144
#include <iostream>
#include <algorithm>
#include <string.h>
#define MAXN 105
#define LL long long
using namespace std;
int a[MAXN], flag[MAXN];
int n;
LL solve(int index)
{
    LL res = 0;
    if(index * 3 > n)
    {
        for(int i = index; i <= n; i++)
        {
            if(i % 2 == 0 && i / 2 >= index) continue;
            if(i + i > n)
            {
                if(!flag[i]) res += max(0, a[i]);
            }
            else
            {
                if(!flag[i])
                {
                    if(flag[i + i])
                    {
                        res += max(0, a[i]);
                    }
                    else
                    {
                        res += max(0, max(a[i], a[i] + a[i + i]));
                    }
                }
            }
        }
        return res;
    }
    else if(flag[index])
    {
        return solve(index + 1);
    }
    else
    {
        LL tmp = a[index] + solve(index + 1);
        for(int i = index; i <= n; i += index)
        {
            flag[i]++;
        }
        res = max(tmp, solve(index + 1));
        for(int i = index; i <= n; i += index)
        {
            flag[i]--;
        }
        return res;
    }
}

int main()
{
    while(cin >> n)
    {
        memset(flag, 0, sizeof(flag));
        for(int i = 1; i <= n; i++) cin >> a[i];
        cout << solve(1) << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional>
#include <cctype>
#include <locale>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ppb pop_back()
#define ALL(a) (a).begin(),(a).end()
#define int long long
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
//s[i]=tolower(s[i]); islower(s[i]); cout << tolower(s[i])はバグ

vector<int> ch(vector<int> &a){
    int n=a.size();
    vector<int> ret(n,0);
    vector<int> ret2(n,0);
    rep(i,n){
        ret[max(0LL,(i-a[i]))]++;
        if(i+a[i]+1<n) ret[i+a[i]+1]--;
    }
    ret2[0]=ret[0];
    rep(i,n-1){
        ret2[i+1]=ret2[i]+ret[i+1];
    }
    return ret2;
}

signed main(){
    int n,k; cin >> n >> k;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    vector<int> ans=a;
    for(int i=1;i<100;i++){
        ans=ch(ans);
        if(i==k){
            for(auto u:ans) cout << u << " ";
            return 0;
        }
    }
    for(auto u:ans) cout << u << " ";
    return 0;
}


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

int n,a,b;

int main()
{
	while(cin>>a>>b>>n){
		for(int i=0;i<n;++i)
		{
			if(i%2==0){
				b+=a/2;
				a/=2;	
			}else{
				a+=b/2;
				b/=2;
			}
		}
		cout<<a<<" "<<b<<endl;
	}
	
	return 0;
} 

Measured memory_bytes: 256
import math
import string
import collections
from collections import Counter


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]
k = int(input())
s = input()
if len(s) > k:
    print(s[:k]+'...')
else:
    print(s)


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

int main() {
	ios_base::sync_with_stdio( false );

	string S;
	cin >> S;

	bool result = S[0] == 'A';
	if( result ) {
		int n = (int)S.size();
		int al = 0;
		int uc = 0;

		for( int i = 1; i < n; ++i ) {
			if( S[i] >= 'a' && S[i] <= 'z' ) {
				al += 1;
			}
			else if( i >= 2 && i < n-1 && S[i] == 'C' ) {
				uc += 1;
			}
		}

		result = uc == 1 && al == n-2;
	}

	cout << (result ? "AC" : "WA") << endl;
	return 0;
}


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

bool find(int i, int j, string str){
    if(j==3){
        return true;
    }
    else if(i == n){
        return false;
    }
    else if(s[i] == str[j]){
        return find(i+1, j+1, str);
    }
    else return find(i+1, j, str);
}
int main(void){
    cin>>n;
    cin>>s;
    reverse(s.begin(), s.end());
    int ans=0;
    rep(k, 1000){
        string str = to_string(k);
        reverse(str.begin(), str.end());
        for(int i=str.size()+1;i<=3;i++){
            str.push_back('0');
        }
        if(find(0, 0, str)) ans++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 6400
import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		int X = Integer.parseInt(in.next());
		int ans = 0;
		for (int i = 1; i < (1000000); i++){
			if( ((i*i+i)/2) >= X){
				ans = i;
				break;
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 23380
#include<stdio.h>

int main(void)
{
   int n, m, a[100], i, x=0, s=0;

   scanf("%d%d",&n,&m);
   for(i=0;i<n;i++){
      scanf("%d",&a[i]);
      s=s+a[i];
   }

   for(i=0;i<n;i++)
      if(4*m*a[i]>=s) x++;

   if(x>=m)
      printf("Yes\n");
   else
      printf("No\n");
   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)

int main(){
   int h,w;
   cin >> h >> w;
   int dx[8] = {-1,0,1,-1,1,-1,0,1};
   int dy[8] = {-1,-1,-1,0,0,1,1,1};

   char a[h][w];
   rep(i,h){
      rep(j,w){
         cin >> a[i][j];
      }
   }

   rep(i,h){
      rep(j,w){
         if(a[i][j] == '.'){
            int count = 0;
            rep(k,8){
               int tmpx = i + dx[k];
               int tmpy = j + dy[k];
               if(tmpx < 0 || tmpx >= h) continue;
               if(tmpy < 0 || tmpy >= w) continue;
               if(a[tmpx][tmpy] == '#') count++;
            }
            a[i][j] = count + '0';
         }
      }
   }

   rep(i,h){
      rep(j,w){
         cout << a[i][j];
      }
      cout << endl;
   }

   return 0;
}

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

//#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define LL long long

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

	int rem = n%1000;

	if(rem == 0) {
		cout << 0 << endl;
	}
	else {
		cout << 1000 - rem << endl;
	}

	return 0;
}


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

#include <algorithm>
#include<iostream>

using namespace std;


int main(){
          
          
          int a;
    int b;
    int c;
    
    
    cin >> a >> b >> c;
    
    
    int d = a - b;
    
    int dounts = d%c;
    
    
    
    cout << dounts << endl;
          
          
          
     return 0;     
          
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < (int)n; ++i)
#define RREP(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define FOR(i, s, n) for (int i = s; i < (int)n; ++i)
#define RFOR(i, s, n) for (int i = (int)n - 1; i >= s; --i)
#define ALL(a) a.begin(), a.end()
#define IN(a, x, b) (a <= x && x < b)
template<class T>inline void out(T t){cout << t << "\n";}
template<class T,class... Ts>inline void out(T t,Ts... ts){cout << t << " ";out(ts...);}
template<class T>inline bool CHMIN(T&a,T b){if(a > b){a = b;return true;}return false;}
template<class T>inline bool CHMAX(T&a,T b){if(a < b){a = b;return true;}return false;}
constexpr int INF = 1e18;



signed main(){
	int X,Y;
	cin>>X>>Y;
	REP(i,200){
		REP(j,200){
			int x = i + j;
			int y = i * 2 + j * 4;
			if(x == X && y == Y){
				out("Yes");
				return 0;
			}
		}
	}
	out("No");
}

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

#define rep(ver,n) rep2(ver,0,n)
#define rep2(ver,m,n) for(int ver=m;ver<(n);ver++)
#define dup(x,y) (((x)+(y)-1)/(y))
#define all(v) (v).begin(), (v).end()
#define debug(x) std::cerr<<#x<<": "<<x<<"\n"
#define debug2(x,y) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<"\n"
#define debug3(x,y,z) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<", "<<#z<<": "<<z<<"\n"

typedef long long ll;

int main(){
  int n, a[100100] = {}, maxdis = 0;
  cin >> n >> a[0];
  if(a[0] != 0){
    cout << 0;
    return 0;
  }
  rep2(i, 1, n){
    int in;
    cin >> in;
    if(in == 0){
      cout << 0;
      return 0;
    }
    a[in]++;
    maxdis = max(maxdis, in);
  }
  
  ll ans = 1;
  a[0] = 1;
  rep(i, maxdis){
    int ix = i + 1;
    if(a[ix] == 0){
      cout << 0;
      return 0;
    }
    ll addans = 1;
    rep(j, a[ix]){
      addans *= a[i];
      if(addans > 998244353)
        addans %= 998244353;
    }
    ans *= addans;
    if(ans > 998244353){
      ans %= 998244353;
    }
  }
  
  if(ans >= 998244353){
    ans %= 998244353;
  }
  
  cout << ans;
  
  return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	if(a==b)
	{
		if(a!=c)
		{
			cout<<"Yes";return 0;
		}
	 } 
	if(a==c)
	{
		if(a!=b)
		{
			cout<<"Yes";return 0;
		}
	 } 
	if(c==b)
	{
		if(a!=c)
		{
			cout<<"Yes";return 0;
		}
	 } 
	cout<<"No";  
}

Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
#include<string>
#include<vector>
#include <math.h>
#include <iomanip>

using namespace std;

int main()
{
	string s1;
	cin >> s1;
	s1.replace(0, 4, "");
	cout << "2018" << s1 << endl;
}

Measured memory_bytes: 256
let rep n s =
  let rec aux n =
    if n > 0 then (print_string s; aux (pred n))
  in
  aux n

let () =
  Scanf.scanf "%d %d %d %d" (fun sx sy tx ty ->
      let x = abs (tx - sx) and y = abs (ty - sy) in
      rep x "R";
      rep y "U";
      rep x "L";
      rep y "D";
      print_string "D";
      rep (succ x) "R";
      rep (succ y) "U";
      print_string "L";
      print_string "U";
      rep (succ x) "L";
      rep (succ y) "D";
      print_string "R";
      print_newline ();
    )

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,k,q,a;
  int point[100005]={};

  cin>>n>>k>>q;

  for(int i=1;i<=q;i++){
    cin>>a;
    point[a]++;
  }

  q-=k;
  for(int i=1;i<=n;i++) point[i]>q ? cout<<"Yes"<<endl : cout<<"No"<<endl;

  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=999999999999;

int main(){
    int n,m;
    cin>>n>>m;
    if(n%2==1){
        for(int i=1;i<=m;i++){
            if(i%2==1){
                cout<<i/2+1<<" "<<n/2+1-i/2<<endl;
            }else{
                cout<<n/2+i/2+1<<" "<<n+1-i/2<<endl;
            }
        }
    }else{
        for(int i=1;i<=m;i++){
            if(i%2==1){
                cout<<i/2+1<<" "<<n/2-i/2<<endl;
            }else{
                cout<<n/2+i/2<<" "<<n-i/2<<endl;
            }
        }
    }
}

Measured memory_bytes: 3652
#include <iostream>

using namespace std;

int main(){
	long long a, b, c;
	cin >> a >> b >> c;
	
	long long res;
	
	if(a%2 == 0 || b%2 == 0 || c%2 == 0) res = 0;
	else{
		res = min(a*b, min(b*c, a*c));
	}
	
	cout << res << endl;
	
	return 0;
}

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

#define ll long long

#define x first
#define y second
#define pb push_back
#define mp make_pair

#define all(a) (a).begin(), (a).end()

bool f[222222];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    memset(f, 0, sizeof(f));
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        if (x == 1) {
            f[1] = 1;
        } else {
            if (f[x - 1]) f[x] = 1;
        }
    }
    int ans = -1;
    for (int i = 0; i < 222222; i++) {
        if (f[i]) ans = n - i;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 512
x=range(int(input()))
f=lambda a,b,c,d : a*d - b*c 
P=[]
for _ in x:P+=[[int(i) for i in input().split()]]
_=0
P+=[P[0]]
for j in x:_+=f(P[j][0],P[j][1],P[j+1][0],P[j+1][1])
print(_*0.5)

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

int main(){
 int N;
 cin>>N;
 vector<vector<int>>G(N);
 vector<pair<int,int>>vp;
 for(int i=0;i<N-1;i++){
     int a,b;
     cin>>a>>b;
     a--,b--;
     G[a].emplace_back(b);
     G[b].emplace_back(a);
     vp.emplace_back(a,b);
 }

int K=0;

queue<int>q;
vector<bool>used(N,0);
map<pair<int,int>,int>I;
vector<int>cs(N,0);

used[0]=1;
q.push(0);

while(!q.empty()){

    int v=q.front();q.pop();
    if(K<(int)G[v].size())K=G[v].size();
    int cur=1;

    for(auto u:G[v]){
    if(used[u])continue;

    if(cur==cs[v])cur++;
    cs[u]=I[make_pair(u,v)]=I[make_pair(v,u)]=cur++;
    q.push(u);
    used[u]=1;
    }
}
cout<<K<<endl;
 for(auto p:vp)cout<<I[p]<<endl;


return 0;
}

Measured memory_bytes: 19700
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <numeric>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, X;
    cin >> N >> X;
    int x[100010];
    rep(i, N) {
        cin >> x[i];
        x[i] = abs(X - x[i]);
    }
    int G = 0;
    rep(i, N) G = std::gcd(G, x[i]);
    cout << G << endl;

    return 0;
}


Measured memory_bytes: 4024
#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    string s; cin>>s;
    if(s=="RRR") cout<<3<<'\n';
    else
    {
        if(s=="SSS") cout<<0<<'\n';
        else
        {
            if(s=="RRS"||s=="SRR") cout<<2<<'\n';
            else cout<<1<<'\n';
        }
    }
}


Measured memory_bytes: 3612
#define _USE_MATH_DEFINES

#include <cstdio>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;

int main(){
	
	int M;
	cin >> M;
	
	cout << 48 - M << endl;
	
	return 0;
}

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


int main() {
  string s; cin>>s;
  int q; cin>>q;
  int k=1;
  int t,f; char c;
  string owari="";string hazime="";
  for(int i=0;i<q;i++){
    cin>>t;

    if(t==1){k=k*(-1);}

    if(t==2){
      cin>>f>>c;
      if(f==1){
        if(k==-1){owari=owari+c;}
        else{hazime=c+hazime;}
      }
      if(f==2){
        if(k==-1){hazime=c+hazime;}
        if(k==1){owari=owari+c;}
      }
    }

  }
  s=hazime+s+owari;
  if(k==-1){reverse(s.begin(),s.end());}
  cout << s << endl;
}


Measured memory_bytes: 1512
import java.util.*;
import java.util.Arrays;
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner scanner = new Scanner(System.in);
        
        int K = scanner.nextInt();
        int S = scanner.nextInt();
        int sub = 0;
        
        int count = 0;
        for(int i=0;i<=K;i++){
            if(i != S){
                for(int j=0;j<=K;j++){
                    if(i+j != S){
                        sub = S - (i+j);
                        if(sub>=0 && sub<=K){
                        //System.out.println("i:"+i+" j:"+j+"k:"+sub);
                        count++;
                        
                        }
                    }else if(i+j == S)
                    {
                        //System.out.println("i:"+i+" j:"+j);
                        count++;
                        break;
                    }
                }
                
            }else if(i == S){
               // System.out.println("i:"+i);
                count++;
            }
        }
        
        System.out.println(count);
    }
}

Measured memory_bytes: 35640
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll MOD = (1e+9)+7;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
typedef pair<ll,P> PP;
ll d[300][300];
int noneed[300][300] = {};
int main() {
	int n; cin >> n;
	ll sum = 0;
	rep(i, n) {
		rep(j, n) {
			cin >> d[i][j];
			if (i < j)sum += d[i][j];
		}
	}
	bool f = true;
	rep(i, n) {
		Rep(j, i + 1, n) {
			Rep(k, j + 1, n) {
				ll x = d[i][j];
				ll y = d[j][k];
				ll z = d[k][i];
				if (x + y < z || y + z < x || z + x < y)f = false;
			    else if (x + y == z) {
					noneed[i][k] = 1;
				}
				else if (y + z == x) {
					noneed[i][j] = 1;
				}
				else if (z + x == y) {
					noneed[j][k] = 1;
				}
			}
		}
	}
	rep(i, n) {
		Rep(j, i + 1, n) {
			if (noneed[i][j])sum -= d[i][j];
		}
	}
	if (!f) {
		cout << -1 << endl;
	}
	else {
		cout << sum << endl;
	}
	return 0;
}

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

using namespace std;

template <class T>inline T updmax(T &a, T b) { return a = max(a, b); }
template <class T>inline T updmin(T &a, T b) { return a = min(a, b); }

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	int n, d;
	cin >> n >> d;
	cout << (n+2*d)/(2*d+1) << "\n";
	return 0;
}

Measured memory_bytes: 256
var lines = [];

var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
});

rl.on('line', function (x) {
    lines.push(x);
});

rl.on('close', function () {
    var b = lines[0];
    switch (b) {
        case "A": console.log("T"); break;
        case "T": console.log("A"); break;
        case "C": console.log("G"); break;
        case "G": console.log("C"); break;
    }
});

Measured memory_bytes: 21956
def q1():
    _, A, B, C, D = [int(x) - 1 for x in input().split(' ')]
    S = input()
    if "##" in S[A:D + 1]:
        return False
    if C < D:
        return True
    for b in range(B, D + 1):
        if S[b] == '#':
            continue
        if (S[b - 1] != "#" and S[b + 1] != "#"):
            return True
    return False

print('Yes' if q1() else 'No')


Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,d;
  cin >> n >> d;
  vector<vector<double>> x(n,vector<double>(d));
  for(int i=0;i<n;i++){
    for(int j=0;j<d;j++){
      cin >> x[i][j];
    }
  }
  int cnt=0;
  for(int i=0;i<n-1;i++){
    for(int j=i+1;j<n;j++){
      double sum=0;
      for(int k=0;k<d;k++){
        sum+=(x[i][k]-x[j][k])*(x[i][k]-x[j][k]);
      }
      if(floor(sqrt(sum))==sqrt(sum)){
        cnt++;
      }
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<list>
#include<vector>
#include<algorithm>
#include<string>
#include<stdio.h>
#include<math.h>
#include<unordered_map>
#include<map>

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using lst = list<int>;


int main()
{
	int N; cin >> N;
	lst A;

	int total = 0;
	for (int i = 0; i < N; ++i)
	{
		int a; cin >> a;
		total += (a > 0) ? a : -a;
		A.push_back(a);
	}
	A.sort();

	int mi = A.front(); A.pop_front();
	if (mi > 0)
	{
		total -= 2 * mi;
	}
	int ma = A.back(); A.pop_back();
	if (ma < 0)
	{
		total += 2 * ma;
	}
	cout << total << endl;

	while (!A.empty())
	{
		int a = A.front(); A.pop_front();
		if (a > 0)
		{
			cout << mi << " " << a << endl;
			mi -= a;
		}
		else
		{
			cout << ma << " " << a << endl;
			ma -= a;
		}
	}

	cout << ma << " " << mi << endl;

	return 0;
}

Measured memory_bytes: 5376
#include<cstdio>
#include<cstring>
#include<cctype>
#include<vector>
#include<algorithm>
using namespace std;
const int maxn=200010,MOD=1000000007;
int read(){
    char c;int s=0,t=1;
    while(!isdigit(c=getchar()))if(c=='-')t=-1;
    do{s=s*10+c-'0';}while(isdigit(c=getchar()));
    return s*t;
}
struct cyc{
	int z0,z1,z2;
};
cyc operator + (cyc a,cyc b){
	cyc c;
	c.z0=1ll*a.z0*b.z0%MOD;
	c.z1=(1ll*a.z0*b.z1+1ll*a.z1*b.z0)%MOD;
	c.z2=(1ll*a.z0*b.z2+1ll*a.z2*b.z0+1ll*a.z1*b.z1+1ll*a.z2*b.z2+1ll*a.z1*b.z2+1ll*a.z2*b.z1)%MOD;
	return c;
}
vector<cyc>a[maxn];
int n,fa[maxn],first[maxn],cnt=0,tot=0,b[maxn];
struct edge{int v,from;}e[maxn*2];
void insert(int u,int v){cnt++;e[cnt].v=v;e[cnt].from=first[u];first[u]=cnt;}
int MO(int x){return x>=MOD?x-MOD:x;}
void merge(int &x,int y){
	if(a[x].size()<a[y].size())swap(x,y);
	for(int i=0;i<(int)a[y].size();i++){
		a[x][a[x].size()-i-1]=a[x][a[x].size()-i-1]+a[y][a[y].size()-i-1];
	}
}
int main(){
	n=read()+1;
	for(int i=2;i<=n;i++)fa[i]=read()+1,insert(fa[i],i);
	for(int i=n;i>=1;i--){
		int mx=0;
		if(!first[i]){
			a[b[i]=++tot].push_back((cyc){(MOD+1)/2,(MOD+1)/2,0});
		}
		else{
			b[i]=b[e[first[i]].v];
			for(int j=e[first[i]].from;j;j=e[j].from){
				mx=max(mx,min((int)a[b[i]].size(),(int)a[b[e[j].v]].size()));
				merge(b[i],b[e[j].v]);
			}
			a[b[i]].push_back((cyc){(MOD+1)/2,(MOD+1)/2,0});
		}
		for(int j=(int)a[b[i]].size()-1-1;j>=(int)a[b[i]].size()-mx-1;j--)a[b[i]][j].z0+=a[b[i]][j].z2,a[b[i]][j].z2=0;
	}
	int ans=0,N=1;
	for(int i=1;i<=n;i++)N=(N<<1)%MOD;
	for(int i=0;i<(int)a[b[1]].size();i++)ans=MO(ans+1ll*a[b[1]][i].z1*N%MOD);
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 16128
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<cstdio>
#include<vector> 
#include<iomanip>
#include<cmath>
using namespace std;
int main() {
	ios::sync_with_stdio(false);
	string str;
	int i;
	while( cin>>str )
	{
		int flag=0,cnt=0;
		if( str.length()>10 )
		{
			str=str.substr(0,10);
		}
		for( i=2;i<str.length()-1;i++ )
		{
			if( !( str[i]>='a' && str[i]<='z' ) && str[i]!='C') //出现不是小写的字符又不是C的字符 
			{
					flag=1;
					break;
			}
			if( str[i]=='C' )
			{
				cnt++;
			}	
		}
		if( str[0]=='A' && ( str[1]>='a' && str[1]<='z' ) && flag==0 && ( str[ str.length()-1 ]>='a' && str[ str.length()-1 ]<='z' ) && cnt==1 )
			cout<<"AC\n";
		else
			cout<<"WA\n";
	/*	if( str[0]!='A' )
			cout<<"WA\n";
		else if( str[1]=='C' || str[ str.length()-1 ]=='C' || !( str[1]>'a' && str[1]<'z' ) || !( str[ str.length()-1 ]>'a' && str[ str.length()-1 ]<'z' ) )
				cout<<"WA\n";
		else 
		{
				for( i=2;i<str.length()-1;i++ )
				{
					if( !( str[i]>'a' && str[i]<'z' ) && str[i]!='C' ) //出现不是小写的字符又不是C的字符 
					{
						flag=1;
						break;
					}
					if( str[i]=='C' )
					{
						cnt++;
					}	 
				}
				if( flag==1 || cnt==0 || cnt>1 )
					cout<<"WA\n";
				else
					cout<<"AC\n";
		} */
	} 
	return 0;
}

Measured memory_bytes: 256
#define  _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
#pragma comment (linker, "/STACK:526000000")

using namespace std;
typedef string::const_iterator State;
#define eps 1e-11L
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL

#define MOD 998244353LL
#define seg_size 262144*2LL
#define pb push_back
#define mp make_pair
typedef long long ll;
#define REP(a,b) for(long long (a) = 0;(a) < (b);++(a))
#define ALL(x) (x).begin(),(x).end()

unsigned long xor128() {
	static unsigned long x = 123456789, y = 362436069, z = 521288629, w = time(NULL);
	unsigned long t = (x ^ (x << 11));
	x = y; y = z; z = w;
	return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}

void init() {
	iostream::sync_with_stdio(false);
	cout << fixed << setprecision(10);
}

#define int ll
void solve() {
	while (true) {
		int t, p, r;
		cin >> t >> p >> r;
		if (t == 0) return;
		map<int, pair<int, int>> teaminfo;
		map<pair<int, int>, int> penalty;
		REP(i, r) {
			int a, b, c;
			string d;
			cin >> a >> b >> c >> d;
			if (d == "CORRECT") {
				int hoge = c + penalty[mp(a, b)] * 1200;
				teaminfo[a].first++;
				teaminfo[a].second += hoge;
			}
			else {
				penalty[mp(a, b)]++;
			}
		}
		vector<tuple<int, int, int>> teams;
		for (int i = 1; i <= t; ++i) {
			teams.push_back(make_tuple(teaminfo[i].first, -teaminfo[i].second, -i));
		}
		sort(ALL(teams));
		reverse(ALL(teams));
		REP(i, teams.size()) {
			cout << -get<2>(teams[i]) << " " << get<0>(teams[i]) << " " << -get<1>(teams[i]) << endl;
		}
	}
}
#undef int

int main() {
	init();
	solve();
}


Measured memory_bytes: 3244
import java.awt.List;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.Stack;
import java.util.TreeMap;
import java.util.TreeSet;

public class Main
{
	InputStream is;
	PrintWriter out;
	String INPUT = "";
	void solve()
	{
		char[] s=ns().toCharArray();
		s[3]='8';
		out.println(new String(s));
	
	}
	
	
	void run() throws Exception
	{
		is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);
		
		long s = System.currentTimeMillis();
		solve();
		out.flush();
		if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+"ms");
	}
	
	public static void main(String[] args) throws Exception 
	{ new Main().run(); }
	
	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;
	
	private int readByte()
	{
		if(lenbuf == -1)throw new InputMismatchException();
		if(ptrbuf >= lenbuf)
		{
			ptrbuf = 0;
			try 
			{ lenbuf = is.read(inbuf); } 
			catch (IOException e) 
			{ throw new InputMismatchException(); }
			if(lenbuf <= 0)return -1;
		}
		return inbuf[ptrbuf++];
	}
	
	private boolean isSpaceChar(int c)
	{ return !(c >= 33 && c <= 126); }
	private int skip() 
	{ int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }
	
	private double nd() 
	{ return Double.parseDouble(ns()); }
	private char nc()
	{ return (char)skip(); }
	
	private String ns()
	{
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while(!(isSpaceChar(b)))
		{ // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	
	private char[] ns(int n)
	{
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while(p < n && !(isSpaceChar(b)))
		{
			buf[p++] = (char)b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}
	
	private char[][] nm(int n, int m)
	{
		char[][] map = new char[n][];
		for(int i = 0;i < n;i++)map[i] = ns(m);
		return map;
	}
	
	private int[] na(int n)
	{
		int[] a = new int[n];
		for(int i = 0;i < n;i++)a[i] = ni();
		return a;
	}
	
	private int ni()
	{
		int num = 0, b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-')
		{
			minus = true;
			b = readByte();
		}
		
		while(true)
		{
			if(b >= '0' && b <= '9')
			{
				num = num * 10 + (b - '0');
			}else
			{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}
	
	private long nl()
	{
		long num = 0;
		int b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-')
		{
			minus = true;
			b = readByte();
		}
		
		while(true){
			if(b >= '0' && b <= '9')
			{
				num = num * 10 + (b - '0');
			}else
			{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}
	
	private static void tr(Object... o) 
	{ System.out.println(Arrays.deepToString(o)); }
}


Measured memory_bytes: 21460
//Krunal_Mathukiya
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define li long int
#define pb push_back
#define mkp make_pair
#define nikalL return
#define umap unordered_map
#define fr(i,s,n) for(int i=s;i<=n;++i)
#define frr(i,s,n) for(int i=s;i>=n;--i)
#define jaldiKarNe ios_base::sync_with_stdio(false);cin.tie(NULL);
#define mod 1000000007
int n;
long double arr[3001];
long double dp[3001][3001];
int vis[3001][3001];
long double fn(int i,int tail) {
	if(i==0) {
		if(tail<=n/2) return 1;
		else return 0;
	}
	if(vis[i][tail]) return dp[i][tail];
	vis[i][tail]=1;
	long double curr=(1-arr[i])*fn(i-1,tail)+arr[i]*fn(i-1,tail-1);
	return dp[i][tail]=curr;
}
int main(){
	jaldiKarNe;
	cin>>n;
	fr(i,1,n) cin>>arr[i];
	cout<<fixed<<setprecision(10)<<fn(n,n);
}


Measured memory_bytes: 113328
n,m = map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(m)]

AB.sort(reverse=1)

res_L = float('inf')
ans = 0
for a,b in AB:
	cur_R = b
	if cur_R <= res_L:
		res_L = a
		ans += 1
print(ans)

Measured memory_bytes: 27924
N = int(input())
T = list(map(int, input().split()))
V = list(map(int, input().split()))

vel_go = [0]
for ti, v_lim in zip(T, V):
    for _ in range(ti * 2):
        v = min(vel_go[-1] + 0.5, v_lim)
        vel_go.append(v)

vel_back = [0]
for ti, v_lim in zip(T[::-1], V[::-1]):
    for _ in range(ti * 2):
        v = min(vel_back[-1] + 0.5, v_lim)
        vel_back.append(v)
vel_back.reverse()

velocity = tuple(min(x, y) for x, y in zip(vel_go, vel_back))
ans = sum(0.25*(x+y) for x, y in zip(velocity[:-1], velocity[1:]))
print(ans)

Measured memory_bytes: 4724
# define _CRT_SECUREj_NO_WARNINGS 1
# define _USE_MATH_DEFINES
# include <iostream>
# include <numeric>
# include <string>
# include <bitset>
# include <vector>
# include <algorithm>
# include <cstdlib>
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iomanip>
# include <queue>
# include <sstream>
# include <climits>
# include <cmath>
# include <list>
# include <functional>
# include <string>
# include <ctime>
# include <set>
# include <forward_list>
# include <map>
# include <stack>
using namespace std;
# define INF ((int)(1<<25))
# define REP(i,n) for(int i=0;i<(int)n;i++)
# define FOR(i,n) REP(i,n)
# define FORI(i,k,n) for(int i=k;i<(int)n;i++)
# define TORAD 2.0*M_PI/360.0
# define INT(x) int x;cin>>x;
# define ALL(x) (x).begin(),(x).end()
# define RALL(x) (x).rbegin(),(x).rend()
# define DEBUG(x) cout<<#x<<":"<<x<<endl;
# define EPS 1e-12
#ifdef _MSC_VER
#include <intrin.h>
#define __builtin_popcount __popcnt
#endif
typedef long long lint;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
const int dx[4] = { 0,1,0,-1 }, dy[4] = { -1,0,1,0 };
template<class T> void debug(T a) { for (auto i : a)cout << i << endl; }

int main()
{
	int w, h;
	while (cin >> w >> h&&w)
	{
		typedef vector<pii> vp;
		typedef pair<pii, vp> P;
		int a[30][30];
		P start;
		FORI(i, 1, h + 1)
		{
			FORI(j, 1, w + 1)
			{
				cin >> a[i][j];
				if (a[i][j] == 2)
					start.first = make_pair(i, j);
			}
		}
		
		queue<P> que;
		que.push(start);
		while (!que.empty())
		{
			auto isout = [w, h](pii p)->bool {return (p.first <= 0 || p.first > h || p.second <= 0 || p.second > w);};
			auto fin = [](vp &a, pii p)->bool {return find(ALL(a), p) != a.end(); };
			P now = que.front(); que.pop();
			if (now.second.size() >= 10)continue;
			FOR(i, 4)
			{
				P next = now;
				pii p = next.first;
				bool ok = true;
				bool fi = true;
				while (1)
				{
					p.first += dy[i];
					p.second += dx[i];
					if (isout(p)) { ok = false; break; }
					if (a[p.first][p.second] == 3)
					{
						cout << next.second.size() + 1 << endl;
						goto end;
					}
					if (a[p.first][p.second] == 1&&!fin(next.second,p))
					{
						if (fi) { ok = false; break; }
						next.second.push_back(p);
						p.first -= dy[i];
						p.second -= dx[i];
						next.first = p;
						break;
					}
					fi = false;
				}
				if (ok)que.push(next);
			}
		}
		cout << -1 << endl;
	end:;
	}
}

Measured memory_bytes: 12344