akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
#include <cctype>
#include <queue>

using namespace std;

typedef pair <int, int> point;
typedef pair < point, int> kotori;
// 2130
static const int dx[] = {0, 0, 1, -1, 1, 1, -1, -1};
static const int dy[] = {1, -1, 0, 0, 1, -1, 1, -1};

bool vst[1280][1280];
string field[1280];
int h, w, n;

void vst_clear(void)
{
	for (int i = 0; i < 1280; i++){
		for (int j = 0; j < 1280; j++){
			vst[i][j] = false;
		}
	}
}

bool is_region(int y, int x)
{
	return (0 <= y) && (y < h) && (0 <= x) && (x < w);
}

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

	point start, goal;
	point f[10];

	cin >> h >> w >> n;
	for (int i = 0; i < h; i++){
		cin >> field[i]; cin.ignore();
		for (int j = 0; j < w; j++){
			if (field[i][j] == 'S'){
				field[i][j] = '0';
			}
			if (isdigit(field[i][j])){
				f[field[i][j] - '0'] = make_pair(i, j);
			}
		}
	}

	int ret = 0;
	for (int g = 1; g <= n; g++){
		// cout << g-1 << " done" << endl;
		vst_clear();
		start = f[g - 1];
		goal = f[g];

		queue < kotori > q;
		kotori a;
		a.first = start;
		a.second = 0;
		q.push(a);
		// point, step;
		while (!q.empty()){
			kotori hanayo = q.front(); q.pop();
			int x = hanayo.first.second, y = hanayo.first.first;
			// cout << y << " " << x << endl;
			if (vst[y][x]) continue;
			vst[y][x] = true;
			if (hanayo.first == goal){
				ret += hanayo.second;
				break;
			}
			for (int i = 0; i < 4; i++){
				int ny = hanayo.first.first + dy[i], nx = hanayo.first.second + dx[i];
				if (!is_region(ny, nx)) continue;
				if (vst[ny][nx]) continue;
				if (field[ny][nx] == 'X') continue;
				kotori p; p.first = make_pair(ny, nx); p.second = hanayo.second + 1;
				q.push(p);
			}
		}
	}
	cout << ret << endl;

	return 0;
}

Measured memory_bytes: 3872
S = input()

x = y = 0
for i,c in enumerate(S):
    if i%2:
        a,b = 0,1
    else:
        a,b = 1,0
    if int(c) == a:
        x += 1
    if int(c) == b:
        y += 1
print(min(x,y))

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
constexpr int MX = 200005;
int p[MX], n, m, a, b, ans=1;
int find(int x){return (p[x] < 0 ? x : p[x] = find(p[x]));}
void uni(int x, int y){
	x = find(x); y = find(y);
	if(x != y){
		if(p[x] > p[y]) swap(x, y);
		p[x] += p[y];
		p[y] = x;
		ans = max(ans, -p[x]);
	}
}
int main(){
	scanf("%d%d", &n, &m);
	fill(p, p+n, -1);
	rep(i,m){
		scanf("%d%d", &a, &b);
		uni(a-1,b-1);
	}
	printf("%d\n", ans);
}

Measured memory_bytes: 4604
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		char[] s = br.readLine().toCharArray();
		br.close();

		if (s[0] != 'A') {
			System.out.println("WA");
			return;
		}

		int cnt = 0;
		for (int i = 2; i < s.length - 1; i++) {
			if (s[i] == 'C') {
				cnt++;
			}
		}
		if (cnt != 1) {
			System.out.println("WA");
			return;
		}

		for (int i = 1; i < s.length; i++) {
			if (s[i] != 'C') {
				int x = s[i] - 'a';
				if (x < 0 || 26 <= x) {
					System.out.println("WA");
					return;
				}
			}
		}
		System.out.println("AC");
	}
}


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

long long n,ans,tmp;
char c;
long long dist[205],cont;
bool vis[205][2],grafo[205][205];
vector<int> v;

void dfs(int nodo,int mode){
	vis[nodo][mode]=true;
	
	for(int i=0;i<n;i++){
		if(grafo[nodo][i] && vis[i][mode^1]==false)dfs(i,mode^1);
	}
}

void bfs(int nodo){
	tmp=max(tmp,dist[nodo]);
	for(int i=0;i<n;i++){
		if(grafo[nodo][i] && dist[i]==-1){
			dist[i]=dist[nodo]+1;
			v.push_back(i);
		}
	}
}

int main(){

	cin>>n;
	
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			cin>>c;
			if(c=='1')grafo[i][j]=true;
		}
	}
	
	dfs(0,0);
	
	for(int i=0;i<n;i++){
		if(vis[i][0] && vis[i][1]){
			cout<<"-1\n";
			return 0;
		}
	}
	
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			dist[j]=-1;
		}
		dist[i]=0;
		tmp=0;
		cont=0;
		v.clear();
		v.push_back(i);
		
		while(cont<v.size()){
			bfs(v[cont]);
			cont++;
		}
		
		ans=max(ans,tmp+1);
	}
	
	cout<<ans<<"\n";
	

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 H = sc.nextInt();
		int W = sc.nextInt();
		
		int A = 0;
		int B = 0;
		
	
		int x = H / 3;
		
		int S1=x*W;
		int S2= 0;
		int S3= 0;
				
		if(W%2==0){
			S2=(W/2)*(H-x);
			S3=(W/2)*(H-x);
		}else{
			int h = W/2;
			S2=h*(H-x);
			S3=(h+1)*(H-x);
		}
		
		int a = Math.max(Math.max(S1, S2),S3) - Math.min(Math.min(S1, S2),S3);

		
		int y = (H / 3)+1;
		S1=y*W;
		S2= 0;
		S3= 0;
				
		if(W%2==0){
			S2=(W/2)*(H-y);
			S3=(W/2)*(H-y);
		}else{
			int h = W/2;
			S2=h*(H-y);
			S3=(h+1)*(H-y);
		}
		
		int b = Math.max(Math.max(S1, S2),S3) - Math.min(Math.min(S1, S2),S3);
		
		A = Math.min(a, b);
		
		
		x = W / 3;
		
		S1=x*H;
		S2= 0;
		S3= 0;
				
		if(H%2==0){
			S2=(H/2)*(W-x);
			S3=(H/2)*(W-x);			
		}else{
			int h = H/2;
			S2=h*(W-x);
			S3=(h+1)*(W-x);
		}
		
		a = Math.max(Math.max(S1, S2),S3) - Math.min(Math.min(S1, S2),S3);

		
		y = (W / 3)+1;
		S1=y*H;
		S2= 0;
		S3= 0;
				
		if(H%2==0){
			S2=(H/2)*(W-y);
			S3=(H/2)*(W-y);
		}else{
			int h = H/2;
			S2=h*(W-y);
			S3=(h+1)*(W-y);
		}
		
		b = Math.max(Math.max(S1, S2),S3) - Math.min(Math.min(S1, S2),S3);
		
		B = Math.min(a, b);	
		
		int N = Math.min(Math.min(H, W),Math.min(A, B));		
		
		if(H % 3 == 0| W % 3 == 0){
			N = 0;
		}
		
		System.out.println(N);

		
	}

}

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

void solve(ll n, ll x, ll m, vector<ll> &d){
    int k = d.size();
    vector<ll> md(k, 0);
    ll ans = n - 1;
    for(int i=0; i<k; i++){
        md[i] = d[i]%m;
    }

    ll X = x;
    for(int i=0; i<k; i++){
        ll cnt;
        if(i + 1 <= n-1){
            cnt = (n-i-2)/k + 1;
        }else{
            cnt = 0;
        }
        if(md[i] == 0){
            ans -= cnt;
        }else{
            X += cnt*md[i];
        }
    }
    cout << ans - (X/m - x/m) << endl;
}

int main(){
    int k, q;  cin >> k >> q;
    vector<ll> d(k);
    for(int i=0; i<k; i++)
        cin >> d[i];
    
    while(q--){
        ll n, x, m;
        cin >> n >> x >> m;
        solve(n, x, m, d);
    }
}


Measured memory_bytes: 512
using System;

namespace csharp
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = Console.ReadLine();

            string[] a_b = str.Split(' ');

            int a = int.Parse(a_b[0]);
            int b = int.Parse(a_b[1]);

            Console.WriteLine( Math.Max(a+b, Math.Max(a-b, a*b)));

            return;

        }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define forn(l, r) for (int i = l; i < (r); ++i)
#define F first
#define S second
#define MAXN 212345
#define INF 0x3f3f3f3f3f3f3f3fLL

typedef long long int ll;


using namespace std;


int32_t main() {

    ios::sync_with_stdio(0);

    int x=0, y=0, z;

    forn(0, 3){
        cin >> z;
        if(z == 5) x++;
        else if(z == 7) y++;
    }

    if(x == 2 && y == 1) cout << "YES";
    else cout << "NO";

    cout << endl;
}


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

using namespace std;

int main(int qtd, char* nome[])
{
    ios::sync_with_stdio(false);

    int x;
    cin >> x;
    if (x == 7|| x == 5|| x == 3)
        cout << "YES\n";
    else
        cout << "NO\n";

    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		long[] B = new long[N];
		for(int i=0;i<N;i++) B[i] = Math.Max(A[i],0);
		
		long[] asum = new long[N+1];
		long[] bsum = new long[N+1];
		for(int i=0;i<N;i++){
			asum[i+1] = asum[i] + A[i];
			bsum[i+1] = bsum[i] + B[i];
		}
		
		
		long max = - (long) 1e18;
		
		for(int i=0;i+K-1<N;i++){
			long v = 0;
			// [0,i) :any;
			v += bsum[i];
			// [i,i+K) : sum or none
			v += Math.Max(asum[i+K] - asum[i], 0);
			// [i+K,N) : any
			v += bsum[N] - bsum[i+K];
			max = Math.Max(max, v);
		}
		
		Console.WriteLine(max);
		
		
		
	}
	int N, K;
	long[] A;
	public Sol(){
		var d = ria();
		N = d[0]; K = d[1];
		A = rla();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


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

int main(){
  int n;
  string s;
  cin >> n >> s;
  
  int ans=0;
  
  for(int i=0;i<1000;i++){
    int p=0;
    int k=0;
    while(k<n){
      if(p==0&&s[k]==i/100+'0') p++;
      else if(p==1&&s[k]==i/10%10+'0') p++;
      else if(p==2&&s[k]==i%10+'0') p++;
      k++;
    }
    if(p==3) ans++;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 3684
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
using namespace std;

int main(){
	int W, H, x, y, r;
	cin >> W >> H >> x >> y >> r;
	if (x - r >= 0 && x + r <= W&&y - r >= 0 && y + r <= H) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 1160
#include<stdio.h>

#define ABS(x) (((x)<0)?(-(x)):(x))

int main(void){
  int a,b,c,d,e,f;
  double x,y;
  while(scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f)!=EOF){
    x=(c*e-b*f)/(double)(a*e-b*d);
    y=(c*d-a*f)/(double)(b*d-a*e);
    if(ABS(x)<0.0005) x=0;
    if(ABS(y)<0.0005) y=0;
    printf("%.3lf %.3lf\n",x,y);
  }
  return 0;
}

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

#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define ALL(x) (x).begin(), (x).end()

using namespace std;
typedef long long ll;
const ll INF = 1e15;
const ll MOD = 1e9 + 7;

int main() {
  ll n;
  cin >> n;
  vector<ll> a(n);
  REP(i, n) cin >> a[i];
  vector<ll> color(3, -1);

  if (a[0] != 0) {
    cout << 0 << endl;
    return 0;
  }

  ll ans = 3;
  color[0] = 0;
  FOR(i, 1, n) {
    ll now = a[i];
    ll cnt = 0;
    REP(j, 3) {
      if (color[j] + 1 == now) {
        ++cnt;
      }
    }

    if (cnt == 0) {
      cout << 0 << endl;
      return 0;
    }

    ans *= cnt;
    ans %= MOD;

    REP(j, 3) {
      if (color[j] + 1 == now) {
        color[j] = now;
        break;
      }
    }
  }

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

Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, A, B, C, D; cin >> N >> A >> B >> C >> D;
	bool f(false);
	int cnt = N - 1;
	rep(i, 0, cnt + 1) {
		int j = cnt - i;
		int l = A - j*D + i*C, r = A - j*C + i*D;
		
		//dump(i,j,l, r);
		if (l <= B&&B <= r)f = true;
	}
	cout << (f ? "YES" : "NO") << endl;
	return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
l = []
for i in range(m):
    data = list(map(int,input().split()))
    l.append(data)
ball_nums=[1]*n
red_nums=[0]*n
red_nums[0]=1

for i in range(m):
    ball_nums[l[i][0]-1] -= 1
    ball_nums[l[i][1]-1] += 1

    if red_nums[l[i][0]-1]==1:
        red_nums[l[i][1]-1] = 1
        if ball_nums[l[i][0]-1] == 0:
            red_nums[l[i][0]-1] = 0

print(sum(red_nums))

Measured memory_bytes: 28860
// luogu-judger-enable-o2
#include <iostream>
#include <cstdio>
#include <cstring>
#define re register int
using namespace std;
int n,h,maxn;
char s[101];
int main()
{
	cin>>n;
	for(re i=1;i<=n;i++)
	{
		cin>>s[i];
		if(s[i]=='I')
		{
			h++;
			if(h>maxn)
				maxn=h;
		}
		else
			h--;
	}
	cout<<maxn;
	return 0;
}

Measured memory_bytes: 256
from math import gcd
n, k = map(int,input().split())
a = list(map(int,input().split()))
g = a[0]

for i in range(n-1):
    g = gcd(g, a[i+1])
    
if max(a) >= k and k%g == 0:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

        

Measured memory_bytes: 20260
#include <stdio.h>

int main(void){
	int shu,i;
	int answer=100000;
	
	scanf("%d",&shu);
	for(i=0;i < shu;i++){
		answer = answer * 1.05;
		if(answer % 1000 > 0){
			answer = (answer/1000) * 1000 + 1000;
		}
	}
	printf("%d\n",answer);
	
	return 0;
}

Measured memory_bytes: 592
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<map>
#include<bitset>
#include<queue>
#define lson (rt << 1)
#define rson (rt << 1 | 1)
const int maxn = 100000+10;
const int maxm = 4e5 + 10;
const int inf_max = 0x3f3f3f;
const int mod = 1000000007;
using namespace std;
typedef long long ll;

int main()
{
    int n,tar;
    scanf("%d",&n);
    printf("%d\n",n*(n-1)/2 - n/2);
    if(n % 2) tar = n;
    else tar = n+1;
    for(int i = 1;i <= n; ++i) {
        for(int j = i + 1;j <= n; ++j) {
            if(i + j == tar) continue;
            printf("%d %d\n",i,j);
        }
    }
    return 0;
}

Measured memory_bytes: 256
// Problem : B - Crane and Turtle
// Contest : AtCoder - AtCoder Beginner Contest 170
// URL : https://atcoder.jp/contests/abc170/tasks/abc170_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

// #pragma GCC optimize ("O3")
// #pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,b,a) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
#define cs(ans) setprecision(10)<<fixed<<ans

 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const ld pii=3.14159265359;
const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy
 
int main() 
{
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
    int N,M;
    cin>>N>>M;
    if(M>=2*N && M<=4*N && M%2==0)
    	cout<<"Yes"<<endl;
    else
    	cout<<"No"<<endl;
	
	return 0;
	//CHECK CORNER CASES
}
// read the question correctly (ll vs int)
// template by bqi343




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

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef pair<ii, int> ri3;
#define mp make_pair
#define pb push_back
#define fi first
#define sc second
#define SZ(x) (int)(x).size()
#define ALL(x) begin(x), end(x) 
#define REP(i, n) for (int i = 0; i < n; ++i) 
#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define RFOR(i, a, b) for (int i = a; i >= b; --i)

int N, X, D;

int main() {
    //freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin >> N >> X >> D;
    if (D == 0) {
        cout << (X == 0 ? 1 : N+1) << '\n';
    } else {
        if (D < 0) X = -X, D = -D;

        vector<tuple<int,ll,ll> > inv;
        FOR(i,0,N){
            ll b = (ll)i*X;
            inv.emplace_back((b%D+D)%D,b/D+(ll)i*(i-1)/2,b/D+(ll)i*(2*N-1-i)/2);
        }
        sort(ALL(inv));
        //for (auto& x : inv) cout << get<0>(x) << " " << get<1>(x) << " " << get<2>(x) << endl;
        ll ans = 0;
        for (int i = 0, j = 0; i < SZ(inv);) {
            ll ep = -1e18;
            while (j < SZ(inv) && get<0>(inv[j]) == get<0>(inv[i])) {
                if (get<2>(inv[j]) > ep) {
                    ans += get<2>(inv[j]) - max(ep,get<1>(inv[j])-1);
                    ep = get<2>(inv[j]);
                }
                ++j;
            }
            i = j;
        }
        cout << ans << '\n';
    }
}



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

//const ll mod =  1000000007;
//const ll maxn = 1000000000;

//---------------------------------------------------------------------------------------------------
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vll = vector<ll>; // intの1次元の型に vi という別名をつける
using vvll = vector<vll>; // intの2次元の型に vvi という別名をつける
using vs = vector<string>; // stringの1次元の型に vs という別名をつける
using pll = pair<ll, ll>; // これ以降 pii という型名はpair<ll, ll> と同じ意味で使える
//---------------------------------------------------------------------------------------------------

int main() {
   ll a,b,v,w,t,dis,sotaisokudo;
   cin>>a>>v>>b>>w>>t;
   
   if(w>=v)cout<<"NO"<<endl;
   else{
       dis=abs(a-b);
       sotaisokudo=v-w;
       if(dis<=sotaisokudo*t)cout<<"YES"<<endl;
       else cout<<"NO"<<endl;
   
   }
    
}


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

using namespace std;

string today[7] = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"};

int main() {
	int month, day;
	long AA = 0, BB = 0, CC = 0, DD = 0;

	while (cin >> month >> day) {
		if (month == 0) {
			break;
		}

		AA = 2004;
		if (month < 3) {
			AA--;
			month += 13;
		}
		else {
			month++;
		}

		AA *= 365.25;
		BB = month * 30.6;
		CC = 2004 / 400;
		DD = 2004 / 100;

		AA = AA + BB + CC + day - DD - 429;
		BB = AA / 7;
		AA = AA - (BB * 7);

		cout << today[AA] << endl;
	}
	return 0;
}

Measured memory_bytes: 3004
from collections import deque

h,w = map(int, input().split())
l = [list(input()) for _ in range(h)]

# 最大値の格納する
ans = 0

def bfs(y,x,m):#未実装
    #表の初期化
    graph = [[None] * w for i in range(h)]
    #最初の地点のコストは0
    graph[y][x] = 0

    q = deque()
    q.append((y,x))

    for i in range(h):
        for j in range(w):
            if l[i][j] == '#':
                graph[i][j] = -1

    #ノードの移動方向 左が縦軸, 右が横軸
    move = ((0, 1), (0, -1), (1, 0), (-1, 0))

    while q: #wがからになるまで続ける while len(q):でもOK
        #que左端から取り出す
        i, j = q.popleft()

        for di, dj in move:
            #ni, nj 遷移先の座標
            ni , nj = i + di, j + dj
            #遷移先がフィールド内であるか、Noneかどうかをチェックする
            if 0 <= ni < h and 0 <= nj < w and graph[ni][nj] is None:
                #遷移可能であれば現在のコストに1足して渡す
                #print(type(graph[i][j]))
                graph[ni][nj] = graph[i][j] + 1
                #queに格納する
                q.append((ni, nj))

    #queが空になると移動コストtableが完成
    #表中の最大値返す
    return max(max(r) for r in graph)

for i in range(h):
    for j in range(w):
        #'.'であればスタート地点になり得るので、それをbfsにかける
        if l[i][j] == '.':
            d = bfs(i,j,l) # (x, y) = (j, i), lは入力の表の情報
            #返り値が現在の最大値より大きければ値を更新する
            if ans < d:
                ans = d
print(ans)


Measured memory_bytes: 3316
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cctype>
#include<climits>
#include<bitset>
#include<bits/stdc++.h>
#define ld long double
#define ll long long int
#define ull unsigned long long int
#define rep(i,n) for(int i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define INF INT_MAX
#define vi vector<int>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define vvc vector<vector<char> >
#define vvs vector<vector<string> >
#define P 1000000007
using namespace std;
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 long long LLINF=1LL<<60;
//set<int>::iterator it;


int main(void){ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////////////
    
    int a[5]={};
    int k;
    
    rep(i,5)cin>>a[i];
    cin>>k;
    
    
    for (int i=0;i<5;i++){
    
            for(int j=0;j<5;j++){
            
            if(abs(a[i]-a[j])>k){
            cout << ":(" << endl;
            
            return 0;
            }
        }
    }
    
    cout << "Yay!" <<endl;
    
    
    
    
//////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 256
from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf,comb
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
from functools import reduce
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

n = INT()
ans = ''
while n != 0:
    x = ( n - 1 ) % 26
    n = ( n - x + 1 ) // 26
    ans = chr( ord('a') + x ) + ans
print(ans)

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

using namespace std;

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

int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    // cout << setprecision(8) << setiosflags(ios::fixed);

    int n;
    cin >> n;

    vector<ll> a(n);
    for (auto &a_i : a) cin >> a_i;

    vector<vector<ll>> dp(n, vector<ll>(2));
    dp[1][0] = a[0] + a[1];
    dp[1][1] = -a[0] - a[1];
    for (int i = 2; i < n; ++i) {
        // a[i] で反転する
        dp[i][1] = max(dp[i - 1][0] - 2 * a[i - 1],
                       dp[i - 1][1] + 2 * a[i - 1]) - a[i];
        // a[i] で反転しない
        dp[i][0] = max(dp[i - 1][0], dp[i - 1][1]) + a[i];
    }

    cout << max(dp[n - 1][0], dp[n - 1][1]) << endl;

    return 0;
}


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

int main(){
  int n,sum=0;
  scanf("%d",&n);
  vector<int> p(n),q(n);
  rep(i,n)scanf("%d",&p[i]);
  q = p;
  sort(all(q));
  rep(i,n)if(p[i]!=q[i]) sum ++ ;
  sum == 2 || sum==0  ? printf("%s","YES"):printf("%s","NO");
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
typedef unsigned int uint;
using namespace std;

int main() {
    int n;
    cin >> n;
    ll T = 1LL, A = 1LL;
    for (int i = 0; i < n; i++) {
        ll t, a;
        cin >> t >> a;
        ll n = max(T / t + (T % t > 0), A / a + (A % a > 0));
        T = n * t;
        A = n * a;
    }

    cout << T + A << "\n";
    return 0;
}

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



int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin>>n;
    n = n%10;
    string s;
    if(n == 2   || n== 4 || n == 5 || n==7 || n==9)  s = "hon";
    else
        if(n==3) s = "bon";
    else s="pon";
    cout<<s;
    return 0;
}


Measured memory_bytes: 3616
h,w = map(int,input().split())
s = [list(input()) for _ in range(h)]

for i in range(1,h-1):
    for j in range(1,w-1):
        if s[i][j]=="#" and s[i-1][j]==s[i+1][j]==s[i][j-1]==s[i][j+1]==".":
            print("No") 
            exit()
print("Yes")

Measured memory_bytes: 39024
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
template <typename T> using posteriority_queue = priority_queue<T, vector<T>, greater<T> >;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
const int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
template <typename T> void unique(vector<T> &a) { a.erase(unique(ALL(a)), a.end()); }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

template <typename T>
vector<int> z_algorithm(const T &s) {
  int n = s.size();
  vector<int> res(n);
  res[0] = n;
  int j = 0;
  for (int i = 1; i < n;) {
    while (i + j < n && s[j] == s[i + j]) ++j;
    res[i] = j;
    if (j == 0) {
      ++i;
      continue;
    }
    int k = 1;
    while (i + k < n && k + res[k] < j) {
      res[i + k] = res[k];
      ++k;
    }
    i += k;
    j -= k;
  }
  return res;
}

using CostType = ll;
struct Edge {
  int src, dst; CostType cost;
  Edge(int src, int dst, CostType cost = 0) : src(src), dst(dst), cost(cost) {}
  inline bool operator<(const Edge &rhs) const {
    return cost != rhs.cost ? cost < rhs.cost : dst != rhs.dst ? dst < rhs.dst : src < rhs.src;
  }
  inline bool operator<=(const Edge &rhs) const { return !(rhs < *this); }
  inline bool operator>(const Edge &rhs) const { return rhs < *this; }
  inline bool operator>=(const Edge &rhs) const { return !(*this < rhs); }
};

vector<int> topological_sort(const vector<vector<Edge> > &graph) {
  int n = graph.size();
  vector<int> deg(n, 0);
  REP(i, n) {
    for (const Edge &e : graph[i]) ++deg[e.dst];
  }
  queue<int> que;
  REP(i, n) {
    if (deg[i] == 0) que.emplace(i);
  }
  vector<int> res;
  while (!que.empty()) {
    int ver = que.front(); que.pop();
    res.emplace_back(ver);
    for (const Edge &e : graph[ver]) {
      if (--deg[e.dst] == 0) que.emplace(e.dst);
    }
  }
  return res.size() == n ? res : vector<int>();
}

int main() {
  string s, t; cin >> s >> t;
  int n = s.length();
  string S = "";
  while (S.length() + 1 < s.length() + t.length()) S += s;
  vector<int> z = z_algorithm(t + '$' + S);
  vector<vector<Edge> > graph(n);
  REP(i, n) {
    if (z[t.length() + 1 + i] >= t.length()) graph[i].emplace_back(i, (i + t.length()) % n);
  }
  vector<int> toposo = topological_sort(graph);
  if (toposo.empty()) {
    cout << "-1\n";
    return 0;
  }
  vector<int> ans(n, 0);
  for (int i = n - 1; i >= 0; --i) {
    for (const Edge &e : graph[toposo[i]]) ans[toposo[i]] = ans[e.dst] + 1;
  }
  cout << *max_element(ALL(ans)) << '\n';
  return 0;
}


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

using namespace std;

int main () {
    int N, K;
    cin >> N >> K;
    vector<int> A(N + 1, 0);
    
    int a, k = 0;
    for (int i = 0; i < N; ++i) {
        cin >> a;
        if (A[a] == 0) k++;
        A[a]++;
    }

    sort(A.begin(), A.end());
    int i = 0, count = 0;
    while (k > K) {
        if (A[i] > 0) {
            count += A[i];
            k--;
        }
        i++;
    }

    cout << count << endl;

    return 0;
}

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

using namespace std;

typedef long long ll;

template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

int main(void) {
    int N, K;
    string S;
    cin >> N >> K;
    cin >> S;

    S[K - 1] = S[K - 1] + 32;
    cout << S << endl;

    return 0;
}


Measured memory_bytes: 256
word_list = input()

word_dict = {}

for word in word_list:
    if word in word_dict:
        word_dict[word] +=1
    else:
        word_dict[word] = 1

Flag = 'Yes'
for key_count in word_dict.values():
    if key_count % 2 != 0:
        Flag = 'No'

print(Flag)

Measured memory_bytes: 2940
use std::cmp::{min, max};
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
//usage
//input! {
//  h: i32;
//  v: [i32; n]
//  x: [[i32; n]; m]
//  f: chars <- Vec<char>
//}

fn main() {
    input! {
        n: usize, w: usize,
        items: [(usize, usize); n]
    }
    let total_value = items.clone().iter().fold(0, |sum, x| sum + x.1);
    // dp[i][j] = i番目までの品物の中で価値jを達成するための最小の重さ
    // dp[i + 1][j] = min(dp[i][j], dp[i][j - value] + weight)
    let INF = 100000000007;
    let mut dp = vec![vec![INF; total_value + 1]; n + 1];

    for i in 0..n + 1 {
        dp[i][0] = 0;
    }

    for i in 0..n {
        for j in 0..total_value + 1 {
            if items[i].1 <= j {
                dp[i + 1][j] = min(dp[i][j], dp[i][j - items[i].1] + items[i].0);
            }
            else {
                dp[i + 1][j] = dp[i][j];
            }
        }
    }

    let mut ans = 0;
    for i in 0..n+1 {
        for j in 0..total_value + 1 {
            if dp[i][j] <= w {
                ans = max(ans, j);
            }
        }
    }

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

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

typedef  long long ll;
//forループ
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//
//
#define int long long

using namespace std;

int ctoi(char c) {
 switch (c) {
 case '0': return 0;
 case '1': return 1;
 case '2': return 2;
 case '3': return 3;
 case '4': return 4;
 case '5': return 5;
 case '6': return 6;
 case '7': return 7;
 case '8': return 8;
 case '9': return 9;
 default: return 0;
 }
}


 ll a,b,c,s,t,x,y,z;
 ll A,B,C,S,T,X,Y,Z;

 ll cnt;

 long double pi=3.14159265358979323846;

 string N,M;

unsigned long long D;

signed main(){

	cin>>a;

	vector<int> f(a);

	REP(i,a) cin>>f[i];


	for(x=0;x<a-2;x++){
		for(y=x+1;y<a-1;y++){
	for(z=y+1;z<a;z++) {
		if(f[x]>f[y] && f[x]>f[z] && f[x]-f[y]-f[z]<0 && f[y]!=f[z]) cnt++;
		else if(f[y]>f[x] && f[y]>f[z] && f[y]-f[x]-f[z]<0 && f[x]!=f[z]) cnt++;
		else if(f[z]>f[y] && f[z]>f[x] && f[z]-f[y]-f[x]<0 && f[x]!=f[y]) cnt++;
	}
}
	}

	cout<<cnt;

	return 0;

}


Measured memory_bytes: 3560
// abc.070 C - Multiple Clocks

#include <bits/stdc++.h>
using namespace std;

#define ull unsigned long long

//ユークリッドの互除法（最大公約数求める）//GCD
ull eu( ull a, ull b ) {
    if( a < b ) swap( a, b );
    ull r = a % b;
    if( r == 0 )
        return b;
    else
        return eu( b, r );
}
// LCD（最小公倍数）を算出
ull lcd( ull a, ull b ) {
    ull c = eu( a, b );
    return a / c * b;
}

int main( void ) {

    int n;
    cin >> n;

    // 10^18までなので、ullで配列生成
  //  unsigned long long ans = 1, t;
    ull ans = 1ull, t;
    for( int i = 0; i < n; i++ ) {
        cin >> t;
        ans = lcd( ans, t );
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    new Main().run();
  }

  private void run() {
    int w = sc.nextInt();
    int n = sc.nextInt();

    int[] lines = new int[w];
    for(int i = 0; i < w; i++) lines[i] = i + 1;

    sc.useDelimiter("[,\n]");

    for(int i = 0; i < n; i++) {
      int a = sc.nextInt() - 1;
      int b = sc.nextInt() - 1;

      int tmp = lines[a];
      lines[a] = lines[b];
      lines[b] = tmp;
    }

    for(int l : lines) {
      System.out.println(l);
    }
  }

  private final Scanner sc = new Scanner(System.in);
}

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

#include <math.h>
#include <stdlib.h>


#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int n, m; cin >> n >> m;
    if(n==m) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T> inline bool chmax(T &a, const T &b) {if (a<b) { a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, const T &b) {if (b<a) { a=b; return 1;} return 0;}
struct init{init(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}}init_;

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 4e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//
struct UnionFind {
private:
    vector<int> par;
    vector<int> count;
    vector<int> rank;
public:
    UnionFind(int N) {
        count.assign(N, 1);
        rank.assign(N, 0);
        par.assign(N, 0);
        rep(i, N) par[i] = i;
    }

    int root(int x) {
        if (par[x] == x)
            return x;
        else {
            par[x] = root(par[x]);
            return par[x];
        }
    }

    void unite(int x, int y) {
        x = root(x), y = root(y);
        if (x == y) return;
        if (rank[x] < rank[y])
            swap(x, y);
        else if (rank[x] == rank[y])
            rank[y]++;
        par[y] = x;
        count[x] += count[y];
        return;
    }

    int size(int x) {
        return count[root(x)];
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }
};
using UF = struct UnionFind;

struct p {
    ll x, y, id;
    p(ll x = 0, ll y = 0, ll id = 0): x(x), y(y), id(id){}
};

int main() {
    ll N;
    cin >> N;
    vc<p> P(N);
    rep(i, N) cin >> P[i].x >> P[i].y, P[i].x--, P[i].y--, P[i].id = i;

    sort(all(P), [](p a, p b) { return a.x < b.x; });

    UF uf(N);
    auto comp = [](p a, p b) { return a.y < b.y; };
    set<p, decltype(comp)> st{comp};

    st.emplace(P[0]);

    repe(i, 1, N){
        auto [x, y, id] = P[i];
        bool merged = false;

        for (auto it = st.begin(); it != st.lower_bound(P[i]); ){
            auto [tx, ty, tid] = *it;
            bool erased = false;
            uf.unite(id, tid);
            if (merged) it = st.erase(it), erased = true;
            else
                it++;
            merged = true;
        }
        if (!merged) st.emplace(P[i]);
        // for (auto [tx, ty, tid] : st) err(i, tx, ty, tid);
    }



    rep(i, N) cout << uf.size(i) << '\n';
}

Measured memory_bytes: 15584
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  
  int A[N];
  for(int i=0; i<N; i++){
    cin >> A[i];
  }
  
  int maximum =0;
  
  for(int i=0; i<N; i++){
    for(int j=0; j<N; j++){
      if(i!=j && abs(A[i]-A[j]) > maximum){
        maximum=abs(A[i]-A[j]);
      }
    }
  }
  
  cout << maximum << endl;
    
}

Measured memory_bytes: 256
n, m = map(int, input().split())
ac = {}
wa = {}
for _ in range(m):
    p, s = input().split()
    p = int(p)
    if s == 'AC':
        ac[p] = 1
    else:
        if not ac.get(p, 0):
            wa[p] = wa.get(p, 0) + 1
pen = 0
for p in ac:
    pen += wa.get(p, 0)
print(len(ac), pen)

Measured memory_bytes: 53720
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
using namespace std;

int main() {
	long long int d, g, ans = 1001, sol = 0, sum = 0;
	cin >> d >> g;
	vector<int> p(d),c(d);
	for (int i = 0; i < d; ++i) cin >> p[i] >> c[i];

	for (int i = 0; i < (1 << d); ++i) {
		sum = 0;
		sol = 0;
		for (int j = 0; j < d; ++j) {
			if (i & (1 << j)) {
				sum += p[j] * (j + 1) * 100 + c[j];
				sol += p[j];
			}
		}
		if (sum >= g) ans = min(ans, sol);
		else {
			for (int j = d - 1; j >= 0; --j) {
				if (!(i & (1 << j))) {
					if ((g - sum) <= p[j] * (j + 1) * 100) {
						sol += ceil((g - sum) / ((j + 1) * 100.0));
						break;
					}
					else {
						sum += p[j] * (j + 1) * 100;
						sol += p[j];
					}
				}
			}
			ans = min(ans, sol);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
function Main(input) {
  const arr = input.split(' ');
  const res = arr[0] * arr[1];
  if (res % 2 === 0) {
    console.log('Even');
  } else {
    console.log('Odd');
  }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7496
#include<bits/stdc++.h>
using namespace std;
int n,sum;

int main()
{
	cin>>n;
	sum=0;
	for (int i=1;i<=n;i++) {
		int x; scanf("%d",&x);
		sum^=x;
	}
	printf("%s\n",sum? "No" : "Yes");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <math.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <stdlib.h>
#include <deque>  
#include <iomanip>

using namespace std;

using ll = long long;
#define INF 1e9
#define MOD 1e9 + 7
#define rep(i, n) for(int i = 0; i < n; i++)
#define loop(i, a, n) for(int i = a; i < n; i++)
#define all(in) in.begin(), in.end()
int main(){
    int N, K;
    cin >> N >> K;
    cout << (N % K == 0 ? 0 : 1) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define forn for(int i=0;i<n;i++)
//#define pr pair<int,int>
#define ll long long int
const int mod=1e9+7;
vector<bool> taken;
int score[(int)1e6];
ll a,b;
ll f(ll x,ll n)
{
	ll r=1;
	while(n>0)
	{
		if(n%2==1)
		r=(r*x)%mod;
		x=(x*x)%mod;
		n/=2;
	}
	return r;
	
}
ll invfact(ll r)
{
	ll fc=1;
	for(int i=r;i>=1;i--)
	fc= (fc*i)%mod;
	fc=f(fc,mod-2);
	return fc;
}
ll ncr(ll n, ll r)
{
	if(n<a)
	return 0;
	ll y=1;
	for(ll x=n;x>=n-r+1;x--)
	y=(y*x)%mod;
	ll z=invfact(r);
	y=(y*z)%mod;
	return y;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n;
    cin>>n>>a>>b;
    ll ans;
    if(a!=b)
    {
    	ans=((f(2,n)-1-ncr(n,a)-ncr(n,b))%mod+mod)%mod;
	}
	else
	ans=((f(2,n)-1-ncr(n,a))%mod+mod)%mod;
	cout<<ans;
}
 


Measured memory_bytes: 256
n, m=gets.split.map(&:to_i)

if n>=m
  n, m=m, n
end
# n<m

@mod=10**9+7

def fact(k)
  ret=1
  k.times{|i| ret=ret*(i+1)% @mod}
  ret
end

if m-n>=2
  puts 0
elsif m==n+1
  puts fact(m)*fact(n)% @mod
else
  puts 2*fact(m)*fact(n)% @mod
end


Measured memory_bytes: 1788
#include <stdio.h>

int main(void)
{
	int x, y;

	for (;;)
	{
		scanf("%d %d", &x, &y);

		if ((x == 0) && (y == 0))
		{
			break;
		}

		if (x > y)
		{
			printf("%d %d\n", y, x);
		}
		else
		{
			printf("%d %d\n", x, y);
		}
	}

	return 0;
}


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

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

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

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

long long modinv(long long a, long long mod) {
  return modpow(a, mod - 2, mod);
}

long long conbination(long long n, long long r, long long mod) {
  long long a = 1;
  long long b = 1;

  // n * (n - 1) * (n - 2) ...
  for (int i = 0; i < r; i++) {
    a = a * (n - i) % mod;
  }

  // 1 * 2 * 3 * ...
  for (int i = 0; i < r; i++) {
    b = b * (i + 1) % mod;
  }

  return (a * modinv(b, mod)) % mod;
}

int main() {
  long long mod = 1000000000 + 7;
  int n, a, b;
  cin >> n >> a >> b;

  long long res;

  res = modpow(2, n, mod) - 1;

  res = (res - conbination(n, a, mod)) % mod;
  res = (res - conbination(n, b, mod)) % mod;

  if (res < 0) {
    res = mod + res;
  }
  cout << res << endl;
}


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

long long d[87];

long long calc(long long n) {
    if (d[n] != 0) return d[n];
    return d[n] = calc(n - 1) + calc(n - 2);
}

int main() {
    long long N;
    cin >> N;
    d[0] = 2;
    d[1] = 1;
    cout << calc(N) << endl;
}

Measured memory_bytes: 256
def solve(n, k, a):
    return (n+k-3) / (k-1)
assert solve(4, 3, [2,3,1,4]) == 2
assert solve(3, 3, [1,2,3]) == 1
assert solve(8, 3, [7,3,1,8,4,6,2,5]) == 4

n, k = map(int, raw_input().split())
a = map(int, raw_input().split())
print solve(n, k, a)



Measured memory_bytes: 11304
using System;
using System.Collections.Generic;
using System.Linq;

namespace MyProgram{
    class AtCoder{
        static void Main(){
            long N = long.Parse(Console.ReadLine());
            var A = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);
            var left = new long[N];
            var right = new long[N];
            var left_gcd = A[0];
            var right_gcd = A[N-1];
            for(var i=0;i<N;i++){
                left_gcd = Gcd(left_gcd,A[i]);
                left[i] = left_gcd;
                right_gcd = Gcd(right_gcd,A[N-1-i]);
                right[N-1-i] = right_gcd;
            } 
            long max=0;
            for(var i=0;i<N;i++){
                if(i==0){
                    max = Math.Max(max,right[1]);
                }else if(i==N-1){
                    max = Math.Max(max,left[N-2]);
                }else{
                    max = Math.Max(max,Gcd(left[i-1],right[i+1]));
                }
            }
            System.Console.WriteLine(max);
        }

        static long Gcd(long m,long n){
            long temp;
            while(m%n!=0){
                temp =n;
                n = m%n;
                m = temp;
            }
            return n;
        }
    }
}


Measured memory_bytes: 27100
#include <iostream>

using namespace std;

int main()
{
    int n;
    while (cin >> n, n)
    {
        int a[n] = {0};
        int ave = 0;
        int count = 0;
        for (int i = 0; i < n; i++)
        {
            cin >> a[i];
            ave += a[i];
        }
        ave /= n;
        for (int i = 0; i < n; i++)
        {
            if (ave >= a[i])
            {
                count++;
            }
        }
        cout << count << endl;
    }
}


Measured memory_bytes: 3048
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,k;
  vector<int> l;
  std::cin>>n>>k;
  int i,j;
  for(i=0;i<n;i++)
  {
    std::cin>>j;
    l.push_back(j);
  }
  int s=0;
  sort(l.begin(),l.end());
  for(i=n-1;i>=n-k;i--)
  {
    s+=l[i];
  }
  std::cout<<s;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	int n;
	cin>>n;
	vector<P> g(n);
	rep(i,n){
		cin>>g[i].fi>>g[i].se;
	}
	sort(begin(g),end(g),[](const P &a,const P &b){
		return a.se<b.se;
	});
	ll now=0;
	rep(i,n){
		if(now+g[i].fi>g[i].se){
			cout<<"No"<<endl;
			return 0;
		}
		now+=g[i].fi;
	}
	cout<<"Yes"<<endl;
}

Measured memory_bytes: 3328