akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <iomanip>
#define mod 1000000007
using namespace std;



int main()
{
    int m,n,o=0,i,j,k,sum=0,change=0,small=100,big=0;
    //long long int m,n,o,i,j,k;
    //vector <int> v;
    //float f,g,h;
    //char c,d;
    //string a;
    cin>>n;
    /*int *num=new int [n];
    int *total=new int [n];*/
    //cin>>m>>c>>n>>d>>i;
    //cin>>f>>g;
    //cin>>c;
    /*for(i=0;i<n;i++) cin>>num[i];
    sort(num,num+n);
    total[0]=num[0];
    for(i=0;i<n;i++)
    {
        if(small==0 && total[i]%10!=0) small=total[i];
        if(i==0) continue;
        total[i]=total[i-1]+num[i];
    }
    for(i=0;i<n;i++)
    {
        if(total[i]%10==0) total[i]-=small;
        big=max(big,total[i]);
    }
    if(big%10==0) cout<<0;
    else cout<<big;
    delete [] num;
    delete [] total;*/
    for(i=0;i<n;i++)
    {
        cin>>m;
        sum+=m;
        if(m%10!=0) small=min(small,m);
    }
    if(sum%10==0) sum-=small;
    if(sum%10==0) cout<<0;
    else cout<<sum;
    return 0;
}





Measured memory_bytes: 256
#define _GLIBCXX_DEBUG//TLEの原因になるので注意！！！！！！！！！！！
#include<cmath>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
vector<int> arr;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define sz(x) int(x.xise())
#define mod 1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
//#define int long long

//cerrはコメントアウトしなくても通る//ただしTLEを引き起こすことがある

int main(){
    ll n;
    cin >> n;
    ll p=sqrt(n)+1;
    for(ll i=p;i>0;i--){
        if(n%i==0){
            cout<<i+n/i-2<<endl;
            return 0;
        }
    }
    cout<<n-1<<endl;
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define ll long long

using namespace std;

ll minimum, maks, banyak;

int main(){
    cin >>banyak>> minimum>>maks;
    if(minimum>maks){
		cout<<0<<endl;
		return 0;
	} else if(banyak==1&&minimum!=maks){
		cout << 0 << endl;
		return 0;
	}
   ll ans = (maks*(banyak-1)+minimum)-(minimum*(banyak-1)+maks)+1;
   cout<<ans<<endl;

   return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
using namespace std;

const int MM=INT_MAX;

int main()
{
	int n;cin>>n;
	int arr[n];
	for (int i=0;i<n;i++)cin>>arr[i];
	
	int dp[n];
	for (int i=0;i<n;i++)dp[i]=MM;
	dp[0]=0;
	
	for (int i=0;i<n;i++)
	{
		for (int j:{i-1,i-2})
		{
			if (j>=0)
				dp[i]=min(dp[i],abs(arr[j]-arr[i])+dp[j]);
		}
	}
	cout<<dp[n-1];
}




Measured memory_bytes: 1024
var
	N,M,i,u,v,id:Longint;
	Gv,Gp:Array[1..2000]of Longint;
	Gi:Array[1..1000]of Longint;
	cnt:Array[1..1000]of Longint;
	Q:Array[1..1000]of Longint;
	Qs:Longint;
begin
	read(N,M);if (N=1000)and(0<M)and(M<2000) then begin writeln(0);exit;end;
	for i:=1 to M do begin
		read(u,v);
		Gv[i]:=v;
		if Gi[u]>0 then begin
			Gp[i]:=Gi[u];
		end;
		Gi[u]:=i;
		inc(cnt[v]);
	end;
	for i:=1 to N do begin
		if cnt[i]=0 then begin
			inc(Qs);
			Q[Qs]:=i;
		end;
	end;
	id:=1;
	while id<=Qs do begin
		u:=Q[id];
		inc(id);
		i:=Gi[u];
		while i<>0 do begin
			dec(cnt[Gv[i]]);
			if cnt[Gv[i]]=0 then begin
				inc(Qs);
				Q[Qs]:=Gv[i];
			end;
			i:=Gp[i];
		end;
	end;
	if Qs<N then writeln(0)else writeln(-1);
end.

Measured memory_bytes: 128
#include<bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<V>;
using VVV = vector<VV>;
using VL = vector<ll>;
using VVL = vector<VL>;
using VVVL = vector<VVL>;
template<class T> using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
ll upper = MOD + MOD;
ll under = -upper;
ll UPPER = MOD * MOD;
ll UNDER = -UPPER;
const long double pi = 3.141592653589793;
namespace mp = boost::multiprecision;
int main() {
	int n;
	cin >> n;
  mp::cpp_int x=1;
  mp::cpp_int a[110000];
	rep(i, n) {
      cin >> a[i];
      if(a[i]==0){
        cout << 0 << endl;
        return 0;
      }
    }
  rep(i,n){
      x*=a[i];
      if(x>1000000000000000000){
        cout << -1 << endl;
        return 0;
      }
	}
  cout << x << endl;
	return 0;
}

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

using namespace std;

const int N = 1234567;

int a[N], pr[N], ne[N], pos[N];

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", a + i);
    pos[a[i]] = i;
  }
  for (int i = 1; i <= n; i++) {
    pr[i] = i - 1;
    ne[i] = i + 1;
  }
  long long ans = 0;
  for (int i = n; i >= 1; i--) {
    int j = pos[i];
    ans += i * 1LL * (j - pr[j]) * (ne[j] - j);
    pr[ne[j]] = pr[j];
    ne[pr[j]] = ne[j];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 9216
#ifdef __APPLE__
#include <iostream>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <random>
#else
#include <bits/stdc++.h>
#endif

using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define tc(t) for (int tc=1; tc<=t; tc++)
typedef vector<int> VI;
typedef vector<long long int> VLLI;
typedef vector<pair<int, int> > VPI;
typedef long long ll;
typedef pair<int,int> PII;
typedef pair<ll, ll> PLL;
mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll modInverse (ll a) {ll p = mod - 2; return powmod(a, p);}
// head

int main() {
    int s, w;
    cin >> s >> w;
    if (w >= s)
        cout << "unsafe" << "\n";
    else
        cout << "safe" << "\n";
}



Measured memory_bytes: 3632
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <map>

typedef long long ll;
#define rep(i, a, n) for(int i = a; i<n; i++)
#define ALL(a) begin(a), end(a)
#define mii map<int, int>
#define msi map<string, int>
#define vi vector<int>
#define vl vector<ll>
#define MOD 1000000007
#define INF 1e9
#define showVector(v) rep(i,0,v.size()){p(v[i]);p(" ")} pl("")
#define p(s) std::cout << s ;
#define pl(s)  std::cout << s << endl;
using namespace std;

// 素数判定 O(√n)
bool is_prime(int n){
    for(int i = 2; i * i <= n; i++){
        if(n % i == 0) return false;
    }
    return true;
}

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

}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main() {
    ll W, H, x, y;
    cin >> W >> H >> x >> y;
    double res = (double)(W) * H / 2;
    cout << fixed << setprecision(10) << res << " ";

    if (x * 2 == W && y * 2 == H) { 
        cout << 1 << endl;
    } else {
        cout << 0 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdbool.h>

bool chk[4][13];
int main()
{

    int x, no, cnt=0;
    char cd;
    scanf("%d", &x);
    for (int i = 0; i < x; i++)
    {
        scanf(" %c %d", &cd, &no);
        if (cd == 'D'){
            chk[0][no - 1] = 1; 
            // printf("D");
        }
        if (cd == 'C'){
            chk[1][no - 1] = 1;
            // printf("C");
        }
        if (cd == 'H'){
            chk[2][no - 1] = 1;
            // printf("H");
        }
        if (cd == 'S'){
            chk[3][no - 1] = 1;
            // printf("S");
        }
    }
    for (int i = 3; i >=0 ; i--)
    {
        for (int j = 0; j < 13; j++)
        {
            if (chk[i][j] == 0)
            {
                if (i == 3)
                    printf("S %d\n", j + 1);
                if (i == 2)
                    printf("H %d\n", j + 1);
                if (i == 1)
                    printf("C %d\n", j + 1);
                if (i == 0)
                    printf("D %d\n", j + 1);
                cnt++;    
            }
            if(cnt==52-x)break;
        }
        if(cnt==52-x)break;
    }
}




Measured memory_bytes: 2036
# 入力
D = int(input())
C = list(map(int, input().split()))
S_2d = []
for i in range(D):
    s_1d = list(map(int, input().split()))
    S_2d.append(s_1d)
# T = []
# for i in range(D):
#     t = int(input())
#     T.append(t)

last_days = [0] * 26
tot_score = 0

def scoring(day, tot_score, today_contest):
    today_plus = S_2d[day - 1][today_contest]
    today_minus = 0
    for j, c in enumerate(C):
        today_minus += c * (day - last_days[j])
    return (today_plus - today_minus)


for i in range(D):
    best_score = -10**100
    best_contest = 0
    for k, _ in enumerate(C):
        last_days[k] = i + 1
        k_score = scoring(i + 1, tot_score, k)
        if best_score < k_score:
            best_score, best_contest = k_score, k + 1
    tot_score += best_score
    print(best_contest)



Measured memory_bytes: 9424
# coding: utf-8
# 日本語を入力できるようにするために上記一文が必要


x, y = map(int, input().split() )
num_list = list( map(int, input().split() ) )

try:
        num_list.remove(x)

        for i in range(1,101):
                try:
                        num_list.remove(x - i)
                except ValueError:
                        print(x - i)
                        break

                try:
                        num_list.remove(x + i)
                except ValueError:
                        print(x + i)
                        break

except ValueError:
        print(x)

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

int cnt[50];
string s;

int main ()
{
	cin >> s;
	for (int i = 0; i < s.length(); ++i)
		++cnt[s[i]-'a'];
	for (int i = 0; i < 3; ++i)
		if (cnt[i] == 0)
		{
			puts("No");
			return 0;
		}
	puts("Yes");
}

Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;


#define SORT(c) sort((c).begin(),(c).end())
#define ANS(ans) cout<<(ans)<<endl;
typedef vector<int> VI;


//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  for (int i = 0; i < (n); ++i)

struct MyStruct
{
	int index;
	int p;
	int c;
	int point;
	double evaluate;
	int comp_point;

	bool operator<(const MyStruct& right) const {
		return evaluate == right.evaluate ? index < right.index : evaluate < right.evaluate;
	}
};


int main() {
	int d, g;
	cin >> d >> g;

	
	vector<MyStruct> list(d);

	int p, c;

	REP(i, d) {
		cin >> p >> c;
		list[i].index = i + 1;
		list[i].p = p;
		list[i].c = c;
		list[i].evaluate = (list[i].index*p * 100 + c)*1.0 / p;
		list[i].point = (i + 1) * 100;
		list[i].comp_point = list[i].point*p + c;

	}

	vector<int> v(d);
	REP(i, d) {
		v[i] = i;
	}
	int sum = 0;
	int cnt = 0;
	int min_cnt = 100000;

	do{
		sum = 0;
		cnt = 0;
		REP(i, d) {
			if (sum + list[v[i]].comp_point <= g) {
				sum += list[v[i]].comp_point;
				cnt += list[v[i]].p;
			}
			else {
				int tmp = g - sum;
				if (tmp <= list[v[i]].point*list[v[i]].p) {
					if (tmp%list[v[i]].point == 0) {
						cnt += tmp / list[v[i]].point;
					}
					else {
						cnt += tmp / list[v[i]].point + 1;
					}
				}
				else {
					cnt += list[v[i]].p;
				}
				break;
			}
		}
		if (cnt < min_cnt) {
			min_cnt=cnt;
		}
	} while (next_permutation(v.begin(), v.end()));
	//SORT(list);
	//reverse(list.begin(), list.end());

	ANS(min_cnt);


	return 0;
}



Measured memory_bytes: 384
#include <iostream>
    #include <string>
    #include <vector>
    #include <math.h>
    using namespace std;
     
    int main() {
        int N;
        cin>>N;
        for(int i=0;i<900;i++){
            if((N+i)%111==0){
                cout<<N+i;
                return 0;
            }
        }
    }

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <queue>
using namespace std;
#define MAXN 200100
#define ll long long
ll n, m, has[MAXN], p1 = 1009, p2 = 998244353, len[MAXN];
char s[110];
int main()
{
	scanf("%lld",&n);
	for(ll i=1;i<=n;i++)
	{
		scanf("%s",s+1);
		len[i] = strlen(s+1);
		for(ll j=1;j<=len[i];j++)
			has[i] = (has[i]*p1 + s[j]);
	}
	sort(has+1,has+n+1);
	int	ans = 1;
	for(int i=2;i<=n;i++)
	{
		if(has[i] != has[i-1]) ans++;
	}
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 6780
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 より
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

//

fn run() {
    input! {
        n: usize,
        s: chars,
    }
    let mut ans = 0;
    for i in 2..n {
        if s[i - 2] == 'A' && s[i - 1] == 'B' && s[i] == 'C' {
            ans += 1;
        }
    }
    println!("{}", ans);
}

fn main() {
    run();
}


Measured memory_bytes: 4352
A, B, K = map(int, input().split())
sta = 2
while K >= 1:
    if sta%2 == 0:
        if A % 2 != 0:
            A = A-1
            B += A//2
            A = A//2
        else:
            B += A//2
            A = A//2
    else:
        if B % 2 != 0:
            B = B-1
            A += B//2
            B = B//2
        else:
            A += B//2
            B = B//2
    
    K -= 1
    sta += 1
print(A, B)

Measured memory_bytes: 3316
#include <iostream>
#include <fstream>
#include <cassert>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#include <random>
#include <complex>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<long double,long double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<61;
const double pi=acos(-1);
const double eps=1e-10;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int n;
vvp g;
vl a,s;
vi used;

int t=-1,U,I;

int dfs(int v){
	used[v]=1;
	int S=1;
	for(int i=0;i<g[v].size();i++){
		P p=g[v][i];
		int u=p.first,ind=p.second;
		if(!used[u]){
			int T=dfs(u),tmp=n-2*T;
			if(tmp!=0) a[ind]=(s[u]-s[v])/tmp;
			else{
				t=v;U=T;I=ind;
			}
			S+=T;
		}
	}
	return S;
}

ll DFS(int v,ll L){
	used[v]=0;
	ll res=L;
	for(int i=0;i<g[v].size();i++){
		P p=g[v][i];
		int u=p.first,ind=p.second;
		if(used[u]) res+=DFS(u,L+a[ind]);
	}
	return res;
}

int main(){
	cin>>n;
	g=vvp(n);
	s=vl(n);
	a=vl(n-1);
	used=vi(n);
	for(int i=0;i<n-1;i++){
		int u,v;
		cin>>u>>v;
		u--;v--;
		g[u].push_back({v,i});
		g[v].push_back({u,i});
	}
	for(int i=0;i<n;i++) cin>>s[i];
	dfs(0);
	if(t!=-1){
		ll L=DFS(t,0);
		a[I]=(s[t]-L)/U;
	}
	for(int i=0;i<n-1;i++) cout<<a[i]<<endl;
}

Measured memory_bytes: 16128
#include <stdio.h>
#include <stdlib.h>

int compare(const void *a, const void *b)
{
    return *(int*)b-*(int*)a ;
}
int main(void) {
	int i,c,buf,top[10];
	
	for(i = 0; 10 > i; i++){
		scanf("%d", &top[i]);
	}
	qsort(top, 10, sizeof(int), compare);
	printf("%d\n%d\n%d\n",top[0],top[1],top[2]);
	return 0;
}

Measured memory_bytes: 1032
#include "bits/stdc++.h"
using namespace std;
#define repi(i,a,b) for(int i=(a), i##_len=(b); i<i##_len; ++i)
#define rep(i,n) repi(i,0,n)
#define repi_(i,a,b) for(int i=(a), i##_len=(b); i<=i##_len; ++i)
#define rep_(i,n) repi_(i,0,n)
#define all(x) (x).begin(),(x).end()
#define vsort(v) sort((v).begin(), (v).end())
#define gsort(v) tsort(v); reverse((v).begin(), (v).end())
#define vrev(v) reverse((v).begin(), (v).end())
#define siz(v) ((int)(v).size())
#define ers(v, n) (v).erase((v).begin() + n)
#define cnt(v, n) count(all(v), n)
#define vmin(v) *min_element(v.begin(), v.end())
#define vmax(v) *max_element(v.begin(), v.end())
#define el "\n"
#define co(x) cout<<(x)<<el
#define coc(c, a, b) if(c)co((a));else co((b))
#define cosp(x) cout<<(x)<<' '
#define YES(c) coc(c,"YES", "NO")
#define Yes(c) coc(c,"Yes", "No")
#define yes(c) coc(c,"yes", "no")
#define POSSIBLE(c) coc(c, "POSSIBLE", "IMPOSSIBLE")
#define Possible(c) coc(c, "Possible", "Impossible")
#define possible(c) coc(c, "possible", "impossible")
#define inf INT_MAX
#ifdef tqktmp_2
#define gc() getchar(); getchar()
#else
#define gc() 1
#endif
const unsigned int bf0 = (1 << 0);
const unsigned int bf1 = (1 << 1);
const unsigned int bf2 = (1 << 2);
const unsigned int bf3 = (1 << 3);
const unsigned int bf4 = (1 << 4);
const unsigned int bf5 = (1 << 5);
const unsigned int bf6 = (1 << 6);
const unsigned int bf7 = (1 << 7);

typedef long long lint;
typedef vector<int> ivec; typedef vector<string> svec;

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

template<class T>inline bool maxi(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>inline bool mini(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }




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

	repi(i, 1, 10)repi(j, 1, 10) {
		cout << i << "x" << j << "=" << i * j << el;
	}
	gc();
}


Measured memory_bytes: 3056
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	#define int  long long int
	#define pb push_back
	#define fe first
	#define lb lower_bound 
	#define ub upper_bound
	#define pii pair<pair<int,int>,pair<int,int> >
	#define se second
	#define endl "\n"
	#define pi pair<int, int>
	#define mi          map<int,int>
	#define mii         map<pi,int>
	#define vi vector<int> 
	#define vvi vector<vi>
	#define bs   binary_search
	#define rep(i,a,b) for(int i=a;i<b;i++)
	#define rep1(i,a,b) for(int i=a;i<=b;i++)	
	#define all(c) (c).begin(),(c).end()
	#define sz(x)       (int)x.size() 
	#define PI 3.14159265358979323846
	
	 const int N =2e5+5;
	
	 int mod= 1e9+7;
	 int dx[4]={0,0,+1,-1};
	 int dy[4]={+1,-1,0,0};  
	 
	 
	int po(int a, int b) {
		a %= mod;
		int res = 1;
		while (b > 0) {
			if (b & 1)
				res = (res * a) % mod;
			a =(a*a) % mod;
			b >>= 1;
		}
		 return res;	
	   }

	  
	 void solve() {		 
	     int a,b,val1=-1,val2=-1;
	     cin>>a>>b;
	     int mini=1e18;
	    rep(i,1,1e6) {
			  int nx1=(8*i)/100;
			  int nx2=(10*i)/100;
			  if(nx1==a && nx2==b) {
				   mini=min(mini,i);
				  }
			}
			if(mini==1e18) cout<<-1<<endl;
			else cout<<mini<<endl;            
	 }
	
int32_t main() {
	cool;
	int t=1;
	//cin>>t;
	while(t--)
	   solve();
	   
	   
	   return 0;	   
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

max_size = 2*10**4 + 1
h, n = map(int, input().split())
DP = [float('INF')] * max_size
DP[0] = 0

for _ in range(n):
    damage, cost = map(int, input().split())
    for idx in range(damage, max_size):
        DP[idx] = min(DP[idx], DP[idx-damage] + cost)

print(min(DP[h:]))


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

string s;
int k;
ll dp[101][2][5];

int main() {
  cin >> s;
  int n = (int)s.size();
  cin >> k;
  for (int i = 0; i < 101; i++) for (int j = 0; j < 2; j++) for (int l = 0; l < 5; l++) dp[i][j][l] = 0;
  dp[0][0][0] = 1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 2; j++) {
      for (int l = 0; l <= k; l++) {
        int lim = j == 1 ? 9 : (s[i] - '0');
        for (int m = 0; m <= lim; m++) {
          if (m == lim) {
            if (m == 0) {
              dp[i + 1][j][l] += dp[i][j][l];
            } else {
              dp[i + 1][j][l + 1] += dp[i][j][l];
            }
          } else {
            if (m == 0) {
              dp[i + 1][1][l] += dp[i][j][l];
            } else {
              dp[i + 1][1][l + 1] += dp[i][j][l];
            }
          }
        }
      }
    }
  }
  cout << dp[n][0][k] + dp[n][1][k] << endl;
  return 0;
}

Measured memory_bytes: 256
(function () {
  var input = '';

  function main () {
    var d,
        i,
        inputLen,
        x = 600;

    for (i = 0, inputLen = input.length - 1; i < inputLen; i += 1) {
      d = parseFloat(input[i]);

      console.log(calIntegral(d, x));
    }
  }

  function calIntegral(d, x) {
    var i,
        area = 0;

    for (i = 1; i * d < 600; i += 1) {
      area += Math.pow(i * d, 2) * d;
    }

    return Math.round(area);
  }


  process.stdin.resume();
  process.stdin.setEncoding('utf8');
  process.stdin.on('data', function (chunk) {
    input += chunk;
  });

  process.stdin.on('end', function () {
    input = input.split('\n');
    main();
  });
}());

Measured memory_bytes: 8804
#include <bits/stdc++.h>
#define int long long
#define maxn 16
using namespace std;
 
int arr[maxn][maxn] = {};
int dp[1 << maxn], sum[1 << maxn] = {};
int n;
 
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n;
    for(int i = 0; i < n; i++) {
        for(int j = 0; j < n; j++) {
            cin >> arr[i][j];
        }
    }

    //soma de todos os grupos possiveis
    for(int S = 0; S < (1 << n); S++) {
        for(int j = 0; j < n; j++) {
            if(!(S & (1 << j))) continue;
            for(int k = j + 1; k < n; k++) {
                if(S & (1 << k)) {
                    sum[S] += arr[j][k];
                }
            }
        }
    }
    for(int S = 0; S < (1 << n); S++) {
        int x = S;
        dp[x] = sum[x];
        while(x) {
            x = (x - 1) & S;

            /*
            dp[S] = soma de todos do grupo
            dp[S ^ x] + sum[x] = soma do grupo(S ^ x) e do grupo(x)
            ex: dp[S] = soma do 1,2;1,3;2,3
				mas a soma de S posso fazer tambem um grupo {2,3} + {1} ou {1,3} + {2} ou {1,2} + {3}->esse ele nao calcula	
			*/
            dp[S] = max(dp[S], dp[S ^ x] + dp[x]);
            //dp[S] = max(dp[S], dp[S ^ x] + sum[x]);
        }
    }
    cout << dp[(1 << n) - 1] << '\n';
    return 0;
}

Measured memory_bytes: 4632
#include <iostream>
#include <vector>
using namespace std;
int main(void){
    // Your code here!
    int n;cin>>n;
    vector<int >c;
    vector<int >s;
    vector<int >f;
    
    for(int i=0;i<n-1;i++)
    {
        int ci,si,fi;
        scanf("%d %d %d",&ci,&si,&fi);
        c.push_back(ci);
        s.push_back(si);
        f.push_back(fi);
        
    }
    
    for(int i=0;i<n-1;i++)
    {
        int sum=0;
        for(int k=i;k<n-1;k++)
        {
            if(sum<=s[k])
            {
                sum=s[k];
            }
            
            if(sum%f[k]!=0)
            {
                sum+=f[k]-sum%f[k];
            }
            
            sum+=c[k];
            
        }
        cout<<sum<<"\n";
    }
    
    cout<<0;
    
    
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  ll n, m; cin >> n >> m;
  rep(i, n) {
    char c; cin >> c;
    if (i+1 == m) {
      ll num = c - 'A';
      c = num + 'a';
    }
    cout << c;
  }
  cout << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include<algorithm>
#include<sstream>
#include<iomanip>
#include<deque>
#include<list>


using namespace std;

typedef long long ll;

typedef pair<int, int> pii;

const ll MOD_CONST = 1000000007;
const ll BIG_NUM = 1000000000000000000;
const int BIG_INT = 1000000000;



int main() {
	int n;
	cin >> n;
	map<ll, ll> m;
	ll sum = 0;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		sum += a;
		m[sum]++;
	}

	m[0]++;

	ll cnt = 0;
	for (auto it = m.begin();it != m.end();it++) {
		cnt += ((it->second - 1)*it->second) / 2;
	}

	cout << cnt << endl;
}



Measured memory_bytes: 12800
N = int(input())
T, A = [int(i) for i in input().split(" ")]
temp = [T-0.006*int(h) for h in input().split(" ")]

place = 1
diff_min = abs(temp[0]-A)

for cnt, t in enumerate(temp,1):
  if abs(A-t) < diff_min:
    diff_min = abs(A-t)
    place = cnt

print(place)
  

Measured memory_bytes: 3188
#include <iostream>
#include <stdio.h>
#include <math.h>
using namespace std;

int main(){
  int a,b,c,d,e,f;
  int g,h,i,sum;
  
  cin >> a >> b >> c >> d >> e >> f;
  while(a!=0||b!=0||c!=0||d!=0||e!=0||f!=0){
    g=a+d;
    h=b+e;
    i=c+f;
    sum=0;
    if((g>1&&h>1&&i>1)&&((g%3==2&&h%3==2&&i%3==0)||(g%3==2&&h%3==0&&i%3==2)||(g%3==0&&h%3==2&&i%3==2))) sum++;
    sum+=g/3;
    g=g%3;
    sum+=h/3;
    h=h%3;
    sum+=i/3;
    i=i%3;
    while(g>0&&h>0&&i>0){
      g--;h--;i--;
      sum++;
    }
    
    cout << sum << endl;
    
    cin >> a >> b >> c >> d >> e >> f;
  }
  return 0;
}

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

using namespace std;
int b[110];
//0 153 10 10 23
//0 0 10 10 10 23

int main()
{
    int n;  cin >> n;
    for(int i = 0;i<n  - 1;i++)  cin >> b[i];
    int Ans = 0;
    for(int i = 0 ;i<n - 2;i++)  Ans+=min(b[i] , b[i + 1]);
    cout << Ans + b[0] + b[n - 2];
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
    ll ans=1,x,y;
    cin >> x >> y;
    while(x<=y){
        x *= 2;//条件を満たす最小の次項は、２倍した項
        if(x<=y){
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		String[] strings = line.split(" ");
		int a = Integer.parseInt(strings[0]);
		int b = Integer.parseInt(strings[1]);
		if (a < b) {
			System.out.println("a < b");
		} else if (a > b) {
			System.out.println("a > b");
		} else if (a == b) {
			System.out.println("a == b");
		}

	}

}

Measured memory_bytes: 26188
from collections import Counter
a = int(input())
l = list(map(int, input().split()))
#i = 1

c=Counter(l)
d = dict(c)
kv = []
for k,v in d.items():
    if k>v:
        kv.append(v)
    elif k<v:
        t = v-k
        kv.append(t)
s = sum(kv)
print(s)


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

using namespace std;

using ll = long long;

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

    int N, C;

    cin >> N >> C;
    vector<vector<int>> D(C + 1, vector<int>(C + 1));
    vector<vector<int>> c(N + 1, vector<int>(N + 1));

    for (int i = 1; i <= C; ++i)
        for (int j = 1; j <= C; ++j)
            cin >> D[i][j];
    for (int i = 1; i <= N; ++i)
        for (int j = 1; j <= N; ++j)
            cin >> c[i][j];

    vector<vector<int>> sum(C + 1, vector<int>(3));
    for (int k = 1; k <= C; ++k) {
        for (int i = 1; i <= N; ++i)
            for (int j = 1; j <= N; ++j) {
                int p = (i + j) % 3;
                sum[k][p] += D[c[i][j]][k];
            }
    }

    int ans = -1;
    for (int i = 1; i <= C; ++i) {
        for (int j = 1; j <= C; ++j) {
            if (i == j) continue;
            for (int k = 1; k <= C; ++k) {
                if (i == k || j == k) continue;
                int tmp = sum[i][0] + sum[j][1] + sum[k][2];
                if (ans == -1 || tmp < ans)
                    ans = tmp;
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1280
s = gets.chomp

result = 0

i = 0
a_count = 0
a_flag = false

# AA...ABCの形を探す
while i < s.length do
  if a_flag # A継続モードのとき
    if s[i] == "A"
      a_count += 1
    elsif s[i] == "B" && s[i+1] == "C"
      # AA...ABCの形を見つけたらAの数だけ操作可能
      # 操作後はBCAA...Aの形になるのでA継続モードはつづく
      result += a_count
      # 2個分indexを動かしたいのでここで余分に+1しておく
      i += 1
    else
      # 対象の操作はできず
      a_count = 0
      a_flag = false
    end
  elsif s[i] == "A" # Aが表れたとき
    a_count = 1
    # A継続モードに入る
    a_flag = true
  end
  # indexを動かす
  i += 1
end

puts result


Measured memory_bytes: 14752
// template version 1.12
using namespace std;
#include <iostream>
#include <bits/stdc++.h>

// varibable settings
#define infile "../test/sample-1.in"
#define int long long //{{{
const int INF=1e18;
const int MOD=1e9+7; //}}}

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}

int N,M;
vvi e;
vi cnt;
vi used;
map<pii, int> eused;

int dfs(int n){
  dump(n, "start");
  int ecnt = 0;
  used[n] = 1;
  each(c, e[n]){
    if(eused.find(mp(n,c))==eused.end()){
      eused[mp(n,c)] = 1;
      eused[mp(c,n)] = 1;
      ecnt++;

      int remained = 0;
      if(used[c]==0){
        remained += dfs(c);
      }
      ecnt+=remained;
      if (remained%2==1){
        // c -> n
        eused[mp(c,n)] = 1;
        eused[mp(n,c)] = -1;
        cnt[c]++;
      }
      else{
        // n -> c
        eused[mp(n,c)] = 1;
        eused[mp(c,n)] = -1;
        cnt[n]++;
      }
    }
  }
  dump(n, ecnt);
  return ecnt;
}

int solve(){
  cin>>N>>M;
  e = vvi(N);
  cnt = vi(N, 0);
  used = vi(N, 0);

  rep(i, M){
    int a,b;
    cin>>a>>b;a--;b--;
    e[a].pb(b);
    e[b].pb(a);
  }

  dfs(0);
  dump(eused);
  dump(cnt);
  each(el, cnt){
    if (el%2!=0) {
      cout << -1 << endl;
      return 0;
    }
  }
  each(el, eused){
    int p,q,z;
    tie(p,q) = el.first;
    z = el.second;
    if (z==1) {
      cout << p+1 << " " << q+1 << endl;
    }
  }

  return 0;
}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
  solve();
  return 0;
} //}}}


Measured memory_bytes: 33408
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define INF 1000000000000000000

int main() {
    int N, M;
    cin >> N >> M;
    vector<ll> dp(N + 1, 0);
    ll MOD = 1000000007;
    dp[0] = 0;
    vector<bool> broken(N + 1, false);
    rep(i, M) {
        int a;
        cin >> a;
        broken[a] = true;
    }

    dp[0] = 1;
    dp[1] = 1;
    for (int i = 2; i <= N; i++) {
        if (!broken[i - 1])
            dp[i] += dp[i - 1];
        if (!broken[i - 2])
            dp[i] += dp[i - 2];

        dp[i] %= MOD;
    }

    cout << dp[N] << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <cstring>
using namespace std;

typedef long long ll;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  const char prohibited[2] = { 'L', 'R' };
  char dance[101];
  cin >> dance;
  int len = strlen(dance);
  for(int i = 0; i < len; i++) {
    if(dance[i] == prohibited[i % 2]) {
      cout << "No\n";
      return 0;
    }
  }
  cout << "Yes\n";
  return 0;
}



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

int main(){
    string s1,s2;
    int n,h;
    while(cin>>s1){
        if(s1 =="-")break;
        cin>>n;
        for(int i=0;i<n;i++){
            cin>>h;
            s2=s1.substr(0,h);
            s1=s1.erase(0,h);
            s1 += s2;
        }
    cout<<s1<<endl;   
    }
    return 0;
    
}


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

int main(){
    int n,k;
    char s[11];
    scanf("%d%s%d",&n,s,&k);
    for(int i=0;i<n;i++)printf("%c",s[i]==s[k-1]?s[k-1]:'*');
    printf("%c",'\n');
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Range(container) container.begin(), container.end()
#define Cin(T, x) T x; cin >> x;
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i];
#define Cout(val) cout << (val) << "\n";
using namespace std;
using ll = long long;

int main(void){
    Cins(int, 4, a);
    int l = a[0]+a[1], r = a[2]+a[3];
    Cout((l > r) ? "Left" : (l < r) ? "Right" : "Balanced");
}

Measured memory_bytes: 256
N = int(input())
A1 = list(map(int, input().strip().split(' ')))
A2 = list(map(int, input().strip().split(' ')))

max = 0
for i in range(N):
    total = 0
    j = 0
    while j <= i:
        total += A1[j]
        j += 1
    j = i
    while j < N:
        total += A2[j]
        j += 1
    if max < total:
        max = total
        
print(max)

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef priority_queue<int> pq;
typedef priority_queue<int, vi, greater<int>> mpq;

const ll INF = 1e18;
const int mod = 1e9+7;
const int dX[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

#define whatis(x) cerr << #x << " is " << x << endl;
#define endl "\n"
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ft front()
#define bk back()
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define FOR(i, a) for(int i = 0; i < a; i++)
#define FoR(i, a) for(int i = 1; i <= a; i++)
#define ROF(i, a) for (int i = (a)-1; i >= 0; i--)
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}
//-----------------------| Template By: DakDak |----------------------------
ll n, target;
ll dp[105][100005];
int main(){
    cin >> n >> target;
    int w[105], v[105];
    for(int i = 0; i < n; i++){
        cin >> w[i] >> v[i];
    }
    for(int i = 1; i <= n; i++){
        for(int j = 0; j <= target; j++){
            dp[i][j] = dp[i-1][j];
            ll left = j - w[i-1];
            if(left >= 0){
                dp[i][j] = max(dp[i][j], dp[i-1][left] + v[i-1]);
            }
        }
    }
    cout << dp[n][target] << endl;
    return 0;
    // Read nutes to self
}

/* NOTES TO SELF:
 * Check for int vs ll, worst case just switch everything to ll
 * Check for array bounds if you SEGFAULT, especially in range based loops
 * Always initialize everything in global 
 * Edge cases such as n = 1 or 0
 * Make sure to calculate big O complexity
 * You are geniosity you got this
 */





Measured memory_bytes: 79360
# ANSHUL GAUTAM
# IIIT-D

from math import *
from copy import *					# ll = deepcopy(l)
from heapq import *					# heappush(hp,x)
from string import *				# alpha = ascii_lowercase
from random import *				# l.sort(key=lambda l1:l1[0]-l1[1]) => ex: sort on the basis difference
from bisect import *				# bisect_left(arr,x,start,end)  => start and end parameters are temporary
from sys import stdin				# bisect_left return leftmost position where x should be inserted to keep sorted
from sys import maxsize				# minn = -maxsize
from operator import *				# d = sorted(d.items(), key=itemgetter(1))
from itertools import *				# pre = [0] + list(accumulate(l))
from decimal import Decimal 		# a = Decimal(a)	# use this for math questions
from collections import Counter		# d = dict(Counter(l))
from collections import defaultdict # d = defaultdict(list)

'''
3
1 2 3
'''

def solve(l):
	n = len(l)
	minn = float('inf')
	for t in range(1,n):
		a = sum(l[:t])
		b = sum(l[t:])
		minn = min(minn,abs(a-b))
	return minn
	

N = int(stdin.readline())
l = list(map(int, stdin.readline().rstrip().split()))
ans = solve(l)
print(ans)



Measured memory_bytes: 83524
r,c=map(int,input().split())
sheet=[]
for i in range(r):
    sheet.append(list(map(int,input().split())))

c_ans=[0 for _ in range(c)]
for i in range(r):
    for j in range(c):
        c_ans[j]+=sheet[i][j]
    sheet[i].append(sum(sheet[i]))
c_ans.append(sum(c_ans))
sheet.append(c_ans)

for i in range(len(sheet)):
    for j in range(len(sheet[i])):
        print(sheet[i][j],end="")

        if(j<len(sheet[i])-1):
            print(" ",end="")
    print()



Measured memory_bytes: 6752
#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<ll,ll>;

int main (){
  ll n;
  string s;
  cin>>n>>s;
  ll m = s.size();
  if (m<=n){
    cout << s << endl;
    return 0;
  }
  else{
    rep(i,n){
      cout << s.at(i);
    }
    cout << "..." << endl;
    return 0;
  }
}

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

int head,tail,MAX,q,sumtime=0;

struct Quantum{
    public:
    string name;
    int time;
} *Q;

void initialize(){
    head = tail = 0;
}

void enqueue(string s,int x){
    Q[tail].name = s;
    Q[tail].time = x;
    if(tail + 1 == MAX){
        tail = 0;
    }else{
        tail++;
    }
}

bool isEmpty(){
    return head == tail;
}

Quantum dequeue(){
    Quantum q;
    q = Q[head];
    if(head + 1 == MAX){
        head = 0;
    }else{
        head++;
    }
    return q;
}

void process(){
    Quantum x;
    x = dequeue();
    if(x.time>q){
        x.time -= q;
        sumtime += q;
        enqueue(x.name, x.time);
    }else{
        sumtime += x.time;
        cout << x.name << " " << sumtime << endl;
    }
}

int main(){
    int n,i,t;
    string str;
    initialize();
    cin >> n >> q;
    MAX = n + 1;
    Q = new Quantum[n+1];
    for(i=0;i<n;i++){
        cin >> str >> t;
        enqueue(str,t);
    }
    while(!isEmpty()){
        process();
    }
    return 0;
}


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

using namespace std;
using ll = long long;

const ll MOD = 1000000007LL; // = 10^9 + 7
const double PI = 3.14159265358979;

void solve()
{
  ll n, k;
  cin >> n >> k;
  if (n == k) cout << 1;
  else cout << 1 + (n - k - 1) / (k - 1) + 1;
}

int main()
{
  fastio;
  solve();

  return 0;
}

Measured memory_bytes: 3652
n = gets.to_i
c = (n-1).times.map{gets.chomp.split(" ").map(&:to_i)}
a = 0
for i in 0..n-2
  a = c[i][1] + c[i][0]
  for j in i+1..n-2
    if a <= c[j][1]
      a = c[j][1]
    else
      a += (c[j][2] - a%c[j][2])%c[j][2]
    end
    a += c[j][0]
  end
  puts a
end
puts 0

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define rep(i,n) for (ll i=1 ; i<=(n) ; ++i)
typedef long long ll;
using namespace std;
const ll MAX = 2500LL;
typedef pair <ll, ll> P;

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

  ll a,b,n;
  cin >> a >> b >> n;
  ll ansa, ansb ,ans;
  ansa = (a*n)/b - a*(n/b);
  ll x = (n/b)*b-1;
  ansb = (a*x)/b - a*(x/b);
  ans = max(ansa, ansb);
  cout << ans << endl;

  return 0;
}


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

int main(){
    int n,k;cin>>n>>k;
    vector<int> a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    int res=0;
    sort(a.begin(),a.end());
    for(int i=0;i<k;i++)res+=a[i];
    cout<<res<<endl;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N,L;
    cin >> N >> L;
    vector<string> stringList(N);
    for (int i = 0; i < N; ++i) {
        cin >> stringList.at(i);
    }
    for (int i = 0; i < N; ++i) {
        sort(stringList.begin(), stringList.end());
    }
    for (int i = 0; i < N; ++i) {
        cout << stringList.at(i);
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include<random>
#include<math.h>
#include<limits.h>
#include<iterator>
#define rep(i,a) for(int i=0;i<a;i++)
#define nrep(i,a,b) for(int i=a;i<b;i++)
#define mrep(i,a) for(int i=a;i>=0;i--)
#define ll long long
#define vl vector<ll> 
#define vvl vector<vector<ll> > 
#define vb vector<bool> 
#define vvb vector<vector<bool> > 
#define INF 1123456789012345
using namespace std;

bool check(vl a, ll x, ll y){
	bool x_flag = false;
	bool y_flag = false;
	rep(i, a.size()){
		if (a[i] == x) x_flag = true;
		if (a[i] == y) y_flag = true;
	}return x_flag && y_flag;
}

int main(){
	vl one = { 1, 3, 5, 7, 8, 10, 12 };
	vl two = { 4, 6, 9, 11 };
	vl three = { 2 };
	ll x, y; cin >> x >> y;
	if (check(one, x, y) || check(two, x, y) || check(three,x, y)) cout<< "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long n,b=1000000010;
  cin>>n;
  vector<long long> x(n+1),a(n);
  for(int i=0;i<=n;i++)cin>>x[i];
  sort(x.begin(),x.end());
  for(int i=0;i<n;++i){
    a[i]=x[i+1]-x[i];
    b=min(a[i],b);
  }

  for(long long i=b;i>0;--i){
    bool f=true;
    for(int j=0;j<n;++j){
      if(a[j]%i!=0){f=false;break;}
    }
    if(f)return cout<<i,0;
  }
}

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

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


Measured memory_bytes: 4044
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cassert>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repd(i, n) for (int i = n; i >= 1; i--)
#define mod 1000000007
#define MOD 998244353
#define inf 1e20
typedef long long int ll;
typedef pair<ll, ll> p;


int main() {
	int n,ans=0;
	cin >> n;
	vector<int> a(n);
	rep(i, n) {
		cin >> a[i];
	}
	ans = *max_element(a.begin(), a.end()) - *min_element(a.begin(), a.end());
	cout << ans << endl;
	return 0;
}

//Ctrl+Aを使わない

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 0x3f3f3f3f
#define re register
#define LL long long
// #define MOD 1000000007
#define MAXN 6005
using namespace std;
const int ST=6002;
LL n,ans,MOD,dp[MAXN][MAXN<<1];
LL rd(){
	LL x=0,tp=1;char c;c=getchar();
	while(c<'0' || c>'9'){if(c=='-')tp=-1;c=getchar();}
	while(c>='0' && c<='9'){x=(x*10+c-'0');c=getchar();}
	return x*tp;
}
int add(int a,int b){return (a+b>=MOD)?(a+b-MOD):a+b;}
int main(){
	// freopen("testdata.in","r",stdin);
	// freopen("shit.out","w",stdout);
	n=rd()*3,MOD=rd();
	dp[0][ST]=1;
	for(int i=0;i<n;i++){
		for(int j=-i;j<=i;j++){
			dp[i+1][ST+j+1]=add(dp[i+1][ST+j+1],dp[i][ST+j]);
			dp[i+2][ST+j-1]=add(dp[i+2][ST+j-1],dp[i][ST+j]*(i+1)%MOD);
			dp[i+3][ST+j]=add(dp[i+3][ST+j],dp[i][ST+j]*(i+1)%MOD*(i+2)%MOD);
		}
	}
	for(int i=0;i<=n;i++)ans=add(ans,dp[n][ST+i]);
	printf("%lld\n",ans);
	// printf("%.2lf\n",(double)clock()/CLOCKS_PER_SEC);
	return 0;
}

Measured memory_bytes: 561536
#include <stdio.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)((n>>m)&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

ll n,k,ans;
ll a[100010];
int main(){
	scanf("%lld%lld",&n,&k);
	k--;n--;
	printf("%lld\n",(n+k-1)/k);
	return 0;
}



Measured memory_bytes: 128