akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int a = saori.saori_hayami();
		int ans = 0;
		if(a % 2 == 0){
			ans = a/2;
		} else {
			ans = a/2 + 1;
		}
		System.out.println(ans);
		
		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 21076
using System;
using System.Linq;

class Program
{
    static void Main(string[] args) {
        int a = int.Parse(Console.ReadLine());
        int b = int.Parse(Console.ReadLine());
        int c = int.Parse(Console.ReadLine());
        int d = int.Parse(Console.ReadLine());
        Console.WriteLine(Math.Min(a,b)+Math.Min(c,d));
    }
}

Measured memory_bytes: 11220
def main():
    r, g, b, n = map(int, input().split())
    ans = 0
    x, y = 0, 0
    while r*x <= n:
        m = n - r*x
        y = 0
        while g*y <= m:
            if (m - g*y) % b == 0:
                ans += 1
            y += 1
        x += 1
    print(ans)

if __name__ == "__main__":
    main()

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

#define REP(i,n) for(int i=0;i<n;i++)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define EPS (1e-7)

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
typedef pair<double,int> pdi;

int vx[]={0,0,-1,1};
int vy[]={1,-1,0,0};

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

const ll mod=1e9+7;
const int INF=INT_MAX/2;
const int MAX=1e9;
const int MAX_V=10000;

int N;
ll C;
ll x[100010];
ll v[100010];

int main(){
	cin>>N>>C;
	REP(i,N)cin>>x[i]>>v[i];
	ll d[N];
	d[0]=x[0];
	for(int i=1;i<N;i++){
		d[i]=x[i]-x[i-1];
	}
	ll res=0;
	ll ans=0;
	ll right[N];
	ll left[N];
	ll ret=0;
	for(int i=0;i<N;i++){
		res+=v[i]-d[i];
		if(ans<res)ans=res;
		right[i]=ans;
	}
	if(ret<ans)ret=ans;

	res=0;
	ans=0;
	for(int i=N-1;i>=0;i--){
		if(i==N-1)res+=v[i]-(C-x[i]);
		else res+=v[i]-d[i+1];
		if(ans<res)ans=res;
		left[i]=ans;
	}
	if(ret<ans)ret=ans;

	for(int i=0;i<N-1;i++){
		ll sum=right[i]-x[i]+left[i+1];
		if(sum>ret)ret=sum;
	}
	for(int i=N-1;i>=1;i--){
		ll t=left[i]-(C-x[i])+right[i-1];
		if(t>ret)ret=t;
	}
	cout<<ret<<endl;
	return 0;
}

Measured memory_bytes: 4096
#include <stdio.h>
#include <string.h>

int main(void)
{
	char str1[20],str2[20];
	int i,j;
	scanf("%s",str1);
	for(i=strlen(str1)-1,j=0;i>=0;i--,j++){
		str2[j]=str1[i];
	}
	str2[j]='\0';
	printf("%s\n",str2);
	return 0;
}

Measured memory_bytes: 524
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
vector<vector<int>> G;
int dp[100100];
int rec(int u) {
	if (dp[u] != -1)return dp[u];
	int res = 0;
	for (auto i: G[u]) {
		res = max(res, rec(i) + 1);
	}
	return dp[u] = res;
}
int main() {
	int N, M;
	cin >> N >> M;
	G.resize(N);
	for (int i = 0; i < M; i++) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		G[a].push_back(b);
	}
	for (int i = 0; i < N; i++) {
		dp[i] = -1;
	}
	int ans = 0;
	for (int i = 0; i < N; i++) {
		rec(i);
		ans = max(ans, dp[i]);
	}
	cout << ans << endl;

	return 0;
}


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

int main() {
  int N, M;
  cin >> N >> M;

  vector<vector<int> > data(N);

  for (int i = 0; i < N; i++) {
    int K;
    cin >> K;
    data[i].reserve(K);

    for (int j = 0; j < K; j++) {
      int f;
      cin >> f;
      data[i].push_back(f);
    }
    // sort(data[i].begin(), data[i].end());
  }

  int result = 0;
  for (int i = 1; i <= M; i++) {
    bool ok = true;
    for (auto &d : data) {
      bool found = false;
      for (auto &n : d) {
        if (n == i) {
          found = true;
          break;
        }
      }
      if (!found) {
        ok = false;
        break;
      }
    }
    if (ok) {
      result++;
    }
  }

  cout << result << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 
#define pi 3.1415926535897
#define ll long long int
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define mod 1000000007
#define mod1 998244353
#define inf 1000000000000000000
#define inf1 100000000000000
#define endl '\n'
int main()
{
	fastio;
	#ifdef gdb_18
		freopen("input.txt" , "rt" ,stdin);
		freopen("output.txt" , "wt" ,stdout);
	#endif
	ll n;
	cin>>n;
	ll k=__gcd((ll)7,n);
	n/=k;
	n=(9*n);
	ll cur=1;
	bool chk=false;ll ans;
	for(ll i=1;i<=n;i++)
	{
		cur=(cur*10)%n;
		if(cur==1)
		{
			chk=true;
			ans=i;
			break;
		}
	}
	if(chk)
		cout<<ans<<endl;
	else
		cout<<-1<<endl;
	return 0;	
}

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

using namespace std;

bool isSquareNumber(int x) {
    for (int i = 1; i * i <= x; ++i) if (i * i == x) return true;
    return false;
}

int factorial(int n) {
    if (n < 0) return -1;
    else if (n == 0) return 1;
    int ans = 1;
    for (int i = 1; i <= n; ++i) {
        ans *= i;
    }
    return ans;
}

int dist(vector<int> a, vector<int> b) {
    int sum = 0;
    for (int i = 0; i < a.size(); ++i) {
        sum += (a.at(i) - b.at(i)) * (a.at(i) - b.at(i));
    }
    return sum;
}

int main() {
    int n, d;
    cin >> n >> d;
    vector<vector<int>> points(n, vector<int>(d));
    for (int j = 0; j < n; ++j) {
        for (int i = 0; i < d; ++i) {
            cin >> points.at(j).at(i);
        }
    }
    // next_permutationで回すための配列sampleの用意
    vector<int> sample(n);
    for (int i = 0; i < n; ++i) {
        sample.at(i) = i;
    }
    int ans = 0;
    do {
        if (isSquareNumber(dist(points.at(sample.at(0)), points.at(sample.at(1))))) {
            ans++;
        }
    } while (next_permutation(sample.begin(), sample.end()));
    if (n != 1) cout << ans / factorial(n - 2) / 2 << endl;
    else cout << d * (d - 1) / 2 << endl;
}

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

int main() {
 
    int A,B,C;
    cin >>A>>B>>C;
 
    if(A==B && B==C){
        
        cout<<"No"<<endl;
    }
    else if(A==B || B==C || A==C) {
        
        cout<<"Yes"<<endl;
    }
    
    else{
         cout<<"No"<<endl;
    }
    
    
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	
	Scanner sc = new Scanner(System.in);
	public void run() {
		while(sc.hasNext()){
			int w = sc.nextInt();
			int h = sc.nextInt();
			if(w == 0 && h == 0) break;
			else calc(w, h);
		}
	}
	public void calc(int w, int h){
		int[][] c = new int[h][w];
		for(int i = 0; i < h; i++){
			for(int j = 0; j < w; j++){
				c[i][j] = sc.nextInt();
			}
		}
		int ans = 0;
		for(int i = 0; i < h; i++){
			for(int j = 0; j < w; j++){
				if(c[i][j] == 1){
					calc2(c, i, j);
					ans++;
				}
			}
		}
		System.out.println(ans);
	}
	public void calc2(int[][] c, int x, int y){
		c[x][y] = 0;
		if(x > 0){
			if(c[x-1][y] == 1) calc2(c, x-1, y);
			if(y > 0 && c[x-1][y-1] == 1) calc2(c, x-1, y-1);
			if(y < c[x].length -1 && c[x-1][y+1] == 1) calc2(c, x-1, y+1);
		}
		if(x < c.length -1){
			if(c[x+1][y] == 1) calc2(c, x+1, y);
			if(y > 0 && c[x+1][y-1] == 1) calc2(c, x+1, y-1);
			if(y < c[x].length -1 && c[x+1][y+1] == 1) calc2(c, x+1, y+1);
		}
		if(y > 0 && c[x][y-1] == 1) calc2(c, x, y-1);
		if(y < c[x].length -1 && c[x][y+1] == 1) calc2(c, x, y+1);
	}

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

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

#define forn(i,n) for(int i=0;i<(int)(n);i++)
#define si(c) ((int)(c).size())
#define forsn(i,s,n) for(int i = (int)(s); i<((int)n); i++)
#define dforsn(i,s,n) for(int i = (int)(n)-1; i>=((int)s); i--)
#define all(c) (c).begin(), (c).end()
#define D(a) cerr << #a << "=" << a << endl;
#define pb push_back
#define eb emplace_back
#define mp make_pair

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

void out(const char *s) { 
    cout << s << endl;
    exit(0);
}

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

    int mn = 1e9, mx = -1;
    int n; cin >> n;
    vi a(n); forn(i,n) {
        cin >> a[i];
        mn = min(mn, a[i]);
        mx = max(mx, a[i]);
    }

    int dif;
    if (mn+1 < mx) out("No");
    if (mn == mx) {
        if (mn == n-1) out("Yes");
        if (mn*2 <= n) out("Yes");
        out("No");
    }

    int unique = 0;
    forn(i,n) if (a[i] < mx) unique++;
    int repeat = mx-unique;
    if (1 <= repeat && repeat*2 <= n - unique) out("Yes"); else out("No");

    return 0;
}


Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AABC
{
    class Program
    {
        static void Main(string[] args)
        {
            string kk = Console.ReadLine();
            string[] s = new string[3];
            s[0] = kk.Substring(0, 1);
            s[1] = kk.Substring(1, 1);
            s[2] = kk.Substring(2, 1);

            for(int i = 0; i < 3; i++)
            {
                if(s[i].Equals("1"))
                {
                    s[i] = "9";
                }
                else if(s[i].Equals("9"))
                {
                    s[i] = "1";
                }
                else
                {
                    //何もしない
                }
            }

            int r = int.Parse(s[0])*100 + int.Parse(s[1])*10 + int.Parse(s[2]);
            

            Console.WriteLine(r);

        }
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <vector>
#include <map>
#include <stack>
#include <string>
#include <list>
#include <set>
#include <queue>
#include <deque>
#include <math.h>
using namespace std;

typedef pair<int, int> P;
#define ll long long
#define int ll
#define INF (1LL<<60)
#define mod 1000000007
int dx[4] = { 0, 1, 0, -1 };
int dy[4] = { 1, 0, -1, 0 };


// aとbの最大公約数
ll gcd(ll a, ll b) {
	if (a < b) gcd(b, a);
	ll r;
	while ((r = a%b)) {
		a = b;
		b = r;
	}
	return b;
}

// ax+by=1の解
ll extgcd(ll a, ll b, ll& x, ll& y){
	ll d = a;
	if (b != 0){
		d = extgcd(b, a%b, y, x);
		y -= (a / b)*x;
	}
	else{
		x = 1; y = 0;
	}
	return d;
}

// mod mでのaの逆数
ll mod_inverse(ll a, ll m){
	ll x, y;
	extgcd(a, m, x, y);
	return (m + x%m) % m;
}


signed main(){

	int H, W, A, B;
	cin >> H >> W >> A >> B;
	
	int fact[200001], inv_fact[200001];
	fact[0] = 1;
	inv_fact[0] = 1;
	for (int i = 1; i <= 200000; i++){
		fact[i] = fact[i - 1] * i % mod;
		inv_fact[i] = mod_inverse(fact[i], mod);
	}

	int r = 0;
	for (int i = 0; i < H - A; i++){
		int a = ((fact[B + i - 1] * inv_fact[i]) % mod) * inv_fact[B-1] % mod;
		int b = ((fact[H + W - B - 2 - i] * inv_fact[H - i - 1]) % mod * inv_fact[W - B - 1]) % mod;
		r = r + a*b % mod;
		r %= mod;
	}

	cout << r << endl;

	return 0;
}


Measured memory_bytes: 3328
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<P> Graph;

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

  int n;
  cin >> n;
  
  cout << 800*n - n/15*200 << endl;

  return 0;
}

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

int main()
{
    int N;
    string S, T;
    cin >> N >> S >> T;
    string ans = "";
    for (int i = 0; i < N; i++)
    {
        ans.push_back(S[i]);
        ans.push_back(T[i]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
// MOHIT KUMAR
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pin;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;

#define ff(i, a, b) for ( ll i=a; i<(b); i++)
#define ffd(i, a, b) for ( ll i=a; i<= b; i++)
#define fr(i, a, b) for ( ll i = (b)-1; i >= a; i--)
#define ffr(i, a, b) for ( ll i = b ; i >= a; i--)
#define vl vector < ll >
#define vp vector < pl >
#define endl "\n"
#define sz(x) (ll)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

const ld pi = acos(-1) ;
const ll maxn = 1e5 + 5 ;
const int mod = 1e9 + 7 ;
const ll INF = 1e18 ;
const int MX = 2000000001 ; // check the limits, dummy

int main() {
  ios_base::sync_with_stdio(0) , cin.tie(0);
  ll t, q, n, a, b, c, d, k, l, m, r,  x = 0, y = 0, z = 0 , sum = 0, ans = 0, temp = 0, res = 0 ;
  cin >> n ;
  vl v(n) ;
  ff(i, 0, n) cin >> v[i] ;
  res = v[0] ;
  ff(i, 1, n) {
    if (res > v[i]) ans += (res - v[i]) ;
    res = max(res, v[i]) ;
  }
  cout << ans ;
}

Measured memory_bytes: 4704
#include <bits/stdc++.h>
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define incl(v,x) find(rng(v),x)!=v.end()
#define incls(s,c) s.find(c)!=string::npos
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bit(n,k) ((n>>k)&1) // nのk bit目
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
using vt = vector<T>;
const int mod = 1000000007;
const double EPS = 1e-9;
//const long double EPS = 1e-14;
const int INF = (1<<30)-1;
const ll LINF = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
inline int in() { int x; scanf("%d",&x); return x;}
inline ll lin() { ll x; scanf("%lld",&x); return x;}
inline char chin() { char x; scanf("%c",&x); return x;}
inline string stin() { string x; cin >> x; return x;}
//template<class T = int> inline T in() { T x; cin >> x; return (x);}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
char itoa(int n) { return n + '0';}
ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main () {
  double a, b, C;
  cin >> a >> b >> C;
  double S, L, h;
  C *= M_PI/180;
  S = a*b*sin(C)/2;
  L = a + b + sqrt(a*a + b*b - 2*a*b*cos(C));
  h = b*sin(C);
  cout << fixed << setprecision(10) << S SP L SP h << endl;
  return 0;
}


Measured memory_bytes: 3512
n = gets.to_i
total = 0
x = Array.new(4) { Array.new(3) { Array.new(10) {0} } }
n.times do
  b, f, r, v = gets.split.map(&:to_i)
  x[b-1][f-1][r-1] += v
end

4.times do |i|
  3.times do |j|
    puts " " + x[i][j].join(" ")
  end
  puts "#"*20 if i < 3
end

Measured memory_bytes: 8692
#include<bits/stdc++.h>
#define pb           push_back
#define pf           push_front
#define in           insert
#define ff           first
#define ss           second
#define int          long long
#define rep(i,x,m)   for(int i=x;i<m;i++)
#define MOD          1000000007
#define endl         "\n"
#define all(v)       v.begin(),v.end()
#define rall(v)      v.rbegin(),v.rend()
#define vi           vector<int>
#define pi           pair<int,int>
#define sz(x)       (int)x.size()
#define pq           priority_queue<int>
#define fix(y)       fixed<<setprecision(y)
#define print(v)     for(int i=0;i<v.size();i++) cout<<v[i]<<" ";cout<<endl
#define FIO         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;

int power(int n,int m)
{int p=1;if(m==0)return 1;p=(power(n,m/2)%MOD);p=(p%MOD*p%MOD)%MOD;
return(m&1?((p%MOD*n%MOD)%MOD):(p%MOD));}


void solve()
{
     int n;
     cin>>n;
     int a[n];
     rep(i,0,n)cin>>a[i];
     int b[n];
     memset(b,0,sizeof(b));

    int mx=-1;
     rep(i,0,n)
     {
     	if(i==0)
     	{
     		mx=a[i];
     		b[i]=mx;
     		continue;
     	}
     	mx=max(mx,a[i]);
     	b[i]=mx;
       

     }
     int sum=0;
     
     rep(i,0,n)
     {
     	sum+=b[i]-a[i];
     }
     cout<<sum;


}

signed main()
{
        FIO
        // #ifndef ONLINE_JUDGE
        //   freopen("input.txt","r",stdin);
        //   freopen("output.txt","w",stdout);
        // #endif   
        
        int t=1;
        //cin>>t;
        while(t--)
        solve();
        cerr<<(float)clock()/CLOCKS_PER_SEC*1000<<" ms"<<endl;

        return 0;
}

Measured memory_bytes: 6912
#include<bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;
#define rep(i, N) for(int (i) = 0; (i) < (N); (i)++)
#define all(v) (v).begin(), (v).end()
#define eb emplace_back
#define Cout(s) cout << s << endl
string Yes(bool b) {if(b){return "Yes";} else {return "No";}}
string YES(bool b) {if(b){return "YES";} else {return "NO";}}


int main(){
	int N, M;
	cin >> N >> M;
	Cout((N-1)*(M-1));
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>

int main() {
  using i64 = long long;

  int k, q;
  std::cin >> k >> q;
  std::vector<i64> d(k);
  for (i64 &e : d) {
    std::cin >> e;
  }

  for (int qi = 0; qi < q; qi += 1) {
    i64 n, x, m;
    std::cin >> n >> x >> m;
    // n 項の数列の境界は n-1 個
    n -= 1;

    // d の列は mod m で考える
    std::vector<i64> d2(k);
    for (int i = 0; i < k; i += 1) {
      d2[i] = d[i] % m;
    }

    // 加算される値の合計
    i64 sum = 0;
    // 0 が加算される回数
    i64 zero = 0;

    // 1 周期分を計算
    for (int i = 0; i < k; i += 1) {
      sum += d2[i];
      if (d2[i] == 0)
        zero += 1;
    }
    // floor(n / k) 周期なので掛ける
    sum *= n / k;
    zero *= n / k;

    // 1 周期に届かず残った部分を計算
    for (int i = 0; i < n % k; i += 1) {
      sum += d2[i];
      if (d2[i] == 0)
        zero += 1;
    }

    // m の倍数を跨ぐ回数
    i64 gt = (x + sum) / m - x / m;

    std::cout << n - gt - zero << std::endl;
  }
}

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

int main(){
	int a,b;	cin>>a>>b;
	int n=b-a;
	int ans=0;
	for(int i=1;i<n;i++){
		ans+=i;
	}
	ans-=a;

	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repz(i, z, n) for (decltype(n) i = (z); i < (n); i++)
#define rep(i, n) for (decltype(n) i = 0; i < (n); i++)

#define REPZ(i, z, n) for (decltype(n) i = (z); i <= (n); i++)
#define REP(i, n) for (decltype(n) i = 0; i <= (n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) (*max_element(ALL(v)))
#define MIN(v) (*min_element(ALL(v)))
#define INF 1000000000000  // 1E+12

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<
#define PYES cout << "YES" << endl
#define pyes cout << "Yes" << endl
#define POK cout << "OK" << endl
#define PNO cout << "NO" << endl
#define pno cout << "No" << endl
#define PNG cout << "NG" << endl
#define ret return 0

using namespace std;

// デバッグ用
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

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

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

// typedef
typedef long long ll;
typedef unsigned long long ul;
typedef long double ld;
typedef pair<ll, ll> pl;

// const
// 円周率
const ld pi = acos(-1);
// mod用
// 1E+9 +7
const ll mod = (int)1e+9 + 7;
// 1s間で可能なループ回数2E+8回
// int        最大値2147483647         〜2E+9
// long long  最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<type> push_back
// 連想配列map<key,value> insert,
// 集合set<type>
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 cout << fixed << setprecision(15) << endl;
// to_string<->stoi
// stoll(longlong)
// stod(double)
// deep copy v1->v2 copy(v1.begin(), v1.end(), back_inserter(v2) );
// 大文字65-90(-32)
// 小文字97-122(+32)
//  priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>>
//  ba;
signed main() {
  // faster
  // C言語流の入出力は使用できない
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  char b; cin >> b;
  switch(b){
    case 'A':
      cout << "T" <<endl;
    break;
    case 'C':
      cout << "G" <<endl;
    break;
    case 'G':
      cout << "C" <<endl;
    break;
    case 'T':
      cout << "A" <<endl;
    break;
  }
  ret;
}


Measured memory_bytes: 3648
n = int(input())
a = list(map(int,input().split()))

print(' '.join(map(str, a)))
for i in range(1,n):

    v = a[i]
    j = i -1
    while j>=0 and a[j]>v:
        a[j+1] = a[j]
        j -= 1
    a[j+1] = v
    print(' '.join(map(str, a)))


Measured memory_bytes: 5596
#include <iostream>
#include <vector>
#include <cmath>
#include <limits.h>
typedef long long ll;

using namespace std;

int main() {
  ll N,K;
  cin >> N >> K;
  vector <ll> stones(N);
  for(int i = 0; i < N; i++){
    cin >> stones[i];
  }
  vector <ll> dp(N,LLONG_MAX);
  dp[0] = 0;
  for(int q = 1; q < N; q++){
    for(int p =  1; p < K + 1; p ++){
      if(q-p >= 0){
        dp[q] = min(dp[q], dp[q-p] + abs(stones[q-p] - stones[q]));
      }
    }
  }
  cout << dp[N-1];
}

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

// template {{{
#define  range(i, l, r) for (int i = (int)(l); i < (int)(r); (i) += 1)
#define rrange(i, l, r) for (int i = (int)(r) - 1; i >= (int)(l); (i) -= 1)

#define  whole(f, x, ...) ([&](decltype((x)) container) { return (f)(  begin(container),  end(container), ## __VA_ARGS__); })(x)
#define rwhole(f, x, ...) ([&](decltype((x)) container) { return (f)( rbegin(container), rend(container), ## __VA_ARGS__); })(x)

#define debug(x) cerr << "(" << __LINE__ << ")" << #x << ": " << (x) << endl

using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;

// constexpr i32 mod   = 998244353;
constexpr i32 mod   = 1e9 + 7;
constexpr i32 inf   = 1001001001;
constexpr i64 infll = 1001001001001001001ll;

constexpr int dx[] = {0, -1, 1, 0, -1, 1, -1, 1};
constexpr int dy[] = {-1, 0, 0, 1, -1, -1, 1, 1};

struct IoSetup { IoSetup(int x = 15){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(x); cerr << fixed << setprecision(x); } } iosetup;

template <typename T = i64> T input() { T x; cin >> x; return x; }

template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { range(i, 0, v.size()) { os << v[i] << (i + 1 != v.size() ? " " : ""); } return os; }
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }

template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }

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

template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
// }}}

void solver() {
    int x, n;
    cin >> x >> n;

    set< int > st;
    range(i, 0, n) {
        int p = input();
        st.insert(p);
    }

    int diff = inf, ans = -1;
    range(i, 0, 102) {
        if (st.count(i)) continue;
        if (diff > abs(x - i)) {
            ans = i;
            diff = abs(x - i);
        }
    }

    cout << ans << endl;
}

signed main(int argc, char *argv[]) {
    solver();
}


Measured memory_bytes: 3656
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef istringstream ISS;
typedef ostringstream OSS;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define FOR( v, c ) for ( auto &v : c )

#define EACH( it, c ) for ( auto it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()
#define DRANGE( c, p ) (c).begin(), (c).begin() + p, (c).end()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

const int dy[] = { 1, 0, -1, 0 };
const int dx[] = { 0, 1, 0, -1 };

int direction( char c )
{
	static const string d = "NESW";
	return d.find( c );
}

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

	while ( true )
	{
		int n;
		cin >> n;

		if ( !n )
		{
			break;
		}

		VI xs( n ), ys( n );
		REP( i, 0, n )
		{
			cin >> xs[i] >> ys[i];
		}

		VVI arrived( 21, VI( 21, 0 ) );
		arrived[ 10 ][ 10 ] = 1;
		int y, x;
		y = x = 10;

		int m;
		cin >> m;
		REP( i, 0, m )
		{
			char d;
			int l;
			cin >> d >> l;

			int dir = direction( d );

			REP( j, 0, l )
			{
				y += dy[ dir ];
				x += dx[ dir ];
				arrived[y][x] = 1;
			}
		}

		int res = 0;
		REP( i, 0, n )
		{
			res += arrived[ ys[i] ][ xs[i] ];
		}
		cout << ( res == n ? "Yes" : "No" ) << endl;
	}

	return 0;
}

Measured memory_bytes: 1216
#include <cstdio>
#include <iostream>
#include <queue>
#include <stack>
#include <cmath>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
long long ai[200010];
using namespace std;
int main(){
     int n;
     scanf("%d",&n);
     for(int i=1;i<=n;i++){
     	scanf("%lld",&ai[i]);
	 }
	 int l=1;
	 long long liu=0,saber=0,ks=0;
	 for(int i=1;i<=n;i++){
	      ks+=ai[i];
	      liu^=ai[i];
	    while(liu<ks&&l<=i){
	    	liu^=ai[l];
	    	ks-=ai[l];
	    	saber+=i-l;
	    	l++;
		}
		if(i==n){
			while(liu==ks&&l<=i){
				liu^=ai[l];
				ks-=ai[l];
				saber+=i-l+1;
				l++;
			}
		}
    }
	printf("%lld",saber);
	return 0;
}

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

long long ans = 0;

bool count(long long n, vector<long long> &v) {
    long long add = 0;
    for (long long i = 0; i < n; i++) {
        if (v[i] >= n) {
            add += v[i] / n;
            v[i] = (v[i] % n) - v[i] / n;
        }
    }
    for (long long i = 0; i < n; i++) {
        v[i] += add;
    }
    ans += add;
    return add;
}

int main() {
    long long n; cin >> n;
    vector<long long> v(n);
    for (int i = 0; i < n; i++) cin >> v[i];
    while (count(n, v));
    cout << ans << endl;
    return 0;
}

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

typedef long long ll;
typedef pair<ll, ll> pll;

#define REP(i, n) for(int i=0; i < (n); ++i)
#define mp make_pair
#define fi first
#define se second
#define pb push_back

const int MAX_V = 1e4;
const int MAX_E = 1e4;
ll INF = 1e16;

struct Edge {
    int from, to, w;
};

vector<Edge> w(MAX_E);
ll d[MAX_V];
int V, E;

bool bellman_ford(int s) {
    REP(i, V) d[i] = INF;
    d[s] = 0;

    REP(i, V) {
        REP(j, E) {
            Edge e = w[j];
            if (d[e.from] != INF && d[e.to] > d[e.from] + e.w) {
                d[e.to] = d[e.from] + e.w;

                if (i == V - 1) {
                    return true; // detect negative loop.
                }
            }
        }
    }

    return false; // no negative loops.
}

int main() {
    int r;
    cin >> V >> E >> r;

    REP(i, E) {
        int a, b, c;
        cin >> a >> b >> c;
        w[i] = {a, b, c};
    }


    if (bellman_ford(r)) {
        cout << "NEGATIVE CYCLE" << endl;
    } else {
        REP(i, V) {
            if (d[i] == INF) cout << "INF" << endl;
            else cout << d[i] << endl;
        }
    }
}


Measured memory_bytes: 3228
#include <iostream>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <cstring>
#include <string.h>
#include <sstream>
#include <iomanip>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <tuple>
#include <vector>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
 
typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
const ll MOD = 1e9+7;
const ll CFMOD = 998244353;
const double PI  = 3.14159265358;
const double EPS = 1e-8;
 
#define INT_MX 2147483647
#define INF (((int)1e9) + 7)
#define LLINF ((ll)1e18)
#define F first
#define S second
#define MP(x,y) make_pair(x,y)
#define sz(v) ((int)v.size())
#define rs(n) resize(n)
#define ALL(v) v.begin(),v.end()
#define reset(v) memset((v),0,sizeof(v))
#define EB emplace_back
#define PB push_back
#define PF push_front
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,n,m) for(int i=(n);i<(m);i++)
#define vec vector
#define __ <<' '<<
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

void solve(){
    int h, w, n, tmp;
    
    cin >> h >> w >> n;
    tmp = max(h, w);
    cout << (n + tmp - 1) / tmp << '\n';
    
    
}


 
int main(){
    IOS
    int t = 1;
    
    while(t--){
        solve();
    }
}


Measured memory_bytes: 256
#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 FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define FORR(i, a, b) for(int i = b-1;i >= a;--i)
#define p(s) cout << (s) << endl
#define p2(s,t) cout << (s) << " " << (t) << endl 
#define ALL(v) (v).begin(), (v).end()
#define m0(x) memset(x,0,sizeof(x))
typedef long long ll;

using namespace std;

static const ll MOD  = 1e9 + 7;
static const ll INF  = 1e18;

static const int White = 0;
static const int Gray = 1;
static const int Black = 2;

void pvector(vector<int> A){
    cout << "[vector]";
    for(int i = 0; i < A.size(); i++){
        cout << A[i] << " ";
    }
    cout << endl;
}

int main(){
    double W, H, x, y ;
    cin >> W >> H >> x >> y;
    cout << W * H / 2.0 << " ";
    if( x == (W /2) && y == H / 2){
        p(1);
    }else{
        p(0);
    }
    
}

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

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

#define mp make_pair
#define pb push_back

int cnt[26];
int main() {
    #ifdef LOCAL
    freopen("input.txt", "r", stdin);
    #endif
    ios::sync_with_stdio(0);
    string s; cin >> s;
    // cout << s << endl;
    int N = s.size();
    for (int i=0; i<N; ++i) {
    	++cnt[s[i]-'a'];
    }
    ll ans = 1LL*N*(N-1)/2;
    ++ans;
    // cout << N << endl;
    // cout << ans << endl;
    for (int i=0; i<26; ++i) {
    	ans -= 1LL*cnt[i]*(cnt[i]-1)/2;
    	// cout << ans << endl;
    }
    cout << ans << endl;
}


Measured memory_bytes: 720
#include<iostream>
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<string>
#include<cstring>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<bitset>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;

#define PI 3.141592653589793238462643383279
#define mod 1000000007LL
#define rep(i, n) for(i = 0;i < n;++i)
#define rep1(i, n) for(i = 1;i < n;++i)
#define per(i, n) for(i = n - 1;i > -1;--i)
#define int(x) int x; scanf("%d",&x)
#define int2(x, y) int x, y; scanf("%d%d",&x, &y)
#define int3(x, y, z) int x, y, z; scanf("%d%d%d",&x, &y, &z)
#define int4(v, x, y, z) int v, x, y, z; scanf("%d%d%d%d", &v, &x, &y, &z)
#define int5(v, w, x, y, z) int v, w, x, y, z; scanf("%d%d%d%d%d", &v, &w, &x, &y, &z)
#define ll2(x, y) ll x, y; cin >> x >> y;
#define scn(n, a) rep(i, n)cin >> a[i]
#define sc2n(n, a, b) rep(i, n)cin >> a[i] >> b[i]
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define endl "\n"
#define kabe puts("---------------------------")
#define kara puts("")
#define debug(x) cout << " --- " << (x) << "\n"
#define debug2(x, y) cout << " --- " << (x) << " " << (y) << "\n"
#define debug3(x, y, z) cout << " --- " << (x) << " " << (y) << " " << (z) << "\n"
#define X first
#define Y second
#define eps 0.0001
#define prid(x) printf("%.15lf\n", x)

int n, a[110010] = {0}, b[101010] = {0};
int al[50505] = {0};
int ar[50505] = {0};
int bl[50505] = {0};
int br[50505] = {0};

signed main(void){
  int i, j;
  for(int testcase = 0;testcase >= 0;testcase++){
    cin >> n;
    scn(n, a);
    rep(i, n){
      b[i] = a[i];
      if(i % 2 == 0)al[i / 2] = a[i];
      else ar[i / 2] = a[i];
    }
    sort(al, al + (n + 1) / 2);
    sort(ar, ar + n / 2);
    sort(b, b + n);
    rep(i, n){
      if(i % 2 == 0)bl[i / 2] = b[i];
      else br[i / 2] = b[i];
    }

    //rep(i, n / 2)debug3(i, ar[i], br[i]);

    int res = 0, artop = 0, brtop = 0;
    for(;artop < n / 2 && brtop < n / 2;){
      //pri2(artop, brtop);
      if(ar[artop] == br[brtop]){
        artop++; brtop++; ++res;
      }else if(ar[artop] > br[brtop]){
        brtop++;
      }else{
        artop++;
      }
    }
    pri((n / 2) - res);


/*/

//*/ break;
  }
  return 0;
}


Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define test() int t;cin>>t;loop(test,1,t+1)
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define nl cout<<"\n"
#define sp cout<<" "
#define F first
#define S second
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<pii>
#define vll vector<pll>
#define MOD 1000000007
#define all(x) x.begin(),x.end()

template<class C> void min_self( C &a, C b ){ a = min(a,b); }
template<class C> void max_self( C &a, C b ){ a = max(a,b); }

void mod( ll &n, ll m=MOD ){ n%=m,n+=m,n%=m; }

const int MAXN = 1e5+5;
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};


int main() 
{
    fastio();

    int n,k;
    cin>>n>>k;
    vector<int>v(n);
    vector<bool>dp(k+1);
    for(int &a : v) cin>>a;
    for(int j=0;j<=k;j++)
    {
        for(int x:v)
        {
            if( j >= x && !dp[j-x])
            {
                dp[j] = 1;
            }
        }
    }
    dp[k] ?  cout<<"First" : cout<<"Second";
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define ll long long
#define dd double
#define MOD1 1000000007
#define MOD2 998244353
#define nl cout<<endl
#define rt ll Q[100005]={0}
#define mp make_pair
#define test() ll t;cin>>t;while(t--)
#define pb push_back
#define ff first    
#define ss second
#define all(v) v.begin(),v.end()
#define s(ar,n) sort(ar,ar+n)
#define rs(ar,n) sort(ar, ar+n, greater<ll>()) 
#define oa(a,n) for(ll i=0;i<n;i++)cout<<a[i]<<" ";nl
#define cn(a,n) for(ll i=0;i<n;i++)cin>>a[i];
#define ov(a,n) for(ll i=n-1;i>=0;i--)cout<<a[i]<<" ";nl
#define ovp(a,n) for(ll i=0;i<n;i++)cout<<a[i].ff<<" "<<a[i].ss<<endl;
#define maxa(ar,N) *max_element(ar,ar+N)
#define mina(ar,N) *min_element(ar,ar+N)
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
typedef pair<ll,ll> pii;
ll powe(ll n,ll m){if(m==0)return 1;ll t=powe(n,m/2);if(m%2==0)return (t*t);return (((t*t))*n);}
ll mpowe(ll n,ll m,ll MOD){if(m==0)return 1;ll t=mpowe(n,m/2,MOD);t%=MOD;if(m%2==0)return (t*t)%MOD;return (((t*t)%MOD)*n)%MOD;}
ll logtwo(ll n){if(n==1)return 0;if(n==0) return -1;return logtwo(n/2)+1;}
int main()
{
    fastio();
    
    ll a,b;
    cin>>a>>b;
    cout<<a*b<<endl;
    
}

Measured memory_bytes: 3648
#include <iostream>
#include <string>
#include <list>
using namespace std;
int main(void){
  int n;
  string c;
  list<int> l;
  list<int>::iterator it;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>c;
    if(c=="insert"){
      int x;
      cin>>x;
      l.push_front(x);
    }
    if(c=="delete"){
      int x;
      cin>>x;
      for(it=l.begin();it!=l.end();it++){
	if(*it==x){
	  l.erase(it);
	  break;
	}
      }
    }
    if(c=="deleteFirst")
      l.pop_front();
    if(c=="deleteLast")
      l.pop_back();
  }
  int f=0;
  for(it=l.begin();it!=l.end();it++){
    if(f)
      cout<<" ";
    cout<<*it;
    f++;
  }
  cout<<endl;
  return 0;
}

Measured memory_bytes: 34280
#include<bits/stdc++.h>
#define MAX 200000
using namespace std;
long long dp[MAX+1],total[2],md[MAX+1][2];
int bts(int x)
{
	int res = 0;
	while(x)
	{
		if(x%2)
			++res;
		x /= 2;
	}
	return res;
}
int fp(int a,int b,int mod)
{
	if(b==0)
		return 1;
	long long tmp = fp(a,b/2,mod);
	tmp *= tmp;
	tmp %= mod;
	if(b&1)
		tmp *= a*1LL;
	return tmp%mod;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	dp[0] = 0;
	for(int i=1;i<MAX;++i)
		dp[i] = dp[i%bts(i)]+1;
	int n;
	cin>>n;
	string s;
	cin>>s;
	long long stb = 0;
	for(int i=0;i<n;++i)
		if(s[i]=='1')
			stb++;
	for(int i=0;i<n;++i)
	{
		md[i][0] = 1LL*fp(2,i,stb+1);
		if(stb>1)
			md[i][1] = 1LL*fp(2,i,stb-1);		
	}
	for(int i=0;i<n;++i)
		if(s[i]=='1')
			total[0] += md[n-i-1][0],total[1] += md[n-i-1][1];
	for(int i=0;i<n;++i)
	{
		long long k, m = stb;
		if(s[i]=='0')
			k = total[0]+md[n-i-1][0],m++;
		else
			k = total[1]-md[n-i-1][1],m--;		
		if(m)
		{
			k %= m;
			cout<<dp[k]+1<<endl;
		}
		else cout<<"0"<<endl;
	}
	return 0;
}

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

using namespace std ;

const int MAX = 1e5 + 10 ;

int arr[MAX] ;
int n , m ;
string s , t ;

int main()
{
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	cin>>s ;
	cin>>t ;
	n = s.size() , m = t.size() ;
	int ans = 1e9 ;
	for(int i = 0 ; i <= n-m ; ++i)
	{
		string s2 = s.substr(i , m) ;
		int cnt = 0 ;
		for(int j = 0 ; j < m ; ++j)
		{
			if(s2[j] != t[j])
				cnt++ ;
		}
		ans = min(ans , cnt) ;
	}
	return cout<<ans<<"\n" , 0 ;
}		

Measured memory_bytes: 3664
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <bitset>

using namespace std;
typedef pair<int, int> Pi;
typedef long long ll;
#define pii Pi
#define pll PL
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) ((int)(x).size())
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) (x).begin(), (x).end()
typedef tuple<int, int, int> t3;
typedef pair<ll, ll> PL;

void solve(){
	ll a, b; cin >> a >> b;
	printf("%lld\n", min(b/2, (2*a+b)/4));
}

int main(){
	int Tc = 1; //scanf("%d", &Tc);
	for(int tc=1;tc<=Tc;tc++){
		//printf("Case #%d: ", tc);
		solve();
	}
	return 0;
}

Measured memory_bytes: 256
//#define _USE_MATH_DEFINES
//#include <cmath>
#include <iostream>
//#include <stdio.h>
//#include <stdlib.h>
//#include <iomanip>
#include <vector>
//#include <string>
//#include <algorithm>
//#include <functional>
//#include <time.h>
//#include <sstream>
//#include <queue>
//#include <map>

using namespace std;

int n,s,ans = 0;

bool dfs(int i, int cnt, int sum,vector <int> v){
	//??±???????????¢?´¢
	
	

	if (cnt == n){
		if (sum == s) {
			ans++;
			//for (int j = 0; j < v.size(); j++){
			//	cout << v[j] << " ";
			//}
			//cout << endl;
		}
		return true;
	}

	if (i == 10)return true;


	for (int j = 0; i < v.size(); j++){
		if (v[j] == i)return true;
	}


	//nouse
	dfs(i + 1, cnt, sum, v);

	//use
	v.push_back(i);
	dfs(i + 1, cnt + 1, sum + i,v);

	return false;

}

int main(){

	vector <int> v;

	while (cin >> n >> s){
		if (n == 0)break;
		ans = 0;

		dfs(0, 0, 0, v);

		cout << ans << endl;
	}


	return 0;
}

Measured memory_bytes: 1216
#include <stdio.h>

int main()
{
  int a, b, x;

  scanf("%d%d", &a, &b);

  x=a%b;

  while(x!=0)
    {
      a=b;
      b=x;
      x=a%b;
    }

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

  return 0;
}

Measured memory_bytes: 592
N, X = map(int, input().split())


def count(N, X):
    if N == 0:
        return 1
    if X == 1:
        return 0
    elif 1 < X < 2**(N+1) - 1:
        return count(N-1, X-1)
    elif X == 2**(N+1) - 1:
        return 2**N
    elif 2**(N+1) - 1 < X:
        return 2**N + count(N-1, X-2**(N+1)+1)


print(count(N, X))

Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
typedef long long ll;
int zhuanhua(ll n)
{

    return (int)(log(n)/log(2));
}
int main()
{
  long long h,c,ans;
  cin>>h;
  if(h==1)
  {
      cout<<1<<endl;
  }
  else
  {
    c=zhuanhua(h);
    ans=pow(2,c+1)-1;
    cout<<ans<<endl;
  }
  return 0;
}


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

using namespace std;

int main()
{
	int n, a, b;
	string s;
	cin >> n >> a >> b >> s;
	int cntp = 0, cntb = 0;
	for (int i = 0; i < n; i++)
	{
		if (s[i] == 'a')
		{
			if (cntp < a + b)
			{
				cout << "Yes" << endl;
				cntp++;
			}
			else
				cout << "No" << endl;
		}
		else if (s[i] == 'b')
		{
			if (cntp < a + b && cntb < b)
			{
				cout << "Yes" << endl;
				cntp++;
				cntb++;
			}
			else
				cout << "No" << endl;
		}
		else
			cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 896
#include <cstdio>
#include <queue>
#include <iostream>
#include <algorithm>
using namespace std;
long long gcd(long long a,long long b)
{
    return b ? gcd(b, a % b) : a;
}
long long divide(long long x)
{
    long long cnt=0;
    for (long long i = 2; i <= x / i; i ++ )
        if (x % i == 0)
        {
            cnt++;
            while(x%i==0)   x/=i;
        }
    if(x>1) cnt++;
    return cnt;
}
int main()
{
    long long n,m;
    cin >> n >> m;
    long long u = gcd(n,m);
    cout << divide(u)+1 << endl;
    return 0;
}

Measured memory_bytes: 3532