akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
using namespace std;
#define ll long long
ll mod = 998244353; //素数
const int maxn = 3e5 + 100;
ll fra[maxn];
ll inv[maxn];
ll N,A,B,K;
void exgcd( ll b, ll p, ll & a, ll & k ) {
    if( p == 0 ) {
        a = 1; k = 0;
        return;
    }
    exgcd( p, b % p, k, a );
    k -= b / p * a;
    return;
}
ll INV(ll n){
    ll a,k;
    exgcd(n,mod,a,k);
    if(a < 0)
        a += mod;
    return a;
}
void init(ll n){
    fra[0] = 1;
    for (ll i = 1; i <= n; i++)
        fra[i] = fra[i - 1] * i % mod;
    inv[n] = INV(fra[n]);//快速幂也行
    for (ll i = n - 1; i >= 0; i--)
    {
        inv[i] = inv[i + 1] * (i + 1) % mod;
    }
}
ll C(ll up,ll down){
    if(up > down)
        return 0;
    ll ans =  fra[down] * inv[up] % mod * inv[down - up] % mod;
    return ans;
}
int main(){
    cin>>N>>A>>B>>K;
    init(N);
    ll numofA = 0;
    ll ans = 0;
    for (numofA = 0; numofA <= N; numofA++)
    {
        ll sub =  K - numofA * A;
        if(sub < 0)
            break;
        if(sub % B != 0)
            continue;
        ll numofB = sub / B;
        if(numofB > N)
            continue;
        //cout<<numofA <<' '<<numofB<<endl;
        ans = ans + (C(numofA,N) * C(numofB,N)) %mod;
        ans %= mod;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 5624
#include <iostream>

using namespace std;

int r, d, x;
int arr[12];

int main()
{
    cin >> r >> d >> x;
    arr[0] = r*x-d;
    for(int i=1; i<10; i++)
    {
        arr[i] = r*arr[i-1]-d;
    }
    for(int i=0; i<10; i++)
    {
        cout << arr[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int W = sc.nextInt();
        int[] w = new int[N];
        int[] v = new int[N];
        for (int i = 0; i < N; i++) {
            w[i] = sc.nextInt();
            v[i] = sc.nextInt();
        }

        long[][] dp = new long[N + 1][W + 1];

        for (int i = 0; i < N; i++) {
            for (int j = 0; j <= W; j++) {
                if (j >= w[i]) {
                    dp[i + 1][j] = Math.max(dp[i][j - w[i]] + v[i], dp[i][j]);
                } else {
                    dp[i + 1][j] = dp[i][j];
                }
            }
        }

        System.out.println(dp[N][W]);

    }
}


Measured memory_bytes: 125652
def main():
    N = int(input())
    A = [int(a) for a in input().split()]

    s = [0 for i in range(N + 1)]
    for i in range(N):
        s[i + 1] = A[i] + s[i]

    ans = 10**10
    for i in range(1, N):
        l = s[i] - s[0]
        r = s[-1] - s[i]
        ans = min(ans, abs(l - r))

    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 31508
#include <iostream>
#include <vector>
 
using namespace std;
 
const long long Target = 1000000;
 
struct Shain {
    int no;
    long long sum;
};
 
int main( void )
{
    vector<Shain> shain;
    long long n;
    while(cin >> n, n) {
        shain.clear();
        while(n--) {
            long long no, kin, num;
            cin >> no >> kin >> num;
            bool hit = false;
            vector<Shain>::iterator it = shain.begin();
            while(it != shain.end()) {
                if(it->no == no) {
                    it->sum += (kin * num);
                    hit = true;
                    break;
                }
                ++it;
            }
            if(!hit) {
                Shain tmp;
                tmp.no = no;
                tmp.sum = (kin * num);
                shain.push_back(tmp);
            }
        }
        bool hit = false;
        vector<Shain>::iterator it = shain.begin();
        while(it != shain.end()) {
            if(it->sum >= Target) {
                cout << it->no << endl;
                hit = true;
            }
            ++it;
        }
        if(!hit)
            cout << "NA" << endl;
    }
    return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i <= (n); i++)
using namespace std;
 
int main() {
  int a, b, c, x;
  cin >> a >> b >> c >> x;
  int count = 0;
  
  rep(i, a) {
    rep(j, b) {
      rep(k, c) {
        int total = 500 * i + 100 * j + 50 * k;
        if (x == total) {
          count++;
        }
      }
    }
  }
  
  cout << count << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
        
        Scanner sc = new Scanner(System.in);
        long a,b,i,j;
		while(true){
        a = sc.nextInt();
        b = sc.nextInt();
            if(a==0&&b==0)break;
            
		for(i=0;i<a;i++){
            for(j=0;j<b;j++){
            System.out.print("#");
        } 
         System.out.println();
      }
            System.out.println();
    }
  }
}


Measured memory_bytes: 34448
#include<iostream>
using namespace std;
int main(){
int total;
cin>>total;
int a,b,c,d,e,f,g,h,i,j;
while(total!=0){
cin>>a>>b>>c>>d>>e>>f>>g>>h>>i;
j=total-(a+b+c+d+e+f+g+h+i);
cout<<j<<'\n';
cin>>total;
}
return 0;
}

Measured memory_bytes: 1160
S = input()
T = input()
dic = {}
flag = False
N = len(S)
for i in range(N):
    if S[i] in dic.keys():
        if T[i] != dic[S[i]]:
            flag = True
            break
    else:
        dic[S[i]] = T[i]

if flag or len(dic.values()) != len(set(dic.values())):
    print("No")
else:
    print("Yes")

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,Q,K,A,B;
string S;
const ll MOD = 998244353;
//const ll MOD = (1e+9) + 7;
typedef pair<ll, ll> P;
const ll INF = (1LL<<62);

int main() {
    cin>>N>>K;
    vec a(N);
    rep(i,N) cin>>a[i];
    //rep(i,N) a[i] = 0;
    rep(_,K){
        vec bit(N + 2, 0);
        rep(i,N){
            bit[max(1LL, (i + 1) - a[i])] += 1;
            bit[min(N + 1, (i + 1) + a[i] + 1)] += -1;
        }
        ll m = N;
        reps(i,1,N + 2) bit[i] += bit[i-1];
        rep(i,N) {
            a[i] = bit[i+1];
            m = min(m, a[i]);
        }
        if(m == N) {
            break;
        }
    }
    rep(i,N) {
        cout<<a[i]<<" \n"[i == N - 1];
    }
}

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

using namespace std;

using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;

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

    string s;
    cin >> s;
    if (s[s.size() - 1] != 's') s+="s";
    else s+="es";
    cout << s << "\n";

	return 0;
}

Measured memory_bytes: 3660
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <complex>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <iterator>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
#include <limits>
#include <time.h>
#include <cstdint>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define sc second
#define fr first
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(ll i=n-1;i>=0;i--)
#define rRep(i,a,b) for(ll i=b-1;i>=a;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ll INF=1000000011;
constexpr ll MOD2=998244353;
constexpr ll LINF = 1001002003004005006ll;
constexpr ld EPS=10e-8;
template <class T, class U> inline bool chmax(T& lhs, const U& rhs) { if (lhs < rhs) { lhs = rhs; return 1; } return 0; }
template <class T, class U> inline bool chmin(T& lhs, const U& rhs) { if (lhs > rhs) { lhs = rhs; return 1; } return 0; }
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
  for(auto i=begin(v); i != end(v); ++i){
    if(i !=begin(v)) os << ' ';
    os << *i;
  }
  return os;
}

ll N,A[200007],C[200007],ans;

int main(){
  cin >> N ;
  rep(i,N){
    cin >> A[i];
    if(i+A[i]<N){
      C[i+A[i]]++;
    }
    if(i-A[i]>=0){
      ans+=C[i-A[i]];
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 6756
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1e9;
const ll MOD = 1e9 + 7;


int main(){
    string s;
    cin >> s;
    if(s[2] == s[3] && s[4] == s[5]) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import itertools

H, W = list(map(int, input().split()))
N = int(input())
a = list(map(int, input().split()))

m = sorted([(i,a[i]) for i in range(len(a))], key=lambda p: p[1], reverse=True)

color = 0
for y in range(H):
  s = ''
  for x in range(W):
    while m[color][1] <= 0: color += 1
    if s != '': s += ' '
    s += str(m[color][0] + 1)
    m[color] = (m[color][0], m[color][1] - 1)
  if y % 2 != 0:
      s = s.split()
      s.reverse()
      s = ' '.join(s)
  print(s)

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

vector<int> g[100005];
bool visited[100005];

void dfs(int v) {
  visited[v] = true;
  for (auto v2: g[v]) {
    if (visited[v2] == true) continue;
    dfs(v2);
  }
} 


int main() {
  int n,m;
  cin>>n>>m;
  rep(i,m) {
    int x,y,z;
    cin>>x>>y>>z;
    x--; y--;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  int ans=0;
  rep(i,n) {
    if (visited[i]==false) {
      ans++;
      dfs(i);
    }
  }
  cout<<ans<<endl;
  return 0;
}

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

using namespace std;

typedef long long ll;

const int N = 1e2+5;

int n;
bool f[N][6][3];
int p[N][11];

int main(){
    cin >> n;
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= 5; j++){
            for(int k = 1; k <= 2; k++){
                cin >> f[i][j][k];
            }
        }
    }
    for(int i = 1; i <= n; i++){
        for(int j = 0; j <= 10; j++){
            cin >> p[i][j];
        }
    }
    ll ans = -2e18;
    for(int mask = 1; mask < (1 << 10); mask++){
        ll cnt = 0 , open = 0;
        for(int i = 1; i <= n; i++){
            ll C = 0;
            for(int j = 0 , X = 1; j < 20; j += 2 , X++){
                C += ( (mask & (1 << j)) > 0 && f[i][X][1]);
                C += ( (mask & (1 << (j + 1))) > 0 && f[i][X][2]);
            }
            if(C >= 1)
                open ++;
            cnt += p[i][C];
        }
        if(open >= 1)
            ans = max(ans , cnt);
    }
    cout << ans << "\n";
}


Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i = 0; i < n; i++)
ll gcd(ll a,ll b){
    if(a == 0 || b == 0) return max(a,b);
    if(a > b) return gcd(b,a % b);
    else return gcd(a,b % a);
}
int main(){
    int n; cin >> n;
    vector<ll> a(n); rep(i,n) cin >> a[i];
    ll ans = a[0];
    rep(i,n-1){
      ans = gcd(ans,a[i+1]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        long k = sc.nextLong();

        sc.close();

        for (int i = 0; i < k && i < s.length(); i++) {
            if (s.charAt(i) != '1') {
                System.out.println(s.charAt(i));
                return;
            }
        }
        System.out.println(1);
    }
}

Measured memory_bytes: 21972
#include<bits/stdc++.h>
using namespace std;
     
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define INF 999999999999999999
#define endl "\n"
#define MOD 1000000007


 
void func(){

ll n,m;
cin>>n>>m;

ll sum=0;
for(int i=0;i<m;i++){
  ll t;
  cin>>t;
  sum+=t;
} 
if(sum>n)
cout<<"-1"<<endl;
else
cout<<n-sum<<endl;
}




    
int main(){
            ios_base::sync_with_stdio(false);
            cin.tie(0);
            cout.tie(0);
     
        /*  #ifndef ONLINE_JUDGE
          freopen("input.txt", "r" , stdin);
          freopen("output1.txt", "w" , stdout);
          #endif*/
     
       ll t=1;
       //cin>>t;
       while(t--)
       func();
}

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

int main() {
    int N, K;   cin >> N >> K;
    vector<double> prob(N, 1.0/N);

    for (int i = 0; i < N; ++i) {
        int point = i + 1;
        while (point < K){
            prob[i] *= 1.0/2;
            point *= 2;
        }
    }

    double ans = accumulate(prob.begin(), prob.end(), 0.0);

    cout << setprecision(13) << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <iostream>
#include <vector>
#include <set>
#include <cstring>
#include <string>
#include <map>
#include <cmath>
#include <ctime>
#include <algorithm>
#include <bitset>
#include <queue>
#include <sstream>
using namespace std;
#define mp make_pair
#define pb push_back
#define re return
#define fi first
#define se second
typedef vector<int> vi;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef vector<string> vs;
typedef vector<vi> vvi;
long long dp[51][2510];
int b[55];
int main() {
    //freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	int n,a;
	cin>>n>>a;
	for(int i=0;i<n;i++){
	    cin>>b[i];
	}
	dp[0][0]=1;
	for(int x=0;x<n;x++){
		for(int k=50;k>=0;k--)
		for(int y=0;y<=2500;y++){
			if(!dp[k][y])continue;
			dp[k+1][y+b[x]]+=dp[k][y];
		}
	}
	long long ans=0;
	for(int k=1;k<=50;k++)
	for(int y=0;y<=2500;y++)
	if(k*a==y)ans+=dp[k][y];
	cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 768
#include <iostream>
#include <cstdint>
#include <queue>
#include <algorithm>

using namespace std;

int main() {
	int64_t W, H;
	cin >> W >> H;
	std::priority_queue<int64_t, std::vector<int64_t>, std::greater<int64_t>> P;
	int64_t x;
	for (int i = 0; i < W + H; i++)
		cin >> x, P.push((x << 1) | (i < W));
	int64_t r = 0;
	int64_t wh[] = {W + 1, H + 1};
	while (!P.empty()) {
		int64_t p = P.top();
		r += (p >> 1) * wh[p & 1];
		wh[!(p & 1)]--;
		P.pop();
	}
	cout << r << endl;
	return 0;
}


Measured memory_bytes: 2420
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const int N = 100000;
int n, a[N];
bool cmp(int a, int b) {
	return (a & -a) > (b & -b);
}
int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; ++i)
		scanf("%d", a + i);
	sort(a, a + n, cmp);
	int Xor = 0, ans = 0;
	for (int i = 0; i < n; ++i)
		Xor ^= a[i];
	for (int i = 0; i < n; ++i)
		if (Xor & (a[i] & -a[i]))
			Xor ^= 2 * (a[i] & -a[i]) - 1, ++ans;
	printf("%d", Xor == 0 ? ans : -1);
	return 0;
}

Measured memory_bytes: 640
n = gets.to_i
def f(a,b)
  a.to_s.size > b.to_s.size ? a.to_s.size : b.to_s.size
end
ans = 10e10.to_i
1.upto(10e5.to_i) do |i|
  if n%i == 0
    ans = f(i,n/i) if ans > f(i,n/i)
  end
end
puts ans


Measured memory_bytes: 3836
using namespace std;
#include<bits/stdc++.h>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0);
#define END return EXIT_SUCCESS;
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR((I),0,(N))
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) cin>>(P)
#define IN2(P1,P2) cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) REP((I),(N)) cin>>(V[I])
#define INS2(I,N,V1,V2) REP((I),(N)) cin>>(V1[I])>>(V2[I]);
#define INS3(I,N,V1,V2,V3) REP((I),(N)) cin>>(V1[I])>>(V2[I])>>(V3[I]);
#define OUT(P) cout<<(P)<<endl
#define OUT2(P1,P2) cout<<(P1)<<" "<<(P2)<<endl
#define OUT3(P1,P2,P3) cout<<(P1)<<" "<<(P2)<<" "<<(P3)<<endl
#define OUTS(I,N,V) REP((I),(N)) cout<<(V[i])<<endl
#define ALL(C) (C).begin(),(C).end()
#define RALL(C) (C).rbegin(),(C).rend()
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}

string s[3];int i;
inline void solve(){
  IN3(s[0],s[1],s[2]);
  REP(i,3)cout<<(char)toupper(s[i][0]);
  cout<<endl;
}

int main(int argc,char**argv){
  BEGIN
  solve();
  END
}


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

#define REP(i,n) for(int i=0;i<n;++i)
#define RREP(i,n) for(int i=n-1;i>=0;--i)
#define FOR(i,m,n) for(int i=m;i<n;++i)
#define RFOR(i,m,n) for(int i=m-1;i>=n;--i)
#define ALL(v) v.begin(),v.end()
#define PB(a) push_back(a)
#define INF 1000000001
#define MOD 1000000007

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

using namespace std;


int main() {
	cin.tie(0);
	
	ios::sync_with_stdio(false);
	while (1) {
		string s;
		getline(cin, s);
		if (s[0] == '.')break;
		stack<int> r;
		REP(i, s.size()) {
			if (s[i] == '(') r.push(1);
			else if (s[i] == '[') r.push(0);
			else if (s[i] == ')') {
				if (r.empty()||r.top()==0) {
					cout << "no" << endl;
					break;
				}
				else {
					r.pop();
				}
			}
			else if (s[i] == ']') {
				if (r.empty()||r.top()==1) {
					cout << "no" << endl;
					break;
				}
				else {
					r.pop();
				}
			}
			if (i == s.size() - 1) {
				if (r.empty() &&r.empty()) cout << "yes" << endl;
				else cout << "no" << endl;
			}
		}
		
	}
	return 0;
}

Measured memory_bytes: 3244
#include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repb(i,a,b) for(int i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define int long long
#define fi first
#define se second
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;


signed main(){
    string s, t = "AIDUNYAN", r = "AIZUNYAN";
    cin>>s;
    if(s.size() < 8){
        cout << s << endl;
        return 0;
    }
    sort(all(t));
    //o(t);
    rep(i, 0, s.size() - 7){
        string tmp = s.substr(i, 8);
        sort(all(tmp));
        //o(tmp);
        if(tmp != t) continue;
        rep(j, 0, 8){
            s[i + j] = r[j];
        }
        i += 7;
    }
    cout << s << endl;
}

Measured memory_bytes: 1212
#define _CRT_SECURE_NO_WARNINGS
#define ANS_NUM (1)

#ifdef _____MY_DEBUG_____
#define VS_ENDPAUSE()	(system("pause"))
#else
#define VS_ENDPAUSE()
#endif

#include <stdio.h>
#include <iostream>
#include <math.h>
#include <cmath>

using namespace std;
typedef signed char int8;
typedef signed short int16;
typedef signed int int32;
typedef signed long long int64;
typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint32;
typedef unsigned long long uint64;

#if ANS_NUM == 1
void func(void)
{
	int32 a, b, c;
	scanf("%d %d %d", &a, &b, &c);
	if((c>=a) && (c<=b)){
		printf("Yes\n");
	} else {
		printf("No\n");
	}
}
#endif
#if ANS_NUM == 3
typedef struct objTag{
	uint32 val;
	uint32 length;
	objTag *next;
} obj;
void func(void)
{
	uint32 n, k;
	uint32 a, b;

	obj top = {0};

	(void)scanf("%d %d", &n, &k);

	for(uint32 i=0; i<n; i++){
		(void)scanf("%d %d", &a, &b);
		// search position
		obj *addPosition = &top;
		while(addPosition->next){
			if(addPosition->val <= a){
				addPosition = addPosition->next;
			} else {
				break;
			}
		}
		// add values
		obj *addObj = (obj *)malloc(sizeof(obj));
		addObj->val = a;
		addObj->length = b;
		addObj->next = addPosition->next;
		addPosition->next = addObj;
		addPosition = addPosition->next;
	}

	obj *objK = &top;
	uint32 l = 1;
	while(objK->next){
		if(l + objK->length > k){
			break;
		} else {
			l += objK->length;
			objK = objK->next;
		}
	}
	printf("%d\n", objK->val);
}
#endif


int main(void)
{
	func();

	VS_ENDPAUSE();
	return 0;
}










#if ANS_NUM == 2
void func(void)
{
	uint32 n, m;
	uint32 a, b;
	(void)scanf("%d %d", &n, &m);
	uint8 *ans = (uint8 *)calloc(n, sizeof(uint8));
	for(uint8 i=0; i<m; i++){
		(void)scanf("%d %d", &a, &b);
		ans[a-1]++;
		ans[b-1]++;
	}

	for(uint8 i=0; i<n; i++){
		printf("%d\n", ans[i]);
	}

	free(ans);
}
#endif



#if ANS_NUM == 4
void func(void)
{

}
#endif

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define DEBUG(x)  cout << #x << " = " << (x) << endl;
#define SORT(x) sort(ALL(x));
#define RSORT(x) sort(RALL(x));
#define SUM(x) accumulate(ALL(x),0);
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int inf = 1<<30;
const ll mod = 1000000007;
const double eps = 1e-9;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main () {
  int N; cin >> N;
  vector<vector<char>> s(N,vector<char>(10));
  rep(i,N) rep(j,10) cin >> s[i][j];

  rep(i,N) {
    SORT(s[i]);
  }

  vector<string> ss(N+1);
  rep(i,N) {
    rep(j,10) {
      ss[i] += s[i][j];
    }
  }

  RSORT(ss);

  ll ans = 0;
  ll cnt = 0;
  bool onaji = true;
  for(int i = 0; i < N; i++) {
    cnt++;
    if (ss[i]!=ss[i+1]) {
      if(cnt >= 2) {
        ans += (cnt-1)*cnt/2;
      }
      cnt = 0;
    }
  }

  cout << ans << endl;
}

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

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

    ll D = d * d;

    ll ans = 0;
    for (ll i = 0; i < n; ++i)
    {
        ll x, y;
        cin >> x >> y;

        if (D >= x * x + y * y)
        {
            ++ans;
        }
    }

    std::cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
typedef vector<long long> vi;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<string> vs;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int, int> pii;

inline bool valid(int x, int n) {
    return 0 <= x && x < n;
}

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

template <typename T>
inline T pop(queue<T>& q) {
    T front = q.front();
    q.pop();
    return front;
}

template <typename T>
inline T gcd(T a, T b) {
    for (; b; a %= b, swap(a, b));
    return a; 
}

template <typename T>
tuple<T, T, T> xgcd(T a, T b) {
    if (b == 0) return {1, 0, a};
    T x, y, g;
    tie(x, y, g) = xgcd(b, a%b);
    return {y, x-(a/b)*y, g};
}

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

    vs rst{"hi", "hihi", "hihihi", "hihihihi", "hihihihihi"};
    string S; cin >> S;
    for (string s : rst) {
        if (s == S) {
            cout << "Yes";
            return 0;
        }
    }

    cout << "No";
}


Measured memory_bytes: 256
import sys

S = [i for i in input()]
if S[0] != "A":
    print("WA")
    sys.exit()
else:
    S[0] = 'a'

ct = 0
for i in range(len(S[2:-1])):
    if S[i+2] == "C":
        S[i+2] = "c"
        ct += 1
    if ct > 1:
        print("WA")
        sys.exit()
if ct != 1:
    print("WA")
    sys.exit()

for i in S:
    if "a" <= i <= "z":
        pass
    else:
        print("WA")
        sys.exit()

print("AC")


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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int MAXN = 100;
const int MAXV = 1e5;
const ll INF = 2e15;

int n, m, sum;
int w[MAXN+10], v[MAXN+10];
ll dp[MAXN+10][MAXV+10];

int main()
{
    cin.tie(0); cout.tie(0);
    ios_base::sync_with_stdio(false);
    int i, j;

    scanf("%d%d", &n, &m);
    for(i=1; i<=n; i++) scanf("%d%d", &w[i], &v[i]), sum+=v[i];

    for(i=1; i<=sum; i++) dp[0][i]=INF;
    for(i=1; i<=n; i++) for(j=0; j<=sum; j++)
    {
        dp[i][j]=dp[i-1][j];
        if(j>=v[i]) dp[i][j]=min(dp[i][j], dp[i-1][j-v[i]]+w[i]);
    }

    for(i=sum; i>=0; i--)
    {
        if(dp[n][i]<=m)
        {
            printf("%d", i);
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 80128
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int mod=998244353;
void add(int &x,int y){
	x=(x+y)%mod;
}
int ksm(int b,int n){
	int res=1;
	while(n){
		if(n&1) res=1ll*res*b%mod;
		b=1ll*b*b%mod; n>>=1;
	}
	return res;
}
int f[100005],a[305];
signed main(){
	int n,sum=0;cin>>n;
	f[0]=1;
	for(int i=1;i<=n;++i){
		cin>>a[i];sum+=a[i];
		for(int j=sum;j>=a[i];--j)
			add(f[j],f[j-a[i]]+f[j-a[i]]);			
//		cout<<f[1]<<endl;
	}
	int ans=ksm(3,n),res=0;
//	cout<<sum<<endl;
	for(int i=0;i<=sum/2;++i)
		add(res,f[i]);
//	cout<<ans<<" "<<res<<endl;
	res=res*3ll%mod;
	add(ans,mod-res);
	memset(f,0,sizeof(f));
	f[0]=1;sum=0;
	for(int i=1;i<=n;++i){
		sum+=a[i];
		for(int j=sum;j>=a[i];--j)
			add(f[j],f[j-a[i]]);
	}
	if(sum%2==0) add(ans,3ll*f[sum/2]);
	cout<<ans;
	return 0;
}

Measured memory_bytes: 4348
<?php

$input = file_get_contents('php://stdin');
$counts = count_chars($input, 1);

$isBeautiful = true;
foreach($counts as $ord => $count) {
    if ($ord >= 97 && $ord <= 122 && $count % 2 !== 0) {
        $isBeautiful = false;
        break;
    }
}

echo $isBeautiful ? "Yes" : "No";

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

int main() {
	long long int a, b, d, r;
	double A, B, f;
	cin >> A >> B;
	a = A;
	b = B;
	d = a / b;
	r = a % b;
	f = A / B;
	cout << d << " " << r << " " << fixed << setprecision(5) << f << endl;
	return 0;
}

Measured memory_bytes: 3280
#include<bits/stdc++.h>
using namespace std;
template<class T>void gi(T &x){
    int f;char c;
    for(f=1,c=getchar();c<'0'||c>'9';c=getchar())if(c=='-')f=-1;
    for(x=0;c<='9'&&c>='0';c=getchar())x=x*10+(c&15);x*=f;
}
const int N=1e6+10,mod=1e9+7;
int Fac[N],inv[N],n,f[N];
inline int C(int n,int m){
    return 1ll*Fac[n]*inv[m]%mod*inv[n-m]%mod;
}
int main(){
  cin>>n;
  int ans=0,li=(n+1)/2;
  Fac[0]=inv[0]=inv[1]=1;
  for(int i=1;i<=n;i++)Fac[i]=1ll*Fac[i-1]*i%mod;
  for(int i=2;i<=n;i++)inv[i]=(mod-1ll*(mod/i)*inv[mod%i]%mod)%mod;
  for(int i=2;i<=n;i++)inv[i]=1ll*inv[i]*inv[i-1]%mod;
  for(int i=li;i<n;i++)f[i]=1ll*C(i-1,n-1-i)*Fac[i]%mod*Fac[n-1-i]%mod;
  for(int i=n-1;i>=li;i--)f[i]=(f[i]-f[i-1]+mod)%mod;
  for(int i=n-1;i>=li;i--)ans=(ans+1ll*i*f[i])%mod;
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 9984
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;


int main() {
    string S;
    cin >> S;
    bool A = false;
    
    for (int i = 0; i < S.size(); i++) {
        for (int j = 0; j < S.size() && j<i; j++) {
            if (S.at(i) == S.at(j)) {
                A = true;
            }
        }
      
    }
    if (A == true) {
        cout << "no" << endl;
    }
    else {
        cout << "yes" << endl;
    }
}


Measured memory_bytes: 3584
from scipy.misc import comb

N, K = map(int, input().split())

mod = 10 ** 9 + 7

for i in range(1, K + 1):
    a = comb(N - K + 1, i, exact=True)
    b = comb(K - 1, i - 1, exact=True)
    ret = a % mod * b % mod
    print(ret)


Measured memory_bytes: 13580
/* ex5_3
    riverstone*/

#include<stdio.h>
#include <stdbool.h>

#define LIM 100 //行数、列数の上限

int main(void){
    
    int height, width, i, j;
    //多次元配列の定義
    //black_rowとblack_colは各行と各列に1つ以上の黒が存在するかを記録
    char block[LIM][LIM];
    int black_row[LIM]={}, black_col[LIM]={};

    //入力の受け取り
    scanf("%d %d", &height, &width);

    //行列のマス(i,j)を読み取る
    //各行と各列に1つ以上の黒が存在するかをblack_rowとblack_colに記録
    for(i = 0; i < height; i++){
        for(j = 0; j < width; j++){
            scanf(" %c", &block[i][j]);
            if(block[i][j] == '#'){
                //マス(i,j)が黒のとき,black_row[i],black_col[j]を1にする
                black_row[i] = 1;
                black_col[j] = 1;
            }
        }   
    }
    
    //black_rowとblack_colを見て共に1であるようなマスの場合のみ出力
    for(i = 0; i < height; i++){
        if(black_row[i] == 1){
            for(j = 0; j < width; j++){
                if(black_col[j] == 1){
                    //black_row[i] = tureかつblack_col[j] = 0のときblock[i][j]を表示
                    printf("%c", block[i][j]);
                }
            }
            //1行すべて処理が終わると改行する
            printf("\n");  
        } 
    }
 
    return 0;
}

Measured memory_bytes: 128
def main():
    N,M,X = map(int,input().split())
    ca = [list(map(int,input().split())) for _ in range(N)]
    
    mincost = 12*10**5
    flag = 0
    for i in range(1,2**N):
        lev = [0] * M
        cost = 0
        a = list((("0"*N)+bin(i)[2:])[-N:])
        for j in range(N):
            if a[j] == "1":
                cost +=  ca[j][0]
                for k in range(M):
                    lev[k] += ca[j][k+1]
        if min(lev) >= X:
            mincost = min(mincost,cost)
            flag = 1
    if flag == 0:
        print(-1)
    else:
        print(mincost)
main()
 

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

using namespace std;

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
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 (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = 1e18;
const ll MOD = 1000000007;
//const ll MOD = 998244353;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0, -1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
//#define mp make_pair

int main() {
  string t;
  cin >> t;
  int n = 0, w = 0, s = 0, e = 0;
  rep (i, t.size()) {
    if (t[i] == 'N') n++;
    else if (t[i] == 'W') w++;
    else if (t[i] == 'S') s++;
    else e++;
  }
  if (n*s == 0 && n + s != 0) {
    cout << "No" << endl;
    return 0;
  }
  if (w*e == 0 && w + e != 0) {
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;
}
                            


Measured memory_bytes: 256
// Last Update:2017-11-29 22:27:04
// author:sjy
#include<bits/stdc++.h>
using namespace std;
typedef  long long LL;
string str1,str2;
int main(void)
{
    int n;
    while(scanf("%d",&n)!=EOF)
    {
        cin>>str1>>str2;
        if(str1 + str2 > str2 + str1)
            swap(str1,str2);
        int l1 = str1.length();
        int l2 = str2.length();
        int id = 0;
        for(int i = 0;i*l1 <= n;i++)
        {
            int c = (n-l1*i);
            if(c%l2 == 0)
            {
                id = i;
            }
        }
        string ask;
        for(int i = 0;i < id;i++)
            ask+=str1;
        for(int i = 0;i < (n-id*l1)/l2;i++)
            ask+=str2;
        cout<<ask<<endl;
        ask.clear();
    }
    return 0;
}


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

int main()
{
    int a,b;
    cin>>a>>b;
    if(a!=0)
    {
        int digC=0, i=b;
        while(i>0)
        {
            i/=10;
            digC++;
        }
        int c=1,pow=1;
        while(c<=digC)
        {
            pow=pow*10;
            c++;
        }
        a=a*pow;
        int sum=a+b;
        int disC=0;
        for(int c=1; c<=sum; c++)
        {
            if((c*c)==sum)
            {
                disC++;
            }
        }
            if(disC>0)
            {
                cout<<"Yes"<<endl;
            }
            else
            {
                cout<<"No"<<endl;
            }
    }
    else
    {
        int sum=a+b;
        int disC=0;
        for(int c=1; c<=sum; c++)
        {
            if((c*c)==sum)
            {
                disC++;
            }
        }
            if(disC>0)
            {
                cout<<"Yes"<<endl;
            }
            else
            {
                cout<<"No"<<endl;
            }
    }

    return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
	return scanner
}
func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	cnt := 0
	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
		cnt = 2
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}
	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)
	solve(scanner, writer)
	for i := 0; i < cnt; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
	writer.Flush()
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt(scanner)
	m := getNextInt(scanner)
	k := getNextInt(scanner)
	mc := newModcom(n * m)
	var ans mint
	p := mc.choose(n*m-2, k-2)
	for i := 0; i < n; i++ {
		for j := 0; j < m; j++ {
			left := mint(sum(j))
			right := mint(sum(m - 1 - j))
			row := left.add(right)
			ans.addAs(right).addAs(row.mul(mint(n - 1 - i))).addAs(mint(m).mul(mint(sum(n - 1 - i))))
		}
	}
	ans.mulAs(p)
	fmt.Fprintln(writer, ans)
}

func sum(a int) int {
	return a * (a + 1) / 2
}

type modcom struct {
	facs, invs []mint
}

func newModcom(n int) modcom {
	facs := make([]mint, n+1)
	invs := make([]mint, n+1)
	facs[0] = 1
	for i := 0; i < n; i++ {
		facs[i+1] = facs[i].mul(mint(i + 1))
	}
	invs[n] = facs[n].inv()
	for i := n - 1; i >= 0; i-- {
		invs[i] = invs[i+1].mul(mint(i + 1))
	}
	return modcom{
		facs: facs,
		invs: invs,
	}
}
func (mc *modcom) choose(n, k int) mint {
	return mc.facs[n].mul(mc.invs[k]).mul(mc.invs[n-k])
}

type mint int64

func (mt mint) mod() mint {
	m := mint(1e9 + 7)
	mt %= m
	if mt < 0 {
		return mt + m
	}
	return mt
}
func (mt mint) inv() mint {
	var m, y mint
	m.subAs(2)
	dbl := mt
	y = 1
	for i := 0; i < 31; i++ {
		if m%2 == 1 {
			y.mulAs(dbl)
		}
		m >>= 1
		dbl.mulAs(dbl)
	}
	return y
}
func (mt mint) add(x mint) mint {
	return (mt + x).mod()
}
func (mt mint) sub(x mint) mint {
	return (mt - x).mod()
}
func (mt mint) mul(x mint) mint {
	return (mt * x).mod()
}
func (mt mint) div(x mint) mint {
	return mt.mul(x.inv())
}
func (mt *mint) addAs(x mint) *mint {
	*mt = mt.add(x)
	return mt
}
func (mt *mint) subAs(x mint) *mint {
	*mt = mt.sub(x)
	return mt
}
func (mt *mint) mulAs(x mint) *mint {
	*mt = mt.mul(x)
	return mt
}
func (mt *mint) divAs(x mint) *mint {
	*mt = mt.div(x)
	return mt
}


Measured memory_bytes: 3968
#include<bits/stdc++.h>
#define ll long long
#define Filein freopen("in.txt","r",stdin)
#define Fileout freopen("Out.txt","w",stdout)
using namespace std;
int main()
{

      unsigned long long a,b,d,res=0;
      cin >> a >> b >> d;
      res=(b/d)-(a/d);
      if(a%d==0)res++;
      cout << res << endl;
      return 0;
}


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


static long long gcd(long long a, long long b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

static long long lcm(long long a, long long b) {
	return a * b / gcd(a, b);
}


int main(void) {
	long long A, B, C, D;
	cin >> A >> B >> C >> D;

	if (A > B) {
		cout << 0 << endl;
		return 0;
	}

	// 総数 - Cで割り切れる - Dで割り切れる + CでもDで割り切れる
	long long all = B - A + 1;
	long long CB = B / C;
	long long CA = (A-1) / C;
	long long c = CB - CA;

	long long DB = B / D;
	long long DA = (A-1) / D;
	long long d = DB - DA;


	long long CD = lcm(C, D);
	long long CDB = B / CD;
	long long CDA = (A-1) / CD;
	long long cd = CDB - CDA;

	long long ans = all - c - d + cd;
	cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
// Package main provides
//
// File:  a.go
// Author: ymiyamoto
//
// Created on Thu Jan  3 12:22:06 2019
//
package main

import "fmt"

func main() {
	var S string

	fmt.Scan(&S)
	for i := range S {
		if i == 3 {
			fmt.Print(8)
		} else {
			fmt.Print(string(S[i]))
		}
	}
	fmt.Println()
}


Measured memory_bytes: 512
# -*- coding: utf-8 -*-
def main():
    N, Y= map(int, input().split())
    for a in range(N+1):
        for b in range(N-a+1):
            c = N -a -b
            if a * 10000 + b * 5000 + c * 1000 == Y :
                print("{} {} {}".format(a,b,c))
                exit()
    print("{} {} {}".format(-1,-1,-1))
        
if __name__ == '__main__':
    main()

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

int main()
{
  string A, B, C;
  cin >> A >> B >> C;
  
  if((A.at(A.size() - 1) == B.at(0)) && (B.at(B.size() - 1) == C.at(0)))
  {
    cout << "YES" << endl;
  }
  else
  {
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll MOD=1e9+7;
const ll N=2e5+5;
const ld pi=3.14159265359;
const ll INF=(1LL<<63);
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define setp setprecision
#define lwb lower_bound
#define SZ(a) (ll)a.size()
 
int main() {
  ll N, A, a = 0, b = 0, c = 0, ans = 1;
  cin >> N;
  
  for (int i = 0; i < N; i++) {
    cin >> A;
    ll pat = 0;
    if (A == a) pat++;
    if (A == b) pat++;
    if (A == c) pat++;
    ans *= pat;
    ans %= MOD;
    if (A == a) a++;
    else if (A == b) b++;
    else if (A == c) c++;
  }
  cout << ans << endl;
}

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

using std::pair;
using std::vector;
using std::string;

typedef long long ll;
typedef pair<int, int> pii;

#define fst first
#define snd second
#define pb(a) push_back(a)
#define mp(a, b) std::make_pair(a, b)
#define debug(...) fprintf(stderr, __VA_ARGS__)

template <typename T> bool chkmax(T& a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> bool chkmin(T& a, T b) { return a > b ? a = b, 1 : 0; }

const int oo = 0x3f3f3f3f;

string procStatus() {
    std::ifstream t("/proc/self/status");
    return string(std::istreambuf_iterator<char>(t), std::istreambuf_iterator<char>());
}

template <typename T> T read(T& x) {
    int f = 1; x = 0;
    char ch = getchar();
    for(;!isdigit(ch); ch = getchar()) if(ch == '-') f = -1;
    for(; isdigit(ch); ch = getchar()) x = x * 10 + ch - 48;
    return x *= f;
}

const int N = 100000;
const int S = 1 << 16;

int n;
int val[N + 5];
bool can[S + 5];
int dp[S + 5], cnt[16];

int main() {
#ifdef Wearry
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif

    scanf("%d", &n);
    for(int i = 1; i < n; ++i) {
        static int u, v, w;
        scanf("%d%d%d", &u, &v, &w);
        val[u] ^= w;
        val[v] ^= w;
    }

    for(int i = 1; i <= n; ++i) {
        ++ cnt[val[i]];
    }

    int ans = 0, mask = 0;
    for(int i = 1; i < 16; ++i) {
        ans += cnt[i] / 2;
        if(cnt[i] &= 1) mask |= 1 << i;
    }

    for(int i = 0; i < S; ++i) {
        int res = 0;
        for(int j = 0; j < 16; ++j) if(i >> j & 1) res ^= j;
        if(res == 0) can[i] = true;
    }

    for(int i = 0; i < S; ++i) {
        for(int j = i; j; j = (j - 1) & i) 
            if(can[j]) { chkmax(dp[i], dp[i ^ j] + 1); }
    }

    printf("%d\n", ans + __builtin_popcount(mask) - dp[mask]);

    return 0;
}


Measured memory_bytes: 896
#include <iostream>
#include <queue>
#include <algorithm>
#include <string>
#include <utility>
#include <vector>
#include <map>
#include <stack>
#include <iomanip>
#include <set>
#include <sstream>
#include <cmath>
#include <deque>
#include <list>
#include <bitset>
using namespace  std;
typedef pair<long long , long long> P;
typedef long long int64;
typedef long long lint;
#define REP(i, n) for(long long (i)=0; (i)<(n); ++i)
#define FOR(i, a, b) for(long long (i)=(a); (i)<(b); ++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define FST first
#define SND second

signed main(){
    int N, C, K;
    cin >> N >> C >> K;
    vector<int> T(N);
    REP(i, N) cin >> T[i];
    sort(ALL(T));
    int res = 0;
    int i = 0;
    while(i<N) {
        res++;
        int s = T[i];
        bool flag = true;
        for(int c=1; c<C and i+c<N; c++){
            if(T[i+c]-s>K){
                i+=c;
                flag = false;
                break;
            }
        }
        if(flag) i+=C;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 640
// Hint: Don't look, No need

#pragma optimize("O2")
#include <bits/stdc++.h>
#include "bits/stdc++.h"

using namespace std;

#define int long long
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

#ifndef bhupixb
  #define var(...)
  #define stl(...)
#endif

signed main() {
  fast;
  int a, b;
  cin >> a >> b;
  cout << a*b << '\n';


  return 0;
}

Measured memory_bytes: 3648
import java.util.*;
 
public class Main {
    public static void sort(int array[], int array2[], int left, int right){
        if(left <= right){
            int p = array[(left + right) >>> 1];
            int l = left;
            int r = right;
            while(l <= r){
                while (array[l] < p){
                    l++;
                }
                while (array[r] > p){
                    r--;
                }
                if (l <= r){
                    int tmp = array[l];
                    array[l] = array[r];
                    array[r] = tmp;
                    
                    int tmp2 = array2[l];
                    array2[l] = array2[r];
                    array2[r] = tmp2;
                    l++;
                    r--;
                }
            }
            Main.sort(array, array2, left, r);
            Main.sort(array, array2, l, right);
        }
    }
    
    public static void main(String args[]){
        Scanner stdIn = new Scanner(System.in);
        int n = stdIn.nextInt();
        int c[] = new int[26];
        int s[][] = new int[n][26];
        int ind[] = new int[26];
        
        for(int i = 0; i < 26; i++){
            c[i] = stdIn.nextInt();
            ind[i] = i;
        }
        
        for(int i = 0; i < n; i++){
            for(int j = 0; j < 26; j++){
                s[i][j] = stdIn.nextInt();
            }
        }
        
        Main.sort(c, ind, 0, 25);
        
        int rev[] = new int[26];
        
        for(int i = 25; i >= 0; i--){
            rev[i] = ind[25 - i] + 1;
        }
        
        int count = 0;
        boolean endFlag = false;
        
        while(true){
            for(int i = 16; i < n; i++){
                System.out.println(rev[i % 26]);
                count++;
                if(count == 365){
                    endFlag = true;
                    break;
                }
            }
            
            if(endFlag){
                break;
            }
        }
    }
}

Measured memory_bytes: 46444
while True:
    n = int(input())
    if n == 0:
        break
    scores = [0, 0]
    for i in range(n):
        cards = list(map(int, input().split()))
        if cards[0] > cards[1]:
            scores[0] += cards[0] + cards[1]
        elif cards[0] < cards[1]:
            scores[1] += cards[0] + cards[1]
        else:
            scores[0] += cards[0]
            scores[1] += cards[1]
    print(' '.join([str(score) for score in scores]))


Measured memory_bytes: 5624
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);  
	cin.tie(NULL);
	int x;cin>>x;
	int ans=0;
	if(x>=400 && x<=599){
		ans = 8;
	}
	else if(x>=600 && x<=799){
		ans = 7;
	}
	else if(x>=800 && x<=999){
		ans = 6;
	}
	else if(x>=1000 && x<=1199){
		ans = 5;
	}
	else if(x>=1200 && x<=1399){
		ans = 4;
	}
	else if(x>=1400 && x<=1599){
		ans = 3;
	}
	else if(x>=1600 && x<=1799){
		ans = 2;
	}
	else if(x>=1800 && x<=1999){
		ans = 1;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3624
#include<iostream>

using std::cin;
using std::cout;
using std::endl;

int main(){
    long long n;
    long long ans = 0;
    cin >> n;
    long long a[n], b[n];

    for(long long i=0; i<n; i++){
        cin >> a[i] >> b[i];
    }

    for(long long i=n-1; i>=0; i--){
        a[i] += ans;
        if(a[i]%b[i]){
            ans += b[i] - a[i]%b[i];
        }
    }
    cout << ans << endl;
}

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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; i++) cin >> a[i];
  long long ans = 0;
  int MaxNum = 0;
  for(int i = 0; i < n; i++){
    MaxNum = max(MaxNum, a[i]);
    int Bi = MaxNum;
    ans += Bi - a[i];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4052
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Scan()
	_, _ = strconv.Atoi(sc.Text())
	sc.Scan()
	an := strings.Split(sc.Text(), " ")
	ans := ""
	for i := len(an) - 1; i >= 0; i-- {
		ans += an[i] + " "
	}
	fmt.Println(strings.TrimSpace(ans))
}



Measured memory_bytes: 1180