akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#define N 101
#define BLACK 0
#define WHITE 1
#define INF 20000
#define NIL -1
 
int w[N][N],d[N],pi[N],color[N],n;
void prim(void);
 
int main(){
 
  int i,j;
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    for(j=1;j<=n;j++){
      scanf("%d",&w[i][j]);
      if(w[i][j]==-1)
    w[i][j]=INF;
    }
  }
 
  prim();
 
  return 0;
}
 
 
void prim(void){
  int i,j,mincost,v,r,u,sum=0;
 
  for(u=1;u<=n;u++){
    d[u]=INF;
    pi[u]=NIL;
    color[u]=WHITE;
  }
  d[1]=0;
 
  while(1){
    mincost=INF;
    for(i=1;i<=n;i++){
      if(color[i]!=BLACK && d[i]<mincost){
    mincost=d[i];
    u=i;
      }
    }
 
    if(mincost==INF)
      break;
 
    color[u]=BLACK;
 
    for(v=1;v<=n;v++){
      if(color[v]!=BLACK && w[u][v]<d[v]){
    pi[v]=u;
    d[v]=w[u][v];
      }
    }
  }
    for(v=1;v<=n;v++){
      sum+=d[v];
    }
  printf("%d\n",sum);
}



Measured memory_bytes: 2052
def examA():
    S = {0:"pon",1:"pon",2:"hon",3:"bon",4:"hon",5:"hon",6:"pon",7:"hon",8:"pon",9:"hon"}
    N = SI()
    ans = S[int(N[-1])]
    print(ans)
    return

def examB():
    K = I()
    S = SI()
    N = len(S)
    if N<=K:
        ans = S
    else:
        ans = S[:K]+"..."
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examB()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Measured memory_bytes: 76668
#include<stdio.h>
#include<string.h>
#define N 200+10
int hs(char *,int n);
int main()
{
	char s[N];
	scanf("%s",s);
	int n=strlen(s);
	if(n%2==0)
		n-=2;
	else
		n--;
	while(hs(s,n)){
		if(n<=0)
			break;
		n-=2;
	}
	printf("%d",n);
}
int hs(char *s,int n){
	for(int i=0;i<n/2;i++)
		if(s[i]!=s[i+n/2])
			return 1;
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define int long long int

template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}

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

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
constexpr ll INF = 1001001001001001LL;
constexpr ll MOD = 1000000007LL;

int N;
int dist[110];

signed main() {
    cin >> N;
    
    int ma = 0;
    rep(i,0,N) {
        int a; cin >> a;
        dist[a]++;
        chmax(ma, a);
    }

    int border = 0;
    bool ng = false;
    if(ma % 2) {
        border = (ma - 1) / 2 + 1;
        repq(i,border,ma) {
            if(dist[i] < 2) ng = true;
            dist[i] -= 2;
        }
    }
    else {
        border = ma / 2;
        repq(i,border,ma) {
            if(i == border) {
                if(dist[i] < 1) ng = true;
                dist[i]--;
            }
            else {
                if(dist[i] < 2) ng = true;
                dist[i] -= 2;
            }
        }
    }

    repq(i,0,ma) {
        if(i <= border && dist[i] != 0) ng = true;
    }

    cout << (ng ? "Impossible" : "Possible") << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T> using vec = std::vector<T>;

const ll MOD = 1000000007;

struct mint {
    ll x;
    mint(ll x = 0) : x((x % MOD + MOD) % MOD) {
    }
    mint operator-() const {
        return mint(-x);
    }
    mint &operator+=(const mint a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint &operator-=(const mint a) {
        if ((x += MOD - a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint &operator*=(const mint a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t/2);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime MOD
    mint inv() const {
        return pow(MOD - 2);
    }
    mint &operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};

ostream &operator<<(ostream &os, const mint &a) {
    return os << a.x;
}

struct counting {
    vector<mint> fact, ifact;
    counting(int n) : fact(n + 1), ifact(n + 1) {
        assert(n < MOD);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i)
            fact[i] = fact[i - 1] * i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i)
            ifact[i - 1] = ifact[i] * i;
    }
    mint nCk(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n] * ifact[k] * ifact[n - k];
    }
    mint nPk(int n, int k){
        return fact[n]*ifact[n-k];
    }
    mint factorial (int n){
        return fact[n];
    }
} c(1000009);



int main() {
    int S;
    cin >> S;
    mint ans = 0;
    for(int i=1;i<=S/3;++i){
        int a = S-i*3;
        mint tmp = (c.factorial(a+i-1)/(c.factorial(a)*c.factorial(i-1)));
        ans+=tmp;
    }
    cout << ans << endl;
}


Measured memory_bytes: 18640
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cctype>
#include<iostream>
#include<stack>
#include<string>
#include<vector>
#include<queue>
#include<deque>
#include<algorithm>
#include<utility>
#include <map>
#include <set>

using namespace std;

#define REP(i,x) for(int i=0; i<(int)(x); i++)       // 0 <= i < x
#define REPS(i,x) for(int i=1; i<=(int)(x); i++)     // 0 < i <= x
#define RREP(i,x) for(int i=((int)(x)-1); i>=0; i--) // x > i >= 0
#define RREPS(i,x) for(int i=((int)(x)); i>0; i--)   // x >= i > 0
#define INF 100000000

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

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

int N, K;
int x[50], y[50];

int main(void){
	cin >> N >> K;
    REP(i, N){
        cin >> x[i] >> y[i];
    }

    ll res = 4E+18;
    REP(i, N){
        REP(j, N){
            REP(k, N){
                REP(l, N){
                    ll left = min(x[i], x[j]);
                    ll right = max(x[i], x[j]);
                    ll upper = max(y[k], y[l]);
                    ll lower = min(y[k], y[l]);
                    ll num = 0;
                    REP(n, N){
                        if(left<=x[n] && x[n]<=right && lower<=y[n] && y[n]<=upper){
                            num++;
                        }
                    }
                    if(num>=K){
                        res = min(res, (right-left) * (upper-lower));
                    }
                }
            }
        }
    }

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


Measured memory_bytes: 384
n, k = gets.chomp.split.map(&:to_i)

if n <= k
  puts 1
elsif k < n && n <= 2 * k - 1
  puts 2
elsif 2 * k - 1 < n && n <= 3 * k - 2
  puts 3
else
  n -= k
  s, r = n / (k - 1), n % (k - 1)
  ans = 1 + s + (r.zero? ? 0 : 1)
  puts ans
end


Measured memory_bytes: 1788
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    int[] a = new int[n];

    for (int i = 0; i < (2 * m); i++) {
      a[sc.nextInt() - 1]++;
    }

    for (int i = 0; i < n; i++) {
      System.out.println(a[i]);
    }

  }
}

Measured memory_bytes: 36004
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cstring>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <stack>
#include <cmath>
#include <time.h>
#include <unordered_set>
#include <unordered_map>
#define ll long long
#define LINF 0x3f3f3f3f3f3f3f3f
#define INF 0x3f3f3f3f
#define PI 3.14159265
#define RAND (rand()*rand())
#define MAX(x, y) ((x) > (y) ? (x):(y)) 
#define MIN(x, y) ((x) > (y) ? (y):(x))
#define ABS(x) ((x) > 0 ? (x) : -(x))
#define CEIL(x, y) (((x) + (y) - 1)/(y))
using namespace std;
const int MAXN = 1e5 + 5;
const ll MOD = 1e9 + 7;
int N, M, K, Q, T;

int main()
{
	int i, j;
	ll n;
	scanf("%lld", &n);
	if (n % 2ll == 1ll) printf("0");
	else {
		ll cnt = 0ll;
		ll temp = n/2ll;
		while (temp) {
			cnt += temp / 5ll;
			temp /= 5ll;
		}
		printf("%lld", cnt);
	}
	return 0;
}

Measured memory_bytes: 256
from fractions import gcd

# 素因数分解
def prime_factors(n):
  i = 2
  while i * i <= n:
    if n % i:
      i += 1
    else:
      n //= i
      yield i
  if n > 1:
    yield n

A,B = map(int,input().split())
g = gcd(A,B)
print(1+len(set(prime_factors(g))))

Measured memory_bytes: 5048
import copy
n = int(input())
sp = [[i for i in input().split()] for i in range(n)]
for index,value in enumerate(sp):
    sp[index] = [value[0],-int(value[1])]
orig = copy.deepcopy(sp)
sp.sort()
rank = {}
index = 1
for value in sp:
    rank[(value[0],value[1])] = index
    index += 1
indexes = {}
counter = 1
for i in range(n):
    # print(rank[(orig[i][0],orig[i][1])])
    indexes[(rank[(orig[i][0],orig[i][1])])] = counter
    # indexes[counter] = rank[(orig[i][0],orig[i][1])]
    counter += 1
# print(indexes)
for i in range(1,n+1):
    print(indexes[i])

Measured memory_bytes: 3572
#include <iostream>
#include <vector>
#include <string>
#include <bits/stdc++.h>
#include <ctime>

#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL)
#define TT int test_cases; cin >> test_cases; while(test_cases--)
#define TT1 int test_cases=1; while(test_cases--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
 
using namespace std;
typedef long long int ll;

 
int main() {
    
    FAST;
    TT1{
        
        int h,w,m;cin>>h>>w>>m;
        
        vector<int> r(h,0);
        vector<int> c(w,0);
        
        set<pair<int,int>> s;
        for(int i=0;i<m;i++)
        {
            int x,y;cin>>x>>y;
            r[x-1]++;
            c[y-1]++;
            s.insert(mp(x-1,y-1));
        }
        vector<int> h1;
        vector<int> w1;
        int a1=*max_element(r.begin(),r.end());
        int a2=*max_element(c.begin(),c.end());
        
        for(int i=0;i<h;i++)
        {
            if(r[i]==a1) h1.pb(i);
        }
        for(int i=0;i<w;i++)
        {
            if(c[i]==a2) w1.pb(i);
        }
        //cout<<a1<<" "<<a2<<"\n";
        
        int n1=h1.size();
        int n2=w1.size();
        int ans=a1+a2-1;
        int f=0;
        
        for(int i=0;i<n1;i++)
        {
            for(int j=0;j<n2;j++)
            {
                int x=h1[i];int y=w1[j];
                if(s.find(mp(x,y))==s.end())
                {
                    ans++;f=1;break;
                }
            }
            if(f==1) break;
        }
        
        cout<<ans<<"\n";
        
    }
}

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

using namespace std;
using LL = long long;
int main(){
    int n;cin >> n;
    vector<int> vec;
    int ma = 0;
    for(int a = 0;a < n;a++){
        int b;cin >> b;
        vec.push_back(b);
        ma = max(ma,b);
    }
    for(int a = ma;a >= 0 ;a--){
        int ins = 0;
        for(int b = 0;b < n;b++){
            if(vec.at(b) >= a){
                ins++;
            }
        }
        if(ins >= a){
            cout<<a<<endl;
            return 0;
        }
    }
    cout<<0<<endl;
    return 0;
}



Measured memory_bytes: 3152
let N = Int(readLine()!)!
let A = readLine()!.characters.split(" ").map{Int(String($0))!}
if A.filter({$0<0}).count % 2 == 0 {
    print(A.reduce(0){$0+abs($1)})
} else {
    print(A.reduce(0){$0+abs($1)}-A.map{abs($0)}.minElement()!*2)
}

Measured memory_bytes: 7836
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
#define D10 fixed<<setprecision(10)
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-12;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/

ll n, dp[222][222];
string s;

int main()
{
	MS(dp, 0);
	cin >> n;
	REP(i, n)
	{
		char c; cin >> c;
		if (c != '-') s += c;
	}
	n = s.size();
	dp[0][0] = 1;
	REP(i, n)
	{
		if (s[i] == 'U')
		{
			REP(j, n + 1)
			{
				dp[i + 1][j + 1] += dp[i][j];
				dp[i + 1][j + 1] %= MOD;
				dp[i + 1][j] += dp[i][j] * j;
				dp[i + 1][j] %= MOD;
			}
		}
		else
		{
			REP(j, n + 1)
			{
				dp[i + 1][j] += dp[i][j] * j;
				dp[i + 1][j] %= MOD;
				dp[i + 1][j - 1] += dp[i][j] * j* j;
				dp[i + 1][j - 1] %= MOD;
			}
		}
	}
	cout << dp[n][0] << endl;
	return 0;
}

Measured memory_bytes: 3604
import java.util.Scanner;
public class Main
{
	public static void main(String arg[])
	{
		Scanner in = new Scanner(System.in);
		boolean flag=true;
		while(in.hasNext())
		{
			String[] ch = in.next().split(",");
			double BMI = Double.valueOf(ch[1])/(Double.valueOf(ch[2])*Double.valueOf(ch[2]));
			if(BMI>=25)
			{
			System.out.println(ch[0]);
			flag = false;
			}
		}
		if(flag)
		System.out.println("該当なし");
	}
}

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

using namespace std; 

int main(){ 
  string o,e;
  cin>>o>>e;
  for(int i=0;i<min(o.size(),e.size());i++){
    cout<<o.at(i)<<e.at(i);
  }
  if(o.size()>e.size()){
    cout<<o[o.size()-1];
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <random>
#include <algorithm>

using std::cout;
using std::cerr;
using std::cin;
using std::endl;


#define NNN (100000)
#define MMM (10000)
void funcC() {
	int N;
	int M;
	std::vector<int> A[NNN+1];
	int P[NNN];
	int Y[NNN];

	cin >> N;
	cin >> M;

	for (int m = 0; m < M; ++m) {
		int p;
		int y;
		cin >> p;
		cin >> y;
		P[m] = p;
		Y[m] = y;
	}
	for (int m = 0; m < M; ++m) {
		A[P[m]].push_back(Y[m]);
	}
	for (int n = 1; n < N+1; ++n) {
		std::sort(A[n].begin(), A[n].end());
	}

	for (int m = 0; m < M; ++m) {
		int p = P[m];
		int y = Y[m];
		
		int idx =  std::lower_bound(A[p].begin(), A[p].end(), y) - A[p].begin();
		printf("%.6d%.6d\n", p, idx + 1);
		/*
		int idx = -1;
		for (int i = 0; i < A[p].size(); ++i) {
			if (A[p][i] == y) {
				//cerr << p << "," << i + 1 << endl;
				printf("%.6d%.6d\n", p, i + 1);
			}
		}
		*/
	}



}

int main() {
	//funcB();
	funcC();

}


Measured memory_bytes: 7808
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define mp make_pair
#define pb push_back
#define F first
#define S second
const int N=100005;
#define M 1000000021
#define double long double
#define BINF 1000000000000001
#define init(arr,val) memset(arr,val,sizeof(arr))
#define MAXN 15000001
const int LG = 22;



#undef int
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
#define int long long int

	int a,b;
	cin>>a>>b;
	if(b%a==0) cout<<a+b;
	else cout<<b-a<<endl;


return 0;
}

Measured memory_bytes: 384
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;

struct task{
	int cost;
	int deadLine;
};

bool myComp(task left,task right){
	return (left.deadLine < right.deadLine);
}

int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	bool ans = false;
	for(int i = 1; i <= b; i++){
		if( (i * a ) % b == c){
			ans = true;
			break;
		}
	}
	if(ans == true){
		cout<<"YES"<<endl;
	}else{
		cout<<"NO"<<endl;
	}
	return 0;
}



Measured memory_bytes: 3124
#include<iostream>
#include<algorithm>
#include<map>
using namespace std;
#define ll long long 
const int maxn = 2e5 + 5;
int a[maxn], b[maxn];
int p[1000010];
int main()
{
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		cin >> a[i]; b[i] = a[i];
	}
	sort(b + 1, b + 1 + n);
	int ans = 0;
	b[n + 1] = -1;
	for (int i = 1; i <= n; i++)
	{
		int t = b[i];
		
			if (p[t] == 0)
			{if (b[i] != b[i + 1])
				ans++;
				for (int j = 1; t * j <= 1000000; j++)
				{
					p[t * j] = 1;
				}
			}
	}cout << ans << endl;
}

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

int main(){
 
  string s; cin >> s;
  int n = (int)s.length();
  int ptr1 = 0;
  int ptr2 = 2;
  int ans = INT_MAX;
  while(ptr2 < n){
    int sum = (s[ptr1] - '0')*100 + (s[ptr1 + 1] - '0')*10 + (s[ptr2] - '0'); 
    ans = min(abs(sum - 753),ans);
    ptr1++; ptr2++;
  }
  cout << ans << '\n';
}

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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define P pair<int,int>
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
#define possible(n) cout << ((n) ? "possible" : "impossible"  ) << endl
#define Size(n) (n).size()

typedef long long ll;

using namespace std;

const int INF = 1e9,MOD = 1e9 + 7;
const ll LINF = 1e18;

//long long int kaizyo(long long int hh){
  //  cmp=1;
    //while(hh>1){
      //  cmp=(cmp*hh)%MOD;
        //hh--;
    //}
    //return cmp;
//}
//long long int ruizyo(long long int aa, long long int bb){
  //  if(aa==0){
    //    return 1;
    //}
    //else if(aa%2==0){
      //  long long int tt=ruizyo(aa/2,bb);
        //return (tt*tt)%MOD;
    //}
    //else{
      //  return (ruizyo(aa-1,bb)*bb)%MOD;
    //}
//}フェルマ－のア


//while(x!=0){
            //sum+=x%10;
           // x/=10;
        //}
        //各桁の和

//pair<int,int> p[100000];
//P r[100000];
//cin >> tmp;
//p[i]=make_pair(tmp,i);
//cout << p[i].second+1 << endl;//ペアの右側つまりiを出力

//s.find(w[i])==string::npos
//findの使い方

//for(int i=0;i<n;i++){
   // b[i]=x%2;
    //x/=2;
  //}二進数

//visited=vector<vector<bool>>(10,vector<bool>(10,false));アを全部falseに


long long int n,cnt=0,ans=0,a[10000000],b,c,cmp,cmpp,m,h,w,x,y,sum=0,pos;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl=true;

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

       cin >>n>>x;
       rep(i,n)cin>>a[i];
       rep(i,n-1){
           sum=a[i]+a[i+1];
           if(a[i]+a[i+1]>x){
               ans+=sum-x;
               a[i+1]=x-a[i];
               if(a[i+1]<0){
                   a[i]+=a[i+1]*-1;
                   a[i+1]=0;
               }
           }
       }
       Cout(ans);
return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
using namespace std;

struct Shop
{
	long long int a;
	int b;
	
	Shop(long long int a_,int b_)
	{
		a = a_;
		b = b_;
	}

	bool operator<(const Shop &another) const
	{
		return a < another.a;
	}	
};

int main()
{
	int N,M;

	cin >>	N >> M;
	
	vector<Shop> shops;
	unsigned long long int ret = 0;

	for(int i = 0;i < N;++i)
	{
		int a,b;
		cin >> a >> b;
		shops.push_back(Shop(a,b));
	}

	sort(shops.begin(),shops.end());

	int index = 0;
	while(M > 0)
	{
		if(shops[index].b < M)
		{
			M -= shops[index].b;
			ret += shops[index].a * shops[index].b;
		}
		else
		{
			ret += M * shops[index].a;
			M = 0;
			break;
		}
		++index;	
	}
	
	cout << ret << endl;
}

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

int a, b, c, k = 0;

int main()
{
    cin >> a >> b >> c >> k;
    for (; b <= a; k--) {
        b *= 2;
    }
    for (; c <= b; k--) {
        c *= 2;
    }
    if (k >= 0) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}

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

int main(){
    int n;
    cin>>n;
    int ans = 0;
    for(int i=1;i<=n/2;i++){
        if((n-i)!=i) ans++;
    }
    
    cout << ans << endl;
}



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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repi(i, a, b) for (int i = (a); i < int(b); i++)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))
#define uniq(v) (v).erase(unique(all(v)), (v).end())

using namespace std;
using i32 = int;
using i64 = long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

void ioinit() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); }
i64 gcd(i64 a, i64 b) { if (a % b == 0) return b; else return gcd(b, a % b); }
i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
template <class T> bool amax(T &x, T y) { if (x < y) { x = y; return 1; } else return 0; }
template <class T> bool amin(T &x, T y) { if (x > y) { x = y; return 1; } else return 0; }
template <class T> i64 lbi(vector<T> &v, T e) { return lower_bound(all(v), e) - v.begin(); }
template <class T> i64 ubi(vector<T> &v, T e) { return upper_bound(all(v), e) - v.begin(); }

int main() {
  ioinit();
  int n, k;
  string s;
  cin >> n >> k >> s;
  vi32 c;
  {
    int t = 1, cnt = 0;
    rep(i, n) {
      if (s[i] - '0' != t) {
        c.push_back(cnt);
        cnt = 1; t = 1 - t;
      } else {
        cnt++;
      }
    }
    c.push_back(cnt);
    if (t == 0) c.push_back(0);
  }
  vi32 sums(c.size() + 1);
  partial_sum(all(c), sums.begin() + 1);
  int rng = k * 2 + 1;
  int ans = 0;
  for (int i = 0; i < c.size(); i += 2) {
    int l = i, r = min((int) c.size(), i + rng);
    amax(ans, sums[r] - sums[l]);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1272
N = int(input())
C = [int(input()) for _ in range(N)]
MOD = 10**9 + 7

if N <= 2:
    print(1)
    exit()

dp = [1,1]
last_idx = [-1]*(N+10)
last_idx[C[0]] = 0
last_idx[C[1]] = 1

for i in range(2, N):
    if C[i-1] == C[i] or last_idx[C[i]] == -1:
        dp.append(dp[-1] % MOD)
    else:
        dp.append((dp[-1] + dp[last_idx[C[i]]]) % MOD)
    last_idx[C[i]] = i

print(dp[-1])

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

int main() {
    int h, r;
    cin >> h >> r;
    h += r;
    if (h == 0) cout << 0 << endl;
    else if (h > 0) cout << 1 << endl;
    else cout << -1 << endl;
}


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

#define ll long long int
#define pi 3.141592653589793238
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define mod 1000000007



    ll mod_pow(ll a,ll b,ll m)
    {
        ll res=1;
        while(b)
        {
            if(b&1)
                res=(res*a)%m;

            a=(a*a)%m;
            b>>=1;
        }
        return res;
    }

void solve()
{
    ll n;
    cin>>n;
    for(ll i=0;i<n;i++)
        cout<<"ACL";
    return;
}

int main()
{
    FAST;
    #ifndef ONLINE_JUDGE
        freopen("input1.txt","r",stdin);
        freopen("output1.txt","w",stdout);
    #endif
    ll q;
    q=1;
    // cin>>q;
    while(q--)
        solve();
    return 0;
}


Measured memory_bytes: 3516
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  ll n, m, q; cin >> n >> m >> q;
  vector <vector <ll>> v(n, vector <ll> ());
  rep(i, m) {
    ll l, r; cin >> l >> r;
    v.at(l-1).push_back(r-l);
  }
  rep(i, n) sort(v.at(i).begin(), v.at(i).end());
  rep(i, q) {
    ll l, r; cin >> l >> r;
    l--; r--;
    ll res = 0, dis = r - l;
    for (ll j = l; j <= r; j++) {
      auto itr = upper_bound(v.at(j).begin(), v.at(j).end(), dis);
      res += distance(v.at(j).begin(), itr);
      dis--;
    }
    cout << res << endl;
  }
}

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

int main() {
    int n;
    cin >> n;
    vector<int> p(n);
    vector<pair<int, int>> vp;
    for(int i = 0; i < n; i++) {
        cin >> p[i];
        vp.emplace_back(p[i], i);
    }
    sort(vp.begin(), vp.end(), greater<pair<int, int>>());

    vector<int> greater_nums = {-1, -1, n, n};
    ll ans = 0;
    for(int i = 0; i < n; i++) {
        ll idx = vp[i].second, num = p[idx];
        auto it = lower_bound(greater_nums.begin(), greater_nums.end(), idx);
        ll l1 = *(it - 1), l2 = *(it - 2), r1 = *(it), r2 = *(it + 1);
        ll c = (r2 - r1) * (idx - l1) + (r1 - idx) * (l1 - l2);
        ans += num * c;
        greater_nums.insert(it, idx);
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2292
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
using ll = long long;
using ull = unsigned long long;
using namespace std;
#define int long long
#define CONTAINS_VEC(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
#define CONTAINS_SET(m, a) (m).find((a)) != m.end()
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }


signed main()
{
	int R;
	cin >> R;
	if (R < 1200)
	{
		cout << "ABC" << endl;
	}
	else if (R < 2800)
	{
		cout << "ARC" << endl;
	}
	else
	{
		cout << "AGC" << endl;
	}
}



Measured memory_bytes: 3116
#include<bits/stdc++.h>
using namespace std;
const int maxn=300005;

struct nobe{
int s,flag;
}p[maxn];


bool cmp(nobe a,nobe b){
return a.s>b.s;
}

int main(){
    int x,y,a,b,c;
    int x1,y1,z1;
    long long sum=0;
    cin>>x>>y>>a>>b>>c;
    for(int i=0;i<a;i++){
        cin>>p[i].s;
        p[i].flag=1;
    }
    for(int i=a;i<a+b;i++){
        cin>>p[i].s;
        p[i].flag=2;
    }
    for(int i=a+b;i<a+b+c;i++){
        cin>>p[i].s;
        p[i].flag=0;
    }
    sort(p,p+a+b+c,cmp);
    x1=y1=z1=0;
    for(int i=0;i<a+b+c;i++){
        if(z1==x+y)
        break;
        if(p[i].flag==1&&x1<x){
        sum+=p[i].s;
        x1++;
        z1++;
        }
        else if(p[i].flag==2&&y1<y){
        sum+=p[i].s;
        y1++;
        z1++;
        }
        else if(p[i].flag==0){
            sum+=p[i].s;
            z1++;
        }

    }
    cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 2560
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll W, H; cin >> W >> H;
  ll p[W]; FOR(i,0,W) cin >> p[i]; // 横線
  ll q[H]; FOR(i,0,H) cin >> q[i]; // 縦線
  sort(p, p + W);
  sort(q, q + H);
  ll ans = 0;
  // (H+W)方向から選ぶ
  ll yoko = 0, tate = 0;
  FOR(i,0,W+H) {
    if(yoko == W) {
      ans += q[tate] * (W + 1 - yoko);
      tate++;
      continue;
    }
    if(tate == H) {
      ans += p[yoko] * (H + 1 - tate);
      yoko++;
      continue;
    }
    // 縦線を(W+1-横線)本引く
    //if(p[yoko] * (H + 1 - tate) > q[tate] * (W + 1 - yoko)) {
    if(p[yoko]> q[tate]) {
      ans += q[tate] * (W + 1 - yoko);
      tate++;
    } else {
      ans += p[yoko] * (H + 1 - tate);
      yoko++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1792
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<bool> vb;
#define pb push_back
#define fi first
#define se second
#define in insert
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int mod = 1e9 + 7;
void solve(){
    int n;
    cin >> n;
    vi a(n);
    int sum = 0;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        sum += a[i];
    }
    int mid1 = sum / n;
    int mid2 = (sum + n - 1) / n;
    int ans1 = 0, ans2 = 0; 
    for (int i = 0; i < n; ++i) {
        ans1 += (mid1 - a[i]) * (mid1 - a[i]);
        ans2 += (mid2 - a[i]) * (mid2 - a[i]);
    }
    cout << min(ans1, ans2);
}
int main(){
    speed;
    int t = 1;
    //cin >> t;
    for (int i = 1; i <= t; ++i) {
        solve();
    }
}

Measured memory_bytes: 380
#include<stdio.h>
#include<math.h>
#include <limits.h>
#include<stdlib.h>


int main() {
	int n, ans;
	scanf("%d", &n);
	ans = 1000-(n % 1000);
	if (n % 1000 == 0) {
		ans = 0;
	}
	printf("%d\n", ans);

	return 0;
}

Measured memory_bytes: 1732
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
long long a[210000];
long long ans=0;
long long j[210000];
long long y[210000];
int main()
{
	long long n;
	scanf("%lld",&n);
	for(long long i=1;i<=n;i++)
	{
	  scanf("%lld",&a[i]);
	}
	long long l=1,r=1;
	long long now=0;
	while(l<=n)
	{
		while(r<=n&&now+a[r]==(now^a[r]))
		  now^=a[r++];
		ans+=r-l;
		now^=a[l];
		l++;		
	}
	cout<<ans<<'\n';
	return 0;
}

Measured memory_bytes: 3072
const config = {
    input: '/dev/stdin',
    newline: '\n'
};

const line = require('fs').readFileSync(config.input, 'utf-8').split(config.newline);

const selectionSort = arr => {
    let count = 0;
    for (let i = 0; i < arr.length; i++) {
        let min = i;
        for (let j = i; j < arr.length; j++) {
            if (arr[j] < arr[min]) {
                min = j;
            }
        }
        const tmp = arr[i];
        arr[i] = arr[min];
        arr[min] = tmp;
        if (i !== min) count++;
    }
    
    console.log(arr.map(x => x.toString()).join(' '));

    return count;
}

console.log(selectionSort(line[1].split(' ').map(x => parseInt(x))));



Measured memory_bytes: 17216
#include <bits/stdc++.h>
#define MAXN 200005
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(c) (c).begin(), (c).end()
using namespace std;

ll h, sol, k = 1;

int main()
{
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	
	cin >> h;
	while (h) {
		sol += k; k *= 2; h /= 2;
	}
	cout << sol;
	
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long  long int ll;
bool a[22][22];
ll dp[22][(1<<21)+5];
ll mod=1e9+7;
ll solve(int in,ll bitmask,int n)
{
  if(bitmask==(1<<n)-1)
   return 1; 
   if(in>n)
   return 0;
   if(dp[in][bitmask]!=-1)
   return dp[in][bitmask];
   ll ans=0;
   for(int i=1;i<=n;i++)
   {
    if((bitmask&(1<<(i-1)))==0&&a[in][i])
    {
      ans+=solve(in+1,bitmask|(1<<(i-1)),n);
      ans=ans%mod;
     }
   }
  return  dp[in][bitmask]=ans;
}
                 
   
      
int main()
{
   memset(dp,-1,sizeof(dp));
  int n;
  cin>>n;
  for(int i=1;i<=n;i++)
  for(int j=1;j<=n;j++)
  cin>>a[i][j];
  cout<<solve(1,0,n)<<endl;
}

Measured memory_bytes: 360704
#include <stdio.h>

int main (){
	
	int h, a, z, y;
	scanf ("%d %d", &h, &a);
	z = h%a;
	y = h/a;
	if (z > 0 ){
		printf ("%d\n", y+1);
	}
	else {
		printf ("%d\n", y);
	}
	return 0;
}

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

namespace ABC114A
{
    class Program
    {
        static void Main(string[] args)
		{
			int x = int.Parse(Console.ReadLine());

			if ((x == 3) || (x == 5) || (x == 7))
				Console.WriteLine("YES");
			else Console.WriteLine("NO");

			Console.ReadKey();
        }
    }
}

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
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 INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

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

    int res = 0;
    for (int i = 0; i < n; ++i) {
        res += b[a[i]];
        if (i >= 1 && a[i] == a[i-1] + 1) res += c[a[i-1]];
    }
    cout << res << endl;
}

Measured memory_bytes: 3608
n = int(input())
h = list(map(int,input().split()))

a = [float('inf')]*n
a[0] = 0
for i in range(n-1):
    a[i+1] = min(a[i+1],a[i]+abs(h[i]-h[i+1]))
    if i+2 < n :
        a[i+2] = min(a[i+2],a[i]+abs(h[i]-h[i+2]))

print(a[n-1])

Measured memory_bytes: 13980
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
typedef long long ll;
ll MOD = 1e9+7;

using namespace std;

int main()
{
	int a,b,c;
	bool co[100];
	fill(co,co+100,false);
	int ans=0;
	
	cin>>a>>b>>c;
	co[a-1]=true;
	co[b-1]=true;
	co[c-1]=true;
	for(int i=0;i<100;i++)
	{
		if(co[i])
			ans++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
h = gets.to_i
count = 0
while h != 1 do
    count = count + 1
    h = h/2
end

count = count + 1
last = 1
total = 0
(1..count).each do |i|
    if i == 1
        total = 1
        last =  1
    else
        total = total + (last*2)
        last = last*2
    end
end
puts total

Measured memory_bytes: 1788
#include<iostream>
#include<cmath>
#include<algorithm>
#include <cassert>
#include<string>
using namespace std;
int main(){
	int a = 0, b = 0, c=0, d[100000], e[100000],f=0,g=0,h=0, count = 0;
	char rikka,toka[100000];
	string mado[100000],saya;
	cin >> mado[0]>>mado[1]>>mado[2];
	if (mado[0].back()==mado[1].front()&&mado[1].back()==mado[2].front()) {
		cout << "YES" << endl;
	}
	else { cout << "NO" << endl; }
	return 0;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <array>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
#define int long long

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

    int x,y,z;
    cin>>x>>y>>z;

    swap(x,y);
    swap(x, z);

    cout << x << " " << y << " " << z << endl;
}


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

// 小数点以下桁数
// fixed << setprecision(i)

int gcd(int a,int b){return (a%b==0?b:gcd(b, a%b));}
int lcm(int a,int b){return a*b/gcd(a, b);}

int main()
{
  int64_t n, tmp;

  cin >> n;
  tmp = n - 1;
  for (int64_t i = 2; i * i <= n; i++)
  {
    if (n % i == 0)
      tmp = i + n / i - 2;
  }
  cout << tmp << endl;
}

Measured memory_bytes: 3608
#include <iostream>

int main(){
	char s[3];
	std::cin>>s;
	if(s[0]!=s[1]&&s[0]!=s[2]&&s[1]!=s[2]){
		std::cout<<"Yes"<<std::endl;
	}
	else{
		std::cout<<"No"<<std::endl;
	}
	return 0;
}

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

int main(){
    int a, b, c;
    int count;

    cin >> a >> b >> c;
    
    if (a != b && b != c && a != c){
        count = 3;
    }
    else {
        if ((a == b && b != c) || (a == c && c != b) || (b == c && c != a)){
            count = 2;
        }
        else{
            count = 1;
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 3552
import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {
	
	public static void main(String[] args) throws IOException {
		
		BufferedReader br = 
			new BufferedReader(new InputStreamReader(System.in));
		
		ArrayList<Integer> ans = new ArrayList<Integer>();
		int[] nums = new int[101];
		int max = Integer.MIN_VALUE;
		
		while (true) {
			
			String s = br.readLine();
			if(s == null) break;
			nums[Integer.parseInt(s)]++;
			
		}
		
		for (int i = 0; i < nums.length; i++) {
			max = Math.max(max, nums[i]);
		}
		
		for (int i = 0; i < nums.length; i++) {
			if (nums[i] == max) {
				ans.add(i);
			}
		}
		
		for (int a : ans) {
			System.out.println(a);
		}
	}
	
}

Measured memory_bytes: 9328
#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main() {
  int N, K, X, Y;
  cin >> N >> K >> X >> Y;
  
  if( N <= K ){
    cout << N*X << endl;
  }else{
    cout << K*X + (N-K)*Y << endl;
  }
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long K = sc.nextLong();
		int Q = sc.nextInt();
		long[] A = new long[N];
		// 正解数のポイントを全員から引いておく
		Arrays.fill(A, K - Q);
		for(int i = 0; i < Q; i++) {
			int a = sc.nextInt();
			// 正解者のポイントを加算する
			A[a - 1]++;
		}
		sc.close();
		for(int i = 0; i < N; i++) {
			if(A[i] > 0) System.out.println("Yes");
			else System.out.println("No");
		}
	}
}


Measured memory_bytes: 58012
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(a) a.begin(), a.end()
#define P pair<int, int>
#define F first
#define S second
int iso_lower(vector<int> V, int x) {
    //ソートされたVの中から、V[i]>=xとなる最小のiを返す.存在しなければVの要素数を返す
    int s = V.size();
    //V.push_back(INF);
    int l = -1;
    int r = s;  //rが常にtrue
    while(r - l > 1) {
        int mid = (l + r) / 2;
        if(V[mid] < x)
            l = mid;
        else
            r = mid;
    }
    return r;
}
signed main(){
    int N;cin>>N;
    vector<bool>V(N);
    rep(i,N){
        int a,b;cin>>a>>b;
        V[i]=(a==b);
    }
    rep(i,N-2){
        if(V[i]&&V[i+1]&&V[i+2]){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    
}


Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <numeric>
#include <set>
#include <list>
#include <bitset>
#include <cstdlib>
#include <map>
using ll = long long int;
using namespace std;

int main()
{
    int N;
    cin >> N;
    vector<string> S(N);
    vector<ll> cnt(5, 0);
    for (int i = 0; i < N; i++)
    {
        cin >> S[i];
        if (S[i][0] == 'M')
        {
            cnt[0]++;
        }
        if (S[i][0] == 'A')
        {
            cnt[1]++;
        }
        if (S[i][0] == 'R')
        {
            cnt[2]++;
        }
        if (S[i][0] == 'C')
        {
            cnt[3]++;
        }
        if (S[i][0] == 'H')
        {
            cnt[4]++;
        }
    }
    ll ans = 0;
    for (int i = 0; i < 3; i++)
    {
        for (int j = i + 1; j < 4; j++)
        {
            for (int k = j + 1; k < 5; k++)
            {
                ans += cnt[i] * cnt[j] * cnt[k];
            }
        }
    }
    cout << ans << endl;

    return 0;
}


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

int main(){
  int n,k,q;
  cin >> n >> k >> q;
  int qk = q - k;
  vector<int> pts(n,0);
  int kaitousha;
  for(int i=0;i<q;i++){
    cin >> kaitousha;
    kaitousha--;
    pts.at(kaitousha)++;
  }
  for(int i=0;i<n;i++){
    if(pts.at(i)>qk){
      cout << "Yes" << endl;;
    }else{
      cout << "No" << endl;;
    }
  }
}

Measured memory_bytes: 1024
toInt :: (String -> Int)
toInt x = read x ::Int
computeDigit ::  Int -> Int
computeDigit a
  | a    <  10 = 1
  | a    <  100 = 2
  | a    <  1000 = 3
  | a    <  10000 = 4
  | a    <  100000 = 5
  | a    == 100000 = 6

main = do
  args <- words <$> getLine
  print $ length $ filter (odd) $ map(computeDigit) [1..toInt((args !!) 0)]


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

class C
{
	static void Main()
	{
		Console.ReadLine();
		var s = Console.ReadLine();

		var m = s.Count(c => c == '.');
		Console.WriteLine(Math.Min(m, s.Min(c => m += c == '.' ? -1 : 1)));
	}
}


Measured memory_bytes: 11872
#include <iostream>
#include <string>

using namespace std;

int main(int argc, char* argv[]) {
  string str;
  cin >> str;
  
  int result = 0;
  auto len = str.size();
  for(int i = 0; i < len/2; ++i) {
    if(str[i] != str[len-i-1]) {
      result++;
    }
  }
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <time.h>
//#include <random>
#define sz(x) int(x.size())
#define in(x) freopen(x, "r", stdin)
#define out(x) freopen(x, "w", stdout)
#define N 100500
#define oo ll(1e16)
#define pii pair <int, int>
#define pll pair <ll, ll>
#define ft first
#define sd second
#define pb push_back
#define ppb pop_back
#define el '\n'
#define elf endl
#define base ll(1e9 + 7)
#define re return
#define nins 4294967295
using namespace std;
typedef long long ll;
typedef long double ld;

//mt19937 rnd(0);

void solve() {
    string s;
    cin >> s;
    bool f = 0;
    for (int i = 0; i < sz(s); i++)
        f |= (s[i] == '7');

    if (f) cout << "Yes";
        else cout << "No";
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #ifdef _LOCAL
        in("input.txt");

        int t = 1;
//        cin >> t;
        for (int i = 1; i <= t; i++) {
            cout << "Test #" << i << elf;

            clock_t start_time = clock();

            solve();

            cerr.precision(4); cerr << fixed;
            cerr << elf;
            cerr << "Time :: " << ld(clock() - start_time) / CLOCKS_PER_SEC << elf;

            cout << elf;
        }
    #else
        int t = 1;
//        cin >> t;

        while (t--) {
            solve();
            cout << el;
        }
    #endif
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using P = pair<string,int>;
const double PI = acos(-1);
int main() {
int n;
cin >> n;
map<int,int> mp;
  for(int x = 1; x <= pow(10,2); x++)
  for(int y = 1; y <= pow(10,2); y++)
  for(int z = 1; z <= pow(10,2); z++){
    int A = x*x + y*y + z*z + x*y + y*z + z*x;
    if( A <= n) mp[A]++;
  } 
for(int i = 1; i <= n; i++){
  cout << mp[i] << endl;
}
}

Measured memory_bytes: 3992
#include<bits/stdc++.h>
#define int long long
#define rep(i,a,b) for(int i=a;i<b;i+=1)
#define reps(i,a,b) for(int i=a;i>=b;i-=1)
#define vi vector<int>
#define pb push_back
#define in(x) int x; cin>>x;
#define inn(x, y) int x, y; cin>>x>>y;
#define mi unordered_map<int,int>
#define mem(x) memset(x, 0, sizeof(x))
#define IOS ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
using namespace std;

//bool primes[1000001];vi prime;
//void seive(){memset(primes, true, sizeof(primes));primes[0] = primes[1] = false;for(int i = 2; i*i<=1000000;i += 1){
//if(primes[i]){for(int j = i*i; j <= 1000000;j += i) primes[j] = false;}}rep(i, 2, 1000001){if(primes[i]) prime.pb(i);}}

//int gcd(int a, int b){return b==0 ? a : gcd(b, a%b);}

int32_t main(void){
	IOS;
	
	double r;
	cin>>r;
	double ans = (2.00*(22.0/7.0)*r);
	cout<<fixed<<setprecision(5)<<ans;
}

Measured memory_bytes: 3800
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<bitset>
#include<cstdio>
#include<cmath>
#include<deque>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<string>
#include<tuple>
#include<utility>
#include<vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
typedef vector<vector<int>> vvi;

#define rep(i, a, n)  for(int i=a; i<n; i++)
#define REP(i, n)  for(int i=0; i<(int)(n); i++)
#define REPS(i, n)  for(int i=1; i<=(int)(n); i++)
#define PER(i, n) for(int i=(int)(n)-1; i>= 0; i--)
#define PERS(i, n)  for(int i=(int)(n); i>0; i--)
#define FOR(i, c) for(__typeof((c).begin()) i = (c).begin(); i!=(c).end(); i++)
#define RFOR(i, c)  for(__typeof((c).rbegin()) i=(c).rbegin(); i!=(c).end(); i++)
#define ALL(container)  (container).begin(), (container).end()
#define RALL(container) (container).rbegin(), (container).rend()
#define SZ(container) (container).size()
#define FILL0(n)  setfill('0') << right << setw(n)
#define mp(a, b)  make_pair(a, b)
#define toLower(c)  c+0x20
#define toUpper(c)  c-0x20
#define pb  push_back
#define eb  emplace_back

const int INF = 1e9;
const long long LLINF = 1e18;
const int MOD = 1000000007;

int main(){
  int N;  cin >> N;
  vi l(N);
  REP(i, N) cin >> l[i];
  sort(RALL(l));
  int ans = 0;
  for(int a=0; a<N; a++){
    for(int b=a+1; b<N; b++){
      for(int c=b+1; c<N; c++){
        if(l[a]>=l[b]+l[c]) continue;
        if(l[b]>=l[c]+l[a]) continue;
        if(l[c]>=l[a]+l[b]) continue;
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}


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

typedef long long ll;
const int maxn=1e6+7;
const int inf=INT_MAX;
const ll inff=1e18;
const ll mod=1e9+7;
#define pii pair<int,int>
#define mkp make_pair
#define F first
#define S second
#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
//#define int ll

#ifdef HNO2
#define IOS
#else
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0);
#endif // HNO2

int32_t main()
{
    IOS
    int n;
    cin>>n;
    cout<<(n+1)/2<<endl;
}



Measured memory_bytes: 256