akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>  // std::unique
#include <cmath>
using namespace std;

using ll = long long;
constexpr auto PrimeBigNum10_9_7 = 1000000007;

// 素数判定
template <typename T>
bool IsPrimeNumber(T value) {

	for (int i = 2; i * i <= value; ++i) {
		if ((value % i) == 0) {
			return true;
		}
	}
	return false;
}

// 桁数判定
template <typename T>
T GetFigureLength(T value) {
	T figure = 1;
	while (value >= 10) {
		value /= 10;
		++figure;
	}
	return figure;
}

// 素因数分解結果
template <typename T>
map<T, T> GetPrimeFactorize(T value) {

	map<T, T> res;

	for (T i = 2; i * i <= value; ++i) {
		if ((value%i) != 0)	continue;

		T count = 0;
		while ((value % i) == 0) {
			value /= i;
			++count;
		}

		res[i] = count;
	}

	if (value != 1) {
		res[value] = 1;
	}
	return res;
}

void answer(int a, int b) {
	cout << a << " " << b;
}

int main(void) {


	ll x;
	cin >> x;

	/*

	{
		auto v = pow(10,9);

		int valP = 0;
		int valM = 0;
		for (int i = 1; i < 2000; ++i) {
			auto a = pow(i, 5) - pow(i - 1, 5);
			if (a >= v) {
				valP = i;
				break;
			}
		}
		for (int i = 1; i < 2000; ++i) {
			auto a = pow(-i, 5) - pow(-i - 1, 5);
			if (a >= v) {
				valM = -i;
				break;
			}
		}
		cout << valP << " " << valM;
		return 0;
	}
	→120,-119のため、答えは-119<=A|B<=120
	*/

	/*
	map<ll, ll> ans;
	for (int i = 0; i <= 120; ++i) {
		auto val = 1;
		for (int j{}; j < 5; ++j) val *= i;

		if (ans.count(val + x)) {
			answer(ans[val + x], i);
			break;
		}

		if (ans.count(-val + x)) {
			answer(ans[-val + x], -i);
			break;
		}

		ans[val] = i;
	}
	*/
	map<ll, int> mp;
	for (int i{ 1000 }; i--;) {
		ll c{ 1 };
		for (int j{}; j < 5; ++j) c *= i;
		if (mp[c + x])
			return cout << mp[c + x] << " " << i << endl, 0;
		if (mp[x - c])
			return cout << mp[x - c] << " " << -i << endl, 0;
		mp[c] = i;
	}


	//auto output = resultCount;
	//cout << output;

	return 0;
}


Measured memory_bytes: 3704
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <functional>
#include <utility>
#include <cctype>
#include <fstream>

using namespace std;

#define ll long long
#define INF 2000000000
#define LINF 9000000000000000000
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define du(x) cout<<#x<<'='<<x<<endl
#define du2(x,y) cout<<#x<<'='<<x<<' '<<#y<<'='<<y<<'\n'<<endl
#define du3(x,y,z) cout<<#x<<'='<<x<<' '<<#y<<'='<<y<<' '<<#z<<'='<<z<<'\n'<<endl
#define darr(arr,n) rep(i,(n-arr)){cout<<*(arr+i)<<' ';}cout<<endl
#define ddarr(arr,a,b) rep(i,a){rep(j,b){cout<<*(arr+i*b+j)<<' ';}cout<<endl;}
#define ddd ifstream in("Text.txt");cin.rdbuf(in.rdbuf());


int field[600][600];

int a[300000], b[300000], c[300000], d[300000];
int main() {

    int H, W;
    cin >> H >> W;
    rep(i, H)rep(j, W)cin >> field[i][j];

    int cou = 0;
    rep(i, H)rep(j, W - 1) {
        if (field[i][j] % 2 == 1) {
            field[i][j]--;
            field[i][j + 1]++;

            a[cou] = i + 1;
            b[cou] = j + 1;
            c[cou] = i + 1;
            d[cou] = j + 2;
            cou++;
        }
    }

    rep(i, H - 1) {
        if (field[i][W - 1] % 2 == 1) {
            field[i][W - 1]--;
            field[i + 1][W - 1]++;

            a[cou] = i + 1;
            b[cou] = W;
            c[cou] = i + 2;
            d[cou] = W;
            cou++;
        }
    }
    //OK
    cout << cou << endl;
    rep(i, cou) {
        cout << a[i] << ' ' << b[i] << ' ' << c[i] << ' ' << d[i] << endl;
    }
}

Measured memory_bytes: 6272
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<string>
#include<functional>
#define rep(i,n,m) for(int i=(n);i<(int)(m);i++)
#define reps(i,n,m) for(int i=(n);i<=(int)(m);i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define fs first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define LB(a,x) lb(all(a), x) - a.begin()
#define UB(a,x) ub(all(a), x) - a.begin()
#define printfdouble(x) printf("%.20f\n",(x))
#define chartoint(c) (int)((c) - '0')
#define chartoll(c) (long long)((c) - '0')
#define MOD 1000000007
#define itn int
#define enld endl
#define ednl endl
#define icn cin
#define cotu cout
#define Endl endl
#define stirng string
using namespace std;
typedef long long ll;
const double pi = 3.141592653589793;
using Graph = vector<vector<int>>;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return 1;} return 0;}
template<class T> bool chmin(T &a, const T &b){if(b<a){a=b; return 1;} return 0;}
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int N; cin >> N;
    int ans = 0;
    reps(A,1,N){
        ans += (N-1)/A;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3648
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
 
int main(){
    int n;
    int x[100];
    int y[100];
    int i,p=0;
    double D[4]={0};
    double max=0;
     
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&x[i]);   // x?????\???
    }
    for(i=0;i<n;i++){
        scanf("%d",&y[i]);   // y?????\???
    }
     
    while(p<3){
        for(i=0;i<n;i++){
            D[p]+=pow(abs(x[i]-y[i]),p+1);
        }
        D[p]=pow(D[p],1/(double)(p+1));
        printf("%lf\n",D[p]);
        p++;
    }
     
    for(i=0;i<n;i++){
        if(abs(x[i]-y[i])>max){
            max=abs(x[i]-y[i]);
        }
    }
    D[3]=(double)max;
    printf("%lf\n",D[3]);
         
        return 0;
}

Measured memory_bytes: 696
while True:
    x=int(input())
    if x == 0:
        break
    m=1000-x
    s=0
    if m >= 500:
        s += 1
        m -=500
    while m >= 100:
        s += 1
        m -= 100
    if m >= 50:
        s += 1
        m -= 50
    while m >= 10:
        s += 1
        m -= 10
    if m >= 5:
        s += 1
        m -= 5
    while m >= 1:
        s += 1
        m -= 1
    print(s)


Measured memory_bytes: 5588
#include <bits/stdc++.h>
#include <bitset>
#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
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

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

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

int main(){
    cin>>H>>W;
    vector<string> ma(H);
    rep(i,H) cin>>ma[i];
    mat dist(H * W, vec(H*W, INF));
    vec di = {-1, 0, 1, 0}, dj = {0, -1, 0, 1};
    rep(i,H){
        rep(j, W){
            rep(k,4){
                int ni = i + di[k], nj = j + dj[k];
                if(ni >= 0 && ni < H && nj >= 0 && nj < W){
                    if(ma[i][j] != '#' && ma[ni][nj] != '#'){
                        dist[i*W + j][ni*W + nj] = dist[ni*W + nj][i*W + j] = 1;
                    }
                }
            }
        }
    }
    rep(k,H*W){
        rep(i,H*W){
            rep(j,H*W){
                if(i != j) chmin(dist[i][j], dist[i][k] + dist[k][j]);
            }
        }
    }
    ll ans = 0;
    rep(i,H*W){
        rep(j,H*W){
            if(dist[i][j] != INF) {
                chmax(ans, dist[i][j]);
                //cout << i/W<<' '<<i%W<<' '<<j/W<<' '<<j%W<<' '<<dist[i][j] << endl;
            }
        }
    }
    cout<<ans<<endl;
}

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

#define thegamebegins   ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define fileio          freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define int             long long
#define float           long double
#define test            int T; cin>>T; while(T--)
#define in(a,n)         for(int i=0; i<n; ++i)  cin>>a[i]
#define r0              return 0
#define E               "\n"
#define S               " "
#define elif            else if 
#define M               1000000007
#define fi(i,x,y)       for(int i=x; i<y; ++i)
#define fa(i,s)         for(auto i:s)
#define fp(i,s)         for(auto i=(s).begin(); i!=(s).end(); ++i)
#define sz(s)           (int)(s).size()
#define vi              vector <int>
#define vpii            vector <pair <int,int> >
#define mii             map <int,int>
#define pii             pair <int,int>
#define seti            set <int>
#define setd            set <int,greater <int> >
#define all(s)          (s).begin(),(s).end()
#define sortd(a,n)      sort(a, a+n, greater<int>())
#define pb              push_back
#define fr              first
#define sc              second
#define lb              lower_bound
#define ub              upper_bound
#define er              equal_range
 
const int INF = 0x3f3f3f3f;

signed main()
{
    thegamebegins

    string s;   cin>>s;
    if(find(all(s),'7')!=s.end())   cout<<"Yes";
    else    cout<<"No";
    r0;
}


Measured memory_bytes: 3648
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
using namespace std;

int main(){
	double in[1000];
	int n;
	for(;;){
		cin >> n;
		if(n==0) break;
		double s = 0, s2 = 0;

		for(int i=0; i<n; i++){
			cin >> in[i];
		}
		for(int i=0; i<n; i++){
			s += in[i];
		}
		s/=n;
		for(int i=0; i<n; i++){
			s2 += (in[i]-s)*(in[i]-s);
		}
		s2/=n;
		cout << sqrt(s2) << endl;
	}
	return 0;
}

Measured memory_bytes: 1296
#include<bits/stdc++.h>
using namespace std;
#define inf 1e9
#define ll long long 
#define M 1000000007
#define P pair<int,int>
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define rep(i,n) FOR(i,0,n)
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265

int n;
int a[1000000];

int main(){
  cin>>n;
  rep(i,n){
    cin>>a[i];
  }
  int b=0,ans=1;
  rep(i,n){
    if(i==0) continue;
    if(a[i-1]<a[i]){
      if(b==-1){
        ans++;
        b=0;
      }
      else b=1;
    }
    else if(a[i-1]>a[i]){
      if(b==1){
        ans++;
        b=0;
      }
      else b=-1;
    }
  }

  cout<<ans<<endl;

  return 0;
}



Measured memory_bytes: 640
#include<bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define repk(i,k, n) for (ll i = k; i <= (ll)(n); ++i)
#define MAX 100010
#define MOD 1000000007
typedef long long  ll;

using namespace std;


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

	int cnt[10][10] = {};

	repk(i,1, N) {
		string s = to_string(i);
		int f = s.front() - '0';
		int l = s.back() - '0';
		cnt[f][l]++;
	}

	int ans = 0;
	rep(i, 10) {
		rep(j, 10) {
			ans += cnt[i][j] * cnt[j][i];
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <unordered_map>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
#include <unordered_map>
#include <fstream>
#include <time.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef pair<int,int> pii;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(int i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 2020000;
ll dy[8] = {1,-1,0,0,1,-1,1,-1};
ll dx[8] = {0,0,1,-1,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T> inline void print(T &a){
    rep(i,a.size()) cout << a[i] << " ";
    cout << "\n";
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << "\n";}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
const int mod = 1e9 + 7;
//const int mod = 998244353;

int main(){
	ll n,k; cin >> n >> k;
	vl a(n); rep(i,n) cin >> a[i];
	rep(i,n-k){
		if(a[i] < a[i+k]) puts("Yes");
		else puts("No");
	}
}

Measured memory_bytes: 4784
#include <iostream>
#include <cmath>
#include <numeric>
#include <vector>
using namespace std;

int main(){
    int N, temp;
    cin >> N;
    vector<int> A;
    for(int i = 0; i < N; i++){
        cin >> temp;
        A.push_back(temp);
    }
    double average = accumulate(A.begin(), A.end(), 0) / double(A.size());
    average = round(average); //平均を四捨五入する。
    
    int ans = 0;
    for(int i = 0; i < N; i++){
        ans += (average - A[i])*(average - A[i]);
    }
    cout << ans << endl;
}

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

using namespace std;

int main(){
  int n,ans = 1;
  cin >> n;
  string s;
  cin >> s;
  for(int i = 1; i < n; i++){
    if(s[i] != s[i - 1]){
      ans++;
    }
  }
  cout << ans;
}


Measured memory_bytes: 512
#import sys
MOD = 10 ** 9 + 7
INFI = 10**10
#input = sys.stdin.readline
import math

import itertools
import heapq
#import bisect

import copy
from functools import lru_cache

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def kingaku(a,b,n):
    keta=len(str(n))
    return a*n+b*keta

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

#    h,w,a,b = map(int, input().split())
#    c = [[0 for j in range(n)] for i in range(n)]

def ret(a):
    c=[None]*(len(a)-1)
    if len(a)==1:
        return a[0]
    elif len(a)==0:
        return 0
    for i in range(1,len(a)):
        c[i-1]=abs(a[i]-a[i-1])
    return ret(c)


def main():
    n,k=map(int,input().split())
    mo=[0 for i in range(n)]
    for i in range(k):
        d=int(input())
        a=list(map(int,input().split()))
        for j in range(d):
            mo[a[j]-1]=1
    print(len(mo)-sum(mo))





if __name__ == "__main__":

    main()

Measured memory_bytes: 68512
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

#define MAX_N 100005
ll inv[MAX_N], fac[MAX_N], finv[MAX_N];
void make() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for(int i=2; i<MAX_N; i++) {
    inv[i] = mod - inv[mod%i] * (mod/i) % mod;
    fac[i] = fac[i-1] * (ll)i % mod;
    finv[i] = finv[i-1] * inv[i] % mod;
  }
}
ll perm(ll n, ll r) {
  if(n < 0)      return 0;
  else if(n < r)  return 0;
  else            return (fac[n] * finv[n-r]) % mod;
}

void dfs(vector<vector<int> >& Graph, int v, int par, int k, ll& ans) {
  ll n = k-1-(par >= 0);
  ll r = int(Graph[v].size()-(par >= 0));
  ans *= perm(n, r);
  ans %= mod;
  for(int i=0; i<Graph[v].size(); i++) {
    int w = Graph[v][i];
    if(w != par)
      dfs(Graph, w, v, k, ans);
  }
}

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> A(N), B(N);
  make();
  vector<vector<int> > Graph(N);
  rep(i, N-1) {
    cin >> A[i] >> B[i];
    A[i]--; B[i]--;
    Graph[A[i]].push_back(B[i]);
    Graph[B[i]].push_back(A[i]);
  }
  ll ans = K;
  dfs(Graph, 0, -1, K, ans);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 14720
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>

typedef long long ll;
using namespace std;

int pot (ll q, ll w){
	ll qw = q;
	q = 1;
	for (int i = 0; i<w; i++)
		q*= qw;
	return q;
}

ll a,b,c,f[10],rj;

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

cin >> a >> b >> c;

f[a]++;
f[b]++;
f[c]++;

for (int i = 0; i<10; i++)
	if (f[i] == 2)
		rj = 1;

if (rj == 1)
	cout << "Yes";
else
	cout << "No";


return 0;
}



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

int main()
{
    std::string s, t;
    std::cin >> s >> t;
    std::sort(s.begin(), s.end());
    std::sort(t.rbegin(), t.rend());
    if (s < t) printf("Yes\n");
    else printf("No\n");

    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void)
{
	int a,d,n;

	int l;
	int count;
	int i1;

	int check;

	while(1){

		cin >> a;
		cin >> d;
		cin >> n;

		if (a==0 && d==0 && n==0) break;

		l = a;
		count = 0;
		check = 0;

		if(l==2) count++;
		else if(l!=1){
			for(i1=2;i1*i1<=l;i1++){
				if(l%i1==0){
					check = 1;
					break;
				}
			}
			if(check==0) count++;
		}

		

		while(count<n){
			l += d;
			check=0;

			if(l==2) count++;
			else{
				for(i1=2;i1*i1<=l;i1++){
					if(l%i1==0){
						check = 1;
						break;
					}
				}

				if(check==0) count++;
			}

		}

		cout << l << endl;
	}



	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef long double ldouble;
ldouble calc(ldouble r,ldouble w){
  return sqrt(r*r+(w/(2*r))*(w/(2*r)));
}
signed main(){
  int d,n,b;
  cin>>d>>n>>b;
  int p[n];
  ldouble h[n];
  for(int i=0;i<n;i++) cin>>p[i]>>h[i];
  ldouble INF=1e10;
  ldouble ans=INF;
  for(int i=1;i<=b+1;i++){
    ldouble w=(double)d/i;
    ldouble l=0,r=INF;
    for(int k=0;k<2000;k++){
      ldouble x=(l+r)/2;
      ldouble y=w/(2*x);
      //cout<<x<<" "<<y<<endl;
      bool f=1;
      for(int j=0;j<n;j++){
	ldouble ax=p[j];
	while(ax>=w) ax-=w;
	ldouble ay=(-1.0/(2*x*x)*(ax*ax))+((y/x)*ax);
	f&=(h[j]<=ay);
      }
      if(f) l=x;
      else r=x;
    }
    //cout<<i<<":"<<w<<" "<<r<<endl;
    ans=min(ans,calc(r,w));
    ldouble x=sqrt(w/2);
    if(x<=r) ans=min(ans,calc(x,w));
    /*
    l=0;
    for(int k=0;k<20;k++){
      ldouble m1=l+(r-l)/3;
      ldouble m2=l+(r-l)/3*2;
      ldouble t1=calc(m1,w);
      ldouble t2=calc(m2,w);
      ans=min(ans,t1);
      ans=min(ans,t2);
      //cout<<m1<<":"<<t1<<endl;
      //cout<<m2<<":"<<t2<<endl;
      if(t1<t2) r=m2;
      else l=m1;
    }
    */
  }
  printf("%.12Lf\n",ans);
  return 0;
}

Measured memory_bytes: 3288
def main():
    h,n=map(int,input().split())
    ab=sorted([tuple(map(int,input().split())) for _ in range(n)],key=lambda x:x[1])
    mn=[0]
    for i,j in ab:
        if i > len(mn)-1:
            mn.extend([j]*(i-len(mn)+1))
    for i in range(1,len(mn)):
        for j in range(1,i):
            x=mn[j]
            cost=(i//j)*x+mn[i-(i//j)*j]
            if cost<mn[i]:
                mn[i]=cost
    if h<=len(mn)-1:
      print(mn[h])
    else:
      c=len(mn)
      while True:
        s=10**9
        for i in range(1,len(mn)):
          s=min(s,mn[i]+mn[-i])
        mn.append(s)
        if c==h:
          print(mn[-1])
          break
        else:
          c+=1
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 42544
//ABC150A
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <climits>
#include <cfloat>
#include <string>
#include <unordered_map>
using namespace std;

int main(){
	int k, x;
	cin >> k >> x;
	if(500*k >= x){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 768
#include <stdio.h>
int main(void)
{
	int N;
	int i;
	long int cnt;
 
	scanf("%d",&N);	
 
	int M[N+1];
	int H[N];
	for(i=0;i<N+1;i++){
		scanf("%d",&M[i]);
	}
 
	for(i=0;i<N;i++){
		scanf("%d",&H[i]);
	}
 
	cnt=0;	
	for(i=0;i<N;i++){
		if(M[i]>=H[i]){
			cnt+=H[i];
		}else{
			cnt+=M[i];
			H[i]-=M[i];
			if(M[i+1]>=H[i]){
				cnt+=H[i];
				M[i+1]-=H[i];
			}else{
				cnt+=M[i+1];
				M[i+1]=0;
			}
		}
	}
 
	printf("%ld\n",cnt);
 
	return 0;
}	

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

using namespace std;

const int MOD = 1000000007;
const int maxf = 2010;
vector<int> f(maxf, 1);
vector<int> invf(maxf, 1);

int comb(int n, int r) {
  if (r < 0 || r > n) return 0;
  return 1LL * f[n] * invf[n - r] % MOD * invf[r] % MOD;
}

inline int mpow(int x, int n) {
  int res = 1;
  while (n > 0) {
    if (n % 2 == 1) res = 1LL * res * x % MOD;
    x = 1LL * x * x % MOD;
    n /= 2;
  }
  return res % MOD;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, K;
  cin >> N >> K;

  for (int i = 1; i < maxf; i++) {
    f[i] = 1LL * i * f[i - 1] % MOD;
  }
  invf[maxf - 1] = mpow(f[maxf - 1], MOD - 2);
  for (int i = maxf - 1; i > 0; i--) {
    invf[i - 1] = 1LL * invf[i] * i % MOD;
  }

  int blue = K, red = N - K;
  for (int i = 0; i < K; i++) {
    cout << 1LL * comb(blue - 1, i) * comb(red + 1, i + 1) % MOD << '\n';
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()
// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return;std::cout << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class X> void DEBUG(X d, T e){if(DEBUG_OUT == false)return;std::cout <<d<<" ";DEBUG(e);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

//CODE

void solve(void)
{
  int N;
  cin>>N;
  vector<int> vec(N);
  for (int i = 0; i < N; i++)
  {
    cin>>vec[i];
  }
  vector<int> origin = vec;
  sort(ALL(vec));
  int COUNT = 0;
  for (int i = 0; i < N; i++)
  {
    if(vec[i] != origin[i]) COUNT++;
  }
  if(COUNT <= 2)
  {
    cout<<"YES"<<endl;
  }
  else
  {
    cout<<"NO"<<endl;
  }
  
  
  
  
  return;
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();
  

 
  return 0;
}


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

const int MN = 2e5+5, mod = 1e9+7;
int dp[MN], lst[MN], N, i, x, y;

int main(){
    for(scanf("%d",&N),i=1;i<=N;i++){
        scanf("%d",&x);
        dp[i] = dp[i-1];
        if(lst[x]&&x!=y) dp[i]=(dp[i]+dp[lst[x]]+1)%mod;
        lst[x]=i; y=x;
    }
    printf("%d\n",(dp[N]+1)%mod);
    return 0;
}


Measured memory_bytes: 1792
import java.io.*;
public class Main {
		public static void main(String[] arg) throws IOException {
			InputStreamReader is = new InputStreamReader(System.in);       //?????????
	        BufferedReader br = new BufferedReader(is);
			String str = br.readLine();  
			int num = Integer.parseInt(str);
			System.out.println(num*num*num);
	}

}

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

using namespace std;

#define ll long long
#define ull unsigned long long
#define pl pair<ll, ll>
#define vll vector<ll>
#define pll vector<pair<ll, ll>>
#define f(i,a, b) for (ll i = a; i < b; i++)
#define ft int t; cin>>t; while(t--)
#define mp make_pair
#define pb push_back
#define ld float
#define fd(i,a, b) for (ll i = a; i >= b; i--)
#define nl "\n"
 /*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
     typedef tree<ll ,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;*/



int main() {
ios_base::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NULL);
  ll n,k;
  cin>>n>>k;

  ll mod=1e9+7;

  ll pr=0,sf=0;
  f(i,0,k)pr+=i;
  for(ll i=n;i>n-k;i--)sf+=i;
  ll fi=k,si=n-k;
  ll sm=0;
  f(i,k,n+2){
      sf=sf%mod; pr=pr%mod;
     ll val=(sf-pr+1+mod)%mod;
     sm=(sm+val)%mod;
      pr+=fi;
      sf+=si;
      fi++; si--;
  }

  cout<<sm;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=1; i<=(n); i++)
int main() {

    int h, w;
    cin >> h >> w;
    char s[55][55] = {};
    REP(i, h){
        REP(j, w){
            cin >> s[i][j];
        }
    }
    REP(i, h){
        REP(j, w){
            if(s[i][j] == '#' && s[i+1][j] != '#' && s[i-1][j] != '#' && s[i][j+1] != '#' && s[i][j-1] != '#'){
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n, a[100010], b[100010] = {}, ans = 1;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		b[a[i]]++;
	}
	for (int i = 0; i < n - 2; i++) {
		ans = max(ans, b[i] + b[i + 1] + b[i + 2]);
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
    int N;
    cin >> N;
    vector<int> h(N);
    for (int i=0; i<N; i++){
        cin >> h.at(i);
    }

    int cnt;

    while(true){
        bool allzero =true;
        for(int i=0; i<N; i++){
            if (h.at(i) != 0){
                allzero =false;
            }
        }
        if (allzero) break;

    //ゼロでない一番左の値をほしい

    int l;
    while(h.at(l)==0) l++;
    int r=l;

    while (r<N-1 && h.at(r+1) != 0) r++;
    cnt++;
    for(int i=l; i<=r; i++) h.at(i)--;

    }

    cout << cnt <<endl;
}

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

int main()
{
  ll N;
  cin >> N;

  if (N%2 == 1) {
    cout << 0 << endl;
    return 0;
  }

  ll t = 10;
  ll ans = 0;
  while (t <= N) {
    ans += N/t;
    t *= 5;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repit(it, li) for(auto it=li.begin(); it!=li.end(); it++)
using namespace std;
using ll = long long;
using P = pair<int,int>;

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

   int ans;
   if(n>=10) ans=r;
   else ans=r+100*(10-n);

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


Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define rep(i,n) for(int i=(0);i<(n);i++)

using namespace std;

typedef long long ll;

int max_N = 1e7;

int N, Q;
string s;
vector<char> t;
vector<char> d;

bool lcond(int x){
	int ok = N;
	int ng = -1;
	int pos = x;
	if(pos <= ng) return false;
	if(pos >= ok) return true;

	for(int i = 0; i < Q; i++){
		if(t[i] == s[pos]){
			if(d[i] == 'L'){
				pos--;
			}else{
				pos++;
			}
			// cout << x << "," << i << "," << pos << endl;
		}

		if(pos == ng) return false;
		if(pos == ok) return true;
	}
	return false;
}

bool ucond(int x){
	int ok = -1;
	int ng = N;
	int pos = x;
	if(pos >= ng) return false;
	if(pos <= ok) return true;

	for(int i = 0; i < Q; i++){
		if(t[i] == s[pos]){
			if(d[i] == 'L'){
				pos--;
			}else{
				pos++;
			}
			// cout << x << "," << i << "," << pos << endl;
		}

		if(pos == ng) return false;
		if(pos == ok) return true;
	}
	return false;
}

// condを満たす最小のxを求める(lower_bound)
// 全てのxが条件を満たさない場合はnを返す(nはとりえない値)
int lower_bound_cond(){
	int lb = -1, ub = max_N;

	while(ub - lb > 1){
		int mid = (lb + ub) / 2;
		bool ok = lcond(mid);
		// cout << mid << "," << ok << endl;
		if(ok) ub = mid;   // Answer is in (lb, mid]
		else lb = mid;            // Answer is in (mid, ub]
	}

	// now lb + 1 = ub
	return ub;
}

// condを満たす最大のxを求める(upper_bound)
// 全てのxが条件を満たさない場合は-1を返す(-1はとりえない値)
int upper_bound_cond(){
	int lb = -1, ub = max_N;

	while(ub - lb > 1){
		int mid = (lb + ub) / 2;
		bool ok = ucond(mid);
		// cout << mid << "," << ok << endl;
		if(ok) lb = mid;   // Answer is in [mid, ub)
		else ub = mid;            // Answer is in [lb, mid)
	}

	// now lb + 1 = ub
	return lb;
}

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

	cin >> N >> Q;
	cin >> s;

	rep(i, Q){
		string a, b;
		cin >> a >> b;

		t.push_back(a[0]);
		d.push_back(b[0]);
	}

	// cout << "calc lfall:" << endl;
	int lfall = upper_bound_cond();
	// cout << "lfall = " << lfall << endl;
	// cout << "calc ufall:" << endl;
	int rfall = lower_bound_cond();
	// cout << "rfall = " << rfall << endl;

	int fall = (lfall == max_N ? 0 : lfall + 1) + (rfall == -1 ? 0 : N - rfall);
	cout << N - fall << endl;
}


Measured memory_bytes: 1100
#include<stdio.h>
#include<string.h>
int main()
{
	int t=0,i,n,a=0;
	char s[20];
	scanf("%s",s);
	n=strlen(s);
	if(n<4||n>10)printf("WA\n");
	else if(s[0]!='A')printf("WA\n");
	else if(s[1]>='A'&&s[1]<='Z')printf("WA\n");
	else if(n<4)printf("WA\n");
	else if(s[1]=='C')printf("WA\n");
	else if(s[n-1]=='C')printf("WA\n");
	else
	{
		for(i=2;i<n;i++)
		{
			if((s[i]<'a'||s[i]>'z')&&s[i]!='C')a=1;
		}
		if(a==1)printf("WA\n");
		else
		{
			for(i=0;i<n;i++)
			{
				if(s[i]=='C')t++;
			}	
			if(t!=1)printf("WA\n");
			else printf("AC\n");
		}
	}
	return 0;
}

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

int main() {
  int n,m,l; cin>>n>>m>>l;
  bool frag=false;
  if (n==m&&n!=l) frag=true;
  if (n==l&&n!=m) frag=true;
  if (l==m&&n!=m) frag=true;
  if (frag) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


Measured memory_bytes: 256
import math

n=int(input())
s=""

i=0
while n!=0:
    #print(s)
    if abs(n)%2==0:
        s="0"+s
        n=n//2
    else:
        if i%2==0:
            n=(n-1)//2
        else:
            n=(n+1)//2
        s="1"+s
    i+=1
if s!="":
  print(s)
else:
  print(0)

Measured memory_bytes: 3060
import java.util.Scanner;

class Main{

	public static void main(String[] args){

		Scanner sc =new Scanner(System.in);

		int x=sc.nextInt();
		int y=sc.nextInt();

		System.out.println(gcd(x,y));

	}

	private static int gcd(int x, int y) {

		if(x%y==0) return y;
		else return gcd(y,x%y);

	}


}



Measured memory_bytes: 26332
from sys import stdin


def fetch_one_line():
    return stdin.readline().rstrip()


def fetch_int_input():
    return [int(s) for s in fetch_one_line().split()]


def fetch_inputs(times):
    return [fetch_one_line() for _ in range(times)]


def fetch_int_inputs(times):
    return [[int(s) for s in fetch_one_line()] for _ in range(times)]

print(pow(int(fetch_one_line()), 2))


Measured memory_bytes: 38256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
// Hey! 僕の提出を見てくれてありがとう.
// ロボ子さん可愛いぞ！！！！！君もV沼にはまろう↓
// https://www.youtube.com/channel/UCDqI2jOz0weumE8s7paEk6g
using namespace std;
namespace mp = boost::multiprecision;
// 任意長整数型
using bint = mp::cpp_int;
// 仮数部長が32の浮動小数点数型
using real32 = mp::number<mp::cpp_dec_float<32>>;
// 仮数部長が1024の浮動小数点数型
using real1024 = mp::number<mp::cpp_dec_float<1024>>;
// ついでに有理数型
using rat = boost::rational<bint>;
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
#define pb(x) push_back(x)
#define pri_queue priority_queue //優先度付きキュー
#define syo(x) fixed << setprecision(x) //iostreamで小数をx桁表示
//sortを降順にする時は greater<型>()
const string YES = "YES";
const string NO = "NO";

void solve(long long A, long long V, long long B, long long W, long long T){
  ll x=A,y=B;
  bool n;
  if(x < y){
    n = true;
  }else{
    n = false;
  }
  bool can = false;
  for (int i = 0; i < T; i++) {
    if(n){
      x +=V;
      y +=W;
      if(x >= y){
        can = true;
      }
    }else{
      x -= V;
      y -= W;
      if(x <= y){
        can = true;
      }
    }
  }
  cout << (can ? YES:NO) << endl;
}

int main(){
    long long A;
				scanf("%lld",&A);
				long long V;
				scanf("%lld",&V);
				long long B;
				scanf("%lld",&B);
				long long W;
				scanf("%lld",&W);
				long long T;
				scanf("%lld",&T);
    solve(A, V, B, W, T);
    return 0;
}


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

using namespace std;
typedef long long ll;

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

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

// using ll = long long;
#define int long long

#define LOG(variable) cout << #variable":\t" << (variable) << endl
#define LOGCON(i, container) for(int (i) = 0; (i) < (container).size(); ++(i)) cout << (i) << ":\t" << (container)[(i)] << endl
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, r, n) for (int i = (r); i < (n); ++i)
#define REPR(i, n) for(int i = (n); i >= 0; --i) // from n to 0
#define REPRS(i, r, n) for(int i = (n); i >= (r); --i) // from n to r
#define REPOBJ(itr, obj) for(auto itr = (obj).begin(); itr != (obj).end() ; ++itr)
#define REPROBJ(itr, obj) for(auto itr = (obj).rbegin(), e = (obj).rend(); itr != e; ++itr)
#define COUTB(x) cout << (x) << "\n"
#define COUTS(x) cout << (x) << " "
#define PB push_back
#define SORT(obj) sort((obj).begin(), (obj).end())
#define SORTR(obj) sort((obj).begin(), (obj).end(), greater<>())
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define PI (acos(-1))

const int MAX = 105;
bool g[MAX][MAX];
/***** MAIN *****/
signed main() {
  int W, H, N;
  cin >> W >> H >> N;
  int x[N], y[N], com[N];
  REP(i,N) {
    cin >> x[i] >> y[i] >> com[i];
  }
  REP(i,N) {
    if(com[i] == 1) {
      REP(j, H) REP(k, x[i]) {
        g[j][k] = true;
      }
    } else if(com[i] == 2) {
      REP(j, H) REPS(k, x[i], W) {
        g[j][k] = true;
      }
    } else if(com[i] == 3) {
      REP(j, y[i]) REP(k, W) {
        g[j][k] = true;
      }
    } else if(com[i] == 4) {
      REPS(j, y[i], H) REP(k, W) {
        g[j][k] = true;
      }
    }
  }
  int white = 0;
  REP(i,H) REP(j,W) if(!g[i][j]) ++white;
  cout << white;
  cout << "\n";
  return 0;
}
/***** MAIN *****/


Measured memory_bytes: 256
#include <iostream>
#include <map>
using namespace std;
long long pow(long long i, long long P);

int main(void){
  long N,P;
  string _S;
  cin>>N>>P;
  cin>>_S;


  if(P==2 or P==5){
    long long retval=0;
    for(long long i=0;i<N;i++){
      if((_S[i]-'0')%P==0){
        retval+=(i+1);
      }
    }
    cout<<retval<<endl;
    return 0;
  }



  map<long long,long long>d;
  for(long long i=0;i<P;i++){
    d[i]=0;
  }
  d[0]=1;
  long long S=0;
  for(long long i=0;i<N;i++){
    S+=pow(i+1,P)*(_S[N-i-1]-'0');
    d[S%P]=d[S%P]+1;
  }
  long long retval=0;
  for(long long i=0;i<P;i++){
    if(d[i]>0){
      retval+=(d[i]-1)*d[i]/2;
    }
  }
  cout<<retval<<endl;
  return 0;
  return 0;
}

long long pow(long long i,long long P){
  if(i==0) return 1;
  else if(i%2==0){
    return (pow(i/2,P)*pow(i/2,P))%P;
  }
  else{
    return (10*pow(i-1,P))%P;
  }
}


Measured memory_bytes: 1028
v = input().split(' ')
X = v[0]
Y = v[1]
x = 0
y = 0
a = ['A','B','C','D','E','F']
if type(X)==type(1):
    x = int(X)
else:
    i = 0
    for b in a:
        i += 1
        if X==b:
            x = int(9+i)

if type(Y)==type(1):
    y = int(Y)
else:
    i = 0
    for c in a:
        i += 1
        if Y==c:
            y = int(9+i)

if x>y:
    print('>')
elif x==y:
    print('=')
else:
    print('<')


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

int main()
{
  int n, m, k;
  cin >> n >> m >> k;
  vector<int> a(n);
  vector<int> b(m);
  rep(i, n) cin >> a[i];
  rep(i, m) cin >> b[i];

  ll t = 0;
  rep(i, m) t += b[i];
  int j = m;
  int ans = 0;
  rep(i, n + 1)
  {
    while (j > 0 && t > k)
    {
      --j;
      t -= b[j];
    }
    if (t > k)
      break;
    ans = max(ans, i + j);
    if (i == n)
      break;
    t += a[i];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4820
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#define llong long long
#define INF (__INT32_MAX__ / 2)

using namespace std;
typedef pair<int, int> ipair;

int A, B;
int res;
int main(int argc, char **argv) {
    cin >> A >> B;

    res = A % B;
    cout << res << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int n,b,f,r,v,c=0,i,j,s;
  int count[4][3][10] ={{{0}}} ;
  scanf("%d",&n);
  while(1){
    if(c==n) break;
    scanf("%d %d %d %d",&b,&f,&r,&v);
    /*b=building,f=floor,r=number,v=inout*/
    count[b-1][f-1][r-1] += v;
    c++;
  }
  /*0building*/
  for(i=0;i<=2;i++){
    for(j=0;j<=9;j++){
      printf(" %d",count[0][i][j]);
      if(j==9){
	printf("\n");
      }
    }
  }
  for(s=1;s<=20;s++){
    printf("#");
  }
  printf("\n");
  /*1building*/
  for(i=0;i<=2;i++){
    for(j=0;j<=9;j++){
      printf(" %d",count[1][i][j]);
      if(j==9){
	printf("\n");
      }
    }
  }
  for(s=1;s<=20;s++){
    printf("#");
  }
  printf("\n");
  /*2buiding*/
  for(i=0;i<=2;i++){
    for(j=0;j<=9;j++){
      printf(" %d",count[2][i][j]);
      if(j==9){
	printf("\n");
      }
    }
  }
  for(s=1;s<=20;s++){
    printf("#");
  }
  printf("\n");
  /*3building*/
  for(i=0;i<=2;i++){
    for(j=0;j<=9;j++){
      printf(" %d",count[3][i][j]);
      if(j==9){
	printf("\n");
      }
    }
  }

  return 0;
}



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

string makeSnakeA( int a )
{
    string s = ">\'";
    for( int i = 0; i < a; i++ )
        s += "=";
    s += "#";
    for( int i = 0; i < a; i++ )
        s += "=";
    s += "~";
    return s;
}

string makeSnakeB( int a )
{
    string s = ">^";
    for( int i = 0; i < a; i++ )
        s += "Q=";
    s += "~~";
    return s;
}

int main()
{
    int n;
    string str, s[200], t[200];
    for( int i = 0; i < 200; i++ )
    {
        s[i] = makeSnakeA( i + 1 );
        t[i] = makeSnakeB( i + 1 );
    }

    cin >> n;

    for( int i = 0; i < n; i++ )
    {
        cin >> str;

        int size = str.size();

        if( size >= 6 && s[(size-6)/2] == str )
            cout << "A" << endl;
        else if( size >= 6 && t[(size-6)/2] == str )
            cout << "B" << endl;
        else
            cout << "NA" << endl; 
    }

    return 0;
}


Measured memory_bytes: 3204
from sys import setrecursionlimit
setrecursionlimit(10 ** 9)

n, m = [int(i) for i in input().split()]
A = [[int(i) for i in input().split()] for j in range(n+m-1)]

T = [[] for i in range(n+1)]
RT = [[] for i in range(n+1)]

for a, b in A:
    T[a].append(b)
    RT[b].append(a)

P = [0] * (n+1)
D = [0] * (n+1)

def dfs(i):
    if D[i] > 0:
        return D[i] + 1
    for t in RT[i]:
        d = dfs(t)
        if d > D[i]:
            D[i] = d
            P[i] = t

    return D[i] + 1

def root(i):
    if not RT[i]:
        return i
    return root(RT[i][0])

D[root(1)] = 1

for i in range(1, n+1):
    dfs(i)

for p in P[1:]:
    print(p)

Measured memory_bytes: 103940
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
template<typename T>
using pque = priority_queue<T, vector<T>, greater<T>>;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

#define N 64
char s[N][N];
mcf_graph<int, int> g(N*N);
const int S = N*N - 200, T = N*N - 201, INF = 200;
bool u[N][N];

void dfs(int a, int y, int x, int c){
	if(s[y][x] == '#' || u[y][x]) return;
	u[y][x] = true;
	DEBUG("  => (%d, %d)\n", y, x);
	g.add_edge(a, y*N+x, 1, INF-c);
	dfs(a, y+1, x, c+1);
	dfs(a, y, x+1, c+1);
}

int main(){
	int n, m; scanf("%d%d", &n, &m);
	REP(i, n){
		scanf("%s", s[i]);
		s[i][m] = '#';
	}
	REP(i, m+1) s[n][i] = '#';
	int k = 0;
	REP(i, n) {
		REP(j, m) {
			g.add_edge(i*N+j, T, 1, 0);
			if(s[i][j] != 'o') continue;
			DEBUG("[%d](%d, %d)\n", k, i, j);
			int p = N*N-1-k;
			g.add_edge(S, p, 1, 0);
			REP(y, N) REP(x, N) u[y][x] = false;
			dfs(p, i, j, 0);
			k++;
		}
	}
	auto [hoge, ans] = g.flow(S, T);
	DEBUG("%d %d\n", hoge, ans);
	printf("%d\n", INF*k - ans);
}




Measured memory_bytes: 7256
#include <iostream>
#include <vector>
#define ll long long 
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vvvl vector<vector<vector<ll> > >
using namespace std;
int main(void){
    ll k,r; cin>>k>>r;
    if(k<10) cout<<(r+100*(10-k))<<endl;
    else cout<<r<<endl;
}


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

int main() {
    double a,b,C,S,L,h;
    
    cin >> a >> b >> C;

    double PI = acos(-1);
    double rad = 2*PI*C/360;
    
    h = b*sin(rad);
    S = a*h/2;
    L = a+b+sqrt(pow(a,2)+pow(b,2)-2*a*b*cos(rad));
    
    cout << fixed;
    cout.precision(6);
    cout << S << endl << L << endl << h << endl;
    
}


Measured memory_bytes: 3544
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <unordered_map>
#define rep(i,n) for (int i=0; i<n;++i)
#define rep_down(i,n) for (int i=n-1; i>=0;--i)
#define ALL(a)  (a).begin(),(a).end()
typedef long long ll;
using namespace std;
typedef pair<int, int> P;
const ll MOD = 1e9+7LL;
const int INF = 1e9+7;
int N;
vector<P> T[100005];
int color[100005]; // 0は未彩色　-1or1

void dfs(int v, int c){
  if (color[v] != 0) return;
  color[v] = c;
  rep(i, T[v].size()) {
    P p = T[v][i];
    int nc = p.second?-c:c;
    dfs(p.first, nc);
  }
}

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

  cin >> N;
  int u,v,w;
  rep(i, N-1) {
    cin >> u >> v >> w;
    u--; v--;
    w%=2;
    T[u].push_back(P(v,w));
    T[v].push_back(P(u,w));
  }

  dfs(0,1);
  rep(i, N) {
    int c = color[i]>0?1:0;
    cout << c << "\n";
  }
  return 0;
}

Measured memory_bytes: 8448
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdint.h>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-12;
static const double PI = acos(-1.0);

#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(a) (a).begin(), (a).end()
#define DEBUG(x) cout << #x << ": " << x << endl

const long long MOD = 1000000007;

ll dp[1001][1001];

void solve(long long H, long long W, std::vector<std::string> a) {
  dp[0][0] = 1;
  REP(h, H) {
    REP(w, W) {
      if (a[h][w] == '#') {
        continue;
      }
      if (w - 1 >= 0) {
        dp[h][w] += dp[h][w - 1];
      }
      if (h - 1 >= 0) {
        dp[h][w] += dp[h - 1][w];
      }
      dp[h][w] %= MOD;
    }
  }
  std::cout << dp[H - 1][W - 1] << std::endl;
}

int main() {
  long long H;
  scanf("%lld", &H);
  long long W;
  scanf("%lld", &W);
  std::vector<std::string> a(H);
  for (int i = 0; i < H; i++) {
    cin >> a[i];
  }
  solve(H, W, std::move(a));
  return 0;
}


Measured memory_bytes: 9088
#include <iostream>
using namespace std;
int qzh[100005];
int main(int argc, char** argv) {
	int n,q;
	cin >> n >> q;
	string a;
	cin >> a;
	a=' '+a;
	for(int i=1;i<=a.size();i++)
	{
		if(a[i]=='C'&&a[i-1]=='A')
			++qzh[i];
	}
	for(int i=1;i<=n;i++)
		qzh[i]+=qzh[i-1];
	while(q--)
	{
		int l,r;
		cin >> l >> r;
		cout << qzh[r]-qzh[l] << "\n";
	}
	return 0;
}

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

int main(){
  int s;
  cin >> s;
  cout << "ABC" << s << endl;
  return 0;
}


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

int main(){
    int A, B, K;
    cin >> A >> B >> K;
    for (int i = 0; i < K; i++){
        if(A + i <= B){
            cout << A + i << endl;
        }
    }
    for (int i = B - K + 1; i <= B; i++){
        if (i > A + K - 1){
            cout << i << endl;
        }
    }
}

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

using namespace std;

typedef long long ll;

double getTime() {
  return clock() / (double) CLOCKS_PER_SEC;
}

void read() {};

template<typename T, typename... Args>
void read(T& a, Args&... args) {
  cin >> a;
  read(args...);
}

void print() {};

template <typename T, typename... Args>
void print(T a, Args... args) {
  cout << a << " \n"[sizeof...(args) == 0];
  print(args...);
}

int main() {
  int a[3]; cin >> a[0] >> a[1] >> a[2];
  if(a[0] == a[1] and a[0] != a[2]) {
    print("Yes");
  }
  else if(a[0] == a[2] and a[0] != a[1]) {
    print("Yes");
  }
  else if(a[1] == a[2] and a[1] != a[0]) {
    print("Yes");
  }
  else {
    print("No");
  }
}

Measured memory_bytes: 256
N = int(input())
flag = False
for i in range(0,N//4+2):
    for j in range(0,N//7+2):
        s = 4*i + 7*j
        if s > N: break
        if s == N:
            flag = True
            break
    if flag: break
if flag: print('Yes')
else: print('No')

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

using namespace std;

int n, m;
int p;
char s[10];
int jum[100010];
int penal;
int righ;
int ch[100010];

int main(void)
{
	scanf("%d %d", &n, &m);
	
	for(int i = 0 ; i < m ; i++)
	{
		scanf("%d %s", &p, s);
		
		if(strcmp(s, "WA") == 0)
		{
			jum[p]++;
		}
		
		if(strcmp(s, "AC") == 0)
		{
			if(ch[p] == 0)
			{
				ch[p] = 1;
				righ++;
				penal += jum[p];
			}
		}
	}
	
	printf("%d %d", righ, penal);
	return 0;
}

Measured memory_bytes: 1024