akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define lli long long int
#define pii pair<int,int>
#define vii vector<pii>
#define pb push_back
#define eb emplace_back
#define em emplace
#define all(v)  v.begin(),v.end()
#define mod 1000000007
#define vi vector<int>
#define vl vector<lli>
#define vll vector<pair<lli,lli>>
#define pll pair<lli,lli>
#define vvi vector<vector<int>>
#define vvl vector<vector<lli>>
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define tk(args...) take(args);
#define posLSB(X) __builtin_ctz(X)
#define num1bit(X) __builtin_popcount(X)
#define numlead0(X) __builtin_clz(X)
#define umreserve(X) X.reserve(32768); X.max_load_factor(0.25);
void err(istream_iterator<string> it) {} template<typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) { cout << *it << " = " << a << "\n"; err(++it, args...);}
void take() {} template<typename T, typename... Args> void take( T & a, Args & ... args ) { cin>>a; take(args...); }
template<class T>
void printvec(vector<T> &a){
	for(T &x:a){
		cout<<x<<" ";
	}
	cout<<endl;
}
template<class T>
void printarr(T a[],lli n){
	for(lli i=0;i<n;i++){
		cout<<a[i]<<" ";
	}
	cout<<endl;
}
struct HASH{
  size_t operator()(const pair<int,int>&x)const{
    return (size_t) x.first * 37U + (size_t) x.second;
  }
};

#define endl "\n"

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

lli mul(lli a, lli b) {
	return a * 1ll * b % mod;
}

inline bool setmin(lli &x, lli y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(lli &x, lli y) { return (y > x) ? x = y, 1 : 0; }

lli power_mod(lli a,lli x){if(x==0) return 1;lli y=power_mod(a,x/2);lli ans=(y*y)%mod; if(x%2) ans=(ans*a)%mod;return ans;}
lli inv(lli a){return power_mod(a,mod-2);}
lli power(lli a, lli x){ if(x==0) return 1; lli y= power(a,x/2); lli ans=(y*y); if(x%2) ans*=a; return ans;}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin>>n;
	vector<int> a(n),b(n),c(n);
	for(int i=0;i<n;i++)cin>>a[i]>>b[i]>>c[i];
	vector<int> dpa(n),dpb(n),dpc(n);
	dpa[0]=a[0];
	dpb[0]=b[0];
	dpc[0]=c[0];
	for(int i=1;i<n;i++){
		dpa[i]=max(dpb[i-1]+a[i],dpc[i-1]+a[i]);
		dpb[i]=max(dpa[i-1]+b[i],dpc[i-1]+b[i]);
		dpc[i]=max(dpb[i-1]+c[i],dpa[i-1]+c[i]);
	}
	cout<<max({dpa[n-1],dpb[n-1],dpc[n-1]})<<endl;
}


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

using namespace std;

const int N = 1000010;

int k, n, a[N], maxn = -1;

int main() {
	cin >> k >> n;
	for (int i = 1; i <= n; i++)
		cin >> a[i];
	a[n + 1] = k + a[1];
	for (int i = 2; i <= n + 1; i++)
		maxn = max(maxn, a[i] - a[i - 1]);
	cout << k - maxn << endl;	
		
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>

int main(){
  std::string s;
  int p;
  std::map<std::string,std::vector<int> > m;
  while(std::cin>>s>>p,!std::cin.eof()){
    m[s].push_back(p);
  }
  std::map<std::string,std::vector<int> >::iterator m_it = m.begin();
  while(m_it!=m.end()){
    std::cout<<(*m_it).first<<std::endl;
    std::vector<int> v = (*m_it).second;
    std::sort(v.begin(),v.end());
    std::vector<int>::iterator v_it = v.begin();
    while(v_it!=v.end()){
      std::cout<<*v_it;
      v_it++;
      (v_it==v.end())?std::cout<<std::endl:std::cout<<" ";
    }
    m_it++;
  }
  return 0;
}

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

#define REP(i, n) for (int i = 0; i < (n); ++i)

int main(void) {
    int n, l, r, ans = 0;

    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    REP(i, n) {
        cin >> l >> r;
        ans += (r - l) + 1;
    }

    cout << ans << "\n";
    return 0;
}

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

int main(){
  int m,n;
  cin >> m >> n;
  vector<string> g(m);
  for(int i=0;i<m;i++) cin >> g[i];

  vector< vector<bool> > can( m, vector<bool>(n, true) );
  for(int i=0;i<m;i++){
    for(int j=0;j<n;j++){
      if(i == 0) can[i][j] = false;

      if(g[i][j] == 'o'){
	for(int jj=-1;jj<=1;jj++){
	  if(j+jj>=0 && j+jj<n) can[i][j+jj] = false;
	}
      }

      if(g[i][j] == 'x'){
	for(int ii=-1;ii<=1;ii++){
	  if(i+ii>=0 && i+ii<m){
	    for(int jj=-1;jj<=1;jj++){
	      if(j+jj>=0 && j+jj<n) can[i+ii][j+jj] = false;
	    }
	  }
	}
      }
    }
  }

  int ans = 0;
  for(int i=0;i<m;i++){
    for(int j=0;j<n;j++){
      if(can[i][j]) ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3184
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define All(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()   //reverse
#define strall(v) (v).cbegin(),(v).cend() //const_itterator
#define IN(a, b, x) (a<=x&&x<b)
using namespace std;
using ll = long long;
using Pair = pair<int,int>;
using Graph = vector<vector<ll>>;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<typename t, typename u, typename Comp=less<>>
bool chmax(t& xmax, const u& x, Comp comp={}) { if(comp(xmax, x)) { xmax = x; return true; } return false;}
template<typename t, typename u, typename Comp=less<>>
bool chmin(t& xmin, const u& x, Comp comp={}) { if(comp(x, xmin)) { xmin = x; return true;} return false;}
const int INF = 1e9;
const ll infl = ll(1e18)+5;

/*
*ios::sync_with_stdio(false);
*cin.tie(0);
*/
int main(){
  int N;
  cin >> N;
  for(int i=1;i<10;i++){
    for(int j=1;j<10;j++){
      if(N==i*j){
        cout << "Yes" << endl;
        return 0;
      }
    }
  } 
  cout << "No" << endl; 
}

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

int main() {
	int n;
	double x,y;
	double r,a;
	
	while(cin>>n,n+1){
		r=1;a=0;
		
		for(int i=0;i<n-1;++i){
			a+=atan2(1,r);
			r=sqrt(r*r+1);
		}
		cout<<r*cos(a)<<endl<<r*sin(a)<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 1296
import sys
S=input()
first=S[0]
second=S[1]
last=S[len(S)-1]
cnt=0
moji=[i for i in "abcdefghijklmnopqrstuvwxyz"]
# print(len(moji))

if first=="A":
  for i in range(2,len(S)-1):
  
    if S[i]=="C":
      cnt+=1
    else:
      if (S[i] in moji)==False:
        print("WA")
        sys.exit()

  if cnt==1 and ((last in moji)==True) and ((second in moji)==True):
    print("AC")
  else:
    print("WA")
        
else:
  print("WA")

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

using namespace std;


int main(){

    int a, b;
    char op;
    cin >> a >> op >> b;

    if( op == '+' ){
        cout << a + b << endl;
    }
    else if( op == '-' ){
        cout << a - b << endl;
    }


    return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	int N, K;
	cin >> N >> K;
	vector<int> A(N);
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
	}
	sort(A.begin(), A.end());
	int ret = 1 << 30;
	for (int i = K - 1; i < N; ++i) {
		ret = min(ret, A[i] - A[i - K + 1]);
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define for1(i, m, n) for (int i = m; i < n; i++)
#define ll long long
#define endl '\n'
using namespace std;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(true) {
        int h, w;
        cin >> h >> w;
        if (h == 0) {
            break;
        }
        rep(i, h) {
            rep(j, w) {
                if ((i + j) % 2 == 0) {
                    cout << '#';
                } else {
                    cout << ".";
                }
            }
            cout << endl;
        }
    cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3160
N = int(input())
X = []
Y = []
for _ in range(N):
    a = int(input())
    tmp = []
    for _ in range(a):
        tmp.append(list(map(int, input().split())))

    X.append(a)
    Y.append(tmp)

ans = 0
for bit in range(2 ** N):
    flag = True
    for i in range(N):
        if bit >> i & 1:
            for x, y in Y[i]:
                flag &= (bit >> (x - 1) & 1) == y

    if flag:
        ans = max(ans, bin(bit).count("1"))

print(ans)


Measured memory_bytes: 74112
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]

class UnionFind():
    def __init__(self, size):
        self.par = [i for i in range(size)]
        self.rank = [0 for _ in range(size)]
        self.sizes = [1 for _ in range(size)]
    def root(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.root(self.par[x])
            return self.par[x]
    def same(self, x, y):
        return self.root(x) == self.root(y)
    def unite(self, x, y):
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
            self.sizes[y] += self.sizes[x]
        else:
            self.par[y] = x
            self.sizes[x] += self.sizes[y]
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
    def size(self, x):
        return self.sizes[self.root(x)]

total = int(n * (n-1) / 2)
uf = UnionFind(n)
res = [0] * m
for i in range(m)[::-1]:
    a = ab[i][0] - 1
    b = ab[i][1] - 1
    if uf.root(a) == uf.root(b):
        res[i] = total
        continue
    res[i] = total - uf.size(a) * uf.size(b)
    total -= uf.size(a) * uf.size(b)
    uf.unite(a, b)
    if res[i] == 0:
        break

for i in range(1, m):
    print(res[i])
print(int(n * (n-1) / 2))

Measured memory_bytes: 36428
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <stack>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); ++i)
// int H[N]; rep(i,N) scanf("%d", &H[i]);
using namespace std;

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

int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
const long long INF = 1LL << 60;
// spring s; cin >> s;
// cout << res << endl;
// --------write my code!!!!!----------//

// I'm trying to ~~~
int main(){
    int N,T,A; cin>>N>>T>>A;
    vector<int> H(N);
    rep(i,N) cin >> H[i];
    int t = 10000000;
    int res = 0;
    rep(i,N){
        int temp = abs(A*1000 - (T*1000 - H[i]*6));
        if(temp < t){
            t=temp;
            res = i+1;
        }
    }
    cout << res << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <ext/numeric>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#define oo 0x3f3f3f3f
#define OO 0x3f3f3f3f3f3f3f3f
#define ones(n) __builtin_popcount(n)
#define ONES(n) __builtin_popcountll(n)

using namespace std;
//using namespace __gnu_cxx;
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef pair<int, int> ii;
typedef pair<long long, pair<int, int>> iii;
typedef pair<ii, ii> iiii;

const double PI = acos(-1.0), EPS = 1e-6;
const int N = 100005, M = 102, mod = 998244353, mxLog = 20;
int n;
int arr[4][N];
int memo[4][N];
int solve(int prev, int i) {
    if (i == n) {
        return 0;
    }
    int &ret = memo[prev][i];
//    cout << ret << '\n';
    if (~ret)
        return ret;
    ret = 0;
    for (int j = 0; j < 3; ++j) {
        if (j == prev)
            continue;
        ret = max(ret, arr[j][i] + solve(j, i + 1));
    }
    return ret;
}


int main() {
#ifndef ONLINE_JUDGE
//    freopen("input.txt", "rt", stdin);
//    freopen("output.txt", "w", stdout);
#endif
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0), cout.precision(7), cout << fixed;

    cin >> n;
    for (int j = 0; j < n; ++j) {
        for (int i = 0; i < 3; ++i)
            cin >> arr[i][j];
    }
    memset(memo, -1, sizeof memo);
    cout << solve(3, 0) << '\n';


    return 0;
}

Measured memory_bytes: 10752
#include <bits/stdc++.h>
using namespace std;
 int main() {
  int dist,t,speed;
    cin>>dist>>t>>speed;
    if(ceil((float)dist/speed)<=t) {
         cout<<"Yes"<<endl;
    }else {
          cout<<"No"<<endl;
    }
   return 0;
 }

Measured memory_bytes: 3576
#include <stdio.h>

int main(void)
{
	int a, b;
	scanf("%d%d", &a, &b);

	if(a < b)
		printf("a < b\n");
	else if(a > b)
		printf("a > b\n");
	else
		printf("a == b\n");

	return 0;
}

Measured memory_bytes: 580
#include <cstdio>
#include <algorithm>
using namespace std;

int main() {
	int a, b, c; scanf("%d %d %d", &a, &b, &c);

	int k[3] = { a, b, c };
	sort(k, k + 3);

	int sum = k[0] + k[1] + 10 * k[2];

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

	return 0;
}

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

int main()
{
    int n,m;
    cin >> n >> m;
    int st[n][2];
    int ch[m][2];
    for(int i = 0; i < n; i++){
        cin >> st[i][0];
        cin >> st[i][1];
    }
    for(int i = 0; i < m; i++){
        cin >> ch[i][0];
        cin >> ch[i][1];
    }

    for(int i = 0; i < n; i++){
        int dis = 1000000000;
        int check;
        for(int j = 0; j < m; j++){
            int mh = abs(st[i][0] - ch[j][0]) + abs(st[i][1] - ch[j][1]);
            if(dis > mh){
                dis = mh;
                check = j;
            }
        }
        cout << check + 1 << endl;
    }
}

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

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef pair<LL, LL> PLL;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())

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

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

LL dp[3010][3010];

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

  int N, M; cin >> N >> M;
  string S; cin >> S;
  VI zs(N+1, 0);
  REP(i,N) zs[i+1] = zs[i] + (S[i]=='0');

  VI rs(N+1);
  REP(i,N+1) rs[i] = i+1;
  REP(i,M){
	int l, r; cin >> l >> r;
	--l;
	for(int k=l;k<r;++k)
	  rs[k] = max(rs[k], r);
  }

  int rr = 0;
  dp[0][0] = 1;
  for(int i=0;i<N;++i){
	int dz = (rs[i] <= rr? 0: zs[rs[i]]-zs[rr]);
	rr = rs[i];
	for(int z=0;z<=N;++z){
	  int zz = z + dz;
	  if(zz > N) continue;
	  if(zz > 0)
		(dp[i+1][zz-1] += dp[i][z]) %= MOD;
	  if(rr - i - zz > 0)
		(dp[i+1][zz] += dp[i][z]) %= MOD;
	}
	rr = rs[i];
  }
  cout << dp[N][0] << endl;

  return 0;
}


Measured memory_bytes: 70784
N, K = map(int, input().split())
R = N - K

if R == 0: #赤いボールが無い時
    print (1)
    for _ in range(1, K):
        print (0)
    exit()

if K == 1: #青いボールが1つのとき
    print (R+1)
    exit()

for i in range(1, K+1): #K回答えを出力
    if i > R+1:
        print (0)
        continue
    if i == 1:
        position = R + 1
        boal = 1
        print (R+1)
    if i >= 2:
        position = ((position * (R + 1 - (i-1))) // i)
        a = position%(7 + 10 ** 9)
        boal = ((boal * (K - (i-1)))// (i-1))
        b = boal%(7 + 10 ** 9) 
        print ((a * b)%(7 + 10 ** 9))

Measured memory_bytes: 3316
const main = (input) => {
  input = input.split(' ');
  const a = parseInt(input[0], 10);
  const b = parseInt(input[1], 10);
  const c = parseInt(input[2], 10);
  
  if (b-a===c-b) {
    console.log('YES');
  }else{
    console.log('NO');
  }
}
 
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 11340
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int[][] a=new int[3][3];
    for(int i=0;i<3;i++)
      for(int j =0;j<3;j++)
      {
        a[i][j]=sc.nextInt();
      }
    int q=sc.nextInt();
    int x=0;
    for(int r=0;r<q;r++)
    {
      int n=sc.nextInt();
      for(int i=0;i<3;i++)
      for(int j =0;j<3;j++)
      {
       if( a[i][j]==n)
         a[i][j]=1;
      }
      if(a[0][0]==1 && a[1][1]==1 && a[2][2]==1)
      {x=1;
       break;
      }
      if(a[0][0]==1 && a[0][1]==1 && a[0][2]==1)
      {x=1;
       break;
      }
      if(a[0][1]==1 && a[1][1]==1 && a[2][1]==1)
      {x=1;
       break;
      }
       
      
      if(a[0][2]==1 && a[1][2]==1 && a[2][2]==1)
      {x=1;
       break;
      }
      
      if(a[1][0]==1 && a[1][1]==1 && a[1][2]==1)
      {x=1;
       break;
      }
      
      if(a[2][0]==1 && a[2][1]==1 && a[2][2]==1)
      {x=1;
       break;
      }
      
      if(a[0][0]==1 && a[1][0]==1 && a[2][0]==1)
      {x=1;
       break;
      }
      
      if(a[0][2]==1 && a[1][1]==1 && a[2][0]==1)
      {x=1;
       break;
      }
    

            

    }
    if(x==1)
      System.out.println("Yes");
    else
      System.out.println("No");
        
  }
  

}


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

int main() {
    int a, b, c, x, ans = 0;
    cin >> a >> b >> c >> x;
    rep(i, c + 1) {
        if((x - 50 * i) % 100) continue;
        rep(j, b + 1) {
            int temp = x - 50 * i - 100 * j;
            if(temp % 500 == 0 && 0 <= temp / 500 && temp / 500 <= a) ans++;
        }
    }
    cout << ans << endl;
}

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

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

public class Main{

	Scanner sc;

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

	void run(){
		sc=new Scanner(System.in);
		int n=sc.nextInt();
		sc.nextLine();
		for(int k=0; k<n; k++){
			String[] ss=sc.nextLine().split(" ");
			int[] a=new int[10];
			for(int i=0; i<10; i++)
				a[i]=Integer.parseInt(ss[i]);
			int x=0;
			for(int i=0; i<10; i++){
				if(a[i]>x){
					x=a[i];
					a[i]=-1;
				}
			}
			x=0;
			for(int i=0; i<10; i++){
				if(a[i]>x){
					x=a[i];
					a[i]=-1;
				}
			}
			boolean f=true;
			for(int i=0; i<10; i++)
				if(a[i]!=-1){
					f=false;
					break;
				}
			println(f?"YES":"NO");
		}
		sc.close();
	}

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

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

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

Measured memory_bytes: 12000
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

int main(void){
  int n;
  cin >> n;
  vector<int> s(n);
  int sum = 0;
  REP(i, n) cin >> s[i], sum += s[i];
  sort(ALL(s));
  if(sum%10) cout << sum << endl;
  else{
    REP(i, n){
      if((sum-s[i])%10){
        cout << sum-s[i] << endl;
        return 0;
      }
    }
    cout << 0 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <istream>
#include <set>
#include <queue>
#define rep0(i,n) for (long long int i = 0; i <= (n); ++i)
#define rep1(i,n) for (long long int i = 1; i <= (n); ++i)
#define REP(a,b) for (long long int i = a; i <= (b); ++i) 
#define ps push_back 
#define MOD 1000000007
using namespace std;
typedef long long ll;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	ll n;
	cin >> n;
	ll count = 0;
	ll save = 0;
	vector<ll>a(n + 1);
	vector<ll>b(n);
	rep0(i, n)cin >> a[i];
	rep0(j, n - 1)cin >> b[j];
	rep0(k, n - 1) {
		if (a[k] >= b[k]) {
			a[k] -= b[k];
			count += b[k];
			b[k] = 0;
		}
		else {
			save = a[k];
			a[k] = 0;
			count += save;
			b[k] -= save;
			if (a[k + 1] >= b[k]) {
				a[k + 1] -= b[k];
				count += b[k];
			}
			else {
				save = a[k + 1];
				a[k + 1] = 0;
				count += save;
			}
		}
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 1792
import itertools
import math
import sys

n, m = map(int, input().split())
x = sorted(list(map(int, input().split())))
gaps = []
if n >= m:
    print(0)
else:
    for i in range(1, m):
        gaps.append(x[i] - x[i - 1])
    gaps.sort()
    gaps = gaps[:m - n]
    print(sum(gaps))


Measured memory_bytes: 13704
#include <bits/stdc++.h>
using namespace std;
int main() {
    string s, t;
    cin >> s >> t;
    int count = 0;

    if(s[0] == t[0]) {
        count++;
    };

    if(s[1] == t[1]) {
        count++;
    };

    if(s[2] == t[2]) {
        count++;
    };

    cout << count << endl;
    return 0;
}

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

int main(void){
    int n;
    cin>>n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin>>a[i];
    }
    int sc=0;
    for (int i = 0; i < n; ++i) {
        int minj=i;
        for (int j = i+1; j < n; ++j) {
            if(a[minj]>a[j])minj=j;
        }
        if(i!=minj){
            int t=a[i];
            a[i]=a[minj];
            a[minj]=t;
            ++sc;
        }

    }
    for (int i = 0; i < n-1; ++i) {
        cout<<a[i]<<" ";
    }
    cout<<a[n-1]<<endl;
    cout<<sc<<endl;
    return 0;
}


Measured memory_bytes: 3100
N, M = map(int, input().split())
X = list(map(int, input().split()))
X.sort()
X_distance = [0]*(M-1)
for i in range(M-1):
    X_distance[i] = abs(X[i]-X[i+1])
X_distance.sort(reverse=True)

if N >= M:
    print(0)
elif M == 1:
    print(0)
else :
    for i in range(N-1):
        X_distance[i] = 0
    print(sum(X_distance))

Measured memory_bytes: 13960
#include<iostream>
#include<vector>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>

using namespace std;

const int N=3e5+9;

int n,k;
vector<string> v;
string strs;

inline void dfs(int pos,string str)
{
	if(pos==n+1)
		return;
	for(int i=1;i<=k;i++)
	{
		string tmp;
		tmp=(char)(i+'0');
		tmp=str+tmp;
		v.push_back(tmp);
		dfs(pos+1,tmp);
	}
}

int a[N];

inline void get()
{
	for(int i=1;i<=n;i++)
		a[i]=(k+1)/2;
	int top=n;
	for(int i=1,e=n/2;i<=e;i++)
	{
		a[top]-=1;
		if(a[top]==0)
			top--;
		else
		{
			while(top<n)
			{
				top++;
				a[top]=k;
			}
		}
	}
	while(a[top]==0)top--;
	for(int i=1;i<=top;i++)
		printf("%d ",a[i]);
	puts("");
}

int main()
{
	if(fopen("vj.in","r"))
	{
		freopen("vj.in","r",stdin);
		freopen("vj.out","w",stdout);
	}	
	
	scanf("%d%d",&k,&n);

	
	if(k%2==0)
	{
		printf("%d",k/2);
		for(int i=2;i<=n;i++)
			printf(" %d",k);
		puts("");
		return 0;
	}
	get();
	return 0;
	



	//k=1;n=14;
	get();
	//return 0;
	//for(n=1;n<=5;n++)
	{
		v.clear();
		dfs(1,strs);
		sort(v.begin(),v.end());

		int midpos=(v.size()+1)/2-1;
		cout<<midpos<<endl;
		for(int i=midpos-n/2;i<=midpos+n/2;i++)
			cout<<i<<" "<<v[i]<<endl;
		//cout<<v[((v.size()+1)/2)-1]<<endl;
	}	

	return 0;
}


Measured memory_bytes: 3456
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

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

  static class TaskC {
    public void solve(int testNumber, InputReader in, OutputWriter out) {
      long n = in.nextLong();
      long m = in.nextLong();
      if (m >= n * 2) {
        long remain = m - n * 2;
        out.printLine(n + remain / 4);
      } else {
        out.printLine(m / 2);
      }
    }

  }

  static class InputReader {
    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;
    private InputReader.SpaceCharFilter filter;

    public InputReader(InputStream stream) {
      this.stream = stream;
    }

    public int read() {
      if (numChars == -1) {
        throw new InputMismatchException();
      }
      if (curChar >= numChars) {
        curChar = 0;
        try {
          numChars = stream.read(buf);
        } catch (IOException e) {
          throw new InputMismatchException();
        }
        if (numChars <= 0) {
          return -1;
        }
      }
      return buf[curChar++];
    }

    public long nextLong() {
      int c = read();
      while (isSpaceChar(c)) {
        c = read();
      }
      int sgn = 1;
      if (c == '-') {
        sgn = -1;
        c = read();
      }
      long res = 0;
      do {
        if (c < '0' || c > '9') {
          throw new InputMismatchException();
        }
        res *= 10;
        res += c - '0';
        c = read();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public boolean isSpaceChar(int c) {
      if (filter != null) {
        return filter.isSpaceChar(c);
      }
      return isWhitespace(c);
    }

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

    public interface SpaceCharFilter {
      boolean isSpaceChar(int ch);

    }

  }

  static class OutputWriter {
    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
      writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public OutputWriter(Writer writer) {
      this.writer = new PrintWriter(writer);
    }

    public void close() {
      writer.close();
    }

    public void printLine(long i) {
      writer.println(i);
    }

  }
}



Measured memory_bytes: 21460
#include <iostream>
#include <iomanip>
using namespace std;
int A, B, C;
int n;

double dp[301][301][301];


double foo(int A, int B, int C)
{
    if(dp[A][B][C] != -1) return dp[A][B][C];

    double nn = n;
    double AA = A;
    double BB = B;
    double CC = C;

    double res = 0;
    
        if(A != 0)
        {
           double E1 = (foo(A-1, B, C) + 1.0) * AA/nn;
           res += E1;
        }


        if(B != 0)
        {
           double E1 = (foo(A+1, B-1, C) + 1.0) * BB/nn;
           res += E1;
        }

        if(C != 0)
        {
           double E1 = (foo(A, B+1, C-1) + 1.0) * CC/nn;
           res += E1;
        }
    double kl = 1.0 - (AA + BB + CC)/nn;

    res += kl;
    res /= (1.0 - kl);

    dp[A][B][C] = res;
    return res;
    


}


int main()
{
    A=0;B=0;C=0;

    for (int i = 0; i < 301; ++i)
    {
        for (int j = 0; j < 301; ++j)
        {
            for (int k = 0; k < 301; ++k)
            {
                dp[i][j][k] = -1;
            }
        }
    }
    dp[0][0][0] = 0;
    cin >> n;
    for (int i = 0; i < n; ++i)
    {
        int a;
        cin >> a;
        if(a == 1) A++;
        else if(a == 2) B++;
        else if(a == 3) C++;

    }
    cout << fixed << setprecision(10) << foo(A, B, C);

    return 0;
}

Measured memory_bytes: 213376
/* To Kaise Hain Aaplog*/

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define all(x) (x).begin(), (x).end()

void shuru_krte_hai_bina_kisi_bakchodi_ke()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif // ONLINE_JUDGE
}

const int mod = 1e9 + 7;
const int s = 1e6 + 1;

int32_t main()
{

	//shuru_krte_hai_bina_kisi_bakchodi_ke();
	string s;
	cin>>s;
	if(s[s.length()-1]=='s'){
		s+="es";
	}else
	{
		s+="s";
	}
	cout<<s;
	
	return 0;
}

Measured memory_bytes: 3592
#include <stdio.h>

int main(void) 
{
    int a, b;
    
    scanf("%d %d", &a, &b);
    
    if(a > b)
    {
        printf("a > b\n");
    }
    else if(a < b)
    {
        printf("a < b\n");
    }
    else
    {
        printf("a == b\n");
    }
	
    return 0;
}

Measured memory_bytes: 580
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define printYes() cout << "Yes" << endl;
#define printNo() cout << "No" << endl;
#define printVector(v) rep(i, v.size()) cout << v[i] << endl;

int main()
{
    int N, T;
    cin >> N >> T;
    vector<int> A(N);
    rep(i, N)
    {
        cin >> A[i];
    }
    vector<pair<int, int>> max_dp(N), min_dp(N);
    min_dp[0] = make_pair(A[0], 0);
    max_dp[N - 1] = make_pair(A[N - 1], N - 1);
    rep(i, N - 1)
    {
        if (A[i + 1] <= min_dp[i].first)
            min_dp[i + 1] = make_pair(A[i + 1], i + 1);
        else
            min_dp[i + 1] = min_dp[i];

        if (A[N - 2 - i] >= max_dp[N - 1 - i].first)
            max_dp[N - 2 - i] = make_pair(A[N - 2 - i], N - 2 - i);
        else
            max_dp[N - 2 - i] = max_dp[N - 1 - i];
    }
    int max_profit = 0;
    rep(i, N)
    {
        max_profit = max(max_profit, max_dp[i].first - min_dp[i].first);
        //cout << max_dp[i].first - min_dp[i].first << ":" << max_dp[i].second << "->" << min_dp[i].second << endl;
    }
    map<pair<int, int>, int> ans;
    rep(i, N)
    {
        int profit = max_dp[i].first - min_dp[i].first;
        if (profit == max_profit)
        {
            pair<int, int> p = make_pair(max_dp[i].second, min_dp[i].second);
            ans[p];
        }
    }
    cout << ans.size() << endl;
    return 0;
}

Measured memory_bytes: 5376
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
struct Unionfind{
  vector<ll>par;
  vector<ll>size;
  Unionfind(ll n):par(n),size(n){
    for(ll i=0;i<n;i++){
      par[i]=i;
      size[i]=1;
    }
  }
  ll root(ll x){
    return par[x]==x?x:par[x]=root(par[x]);
  }
  bool same(ll x,ll y){
    return root(x)==root(y);
  }
  void unit(ll x,ll y){
    x=root(x);
    y=root(y);
    if(x==y)return;
    if(size[x]<size[y]){
      par[x]=y;
      size[y]+=size[x];
    }else{
      par[y]=x;
      size[x]+=size[y];
    }
  }
  ll treesize(ll x){
    return size[root(x)];
  }
};
int main(){
  ll N,M;
  cin>>N>>M;
  vector<pair<ll,ll>>edge(M);
  for(ll i=0;i<M;i++){
    ll a,b;
    cin>>a>>b;
    a--,b--;
    edge[i].first=a;
    edge[i].second=b;
  }
  reverse(edge.begin(),edge.end());
  Unionfind uf(N);
  ll res=N*(N-1)/2;
  vector<ll>ans;
  for(ll i=0;i<M;i++){
    ans.push_back(res);
    ll a=edge[i].first;
    ll b=edge[i].second;
    ////cout<<uf.root(a)<<uf.root(b)<<endl;
    //cout<<"a"<<a<<"b"<<b<<endl;
    if(!uf.same(a,b)){
      ll as=uf.treesize(a);
      ll bs=uf.treesize(b);
      //cout<<"treesize:"<<"as"<<a<<"bs"<<b<<endl;
      res-=as*bs;
      // //cout<<"a*b"<<a*b<<endl;
       uf.unit(a,b);
      //cout<<"res"<<res<<endl;
    }
    
    
  }
  reverse(ans.begin(),ans.end());
  for(ll i=0;i<M;i++){
    cout<<ans[i]<<endl;
  }
}


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

using namespace std;

#define dbg(x) cout << #x << ' ' << x << endl;

typedef long long Long;

int n, p;

const int N = 1e5;

int arr[N];

Long memo[N][2];

Long solve(int ind, int p) {
  if (ind == n) return p == 0;
  Long& res = memo[ind][p];
  if (res != -1) return res;

  res = solve(ind + 1, p) + solve(ind + 1, (p + arr[ind]) & 1);
  return res;
}

int main() {
  ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);

#ifdef Local
  freopen("test.in", "r", stdin);
#endif

  memset(memo, -1, sizeof memo);

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

  cout << solve(0, p);

  return 0;
}


Measured memory_bytes: 1792
def resolve():
    '''
    code here
    '''
    S = input()
    is_flag = True
    while is_flag:
        # print(S, len(S))
        if len(S)>=5:
            temp = S[:5]
            # print(temp)
            if temp == 'dream':
                S = S[5:]
                if len(S) != 0:
                    if S[:5] == 'erase':
                        pass
                    elif S[:2] == 'er':
                        S = S[2:]
                
            elif temp == 'erase':
                S = S[5:]
                if len(S) != 0:
                    if S[0] == 'r':
                        S = S[1:]

            else:
                print('NO')
                is_flag = False
        elif len(S) == 0:
            print('YES')
            is_flag = False
        else:
            print('NO')
            is_flag = False


if __name__ == "__main__":
    resolve()


Measured memory_bytes: 9188
import java.util.Scanner;

//ABC052
public class Main {

    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	long a = sc.nextLong(), b = sc.nextLong();
	long c = sc.nextLong(), d = sc.nextLong();
	System.out.println(Math.max(a * b, c * d));
    }

}


Measured memory_bytes: 10324
import os
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7


# MOD = 998244353
def cummax(it, first=-float('inf')):
    """
    累積 max
    :param collections.Iterable it:
    :param float first:
    :return:
    """
    cm = first
    ret = []
    for v in it:
        cm = max(v, cm)
        ret.append(cm)
    return ret


N = int(sys.stdin.buffer.readline())
A = list(map(int, sys.stdin.buffer.readline().split()))
SIZE = 2 ** N

# dp[k]: i | j | k == k となる i, j のうち A[i] + A[j] が最大となる i, j
#: :type: list of ((int, int), (int, int))
dp = [None] * SIZE
for k in range(1, SIZE):
    dp[k] = list(sorted([(A[0], 0), (A[k], k)]))

# 高速ゼータ変換、配る版
# for k in range(1, SIZE):
#     mask = k
#     while mask < SIZE - 1:
#         # kに立ってないビットを1つだけ立てる
#         next_k = (mask + 1) | k
#         mask |= next_k
#
#         a1, a2 = dp[k]
#         b1, b2 = dp[next_k]
#         if a1 > b2:
#             # dp[next_k] = a1, a2
#             dp[next_k] = dp[k]
#         elif b1 > a2:
#             # dp[next_k] = b1, b2
#             pass
#         elif a2 > b2:
#             dp[next_k] = b2, a2
#         elif b2 > a2:
#             dp[next_k] = a2, b2

# 高速ゼータ変換
for k in range(1, SIZE):
    d = 1
    while d < SIZE:
        if k & d == 0 or k - d == 0:
            d <<= 1
            continue
        # k に立っているビットを1つだけ消したもの
        prev_k = k - d

        a1, a2 = dp[k]
        b1, b2 = dp[prev_k]
        if a1 > b2:
            # dp[k] = a1, a2
            pass
        elif b1 > a2:
            # dp[k] = b1, b2
            dp[k] = dp[prev_k]
        elif a2 > b2:
            dp[k] = b2, a2
        elif b2 > a2:
            dp[k] = a2, b2

        d <<= 1

ans = [0] * SIZE
for k in range(1, SIZE):
    (a1, _), (a2, _) = dp[k]
    ans[k] = a1 + a2

ans = cummax(ans[1:])
print(*ans, sep='\n')


Measured memory_bytes: 120444
#include <bits/stdc++.h>
#include <math.h>
#define ll long long
using namespace std;

int main(){
    ll n;
    cin>>n;
    ll num[n];
    for (int i = 0; i < n; ++i) {
        cin>>num[i];
        if(num[i]%2==1){
            cout<<"first"<<endl;
            return 0;
        }
    }
    cout<<"second"<<endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>

using namespace std;

int A, B, AB; // ピザの値段
int X, Y; // 必要枚数

int main() {
	int cost = 0; // 総費用
	cin >> A >> B >> AB >> X >> Y;

	if ((A + B) > AB * 2) {
		int less = min(X, Y); // 少ないほう
		cost += AB * less * 2;
		if (less == X) {
			if (B / 2 > AB) {
				cost += AB * (Y - less) * 2;
			}
			else {
				cost += B * (Y - less);
			}
		}
		else {
			if (A / 2 > AB) {
				cost += AB * (X - less) * 2;
			}
			else {
				cost += A * (X - less);
			}
		}
	}
	else {
		cost += A * X;
		cost += B * Y;
	}

	cout << cost << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <iomanip>
using namespace std;
#define int long long

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

    int n,k; cin >> n >> k;
    vector<int> a(n),b(n);
    for(int i = 0;i < n;i ++) cin >> a.at(i) >> b.at(i);

    vector<int> count(100001);

    for(int i = 0;i < n;i ++){
        count.at(a.at(i)) += b.at(i);
    }

    int sum = 0;

    for(int i = 0;i < 100001;i ++){
        sum += count.at(i);
        if(sum >= k){
            cout << i << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 5520
import sys
import math
import fractions
from collections import deque
from collections import defaultdict
sys.setrecursionlimit(10**7)

N = int(input())
P = []
for i in range(N):
    P.append(int(input()))

cnt = [0] * (N + 1)

for i in P:
    if cnt[i - 1] != 0:
        cnt[i] = cnt[i-1] + 1
        cnt[i - 1] = 0
    else:
        cnt[i] = 1

print(N - max(cnt))


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

#define lli long long int
#define pb push_back
#define in insert
#define pi pair<lli, lli>
#define ps pair<double, string>
#define pib pair<pi, bool>
#define mp make_pair
#define fir first
#define sec second
#define MAXN 200001
#define MAXL 10001
#define mod 1000000007

vector<int> adj[MAXN];
bool visited[MAXN];
vector<int> cycle;

void dfs(int s)
{
  visited[s] = true;
  cycle.pb(s);
  if (!visited[adj[s][0]])
    dfs(adj[s][0]);
  else
  {
    cycle.pb(adj[s][0]);
    return;
  }
}
signed main()
{
  lli n, k;
  cin >> n >> k;
  vector<int> v(n);
  for (int i = 0; i < n; i++)
  {
    cin >> v[i];
    adj[i + 1].pb(v[i]);
  }
  dfs(1);
  int rep = cycle[cycle.size() - 1];
  int index;
  for (int i = 0; i < n; i++)
  {
    if (cycle[i] == rep)
    {
      index = i;
      break;
    }
  }
  vector<int> new_cycle;
  for (int i = index; i < cycle.size() - 1; i++)
    new_cycle.pb(cycle[i]);
  if (k <= index)
    cout << cycle[k] << endl;
  else
  {
    k -= index;
    cout << new_cycle[k % new_cycle.size()] << endl;
  }
  return 0;
}

Measured memory_bytes: 23052
/*
　　こんにちは。あたしはｶｳｶﾞｰﾙ。
　　RedcoderになるためAtCoderを巡る旅をしてます。

　　　 　＿_
　　　 ヽ|＿_|ノ　　　　ﾓｫ
　　　　||‘‐‘||ﾚ　　_)_, ―‐ 、
　　　　/(Ｙ (ヽ＿ /・ ヽ　　   ￣ヽ
　　　　∠ ＿ ゝ　 ｀^ヽ ﾉ.::::_(ノヽ
　　　　 _/ヽ　 　　  /ヽ￣￣￣/ヽ
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl

#define rep(i, n) REP(i, 0, n)                  // 0, 1, ..., n-1
#define REP(i, x, n) for(int i = x; i < n; i++) // x, x + 1, ..., n-1
#define FOREACH(x, a) for(auto &(x) : (a))

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()

#define COUT(x) cout << (x) << endl

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

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

    double N;
    cin >> N;
    COUT(ceil(N / 2.0));
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod=1e9+7;
ll n,m,t;
ll qpow(ll a,ll n)
{
    ll ans=1;
    while(n)
    {
        if(n&1) ans=ans*a%mod;
        a=a*a%mod;
        n>>=1;
    }
    return ans;
}
int main()
{
    scanf("%lld%lld%lld",&n,&m,&t);
    ll g=n/__gcd(n,t),h=m/__gcd(m,t);
    ll ans=(qpow(2,h)+qpow(2,g)-1+qpow(2,__gcd(h,g))-2)%mod;
    ans=qpow(ans,(n/g)*(m/h));
    printf("%lld\n",ans);
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use num::*;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::collections::*;

fn solve() {
    input! {
        n: usize
    };

    let mut res = 0;
    for a in 1..=n {
        let max_b = (n - 1) / a;
        res += max_b;
    }
    println!("{}", res);
}

fn main() {
    std::thread::Builder::new()
        .name("big stack size".into())
        .stack_size(256 * 1024 * 1024)
        .spawn(|| {
            solve();
        })
        .unwrap()
        .join()
        .unwrap();
}


Measured memory_bytes: 2240
N,L=map(int,input().split())
l=[]

for i in range(1,N+1):
    l.append(i)
for i in range(len(l)):

    (l[i])=L+(i+1)-1

if l[0]>0 and l[len(l)-1]>0:
    l.remove(l[0])
elif l[0]<0 and l[len(l)-1]<0:
    l.remove(l[len(l)-1])
else:
    l.remove(0) 

print(sum(l))   


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

int main() {
    int n;
    cin >> n;
    bool flag = 0;
    for (int i = 0; i <= n; i+=7) {
        for (int j = 0; j <= n-i; j+=4){
            if (i + j == n) {
                flag = 1;
            }
        }
    }
    if (flag) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
int read(){int x;scanf("%d",&x);return x;}
const int MAXN=20005;
bool f[MAXN];
int a[MAXN];
int main(){
	int N=read(),sum=0;
  	for(int i=1;i<=N*2;i++) a[i]=read(),sum+=a[i];
  	sort(a+1,a+N*2+1);
  	int ans=0;
  	for(int i=1;i<=N*2;i+=2) ans+=a[i];
 printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 256
from collections import deque

H, W = list(map(int, input().split()))
S = []
for _ in range(H):
    S.append(input())

ret = 0
for i in range(H):
    for j in range(W):
        s = S[i][j]
        queue = deque([(i,j,0)])
        footprint = [(i,j)]
        if s == '#':
            continue
        while True:
            x, y, d = queue.popleft()
            for p in [(x-1, y), (x, y-1), (x, y+1), (x+1, y)]:
                if p[0] < 0 or p[0] >= H or p[1] < 0 or p[1] >= W:
                    continue
                if p in footprint:
                    continue
                if S[p[0]][p[1]] == '#':
                    continue
                queue.append((p[0], p[1], d+1))
                footprint.append(p)

            if len(queue) == 0:
                break
        if d > ret:
            ret = d

print(ret)

Measured memory_bytes: 45660
import java.util.*;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
 
   int N = sc.nextInt();
   int X = sc.nextInt();
   int[] m = new int[N];
   int sum =0;
   for(int i=0;i<N;i++) 
   {
     m[i] = sc.nextInt();
     sum+=m[i];
   } 
   Arrays.sort(m);
   
   System.out.println(N+(X-sum)/m[0]);
 }
}

Measured memory_bytes: 22100
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define INF_MAX INT_MAX
#define INF_MIN ((int)1<<31)-1
using namespace std;
class Segtree{
    vector<int> tree;
    int n=1,m,Inf;
    void Set(vector<int> vec){
        rep(i,n*2-2)tree[i+1]=Inf;
        rep(i,vec.size())tree[i+n]=vec.at(i);
        update(0,n-1);
    }
    int sum(int a,int b){
        if(m==0)return max(a,b);
        else if(m==1)return min(a,b);
        else if(m==2)return a+b;
        else return a*b;
    }
    int query(int a,int b,int x,int l,int r){
        if(r<a||b<l)return Inf;
        if(a<=l&&b>=r)return tree[x];
        return sum(query(a,b,x*2,l,(l+r)/2),query(a,b,x*2+1,(l+r)/2+1,r));
    }
    void update(int l,int r){
        l+=n,r+=n;
        l/=2,r/=2;
        while(1){
            if(l==0)break;
            int xl=l;
            for(;xl<=r;xl+=2){
                tree[xl]=sum(tree[xl*2],tree[xl*2+1]);
            }
            l/=2,r/=2;
        }
    }
public:
    void Max(vector<int> vec){
        m=0;
        Inf=INF_MAX;
        Set(vec);
    }
    void Min(vector<int> vec){
        m=1;
        Inf=INF_MIN;
        Set(vec);
    }
    void Add(vector<int> vec){
        m=2;
        Inf=0;
        Set(vec);
    }
    void Multiply(vector<int> vec){
        m=3;
        Inf=1;
        Set(vec);
    }
    void Min(){
        m=1;
        Inf=INF_MIN;
        rep(i,n*2-1)tree[i+1]=Inf;
    }
    Segtree(int in){
        for(;in>n;n*=2);
        tree.resize(n*2);
    }
    void Set(int a,int b){
        tree[a+n]=b;
        update(a,a);
    }
    int query(int a,int b){
        return query(a,b,1,0,n-1);
    }
};
class Union_Find{
private:
    vector<int> t,s;
public:
    Union_Find(int max_length){
        rep(i,max_length+1){
            t.push_back(i);
            s.push_back(1);
        }
    }
    void Union(int x,int y){
        if(same(x,y))return;
        int tx=Find(x),ty=Find(y);
        if(s[tx]<s[ty]){
            s[ty]+=s[tx];
            t[tx]=ty;
        }
        else if(s[tx]>s[ty]){
            s[tx]+=s[ty];
            t[ty]=tx;
        }
        else if(tx>ty){
            t[tx]=ty;
            s[ty]+=s[tx];
        }
        else{
            t[ty]=tx;
            s[tx]+=s[ty];
        }
    }
    int Find(int n){
        if(t[n]==n)return n;
        else return t[n]=Find(t[n]);
    }
    bool same(int x,int y){
        return Find(x)==Find(y);
    }
};
signed main(){
    int n,q;
    cin>>n>>q;
    Union_Find tree(n);
    rep(i,q){
        int a,b,c;
        cin>>a>>b>>c;
        if(a==0)tree.Union(b,c);
        else if(tree.same(b,c))cout<<1<<endl;
        else cout<<0<<endl;
    }
    return 0;
}


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

int main(void)
{
    int N;
    double money = 0;
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        double M;
        string type;
        cin >> M >> type;
        if (type == "JPY")
            money += M;
        else
            money += M * 380000.0;
    }
    cout << money << endl;
    return 0;
}

Measured memory_bytes: 256