akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

/**
 * https://atcoder.jp/contests/abc157/tasks/abc157_a
 *
 */
public final class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			int ans = n / 2 + (n % 2);
			System.out.println(ans);
		}
	}

}


Measured memory_bytes: 25300
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


template<typename T> void drop(const T &x){cout<<x<<endl;exit(0);}

//INSERT ABOVE HERE
signed main(){
  Int n,m;
  cin>>n>>m;
  vector<Int> ds(n);
  for(Int i=0;i<n;i++) cin>>ds[i];
  using P = pair<Int, Int>;
  map<P, Int> idx;
  vector< vector<Int> > G(n);
  for(Int i=0;i<m;i++){
    Int u,v;
    cin>>u>>v;
    u--;v--;
    idx[minmax({u,v})]=i;
    G[u].emplace_back(v);
    G[v].emplace_back(u);
  }

  vector<P> vp;
  for(Int i=0;i<n;i++)
    vp.emplace_back(ds[i],i);
  sort(vp.begin(),vp.end());

  const Int INF = 1e9;
  vector<Int> cs(n,-1);
  vector<Int> ans(m,INF);

  // same value
  for(auto p:vp){
    Int v=p.second;
    for(Int u:G[v]){
      if(~cs[u]) continue;
      if(ds[u]==ds[v]){
        if(cs[v]<0) cs[v]=0;
        cs[u]=!cs[v];
        ans[idx[minmax({u,v})]]=ds[v];
      }
    }
  }

  // other value
  for(auto p:vp){
    Int v=p.second;
    if(~cs[v]) continue;
    for(Int u:G[v]){
      if(ds[u]>ds[v]) continue;
      assert(ds[u]<ds[v]);
      assert(~cs[u]);
      cs[v]=!cs[u];
      ans[idx[minmax({u,v})]]=ds[v];
      break;
    }
    if(cs[v]<0) drop(-1);
  }

  for(Int i=0;i<n;i++) cout<<"BW"[cs[i]];
  cout<<endl;
  for(Int i=0;i<m;i++) cout<<ans[i]<<endl;
  return 0;
}


Measured memory_bytes: 27508
#include <bits/stdc++.h>
 
#define rep(i,n) for(ll i=0;i<n;++i)
#define ALL(a) (a).begin(),(a).end()
 
using namespace std;
using ll  = long long;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
 
const ll MOD  = 1e9+7;
const ll LINF = 1LL << 60;
const int INF = 1e9 + 7;

int mvx[]={0, 0, -1, 1};
int mvy[]={-1, 1, 0, 0};

int main(){
    int h, w;
    cin >> h >> w;

    string board[h];
    rep(i, h)cin >> board[i];

    int ans = 0;
    rep(i, h)rep(j, w){
        if(board[i][j] == '.')ans++;
    }

    queue<pll> que;
    que.push(make_pair(0, 0));

    bool visited[h][w] = {};
    visited[0][0] = true;

    int cnt[h][w] = {};
    cnt[0][0] = 1;

    while(!que.empty()){
        pll pos = que.front();
        que.pop();

        if(pos.first == h-1 && pos.second == w-1)break;

        rep(i, 4){
            int dx = pos.second + mvx[i];
            int dy = pos.first + mvy[i];

            if(dx < 0 || dx >= w || dy < 0 || dy >= h)continue;

            if(visited[dy][dx] || board[dy][dx] == '#')continue;
            visited[dy][dx] = true;

            cnt[dy][dx] = cnt[pos.first][pos.second] + 1;
            que.push(make_pair(dy, dx));
        }
    } 

    if(cnt[h-1][w-1] <= 0)cout << -1 << endl;
    else cout << ans - cnt[h-1][w-1] << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e12;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}
ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

//dp
int n, m;
vector<P> vp;
ll dp[510][1100];

int main() {
	cin >> n >> m;
	if (m == 0) {
		cout << n + 1 << endl;
		return 0;
	}
	rep(i, m) {
		ll c, d;
		cin >> c >> d;
		vp.push_back({ c,d });
	}
	sort(ALL(vp));
	vector<P> vp2;
	ll d = -1;
	rep(i, vp.size()) {
		if (d < vp[i].second) {
			d = vp[i].second;
			vp2.push_back(vp[i]);
		}
	}
	rep(i, 510)rep(j, 1010)dp[i][j] = INF;
	dp[0][0] = 0;
	int now = 0;
	rep(i, vp2.size()) {
		ll ci = vp2[i].first;
		ll di = vp2[i].second;
		FOR(j, di, n + 2) {//新しく経由する点
			FOR(k, now, n + 2) {//今までに経由した点
				if (k < j)dp[i + 1][j] = min(dp[i + 1][j], dp[i][k] + (j - now) + (j - ci));
				else dp[i + 1][j] = min(dp[i + 1][j], dp[i][j] + (ci - now));
			}
		}
		now = ci;
	}
	//FOR(i, 1, m + 1) {
	//	if (dp[i][5] == INF) {
	//		cout << i << endl;
	//		break;
	//	}
	//}
	//rep(i, vp2.size() + 1) {
	//	if (i != vp2.size())continue;
	//	rep(j, n + 1) {
	//		if (dp[i][j] != INF)printf("%4d", dp[i][j]);
	//		else cout << " INF";
	//	}
	//	cout << endl;
	//}
	ll ans = INF;
	rep(i, n + 2) {
		ans = min(dp[vp2.size()][i] + n + 1 - now, ans);
	}
	cout << ans << endl;
	//cout << dp[vp2.size()][d] + n + 1 - now << endl;
}

//int n, m;
//vector<P> vp;
//int sum[100100];
//
//int main() {
//	cin >> n >> m;
//	vp.resize(m);
//	rep(i, m) {
//		int a, b;
//		cin >> a >> b;
//		sum[a]++;
//		sum[b]--;
//	}
//	rep(i, n + 2)sum[i + 1] += sum[i];
//	ll ans = 0;
//	rep(i, n + 1) {
//		if (sum[i] > 0)ans += 3;
//		else ans++;
//	}
//	cout << ans << endl;
//}


Measured memory_bytes: 7524
import java.util.Scanner;

public class Main {
	void run() {
		Scanner scan = new Scanner(System.in);
		while (true) {
			String str = scan.next();
			if (str.equals("0")) break;
			char[] cnum = str.toCharArray();
			int sum = 0;
			for (char c : cnum) {
				sum += Character.getNumericValue(c);
			}
			System.out.println(sum);
		}
	}
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 26256
local function upper_bound(key,ary)
    local n=#ary
    if n==0 then
        return 1 
    end
    if key<ary[1] then
        return 1
    end
    if key>=ary[n] then
        return n+1
    end
    local min,max=1,n
    while 1<max-min do
        local mid=(min+max)//2
        if key>=ary[mid] then
            min=mid
        else
            max=mid
        end
    end
    return max
end

local n=io.read("n")
local a={}
for i=1,n do
    a[i]=io.read("n")
end

local INF=math.maxinteger
local dp={}
for i=1,n do
    dp[i]=INF
end

local len=0
for i=n,1,-1 do
    local k=upper_bound(a[i],dp)
    dp[k]=a[i]
    len=math.max(k,len)
end
print(len)

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

string s;
bool flag=false;

int main()
{
    cin>>s;
    int N=s.size();
    for (int i=0; i<(N-1)/2; i++) {
        if (s.at(i)==s.at(N-1-i)) flag=true;
        else {
            flag=false;
            break;
        }
    }
    if (flag) {
        if ((N-1)/2%2==1){
            N=(N-1)/2;
            for (int i=0; i<(N-1)/2; i++) {
                if (s.at(i)==s.at(N-1-i)) {
                    flag=true;
                }
                else {
                    flag=false;
                    break;
                }
            }
        }
        else if((N-1)/2%2==0) {
            N=N/2;
            for (int i=0; i<N/2; i++) {
                if (s.at(i)==s.at(N-1-i)) {
                    flag=true;
                }
                else {
                    flag=false;
                    break;
                }
            }
        }
        if (flag) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(){
	string s;
	cin >> s;
	int i,n = s.size();
	int cnt1 = 0,cnt2 = 0;
	for(i=0;i<n;i++){
		if(i&1){
			if(s[i]=='0') cnt1++;
			else cnt2++;
		}else{
			if(s[i]=='1') cnt1++;
			else cnt2++;
		}
	}
	cout << min(cnt1,cnt2) << endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    bool flag=false;
    for(int i=1;i<=9;i++){
        if(n%i==0&&n/i<10){
            flag=true;
            break;
        }else{
            flag=false;
        }
    }
    if(flag)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 ull = unsigned long long;
//#define ll long long
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define rep(i, n) REP(i, 0, n)
#define rep_rev(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
ll t1,t2,t3;
const ll mod = 1000000007;
const int INF = 1e9;
const ll INFLONG = 1e18;



int main(){
  ll n;
  cin >> n;
  vector<ll> vec(n);
  map<ll,ll> mp;
  rep(i,n){
    cin >> vec[i];
  }
  rep(i,n){
    t1 = vec[i];
    t1 -= (i+1);
    if(-n <= t1 && t1 <= n){
      mp[-t1]++;
      //cou[t1 + n]++;
    }
  }
  ll piv = 0;
  ll ans = 0;

//  REP(i,-1,10){
//    cout << mp[i] << endl;
//  }
  rep(i,n){
    t1 = vec[i];
    t1 -= (i+1);
    if(-n <= t1 && t1 <= n){
      mp[-t1]--;
    }
    piv++;
    if(-n <= piv + vec[i] && piv + vec[i] <= n){
      ans += mp[piv + vec[i]];
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 17252
import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int num = sc.nextInt();
		int[] cities = new int[num+1];
		int[] savers = new int[num];
		for(int i = 0; i <= num; i++)cities[i] = sc.nextInt();
		for(int i = 0; i < num; i++)savers[i] = sc.nextInt();

		double ans = 0;
		for(int i = 0; i < num; i++){
			if(savers[i] <= cities[i]){
				ans += savers[i];
				savers[i] = 0;
				continue;
			}else{
				ans += cities[i];
				savers[i] -= cities[i];
			}
			
			if(savers[i] <= cities[i+1]){
				ans += savers[i];
				cities[i+1] -= savers[i];
			}else{
				ans += cities[i+1];
				cities[i+1] = 0;
			}
		}


		System.out.printf("%.0f\n", ans);
	}
}


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


#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define pii pair<int,int>
#define ll long long
#define el '\n'

using namespace std;


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

    int n,x;
    cin >> n >> x;

    int ar[n+1];
    for (int i=1;i<=n;i++){
        cin >> ar[i];
    }

    int cur=0;
    for (int i=2;i<=n+1;i++){
        cur+=ar[i-1];
        if (cur>x){
            cout << i-1 << el;
            return 0;
        }
    }

    cout << n+1 << el;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MAX_V 200
#define INF 1<<29
using namespace std;
struct edge{int to,cap,rev;};
vector<edge>G[MAX_V];
int level[MAX_V];
int iter[MAX_V];
void add_edge(int from,int to,int cap){
  G[from].push_back((edge){to,cap,G[to].size()});
  G[to].push_back((edge){from,0,G[from].size()-1});
}
void bfs(int s){
  memset(level,-1,sizeof(level));
  queue<int>q;
  level[s]=0;
  q.push(s);
  while(!q.empty()){
    int v=q.front();q.pop();
    for(int i=0;i<G[v].size();i++){
      edge &e=G[v][i];
      if(e.cap>0&&level[e.to]<0){
        level[e.to]=level[v]+1;
        q.push(e.to);
      }
    }
  }
}
int dfs(int v,int t,int f){
  if(v==t)return f;
  for(int &i=iter[v];i<G[v].size();i++){
    edge &e=G[v][i];
    if(e.cap>0&&level[v]<level[e.to]){
      int d=dfs(e.to,t,min(f,e.cap));
      if(d>0){
        e.cap-=d;
        G[e.to][e.rev].cap+=d;
        return d;
      }
    }
  }
  return 0;
}
int max_flow(int s,int t){
  int flow=0;
  while(1){
    bfs(s);
    if(level[t]<0)return flow;
    memset(iter,0,sizeof(iter));
    int f;
    while((f=dfs(s,t,INF))>0){
      flow+=f;
    }
  }
}
#define r(i,n) for(int i=0;i<n;i++)
int main(){
  int n,m;
  cin>>n;
  r(j,n){
    int a,b;
    cin>>a>>b;
    a--,b--;
    for(int i=a;i<=b;i++){
      add_edge(1+j,i+110,1);
    }
  }
  r(i,100)add_edge(0,i+1,1);
  r(i,36)add_edge(i+110,199,1);
  int p=max_flow(0,199);
  cout<<p*50+31*50<<endl;
}

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

#define ll long long int
ll mod=1e9+7;

// vector<ll> g[200005];
// ll vis[200005];
// queue<ll> q;
// ll level[200005];

// void dfs(ll i)
// {
//     vis[i] = 1;
//     for(ll j=0;j<g[i].size();j++)
//     {
//         ll child = g[i][j];
//         if(vis[child] == 0)
//         {
//             dfs(child);
//         }
//     }
// }

// void bfs(ll i)
// {
//     vis[i] = 1;
//     while(!q.empty())
//     {
//         ll top = q.front();
//         ll len_adj = g[top].size();
//         ll j;
//         for(j=0;j<len_adj;j++)
//         {
//             ll v = g[top][j];
//             if(vis[v]==0)
//             {
//                 vis[v]=1;
//                 q.push(v);
//                 level[v] = level[top] + 1;
//             }
//         }   
//         q.pop();
//     }
// }

vector<ll> DecToBinary(ll num,ll trailing_zero, ll nbits)
{
    vector<ll> bits;
    while(num > 0)
    {
        bits.push_back(num%2);
        num /= 2;
    }

    if(trailing_zero == 1)
    {
        while(bits.size() < nbits)
        {
            bits.push_back(0);
        }
    }

    return bits;
}

long long int BinaryToDec(vector<ll> bits)
{
    ll number = 0;
    ll i;
    for(i=bits.size()-1;i>=0;i--)
    {
        number += (bits[i] * (long long)pow((ll)2 , i));
    }
    return number;
}

ll modular_exponentiation(ll base, ll power)
{
    ll ans = 1;
    base = base % mod;
    while (power > 0)
    {
        if (power & 1)
        {
            ans = (ans * base) % mod;
        }

        power /= 2;
        base = (base * base) % mod;
    }
    return ans;
}

int main()
{
    /* Faster input ouput */
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    // cout.tie(NULL);

    /* To read input from a file and output to a file */
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    
    ll t = 1;
    // cin >> t;
    while(t--)
    {        
        ll n,i,j;
        cin >> n;
        ll arr[n];

        ll sum = 0;
        unordered_map<ll,ll> mp;

        for(i=0;i<n;i++)
        {
            cin >> arr[i];
            sum += arr[i];
            auto it = mp.find(arr[i]);
            if(it == mp.end())
            {
                mp[arr[i]] = 1;
            }
            else
            {
                mp[arr[i]]++;
            }
            
        }

        ll q;
        cin >> q;
        for(i=0;i<q;i++)
        {
            ll a,b;
            cin >> a >> b;
            auto it = mp.find(a);
            if(it != mp.end())
            {
                mp.erase(a); 
                ll times = it->second;
                sum -= (a*times);
                // sum -= a;
                sum += (b*times);

                auto it2 = mp.find(b);
                if(it2 == mp.end())
                {
                    mp[b] = times;
                }
                else
                {
                    mp[b] += times;
                }
            }
            
            cout << sum << '\n';
        }
    }
    
    return 0;
}

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

#define M 876543/* your task*/
#define NIL (-1)
#define L 14

char H[M][L]; /* Hash Table */

int getChar(char ch){
  if ( ch == 'A') return 1;
  else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  else if ( ch == 'T') return 4;
  return -1;
}

/* convert a string into an integer value */
long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}

int h1(int key){ return key%M; }
int h2(int key){ return key%L; }

int find(char str[]){
  int key = (int)(getKey(str)&0x7fffffff);
  return (H[h1(key)][h2(key)]=='\0'?0:1);
}

int insert(char str[]){
  int key = (int)(getKey(str)&0x7fffffff);
  H[h1(key)][h2(key)] = 't';
  return 0;
}

int main(){
    int i, n, h;
    char str[L], com[9];
    for ( i = 0; i < M; i++ ) H[i][0] = '\0';
    
    scanf("%d", &n);
    
    for ( i = 0; i < n; i++ ){
	scanf("%s %s", com, str);
	
	if ( com[0] == 'i' ){
	    insert(str);
	} else {
	    if (find(str)){
		printf("yes\n");
	    } else {
		printf("no\n");
	    }
	}
    }

    return 0;
}

Measured memory_bytes: 12572
import itertools


min_time = 1000000
D = [int(input()) for _ in range(5)]
for p in itertools.permutations(D):
    time = 0
    for i in range(5):
        d = p[i]
        if i < 4:
            for _ in range(9):
                if d%10 == 0:
                    break
                d += 1
        time += d
    min_time = min(min_time, time)
print(min_time)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 99999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(20) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,R) vector<vector<L>> K(N, vector<L>(M,R))
#define pint pair<lli,lli>
#define Lower(v,X) lower_bound(v.begin(),v.end(),X)-v.begin();
#define mod 1000000007
#define MAX 5100000
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int main(){
  lli A,B,C,D,E,L,R,X,Y,W,H,N,M,K,sum=0,num=0,flag=0;string S,T;
  cin >> N;
  rep(i,1,N+1)if(i%2)sum++;
  Out((double)sum/N);
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){

	int i,j;
	int d,s;

	while(scanf("%d",&d)!=EOF){
		s=0;
		j=600/d;
		for(i=0;i<j;i++){
			s+=((d*i)*(d*i))*d;
		}
		printf("%d\n",s);
	}

	return 0;
}

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

int main(){
  string s;
  int SAM = 700;
  cin >> s;
  if(s[0] == 'o') SAM += 100;
  if(s[1] == 'o') SAM += 100;
  if(s[2] == 'o') SAM += 100;
  cout << SAM << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set> 
#include <map>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iomanip>
#define REP(i,n) for(int i=0; i<(n); ++i)
#define FOR(i,a,b) for(int i=(a); i<(b); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const ll INFLL = 100100100100100100;
const int MOD = (int)1e9 + 7;
const ll MODLL = (ll)1e9 + 7;
const double EPS = 1e-9;

int main () {
    
    int n; cin >>n;
    vector<int> a(n); REP(i,n) cin >> a[i];
    vector<int> b(n); REP(i,n) cin >> b[i];
    vector<int> c(n); REP(i,n) cin >> c[i];
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    sort(c.begin(), c.end());

    vector<ll> bc(n);
    for (int i = 0; i < n; i++) {
        int thisb = b[i];
        int ok = n;
        int ng = -1;
        while (abs(ok - ng) > 1) {
            int m = (ok+ng)/2;
            if (c[m] > thisb) {
                ok = m;
            } else {
                ng = m;
            } 
        }
        bc[i] = (ll)(n - ok);
    }

    vector<ll> cumbc(n+1, 0);
    for (int i = n-1; i >= 0; i--) {
        cumbc[i] = cumbc[i+1] + bc[i];
    }

    ll res = 0;
    for (int i = 0; i < n; i++) {
        int thisa = a[i];
        int ok = n;
        int ng = -1;
        while (abs(ok - ng) > 1) {
            int m = (ok+ng)/2;
            if (b[m] > thisa) {
                ok = m;
            } else {
                ng = m;
            } 
        }
        res += cumbc[ok];
    }

    cout << res << endl;
    return 0;
}


Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll h,w;
	cin>>h>>w;
	ll dx[4]={1,0,-1,0};
	ll dy[4]={0,1,0,-1};
	char ch[22][22];
	for(ll i=0;i<h;i++){
		for(ll j=0;j<w;j++){
			cin>>ch[i][j];
		}
	}
	ll ans=0;
	for(ll i=0;i<h;i++){
		for(ll j=0;j<w;j++){
			if(ch[i][j]=='#'){
				continue;
			}
			queue<pair<ll,ll>>q;
			q.push(make_pair(i,j));
			ll sum[22][22];
			for(ll i=0;i<h;i++){
				for(ll j=0;j<w;j++){
					sum[i][j]=0;
				}
			}
			sum[i][j]=1;
			while(q.size()!=0){
				ll nowx=q.front().first;
				ll nowy=q.front().second;
				q.pop();
				for(ll k=0;k<4;k++){
					ll nexx=nowx+dx[k];
					ll nexy=nowy+dy[k];
					if(nexx<0||nexx==h||nexy<0||nexy==w){
						continue;
					}
					if(ch[nexx][nexy]=='#'||sum[nexx][nexy]!=0){
						continue;
					}
					sum[nexx][nexy]=sum[nowx][nowy]+1;
					q.push(make_pair(nexx,nexy));
					ans=max(sum[nexx][nexy],ans);
				}
			}
		}
	}
	cout <<ans-1;
	return 0;
}

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

struct edge { int to, cost; };
typedef pair<int, int> P;
typedef pair<string, int> SP;
#define rep(i, n) for(int i = 0; i < n; ++i)

const int INF = 1e9 + 7;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    // vvvi V (50, vvi(50, vi(2500)));

    string s;
    cin >> s;
    rep(i, s.length()){
        if(s[i] == '7'){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;

    return 0;
}

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

int main(){
  string a, b, c;
  cin >> a >> b >> c;
  bool sw_a = true;
  bool sw_b = false;
  bool sw_c = false;
  while(true){
    if(sw_a){
      if(a.size() == 0){
        cout << "A" << endl;
        break;
      }
      if(a[0] == 'b'){
        sw_b = true;
        sw_a = false;
      }
      if(a[0] == 'c'){
        sw_c = true;
        sw_a = false;
      }
      a.erase(a.begin());
    }
    if(sw_b){
      if(b.size() == 0){
        cout << "B" << endl;
        break;
      }
      if(b[0] == 'a'){
        sw_a = true;
        sw_b = false;
      }
      if(b[0] == 'c'){
        sw_c = true;
        sw_b = false;
      }
      b.erase(b.begin());
    }
    if(sw_c){
      if(c.size() == 0){
        cout << "C" << endl;
        break;
      }
      if(c[0] == 'a'){
        sw_a = true;
        sw_c = false;
      }
      if(c[0] == 'b'){
        sw_b = true;
        sw_c = false;
      }
      c.erase(c.begin());
    }

  }
}

Measured memory_bytes: 256
import java.util.Scanner;
class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int[] h = new int[n];
		for(int i = 0; i < n; i++) {
			h[i] = sc.nextInt();
		}
		int[] a = new int[m];
		int[] b = new int[m];
		int[] no = new int[n];
		for(int i = 0; i < n; i++) {
			no[i] = 0;
		}
		for(int i = 0; i < m; i++) {
			a[i] = sc.nextInt();
			b[i] = sc.nextInt();
			if( h[a[i]-1] >= h[b[i]-1] ) {
				no[b[i]-1] = 1; 
			}
			if( h[a[i]-1] <= h[b[i]-1]){
				no[a[i]-1] = 1;
			}
		}
		
		int count = 0;
		for(int i = 0; i < n; i++) {
			if( no[i] == 0) {
				//System.out.println(i+1);
				count++;
			}
		}
		
		System.out.println(count);
	}
}

Measured memory_bytes: 62800
#include<bits/stdc++.h>
#define int long long
using namespace std;
int mod=1000000007;
#define r(i,n) for (int i=0; i < (n); i++)
main(){
	int h,w;
	cin>>h>>w;
	int a[h],b[w],c[h],d[w],H=0,W=0;
	r(i,h)cin>>a[i];
	r(i,w)cin>>b[i];
	int ta[h],tb[w];
	r(i,h-1)ta[i]=a[i+1]-a[i];
	r(i,w-1)tb[i]=b[i+1]-b[i];
	h--;
	w--;
	r(i,h)a[i]=ta[i];
	r(i,w)b[i]=tb[i];
	int hh=h-2;
	c[0]=c[h-1]=h;
	for(int i=1;i<h/2;i++){
		c[i]=c[h-1-i]=c[i-1]+hh;
		hh-=2;
	}
	if((h%2)&&h!=1)c[h/2]=c[(h/2)-1]+1;
	int ww=w-2;
	d[0]=d[w-1]=w;
	for(int i=1;i<w/2;i++){
		d[i]=d[w-1-i]=d[i-1]+ww;
		ww-=2;
	}
	if((w%2)&&w!=1)d[w/2]=d[(w/2)-1]+1;

	r(i,h)H+=(a[i]*c[i]),H%=mod;
	r(i,w)W+=(b[i]*d[i]),W%=mod;
	cout<<(H*W)%mod<<endl;
}

Measured memory_bytes: 4992
#include <stdio.h>

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

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

int N, K;
int A;

int main(int argc, char* argv[]){
  cin >> N >> K;
  for(int i = 0; i < N; i++) cin >> A;
  int ans;
  if(N-K==0) ans = 1;
  else if((N-K)%(K-1)==0) ans = 1 + (N-K)/(K-1);
  else ans = 1 + (N-K)/(K-1) + 1;
  cout << ans << endl;
}


Measured memory_bytes: 256
/* by Natsu Kinmoe */
#include <bits/stdc++.h>
using namespace std;
#define SZ(x)               ((int)(x).size())
#define all(x)              (x).begin(), (x).end()
#define loop(i, n)          for(int i = 0; i < (n); i++)
#define cont(i, n)          for(int i = 1; i <= (n); i++)
#define circ(i, a, b)       for(int i = (a); i <= (b); i++)
#define range(i, a, b, c)   for(int i = (a); ((c) > 0 ? i <= (b) : i >= (b)); i += (c))
#define foreach(it, v)      for(__typeof((v).begin()) it = (v).begin(); it != (v).end(); it++)
#define y0          y0O0OO00OO0OO0OO0OOO00OO0OO0O0O000OO0
#define y1          y1II11II11III11I1III11II111IIII1II1I1
#define pub         push_back
#define pob         pop_back
#define mak         make_pair
typedef long long   ll;
typedef long double lf;
const int   Inf = 0x3f3f3f3f;
const ll    INF = 0x3f3f3f3f3f3f3f3fll;
/* Source code starts here */

typedef __int128 lll;
ll n;

inline void exgcd(lll a, lll b, lll &x, lll &y) {b ? (exgcd(b, a % b, y, x), y -= a / b * x) : (x = 1, y = 0);}
inline ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;}

int main() {
	cin >> n; n *= 2;
	ll ans = n;
	for(ll i = 1; i * i <= n; i++) {
		if(n % i) continue;
		ll now = i;
		lll x, y;
		if(gcd(now, n / now) == 1) {
			exgcd(n / now, now, x, y);
			y = -y; ((y %= n / now) += n / now) %= n / now;
			if(y) ans = min(ans, ll(y * now));
		}
		now = n / i;
		if(gcd(now, n / now) == 1) {
			exgcd(n / now, now, x, y);
			y = -y; ((y %= n / now) += n / now) %= n / now;
			if(y) ans = min(ans, ll(y * now));
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3644
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define repi(i,a,b) for(int i = (a); i < (b); i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
int a[1000010]={0};
bool flag[1000010]={false};
void hamming(){
	a[1]=1;
	flag[1]=true;
	for(int i=2;i <=1000000;i++){
		if(i%2==0&&flag[i/2])flag[i]=true;
		if(i%3==0&&flag[i/3])flag[i]=true;
		if(i%5==0&&flag[i/5])flag[i]=true;
		if(flag[i]){
			a[i]=(a[i-1]+1);
		}else{
			a[i]=a[i-1];
		}
	}
	return ;
}
int main(){
	hamming();
	int n,m;
	while(cin>>n>>m,n){
		cout <<a[m]-a[n-1]<<endl;
	}
	return 0;
}

Measured memory_bytes: 5740
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int n,m,sum;
char step;
char map[105][105];
int dx[4]={0,0,1,-1};
int dy[4]={1,-1,0,0};
void dfs(int x,int y){
	map[x][y]='.';
	for(int i=0;i<4;i++){
		int xx=x+dx[i];
		int yy=y+dy[i];
		if(xx>=0&&xx<n&&yy>=0&&yy<m&&map[xx][yy]==step)
		dfs(xx,yy);
	}
}
int main(){
	while(~scanf("%d%d",&n,&m)){
		if(n==0&&m==0) break;
		sum=0;
		memset(map,'\0',sizeof(map));
		for(int i=0;i<n;i++)
		   cin>>map[i];
		for(int i=0;i<n;i++)
		   for(int j=0;j<m;j++){
			if(map[i][j]!='.'){
				step=map[i][j];
				dfs(i,j);
				sum++;
			}
		}
		cout<<sum<<endl;
	}
	return 0;
}

Measured memory_bytes: 3444
//By Don4ick 
//#define _GLIBCXX_DEBUG

#include <bits/stdc++.h>

typedef long long ll;
typedef long double ld;
typedef unsigned int ui;

#define forn(i, n) for (int i = 1; i <= n; i++)
#define pb push_back
#define all(x) x.begin(), x.end()
#define y1 qewr1234

const double PI = acos(-1.0);
const int DIR = 4;
const int X[] = {1, 0, -1, 0};
const int Y[] = {0, 1, 0, -1};

const int N = (int)1e5 + 228;

using namespace std;

int n, a[N];

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

	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);

	//~read
	scanf("%d", &n);
	forn(i, n)
		scanf("%d", &a[i]);
	//~solve
	sort(a + 1, a + n + 1);
	int ptr = 1;
	while(ptr < n && a[n - ptr] >= ptr + 1)
		ptr++;
	if (a[n - ptr + 1] == ptr && (ptr == n || a[n - ptr + 1] > a[n - ptr]))
	{
		cout << "Second" << endl;
		return 0;
	}
	if (((a[n - ptr + 1] - ptr) & 1))
	{
		cout << "First" << endl;
		return 0;
	}
	if (ptr < n)
	{
		int cnt = ptr - a[n - ptr];
		for (int i = n - ptr; i >= 1; i--)
		{
			cnt++;
			if (i == 1 || a[i] > a[i - 1])
				break;
		}
		if ((cnt & 1))
		{
			cout << "First" << endl;
			return 0;
		}
	}
	cout << "Second" << endl;

	return 0;
}



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

#define int long long

int32_t main()
{
    //FILE *fptr1=freopen("in.txt","r",stdin);
  int a,b,c,k;
  cin>>a>>b>>c>>k;
  int ans=0;
  int y=k;
  k-=a;
  if(k<=0)
  {
    cout<<y<< "\n";
    return 0;
  }
  ans+=a;
  y=k;
  k-=b;
  if(k<=0)
  {
    cout<<ans<< "\n";
    return 0;
  }
  //cout<<ans<< "\n";
  //ans+=b;
  y=k;
  k-=c;
  if(k<=0)
  {
    cout<<ans-y<< "\n";
    return 0;
  }
  ans-=c;
  cout<<ans<< "\n";

  return 0;
}


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

typedef long long llong;

const int N = 1 << 17;

const llong inf = 1e15;

struct segtree {
    llong T[2 * N];

    segtree() {
        for (int i = 0; i < 2 * N; i++)
            T[i] = inf;
    }

    void put(int i, llong x) {
        int v = i + N;
        T[v] = min(T[v], x);
        while ((v >>= 1) > 0) {
            T[v] = min(T[2 * v], T[2 * v + 1]);
        }
    }
    llong get(int l, int r) {
        l += N;
        r += N;
        llong ans = inf;
        while (l <= r) {
            ans = min(ans, T[l]);
            ans = min(ans, T[r]);
            l = (l + 1) / 2;
            r = (r - 1) / 2;
        }
        return ans;
    }
} T1, T2;

llong D[N];
llong X[N];

int main() {
    int n;
    scanf("%d", &n);
    llong E, T;
    scanf("%lld %lld", &E, &T);
    for (int i = 0; i < n; i++) {
        scanf("%lld", &X[i]);
    }
    X[n] = E;

    D[0] = X[0];
    T1.put(0, D[0] - X[0]);
    T2.put(0, D[0] - 3 * X[0]);

    int pt = 0;

    for (int i = 1; i <= n; i++) {
        while (2 * (X[i - 1] - X[pt]) > T)
            pt++;
        llong A = T1.get(pt, i - 1) + X[i] + T;
        llong B = T2.get(0, pt - 1) + 2 * X[i - 1] + X[i];
        llong cur = min(A, B);
        D[i] = cur;
        T1.put(i, D[i] - X[i]);
        T2.put(i, D[i] - 3 * X[i]);
    }
    llong ans = D[n];
    printf("%lld\n", ans);

}


Measured memory_bytes: 5888
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main() {
	int n, x, y;
	cin >> n >> x >> y;
	x--; y--;
	vector<vector<int>> g(n);
	rep(i, n-1) {
		g[i].push_back(i+1);
		g[i+1].push_back(i);
	}
	g[x].push_back(y);
	g[y].push_back(x);
	vector<vector<int>> dis(n, vector<int>(n));
	
	rep(i, n) {
		vector<int> dist(n, -1);
		queue<int> que;
		dist[i] = 0;
		que.push(i);
		while(!que.empty()) {
			int v = que.front();
			que.pop();
			for(int nv: g[v]) {
				if(dist[nv] != -1) continue;
				dist[nv] = dist[v] + 1;
				que.push(nv);
			}
		}
		dis[i] = dist;
	}
	
	
	vector<int> ans(n-1);
	rep(i, n) {
		for(int j = i+1; j < n; j++) {
			ans[dis[i][j]-1]++;
		}
	}
	rep(i, n-1) {
		cout << ans[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 16128
w = int(input())    # 縦線
n = int(input())    # 横線
combine = [list(map(int, input().split(","))) for _ in range(n)]   # 横棒の終始
answer = list(range(1, w+1))    # 回答

# 終始入れ替え
for com in combine:
    x, y = com
    answer[x-1], answer[y-1] = answer[y-1], answer[x-1]

# 出力（改行あり）
print('\n'.join(map(str, answer)))
    


Measured memory_bytes: 5612
#include <iostream>
using namespace std;
#define MAX 2000000
int H, A[MAX+1];

void maxHeapify(int i) {
    int left, right, largest;
    left = i * 2;
    right = i * 2 + 1;

    if (left <= H && A[left] > A[i]) largest = left;
    else largest = i;

    if (right <= H && A[right] > A[largest]) largest = right;

    if (largest != i) {
        swap(A[i], A[largest]);
        maxHeapify(largest);
    }
}


int main()
{
    cin >> H;
    for (int i = 1; i <= H; i++) cin >> A[i];

    for (int i = H/2; i >= 1; i--) maxHeapify(i);

    for (int i = 1; i <= H; i++) {
        cout << " " << A[i];
    }
    cout << endl;

    return 0;
}



Measured memory_bytes: 5048
#include<stdio.h>
 
int main(void){
  int n;
  int s1,s2,s3;
  int temp;
  int i;
  
    scanf("%d",&n);

  for(i = 0;i < n;i++){
    scanf("%d %d %d",&s1,&s2,&s3);
    if(s1 < s2){
      temp = s1;
      s1 = s2;
      s2 = temp;
    }
    if(s1 < s3){
      temp = s1;
      s1 = s3;
      s3 = temp;
    }
    if(s1 * s1 == s2 *s2 + s3 * s3){
      printf("YES\n");
    }else{
      printf("NO\n");
    }
  }

  return 0;
}

Measured memory_bytes: 580
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue> //C++
#include <string> //C++
#include <iostream> //C++
#include <vector> //C++
#include <algorithm> //C++
using namespace std; //C++
#define rep(i, a, n) for (i = (a); i < (n); i++)






int main()
{
	int w;
	int x, y;
	cin >> w;
	int i;

	rep(i, 1, 10) {
		if (w % i == 0) {
			if ((w / i) < 10) {
				cout << "Yes";
				return 0;
			}
		}
		
	}
	cout << "No";
}

Measured memory_bytes: 256
N = gets.to_i
dams = gets.split(' ').map(&:to_i)

# x0/2 + x1/2 = d0
# x1/2 + x2/2 = d1
# x2/2 + x0/2 = d2

# x0/2 + x1/2 = d0
# x1/2 + x2/2 = d1
# x2/2 + x3/2 = d2
# x3/2 + x4/2 = d3
# x4/2 + x0/2 = d4

# x0 = d0 - d1 + d2 - d3 + d4
# x1 = d1 - d2 + d3 - d4 + d0
# x2 = d2 - d3 + d4 - d0 + d1

ms = Array.new(N, 0)

N.times do |i|
  ms[0] += (i.odd? ? -1 : 1) * dams[i]
end

N.times do |i|
  next unless ms[i].zero?

  ms[i] = 2 * (dams[i - 1] - ms[i - 1] / 2)
end

puts ms.join(' ')


Measured memory_bytes: 15236
#define ll long long
#define dd long double
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define mp make_pair
#define mt make_tuple
#define fo(i , n) for(ll i = 0 ; i < n ; i++)
//#include<bits/stdc++.h>
#include<iomanip>   
#include<cmath>
#include<cstdio>
#include<utility>
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<bitset>
dd pi = acos(-1) ;
ll z =  1000000007 ;
ll inf = 100000000000000000 ;
ll p1 = 37 ;
ll p2 = 53 ;
ll mod1 =  202976689 ;
ll mod2 =  203034253 ;
ll fact[100] ;
ll gdp(ll a , ll b){return (a - (a%b)) ;}
ll ld(ll a , ll b){if(a < 0) return -1*gdp(abs(a) , b) ; if(a%b == 0) return a ; return (a + (b - a%b)) ;} // least number >=a divisible by b
ll gd(ll a , ll b){if(a < 0) return(-1 * ld(abs(a) , b)) ;    return (a - (a%b)) ;} // greatest number <= a divisible by b
ll gcd(ll a , ll b){ if(b > a) return gcd(b , a) ; if(b == 0) return a ; return gcd(b , a%b) ;}
ll e_gcd(ll a , ll b , ll &x , ll &y){ if(b > a) return e_gcd(b , a , y , x) ; if(b == 0){x = 1 ; y = 0 ; return a ;}
ll x1 , y1 ; e_gcd(b , a%b , x1 , y1) ; x = y1 ; y = (x1 - ((a/b) * y1)) ; return e_gcd(b , a%b , x1 , y1) ;}
ll power(ll a ,ll b , ll p){if(b == 0) return 1 ; ll c = power(a , b/2 , p) ; if(b%2 == 0) return ((c*c)%p) ; else return ((((c*c)%p)*a)%p) ;}
ll inverse(ll a ,ll n){return power(a , n-2 , n) ;}
ll max(ll a , ll b){if(a > b) return a ; return b ;}
ll min(ll a , ll b){if(a < b) return a ; return b ;}
ll left(ll i){return ((2*i)+1) ;}
ll right(ll i){return ((2*i) + 2) ;}
ll ncr(ll n , ll r){if(n < r|| (n < 0) || (r < 0)) return 0 ; return ((((fact[n] * inverse(fact[r] , z)) % z) * inverse(fact[n-r] , z)) % z);}
void swap(ll&a , ll&b){ll c = a ; a = b ; b = c ; return ;}
//ios_base::sync_with_stdio(0);
//cin.tie(0); cout.tie(0);
using namespace std ;
/*#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>*/
// ordered_set s ; s.order_of_key(val)  no. of elements strictly less than val
// s.find_by_order(i)  itertor to ith element (0 indexed)
//__builtin_popcount(n) -> returns number of set bits in n
// ll seed;
//mt19937 rnd(seed=chrono::steady_clock::now().time_since_epoch().count()); // include bits

void solve()
{
    ll n , x , t ;
    cin >> n >> x >> t ;
    cout << (((n+x-1)/x)*t) << endl ;
    return ;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    /*#ifndef ONLINE_JUDGE
    freopen("inputf.txt" , "r" , stdin) ;
    freopen("outputf.txt" , "w" , stdout) ;
    freopen("error.txt" , "w" , stderr) ;
    #endif*/
    
    ll t ;
    //cin >> t ;
    t = 1 ;
   
    while(t--)
    {
        solve() ;
    }
   // cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
 
    return 0;
}

Measured memory_bytes: 3152
#include<stdio.h>
int main()
{
    int a;
    char s[10];
   // gets(s);

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

    if(a < 3200)
    {
        printf(" red ");
    }
    else
    {
        printf("%s\n",s);
    }
    return 0;
}


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

using namespace std;

int main(int argc, char *argv[]) {
    int64_t a, b, c;
    cin >> a >> b >> c;
    int64_t r = (c - a - b) * (c - a - b);
    int64_t l = 4 * a * b;
    cout << ((c - a - b > 0 && r > l) ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
	
using namespace std;
const int MAX_N=1e5;
int N;
ll R,C;
bool ised(ll x,ll y){
	return (x==0 || x==R || y==0 || y==C);
}
typedef pair<ll,int> P;
P edge[MAX_N<<1];
ll dis(ll x,ll y){
	if (x==0){
		return y;
	}else if(y==C){
		return C+x;
	}else if (x==R){
		return C+R+C-y;
	}else {
		return (C+R)*2-x;
	}
}
int M;
bool used[MAX_N];
int main(){
	cin>>R>>C>>N;
	M=0;
	REP(i,N){
		ll x1,y1,x2,y2;
		cin>>x1>>y1>>x2>>y2;
		if (ised(x1,y1) && ised(x2,y2)){
			edge[M++]=P(dis(x1,y1),i);
			edge[M++]=P(dis(x2,y2),i);
		}
	}
	bool ans=true;
	{
		stack<int> st;
		sort(edge,edge+M);
		REP(i,M){
			P e=edge[i];
			if (!used[e.second]){
				st.push(e.second);
				used[e.second]=true;
			}else{
				if (st.empty() || st.top()!=e.second){
					ans=false;
					break;
				}else{
					st.pop();
				}
			}
		}
	}
	cout<<(ans ? "YES" : "NO")<<endl;
	return 0;
}

Measured memory_bytes: 3712
L,R=map(int,input().split())
M=2019
import sys
for i in range(L,R):
    for j in range(i+1,R+1) :
        if (i*j)%2019 < M :
            M = (i*j)%2019
            if M == 0:
                print(M)
                sys.exit()
print (M)

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

#define INF 0x33433433

int n;
int m;
int d[1001];
int c[1001];
int dp[1001][1001];

int main() {
    scanf("%d%d", &n, &m);
    for (int i=0; i<n; i++) {
        scanf("%d", &d[i]);
    }

    for (int i=0; i<m; i++) {
        scanf("%d", &c[i]);
    }

    for (int i=0; i<=n; i++) {
        for (int j=0; j<=m; j++) {
            dp[i][j] = INF;
        }
    }
    
    dp[0][0] = 0;
    for (int i=0; i<=n; i++) {
        for (int j=1; j<=m; j++) {
            dp[i][j] = min(dp[i][j], dp[i][j-1]);
            if (i > 0) {
                dp[i][j] = min(dp[i][j], dp[i-1][j-1]+d[i-1]*c[j-1]);
            }
        }
    }
    
    printf("%d\n", dp[n][m]);       
}

Measured memory_bytes: 4212
#include <stdio.h>
main(){
  int a[4],b[4],i,j,hit=0,blow=0;

  while(~scanf("%d",&a[0])){

    hit = blow = 0;
    for(i=1;i<4;i++){ scanf("%d", &a[i]); }
    for(i=0;i<4;i++){ scanf("%d", &b[i]); }


    for(i=0;i<4;i++){
      if(a[i]==b[i]){
	hit=hit+1;
      }
    }
    
    for(i=0;i<4;i++){
      for(j=0;j<4;j++){
	if(a[i]==b[j] && i != j){
	  blow=blow+1;
	}
      }
    }
 

    printf("%d %d\n",hit,blow);
  } 
   return 0;
}

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

using ll = long long;
using namespace std;
const int INFint = 2e9+1;
const ll INFll = 2e18+1;
ll MOD=1e9+7;


int main() {
  int N,W;
  cin>>N>>W;
  vector<int> wi(N+1),vi(N+1);
  for(int i(1);i<=N;i++){
    cin>>wi[i]>>vi[i];
  }
  ll dp[101][100001] = {0};
  for(int i(0);i<=N;i++){
    for(int v(1);v<=N*1000;v++){
      dp[i][v] = INFll;
    }
  }
  for(int i(1);i<=N;i++){
    for(int v(0);v<=N*1000;v++){
      if(v >= vi[i]){
        dp[i][v] = min(dp[i-1][v],dp[i-1][v-vi[i]] + wi[i]);
      }else{
        dp[i][v] = dp[i-1][v];
      }
    }
  }
  for(int i(0);i<N;i++){
    for(int v(0);v<=N*10;v++){
      //cout << dp[i][v] << " ";
    }
    //cout << endl;
  }
  ll ans(0);
  for(ll i(0);i<=N*1000;i++){
    if(dp[N][i] <= W) ans = i;
  }
  cout << ans << endl;
}

Measured memory_bytes: 79104
N=int(input())
X=[0]*N
Y=[0]*N
LIST=[[0,0] for i in range(N*N)]
for i in range(N):
    X[i],Y[i]=map(int,input().split())

for i in range(N):
    for j in range(N):
        if(i==j):continue
        LIST[i*N+j][0]=X[i]-X[j]
        LIST[i*N+j][1]=Y[i]-Y[j]

LIST=sorted(LIST,key=lambda x: (x[0],x[1]))

t=[0,0]
m=0
c=0
for i in range(len(LIST)):
    if(LIST[i]==[0,0]):continue
    elif(LIST[i]!=t):
        c=1
        t=LIST[i]
    else:c+=1
    m=max(c,m)

print(N-m)

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

const ll INF = pow(10, 9) + 7;

int main() {
  int n;
  string s;
  cin >> n >> s;
  rep(i,s.size()){
    s[i] += n;
    if(s[i]>90){
      s[i] = s[i] - 90 + 64;
    }
  }
  cout << s << endl;
}

Measured memory_bytes: 256
s=input()
ans=[0]*len(s)
cnt=1
for i in range(1,len(s)):
  if s[i]=='R':
    cnt+=1
  else:
    ans[i-1]+=(cnt+1)//2
    ans[i]+=cnt-(cnt+1)//2
    cnt=0
cnt=1
for i in range(len(s)-1)[::-1]:
  if s[i]=='L':
    cnt+=1
  else:
    ans[i+1]+=(cnt+1)//2
    ans[i]+=cnt-(cnt+1)//2
    cnt=0
print(' '.join(map(str,ans)))

Measured memory_bytes: 10484
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
int main(){
    ll n,A[200001],B[200001],suma=0,sumb=0;
    cin>>n;
    rep(i,n) cin>>A[i],suma+=A[i];
    rep(i,n) cin>>B[i],sumb+=B[i];
    ll a=0,b=0;
    rep(i,n){
        if(A[i]<B[i]) a+=(B[i]-A[i]+1)/2;
        else b+=A[i]-B[i];
    }
    if(max(a,b)<=sumb-suma) cout<<"Yes";
    else cout<<"No";
}


Measured memory_bytes: 2432
#pragma region RegionDefs
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define reps(i,l,r) for(int i=(l),i##_len=(r);i<i##_len;++i)
#define repr(i,l,r) for(int i=(r)-1,i##_left=(l);i>=i##_left;--i)
#define all(x) begin(x),end(x)
using namespace std;
typedef long long ll;
const ll INF = 1e9;
template<class T=ll> using V = vector<T>;
template<class T=ll> using PQ = priority_queue<T>;
template<class T=ll> using PQG = priority_queue<T, V<T>, greater<T>>;
const ll MOD = 1000000007LL;
void in() {}
template<class Head, class... Tail>
void in(Head&& head, Tail&&... tail) { cin >> head; in(move(tail)...); }
#define IN(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define TIN(T, ...) T __VA_ARGS__; in(__VA_ARGS__)
#define VIN(T, v, n) V<T> v(n); for(auto& _elem:v)cin>>_elem
#define VIND(T, v, n) V<T> v(n); for(auto& _elem:v)cin>>_elem,--_elem
#define OUT(x) cout << x;
#define OUTL(x) cout << x << endl;
template<class T>bool chmax(T &a, const T &b) {if (a<b) {a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) {if (a>b) {a=b; return 1;} return 0;}
template<class T>
string join(vector<T>& v, string delim="") { ostringstream os; rep(i,v.size())i?os<<delim<<v[i]:os<<v[0]; return os.str(); }
#pragma endregion RegionDefs

void solve()
{
    IN(n);
    int k = 0;
    int m = 0;
    rep(i, n) {
        IN(d1, d2);
        if (d1 == d2) ++k;
        else k = 0;
        chmax(m, k);
    }
    if (m >= 3) cout << "Yes" << endl;
    else cout << "No" << endl;
}

int main()
{
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(numeric_limits<double>::max_digits10);

    solve();

    return 0;
}

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

main(){
	int n,k,ans;
	string s;
	
	ans = 0;
	cin>>n>>s;
	for(int i=1;i<n;i++){
		k = 0;
		for(int j=0;j+i<n;j++){
			if(s[j] == s[j+i])
				ans = max(ans, min(i, ++k));
			else
				k = 0;
		}
	}
	cout<<ans<<endl;
}

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

int main(){
  int n;
  string f[100];

  map< string , string > str;
  str["lu"] = "ru";
  str["ru"] = "lu";
  str["ld"] = "rd";
  str["rd"] = "ld";


  while(cin >> n, n){
    for(int i = 0; i < n; i++){
      cin >> f[i];
    }
    int cnt = 0;
    for(int i = 0; i < n - 1; i++){
      cnt += (str[f[i]] == f[i + 1]);
    }

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

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

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

 vector<int> vec(N);
 long long sum = 0;
 for(int i = 0; i < N; i++) {
   cin >> vec.at(i);
   sum += vec.at(i);
 }

 cout << sum - N << endl;
 
}


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

int main(){
    int N;
    cin >> N;
    vector<int> D(114514,0);
    rep(i,N){
        int d;
        cin >> d;
        D[d]++;
    }

    int kR = 114154;
    int kL = -1;
    int sumL = 0, sumR = 0;

    while(sumL != N/2 && kL < 114154-1){
        kL++;
        sumL += D[kL];
    }
    while(sumR != N/2 && kR >= 0){
        kR--;
        sumR += D[kR];
    }

    cout << max(kR-kL, 0) << endl;
}


Measured memory_bytes: 640