akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <iomanip>
#include <map>
#include <bitset>
#include <cstdio>
#include <set>
#include <stack>
#include <queue>
#include <cassert>
//#include <bits/stdc++.h>
#define rep(i,n) Rep(i,0,n)
#define Rep(i,k,n) for(int i=k ; i<n ; i++)
#define rep1(i,n) for(int i=1 ; i<=n ; i++)
#define vi vector<int>
#define vii vector<vector<int>>
#define mii map<int,int>
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())
#define ALL(a)  (a).begin(),(a).end()

typedef long long ll;

//const int MOD = 1000000007;
//const int INF = 1<<30;
using namespace std;

string yn(bool x){
    return x ? "Yes" : "No";
}


int main(){
    ll n,k; cin >> n >> k;
    
    map<ll,ll> m;
    
    rep(i,n){
        int x,y; cin >> x >> y;
        m[x] += y;
    }
    
    
    for(ll ans = 1 ; ans<=100000 ; ans++){
        if(k <= m[ans]){
            cout << ans << endl;
            break;
        }
        
        k -= m[ans];
    }
}














Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(V) V.begin(),V.end()

int main() {
	int N;
	cin >> N;
	for (double i = 0;i < 50002;i += 1) {
		if ((int)(i * 1.08) == N) {
			cout << i << endl;
			return 0;
		}
	}
	cout << ":(" << endl;
}

Measured memory_bytes: 256
/**
 * @author      : cromarmot (yexiaorain@gmail.com)
 * @license     : GPL
 * @created     : 星期六 9月 28, 2019 20:06:50 CST
 */

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

typedef long long ll;
#define ten5 100000+10
#define MOD 1000000007
#define rep(i,a,n) for (int i=a;i<n;i++)
#define iif(c,t,f) ((c)?(t):(f))
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
const double pi = acos(-1.0);

int n;

int k;

int h[100010];

int main(){
  cin>>n>>k;
  int ans = 0;
  rep(i,0,n){
    scanf("%d",h+i);
    ans+= h[i]>=k;
  }
  cout<<ans<<endl;

  return 0;
}

/*
 *
 * hash prime
   61,83,113,151,211,281,379,509683,911
   1217,1627,2179,2909,3881,6907,9209
   12281,16381,21841,29123,38833,51787,69061,92083
   122777,163729,218357,291143,388211,517619,690163,999983
   1226959,1635947,2181271,2908361,3877817,5170427,6893911,9191891
   12255871,16341163,21788233,29050993,38734667,51646229,68861641,91815541
   122420729,163227661,217636919,290182597,386910137,515880193,687840301,917120411
   1000000007,1000000009
 * */



Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include <cstddef>
using namespace std;

int main()
{
    int N, K, Q; 
    cin >> N >> K >> Q;
    vector<int> A(Q), B(N, K - Q);
    for(int i = 0; i < Q; i++)
    {
        cin >> A.at(i);
        B.at(A.at(i) - 1)++;
    }
    for(int i = 0; i < N; i++)
    {
        if(B.at(i) > 0) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 1408
n, m = map(int, input().split())
conn = []

for _ in range(n):
    conn.append([False]*n)

visited = [False] * n

v = []

for _ in range(m):
    line = map(int, input().split())
    v.append([x-1 for x in line])

for start, end in v:
    conn[start][end] = conn[end][start] = True

def dfs(now, depth):
    if visited[now] : return 0
    if depth == n - 1: return 1

    visited[now] = True
    ret = 0

    for i in range(n):
        if conn[now][i]: ret += dfs(i, depth+1)

    visited[now] = False
    return ret

print(dfs(0, 0))

Measured memory_bytes: 3064
#include <stdio.h>

int main(void){
	int n,i,j,min=4000000,res,a[100];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	for(j=-100;j<=100;j++){
		res = 0;
		for(i=0;i<n;i++){
			res += (a[i] - j) * (a[i] - j);
		}
		if(res < min)min = res;
	}
	printf("%d\n",min);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(n); ++i)
#define repr(i, a, b) for (int i=a; i<(b); ++i)
#define reprev(i, n) for (int i=n-1; i>=0; --i)
#define reprrev(i, a, b) for (int i=b-1; i>=(a); --i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using lP = pair<ll, ll>;

int main() {
    cout << fixed << setprecision(10);
    
    int N, D, A; cin >> N >> D >> A;
    vector<P> xh(N+1);
    rep(i, N) {
        int x, h;
        cin >> x >> h;
        xh[i] = make_pair(x, h);
    }
    xh[N] = make_pair(int(1e9+5), 0);

    sort(xh.begin(), xh.end());

    ll ans = 0;
    ll tot = 0;
    D = D*2;
    queue<P> q;
    rep(i, N) {
        // 敵は ld <= Xi <= rdの必要がある
        int x = xh[i].first;
        ll h = xh[i].second;

        // 期限切れの攻撃を減らす
        while(q.size() && q.front().first < x) {
            tot -= q.front().second;
            q.pop();
        }

        // 攻撃をする
        h -= tot;

        if (h > 0) {
            // iのモンスターのHPを0以下にするのに必要な回数
            int na = (h + A-1) / A;
            ans += na;
            tot += na*A;
            q.emplace(x+D, na*A);
        }
    }

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

Measured memory_bytes: 2688
def lcs(x, y)
    c = Array.new(x.size + 1){[]}
    (x.size + 1).times { |i| c[i][0] = 0}
    (y.size + 1).times { |j| c[0][j] = 0}
    1.upto(x.size) do |i|
        1.upto(y.size) do |j|
            if x[i - 1] == y[j - 1] then
                c[i][j] = c[i - 1][j - 1] + 1
            else
                c[i][j] = [c[i - 1][j], c[i][j - 1]].max
            end
        end
    end
    # c.each { |e| p e }
    return c[x.size][y.size]
end

q = gets.chomp.to_i
q.times do
    x = gets.chomp.chars
    y = gets.chomp.chars
    puts lcs(x, y)
end



Measured memory_bytes: 69188
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<ll> vl;
typedef vector<vector<int, int> > vvi;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define in insert
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
int main(){
    int a, b;
    cin >> a >> b;
    int sum = 0;
    int cnt = 0;
    if(b==1){
        cout << 0;
        return 0;
    }
    while(sum<b){
        sum+=a;
        cnt++;
        if(sum>=b){
            break;
        }
        sum--;

    }
    cout << cnt;
}
    

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

al = [chr(ord('a') + i) for i in range(26)]

def dfs(idx, tmp):
    if idx == n:
        return [tmp]
    else:
        ret = []
        nexts = list(set(list(tmp)))
        nexts.sort()
        nexts.append(chr(ord(nexts[-1]) + 1))
        for x in nexts:
            ret += dfs(idx + 1, tmp + x)
        return ret

ans = dfs(1, 'a')
ans.sort()
for a in ans:
    print(a)


Measured memory_bytes: 62684
#include <bits/stdc++.h>
#define ll long long
int main() {
	ll n, k; std::cin >> n >> k;
	ll ans = 0;
	for (int b = k+1; b <= n; ++b) {
		ans += (n/b)*(b-k);
		// std::cout << b << " Delta: " << (n/b)*(b-k);
		if (b*(n/b) != n) {
			ll delta = 0;
			if (k == 0) delta = n-((n/b)*b+1)+1;
			else delta = n-((n/b)*b+k)+1;
			if (delta > 0) ans += delta;
		}
		// std::cout << b  << " " << ans << std::endl;
		// std::cout <<  " " << ans << std::endl;
	}
	std::cout << ans << std::endl;
	return 0;
}

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

#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, n, m) for(int (i) = (n); (i) < (m); ++(i))

constexpr int INF = 1e9;
// constexpr ll INF = 1LL<<61;
constexpr ll mod = 1e9+7;


int main(){
  int N;
  cin >> N;
  int S = N * (N-1) / 2;
  vector<pair<int, int>> ans;
  int diff = N % 2 ? N : N + 1;
  FOR(i, 1, N+1){
    FOR(j, i+1, N+1){
      if((S-i) - (S-diff) == j) continue;
      ans.push_back({i, j});
    }
  }
  cout << ans.size() << endl;
  REP(i, (int)ans.size()){
    cout << ans[i].first << " " << ans[i].second << endl;
  }

  return 0;
}

Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define y1 zzz
#define fi first
#define se second
#define PII pair<int,int>
#define PII2 pair<int,PII >
#define PII3 pair<PII,int >
#define PII4 pair<PII,PII >
#define all(x) (x).begin(),(x).end()
#define pb push_back
void solve()
{
    int ans=0,x;
    cin>>x;
    ans+=(x/500)*1000;
    x%=500;
    cout<<ans+(x/5)*5;
}
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    //freopen("STRWC.inp","r",stdin);
    //freopen("FORMMAU.out","w",stdout);
    //int t;cin>>t;while(t--)
    solve();
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#include<set>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define brep(index,num) for(int index=num-1;index>=0;index--)
#define brep1(index,num) for(int index=num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-9
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	int N;
	multiset<int> S;
	scan(N);
	ll twoNth=(1LL<<N);
	rep(i,twoNth){
		int s;
		scan(s);
		S.insert(-s);
	}
	/*for(auto itr=S.begin();itr!=S.end();itr++) printf("%d ",-(*itr));
	kaigyo;*/
	vint choosed;
	auto itr=S.lower_bound(-INF);
	choosed.push_back(*itr);
	S.erase(itr);
	rep(i,N){
		int chsize=choosed.size();
		/*printf("i:%d\n ch: ",i);
		rep(j,chsize) printf("%d ",-choosed[j]);
		printf("\n  S: ");
		for(auto itr=S.begin();itr!=S.end();itr++) printf("%d ",-(*itr));
		kaigyo;*/
		for(int j=0;j<chsize;j++){
			auto itr=S.upper_bound(choosed[j]);

			if(itr==S.end()){
				prin("No");
				return 0;
			}
			else{
				choosed.push_back(*itr);
				S.erase(itr);
			}
		}
		sort(ALL(choosed));
	}
	prin("Yes");
	return 0;
}


Measured memory_bytes: 13692
f = True
while True:
	for k in range(3):
		p = list(input())
		if p[0] == '0':
			f = False
			break
		a, b = 0, 0
		del p[0]
		for x in p:
			if x == 'A': a += 1
			else: b += 1
		if a > b: a += 1
		else: b += 1
		print(a, b)
	if not f: break


Measured memory_bytes: 5560
#include <iostream>
#include <algorithm>

using namespace std;

void solve()
{
	int x, y, s;
	while (cin >> x >> y >> s, x || y || s)
	{
		int maxv = -1;
		for (int i = 1; i < s; ++i)
		{
			for (int j = 1; j < s; ++j)
			{
				int cost = (int)(i * (100 + x) / 100.0) + (int)(j * (100 + x) / 100.0);
				if (cost > s)
				{
					break;
				}
				if (cost == s)
				{
					int newCost = (int)(i * (100 + y) / 100.0) + (int)(j * (100 + y) / 100.0);
					maxv = max(maxv, newCost);
				}
			}
		}
		cout << maxv << endl;
	}
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
 
#define dump(x)  cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
#define possible(n) cout << ((n) ? "possible" : "impossible"  ) << endl
 
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
 
#define FOREACH(x,a) for(auto& (x) : (a) )
 
#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j])
 
#define SCOUT(x) cout<<(x)<<" "
#define ENDL cout<<endl
 
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i]
#define VECCOUT(x) if(1){for(auto tt=x.begin();tt!=x.end();tt++){if(tt!=x.begin())cout<<" ";cout<<(*tt);}cout<<endl;}
 
#define ALL(obj) (obj).begin(),(obj).end()
 
#define EXIST(n,x) (find(ALL(n),x)!=n.end())
#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end())
#define EN(x) if(1){cout<<#x<<endl;return 0;}
#define COUT(x) cout<<(x)<<endl
void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)
 
template <class T = ll>
T IN(){T x;cin>>x;return (x);}
 
template <class Head>
void VT(Head head){}
template <class Head,class Seco,class... Tail>
void VT(Head&& head,Seco&& seco,Tail&&... tail){
    seco.resize(head);
    VT(head,move(tail)...);
}
void VT2(){}
template <class Head,class... Tail>
void VT2(Head&& head,Tail&&... tail){
    VECCIN(head);
    VT2(move(tail)...);
}
 
template <class Head>
void VT3(Head&& head){}
template <class Head,class Seco,class... Tail>
void VT3(Head&& head,Seco&& seco,Tail&&... tail){
    seco[head]=IN();
    VT3(head,move(tail)...);
}
 
#define VC1(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);VT2(__VA_ARGS__); //aaabbbccc
#define VC2(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);REP(i,n)VT3(i,__VA_ARGS__); //abcabcabc
 
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision; // cpp_int
 
#define P pair<ll,ll>
#define V vector<ll>
#define M map<ll,ll>
#define S set<ll>
 
#define pb(a) push_back(a)
#define mp make_pair

int main(){

    LCIN(a,b,c,k);
    //Cは無視していい
    ll val = a-b;
    if(k%2)val*=(-1);
    COUT(val);

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define mp make_pair
#define CHECK(x) if(!(x)) return false;
#define CHECKRET(x, y) if(!(x)) return (y);
#define SKIP(x) if((x)) continue;
typedef pair<int, int> pii;

const int MAXN = 100010;
pii sorted[MAXN];

int fucked[2];

int main() {
  int N;
  scanf("%d", &N);
  for (int i = 0; i < N; ++i) {
    sorted[i].second = i;
    scanf("%d", &sorted[i].first);
  }
  sort(sorted, sorted + N);
  for (int i = 0; i < N; ++i) {
    SKIP(sorted[i].second % 2 == i % 2);
    ++fucked[i % 2];
  }
  printf("%d\n", max(fucked[0], fucked[1]));
  return 0;
}


Measured memory_bytes: 1152
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF=1<<29;
const double EPS=1e-9;
  
const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};


int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  sort(A.begin(), A.end());
  A.erase(unique(A.begin(), A.end()), A.end());
  cout << A.size() << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int a,b,c,i,count=0;
    scanf("%d %d %d",&a,&b,&c);
    for(i=0;i+a<b+1;i++){
        if(c % (a+i) == 0){
            count = count + 1;
        }
    }
    printf("%d\n", count);
}


Measured memory_bytes: 2084
#include <stdio.h>
 
int main()
{
    int n, ctr = 0;
    scanf("%d", &n);
    int input[n];
    for(int i = 0; i < n; i++)
    {
    	scanf("%d", &input[i]);
	}
	for (int i = 0; i < n-2; i++) 
	{
	    for (int j = i+1; j < n-1; j++) 
		{
	      for (int k = j+1; k < n; k++) 
		  {
			if ((input[i] == input[j]) || (input[j] == input[k]) || (input [k] == input[i])) 
			{
	          continue;
	        }
	        if (input[i] + input[j] > input[k] && input[j] + input[k] > input[i] && input[k]+ input[i] > input[j]) 
			{
	          ctr++;
	        }
      	  }
}
    }
  	printf("%d\n", ctr);
    return 0;
}

Measured memory_bytes: 1720
#include<iostream>
#include<vector>
#include<string.h>

using namespace std;

struct log{
	int id,belong,correct,penalty;
};

int main(void){
	
	struct log team[1001];
	int n,idcount[1001];

	while(cin>>n,n){
		
		memset(team,0,sizeof(team));
		memset(idcount,0,sizeof(idcount));
		
		for(int i=1;i<=n;i++){
			cin>>team[i].id>>team[i].belong>>team[i].correct>>team[i].penalty;
		}
		
		for(int i=1;i<=n;i++){
			for(int j=n;j>=i+1;j--){
				if(team[j-1].correct<team[j].correct){
					struct log temp;
					temp=team[j];
					team[j]=team[j-1];
					team[j-1]=temp;
				}
			}
		}

		for(int i=1;i<=n;i++){
			for(int j=n;j>=i+1;j--){
				if(team[j-1].correct==team[j].correct && team[j-1].penalty>team[j].penalty){
					struct log temp;
					temp=team[j];
					team[j]=team[j-1];
					team[j-1]=temp;
				}
			}
		}
			
		for(int i=1;i<=n;i++){
			for(int j=n;j>=i+1;j--){
				if(team[j-1].correct==team[j].correct && team[j-1].penalty==team[j].penalty && team[j-1].id>team[j].id){
					struct log temp;
					temp=team[j];
					team[j]=team[j-1];
					team[j-1]=temp;
				}
			}
		}
	
		
		for(int i=1,sum=0;i<=n;i++){
			if(sum<10 && idcount[team[i].belong]<3){
				cout<<team[i].id<<endl;
				idcount[team[i].belong]++;
				sum++;
			}
			else if(sum<20 && idcount[team[i].belong]<2){
				cout<<team[i].id<<endl;
				idcount[team[i].belong]++;
				sum++;
			}
			else if(sum<26 && idcount[team[i].belong]==0){
				cout<<team[i].id<<endl;
				idcount[team[i].belong]++;
				sum++;
			}
		}
	}
}

Measured memory_bytes: 0
//#pragma GCC optimize("03", "unroll-loops")
//#pragma GCC target("avx2")

#include <bits/stdc++.h>

#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define FOR(i,n) for(i=0;i<n;i++)
#define FORn(i,j,n) for(i=j;i<n;i++)
#define pb push_back
#define unique_sort(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define vprint(v) for(auto t:v)cout<<t<<" "
#define endl "\n"

using namespace std;

typedef long long int lli;
typedef long int li;
typedef vector<lli> vli; 
typedef vector<int> vi; 
typedef vector<string> vs; 


const lli mod=1000000007;
const lli limit=1000000;


void fc(lli &x)
    {
        bool neg=false;
        register char c;
        x =0;
        c=getchar();
        if(c=='-')
        {
            neg = true;
            c=getchar();
        }
        for(;(c>47 && c<58);c=getchar())
            x = (x<<1) + (x<<3) +c -48;
        if(neg)
            x *=-1;
    }

int main() {

    fast()
    lli n,q,t;
    lli temp,temp1,temp2,temp3;
    lli i,j,k;
    lli a,b,c,d;
    cin>>b>>a>>d>>c;
    while(b>0 && d>0){
        d-=a;
        if(d<=0)break;
        b-=c;
    }
    if(b<=0)cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
 
}

Measured memory_bytes: 3668
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
static class Program{
	const int mod=1000000007;
	static void Main(){
		Sc sc=new Sc();
		int[] s=sc.Ia;
		string t=sc.S+"2";
		List<int> li=new List<int>();
		for(int i=0,j=1;i<s[0];i++,j++) {
			if(t[i]!=t[i+1]){
				li.Add(j*(t[i]=='1'?1:-1));
				j=0;
			}
		}
		int ans=0,q=0;
		for(int i=0,j=0,k=0;i<li.Count;i++) {
			if(li[i]<0){
				q+=li[i]*-1;
				k++;
				if(k>s[1]){
					q-=Math.Abs(li[j]);
					j++;
					if(li[j]<0){
						q+=li[j];
						j++;
					}
					k--;
				}
			}
			else{q+=li[i];}
			ans=Math.Max(ans,q);
		}
		Console.WriteLine(ans);
	}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public int[] Ia2{get{return Array.ConvertAll((Console.ReadLine()+" 0").Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()).Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
}

Measured memory_bytes: 12512
#include <iostream>

using namespace std;

int calcGcd(int x, int y)
{
    int r;

    if (x < y)
    {
        swap(x, y);
    }

    while(y > 0)
    {
        r = x % y;
        x = y;
        y = r;
    }

    return x;
}

int main( )
{
    int a, b;
    int gcd, lcm;
 
    while(cin >> a >>  b)
    {
        gcd = calcGcd(a, b);
        lcm = a / gcd * b;

        cout << gcd << " " << lcm << endl; 
    }

    return 0;
}

Measured memory_bytes: 2996
def is_contradict(T, H):
    for t in T:
        a = t[0]
        x = t[1]
        y = t[2]
        if int(H[a-1]) == 1 and int(H[x-1]) != y:
            return True
    return False

def main():
    N=int(input())
    T=[]
    for n in range(N):
        A=int(input())
        for a in range(A):
            x,y = map(int, input().split())
            T.append((n+1,x,y))
    
    ans = 0
    for i in range(2**N):
        s = format(i, "015b")
        s = s[15 - N:]
        if not is_contradict(T, s):
            c = s.count("1")
            if ans < c:
                ans = c
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
using System;

namespace ABC055_B
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            long power = 1;
            for(var i=1;i<=n;i++)
            {
                power *= i;
                power %= (long)(Math.Pow(10, 9) + 7);
            }
            
            Console.WriteLine(power);
        }
    }
}


Measured memory_bytes: 13140
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	Scanner sc;

	static final int INF=1<<28;
	static final double EPS=1e-9;

	class T{
		int n, ans;
		int rank;

		T(int n, int ans){
			this.n=n;
			this.ans=ans;
		}
	}

	void run(){
		sc=new Scanner(System.in);
		LinkedList<T> list=new LinkedList<T>();

		for(;;){
			String[] s=sc.nextLine().split(",");
			int n=Integer.parseInt(s[0]);
			int ans=Integer.parseInt(s[1]);
			if(n==0&&ans==0)
				break;
			list.add(new T(n, ans));
		}

		// ³ðÉ\[g
		T[] ts=list.toArray(new T[0]);
		sort(ts, new Comparator<T>(){
			@Override
			public int compare(T t1, T t2){
				return t2.ans-t1.ans;
			}
		});

		// ÊvZ
		HashMap<Integer, Integer> map=new HashMap<Integer, Integer>();
		ts[0].rank=1;
		for(int i=1; i<ts.length; i++){
			ts[i].rank=ts[i-1].rank;
			if(ts[i].ans!=ts[i-1].ans)
				ts[i].rank+=1;
		}

		for(T t : ts)
			map.put(t.n, t.rank);
		// println(t.n+":"+t.ans+":"+t.rank);

		// ®Ô
		for(; sc.hasNext();){
			int n=sc.nextInt();
			println(map.get(n)+"");
		}

		sc.close();
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

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

Measured memory_bytes: 12000
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <utility>
#include <climits>
#include <iomanip>
using namespace std;
#define MAXSIZE 100005
#define MAXL 100
#define MOD 998244353
typedef long long int lli;

int main(){
    int a[3];
    int sum = 0;
    for(int i = 0; i < 3; ++i){
        cin >> a[i];
        sum += a[i];
    }

    if(sum >= 22) puts("bust");
    else puts("win");
    return 0;
}

Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int k;
	cin>>k;
	string s;
	cin>>s;
	if(s.length()<=k)
	cout<<s;
	else
	{
		for(int i=0;i<k;i++)
		cout<<s[i];
		cout<<"...";
		
	}
}

Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <bitset>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>

using namespace std;
typedef long long ll;

int main(){

  int N, Q;
  cin >> N >> Q;
  
  string s;
  cin >> s;

  vector<int> v(N,0);
  int cur=0;
  for(int i=1; i<N; i++){
    if(s[i-1]=='A' && s[i]=='C') cur++;
    v[i]=cur;
    //cout << "cur" << cur << endl;
  }

  for(int i=0; i<Q; i++){
    int l,r;
    cin >> l >> r;
    cout << v[r-1]-v[l-1] << endl;
  }
  
  return 0;

}


Measured memory_bytes: 1408
"""
Writer: SPD_9X2
https://atcoder.jp/contests/abc129/tasks/abc129_f
=====解説をみた=====

なるほど行列式ね…
繰り返し同じ写像を繰り返す場合、行列式による繰り返し2乗法
を考えるべきなのかもしれんね…

"""

#行列A,Bの積(不可能だとエラー)
def matrix_mul(A,B):

    ans = [ [0] * len(B[0]) for i in range(len(A)) ]

    for ai in range(len(A)):

        for bj in range(len(B[0])):

            now = 0
            for same in range(len(A[0])):
                now += A[ai][same] * B[same][bj]
            ans[ai][bj] = now % mod

    return ans

#行列Aのx乗(当然正方行列じゃないとだめ)
def matrix_pow(A,x):

    B = [[A[i][j] for j in range(len(A[0]))] for i in range(len(A))]
    ans = [[0] * len(A[0]) for i in range(len(A))]
    for i in range(len(A)):
        ans[i][i] = 1

    while x > 0:
        if x % 2 == 1:
            ans = matrix_mul(ans,B)
        B = matrix_mul(B,B)

        x//=2
    return ans

import sys
L,A,C,mod = map(int,input().split())

now = [[0,A,1]]
LA = len(str(A))
LB = len(str(A+C*(L-1)))
B = A+C*(L-1)

if LA==LB:
    np = [[pow(10,LA,mod),0,0],[1,1,0],[0,C,1]]
    k = (B-A)//C+1
    now = matrix_mul(now , matrix_pow(np,k))
    print (now[0][0] % mod)
    sys.exit()

for i in range(LA,LB+1):

    np = [[pow(10,i,mod),0,0],[1,1,0],[0,C,1]]
    #print (now,np)

    if i == LA:
        k = (10**i-1-A)//C+1
        now = matrix_mul(now , matrix_pow(np,k))
    elif i == LB:
        k = (B-A)//C-(10**(i-1)-1-A)//C
        now = matrix_mul(now , matrix_pow(np,k))
    else:
        k = (10**i-1-A)//C - (10**(i-1)-1-A)//C
        now = matrix_mul(now , matrix_pow(np,k))

    #print (i,k,now)
print (now[0][0] % mod)


Measured memory_bytes: 39664
from collections import deque
H,W=map(int, input().split())
ch,cw=map(int, input().split())
dh,dw=map(int, input().split())

L=[]
for h in range(H):
    s=list(input())
    L.append(s)

def isOK(h,w):
    if 0<=h<H and 0<=w<W:
        if L[h][w]==".":
            return True
    return False

que=deque([(ch-1,cw-1,0)])
DX=[0,1,0,-1]
DY=[1,0,-1,0]

cost=[[-1]*W for _ in range(H)]
cost[ch-1][cw-1]=0
count=0
while que:
    lis=[]
    while que:
        
        t=que.popleft()
        x,y,now=t
        lis.append((x,y))
        for i in range(4):
            dx=DX[i]
            dy=DY[i]
            nx=x+dx
            ny=y+dy
            if isOK(nx,ny):
                if cost[nx][ny]==-1:
                    cost[nx][ny]=now
                    que.append((nx,ny,now))
                    lis.append((nx,ny))
    for t in lis:
        x,y=t
        for dx in range(-2,3):
            for dy in range(-2,3):
                if abs(dx)+abs(dy)<=1:
                    continue
                nx=x+dx
                ny=y+dy
                if isOK(nx,ny):
                    if cost[nx][ny]==-1 or cost[nx][ny]>count+1:
                        cost[nx][ny]=count+1
                        que.append((nx,ny,count+1))
    count+=1


print(cost[dh-1][dw-1])

Measured memory_bytes: 139464
import java.io.BufferedReader;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;

public class Main {
	public static void main(final String[] args){
    
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        
        if(n == 111){
            System.out.println(999);
        }else if(n == 119){
            System.out.println(991);
        }else if(n == 199){
            System.out.println(911);
        }else if(n == 191){
            System.out.println(919);
        }else if(n == 911){
            System.out.println(199);
        }else if(n == 919){
            System.out.println(191);
        }else if(n == 991){
            System.out.println(119);
        }else{
            System.out.println(111);
        }
        






    }
}

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

using pii = pair<int,int>;
using ll = long long;
#define rep(i, j) for(int i=0; i < (int)(j); i++)
#define repeat(i, j, k) for(int i = (j); i < (int)(k); i++)
#define all(v) v.begin(),v.end()
#define debug(x) cerr << #x << " : " << x << endl

template<class T> bool set_min(T &a, const T &b) { return a > b  ? a = b, true : false; }
template<class T> bool set_max(T &a, const T &b) { return a < b  ? a = b, true : false; }
// vector
template<class T> istream& operator >> (istream &is , vector<T> &v) { for(T &a : v) is >> a; return is; }
template<class T> ostream& operator << (ostream &os , const vector<T> &v) { for(const T &t : v) os << "\t" << t; return os << endl; }
// pair
template<class T, class U> ostream& operator << (ostream &os , const pair<T, U> &v) { return os << "<" << v.first << ", " << v.second << ">"; }

const int INF = 1 << 30;
const ll INFL = 1LL << 60;


class Solver {
  public:
    bool solve() {
        int N; cin >> N;
        vector<ll> A(N); cin >> A;
        vector<ll> sum(N + 1);
        map<ll, ll> cnt;
        cnt[0] = 1;
        rep(i, N) {
            sum[i + 1] = sum[i] + A[i];
            cnt[sum[i + 1]]++;
        }
        ll ans = 0;
        rep(i, N) {
            if(cnt.count(sum[i]) and cnt[sum[i]] > 0) {
                cnt[sum[i]]--;
                ans += cnt[sum[i]];
            }
        }
        cout << ans << endl;
        return 0;
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    Solver s;
    s.solve();
    return 0;
}


Measured memory_bytes: 15872
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using static System.Console;
using static System.Convert;
using static System.Math;
using static Extentions;

class IO
{
    int idx;
    string[] input = In.ReadToEnd().Split(new[] { " ", "\n", "\r" },
        StringSplitOptions.RemoveEmptyEntries);

    T Get<T>(Func<string, T> parser) => parser(input[idx++]);

    public string S => Get(s => s);
    public char C => Get(char.Parse);
    public int I => Get(int.Parse);
    public long L => Get(long.Parse);
    public double F => Get(double.Parse);
    public decimal D => Get(decimal.Parse);
    public BigInteger B => Get(BigInteger.Parse);

    T[] Gets<T>(int n, Func<string, T> parser)
        => input.Skip((idx += n) - n).Take(n).Select(parser).ToArray();

    public string[] Ss(int n) => Gets(n, s => s);
    public char[] Cs(int n) => Gets(n, char.Parse);
    public int[] Is(int n) => Gets(n, int.Parse);
    public long[] Ls(int n) => Gets(n, long.Parse);
    public double[] Fs(int n) => Gets(n, double.Parse);
    public decimal[] Ds(int n) => Gets(n, decimal.Parse);
    public BigInteger[] Bs(int n) => Gets(n, BigInteger.Parse);

    public void Write<T>(params T[] xs) => WriteLine(string.Join(" ", xs));
    public void Write(params object[] xs) => WriteLine(string.Join(" ", xs));
}

#region Library

static class Extentions
{
}

#endregion

static class Program
{
    public static void Main()
    {
        var sw = new StreamWriter(OpenStandardOutput()) { NewLine = "\n" };
#if DEBUG
        sw.AutoFlush = true;
#else
        sw.AutoFlush = false;
#endif
        SetOut(sw);
        Solve(new IO());
        Out.Flush();
    }

    static void Solve(IO io)
    {
        var q = io.L;
        var h = io.L;
        var s = io.L;
        var d = io.L;
        var n = io.L;

        s = Min(q * 4, Min(h * 2, s));
        d = Min(s * 2, d);

        var ans = (n / 2) * d + (n % 2) * s;
        io.Write(ans);
    }
}

Measured memory_bytes: 13268
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    for(;;){
        int n, m;
        if(!(cin >> n >> m))
            return 0;

        vector<int> cost(n);
        vector<vector<int> > p(3, vector<int>(n));
        for(int i=0; i<n; ++i){
            string s;
            cin.ignore();
            getline(cin, s);
            cin >> cost[i];
            for(int j=0; j<3; ++j){
                cin >> p[j][i];
            }
        }

        int ret = 0;
        for(int i=0; i<3; ++i){
            vector<int> maxP(m+1, 0);
            for(int j=1; j<=m; ++j){
                maxP[j] = maxP[j-1];
                for(int k=0; k<n; ++k){
                    if(cost[k] > j)
                        continue;
                    maxP[j] = max(maxP[j], maxP[j-cost[k]] + p[i][k]);
                }
            }
            ret = max(ret, maxP[m]);
        }

        cout << ret << endl;
    }
}

Measured memory_bytes: 940
#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
const long long mod = 1e9+7;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
const int ddx[4] = {1,1,-1, -1};
const int ddy[4] = {1,-1,-1,1};
//////////////////////////////////

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

    for(int i=0; i<n; i++) {
        if(q - x[i] < k) cout << "Yes" << endl;
        else cout << "No" << endl;
    }

    return 0;
}

// EOF


Measured memory_bytes: 1024
#include <iostream>
#define llint long long

using namespace std;

llint S;
const llint C = 1000000000;

int main(void)
{
	cin >> S;
	
	llint x1 = (S+C-1)/C, y2 = C;
	llint x2 = 1, y1 = x1*C - S;
	
	cout << 0 << " " << 0 << " " << x1 << " " << y1 << " " << x2 << " " << y2 << endl;
	return 0;
	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#ifdef DEBUG
#include "_debug.cpp"
#include "callable.hpp/callable.hpp"
#endif
#define endl '\n'
using namespace std;
using ll = long long;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    char a, b;
    cin >> a >> b;
    if(a < b) cout << "<" << endl;
    else if(a > b) cout << ">" << endl;
    else cout << "=" << endl;
    return 0;
}


Measured memory_bytes: 256
h,w = map(int, input().split())
s = []
s.append((". " * (w + 2)).split())
for i in range(h):
    b = "." + input() + "."
    s.append(list(b))
s.append((". " * (w + 2)).split())
for i in range(1,h + 1):
    for f in range(1, w + 1):
        if s[i][f] == "#":
            for x in range(-1, 2, 1):
                for y in range(-1, 2, 1):
                    if s[i+x][f+y] == ".":
                        s[i+x][f+y] = 1
                    elif isinstance(s[i+x][f+y], int):
                        s[i+x][f+y] += 1
for i in range(1, h + 1):
    ans = "".join(map(str, s[i][1:w+1])).replace(".","0")
    print(ans)

Measured memory_bytes: 3064
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>

int main(void)
{
	int n, m, sum = 0, ret = 0;
	int arr[100];
	scanf("%d %d", &n, &m);

	for (int i = 0; i < n; i++)
	{
		scanf("%d", &arr[i]);
		sum += arr[i];
	}

	for (int i = 0; i < n; i++)
	{
		if (arr[i] >= (double)sum / (4 * m))
			ret++;
	}

	if (ret >= m)
		printf("Yes");
	else
		printf("No");

	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>

using namespace std;
typedef long long ll;

struct mint{
    static const long long MOD = 1000000007;

    long long v;

    mint() : v(0) {}
    mint(long long x){
        x = x % MOD;
        if(x < 0){ x += MOD; }
        v = x;
    }
    mint& operator+=(mint a){
        v += a.v;
        if(v >= MOD){ v -= MOD; }
        return *this;
    }
    mint& operator*=(mint a){
        v *= a.v;
        v %= MOD;
        return *this;
    }
    mint& operator-=(mint a){
        v -= a.v;
        if(v < 0){ v += MOD; }
        return *this;
    }
    mint& operator/=(mint a){
        return (*this) *= a.inv();
    }

    mint operator*(mint a) const{
        return mint(v) *= a;
    }

    mint operator+(mint a) const {
        return mint(v) += a;
    }

    mint operator-(mint a) const {
        return mint(v) -= a;
    }

    mint operator/(mint a) const {
        return mint(v) /= a;
    }

    mint pow(long long k) const {
        mint res(1),tmp(v);
        while(k){
            if(k&1) res *= tmp;
            tmp *= tmp;
            k >>= 1;
        }
        return res;
    }
    mint inv(){return pow(MOD - 2); }

    static mint comb(long long n, int k){
        mint res(1);
        for(int i = 0; i < k; ++i){
            res *= mint(n - i);
            res /= mint(i + 1);
        }
        return res;
    }

    static mint factorial(long long n){
        mint res(1);
        for(int i = n; i > 1; --i){
            res *= mint(i);
        }
        return res;
    }

    bool operator<(const mint &a) const {
        return v < a.v;
    };
};

mint operator*(long long l, mint r){ return r * l; }

int main(){
    ll h, w;
    cin >> h >> w;
    vector<string> map(h);
    for(int i = 0; i < h; ++i){
        cin >> map.at(i);
    }

    vector<vector<mint>> num(h, vector<mint>(w, 0));
    num.at(0).at(0) = 1;
    for(int i = 0; i < h; ++i){
        for(int j = 0; j < w; ++j){
            if(map.at(i).at(j) == '#'){ continue; }
            if(i > 0 && map.at(i - 1).at(j) == '.'){
                num.at(i).at(j) += num.at(i - 1).at(j);
            }
            if(j > 0 && map.at(i).at(j - 1) == '.'){
                num.at(i).at(j) += num.at(i).at(j - 1);
            }
        }
    }

    cout << num.at(h - 1).at(w - 1).v << endl;
    return 0;
}

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

using namespace std;

#define FOR(i,s,e) for((i)=(s);(i)<(int)(e);(i)++)
#define REP(i,e) FOR(i,0,e)

#define all(o) (o).begin(), (o).end()
#define psb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))

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

const double EPS = 1e-10;

const int INF = 1000 * 1000 * 10;
const int N = 100;
int d[N][N];
int n;

int main() {
  int i, j, k;
  int u, v, c; 

  scanf("%d ", &n);
  for (i=0; i<n; i++) 
    for (j=0; j<n; j++) {
      if (i==j)
        d[i][j] = 0;
      else
        d[i][j] = INF;
    }

  for (i=0; i<n; i++) {
    scanf("%d%d ", &u, &k);
    for (j=0; j<k; j++) {
      scanf("%d%d ", &v, &c);
      d[u][v] = c;
    }
  }

  //Warshall-Floyd
  for (k=0; k<n; k++)
    for (i=0; i<n; i++)
      for (j=0; j<n; j++)
        d[i][j] = min(d[i][j], d[i][k] + d[k][j]);

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

	return 0;
}

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

typedef long long ll;
const int N = 2000006;
const ll MOD = 1000000007;

ll a[N];
int bts[66];
int stb[66];

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	
	ll ans = 0;
	
	for(int i=n;i>0;i--){
		for(int j=0;j<61;j++){
			ll t = (1ll<<j);
			t %= MOD;
			if((a[i])&(1ll<<j)){
				ll b = stb[j];
				bts[j]++;
				ans += t*b;
				ans %= MOD;
			}else{
				ll b = bts[j];
				stb[j]++;
				ans += t*b;
				ans %= MOD;
			}
		}
	}
	
	cout<<ans;
	
	return 0;
}


Measured memory_bytes: 5936
s=input()
t=input()
l_s=len(s)
l_t=len(t)

s=sorted(s)
t=sorted(t, reverse=True)

cnt=0

if l_s<=l_t:
    for i in range(l_s):
        if ord(s[i])<ord(t[i]):
            print("Yes")
            exit()
        elif ord(s[i])>ord(t[i]):
            print("No")
            exit()
        else:
            cnt+=1

    if cnt==l_s==l_t:
        print("No")
    else:
        print("Yes")

else:
    for i in range(l_t):
        if ord(s[i])<ord(t[i]):
            print("Yes")
            exit()

        elif ord(s[i])>ord(t[i]):
            print("No")
            exit()

    print("No")

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

int main() {
  int H, W, N, bl = 0, cn = 0;
  cin >> H >> W >> N;
  
  if (H > W) {
    while(true) {
      bl += H;
      cn++;
      
      if (bl >= N)
        break;
    }
  }
    
  else {
    while(true) {
      bl += W;
      cn++;
      
      if (bl >= N)
         break;
    }
  }
    
  cout << cn << endl;
}
    
    

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string n;cin >> n;
	cout << "ABC"+n << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#include <fstream>
#define debug(x) cout << #x << " = " << x << endl
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,n) for(int i = (n); i > -1; i--)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const double EPS = 1e-9;


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

  int n;
  cin>>n;
  int c[n-1],s[n-1],f[n-1];
  rep(i,n-1) cin>>c[i]>>s[i]>>f[i];
  rep(i,n-1) {
    int t = 0;
    FOR(j, i, n-1) {
      if(t <= s[j]) {
        t = s[j] + c[j];
      } else if(t % f[j] == 0) {
        t = t + c[j];
      } else {
        t = t + f[j] - (t % f[j]) + c[j];
      }
    }
    cout << t << endl;
  }
  cout << 0 << endl;

  return 0;

}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    println(if (n % sumK(n) == 0) "Yes" else "No")
}

fun sumK(num: Int): Int {
    val str = num.toString()
    var sum = 0
    str.forEach { sum += it.toString().toInt() }
    return sum
}



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

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

    int n;
    cin >> n;
    map<int, int> mp;

    int nn = n;
    for(int i = 2; i <= (int)sqrt(n); i++){
        while(nn % i == 0){
            mp[i]++;
            nn /= i;
        }
    }
    if(nn != 1){
        mp[nn] = 1;
    }

    cout << n << ':';
    bool f = true;
    for(auto x: mp){
        for(int i = 0; i < x.second; i++){
            cout << ' ' << x.first;
        }
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 3232
#define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cstdio>
#include <complex>
#include <numeric>
#include <string.h>
#include <random>
#include <cmath>
#define rep(i,n) for (int i = 0; i < (int)n; i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<pi, pi> pp;
typedef pair<ll, ll> pl;
double PI = 3.141592653589793238462643383279;
const double EPS = 1e-9;
const ll MOD = 1000000007;
//const ll MOD = 998244353
const int inf = 1 << 30;
const ll linf = 1LL << 60;

int N, M, T;
int x[100000], y[100000];
ll b[50000];
int c[50000];
int c2[50000];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> M >> T;
    rep(i,M) cin >> x[i] >> y[i];
    rep(i,M) { x[i]--; y[i]--; }
    if (T == 1) {
        string ans;
        rep(i,M) ans.push_back('^');
        for (int i = 0; i < N; i += 64) {
            memset(b, 0, sizeof(b));
            for (int j = i; j < min(N,i+64); j++) {
                b[j] = (1LL<<(j-i));
            }
            for (int j = M-1; j >= 0; j--) {
                b[x[j]] |= b[y[j]];
                b[y[j]] |= b[x[j]];
            }
            for (int j = 1; j < N; j++) b[0] &= b[j];
            for (int j = 0; j < 64; j++) {
                if (!(b[0]&(1LL<<j))) continue;
                memset(b, 0, sizeof(b));
                b[j+i] = 1;
                for (int j = M-1; j >= 0; j--) {
                    if (b[x[j]] && !b[y[j]]) {
                        if (x[j] > y[j]) ans[j] = 'v';
                    }
                    if (b[y[j]] && !b[x[j]]) {
                        if (y[j] > x[j]) ans[j] = 'v';
                    }
                    b[x[j]] |= b[y[j]];
                    b[y[j]] |= b[x[j]];
                }
                cout << ans << endl;
                return 0;
            }
        }
        cout << -1 << endl;
    } else {
        if (N == 2) {
            cout << -1 << endl;
            return 0;
        }
        rep(i,N) c[i] = i;
        rep(i,N) c2[i] = 1;
        string ans;
        rep(i,M) ans.push_back('^');
        for (int i = M-1; i >= 0; i--) {
            if (c2[c[x[i]]] > 1) {
                c2[c[x[i]]]--;
                c2[c[y[i]]]++;
                c[x[i]] = c[y[i]];
                if (x[i] < y[i]) ans[i] = 'v';
            } else if (c2[c[y[i]]] > 0) {
                c2[c[x[i]]]++;
                c2[c[y[i]]]--;
                c[y[i]] = c[x[i]];
                if (x[i] > y[i]) ans[i] = 'v';
            } else if (c2[c[x[i]]] > 0) {
                c2[c[x[i]]]--;
                c2[c[y[i]]]++;
                c[x[i]] = c[y[i]];
                if (x[i] < y[i]) ans[i] = 'v';
            }
            /*
            rep(j,N) cerr << c2[j] << " ";
            cerr << endl;
            rep(j,N) cerr << c[j] << " ";
            cerr << endl;
            */
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 1792
N = int(input())
P1 = tuple(map(int, input().split()))
P2 = tuple(map(int, input().split()))

import itertools
a = 0
b = 0
for perm in itertools.permutations([i+1 for i in range(N)]):
    if perm <= P1:
        a += 1
    if perm <= P2:
        b += 1
print(abs(b - a))

Measured memory_bytes: 39408
import sys
sys.setrecursionlimit(10000000)
import numpy as np
from heapq import heapify, heappop, heappush
import copy
from math import gcd, ceil
from collections import deque
# queueとして使う場合 push, popleftを使う
from bisect import bisect_left, bisect_right
# bisect_left: 配列の順序関係が崩れない条件で挿入することができる一番左の点
# bisect_right: 配列の順序関係が崩れない条件で挿入することができる一番右の点
# A = [1, 1, 1, 2, 2, 2, 4]
# print(bisect_left(A, 2))  # 3
# print(bisect_right(A, 2))  # 6
# print(bisect_left(A, 3))  # 6
# print(bisect_right(A, 3))  # 6


def main():
    N = int(input())
    Bs = []
    As = []
    for i in range(N):
        a, b = map(int, input().split())
        As.append(a)
        Bs.append(b)
    min_med = np.median(As)
    max_med = np.median(Bs)
    if N % 2 == 0:
        print(int(2 * (max_med - min_med) + 1))
    else:
        print(int((max_med - min_med) + 1))
    


if __name__ == '__main__':
    main()


Measured memory_bytes: 45844
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    int a = sc.nextInt();
    int b = sc.nextInt();
    int ans = a * b;
    
    if(ans % 2 == 0){
      System.out.println("Even");
    }else{
      System.out.println("Odd");
    }
  }
}

Measured memory_bytes: 35764