akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n)  for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define deb(x) cerr << #x <<": " << x << '\n';
#define ios ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
typedef long double ld;
typedef long long ll;

int main(){
    ios;
    double a,b,c,d;
    cin >> a >> b >> c >> d;
    if(ceil(c / b) <= ceil(a / d))cout << "Yes";
    else cout << "No";
    return 0;
}


Measured memory_bytes: 3720
from bisect import bisect_left

s = input()
n = len(s)
ans = [0] * n
l = [i for i in range(n - 1) if s[i] == 'R' and s[i + 1] == 'L']
for i in range(n):
    b = bisect_left(l, i)
    if s[i] == 'R':
        if (l[b] - i) % 2 == 1:
            ans[l[b] + 1] += 1
        else:
            ans[l[b]] += 1
    elif s[i] == 'L':
        if (i - l[b - 1]) % 2 == 1:
            ans[l[b - 1] + 1] += 1
        else:
            ans[l[b - 1]] += 1
a = ''
for i in range(n):
    if i != n - 1:
        a += str(ans[i]) + " "
    else:
        a += str(ans[i])
print(a)

Measured memory_bytes: 6388
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

L, R = nl()

import sys
if R - L >= 2019:
    print(0)
    sys.exit()

res = 2018
L %= 2019
R %= 2019
for i in range(L, R):
    for j in range(i+1, R+1):
        res = min(res, (i * j) % 2019)

print(res)



Measured memory_bytes: 3064
#include <bits/stdc++.h>
    using namespace std;
    #define ll long long int
    #define pb push_back
    #define mp make_pair
    #define mod 1e9+7
    #define sz 100000
    #define f(i,n) for(ll i=0;i<n;i++)
    #define fab(i,a,b) for(ll i=a;i<b;i++)
    #define fr(i,n) for(ll i=n-1;i>=0;i--)
    #define fba(i,b,a) for(ll i=b-1;i>=a;i--)
    #define tc(t) ll t;cin>>t;while(t--)
     
    ll pw(ll x,unsigned ll y) 
    { 
        if (y==0) 
            return 1; 
        else if (y%2==0) 
            return pw(x,y/2)*pw(x,y/2); 
        else
            return x*pw(x,y/2)*pw(x,y/2);
    }
     
    int main() 
    {
        ll r,c,n,ans;
        cin>>r>>c>>n;
        ans=n/max(r,c);
        if(ans*max(r,c)<n) ans++;
        cout<<ans;
        return 0;
    }

Measured memory_bytes: 256
using System;

namespace abc126A
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split();
            int A = int.Parse(str[0]);
            int B = int.Parse(str[1]);
            string C = Console.ReadLine();
            string temp = C.Substring(0, B - 1);
            string hoge = C.Substring(B - 1, 1);
            string moga = C.Substring(B, A - B);
            string mogo = hoge.ToLower();
            Console.WriteLine(temp + mogo + moga);
        }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (a); i < n; i++)
#define print(x) cout << x << endl;
using namespace std;
typedef long long ll;

int main()
{
    int N;
    cin >> N;
    vector<int> h(N);
    rep(i, 0, N) cin >> h[i];

    int dp[N+1];
    dp[0] = 0;
    dp[1] = abs(h[0] - h[1]);
    for (int i = 2; i < N; i++) {
        dp[i] = min(dp[i-1]+abs(h[i] - h[i-1]), dp[i-2]+abs(h[i]-h[i-2]));
    }

    cout << dp[N-1] << endl;

    return 0;
}

Measured memory_bytes: 1024
//
//  main.cpp
//  CoderTest
//
//  Created by yuya on 2019/07/25.
//  Copyright © 2019 yuya. All rights reserved.
//

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;


int main()
{
    
    int N;
    cin >> N;
    vector<int> a(N + 1), b(N + 1);
    for(int i=1;i<=N;i++) cin >> a[i];
    
    int sum = 0;
    for(int i=N;i>=1;i--)
    {
        int balls = 0;
        int j = 2;
        while(i * j <= N)
        {
            balls += b[i * j];
            j++;
        }
        balls = balls % 2;
        if(balls != a[i])
        {
            b[i] = 1;
            sum++;
        }
    }
    
    cout << sum << endl;
    
    if(sum != 0)
    {
        for(int i=1;i<=N;i++)
        {
            if(b[i] == 1) cout << i << " ";
        }
        cout << endl;
    }
    
    
    return 0;
}


Measured memory_bytes: 2432
"use strict";

var main = function main(input) {
  var A = parseInt(input.split("\n")[0], 10);
  var B = parseInt(input.split("\n")[1], 10);
  var C = parseInt(input.split("\n")[2], 10);
  var X = parseInt(input.split("\n")[3], 10);
  var count = 0;

  for (var i = 0; i <= A; i++) {
    for (var j = 0; j <= B; j++) {
      for (var k = 0; k <= C; k++) {
        var total = 500 * i + 100 * j + 50 * k;

        if (total == X) {
          count++;
        }
      }
    }
  }

  console.log(count);
};

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 21064
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>

#define ll long long

using namespace std;



int main(){

    ll NN = 1e+9;
    NN += 7;

    ll n;
    ll m;
    cin >> n >> m;
    ll result=1;

    if(n >= m+2 || m >= n+2){
        cout << 0 << endl; 
    }else if(n == m){
        for(ll i=n; i>0; i--){
            result *= i;
            result %= NN;
        }
        result = result * result;
        result *= 2;
        cout << result % NN << endl;
    }else if(n > m){
        for(ll i=n; i>0; i--){
            result *= i;
            result %= NN;
        }
        for(ll i=m; i>0; i--){
            result *= i;
            result %= NN;
        }
        cout << result % NN << endl;        
    }else if(n < m){
        for(ll i=m; i>0; i--){
            result *= i;
            result %= NN;
        }
        for(ll i=n; i>0; i--){
            result *= i;
            result %= NN;
        }
        cout << result % NN << endl;        
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include<numeric>
#include<cmath>
#include<map>
#include<iomanip>
#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, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
using pll = pair<ll,ll>;
using vvii = vector<vector<int> >;
using vvll =  vector<vector<ll> >;

const ll inf = 1LL << 60;

int main(){
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	//cout << fixed << setprecision(15);
    int N,K;cin >>N>>K;
    vector<int> P(N);
    REP(i,N){
        cin >> P[i];
        P[i]--;
    }
    vector<ll> C(N);
    REP(i,N)cin >> C[i];

    vector<bool> seen(N,false);
    vector<int> count(N,0);
    vector<ll> sum(N,0);
    REP(i,N){
        if(seen[i] == false){
            int now = 0;
            int where = i;
            ll now_sum = 0;
            while(true){
                if(seen[where])break;
                now++;
                now_sum += C[where];
                seen[where] = true;
                where = P[where];
            }
            while(true){
                count[where] = now;
                sum[where] = now_sum;
                where = P[where];
                if(where == i)break;
            }
            //cout << count[i] << " " << sum[i] << endl;

        }
        
    }
    ll ans = -inf;
    //vector<bool> ok(N,false);
    REP(i,N){
        ll shou = K / count[i];
        ll amari = K % count[i];
        ll ruiseki = 0;
        ll now_maxi = -inf;
        int now = i;
        
        REP(k,amari + count[i]){
            ruiseki += C[now];
            now_maxi = max(now_maxi,ruiseki);
            now = P[now];    
        }
        if(sum[i] > 0){
            ans = max(ans, (shou-1)*sum[i] + now_maxi);
        }
        else{
            ans = max(ans, now_maxi);
        }
        /*REP(j,amari){
            ruiseki += C[now];
            now = P[now];
        }
        int front = now;
        int back = i;
        int maxi = ruiseki;

        REP(j,count[i]){
            ll next = ruiseki; //次の累積和
            next -= C[back];
            next += C[front+1];
            ok[back] = true;
            maxi = max(ruiseki,next);

            front = P[front];
            back = P[back];
            ruiseki = next;
        }*/

        //ans = max(ans,shou * sum[i] + maxi);
    
    }

    cout << ans << endl;
}

Measured memory_bytes: 3696
#include <stdio.h>
int main()
{
 int N,i,x;
 scanf("%d",&N);
 for (i = 3; i <= N; i++){
        if (i % 3 == 0)
            printf(" %d", i);
        else {
            x = i;
            while (x != 0){
                if (x % 10 == 3){
                    printf(" %d", i);
                    break;
                }
                x=x/ 10;
            }
     }
    }
      
 printf("\n");
 return 0;
}

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

void fnInput(int& rnStair, vector<int>& rvnBroken)
{
  int nBrokenSiz;
  cin >> rnStair >> nBrokenSiz;
  rvnBroken.resize(nBrokenSiz);

  for (int& rnBroken : rvnBroken)
    cin >> rnBroken;
}

void fnDPWaySet(int nStair, vector<llong>& rvnDPWays)
{
  rvnDPWays.resize(nStair + 1);
  rvnDPWays[0] = 1;

  for (int i = 1; i < rvnDPWays.size(); i++)
  {
    rvnDPWays[i] += rvnDPWays[i - 1];
    if (i > 1)
      rvnDPWays[i] += rvnDPWays[i - 2];

    rvnDPWays[i] %= 1000000007;
  }
}

bool fnUseFulStairSet(int nStair, vector<int>& rvnUseful, const vector<int>& cnrvnBroken)
{
  for (int i = 0; i < cnrvnBroken.size(); i++)
    if (i == 0)
      if (cnrvnBroken[i] == 1);
      else
        rvnUseful.push_back( cnrvnBroken[i] - 1 );
    else
      if (cnrvnBroken[i] - cnrvnBroken[i - 1] == 1)
        return false;
      else
        rvnUseful.push_back( (cnrvnBroken[i] - 1) - (cnrvnBroken[i - 1] + 1) );

  if (cnrvnBroken.size())
    rvnUseful.push_back( nStair - (cnrvnBroken[cnrvnBroken.size() - 1] + 1) );
  else
    rvnUseful.push_back( nStair );
  return true;
}

llong fnNumOfWays(int nStair, const vector<int>& cnrvnBroken)
{
  vector<llong> vnDPWays;
  fnDPWaySet(nStair, vnDPWays);

  vector<int> vnUseful;
  if (!fnUseFulStairSet(nStair, vnUseful, cnrvnBroken))
    return 0;

  llong nNumOfWays = 1;

  for (int nUseful : vnUseful)
  {
    nNumOfWays *= vnDPWays[ nUseful ];
    nNumOfWays %= 1000000007;
  }
  
  return nNumOfWays;
}
  
int main()
{
  int nStair;
  vector<int> vnBroken;

  fnInput(nStair, vnBroken);
  cout << fnNumOfWays(nStair, vnBroken) << endl;

  return 0;
}

Measured memory_bytes: 4564
from bisect import bisect_left
N, M ,K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
SA =[A[0]]
for i in A[1:]:
    SA.append(SA[-1] + i)
SB =[0]
for i in B:
    SB.append(SB[-1] + i)

i = bisect_left(SA, K)
SA = SA[: i+1]
SA.append(2*10**9)
i = bisect_left(SB, K)
SB = SB[: i+1]
if SB[-1] > K: SB.pop()

i, ii = 0, 0
j = len(SB) - 1
ans = [j]
while j >= 0:
    diff = K - SB[j]
    jdg = False
    for ii in range(i, len(SA)):
        if SA[ii] > diff:
            jdg = True
            break
    i = ii
    ans.append(i + j)
    j -= 1
print(max(ans))

Measured memory_bytes: 50244
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
#define forn(i,a,b)for(int i=(a),_b=(b);i<=_b;i++)
#define fore(i,b,a)for(int i=(b),_a=(a);i>=_a;i--)
#define rep(i,n)for(int i=0,_n=n;i<n;i++)
#define ll long long
#define pii pair<int,int>
#define vi vector<int>
#define vpii vector<pii>
#define m_p make_pair
#define re return
#define pb push_back
#define si set<int>
#define ld long double
#define X first
#define Y second
#define st string
#define ull unsigned long long
#define mod 1000000007
#define INF 1000000007
#define x1 XZVJDFADSPFOE
#define y1 GASDIJSLDAEJF
#define x2 DFDAJKVOHKWIW
#define y2 PSFSAODSXVNMQ
#define LLINF 0x3f3f3f3f3f3f3f3fLL
using namespace std;
inline void read(int &x)
{
	short negative=1;
    x=0;
    char c=getchar();
    while(c<'0' || c>'9')
    {
		if(c=='-')
			negative=-1;
		c=getchar();
	}
    while(c>='0' && c<='9')
        x=(x<<3)+(x<<1)+(c^48),c=getchar();
    x*=negative;
}
ll quickpower(ll n,ll k){
	ll ans=1;
	while(k){
		if(k%2){
			ans*=n;
			ans%=mod;
		}
		n*=n;
		n%=mod;
		k/=2;
	}
	return ans;
}
string int_to_string(int n)
{
	string s="";
	while(n)
	{
		int now=n%10;
		s+=now+'0';
		n/=10;
	}
	reverse(s.begin(),s.end());
	return s;
}
int string_to_int(string s)
{
	int n=0;
	rep(i,s.size())
	{
		n*=10;
		n+=s[i]-'0';
	}
	return n;
}
int main()
{
	ios::sync_with_stdio(0);
	//think twice,code once
	int n,m;
	int a[1111];
	cin>>n>>m;
	rep(i,n)cin>>a[i];
	sort(a,a+n);
	ll res=0;
	rep(i,m) res+=a[i];
	cout<<res<<endl;
	return 0;
}



Measured memory_bytes: 3660
import java.util.*;
import java.math.*;
import java.lang.*;

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

class Solution{
	
	private static final int PUDDLE = 0;
	private static final int NONE = 1;
	private static final int ANT = 2;
	private static final int HOLE = 3;
	private static final int FOOD = 4;
	private static final int INF = (1<<20);
	
	private int[][] grid;
	private Scanner scan;
	private int x,y,sx,sy,gx,gy;
	
	void solve(){
		scan = new Scanner(System.in);
		while(input()) System.out.println(dijkstra());
	}

	private boolean input(){
		x = scan.nextInt();
		y = scan.nextInt();
		grid = new int[x][y];
		
		for(int j = 0; j < y; j++){
			for(int i = 0; i < x; i++){	
				grid[i][j] = scan.nextInt();
				if(grid[i][j] == ANT){
					sx = i;
					sy = j;
				}
				if(grid[i][j] == HOLE){
					gx = i;
					gy = j;
				}
			}
		}
		return x!=0||y!=0;	
	}
	
	private int dijkstra(){
		PriorityQueue<State> Q = new PriorityQueue<State>();
		int T[][][] = new int[7][x][y];
		for(int i = 0; i < 7; i++)
			for(int j = 0; j < x; j++)
				for(int k = 0; k < y; k++) T[i][j][k] = INF;
		
		T[6][sx][sy] = 0;
		Q.add(new State(6,sx,sy,0));
		
		int dx[] = {1,0,-1,0};
		int dy[] = {0,1,0,-1};
		
		while(!Q.isEmpty()){
			final State now = Q.poll();
		
			if(T[now.HP][now.x][now.y] < now.cost) continue;
		
			for(int i = 0; i < 4; i++){
				State nex = (State)now.clone();
				
				nex.x += dx[i];
				nex.y += dy[i];
				nex.HP--;
				nex.cost++;
				
				if(nex.HP <= 0) continue;
				if(nex.x < 0 || nex.x >= x) continue;
				if(nex.y < 0 || nex.y >= y) continue;
				if(grid[nex.x][nex.y] == PUDDLE) continue;
				if(grid[nex.x][nex.y] == FOOD) nex.HP = 6;
				
				if(T[nex.HP][nex.x][nex.y] > nex.cost){
					T[nex.HP][nex.x][nex.y] = nex.cost;
					Q.add(nex);
				}
				
			}
		}
		int res = INF;
		for(int i = 1; i < 7; i++) res = Math.min(res, T[i][gx][gy]);
		if(res == INF) res = -1;
		return res;
	}
}

class State implements Comparable, Cloneable{
	public int HP,x,y,cost;
	State(int HP, int x, int y, int cost){
		this.HP = HP;
		this.x = x;
		this.y = y;
		this.cost = cost;
	}
	
	@Override
	public int compareTo(Object o) {
		return new Integer(((State)o).cost).compareTo(new Integer(this.cost));
	}
	
	@Override
	public Object clone(){
		try {
			return super.clone();
		} catch (CloneNotSupportedException e) {
			e.printStackTrace();
		}
		return null;
	}
	
	@Override
	public String toString(){
		return HP + " " + x + " " + y + " " + cost;
	}
}

Measured memory_bytes: 28256
N,A,B = map(int,input().split())
if ((B-A) % 2 == 0):
    print((B-A)//2)
else:
    arr = min(N-B,A-1) + 1
    if (N-B > A-1):
        #Aの方が端に近い
        print(arr + ((B-arr)-1)//2)
    else:
        # Bの方が端に近い
        print(arr + (N-(A+arr))//2)

Measured memory_bytes: 3060
#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

map<int, int> prime_factor(int n) {
    map<int, int> ret;
    for (int i = 2; i * i <= n; i++) {
        while (n % i == 0) {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1) ret[n] = 1;
    return ret;
}

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

    map<int, int> mp;
    for (int i = 1; i <= n; i++) {
        auto f = prime_factor(i);
        for (int i = 1; i <= n; i++) {
            mp[i] += f[i];
        }
    }

    map<int, int> count;
    for (int i = 1; i <= n; i++) count[mp[i]]++;
    for (int i = n; i; i--) count[i - 1] += count[i];

    int ans = 0;
    ans += count[74];
    ans += count[24] * (count[2] - 1);
    ans += count[14] * (count[4] - 1);
    ans += count[4] * (count[4] - 1) / 2 * (count[2] - 2);

    cout << ans << endl;
    return 0;
}

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

class Array{
public:
	string s;
	int value;
};

const int MAXN=40;
Array A[MAXN];
Array B[MAXN];

bool IsEqual(int n){
	for(int i=0;i<n;i++){
		if(A[i].s!=B[i].s)return false;
	}
	return true;
}

int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>A[i].s;
		B[i].s=A[i].s;
		A[i].value=B[i].value=A[i].s[1]-48;
	}
	for(int i=0;i<n;i++){
		for(int j=n-1;j>i;j--){
			if(A[j].value<A[j-1].value){
				swap(A[j],A[j-1]);
			}
		}
	}
	
	for(int i=0;i<n;i++){
		int minn=i;
		for(int j=i+1;j<n;j++){
			if(B[minn].value>B[j].value){
				minn=j;
			}
		}
		swap(B[i],B[minn]);
	}
	
	for(int i=0;i<n;i++){
		cout<<A[i].s;
		if(i!=n-1)cout<<" ";
	}
	cout<<endl<<"Stable"<<endl;
	for(int i=0;i<n;i++){
		cout<<B[i].s;
		if(i!=n-1)cout<<" ";
	}
	if(IsEqual(n)){
		cout<<endl<<"Stable"<<endl;
	}
	else{
		cout<<endl<<"Not stable"<<endl;
	}
	return 0;
}


Measured memory_bytes: 3204
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<set>
#include<map>
#include<queue>
using namespace std;

typedef int ssss;
#define int long long

#define rep(i,n) for(int (i)=0;(i)<(n);++i)
#define rrep(i,n) for(int (i)=(n)-1;(i)>=0;--i)
#define rep1(i,n) for(int (i)=1;(i)<=(n);++i)
#define rrep1(i,n) for(int (i)=(n);(i)>=1;--i)
#define pb push_back
#define fr first
#define sc second

typedef long long ll;
typedef pair<int,int> P;
typedef pair<long long,long long> LP;
typedef double db;
using namespace std;

ll N,K,Q;
ll A[2001];
const ll inf = 0xffffffffffffff;
ll ans = inf;
bool used[2001];
int id[2001];
int zan[2001];
priority_queue<P,vector<P>,greater<P> > q1;
vector<P> v;
priority_queue<P,vector<P>,greater<P> > q;

ll calc(){
  ll l1 = -1LL;
  while(!q.empty()) q.pop();
  rep(i,N){
      zan[i] = 0LL;
  }

  ll cnt = 0LL;
  ll cnt2 = 0LL;

  rep(i,N){
    if(used[i]){
      zan[cnt]= cnt2;
      cnt2=0LL;
      cnt++;
    }
    else{
      q.push(P( A[i], cnt ) );
      cnt2++;
    }
  }
  zan[cnt] = cnt2;
  ll t = Q;
  ll res = 0LL;
  while(!q.empty() ){
    P p = q.top();
    q.pop();
    if(zan[ p.sc ] <= K-1LL) continue;
    if(l1 == -1LL ) l1 = p.fr;
    zan[p.sc]--;
    t--;
    res = max(res, (ll)p.fr);
    if(t==0) return res-l1;
  }
  return inf;
}

ll ss(){
  priority_queue<int,vector<int>,greater<int> > q3;
  rep(i,N) q3.push(A[i]);
  ll r1 = q3.top();
  q3.pop();
  rep(i,Q-2LL) q3.pop();
  ll r2 = q3.top();
  q3.pop();
  return r2-r1;
}

ssss main()
{
  cin>>N>>K>>Q;

  rep(i,N){
    cin>>A[i];
    q1.push(P(A[i],i));
    used[i]=0;
  }
  if(Q==1LL){
    puts("0");
    return 0;
  }
  ans = ss();
  //cout<<ss()<<endl;
  ll res;
  while(!q1.empty()){
    P p = q1.top();
    q1.pop();
    used[p.sc]=1;
    res = calc();
    ans = min(ans,res);
  }
  cout<<ans<<endl;
}


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

#define ll long long
#define sd(x) scanf("%d", &(x))
#define pii pair<int, int>
#define F first
#define S second

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

long long dp[55][55];
vector<ll> masks[55][55];
int a[55], b[55];
vector<ll> vec[55];
int main(){
	masks[0][0].push_back(0);
	long long mx = 0;
	for(int i = 1; i <= 50; i++){
		masks[i][i].push_back({0});
		for(int j = 0; j < i; j++){
			for(int k = 1; k <= i; k++){
				for(auto it : masks[i%k][j])
					masks[i][j].push_back((1LL <<(k)) | it);
			}
		}
	}
	int n;
	cin >> n;
	for(int i = 1; i <= n; i++) cin >> a[i];
	for(int i = 1; i <= n; i++) cin >> b[i], vec[i] = masks[a[i]][b[i]];
	long long ans = 0;
	for(int i = 50; i >= 1; i--){
		// check without ith bit
		bool ok = 1;
		bool fuck = 0;
		for(int j = 1; j <= n; j++){
			if(vec[j].empty()) fuck = 1;
			bool ok2 = 0;
			for(auto it : vec[j]) if(!(it >> i & 1)) ok2 = 1;
			if(!ok2){
				ok = 0;
				break;
			}
		}
		if(fuck){
			printf("-1\n");
			return 0;
		}
		if(!ok){
			ans += (1LL << i);
		} else{
			for(int j = 1; j <= n; j++){
				vector<ll> nw;
				for(auto it : vec[j]) if(!(it >> i & 1)) nw.push_back(it);
				vec[j] = nw;
			}
		}
	}
	cout << ans;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define all(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main(){
    int N;
    cin >>N;
    set<string> S;
    string tmp;
    rep(i,N){
        cin >>tmp;
        S.insert(tmp);
    }
    cout << S.size() << endl;
    return 0;
}

Measured memory_bytes: 19252
#include <iostream>

using namespace std;

int main() {
    string s;
    int m, h;
    int h_sum;

    while (1) {
        cin >> s;
        if (s == "-") {
            break;
        }

        cin >> m;
        h_sum = 0;
        for (int i=0; i<m; ++i) {
            cin >> h;
            h_sum += h;
        }
        h_sum %= s.length();
        cout<<s.substr(h_sum)<<s.substr(0, h_sum)<<endl;
    }
    return 0;
}



Measured memory_bytes: 3124
#include<bits/stdc++.h>
using namespace std;
int N;
int main(){
  cin >> N;
  if(N%10==3){
    cout << "bon" << endl;
  }else if(N%10 ==  0 || N%10 ==  1 || N%10 ==  6 || N%10 ==  8){
    cout <<  "pon" << endl;
  }else{
    cout << "hon" << endl;
  }
}


Measured memory_bytes: 3592
#include<stdio.h>
#include <stdlib.h>
#include<string>
#include<queue>
#include<algorithm>
#include<math.h>

using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
const long long INF = 1LL << 60;
typedef pair<int, int> P;





int main(){
    int a[3];
    scanf("%d %d %d", a, a + 1, a + 2);
    sort(a, a + 3);
    int answer = 1;
    if(a[0] != a[1]) answer++;
    if(a[1] != a[2]) answer++;
    printf("%d", answer);
    return 0;
}

Measured memory_bytes: 128
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

typedef long double ld;
typedef long long ll;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define pb push_back
#define mp make_pair
#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const ld eps = 1e-9;
const ld pi = acos((ld) -1);

mt19937 mrand(random_device{} ()); 

int rnd(int x) {
  return mrand() % x;
}

void precalc() {
}

const int maxn = (int) 1e5 + 5;
int n;
int a[maxn], b[maxn];

int read() {
  if (scanf("%d", &n) < 1) {
    return false;
  }
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &a[i], &b[i]);
  }
  return true;
}

void solve() {
  long long res = 0;
  for (int i = n - 1; i >= 0; i--) {
    int x = (a[i] + res) % b[i];
    if (x) {
      res += b[i] - x;
    }
  }
  printf("%lld\n", res);
}

int main() {
  precalc();
#ifdef LOCAL
  assert(freopen(TASK ".in", "r", stdin));
  assert(freopen(TASK ".out", "w", stdout));
#endif
  while (true) {
    if (!read()) {
      break;
    }
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;
//0608
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a=sc.nextInt(),b=sc.nextInt(),c=sc.nextInt(),d=sc.nextInt(),e=sc.nextInt();
        System.out.println(Math.min(a*e,b+(e-c>0?(e-c)*d:0)));
    }
}


Measured memory_bytes: 26256
#include<stdio.h>

int main(void)
{
  int A, B, C, D, counter = 0;

  scanf("%d %d %d %d", &A, &B, &C, &D);

  while(A > 0 && C > 0){
    if(counter % 2 == 0){
      C -= B;
    }else{
      A -= D;
    }
    counter ++;
  }

  if(A <= 0){
    printf("No\n");
  }else{
    printf("Yes\n");
  }

  return 0;
}

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

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rep2(i,s,n) for(int i = (s); i < (n); ++i)
#define ll long long
#define ld long double
#define P pair<ll,ll>
#define all(v) v.begin(),v.end()

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);

ll keta(ll m,ll n){
    string s=to_string(m),t=to_string(n);
    return max(s.size(),t.size());
}

int main(void)
{
    ll n; cin>>n;
    ll ans=INF;
    for(int i=1;i<=sqrt(n);i++){
        ll b=n/i;
        if(b*i==n) ans=min(ans,keta(i,b));
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3752
#include<iostream>
using namespace std;
 
int main(){
  int a, b;
  
  while(true) {
    cin >> a >> b;
    
    if(a == 0 && b == 0) {
      break;
    }
    
    if(a > b) {
      cout << b << " " << a << endl;
    } else {
      cout << a << " " << b << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 3060
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
#include <climits>
#include <queue>
#include <iomanip>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i = 0; i < (ll)(n); ++i)
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;}

const int maxn=100000;
int dp[maxn+1];

int main(){
	int n;
	cin >> n;
	
	const int INF=1<<20;
	
	REP(i,maxn+1) dp[i] = INF;
	
	dp[0] = 0;
	for(int i=0; i<=maxn; i++){
		chmin(dp[i+1], dp[i]+1);
		for(int j=6; i+j<=maxn; j*=6){
			chmin(dp[i+j], dp[i]+1);
		}
		for(int j=9; i+j<=maxn; j*=9){
			chmin(dp[i+j], dp[i]+1);
		}
	}
	
	cout << dp[n] << endl;
	
	return 0;
}

Measured memory_bytes: 4020
N, M = map(int, input().split(" "))
min_l = 1
max_r = N

for m in range(M):
    l, r = map(int, input().split(" "))
    if l > min_l:
        min_l = l
    if r < max_r:
        max_r = r

ans = (max_r-min_l)+1
if ans < 0:
    ans = 0

print(ans)


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

int main() {
  int num, max;
  cin >> num;
  vector<int> range(num), type;
  for(int i=0; i<num; i++)
    cin >> range.at(i);
  
  type.push_back(range.at(0));
  for(int i=1; i<num; i++) {
    bool exist=false;
    for(int j=0; j<type.size(); j++)
      if(range.at(i)==type.at(j))
        exist=true;
    if(!exist)
      type.push_back(range.at(i));
  }
  cout << type.size() << endl;
}

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

using namespace std;

typedef long long ll;

int P(int num){
    int ans = 1;
    for(int i = 2; i <= num; i++) ans*=i;
    return ans;
}

int n;
int cnt(int num){
    int nums[9];
    for(int i = 0; i < n; i++){
        nums[i] = num%10;
        num/=10;
    }
    bool used[9]={false};
    int th = 0;
    for(int i = n-1; i>=0; i--){        
        int unused = 0;
        for(int j = 1; j < nums[i]; j++){
            if(!used[j])unused++;
        }
        used[nums[i]]=true;
        th += P(i)*unused;
    }
    return th;
}

int main(){
    cin >> n;
    int p=0, q=0;
    for(int i = 0; i < n; i++){
        int pp;
        cin >> pp;
        p += int(pp*pow(10, n-i-1));
    }
    for(int i = 0; i < n; i++){
        int qq;
        cin >> qq;
        q += int(qq*pow(10, n-i-1));
    }
    cout << abs(cnt(p)-cnt(q)) << endl;

    return 0;
}

Measured memory_bytes: 384
#define _CRT_NONSTDC_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <array>
#include <algorithm>
#include <list>
#include <iomanip>
#include <queue>
#include <functional>
#include <cassert>
#include <cmath>
#include <set>
#include <map>
#include <numeric>
#include <vector>

using namespace std;
using ll = long long;
const int INTMAX = numeric_limits<int>::max();
const int INTMIN = numeric_limits<int>::min();
const ll LLMAX = numeric_limits<long long>::max();
const ll LLMIN = numeric_limits<long long>::min();
const int MOD = 1000000007;
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }

bool solve() {
	int n, k;
	cin >> n >> k;
	deque<int>v(n);
	for (auto&& e : v) cin >> e;
	ll ans = 0;

	
	for (int lout = 0; lout <= k; lout++) {
		for (int rout = 0; lout + rout <= k; rout++) {
			deque<int> vt(v);
			priority_queue<int, std::vector<int>, greater<int>> q;
			ll sum = 0;
			for (int i = 0; i < lout; i++) {
				if (vt.empty()) break;
				q.push(vt.front());
				sum += vt.front();
				vt.pop_front();
			}
			for (int i = 0; i < rout; i++) {
				if (vt.empty()) break;
				q.push(vt.back());
				sum += vt.back();
				vt.pop_back();
			}
			for (int i = 0; i < k - lout - rout; i++) {
				if (q.empty()) break;
				if (q.top() < 0) {
					sum -= q.top();
					q.pop();
				} else
					break;
			}
			ans = max(ans, sum);
		}

	}

	cout << ans << endl;

	return true;
}

signed main() {
	solve();

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <sstream>
#include <fstream>

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)

using namespace std;
typedef long long unsigned int ll;

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  if (A == B) {
    cout << C << endl;
  } else if (B == C) {
    cout << A << endl;
  } else {
    cout << B << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <iomanip>

using namespace std;

int main() {
	int a, b, d, r;
	double f;
	double A, B;
	cin >> a >> b;
	d = a / b;
	r = a % b;
	A = a * 10 / 10;
	B = b * 10 / 10;
	f = A / B;

	cout << fixed << setprecision(5);

	cout << d << " " << r << " " << f << endl;

}


Measured memory_bytes: 3276
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        int a[] = new int[N];
        int maxI = 0;
        for(int i = 0; i < N; i++) {
            a[i] = sc.nextInt();
            maxI = Math.max(maxI, a[i]);
        }
        
        int maxJ = 0;
        int maxJJ = 0;
        for(int i = 0; i < N; i++) {
            int r = maxI - a[i];
            int x = Math.min( a[i], r );
            if( maxJ < x ) {
                maxJJ = a[i];
            }
            maxJ = Math.max(maxJ, x);
        }
        System.out.println( maxI + " " + maxJJ );
        // System.out.println( comb( (long)maxI, (long)maxJJ ) );
    }
    
    public static long comb( long i , long j ) {
        long X = perm(i, j);
        long Y = 1;
        for(long x = j; 0 < x; x--) {
            Y *= x;
        }
        

        return X / Y;
    }
    
    public static long perm( long i , long j ) {
        long sum = 1;
        for(long x = 0; x < j; x++) {
            sum *= i;
            i--;
        }
        return sum;
    }
}


Measured memory_bytes: 59912
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<chrono>
#include<random>
#include<cstdio>
#include<set>
#include<map>
#define MAX_N 10
#define MAX_M 100
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;


int main(){
    ll a,b,c;
    cin>>a>>b>>c;
    //cout<<sqrt(a)<<"\n"<<sqrt(b)<<"\n"<<sqrt(c)<<"\n";
    if((c-a-b)>0 && 4*a*b<(c-a-b)*(c-a-b)){
        cout<<"Yes";
    }else{
        cout<<"No";
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
//#pragma GCC optimize("Ofast")
//#define _GLIBCXX_DEBUG
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
//#define int ll
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define floatprec(dig) fixed << setprecision(dig)
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
#define invar(typ, var) typ var; cin >> var;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX / 2;
const ll LLINF = 1LL<<60;
constexpr ll MOD = 1000000007;
const double EPS = 1e-9;

signed main(void) {
  cin.tie(0); ios::sync_with_stdio(false);
  
  ll N, M;
  cin >> N >> M;
  vll H(N);
  rep(i, N) {
    cin >> H[i];
  }
  
  vvll points(N);
  rep(i, M) {
    ll a, b;
    cin >> a >> b;
    a--; b--;
    points[a].push_back(b);
    points[b].push_back(a);
  }
  
  ll ct = 0;
  rep(i, N) {
    bool ng = false;
    for(auto p : points[i]) {
      if(H[i] <= H[p]) ng = true;
    }
    if(!ng) ct++;
  }
  fin(ct);
  // vi goods(N, 1);
  
  // map<pair<ll,ll>, ll> seen;
  
  // rep(i, M) {
  //   ll a, b;
  //   cin >> a >> b;
  //   a--; b--;
  //   if(a > b) swap(a, b);
  //   if(seen.find(mp(a, b)) != seen.end()) {
  //     seen.emplace(mp(a, b), 0);
  //   }
  //   seen[mp(a, b)] ++;
  // }
  // for(auto abp : seen) {
  //   ll a = abp.first.first;
  //   ll b = abp.first.second;
  //   //aからbに行けて、bの方が以上 
  //   if(H[b] >= H[a]) {
  //     goods[a] = 0;
  //   }
  //   if(H[a] >= H[b]) {
  //     goods[b] = 0;
  //   }
  // }
  
  // ll ct = 0;
  // rep(i, N) {
  //   if(!goods[i]) ct++;
  // }
  // fin(ct);
}

Measured memory_bytes: 9748
//ヒットアンドブロー
#include<cstdio>

using namespace std;

int main(void){
	int hit,blow,i,j;
	int a[4],b[4];

	while(scanf("%d %d %d %d",&a[0],&a[1],&a[2],&a[3])==4){
		scanf("%d %d %d %d",&b[0],&b[1],&b[2],&b[3]);
		hit=0;
		blow=0;
		for(i=0;i<4;i++){
			for(j=0;j<4;j++){
				if(a[i]==b[j]){
					if(i==j)
						hit++;
					else
						blow++;
				}
			}
		}
		printf("%d %d\n",hit,blow);
	}

	return 0;
}

Measured memory_bytes: 0
def match(ch1, ch2):
    return ch1 == ch2 or ch1 == '?' or ch2 == '?'

def solve():
    MAXLEN = 2000
    a = raw_input()
    b = raw_input()
    c = raw_input()
    lA = len(a); lB = len(b); lC = len(c)
    MAXLEN = max(lA, lB, lC)
    ab = [True for i in range(10*MAXLEN)]
    ac = [True for i in range(10*MAXLEN)]
    bc = [True for i in range(10*MAXLEN)]
    for i in range(lA):
        for j in range(lB):
            if not match(a[i], b[j]):
                ab[i - j + 5 * MAXLEN] = False
    for i in range(lA):
        for j in range(lC):
            if not match(a[i], c[j]):
                ac[i - j + 5 * MAXLEN] = False
    for i in range(lB):
        for j in range(lC):
            if not match(b[i], c[j]):
                bc[i - j + 5 * MAXLEN] = False
    ret = lA + lB + lC
    for i in range(-2*MAXLEN, 2*MAXLEN+1):
        for j in range(-2*MAXLEN, 2*MAXLEN+1):
            if i < -MAXLEN and j > 0:
                continue
            if i > MAXLEN and j < 0:
                continue
            if j < -MAXLEN and i > 0:
                continue
            if j > MAXLEN and i < 0:
                continue
            if ab[i + 5*MAXLEN] and ac[j + 5*MAXLEN] and bc[j - i + 5*MAXLEN]:
                L = min(0, i, j)
                R = max(lA, lB + i, lC + j)
                ret = min(ret, R - L)
    print ret

if __name__ == '__main__':
    solve()


Measured memory_bytes: 35100
<?php

fscanf(STDIN, "%d %d", $n, $m);

$even = 0;
if ($n >= 2) {
    $even = $n * ($n - 1) / 2;
}

$odd = 0;
if ($m >= 2) {
    $odd = $m * ($m - 1) / 2;
}

echo $even + $odd;


Measured memory_bytes: 4728
w, h, n = map(int, input().split())
xya = [list(map(int, input().split())) for _ in range(n)]

ans=[0,0,w,h]
for i in range(n):
    if xya[i][2] == 1:
        if xya[i][0] >= ans[0]:
            ans[0] = xya[i][0]
    elif xya[i][2] == 2:
        if xya[i][0] <= ans[2]:
            ans[2] = xya[i][0]
    elif xya[i][2] == 3:
        if xya[i][1] >= ans[1]:
            ans[1] = xya[i][1]
    elif xya[i][2] == 4:
        if xya[i][1] <= ans[3]:
            ans[3] = xya[i][1]

print(0 if (ans[2]-ans[0])<=0 or (ans[3]-ans[1])<=0 else (ans[2]-ans[0])*(ans[3]-ans[1]))


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <iomanip>
#include <algorithm>
#include <iostream>
#define ll long long int
#define cases int t; cin >> t; while (t--)
#define fir for (ll i = 0; i < n; i++)
#define fira for (ll i = 0; i < n; i++) cin >> a[i]
#define firan ll n; cin >> n; ll a[n]; fira;
#define pb push_back
using namespace std;

int main()
{
    int a, b; cin >> a >> b;
    int d = a*b;
    bool temp = false;
    for (int i = 1; i < 4; i++) 
    {
        if ((d*i)%2!=0)
        {
            temp = true;
            break;
        }
    }
    if (temp == true) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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

ll n, m;
vector<P> jobs;

int main() {
    cin >> n >> m;
    for(ll i = 0; i < n; i++) {
        ll day, money;
        cin >> day >> money;
        jobs.emplace_back(day, money);
    }
    sort(rbegin(jobs), rend(jobs));

    ll ans = 0;
    priority_queue<ll> cand;
    for(int day = 1; day <= m; day++) {
        while(jobs.size() > 0 && jobs.back().first == day) {
            cand.push(jobs.back().second);
            jobs.pop_back();
        }
        if(cand.size() == 0)  continue;
        ans += cand.top();  cand.pop();
    }

    cout << ans << endl;
}

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

using namespace std;

int main(){


    int c;
    int odd,even;
    cin>>c;
    if(c%2==0){
    odd=c/2;
    even=c/2;
    }
    else{
    odd=c/2+1;
    even=c/2;
    }
    cout<<(odd*even);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; i++)
int main() {
    int n;
    cin>>n;
    vector<int> p(n);
    rep(i,n) 
        cin>>p[i];
    int k= 0;
    rep(i,n) 
        if(p[i] !=i+ 1) k++;
    if(k<= 2) 
        cout<<"YES"<<endl;
    else 
        cout<<"NO"<<endl;
    return 0;
}

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

typedef long long ll;
typedef double db;
typedef vector<int> vi;
typedef vector<long> vll;
typedef pair<int, int> pi;
typedef pair<long long, long long> pll;
typedef vector<pair<int, int>> vpi;
typedef vector<pair<long long, long long>> vpll;

#define F first
#define S second
#define PB push_back
#define MP make_pair

int main() {
    int n, a;
    vi s;
    cin >> n;
    for (int i = 0; i < n; i++) {
        s.PB(0);
    }
    for (int i = 1; i < n; i++) {
        cin >> a;
        s[a - 1] += 1;
    }
    for (int si : s) {
        cout << si << "\n";
    }

    return 0;
}


Measured memory_bytes: 4316
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <list>
#include <map>
using namespace std;
#define forr(i,m,n) for (int i=(m); i<=(n); i++)
#define forv(i,m,n) for (int i=(m); i>=(n); i--)
#define forall(it,p) for (auto it = p.begin(); it != p.end(); ++it)
#define DBG 0
#define R 1000000007L

#define MAXN 100001
int x[MAXN];
int y[MAXN];
int dstn[MAXN];
long bw[MAXN][2];
list<int> proc;
list<int> nextproc;
list<int> dst[MAXN];

int main() {
  int n, lasti;
  cin >> n;
  if (n<=2) {
    cout << (n==1 ? 2 : 3);
    exit(0);
  }
  forr(i,0,n-2) {
    int xx, yy;
    cin >> xx >> yy;
    x[i] = xx - 1;
    y[i] = yy - 1;
    dst[y[i]].push_back(x[i]);
    dst[x[i]].push_back(y[i]);
  }
  proc.clear();
  forr(i,0,n-1) {
    dstn[i] = dst[i].size();
    bw[i][0] = bw[i][1] = -1;
    if (dstn[i] == 1) {
      bw[i][0] = bw[i][1] = 1;
      proc.push_back(i);
      if (DBG) cout << "leaf push " << i << endl;
    }
  }

  if (DBG) {
    forr(i,0,n-1) {
      cout << "dst " << i << "(" << dstn[i] << "):";
      forall(it, dst[i])
        cout << *it << " ";
      cout << endl;
    }
  }
  while(!proc.empty()) {
    int i = proc.front();
    lasti = i;
    proc.pop_front();
    if (bw[i][0] == -1) {
      long bsum = 1, wsum = 1;
      forall(it,dst[i]) {
        if (bw[*it][1] == -1) continue;
        // B can have W only
        bsum = (bsum * bw[*it][1]) % R;
        wsum = (wsum * (bw[*it][0] + bw[*it][1])) % R;
              // W can have both
      }
      bw[i][0] = bsum;
      bw[i][1] = wsum;
    }
    forall(it2,dst[i]) {
      if (--dstn[*it2] == 1){
        nextproc.push_back(*it2);
        if (DBG) cout << "push " << *it2 << endl;
      }
    }
    if (proc.empty()) {
      forall(it3, nextproc)
        proc.push_back(*it3);
      nextproc.clear();
    }

    if (DBG) {
      cout << " dstn    b    w   in proc " << i << endl;
      forr(i,0,n-1) {
        cout << dstn[i] << "   " << bw[i][0]
                        << "   " << bw[i][1] << endl;
      }
    }
  }
  cout << (bw[lasti][0] + bw[lasti][1]) % R;
}


Measured memory_bytes: 13952
#include <algorithm>
#include <bits/stdc++.h>
#include <limits>

#define ll long long
#define pi (acos(-1))
#define rep(i, n) for (unsigned long long i = 0; i < (unsigned long long)(n); ++i)
using namespace std;
std::vector<unsigned ll> genprimevec(const unsigned ll N);
int main()
{
int n;cin>>n;
rep(i,n+1){
	int x=i*(1.08);
	if(x==n){
		cout<<i<<endl;return 0;
	}

}
cout<<":("<<endl;
return 0;
}

/*author  https://qiita.com/drken/items/0c88a37eec520f82b788*/
ll extgcd(ll a, ll b, ll &x, ll &y)
{
    if (b == 0)
    {
        x = 1, y = 0;
        return a;
    }
    ll d = extgcd(b, a % b, y, x);
    y -= a / b * x;
    return d;
}


std::vector<unsigned ll> genprimevec(const unsigned ll N)
{
    std::vector<bool> is_prime(N + 1);
    for (unsigned ll i = 0; i <= N; i++) { is_prime[i] = true; }
    std::vector<unsigned ll> P;
    for (unsigned ll i = 2; i <= N; i++)
    {
        if (is_prime[i])
        {
            for (unsigned ll j = 2 * i; j <= N; j += i) { is_prime[j] = false; }
            P.emplace_back(i);
        }
    }
    return P;
}


Measured memory_bytes: 3588
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
int x[58],y[58];
map<pint,int> me;
int n;
int cal(int dx,int dy){
	int ret=n;
	rep(i,n){
		ret-=me[mp(x[i]-dx,y[i]-dy)];
	}
	return ret;
}
int main()
{
	cin>>n;
	rep(i,n){
		cin>>x[i]>>y[i];
		me[mp(x[i],y[i])]++;
	}
	int out=n;
	rep(i,n) rep(j,n){
		if(x[i]!=x[j] || y[i]!=y[j]){
			out=min(out,cal(x[i]-x[j],y[i]-y[j]));
		}
	}
	cout<<out<<endl;
}


Measured memory_bytes: 4096
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 3e5 + 10;
#define fi first
#define se second
#define pb push_back
#define wzh(x) cerr<<#x<<'='<<x<<endl;
int n,k,a[N],b[N];
const int inf = 1e9;
struct uzi {
#define mid (l+r>>1)
#define ls o<<1
#define rs o<<1|1
  int t[N << 2], laz[N << 2];
  void build(int o, int l, int r) {
    laz[o] = t[o] = -inf;
    if (l == r)return;
    build(ls, l, mid);
    build(rs, mid + 1, r);
  }
  void up(int o, int l, int r, int x, int y) {
    if (l == r) {
      t[o] =max( y,t[o]);
      return ;
    }
    if (x <= mid)up(ls, l, mid, x, y);
    else up(rs, mid + 1, r, x, y);
    t[o] = max(t[ls], t[rs]);
  }
  int get(int o, int l, int r, int x, int y) {
    assert(x <= y);
    if (l >= x && r <= y)return t[o];
    int res = -inf;
    if (x <= mid)res = max(res, get(ls, l, mid, x, y));
    if (y > mid)res = max(res, get(rs, mid + 1, r, x, y));
    return res;
  }
#undef mid
#undef ls
#undef rs
} T;
int dp[N];
int main() {
  ios::sync_with_stdio(false);
  cin>>n>>k;
  for(int i=1;i<=n;i++)cin>>a[i];
  T.build(1,1,300000);
  T.up(1,1,300000,a[1],1);
  int ans=1;
  for(int i=2;i<=n;i++){
    int y=max(1,T.get(1,1,300000,max(a[i]-k,1),min(a[i]+k,300000))+1);
    T.up(1,1,300000,a[i],y);
    ans=max(ans,y);
    //cout<<i<<' '<<a[i]<<' '<<y<<endl;
  }
  cout<<ans<<'\n';
  return 0;
}

Measured memory_bytes: 13040
#include<stdio.h>
#define MAX 100005
#define INFTY 1000000000
typedef struct{
  char c;
  int  n;
} Card;

void Merge(Card *A,int left,int mid,int right){
  int n1,n2,i,j,k;
  Card l[MAX/2],r[MAX/2];

  n1 = mid-left;
  n2 = right-mid;
  for(i=0;i<n1;i++) l[i] = A[left+i];
  for(i=0;i<n2;i++) r[i] = A[mid+i];
  l[n1].n = INFTY;
  r[n2].n = INFTY;
  i=0;
  j=0;

  for(k=left;k<right;k++){
    if(l[i].n<=r[j].n){
      A[k] = l[i];
      i++;
    }
    else{
      A[k] = r[j];
      j++;
    }
  }
}

void MergeSort(Card *A, int left, int right){
  int mid;

  if(left+1<right){
    mid = (left+right)/2;
    MergeSort(A, left, mid);
    MergeSort(A, mid, right);
    Merge(A, left, mid, right);
  }
}

int Partition(Card *A,int p,int r){
  int x,i,j;
  Card tmp;

  x = A[r].n;
  i = p-1;
  for(j=p;j<r;j++){
    if(A[j].n<=x){
      i++;
      tmp = A[i];
      A[i] = A[j];
      A[j] = tmp;
    }
  }
 tmp = A[i+1];
 A[i+1] = A[r];
 A[r] = tmp;

  return i+1;
}

void QuickSort(Card *A, int p, int r){
  int q;

  if(p<r){
    q = Partition(A,p,r);
    QuickSort(A,p,q-1);
    QuickSort(A,q+1,r);
  }
}

int main(){
  Card A[MAX],B[MAX];
  int n,i,left,right,flag=0;

  scanf("%d",&n);
  left = 0;
  right = n;
  for(i=0;i<n;i++){
    scanf("%s %d",&A[i].c,&A[i].n);
    B[i] = A[i];
  };
  QuickSort(A,0,n-1);
  MergeSort(B,left,right);
  for(i=0;i<n;i++){
    if(A[i].c != B[i].c){
      flag++;
      printf("Not stable\n");
      break;
    }
  }
  if(flag == 0) printf("Stable\n");

  for(i=0;i<n;i++) printf("%c %d\n",A[i].c,A[i].n);

  return 0;
}



Measured memory_bytes: 4064