akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef complex<double> P;
typedef pair<P,P> L;

const double INF = 1e+8;
const double EPS = 1e-8;

double dot(P a, P b){ return real(conj(a)*b);}
double cross(P a, P b){ return imag(conj(a)*b);}

int ccw(P a, P b, P c){
  b -= a;
  c -= a;
  if(cross(b,c) > EPS) return 1;
  if(cross(b,c) < -EPS) return -1;
  if(dot(b,c) < -EPS) return 2;
  if(norm(b) < norm(c)) return -2;
  return 0;
}

double getDistanceSP(L s, P p){
  if(dot(s.second - s.first, p - s.first) < -EPS) return abs(p - s.first);
  if(dot(s.first - s.second, p - s.second) < -EPS) return abs(p - s.second);
  return abs(cross(s.second - s.first, p - s.first) / abs(s.second - s.first));
}


int n[2];
P v[2][55];

void solve(){
  double res = INF;

  for(int i=0;i<n[0];i++){
    for(int j=0;j<n[1];j++){
      if(i < n[0] - 1) res = min(res, getDistanceSP(L(v[0][i],v[0][i+1]),v[1][j]));
      if(j < n[1] - 1) res = min(res, getDistanceSP(L(v[1][j],v[1][j+1]),v[0][i]));
    }
  }

  printf("%.10f\n",res);
}

int main(){
  while(cin >> n[0]){
    double x,y;
    for(int j=0;j<2;j++){
      if(j == 1) cin >> n[j];
      n[j] += 2;
      for(int i=1;i<n[j]-1;i++) {
        cin >> x >> y;
        v[j][i] = P(x,y);
      }
    }
    v[0][0] = P(0,0);
    v[0][n[0]-1] = P(1000,0);
    v[1][0] = P(0,1000);
    v[1][n[1]-1] = P(1000,1000);    
    solve();
  }
}

Measured memory_bytes: 1272
#include <bits/stdc++.h>
#define reg register

using namespace std;

typedef long long ll;
const int maxn = 100005;

inline ll read() {
    reg ll s = 0, t = 0; reg char ch = getchar();
    while (!isdigit(ch)) t |= ch == '-', ch = getchar();
    while (isdigit(ch)) s = (s << 1) + (s << 3) + (ch ^ 48), ch = getchar();
    return t ? -s : s;
}

int main() {
    int a, b;
    cin >> a >> b;
    reg int ans = 0, res = 1;
    while (res < b) {
        res += a - 1;
        ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n;
int ttime[600];
int beginn[600];
int loop[600];
void judge(int now) {
	int re=0;
	while(now!=n-1) {
		if((re-beginn[now])%loop[now]==0&&re-beginn[now]>=0) {
			re+=ttime[now];
			now++;
		} else 	re++;
	}
	printf("%d\n",re);
}
int main() {
	scanf("%d",&n);
	for(int i=0; i<n-1; i++)
		scanf("%d%d%d",&ttime[i],&beginn[i],&loop[i]);
	for(int i=0; i<n-1; i++)
		judge(i);
	puts("0");
	return 0;
}

Measured memory_bytes: 384
use std::io::*;
use std::str::*;

fn read<T: FromStr>(s: &mut StdinLock) -> T {
    let s = s.by_ref().bytes().map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.parse::<T>().ok().unwrap()
}

fn main() {
    let s = stdin();
    let mut s = s.lock();
    let s = &mut s;

	let n = read::<usize>(s);
	let mut cnt: usize = 0;
	let mut exists = false;
	for _i in 0..n {
		let x1 = read::<usize>(s);
		let x2 = read::<usize>(s);
		if x1 != x2 {
			cnt = 0;
		} else {
			cnt += 1;
			if cnt == 3 {
				exists = true;
				break;
			}
		}
	}
	if exists {
		println!("Yes");
	} else {
		println!("No");
	}
	
}



Measured memory_bytes: 2112
#include <stdio.h>
  
int main()
{
  
  int a, b, r, tmp;
  
  scanf("%d %d",&a,&b);
  
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
  
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  
  printf("%d\n", b);
  
  return 0;
}

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

#define rep(i,n) for(ll (i)=0;(i)<(ll)(n);(i)++)
#define rept(i,n) for(ll (i)=0;(i)<=(ll)(n);(i)++)
#define reps(i,s,n) for(ll (i)=(s);(i)<(ll)(n);(i)++)
#define repst(i,s,n) for(ll (i)=(s);(i)<=(ll)(n);(i)++)
#define repr(i,n) for(ll (i)=(n);(i)>=0;(i)--)
#define each(itr,v) for(auto (itr):(v))
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp(x,y) make_pair((x),(y))
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define dbg(x) cout<<#x" = "<<(x)<<ln

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int> > mat;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int inf = (int)1e9;
const ll linf = (ll)1e18;
const int mod = (int)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ????????????????????\????????????????????\????????????????????\????????????????????\????????????????????\????????????????????\????????????????????\????????????????????\????????????????????\???
// .???.:( ^??^)?????????.???.:( ^??^)?????????.???.:( ^??^)?????????.???.:( ^??^)?????????.???.:( ^??^)?????????
// ?????\????????????????????\????????????????????\????????????????????\????????????????????\????????????????????\????????????????????\????????????????????\????????????????????\??????????????????

ll n, v, a[1000], b[1000], c[1000], d[1000], ps[1000000], r;

int main() {
	cin >> n >> v;
	rep(i,n) cin >> a[i];
	rep(i,n) cin >> b[i];
	rep(i,n) cin >> c[i];
	rep(i,n) cin >> d[i];
	rep(i,n) rep(j,n) ps[i*n+j] = a[i] + b[j];
	sort(ps, ps+n*n);
	rep(i,n) rep(j,n) {
		ll t = c[i] + d[j];
		if (t<v) r += upper_bound(ps, ps+n*n, v-t) - lower_bound(ps, ps+n*n, v-t);
	}
	cout << r << ln;
}

Measured memory_bytes: 11068
while True:
    n, x = map(int, input().split())
    num = 0
    
    if n == x == 0:
        break
        
    for i in range(1, n + 1):
        for j in range(1, i):
            for k in range(1, j):
                    if i + j + k == x:
                        num += 1
                                    
    print(num)


Measured memory_bytes: 5596
#include <iostream>
#include <string>
using namespace std;
int main()
{
    string stra, strb, strc;
    cin >> stra >> strb >> strc;
    int numa = 0, numb = 0, numc = 0;
    int enda = stra.length(),endb = strb.length(), endc = strc.length();
    int turn = 0,num=0;
    string next;
    string a = "a";
    string b = "b";
    string c = "c";
    for(;;){
        if(turn == 0){
            if(numa>=enda){
                cout << "A" << endl;
                return 0;
            }else{
                next = stra.substr(numa,1);
                numa ++;
            }
        }else if(turn == 1){
            if(numb>=endb){
                cout << "B" << endl;
                return 0;
            }else{
                next = strb.substr(numb,1);
                numb ++;
            }
        }else{
            if(numc >=endc){
                cout << "C" << endl;
                return 0;
            }else{
                next = strc.substr(numc,1);
                numc ++;
            }
        }

        if(next.compare(0,1,a)==0){
            turn = 0;
        }else if(next.compare(0,1,b)==0){
            turn = 1;
        }else{
            turn = 2;
        }

    }
}

Measured memory_bytes: 888
#include <stdio.h>
#define N 100
int main(void){
  int n,i,j,c=0,s,f[N],flag=1,t,x;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&f[i]);
  }
  while(flag){
    flag=0;
    for(j=n-1;j>=1;j--){
      if(f[j]<f[j-1]){
	s=f[j-1];
	f[j-1]=f[j];
	f[j]=s;
	c++;
	flag=1;
      }
    }
  }
  for(i=0;i<n-1;i++){
    printf("%d ",f[i]);
  }
  printf("%d\n",f[n-1]);
  printf("%d\n",c);
  return 0;
}



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



int main()
{
  int n,k;cin>>n>>k;
  ll res=0;
  for(int i=0;i<n;i++)
    {
      int x;cin>>x;
      res+=2*min(x,k-x);
    }
  cout<<res<<endl;
  return 0;
}


Measured memory_bytes: 256
import sys

input=sys.stdin.readline

N,K=map(int,input().split())
A=list(map(int,input().split()))
F=list(map(int,input().split()))

A.sort()
F.sort(reverse=True)

def condition(num):
    count=0
    goal=[num//F[i] for i in range(N)]
    for i in range(0,N):
        if A[i]>goal[i]:
            count+=A[i]-goal[i]
    return K>=count

start=0
end=2*(10**17)
while end-start>1:
    test=(end+start)//2
    if condition(test):
        end=test
    else:
        start=test

if condition(start):
    print(start)
else:
    print(end)

Measured memory_bytes: 137404
// 2015/01/05 Tazoe

#include <iostream>
#include <stack>
using namespace std;

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

	int G[100][100] = {0};

	for(int i=0; i<n; i++){
		int u, k;
		cin >> u >> k;

		for(int j=0; j<k; j++){
			int v;
			cin >> v;

			G[u-1][v-1] = 1;
		}
	}

//	for(int i=0; i<n; i++){
//		for(int j=0; j<n; j++){
//			cout << G[i][j] << ' ';
//		}
//		cout << endl;
//	}

	int d[100] = {0};
	int f[100] = {0};

	stack<int> S;
	int T = 0;

	for(int i=0; i<n; i++){
		if(d[i]!=0)
			continue;

		S.push(i);
		d[i] = ++T;

		while(!S.empty()){
			int u = S.top();

			int v = -1;
			for(int j=0; j<n; j++){
				if(G[u][j]==1 && d[j]==0){
					v = j;
					break;
				}
			}

			if(v!=-1){
				S.push(v);
				d[v] = ++T;
			}
			else{
				S.pop();
				f[u] = ++T;
			}
		}
	}

	for(int i=0; i<n; i++){
		cout << i+1 << ' ' << d[i] << ' ' << f[i] << endl;
	}

	return 0;
}

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

long modpow(long a, long n, long mod){
	if (n == 0) {
		return 1;
	}
	long answer;
	if (n%2 == 0) {
		answer = modpow(a, n/2, mod);
		answer *= answer;
	} else {
		answer = modpow(a, n-1, mod);
		answer *= a;
	}
	answer %= mod;
	return answer;
}

int main(void) {

  long n,a,b,k;
  scanf("%ld %ld %ld %ld", &n, &a, &b, &k);
  long mod = 998244353;
  long *combination_list;
  combination_list = (long *)malloc(sizeof (long) * n+1);
  combination_list[0] = 1;
  for (long i = 1; i <= n; i++) {
    combination_list[i] = combination_list[i-1]*(n+1-i);
    combination_list[i] %= mod;
    combination_list[i] *= modpow(i,mod-2,mod);
    combination_list[i] %= mod;
  }
  long unit_a,unit_b;
  long count;
  long sum = 0;
  for (long i = 0; i <= n; i++) {
    unit_a = i;
    if (unit_a*a > k) {
      break;
    }
    if ((k-unit_a*a)%b != 0) {
      continue;
    }
    unit_b = (k-unit_a*a)/b;
    if (unit_b > n) {
      continue;
    }
    count = combination_list[unit_a];
    count *= combination_list[unit_b];
    count %= mod;
    sum += count;
    sum %= mod;
  }
  printf("%ld\n", sum);

  return 0;
}

Measured memory_bytes: 2560
import sys
MOD = 10 ** 9+7
input = sys.stdin.readline
def ii(): return int(input())
def mi(): return map(int, input().rstrip().split())
def lmi(): return list(map(int, input().rstrip().split()))
def li(): return list(input().rstrip())
# template


X, t = mi()
print(max(X-t,0))


Measured memory_bytes: 2940
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using static System.Console;
using static System.Math;

class Program
{
    static void Main()
    {
        var AB = ReadLine().Split().Select(int.Parse).ToArray();
        var A = AB[0];
        var B = AB[1];
        WriteLine(Max(A - B * 2, 0));
    }
}


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

int main()
{
	int a, b, g;
	cin >> a >> b >> g;
	
	double gg = (g*1.0)/(a*1.0);
	double pi = acos(-1);
	double ggg = (g*1.0)/(a*1.0)/(a*1.0);
	//cout << atan(1/1.732)*180/pi << "\n";
	if (ggg <= b/2)
	{
		double x = gg*2/b;
		double j = sqrt(b*b+x*x); 
		double ff = atan(x/b)*180/pi;
		cout<<setprecision(10) << 90-ff << "\n";
	}
	else
	{
		double qq = (b-ggg)*2;
		double j = sqrt(qq*qq+(a*1.0)*(a*1.0)); 
		double ff = atan(a/qq)*180/pi;
		//cout << qq << ' ' << x << ' ' << j << ' ' << ff << "\n";
		cout<<setprecision(10)<< 90-ff << "\n";
	}
} 

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

using namespace std;

#define SZ(x) (int)(x.size())

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

int cnt(int n) {
  int res = 0;
  while(n > 0) {
    res += n % 2;
    n /= 2;
  }
  return res;
}

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

  int n; cin >> n;
  vi v(1<<20);
  for(int i=0;i<n;++i) {
    int a; cin >> a;
    v[a]++;
  }

  for(int i=0;i<20;++i) {
    for(int j=0;j<(1<<20);++j) {
      if((j>>i)&1) {
        v[j-(1<<i)] += v[j];
      }
    }
  }

  vll po(n);
  po[0] = 1;
  for(int i=0;i<n;++i) {
    po[i+1] = po[i] * 2 % MOD;
  }

  ll ans = 0;
  for(int i=0;i<(1<<20);++i) {
    if(cnt(i) % 2 == 0) {
      ans += po[v[i]];
      ans %= MOD;
    } else {
      ans += MOD - po[v[i]];
      ans %= MOD;
    }
  }
  cout << ans << endl;

}



Measured memory_bytes: 7728
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <algorithm>
#include <climits>
#define endl "\n"
#define ll long long
using namespace std;

int main()
{
	string str;
	cin >> str;

	if(str == "ABC")
		cout << "ARC" << endl;
	else
		cout << "ABC" << endl;

}

Measured memory_bytes: 3596
#include<cstdio>
#include<queue>
#include<utility>
#include<cstring>
#include<stack>
#include<algorithm>
#include<cmath>
#include<iostream>
#include<map>
#define MAX_N 100001
#define INF_INT 2147483647
#define INF_LL 9223372036854775807
#define REP(i,n) for(int i=0;i<(int)(n);i++)
void init(int n);
int find(int n);
void unite(int x,int y);
bool same(int x, int y);
int dx[4] = {1,0,0,-1};
int dy[4] = {0,1,-1,0};
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
bool cmp_P(const P &a,const P &b){
  return a.second < b.second;
}
int main()
{
  int N,a,A=0,B=0;
  priority_queue<int, vector<int> > que;
  cin >> N;
  REP(i,N){
    cin >> a;
    que.push(a);
  }
  REP(i,N){
    if(que.empty())
      break;
    A += que.top();
    que.pop();
    if(que.empty())
      break;
    B += que.top();
    que.pop();
  }
  cout << A - B << endl;
  return 0;
}

int par[MAX_N];
int ranks[MAX_N];

//n要素で初期化
void init(int n){
  REP(i,n){
    par[i] = i;
    ranks[i] = 0;
  }

}

//木の根を求める
int find(int x){
  if(par[x] == x){
    return x;
  }else{
    return par[x] = find(par[x]);
  }
}

void unite(int x,int y){
  x = find(x);
  y = find(y);
  if(x == y) return ;
  if(ranks[x] < ranks[y]){
    par[x] = y;
  }else{
    par[y] = x;
    if(ranks[x] == ranks[y]) ranks[x]++;
  }
}

bool same(int x, int y){
  return find(x) == find(y);
}



Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int n;
	scanf("%d",&n);
	int a[n];
	int b[n];
	for(int i=0; i<n; i++){
		scanf("%d",&a[i]);
		b[i]=0;
	}
	
	for(int i=n; i>=1; i--){
		int sum=0;
		/*if((sum%2)==a[i-1]){
			printf("%d\n",sum);
			for(int j=1; j<=n; j++){
				int flg=0;
				if(a[j-1]==1){
					if(flg==0){	
						printf("%d",j);
						flg ++;
					}else{
						printf(" %d",j);
					}
				}
			}
		}*/
		for(int j=1; j<=(n/i); j++){
			sum+=b[j*i-1];
		}
		b[i-1]=(sum+a[i-1])%2;
	}
	
	int sum_b=0;
	for(int i=0; i<n; i++){
		sum_b+=b[i];
	}
	
	printf("%d\n",sum_b);
	
	for(int j=1; j<=n; j++){
		int flg=0;
		if(b[j-1]==1){
			if(flg==0){	
				printf("%d\n",j);

		}
	}
}
}

Measured memory_bytes: 2432
import java.util.*;

 
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    Integer a[] = new Integer[N];
    for(int i=0; i<N ;i++){
        a[i] = sc.nextInt();
    }
    Arrays.sort(a, Comparator.reverseOrder());
    int sum = 0;
    for(int k =0; k<K ;k++){
        sum += a[k];
    }
    System.out.println(sum); 
}
    
}


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

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

  string S, T; cin >> S >> T;
  ll ans = 0;
  for (ll i = 0; i < S.size(); i++) {
    if (S[i] != T[i]) ans++;
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 3792
#include<bits/stdc++.h>
using namespace std;
int n,x,y;
vector<int> g[2005];
int Ans[2005];
int dis[2005];
int main()
{
	scanf("%d%d%d",&n,&x,&y);
	for(int i=1;i<n;++i)g[i].push_back(i+1),g[i+1].push_back(i);
	g[x].push_back(y);g[y].push_back(x);
	for(int i=1;i<=n;++i)
	{
		memset(dis,0,sizeof(dis));
		queue<int> q;
		q.push(i);dis[i]=1;
		while(!q.empty())
		{
			int u=q.front();q.pop();
			for(int v:g[u])if(!dis[v])dis[v]=dis[u]+1,q.push(v);
		}
		for(int i=1;i<=n;++i)Ans[dis[i]-1]++;
	}
	for(int i=1;i<n;++i)printf("%d\n",Ans[i]/2);
}

Measured memory_bytes: 384
// Problem : D - Replacing
// Contest : AtCoder - AtCoder Beginner Contest 171
// URL : https://atcoder.jp/contests/abc171/tasks/abc171_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#define DEBUG fprintf(stderr, "Passing [%s] line %d\n", __FUNCTION__, __LINE__)
#define File(x) freopen(x".in","r",stdin); freopen(x".out","w",stdout)
#define int long long

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef pair <int, int> PII;
typedef pair <int, PII> PIII;

inline int gi()
{
    int f = 1, x = 0; char c = getchar();
    while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
    while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
    return f * x;
}

inline LL gl()
{
    LL f = 1, x = 0; char c = getchar();
    while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
    while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
    return f * x;
}

const int INF = 0x3f3f3f3f, N = 100003, M = N << 1;

int n, m;
int q;
int a[N], sum, ton[N];

signed main()
{
    //File("");
    n = gi();
    for (int i = 1; i <= n; i+=1)
    	a[i] = gi(), sum += a[i], ++ton[a[i]];
	q = gi();
	while (q--)
	{
		int b = gi(), c = gi();
		sum += (c - b) * ton[b];
		ton[c] += ton[b], ton[b] = 0;
		cout << sum << endl;
	}
    return 0;
}

Measured memory_bytes: 5192
import java.io.IOException;
import java.util.InputMismatchException;

public class Main {
	void run() {
		MyScanner sc = new MyScanner();

		int n = sc.nextInt();
		int pf = sc.nextInt();
		int pa = sc.nextInt();
		int pt = sc.nextInt();
		int px = sc.nextInt();
		int py = sc.nextInt();

		double[] max = new double[2];
		int[] time = new int[2];
		max[0] = max[1] = 0;
		time[0] = time[1] = 1 << 20;
		for (int i = 1; i < n; i++) {
			int f = sc.nextInt();
			int a = sc.nextInt();
			int t = sc.nextInt();
			int x = sc.nextInt();
			int y = sc.nextInt();

			if (pt == t && pa != a) {
				double len = Math.hypot(Math.abs(px - x), Math.abs(py - y));
				if (max[t] < len) {
					max[t] = len;
					time[t] = f - pf;
				} else if (max[t] == len && time[t] > f - pf) {
					time[t] = f - pf;
				}
			}
			pf = f;
			pa = a;
			pt = t;
			px = x;
			py = y;
		}

		if (max[0] > 0) {
			System.out.println(max[0] + " " + 1. * time[0] / 60);
		} else {
			System.out.println(-1 + " " + -1);
		}
		if (max[1] > 0) {
			System.out.println(max[1] + " " + 1. * time[1] / 60);
		} else {
			System.out.println(-1 + " " + -1);
		}
	}

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

	public void mapDebug(int[][] a) {
		System.out.println("--------map display---------");
		for (int i = 0; i < a.length; i++) {
			for (int j = 0; j < a[i].length; j++) {
				System.out.printf("%3d ", a[i][j]);
			}
			System.out.println();
		}
		System.out.println("----------------------------" + '\n');
	}

	class MyScanner {
		int read() {
			try {
				return System.in.read();
			} catch (IOException e) {
				throw new InputMismatchException();
			}
		}

		boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		boolean isEndline(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		int[] nextIntArray(int n) {
			int[] array = new int[n];
			for (int i = 0; i < n; i++)
				array[i] = nextInt();
			return array;
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		long[] nextLongArray(int n) {
			long[] array = new long[n];
			for (int i = 0; i < n; i++)
				array[i] = nextLong();
			return array;
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		double[] nextDoubleArray(int n) {
			double[] array = new double[n];
			for (int i = 0; i < n; i++)
				array[i] = nextDouble();
			return array;
		}

		String next() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		String[] nextStringArray(int n) {
			String[] array = new String[n];
			for (int i = 0; i < n; i++)
				array[i] = next();

			return array;
		}

		String nextLine() {
			int c = read();
			while (isEndline(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndline(c));
			return res.toString();
		}
	}
}

Measured memory_bytes: 17152
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

struct edge{
    ll to, cap, rev;
};

struct Dinic{
    const ll INF = 1e9;
    int n;
    vector<vector<edge> > g;
    VL level, iter;

    void init(int x){
        n = x;
        g.resize(n);
        level.resize(n);
        iter.resize(n);
    }

    void add_edge(int from, int to, ll cap){
        g[from].push_back((edge){to, cap, (int)g[to].size()});
        g[to].push_back((edge){from, 0, (int)g[from].size() - 1});
    }

    void bfs(int s){
        fill(ALL(level), -1);
        queue<int> que;
        level[s] = 0;
        que.push(s);
        while (!que.empty()){
            int v = que.front();
            que.pop();
            for (edge &e : g[v]){
                if (e.cap > 0 && level[e.to] < 0){
                    level[e.to] = level[v] + 1;
                    que.push(e.to);
                }
            }
        }
    }

    ll dfs(int v, int t, ll f){
        if (v == t) return f;
        for (ll &i = iter[v]; i < g[v].size(); i++){
            edge &e = g[v][i];
            if (e.cap > 0 && level[v] < level[e.to]){
                ll d = dfs(e.to, t, min(f, e.cap));
                if (d > 0){
                    e.cap -= d;
                    g[e.to][e.rev].cap += d;
                    return d;
                }
            }
        }
        return 0;
    }

    ll max_flow(int s, int t){
        ll flow = 0;
        while (1){
            bfs(s);
            if (level[t] < 0) return flow;
            fill(ALL(iter), 0);
            ll f;
            while ((f = dfs(s, t, INF)) > 0){
                flow += f;
            }
        }
    }
};

int main() {
    int n;
    cin >> n;
    VL a(n+1);
    ll sum = 0;
    FOR(i,1,n){
        cin >> a[i];
        if (a[i] > 0) sum += a[i];
    }

    Dinic flow;
    flow.init(n+2);

    FOR(i,1,n){
        if (a[i] >= 0){
            flow.add_edge(0, i, 0);
            flow.add_edge(i, n+1, a[i]);
        }else{
            flow.add_edge(0, i, -a[i]);
            flow.add_edge(i, n+1, 0);
        }
        for (int x = 2 * i; x <= n; x += i){
            flow.add_edge(i, x, 1e18);
        }
    }

    cout << sum - flow.max_flow(0, n+1) << endl;

    return 0;
}


Measured memory_bytes: 384
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
using i64 = int64_t;

__attribute__((constructor)) static void init()
{
    ios::sync_with_stdio(false);
    std::cin.tie(0);
}

int main()
{
    string s;
    cin >> s;

    cout << (s[1] == 'B' ? "ARC" : "ABC") << "\n";
}


Measured memory_bytes: 3652
//

#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <math.h>
#include <utility>
#include <set>
#include <map>
#define INF 100000
#define rep(i,n) for(int i =0;i<n;i++)
using namespace std;
typedef long long int ll;

#define MAX 5000


int main(){
    double a,b;
    cin >>a>>b;
    double ans = (a*b*1000000)/3305785;
    printf("%.5f",ans);
    cout <<endl;
}

Measured memory_bytes: 1268
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}



signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int M, D, M2, D2;
	
	cin>>M>>D;
	
	cin>>M2>>D2;
	
	if(M != M2) cout<<1<<endl;
	else cout<<0<<endl;
	
	
	return 0;
}

Measured memory_bytes: 764
n, m, x = map(int, input().split())
ca = [list(map(int, input().split())) for _ in range(n)]
ans = 10**111
ok = False
for i in range(2**n):
    y = [0]*(m+1)
    for j in range(n):
        if i & (1 << j):
            for k in range(m+1):
                y[k] = y[k] + ca[j][k]
    if sum(z >= x for z in y[1:]) == m:
        ans = min(ans, y[0])
        ok = True
if ok:
    print(ans)
else:
    print(-1)


Measured memory_bytes: 9152
# -*- coding: utf-8 -*-

H, W = map(int, input().split())
N = int(input())
As = list(map(int, input().split()))

status = 0 #0:下方向、1:右方向、2:上方向、3:左方向
x = 0
y = 0
switch = 0

ans = [[0 for i in range(H)] for j in range(W)]

for i in range(N):
    tmp = As[i]
    while tmp > 0:
        if status == 0:
            ans[x][y] = i+1
            if y == H-1-switch:
                x += 1
                status = 1
            else:
                y += 1
        elif status == 1:
            #print(x,y)
            ans[x][y] = i+1
            if x == W-1-switch:
                y -= 1
                status = 2
            else:
                x += 1
        elif status == 2:
            ans[x][y] = i+1
            if y == switch:
                x -= 1
                status = 3
                switch += 1
            else:
                y -= 1
        else:
            ans[x][y] = i+1
            if x == switch:
                y += 1
                status = 0
            else:
                x -= 1
        tmp -= 1

for h in range(H):
    for w in range(W):
        print(ans[w][h],end=' ')
        # if w != W-1:
        #     print(' ')
    print()








Measured memory_bytes: 3828
// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <iostream>
#include <cstdlib>

int main()
{
    int N, H, W;
    int count = 0;
    std::cin >> N >> H >> W;
    
    for (int i = 0; i < N; i++)
    {
        int A, B;
        std::cin >> A >> B;
        if (H <= A && W <= B) count++;
    }
    
    std::cout << count << std::endl;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * 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;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task
    {
        public void solve(int testNumber, Scanner in, PrintWriter out)
        {
            int N = in.nextInt();
            int nums[] = CPUtils.readIntArray(N, in);

            long S = 0;
            for (int i = 0; i < nums.length; i++)
            {
                S ^= nums[i];
            }
            for (int i = 0; i < nums.length; i++)
            {
                S ^= nums[i];
                out.print(S + (i == nums.length - 1 ? "" : " "));
                S ^= nums[i];
            }
        }

    }

    static class CPUtils
    {
        public static int[] readIntArray(int size, Scanner in)
        {
            int[] array = new int[size];
            for (int i = 0; i < size; i++)
            {
                array[i] = in.nextInt();
            }
            return array;
        }

    }
}



Measured memory_bytes: 50692
#include <bits/stdc++.h>
#define err(args...) {}
#ifdef DEBUG
#include "_debug.cpp"
#endif
using namespace std;
using ll = long long;
using ld = long double;
template <typename T> using lim = numeric_limits<T>;
template <typename T> istream& operator>>(istream& is, vector<T>& a) { for(T& x : a) { is >> x; } return is; }
template <typename X, typename Y> istream& operator>>(istream& is, pair<X, Y>& p) { return is >> p.first >> p.second; }
template <typename T> struct monoid {
    const T identity;
    const function<T(T, T)> combine;
};
template <typename T> struct segtree {
    using Type = T;
    using DeltaType = T;
    const int size;
    vector<T> tree;
    const monoid<T> m;
    segtree(int size, const monoid<T>& m) : size(size), tree(2 * (size + 1), m.identity), m(m) {}
    void update(int i, T x) {
        for(tree[i += size] = x; i >>= 1; )
            tree[i] = m.combine(tree[i << 1], tree[(i << 1) | 1]);
    }
    T query(int a, int b, bool inclusive) {
        assert(a <= b);
        T ans_l = m.identity, ans_r = m.identity;
        for(a += size, b += size + inclusive; a < b; a >>= 1, b >>= 1) {
            if(a & 1) ans_l = m.combine(ans_l, tree[a++]);
            if(b & 1) ans_r = m.combine(tree[--b], ans_r);
        }
        return m.combine(ans_l, ans_r);
    }
    T query(int i) { return query(i, i, true); }
    friend ostream& operator<<(ostream& os, segtree& t) {
        os << "[";
        for(int i = 0; i <= t.size; i++) {
            if(i != 0) os << ", ";
            os << t.query(i);
        }
        return os << "]";
    }
};
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    int total = 0, need = 0, mid = 0;
    map<int, vector<int>> m;
    for(int i = 0; i < n; i++) {
        string s;
        cin >> s;
        int neg = 0, val = 0;
        for(char c : s) {
            if(c == '(') {
                val++;
            } else if(val == 0) {
                neg++;
            } else {
                val--;
            }
        }
        if(neg == 0) {
            total += val;
        } else if(val == 0) {
            need += neg;
        } else {
            m[neg].push_back(val);
            mid++;
        }
    }
    segtree<pair<int, int>> s(1'000'000, {{-1'000'001, -1}, [](const auto& x, const auto& y) { return max(x, y); }});
    for(auto& [k, v] : m) {
        sort(v.begin(), v.end());
        s.update(k, {v.back() - k, k});
    }
    bool can = true;
    for(int i = 0; i < mid and can; i++) {
        auto [v, k] = s.query(0, total, true);
        if(can &= (k != -1)) {
            total += v;
            m[k].pop_back();
            if(m[k].empty()) {
                s.update(k, {-1'000'001, -1});
            } else {
                s.update(k, {m[k].back() - k, k});
            }
        }
    }
    cout << (can and (total == need) ? "Yes" : "No") << endl;
    return 0;
}

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

using ll = long long; 

const int mod = 1e9+7;

int add(int a, int b) {
    int c = a + b;
    if (c >= mod) {
        c -= mod;
    }
    return c;
}


int main() {
    int a;
    int b;
    
    scanf("%d%d", &a, &b);
    
    if (b >= a) {
        printf("Yes");
    }
    else {
        printf("No");
    }
	
	return 0;
}

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

using namespace std;
int main()
{
    int n;
    cin >> n;
    int a[n];
    int arr[n + 10] = {0};
    for (int i = 0; i < n - 1; i++)
    {
        cin >> a[i];
        arr[a[i]]++;
    }
    for (int i = 1; i <= n; i++)
        cout << arr[i] << "\n";
    return 0;
}

Measured memory_bytes: 5196
#!python
# -*- coding: utf-8 -*-

N = int(input())

T = []
ONE = []

for n in range(2, 55555):
    for i in T:
        if n % i == 0:
            break
    else:
        T.append(n)
        if n % 10 == 1:
            ONE.append(n)
            if len(ONE) == N:
                print(*ONE)
                break


Measured memory_bytes: 2940
#include <stdio.h>

int main(void){
    int A, B, C, D, x1, x2;
    scanf("%d", &A);
    scanf("%d", &B);
    scanf("%d", &C);
    scanf("%d", &D);
    if (B<=C || D<=A) {
        printf("%d", 0);
    }
    else {
        if (A>C) x1=A;
        else x1=C;
        if (B>D) x2=D;
        else x2=B;
        printf("%d", x2-x1);
    }
    
    return 0;
}


Measured memory_bytes: 128
#include <stdio.h>


int main(void)
{
  int week;
  int i;
  int debt = 100000;
  int interest;

  scanf("%d",&week);

  for(i=0; i<week; i++){
	interest = debt*0.05;

	if(interest%1000 != 0){
	  interest += 1000;
	}

	debt = debt + interest;
	debt = debt/1000;
	debt = debt*1000;

  }

  printf("%d\n",debt);

  return 0;

}

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

using namespace std;
typedef long long ll;
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define INF 1000000000000 //10^12
#define MOD 10000007 //10^9+7

template<typename T>
string printVector(const vector <T> &data) {
    stringstream ss;
    ostream_iterator <T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector <tuple<int, int>> a;
    int x, y;
    for (int i = 0; i < n; ++i) {
        cin >> x >> y;
        a.emplace_back(x, y);
    }
    sort(ALL(a), [](auto const &lhs, auto const &rhs) { return get<1>(lhs) < get<1>(rhs); });

    int now = 0;
    for (auto t: a) {
        int a = get<0>(t), b = get<1>(t);
        if (now + a <= b) now += a;
        else {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;


}

Measured memory_bytes: 2420
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <cctype>
#include <bitset>
#include <type_traits>

#include <list>
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define YES(j) cout << (j ? "YES" : "NO") << endl;
#define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
#define yes(j) std::cout << (j ? "yes" : "no") << endl;

int arr[100][100];

int main(void)
{
    int n;
    cin >> n;
    int f[n][10];
    int p[n][11];

    REP(i, n)
    {
        REP(j, 10)
        {
            cin >> f[i][j];
        }
    }
    REP(i, n)
    {
        REP(j, 11)
        {
            cin >> p[i][j];
        }
    }

    int ans = -2000000000;
    for (int x = 0; x < (1 << 10); x++)
    {
        int open[10];
        int opennum = 0;
        REP(i, 10)
        {
            if (((x >> i) & 1) == 1)
            {
                open[i] = 1;
                opennum++;
            }
            else
            {
                open[i] = 0;
            }
        }
        if (opennum == 0)
            continue;

        int tmp = 0;
        REP(j, n)
        {
            int cnt = 0;
            REP(k, 10)
            {
                if (f[j][k] == 1 and open[k] == 1)
                    cnt++;
            }
            tmp += p[j][cnt];
        }
        ans = max(ans, tmp);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int f[][] = new int[n][10];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < 10; j++) {
                f[i][j] = in.nextInt();
            }
        }
        int p[][] = new int[n][11];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < 11; j++) {
                p[i][j] = in.nextInt();
            }
        }


        long maxp = Long.MIN_VALUE;
        for (int comb = 1; comb <= 1023; comb++) {
            long profit = 0;
            for (int i = 0; i < n; i++) {
                int count = 0;
                for (int j = 0; j < 10; j++) {
                    if (((comb >> j) & f[i][j]) == 1) {
                        count++;
                    }
                }
                profit += p[i][count];
            }
            maxp = Math.max(maxp, profit);
        }

        System.out.println(maxp);
    }
}

Measured memory_bytes: 39800
K, A, B = map(int, input().split())
if B-A <= 2:
    print(K+1)
else:
    ans = 1
    k = A-1
    t = K-k
    if t >= 1:
        ans = A
        ans += (B-A)*(t//2)
        ans += t%2
    else:
        ans = K+1
    print(ans)

Measured memory_bytes: 3060
require 'pp'
$DEBUG ? define_method(:dpp){|e|pp e} : define_method(:dpp){|e|}

# Nと空白区切の入力値を数値の配列で返却する
def gets_n_and_i_list()
  return gets.chomp.to_i, gets.chomp.split(" ").map(&:to_i)
end
n, a_list = gets_n_and_i_list
total = 0
a_list = a_list.sort.reverse

2.step(2*n, 2) do |i|
  a_list[i-1]
  total += a_list[i-1]
end

puts total

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

int main() {
    int n,m;
    cin>>n>>m;
    int ans=100*(n-m);
    ans+=1900*m;
    int k=pow(2,m);
    cout<<ans*k<<endl;
}   


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define len(s) (int)s.size()
#define pb push_back

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;
}
void cmps(vector<int>&v,int &i){
	i=lower_bound(all(v),i)-v.begin();
}
constexpr int mod = 1e9+7;
constexpr int inf = 3e18;

int mod_pow(int x,int y,int m=mod){
	int res=1;
	while(y>0){
		if(y&1)res=res*x%m;
		y>>=1;x=x*x%m;
	}
	return res;
}
int perm[1000001],inv[1000001];
void init_perm(){
	perm[0]=1;
	REP(i,1000001)perm[i]=perm[i-1]*i%mod;
	inv[1000000]=mod_pow(perm[1000000],mod-2);
	for(int i=999999;i>=0;i--){
		inv[i]=inv[i+1]*(i+1)%mod;
	}
}
int nCk(int x,int y){
	if(x<y)return 0;
	return perm[x]*inv[x-y]%mod*inv[y]%mod;
}

int N,K;
vector<int>G[100005];
int ans;
void dfs(int x,int p){
	int cnt=G[x].size()-(x!=0);
	int co=K-2+(x==0);
	ans*=nCk(co,cnt)*perm[cnt]%mod;ans%=mod;
	for(int i:G[x])if(i!=p)dfs(i,x);
}
signed main(){
	init_perm();
	cin>>N>>K;
	ans=K;
	rep(i,N-1){
		int a,b;cin>>a>>b;a--;b--;
		G[a].pb(b);G[b].pb(a);
	}
	dfs(0,0);
	cout<<ans<<endl;
}


Measured memory_bytes: 24832
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int A = sc.nextInt();
		int B = sc.nextInt();
		if (N==1&&A!=B) {
			System.out.println(0);
			return ;
		}
		if (A>B) {
			System.out.println(0);
			return ;
		}
		long temp = N-2;
		System.out.println(temp*B-temp*A+1);
	}
}

Measured memory_bytes: 35900
#include<bits/stdc++.h>
using namespace std;
#define For(i,n,k) for(int i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
long ans=0;
void Main(){
    int n,x;cin>>n>>x;
    vector<int> a(n);
    For(i,0,n) cin>>a[i];
    For(i,0,n-1){
        if(a[i]+a[i+1]>x){
            ans+=a[i]+a[i+1]-x;
            if(a[i]>x){
                a[i]=x;
                a[i+1]=0;
            }
            else{
                a[i+1]=x-a[i];
            }
        }
    }
    cout<<ans<<endl;
}
int main(){
    Main();
    return 0;
}


Measured memory_bytes: 640
//include
//-------------------------
#include<vector>
#include<list>
#include<map>
#include<set>
#include<deque>
#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;

//conversion
//-----------------------
inline int toInt(string s) { int v;istringstream sin(s);sin >> v;return v; }
template<class T>inline string toString(T x) { ostringstream sout;sout << x;return sout.str(); }

//math
//-----------------------
template<class T>inline T sqr(T x) { return x * x; }

//using
//-----------------------
using VI = vector<int>;
using VVI = vector<VI>;
using VS = vector<string>;
using PII = pair<int, int>;
using LL = long long;

//container util
//-----------------------
#define WHOLE(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
#define RWHOLE(f,x,...) ([&](decltype((x)) whole) { return (f)(rbegin(whole), rend(whole), ##__VA_ARGS__); })(x)
#define CWHOLE(f,x,...) ([&](decltype((x)) whole) { return (f)(cbegin(whole), cend(whole), ##__VA_ARGS__); })(x)
#define CRWHOLE(f,x,...) ([&](decltype((x)) whole) { return (f)(crbegin(whole, crend(whole), ##__VA_ARGS__); })(x)
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin();i!=(c).end();++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())


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

//constant
//----------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);

//clear memory
#define CLR(a) memset((a).0,sizeof(a))

//#define DEBUG
#ifdef DEBUG
//debug
#define dump(x) cerr<<#x<<"="<<(x)<<endl;
#define debug(x) cerr<<#x<<"="<<(x)<<"(L"<<__LINE__<<")"<<""<<__FILE__<<endl;
#define stay cout<<"Push any key and Enter..."; scanf_s("%*s");
#else
#define dump(x)
#define debug(x)
#define stay
#endif

class counter {
	static int _counter;
public:
	int operator() (double& n) {
		return n += ++_counter;
	}
};

int main() {

	VI ipt(3);
	REPEAT(i, 3)cin >> ipt[i];
	cout << *WHOLE(max_element, ipt) - *WHOLE(min_element, ipt) << endl;
	stay;
	return 0;
}



Measured memory_bytes: 256
#標準入力を高速に
import sys 
input = sys.stdin.readline

def factorial_mod(x, y, mod):
    factorial = 1
    for i in range(x,y+1):
        factorial *= i
        factorial %= mod
    return factorial

def n_C_k(n,k,mod):
    factorial_nk = factorial_mod(n-k+1, n, mod)
    factorial_k = factorial_mod(1,k,mod)
    conbi=factorial_nk*pow(factorial_k, mod-2, mod)
    return conbi%mod

#main関数(若干早くなる)
def main():
    n, k = map(int, input().split())
    mod = 10**9+7
    ans = 1+n*(n-1)

    a = n
    #a = n_C_k(n, 1, mod)
    #b = n_C_k(n-1, 1, mod)
    b = n-1

    for i in range(1, min(n, k)):
        temp1 = (n-i)*pow(i+1, mod-2, mod)%mod
        a *= temp1
        a %= mod
        temp2 = (n-1-i)*pow(i+1, mod-2, mod)%mod
        b *= temp2
        b %= mod
        temp3 = a*b%mod
        ans += temp3
        ans %= mod

    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 40592
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define sc second
using namespace std;
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int x; cin >> x;
    for(int i = 1;;i++) if(i*x % 360 == 0){
        cout << i << "\n";
        break;
    }
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
int main()
{   string n;
	cin>>n;
	int a=0,b=0;
	for(int i=0;i<n.size();i++)
	{
		if(i%2==0) 
		{
			if(n[i]=='0')
				++b;
			else
				++a;
		}
		else
		{
			if(n[i]=='1')
				++b;
			else
				++a;
		} 
    }
	if(a<b)
	{
		cout<<a;
	}
	else
	{
		cout<<b; 
	} 
	cout<<endl;
    return 0;	
}

Measured memory_bytes: 512
//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#include<stdlib.h>
#include<stdio.h>
#define test ll t; cin>>t; while(t--)
#define FOR(p,n) for(ll i=p;i<(ll)n;i++)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)
ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}
ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
ll modmul(ll x, ll y){return (x*y)%mod;}
ll modadd(ll x, ll y){return (x+y)%mod;}
ll modsub(ll x, ll y){return (x-y+mod)%mod;}
ll fact[1000007]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<100007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
inline long long toint(const std::string &s) {std::stringstream ss; ss << s; long long x; ss >> x; return x;}
inline std::string tostring(long long number) {std::stringstream ss; ss << number; return ss.str();}
inline std::string tobin(long long x) {return std::bitset<63>(x).to_string();}
/*bool prime[MAX];
ull sieve(){memset(prime,true,sizeof(prime));for(ull p=2;p*p<MAX;p++){if(prime[p]==true){for(ull i=2*p;i<MAX;i+=p){prime[i]=false;}}}prime[0]=0;prime[1]=0;
}
/*int inv[1000001]={0};
void findinverse(){inv[1] = 1;for(int i = 2; i <=1e6 ; ++i)	inv[i] = (mod - (mod/i) * inv[mod%i] % mod) % mod;}
*/
using namespace std;
int solve()
{
	int n,k;	cin>>n>>k;
	if(n%k==0)
		cout<<n/k<<endl;
	else
		cout<<n/k+1<<endl;


}
signed main()
{
	fastio;
	clock_t start, end;
//	test
	{
		start=clock();
		solve();
		end=clock();
		double time_taken=double(end-start)/double(CLOCKS_PER_SEC);
//		cout<<time_taken<<endl;
	}
}



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

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

    if (400 <= x && x < 600) {
        cout << 8;
    }
    else if (600 <= x && x < 800) {
        cout << 7;
    }
    else if (800 <= x && x < 1000) {
        cout << 6;
    }
    else if (1000 <= x && x < 1200) {
        cout << 5;
    }
    else if (1200 <= x && x < 1400) {
        cout << 4;
    }
    else if (1400 <= x && x < 1600) {
        cout << 3;
    }
    else if (1600 <= x && x < 1800) {
        cout << 2;
    }
    else if (1800 <= x && x < 2000) {
        cout << 1;
    }
}

Measured memory_bytes: 3224