akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        std::cin.tie(0);
        ios::sync_with_stdio(false);
        cout.precision(20);
    }
} fast;

/* define */
#define FOR(I, X, Y) for (long long(I) = (X); (I) < (Y); (I)++)
#define REP(I, X, Y) for (long long(I) = (Y)-1; (I) >= (X); (I)--)
#define ALL(X) (X).begin(), (X).end()
#define pb push_back
#define COUNT(V, X)                           \
    (upper_bound((V).begin(), (V).end(), X) - \
     lower_bound((V).begin(), (V).end(), X))
#define debug(x) cerr << #x << ':' << x << endl;
#define DEBUG(v)                             \
    {                                        \
        cerr << #v << ':';                   \
        for (auto xv : v) cerr << xv << ' '; \
        cerr << endl;                        \
    }
#define Yes(X) cout << (X ? "Yes" : "No") << endl;
#define YES(X) cout << (X ? "YES" : "NO") << endl;
#define ctoi(C) (C - '0')
#define pow2(x) ((long long)((long long)1 << x))

/* alias */
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using pi = pair<int, int>;
using pl = pair<long long, long long>;
template <typename T>
using PQ = priority_queue<T>;
template <typename T>
using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const long long dx[] = {1, 0, -1, 0};
const long long dy[] = {0, 1, 0, -1};
const long long dx8[] = {1, 1, 0, -1, -1, -1, 0, 1};
const long long dy8[] = {0, 1, 1, 1, 0, -1, -1, -1};
const long long dx9[] = {1, 1, 0, -1, -1, -1, 0, 1, 0};
const long long dy9[] = {0, 1, 1, 1, 0, -1, -1, -1, 0};
const int INF = 1000000007;
const long long LINF = 1000000000000000007;

/* func */
template <typename T1, typename T2>
inline bool chmin(T1 &a, const T2 &b) {
    if (a > b) a = b;
    return a > b;
}
template <typename T1, typename T2>
inline bool chmax(T1 &a, const T2 &b) {
    if (a < b) a = b;
    return a < b;
}
long long max(long long x, int y) {
    return max(x, (long long)y);
}
long long max(int x, long long y) {
    return max((long long)x, y);
}
long long min(long long x, int y) {
    return min(x, (long long)y);
}
long long min(int x, long long y) {
    return min((long long)x, y);
}

/* library */

/* main */

signed main() {
    int N, D;
    cin >> N >> D;
    cout << (N + 2 * D) / (2 * D + 1) << endl;
}

Measured memory_bytes: 256
/*----------------by syr----------------*/
#include<algorithm>
#include<bitset>
#include<cctype>
#include<cstring>
#include<cstdlib>
#include<deque>
#include<fstream>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<limits>
#include<list>
#include<map>
#include<math.h>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<sstream>
#include<string>
#include<time.h>
#include<utility>
#include<vector>

using namespace std;

const int INF=1e9+7;

int nn,W;
long long ans=0;
int v[105],w[105],n[4];
int sum[4][105];
vector<int> vec[4];

int main(){
	scanf("%d%d",&nn,&W);
	for(int i=1;i<=nn;i++){
		scanf("%d%d",w+i,v+i);
		vec[w[i]-w[1]].push_back(v[i]);
	}
	n[0]=vec[0].size();
	n[1]=vec[1].size();
	n[2]=vec[2].size();
	n[3]=vec[3].size();
	for(int i=0;i<4;i++){
 		sort(vec[i].begin(),vec[i].end());
 		reverse(vec[i].begin(),vec[i].end());
	}
	for(int i=0;i<4;i++){
		sum[i][0]=0;
		for(int j=1;j<=n[i];j++){
			sum[i][j]=sum[i][j-1]+vec[i][j-1];
//			printf("%d ",sum[i][j]);
		}
//		puts("");
	}
	for(int i=0;i<=n[0];i++){
		for(int j=0;j<=n[1];j++){
			for(int k=0;k<=n[2];k++){
				long long v0=sum[0][i],w0=(long long)i*w[1];
				long long v1=sum[1][j],w1=(long long)j*(w[1]+1);
				long long v2=sum[2][k],w2=(long long)k*(w[1]+2);
				if(w0+w1+w2>W) continue;
//				printf("%d %I64d\n%d %I64d\n%d %I64d\n\n",v0,w0,v1,w1,v2,w2);
				int l=min((W-w0-w1-w2)/(w[1]+3),(long long)n[3]);
				ans=max(ans,v0+v1+v2+sum[3][l]);
			}
		}
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
  int a,w[10]={},k[10]={},wa,ke;
  for(int i=0; i<10; i++) {
      cin >> a;
      w[i]=a;
  }
  sort(w,w+10);
  wa=w[9]+w[8]+w[7];
  cout << wa << " ";
  for(int i=0; i<10; i++) {
      cin >> a;
      k[i]=a;
  }
  sort(k,k+10);
  ke=k[9]+k[8]+k[7];
  cout << ke << endl;
}


Measured memory_bytes: 3152
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define endl "\n"

int main()
{
  i64 N;
  cin >> N;
  vector<i64> A(N);
  for (i64 i = 0; i < N; i++)
    cin >> A[i];
  map<i64, i64> m;
  i64 ans = 0;
  for (i64 i = 0; i < N; i++)
  {
    m[A[i]]++;
    ans += A[i];
  }
  i64 Q;
  cin >> Q;
  for (i64 i = 0; i < Q; i++)
  {
    i64 B, C;
    cin >> B >> C;
    ans -= B * m[B];
    ans += C * m[B];
    m[C] += m[B];
    m[B] = 0;
    cout << ans << endl;
  }
  return 0;
}


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

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 1e6 + 5;

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

  int n; cin>>n;
  vector<int> v(n);
  for (int i=0; i<n; i++) {
    cin>>v[i];
  }
  vector<int> w = v;
  sort(w.begin(), w.end());
  if (w==v) out("YES");
  int d=0;
  for (int i=0; i<n; i++) {
    d += w[i]!=v[i];
  }
  if (d==2) cout<<"YES"<<endl; else cout<<"NO"<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int x, y; cin >> x >> y;
    int answer = 0;
    vector<vector<char>> v(x, vector<char>(y, '#'));
    for(int i = 0; i < x; i++)
    {
        for(int j = 0; j < y; j++)
        {
            cin >> v[i][j];
        }
    }

    for(int i = 0; i < x; i++)
    {
        for(int j = 0; j < y; j++)
        {
            queue<pair<int, pair<int, int>>> bfs;
            vector<vector<bool>> vis(x, vector<bool>(y));
            bfs.push({0, {i, j}});
            while(!bfs.empty())
            {
                int dis = bfs.front().first;
                int h = bfs.front().second.first;
                int w = bfs.front().second.second;
                bfs.pop();
                if(v[h][w] == '#') continue;
                if(vis[h][w]) continue;
                vis[h][w] = true;
                answer = max(dis, answer);
                if(h > 0) bfs.push({dis + 1, {h - 1, w}});
                if(h < x - 1) bfs.push({dis + 1, {h + 1, w}});
                if(w > 0) bfs.push({dis + 1, {h, w - 1}});
                if(w < y - 1) bfs.push({dis + 1, {h, w + 1}});
            }
        }
    }

    cout << answer;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#include<cmath>

#define REP(i,n) for (int i = 0; (i) < (n); ++ (i))
#define FOR(i,n) for (int i = 1; (i) <= (n); ++ (i))
#define dump(x)  cout << #x << " = " << (x) << endl;
#define pb push_back
#define int long long

const int INF = 1e18;
const int MOD = 1e9+7;
//const lint LINF = 1e18;
const double eps = 0.000000001;//もとの値の10^(-16)まで

using namespace std;

//typedef pair<int, int> P;
//priority_queue< P, vector<P>, greater<P> > q;//ダイクストラの時、greaterで小さい順
//cout << fixed << setprecision(10) << ans << endl;
//int gcd(int a,int b){return b?gcd(b,a%b):a;}

signed main(){
    int a,b;
    cin >> a >> b;
    if(a<b) swap(a,b);
    REP(i,a){
        cout << b;
    }
    cout << endl;



    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll  long long int
#define pb push_back
#define ff first
#define ss second
#define vi vector<int>
#define br cout <<"\n";
#define all(x)  (x).begin(),(x).end()
#define rall(x)  (x).rbegin(),(x).rend()
#define tr(c,i) for(auto i :c)
#define pii pair< int,int >
#define fast_io() ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define pq priority_queue< pair<ll,pii> ,vector<pair<ll,pii>>,greater <pair<ll,pii>> >p;//container adapter makes ascending q
#define er(x) cout << x << " "
#define err(x,y) cout << x << " "<<y
const int MOD = 1000 * 1000 * 1000 + 7;
const int N = 1000000;
using namespace std;
clock_t time_p=clock();
void dem()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
ll fac[N] ;
ll mul ( ll a , ll b )
{
    return ((a % MOD )* (b % MOD )) % MOD ;

}
ll fastExp( ll base , ll pow )
{
    ll res = 1 ;
    while ( pow > 0 )
    {

        if ( pow & 1 ) res = mul ( res , base );
        base = mul ( base , base ) ;
        pow >>= 1 ;

    }
    return res ;
}
ll Inv ( ll base  )
{
    return fastExp( base , MOD - 2  );
}
void fact()
{
    fac[0] = 1 ;
    for ( int i = 1 ; i < N ; ++i )
        fac[i]= mul( fac[i-1] , i );

}
ll nCr ( ll n , ll r ){
ll C = fac[n];
if ( n < r   ||  n < 0 || r < 0 ) return 0 ;
C = mul(C , Inv(fac[r]));
C = mul (C , Inv ( fac[n - r] ));
return C ;


}
ll  solve(  ){
    fact();
    ll x , y ;
    cin >> x >> y ;
    if ((  x + y ) % 3 )  return 0 ;
    else {
    ll n =  ( x + y ) / 3 ;
    ll k = ( 2 * x - y ) / 3  ;
    //cout << n <<" " <<  k ;
    return nCr(  n   , k ) ;
    }
}

int main()
{
    fast_io();
    cout << solve () ;



    return 0 ;
}


Measured memory_bytes: 8064
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define _repargs(_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(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    int N;
    cin >> N;
    rep(i, 100000){
        if(i * (i + 1) / 2 >= N) {
            output(i);
            return 0;
        }
    }
    
    return 0;
}

Measured memory_bytes: 256
//↓template↓

#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
#define rall(n) n.rbegin(),n.rend()
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const double EPS = 1e-10;
const double pi = acos(-1);//3.1415926535897932384626433832795028...
const ll SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
ll fac[200005], finv[200005], inv[200005];
vector<ll>dij;
struct edge { ll to, cost; };
vector<vector<edge> >G;

ll mod_pow(ll a, ll b) {
	ll res = 1, mul = a;
	for (int i = 0; i < 31; ++i) {
		if (b >> i & 1) {
			res *= mul;
			res %= MOD;
		}
		mul = (mul * mul) % MOD;
	}
	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}

template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}

template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T & t, const V & v) { t = v; }

template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T & t, const V & v) {
	for (auto& e : t) fill_v(e, v);
}

template<typename T>
void outp(vector<T>v) {
	for (int i = 0; i < v.size(); ++i) {
		cout << v[i];
		if (i != v.size() - 1) { cout << " "; }
	}
}

double add(double a, double b) {
	if (abs(a + b) < EPS * (abs(a) + abs(b))) { return 0; }
	return a + b;
}


//↑template↑

int main() {
	int n;
	double k[55];
	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> k[i];
	}
	sort(k, k + n);
	double mon = k[0];
	for (int i = 1; i < n; ++i) {
		mon = (k[i] + mon) / 2;
	}

	cout << mon << endl;

}

Measured memory_bytes: 256
import heapq
n, m = map(int,input().split())
a = list(map(lambda x : int(x)*(-1),input().split()))
heapq.heapify(a)

for i in range(m):
    x = heapq.heappop(a)
    x = -(-x//2)
    heapq.heappush(a,x)

print(sum(a)*-1)

Measured memory_bytes: 14180
//#include "stdafx.h"
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <functional>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <tuple>
#include <numeric>
#include <assert.h>
#include <functional>
#include <unordered_map>

using namespace std;

/*-----------------------------------------------------------------------------
　定義
 -------------------------------------------------------------------------------*/
#define REP(i, n)				for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n)			for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define INF						2e9
#define MOD						(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)				(((((x))+((n)-1))/n))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)				(((((x))+((n)-1))/n)*n)		/* Nの倍数に切り上げ */
#define FloorN(x, n)			((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)				(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)				(!IsOdd((x)))						
#define	BitSetV(Val,Bit)		((Val) |= (Bit))			
#define	BitTstV(Val,Bit)		((Val) & (Bit))				
#define ArrayLength(x)			(sizeof( x ) / sizeof( x[ 0 ]))
#define MAX_DWORD				(0xFFFFFFFF)
#define	MAX_SDWORD				((SDWORD)0x7FFFFFFF)
#define	MIN_SDWORD				((SDWORD)0x80000000)
#define	MAX_QWORD				((QWORD)0xFFFFFFFFFFFFFFFF)
#define	MIN_QWORD				((QWORD)0x0000000000000000)
#define	MAX_SQWORD				((SQWORD)0x7FFFFFFFFFFFFFFF)
#define	MIN_SQWORD				((SQWORD)0x8000000000000000)
#define M_PI					3.14159265358979323846

typedef long					SDWORD;
typedef long long				SQWORD;
typedef unsigned long			DWORD;
typedef unsigned long long int	QWORD;
typedef long long ll;
typedef pair<ll, ll>			P;

/*-----------------------------------------------------------------------------
　処理
 -------------------------------------------------------------------------------*/
int main()
{
	int N;
	cin >> N;
	string strA(N/2, 0);
	string strB(N/2, 0);
	string ans = "No";
	if (IsEven(N)) {
		REP(i, N / 2) cin >> strA[i];
		REP(i, N / 2) cin >> strB[i];
		if(strA == strB)	ans = "Yes";
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		new Main().solve();
	}
	
	int n,k;
	int[]a;
	
	void solve(){
		Scanner sc=new Scanner(System.in);
		n=sc.nextInt();
		k=sc.nextInt();
		a=new int[n];
		for(int i=0;i<n;i++){
			a[i]=sc.nextInt();
		}
		Arrays.sort(a);
		
		//二分探索
		int max=n;
		int min=-1;
		int med=0;
		LOOP:while(max-min>1){
			med=(max+min)/2;
			
			if(a[med]>k){
				max=med;
				continue;
			}
			int idx=0;
			
			//dp[j][sum]:=j枚目までで和sumを作れるか
			boolean[][]dp=new boolean[n][k];
			for(int j=0;j<n;j++){
				dp[j][0]=true;
			}
			
			for(int j=1;j<n;j++){
				if(idx==med)idx++;	//i枚目は使わないので
				
				for(int sum=0;sum<k;sum++){
					if(dp[j-1][sum]){
						dp[j][sum]=true;
						int temp=sum+a[idx];
						if(temp<k)dp[j][temp]=true;
					}
				}
				idx++;
			}
			
			for(int sum=k-a[med];sum<k;sum++){
				if(dp[n-1][sum]){
					max=med;
					continue LOOP;
				}
			}
			min=med;
		}
		System.out.println(max);
	}
}

Measured memory_bytes: 210080
#include<stdio.h>
int main(void)
{
	int n,m,i,s,x,y;
	while(1){
		s=0;
		scanf("%d",&n);
		if(n==0) break;
		scanf("%d",&m);
		for(i=0;i<m;i++){
			scanf("%d %d",&x,&y);
			s+=y-x;
		}
		
		if(n<=s) printf("OK\n");
		else printf("%d\n",n-s);
	}
	return 0;
}	

Measured memory_bytes: 2708
/*Arnab's Code
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define vll vector<ll>
#define vii vector<int>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define take(a,n) for(ll i=0;i<n;i++)cin>>a[i]
#define takes(a,n,st) for(ll i=st;i<n+st;i++)cin>>a[i]
ll sum(ll a[],ll n,ll s){ for(ll i=0;i<n;i++)s+=a[i]; return s;}
#define mod 1000000009
ll power(ll x, ll y, ll p)  {  
    ll res = 1;  
    x = x % p;   
    if (x == 0) return 0;  
    while (y > 0){  
        if (y & 1)  
            res = (res*x) % p;  
        y = y>>1;
        x = (x*x) % p;  
    }  
    return res;  
}
ll som(ll n,ll max){
	ll nom=(max/n);
	ll l= nom*n;
	return(((n+l)*nom)/2);
}
void solve(){
	ll n,tot=0;
	cin>>n;
	for(ll i=1;i<=n;i++){
//		cout<<som(i,n)<<" ";
		tot+=som(i,n);
	}
	cout<<tot;
	return;
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	ll t,T;
//	cin>>T;
	T=1;
	for(t=1;t<=T;t++){
//		cout<<"Case #"<<t<<": ";
		solve();
	}
	return 0;
}

Measured memory_bytes: 3604
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Set;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.util.Comparator;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC097C solver = new ABC097C();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC097C {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            String s = in.next();
            int K = in.Int();

            Set<String> set = new HashSet<>();
            Set<String> set2 = new HashSet<>();
            int length = s.length();
            for (int j = 0; j < 26; j++) {
                String c = String.valueOf((char) ('a' + j));
                int idx = s.indexOf(c);
                while (idx >= 0) {
                    for (int i = idx + 1; i <= length; i++) {
                        set2.add(s.substring(idx, i));
                        if (set2.size() >= K) {
                            break;
                        }
                    }
                    set.addAll(set2);
                    set2.clear();
                    idx = s.indexOf(c, idx + 1);
                }
                if (set.size() >= K) {
                    break;
                }
            }


            List<String> list = new ArrayList<>(set);
            list.sort(Comparator.naturalOrder());
            out.println(list.get(K - 1));
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    return null;
                }
            }
            return st.nextToken();
        }

        public int Int() {
            return Integer.parseInt(next());
        }

    }
}



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

#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,n) for(int i = 1; i < n; i++)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
using vb = vector<bool>;
using vc = vector<char>;
using vcc = vector<vc>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
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(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int x, a, b;
  cin >> x >> a >> b;
  x -= a;
  int ans = x % b;
  cout << ans << endl;
}

Measured memory_bytes: 256
N = int(input())
a = []
for _ in range(N):
    x,l = map(int,input().split())
    a.append([x-l,x+l])
a.sort()
ans = 0 
right = -1*1000000000000
for i in a:
    if i[0] >= right:
        ans += 1
        right = i[1]
    else:
        if right > i[1]:
            right = i[1]
print(ans)

Measured memory_bytes: 60888
<?php
//Request Question
function getq($get_word=null){
	if($get_word===null){
		return str_replace("\n","",fgets(STDIN));
	}else if($get_word===1){
		return explode(" ",str_replace("\n","",fgets(STDIN)));
	}
}

/*		START		*/
$a=getq();
echo $a[0];
$a=getq();
echo $a[1];
$a=getq();
echo $a[2];
echo "\n";
?>

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

using namespace std;
const int N=2e5+10;
int a[N];
const int MAX=1e9+10;
vector <int> g[N];
int vis[N];
int ans;

int main()
{
    memset(vis,0,sizeof(vis));
    int n,m;
    cin>>n>>m;
    for(int i=1;i<=n;i++) cin>>a[i];
    for(int i=1;i<=m;i++){
        int x,y;
        cin>>x>>y;
        g[x].push_back(y);
        g[y].push_back(x);
    }
    for(int i=1;i<=n;i++){
        if(vis[i]) continue;
        int flag=1;
        for(int j=0;j<g[i].size();j++){
            if(a[g[i][j]]>=a[i]){
                flag=0;
                break;
            }
        }
        if(flag){
            ans++;
            for(int j=0;j<g[i].size();j++){
            vis[g[i][j]]=1;
        }
        }
    }
    cout<<ans<<endl;
}


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

int main(void){
    int N;
    cin >> N;
    
    string S[N];
    
    for(int i = 0; i < N; i++){
        cin >> S[i];
        if(S[i] == "Y"){
            cout << "Four" << endl;
            break;
        }
        
        if(i == N - 1){
            cout << "Three" << endl;
        }
    }
    
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
 
public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.nextLine());
    String[] S = sc.nextLine().split(" ");
    long[] A = new long[N];
    List<Long> list = new ArrayList<>();
    for(int i = 0; i < N; i++){
      long n = Long.parseLong(S[i]);
      A[i] = n;
      list.add(n-(i+1));
    }
    Collections.sort(list);
    long b = N%2==0 ? list.get(N/2-1) : list.get(N/2);
    long ans = 0;
    for(int i = 0; i < N; i++){
      ans += Math.abs(A[i] - (b+i+1));
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 67032
/*Author - Shubham Gupta (@shubham107)*/
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<ll> vl;      typedef vector<int> vi;
typedef vector<vl> vvl;     typedef vector<vi> vvi;
typedef pair<ll, ll> pll;   typedef pair<int, int> pii;
#define forn(i,n) for(int i=0;i<n;i++)
#define rforn(i,n) for(int i=n-1;i>=0;i--)
#define forne(i,n) for(int i=1;i<=n;i++)
#define forse(i,s,e) for(int i=s;i<e;i++)
#define rforse(i,s,e) for(int i=e-1;i>=s;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define MOD 1000000007
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define fill(a,x) memset(a,x,sizeof a);
#define trav(a,x) for(auto &a:x)
#define INF ll(1e18)
#ifdef SHUBHAM107
#include "../trace.h"
#else
#define trace(args...)
#endif
void solve() {
    ll n;
    cin >> n;
    string ans;
    while(n) {
        n--;
        ans.push_back(char((n % 26) + 'a'));
        n /= 26;
    }
    reverse(all(ans));
    cout << ans;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
#ifdef SHUBHAM107
    freopen("inp.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    freopen("err.txt", "w", stderr);
#endif
    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }
}


Measured memory_bytes: 3652
#include<iostream>
#include<vector>
#include<cmath>
#include<limits.h>
#include<algorithm>
#include<cstring>
using namespace std;

const long long inf=1e12;

int main()
{
  int n,t;
  cin>>n>>t;
  long long pricesum=0;
  
  vector<int> w(n),p(n);
  for(int i=0;i<n;i++)
  {
    cin>>w[i]>>p[i];
    pricesum+=p[i];
  }
  vector<long long> dp(pricesum+1,inf);
  
  
  dp[0]=0;
  for(int i=1;i<=n;i++)
  {
    for(int j=pricesum;j>=p[i-1];j--)
    {
        dp[j]=min(w[i-1]+dp[j-p[i-1]],dp[j]);      
  	}
    
  }
    long long ans=LLONG_MIN;
    long long ansprice=0;
    for(int j=1;j<=pricesum;j++)
      {
          if((dp[j]<=t)&&(ans+dp[j]>ans))
          {
              ans=ans+dp[j];
              ansprice=j;
          }
          
          
      }
    
  cout<<ansprice<<endl;
  return 0;
}


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

using namespace std;

int main(){
  int n, x;
  cin >> n >> x;
  cin.ignore();

  int l[n] = {0};

  int cnt = 1;
  int dist = 0;

  for (int i = 0; i < n; i++){
    cin >> l[i];
    dist += l[i];
    if(dist <= x){
      ++cnt;
    } else {
      break;
    }
  }

  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
def main():
    array = list(map(int, input().split()))

    now = array[0]*60+array[1]
    finish = array[2]*60+array[3]

    sa = finish - now
    K = array[4]
    ans = 0
    for _ in range(int(1e15)):
        if now + K < finish:
            ans += 1
        else:
            break
        now += 1

    print(ans)


if __name__ == '__main__':
    main()


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

int main()
{
	string s,t;
	
	std::cin >> s>>t;
	list<char> slist;
	list<char> tlist;
	for (char c : s)slist.push_back(c);
	for (char c : t)tlist.push_back(c);

	slist.sort();
	tlist.sort(std::greater<char>());
	string rslt = "";

	auto sitr = slist.begin();
	auto titr = tlist.begin();

	while (sitr != slist.end() && titr != tlist.end()) {
		if (*sitr > *titr) {
			rslt = "No";
			break;
		}
		if (*sitr < *titr) {
			rslt = "Yes";
			break;
		}
		sitr++;
		titr++;
	}
	if (rslt != "No"&&rslt !="Yes") {
		if (slist.size() < tlist.size()) {
			rslt = "Yes";
		}
		else {
			rslt = "No";
		}
	}
	cout << rslt;


	return 0;
}


Measured memory_bytes: 768
#!/usr/bin/env python
# coding: utf-8

# In[76]:


import numpy as np
H, W = map(int, input().split())
S = np.array([list(input()) for i in range(H)])
"""
8 8
..#...#.
....#...
##......
..###..#
...#..#.
##....#.
#...#...
###.#..#
"""


# In[84]:


field = np.ones((H, W))
field[S=='#'] = 0
lm, rm, um, dm = (field.copy() for _ in [0]*4)
#print(field)
#print(lm)
#print(rm)
#print(um)
#print(dm)


# In[87]:


#np.where()
for i in range(1, H):
    um[i] = (um[i-1]+1) * field[i]
    dm[-1-i] = (dm[-i]+1) * field[-1-i]
    
for i in range(1, W):
    lm[:, i] = (lm[:, i-1]+1) * field[:, i]
    rm[:, -1-i] = (rm[:, -i]+1) * field[:, -1-i]
    #print(rm)


# In[88]:


#print(field)
#print(um)
#print(dm)
#print(lm)
#print(rm)
print(int(np.max(um+dm+lm+rm)-3))


# In[ ]:






Measured memory_bytes: 266668
import java.util.Scanner;

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

        StringBuilder sb = new StringBuilder();
        sb.append(String.valueOf(str1.charAt(0)));
        sb.append(String.valueOf(str2.charAt(1)));
        sb.append(String.valueOf(str3.charAt(2)));

        System.out.println(sb.toString());
        sc.close();
    }

}


Measured memory_bytes: 21844
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<queue>
#include<set>
#include<map>
#include<stack>
#include<bitset>

#define pb push_back
#define mp make_pair

using namespace std;

template<typename T>inline void upmin(T &x,T y) { y<x?x=y:0; }
template<typename T>inline void upmax(T &x,T y) { x<y?x=y:0; }

typedef unsigned int u32;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double lod;
typedef pair<int,int> PR;
typedef vector<int> VI;

const lod pi=acos(-1);
const int oo=1<<30;
const LL OO=1e18;

const int N=1e5+100;

int gi() {
	int w=0;bool q=1;char c=getchar();
	while ((c<'0'||c>'9') && c!='-') c=getchar();
	if (c=='-') q=0,c=getchar();
	while (c>='0'&&c <= '9') w=w*10+c-'0',c=getchar();
	return q? w:-w;
}

int fa[N];inline int find(int x) { return fa[x]==x?x:fa[x]=find(fa[x]); }
int main()
{
	int n=gi(),m=gi(),i,a=0,b=0,k;
	for (i=1;i<=n;i++) fa[i]=i;
	for (i=1;i<=m;i++) fa[find(gi())]=find(gi());
	for (i=1;i<=n;i++) a+=find(i)==find(1),b+=find(i)==find(2);
	k=a<b?fa[1]:fa[2];
	for (i=1,a=b=0;i<=n;i++) find(i)==k?a++:b++;
	cout<<1LL*n*(n-1)/2-m-1LL*a*b<<endl;
	return 0;
}


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

def main():
  n = int(input())
  la = [int(input()) for _ in range(n)]
  cnt = 0
  
  if la[0] != 0:
    print(-1)
    return
  for i in range(n-1):
    if la[i+1] > la[i] + 1:
      print(-1)
      return
    
  for i in range(n)[::-1]:
    if i+1 < n and la[i]+1 == la[i+1]:
      continue
    else:
      cnt += la[i]
  print(cnt)
    
if __name__=='__main__':
  main()



Measured memory_bytes: 17032
#include <stdio.h>
#include<math.h>
int main(void){
   
  int n,m;
    
  scanf("%d",&n);
  
  int a[n];
  int cnt[200001]={};
  int i;
  
  for(i=1;i<n;i++)
  {
    scanf("%d",&a[i]);
    cnt[a[i]-1]++;
  }
  
  for(i=0;i<n;i++)
  {
    printf("%d\n",cnt[i]);
  }
  
    return 0;
}


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

int n;
int a[100010];
long long sum[100010];

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

    // 偶数項が正
    long long cnt1 = 0;
    sum[0] = a[0];
    while(sum[0]<=0){
        sum[0]++;
        cnt1++;
    }

    for (int i = 1; i < n; i++)
    {
        sum[i] = sum[i-1] + a[i];
        if(i%2 == 0){
            while(sum[i]<=0){
                sum[i]++;
                cnt1++;
            }
        } else {
            while(sum[i]>=0){
                sum[i]--;
                cnt1++;
            }
        }
    }
    



    // 奇数項が正、偶数項が負
    long long cnt2 = 0;
    sum[0] = a[0];
    
    while(sum[0]>=0){
        sum[0]--;
        cnt2++;
    }

    for (int i = 1; i < n; i++)
    {
        sum[i] = sum[i-1] + a[i];
        if(i%2 == 1){
            while(sum[i]<=0){
                sum[i]++;
                cnt2++;
            }
        } else {
            while(sum[i]>=0){
                sum[i]--;
                cnt2++;
            }
        }
    }

    long long cnt = min(cnt1,cnt2);

    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 1408
#pragma region Macros
#include <bits/stdc++.h>

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())
#define IN(x, a, b) x >= a and x < b

using namespace std;
using ll = long long;

template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T> constexpr T INF = numeric_limits<T>::max() / 2;
#pragma endregion

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

  int a, b, x;
  cin >> a >> b >> x;

  constexpr double pi = 3.141592653589793;
  double ok = 0;
  double ng = pi / 2;
  REP(i, 10000000) {
    double mid = (ok + ng) / 2;

    double h = a * tan(mid);
    double V = 0;
    if (h < b) {
      V += a * a * h / 2;
      double h2 = b - h;
      V += h2 * a * a;
    } else {
      double a2 = b * tan(pi / 2 - mid);
      V += a * a2 * b / 2;
    }
    if (V > x) {
      ok = mid;
    } else {
      ng = mid;
    }
  }
  printf("%.10lf\n", ok * 180 / pi);

  return 0;
}

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

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define REPRl(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < (int)n; i++)
#define FORl(i, m, n) for(ll i = m; i < (ll)n; i++)
#define ALL(v) v.begin(), v.end()
ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}

int main() {
  int x,a;cin>>x>>a;
  cout << (x<a?0:10) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ll          long long
#define pb          push_back
#define INF         9223372036854775807
#define    endl        '\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        998244353
#define rep(i,a,b)    for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define lower(u)    transform(u.begin(), u.end(), u.begin(), ::tolower);//convert string u to lowercase;
#define upper(u)    transform(u.begin(), u.end(), u.begin(), ::toupper);
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
using namespace std;

using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define N  200005

//lazy for addition and minimum
ll inv[N],suminv[N];
ll expo(ll base,ll exponent,ll mod){
    ll ans=1;
    while(exponent!=0){
        if(exponent&1) ans=(ans*base)%mod;
        base=(base*base)%mod;
        exponent>>=1;
    }
    return ans%mod;
}
vi a(N),seg(4*N),lazy(4*N);
void push(ll n,ll l,ll r)
{
    if(lazy[n]==0)
        return;
    ll mid=(l+r)/2;
    seg[2*n]=(lazy[n]*((suminv[l]-suminv[mid+1]+hell)%hell))%hell;
    seg[2*n+1]=(lazy[n]*((suminv[mid+1]-suminv[r+1]+hell)%hell))%hell;
    lazy[2*n+1]=lazy[n];
    lazy[2*n]=lazy[n];
    lazy[n]=0;
}
void build(ll n,ll l,ll r)
{
    if(l==r)
    {
        a[l]=inv[l];
        seg[n]=inv[l];
        return;
    }
    ll mid=(l+r)>>1;
    build(2*n,l,mid);
    build(2*n+1,mid+1,r);
    seg[n]=(seg[2*n]+seg[2*n+1])%hell;

}
void update(ll n,ll l,ll r,ll low,ll high,ll val)
{
    if(l>high||low>r)
        return;
    if(low<=l&&r<=high)
    {
        seg[n]=(((suminv[l]-suminv[r+1]+hell)%hell)*val)%hell;
        lazy[n]=val;
        return;
    }
    push(n,l,r);
    ll mid=(l+r)>>1;
    update(2*n,l,mid,low,high,val);
    update(2*n+1,mid+1,r,low,high,val);
    seg[n]=(seg[2*n]+seg[2*n+1])%hell;
}
ll query(ll n,ll l,ll r,ll low,ll high)
{
    if(l>high||low>r)
        return INF;
    if(low<=l&&r<=high)
    {
        return seg[n];
    }
    push(n,l,r);
    ll mid=(l+r)>>1;
    return (query(2*n,l,mid,low,high)+query(2*n+1,mid+1,r,low,high))%hell;
    
}
void solve()
{
    ll n,q;
    cin>>n>>q;
    rep(i,1,n+1)
    {
        inv[i]=expo(10,n-i,hell);
    }
    for(int i=n;i>=1;i--)
    {
        suminv[i]=(suminv[i+1]+inv[i])%hell;
    }
    build(1,1,n);
    while(q--)
    {
        ll l,r,d;
        cin>>l>>r>>d;
        update(1,1,n,l,r,d);
        cout<<query(1,1,n,1,n)<<endl;
    }

}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int TESTS=1;
//    cin>>TESTS;
    while(TESTS--)
    {
        solve();
    }
    time
    return 0;
}

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

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> II;
typedef vector<II> VII;

#define REP(x, n) for (int x = 0; x < (n); ++x)
#define INF (1e9 + 1)
#define EPS 1e-9
#define PB push_back
#define MP make_pair
#define F first
#define S second

int main() {
    
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    int n;
    cin >> n;
    VI v(n);
    REP (i, n) {
        cin >> v[i];
    }
    double isum = 0;
    for (int i : v) {
        isum += 1.0 / (double)i;
    }
    cout << fixed << setprecision(5) << 1.0 / isum << '\n';
    //printf("%.5lf\n", 1.0 / isum);
    return 0;
}

Measured memory_bytes: 256
// SPDX-License-Identifier: X11
// 2020-08-31
// Coprime (500pt)

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

#define MAX 1000005

bool *erato(uint_least32_t bound);

int main() {
  uint_least32_t N;
  scanf("%u\n", &N);

  bool *P = erato(MAX);
  uint_least32_t *Ap = calloc(MAX, sizeof(uint_least32_t));

  bool set = true;
  bool pair = true;

  uint_least8_t s;
  uint_least32_t A, i, j;
  for (i = 0; i < N; i++) {
    scanf("%u", &A);

    if (A == 1) {
      continue;
    }

    if (P[A]) {
      if (Ap[A])
        pair = false;
      Ap[A]++;

      if (Ap[A] == N)
        set = false;

      continue;
    }

    if (!(A & 1)) {
      if (Ap[2])
        pair = false;
      Ap[2]++;

      if (Ap[2] == N)
        set = false;

      while (!(A & 1))
        A >>= 1;

      if (A == 1) {
        continue;
      }

      if (P[A]) {
        if (Ap[A])
          pair = false;
        Ap[A]++;

        if (Ap[A] == N)
          set = false;

        continue;
      }
    }

    if (!(A % 3)) {
      if (Ap[3])
        pair = false;
      Ap[3]++;

      if (Ap[3] == N)
        set = false;

      while (!(A % 3))
        A /= 3;

      if (A == 1) {
        continue;
      }

      if (P[A]) {
        if (Ap[A])
          pair = false;
        Ap[A]++;

        if (Ap[A] == N)
          set = false;

        continue;
      }
    }

    for (j = 5, s = 2; j * j <= A; j += s, s = 6 - s)
      if (!(A % j)) {
        if (Ap[j])
          pair = false;
        Ap[j]++;

        if (Ap[j] == N)
          set = false;

        while (!(A % j))
          A /= j;

        if (A == 1) {
          break;
        }

        if (P[A]) {
          if (Ap[A])
            pair = false;
          Ap[A]++;

          if (Ap[A] == N)
            set = false;

          break;
        }
      }
  }

  if (pair)
    printf("pairwise coprime\n");
  else if (set)
    printf("setwise coprime\n");
  else
    printf("not coprime\n");

  free(P);
  free(Ap);
}

bool *erato(uint_least32_t bound) {
  if (!bound)
    return NULL;

  bool *array = calloc(bound, sizeof(bool));
  uint_least32_t i,j;
  uint_least8_t s,ss;

  if (bound < 3)
    return array;
  array[2] = true;

  if (bound < 4)
    return array;
  array[3] = true;

  if (bound < 5)
    return array;

  for (i = 5, s = 2; i < bound; i += s, s = 6 - s)
    array[i] = true;

  for (i = 5, s = 2; i < bound; i += s, s = 6 - s)
    if (array[i])
      for (j = i, ss = s; i * j < bound; j += ss, ss = 6 - ss)
        array[i * j] = false;

  return array;
}


Measured memory_bytes: 6292
import java.util.*

class Scanner(`in`: java.io.InputStream) {
    private val reader = java.io.BufferedReader(java.io.InputStreamReader(`in`))
    private var tokenizer: StringTokenizer? = null

    fun next(): String {
        if (tokenizer?.hasMoreTokens() != true) {
            tokenizer = StringTokenizer(reader.readLine())
        }
        return tokenizer!!.nextToken()
    }

    fun nextLine(): String {
        return if (tokenizer?.hasMoreTokens() != true) {
            reader.readLine()
        } else tokenizer!!.nextToken("\n")
    }
}

fun main(args: Array<String>) {
    val pw = java.io.PrintWriter(System.out)
    Problem.solve(Scanner(System.`in`), pw)
    pw.flush()
}

////////////////////////////////////////////////////////////////////////

object Problem {
    fun solve(sc: Scanner, pw: java.io.PrintWriter) {
        val S = sc.next()
        pw.println(if (S == "ABC") "ARC" else "ABC")
    }
}


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

public class Main {

  public static void main(String[] args) throws Exception {
    try (final var stdin = new InputStreamReader(System.in);
         final var br = new BufferedReader(stdin)) {
      final var a = Integer.parseInt(br.readLine());
      final var b = Integer.parseInt(br.readLine());
      final var h = Integer.parseInt(br.readLine());

      System.out.println((a + b) * h / 2);
    }
  }
}


Measured memory_bytes: 32408
#include <stdio.h>

int main()
{
    int n;
    int c;
    int p;
    int sum = 0;
    int ans;
    int i;
    
    scanf("%d%d", &n, &c);
    for(i = 0; i < c; i++)
    {
        scanf("%d", &p);
        sum = sum + p;
    }
    
    if(sum % (n + 1) > 0)
    {
        ans = sum / (n + 1) + 1;
    }
    else
    {
        ans = sum / (n + 1);
    }
    
    printf("%d\n", ans);
}


Measured memory_bytes: 2112
#include <iostream>
using namespace std;
int main(void){
  int N;
  cin >> N;
  
  int ans = 1;
  
  for(int i=1;i<=N;i++){
    for(int j=1;j<=i;j++){
      if(i == j * j)
        ans = i;
      if(i == j * j * j)
        ans = i;
      if(i == j * j * j * j)
        ans = i;
      if(i == j * j * j * j * j)
        ans = i;
      if(i == j * j * j * j * j * j)
        ans = i;
      if(i == j * j * j * j * j * j * j)
        ans = i;
      if(i == j * j * j * j * j * j * j * j)
        ans = i;
      if(i == j * j * j * j * j * j * j * j * j)
        ans = i;
    }
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define eb emplace_back
#define pb push_back
#define lb(v,k) lower_bound(all(v),k)-v.begin()
#define chmin(x,y) if(x>y)x=y
#define chmax(x,y) if(x<y)x=y
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll,vector<ll>,greater<ll>> SPQ;
using vi=vector<ll>;
using vvi=vector<vector<ll>>;
using vc=vector<char>;
using vvc=vector<vector<char>>;
ll inf=100100100100;
const int mod=1000000007;
int main(){
   int n,w;cin>>n>>w;w--;
   vvi dp(n,vi(w+1));
   vi omosa(n),kachi(n);
   rep(i,n)cin>>omosa[i]>>kachi[i];
   rep(i,n){
      rep(j,w+1){
         if(j>=omosa[i]){
            dp[i][j]=kachi[i];
            if(i>0){
               chmax(dp[i][j],dp[i-1][j-omosa[i]]+kachi[i]);
               chmax(dp[i][j],dp[i-1][j]);
            }
         }
         else{
            if(i>0)dp[i][j]=dp[i-1][j];
         }
      }
   }
  reverse(all(omosa));
  reverse(all(kachi));
  vvi dp2(n,vi(w+1));
  rep(i,n){
      rep(j,w+1){
         if(j>=omosa[i]){
            dp2[i][j]=kachi[i];
            if(i>0){
               chmax(dp2[i][j],dp2[i-1][j-omosa[i]]+kachi[i]);
               chmax(dp2[i][j],dp2[i-1][j]);
            }
         }
         else{
            if(i>0)dp2[i][j]=dp2[i-1][j];
         }
      }
   }
  ll ans=0;
  rep(k,w+1)chmax(ans,max(dp[n-2][w-k]+kachi[0],dp2[n-2][k]+kachi[n-1]));
   REP(i,1,n-1)rep(k,w+1)chmax(ans,dp[n-i-2][w-k]+dp2[i-1][k]+kachi[i]);
  cout<<ans<<endl;
}

Measured memory_bytes: 141184
N = int(input())
G = [[] for i in range(N)]
for i in range(N-1):
    s, t, w = map(int, input().split())
    G[s].append((t, w))
    G[t].append((s, w))

from collections import deque
def bfs(s):
    dist = [None]*N
    que = deque([s])
    dist[s] = 0
    while que:
        v = que.popleft()
        d = dist[v]
        for w, c in G[v]:
            if dist[w] is not None:
                continue
            dist[w] = d + c
            que.append(w)
    d = max(dist)
    return dist.index(d), d
u, _ = bfs(0)
v, d = bfs(u)

print(d)



Measured memory_bytes: 41952
n, m = map(int, input().split())
ans = [0] * (n + 1)
import collections
g = collections.defaultdict(set)

for _ in range(m):
    a, b = map(int, input().split())
    g[a-1].add(b-1)

def minCircle(s):
    f = [None] * n
    visited = set()
    q = []
    q.append(s)
    while q:
        node = q.pop()
        for nei in g[node]:
            if nei not in visited:
                f[nei] = node
                visited.add(nei)
                q.append(nei)
        if s in visited:
            break
    p = f[s]
    ret = []
    ret.append(s)
    while p is not None and p!= s:
        ret.append(p)
        p = f[p]
    return ret

for i in range(n):
    t = minCircle(i)
    if len(t) > 1 and len(t) < len(ans):
        ans = t
if len(ans) == n + 1:
    print(-1)
else:
    print(len(ans))
    for i in ans:
        print(i+1)


Measured memory_bytes: 47976
/*input
8
0 1
0 2
0 3
2
0 4
1 0
1 1
1 2
*/
fn read_line() -> String {
    let mut return_ = format!("");
    std::io::stdin().read_line(&mut return_).ok();
    return_
}

fn main() {
    let q: u64 = read_line().trim().parse().expect("");
    let mut v: Vec<i64> = vec![];
    let mut v_q: Vec<i64>;
    for _ in 0..q {
        v_q = read_line()
            .trim()
            .split_whitespace()
            .map(|x| x.parse().expect(""))
            .collect();
        if v_q[0] == 0 {
            v.push(v_q[1]);
        } else if v_q[0] == 1 {
            println!("{}", v[v_q[1] as usize]);
        } else if v_q[0] == 2 {
            v.pop();
        }
    }
}



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

using namespace std;

#define ll long

int main()
{
    int n;
    cin >> n;
    int* seive =new int[n+1];
    for(int i=2;i<=n;i++)
    {
        for(int j=i;j<=n;j+=i)
            seive[j]++;
    }
    ll ans=1;
    for(int k=2;k<=n;k++)
    {
        //cout << k << " " << seive[k] << endl;
        ans+=k*((ll)seive[k]+1);
    }
    cout << ans << endl;
}


//838627288460105


Measured memory_bytes: 42676
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
using namespace std;
#define ll long long;
int main(){
ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
long n;
cin>>n;
int m=n%1000;
if(m==0){
   cout<<"0"<<endl;
}else{
   cout<<1000-m<<endl;
}
return 0;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define  boost ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ull unsigned long long
#define deb(x) cout<<#x<<" "<<x<<endl;
#define deb2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define deb2l(x,y,i) cout<<#x<<i<<" "<<x<<" "<<#y<<i<<" "<<y<<endl;

#define fr(i,l,r) for(ll i=l;i<r;i++)
#define mems(a,x) memset(a,x,sizeof(a))
#define mod 1000000007
#define ff first
#define ss second
#define pb(x) push_back(x)
#define vll vector<ll>
#define pbp(x,y) push_back(make_pair(x,y))
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void solve(){
    ll h,a;
    cin>>h>>a;
    ll ans=h/a;
    if(h%a!=0)
    ans++;
    cout<<ans;


}

int main(){
    ll t=1;
//cin>>t;
    while(t--){
     solve();
     cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 256