akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <iostream>
#include <limits.h>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string>
#include <vector>
#include <cstdio>
#include <iomanip>
#define ll long long
#define rep2(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define rep3(i,a,b) for(int i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define queint queue<int>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>//大きい順
#define pqg priority_queue<int,vec,greater<int>>//小さい順
#define pb push_back
#define vec vector<int>
#define vecvec vector<vector<int>>
#define vecll vector<ll>
#define vecvecll vector<vector<ll>>
#define bs binary_search
#define All(c) (c).begin(),(c).end()
#define mp make_pair
using namespace std;
int in(){int x;scanf("%d",&x);return x;}
//ll lin(){ll x;scanf("%d",&x);return x;}
int main(){
    int n=in(),q=in();
    vector<vec> que(n);
    rep(i,n-1){
        int a=in()-1,b=in()-1;
        que[a].pb(b);
        que[b].pb(a);
    }
    vecll cost(n,0);
    rep(i,q){
        int a=in()-1;
        int b=in();
        cost[a] += b;
    }
    vector<bool> done(n,false);
    pq pque;
    pque.push(0);
    while(!pque.empty()){
        int t=pque.top();
        pque.pop();
        REP(e,que[t]){
            if(done[e])continue;
            else{
                cost[e]+=cost[t];
                pque.push(e);
            }
        }
        done[t]=true;
    }
    rep(i,n){
        cout<<cost[i]<<" ";
    }
}

Measured memory_bytes: 16372
N, K = (int(num) for num in input().split(" "))
cnt = 0
dic = {i+1: 0 for i in range(N)}
while cnt < K:
    d = input()
    a = input().split(" ")
    for n in a:
        dic[int(n)] += 1
    cnt += 1

treated = 0
for key in dic:
    if dic[key] == 0:
        treated += 1
print(treated)


Measured memory_bytes: 9184
open Hashtbl;;let t=create 26 in let rec f()=let l=read_line()in Bytes.iter(fun c->if c>='A'&&c<='Z'||c>='a'&&c<='z'then let x=(if c>='A'&&c<='Z'then Char.chr(Char.code c+32)else c)in if mem t x then add t x(find t x+1)else add t x 1)l;f()in try f()with _->Bytes.iter(fun c->Printf.printf"%c : %d
"c(if mem t c then find t c else 0))"abcdefghijklmnopqrstuvwxyz"

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

int main()
{
	int l,r;
	string s;
	cin >> s;
	int n = s.size();
	for(int i = 0;i<n;i++) { if(s[i]=='A') { l=i;break; } }
	for(int i = n-1;i>=0;i--) { if(s[i]=='Z') { r=i;break; } }
	cout<<r-l+1<<endl;
}


Measured memory_bytes: 3732
#include<vector>
#include<string>
#include<iostream>
using namespace std;
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);

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


Measured memory_bytes: 3564
import sys
from operator import itemgetter
read = sys.stdin.read


def main():
    N, *AB = map(int, read().split())
    A, B = zip(*sorted(zip(*[iter(AB)] * 2), key=sum, reverse=True))
    print(sum(A[::2]) - sum(B[1::2]))


if __name__ == '__main__':
    main()

Measured memory_bytes: 26728
#include <iostream>
#include <iomanip>
#include <ios> 
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

using namespace std;
typedef long long int lli;
//const int MAX=;

int main(){
	int N;
	cin>>N;
	string A,B,C;
	cin>>A>>B>>C;
	int ans=0;
	rep(i,N){
		if(A[i]==B[i]&&B[i]==C[i])ans+=0;
		else if(A[i]==B[i])ans+=1;
		else if(B[i]==C[i])ans+=1;
		else if(C[i]==A[i])ans+=1;
		else ans+=2;
	}
	cout<<ans;
}

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

public class Main{
    public static void main(String[] args) throws IOException{
        FastReader in = new FastReader();
        FastWriter out = new FastWriter();
        String s = in.nextLine();
        String t = in.nextLine();
        int ans = 0;
        for (int i = 0; i < s.length(); i++){
            if (s.charAt(i) != t.charAt(i)) ans++;
        }
        out.pl(ans);
        out.close();
    }
}
class FastReader{ 
    BufferedReader br; 
    StringTokenizer st; 
    public FastReader() { 
        br = new BufferedReader(new InputStreamReader(System.in)); 
    } 
    String next(){ 
        while (st == null || !st.hasMoreElements()) { 
            try{ 
                st = new StringTokenizer(br.readLine()); 
            }catch (IOException  e){ 
                e.printStackTrace(); 
            } 
        } 
        return st.nextToken(); 
    } 
    int nextInt(){ 
        return Integer.parseInt(next()); 
    } 
    long nextLong(){ 
        return Long.parseLong(next()); 
    } 
    double nextDouble(){ 
      return Double.parseDouble(next()); 
    } 
    String nextLine(){ 
        String str = ""; 
        try{ 
            str = br.readLine(); 
        } 
        catch (IOException e){ 
            e.printStackTrace(); 
        } 
        return str; 
    } 
}
class FastWriter{
    PrintWriter out;
    FastWriter(){
        out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
	out.flush();
    }
    void pl(Object o){
        out.write(o.toString());
	    out.write("\n");
        out.flush();
    }
    void pl(){
        out.write("\n");
    }
    void p(Object o){
        out.write(o.toString());
    }
    void close(){
        out.flush();
        out.close();
    }  
}


Measured memory_bytes: 37108
N, Q = map(int, input().split(" "))
S = input()
l=[]
r=[]
for i in range(Q):
  _l, _r = map(int, input().split(" "))
  l.append(_l)
  r.append(_r)
#print(l, r)

total_list = []
total=0
S = ' ' + S
for i in range(1, len(S)):
  if S[i-1] + S[i] == "AC":
    total += 1
  total_list.append(total)
#print(total_list)
for j in range(Q):
  num_r = total_list[r[j]-1]
  num_l = total_list[l[j]-1]
  num = num_r - num_l
  print(num)
    
    



Measured memory_bytes: 14296
from collections import defaultdict
from math import gcd

MOD=10**9+7

n=int(input())
L=[]
for i in range(n):
	l=list(map(int,input().split()))
	L.append(l)

def kikaku(a,b):
	g=gcd(a,b)
	a//=g
	b//=g
	if a<0:
		return -a,-b
	return a,b
#aもbも正の場合Dposでカウント。
Dpos=defaultdict(int)
#aが正bが負の場合Dnegでカウント。
Dneg=defaultdict(int)

zerozero=0
azero=0
bzero=0

for l in L:
	a=l[0]
	b=l[1]
	if a==b==0:
		zerozero+=1
		continue
	if a==0:
		azero+=1
		continue
	if b==0:
		bzero+=1
		continue
	a,b=kikaku(a,b)
	if b>0:
		Dpos[(a,b)]+=1
	else:
		Dneg[(a,-b)]+=1
		Dpos[(-b,a)]+=0

r=1
for k,v in Dpos.items():
	a,b=k
	j=Dneg[(b,a)]
	r*=pow(2,v,MOD)+pow(2,j,MOD)-1
	#print(a,b,v,j,r)
	r%=MOD

r*=pow(2,azero,MOD)+pow(2,bzero,MOD)-1
r%=MOD
r-=1
r%=MOD

ans=r+zerozero
ans%=MOD
print(ans)
#print(Dpos)
#print(Dneg)

Measured memory_bytes: 114768
#include <bits/stdc++.h>
using namespace std;
int n;
int lowbit(int x) {
	for (int i = 0;; i ++) if (x >> i & 1) return i + 1;
}

int main() {
	cin >> n;
	for (int i = 0; i < n - 1; i ++) {
		for (int j = i + 1; j < n; j ++) {
			printf("%d ", lowbit(i ^ j));
		}
		printf("\n");
	}
}

Measured memory_bytes: 512
import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String s = in.nextLine();
		int n = in.nextInt();
		for(int i = 0;i < s.length();i += n) {
			System.out.print(s.charAt(i));
		}
	}
}


Measured memory_bytes: 22356
//Name: Pocket Pager Input
//Level: 1
//Category: 文字列
//Note: 

/**
 * 表を引くだけ。
 *
 * オーダーは O(|S|)。
 */
#include <iostream>
#include <string>

using namespace std;

bool solve(bool first) {
    static const char tbl[6][6] = {
        "abcde",
        "fghij",
        "klmno",
        "pqrst",
        "uvwxy",
        "z.?! "
    };

    string line;
    if(!getline(cin, line)) return false;
    if(line.size() % 2 == 1) {
        cout << "NA" << endl;
        return true;
    }
    string buf;
    for(int i = 0; i < line.size(); i += 2) {
        const int r = line[i] - '0' - 1;
        const int c = line[i+1] - '0' - 1;
        if(r < 0 || r >= 6 || c < 0 || c >= 5) {
            cout << "NA" << endl;
            return true;
        }
        buf += tbl[r][c];
    }
    cout << buf << endl;
    return true;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout.setf(ios::fixed);
    cout.precision(10);

    bool first = true;
    while(solve(first)) {
        first = false;
    }
    return 0;
}

Measured memory_bytes: 1172
#include<iostream>
#include<sstream>
#include<vector>
#include<iterator>
#include<algorithm>
using namespace std;

int main(void)
{
    long long A, B, K;
    cin >> A >> B >> K;

    long long cnt;
    cnt = min(A, K);
    A -= cnt;
    K -= cnt;

    cnt = min(B, K);
    B -= cnt;
    K -= cnt;

    cout << A << " " << B << endl;

    return 0;
}


Measured memory_bytes: 256
// Shift-JIS（シフトジス）

#include <bits/stdc++.h>
using namespace std;

int gcd(long long a, long long b)
{
    if (a < b)
    {
        a ^= b;
        b ^= a;
        a ^= b;
    }

    return b ? gcd(b, a % b) : a;
}

int lcm(long long a, long long b)
{
    return a * b / gcd(a, b);
}

int main()
{   
    int r;
    cin >> r;
    cout << 3 * r * r << endl;
    return 0;
}

Measured memory_bytes: 256
N = gets.to_i

def divisor_count(n)
  ret = 0
  (1..(Math.sqrt(n))).each do |m|
    if n % m == 0
      ret += (n / m == m ? 1 : 2)
    end
  end
  ret
end

ans = (1..N).count do |n|
  n.odd? && divisor_count(n) == 8
end
puts ans

Measured memory_bytes: 1788
/* ***********************************************
Author        :taciturnity
Created Time  :2020/2/21 8:23:51
File Name     :TEST.cpp
************************************************ */

#include <iostream>
#include <vector>
#include <queue>
#include <cstdio>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <cmath>
#include <bitset>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#define ll long long
#define INF 0x3f3f3f3f
#define rep(i,x,y) for(int i = x;i <= y;++i)
#define fori(i,x,y) for(int i = x;i >= y; -- i)
#define bug puts("--------------")
#define out(x) cout<<x<<'\n';
inline char gc(){char op[2];scanf("%s",op);return op[0];}
const int N = 1e6+10;
const double eps = 0.00000001;
const ll mod = 1e9 ;
using namespace std;
ll read()
{
    ll x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
int main(){
    ll a;
    cin >> a;
    ll d = a/500;
    a %= 500;
    ll b = a/5;
    cout<<1000LL*d+5LL*b;
}

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

int main(void) {
	int i,n;
	char t;
	char buff[30];
	scanf("%s", buff);
	
	n = strlen(buff);
	for(i=0;i<n/2;i++) {
		t = buff[i];
		buff[i] = buff[n-i-1];
		buff[n-i-1] = t;
	}
	
	printf("%s\n", buff);
	
	return 0;
}

Measured memory_bytes: 524
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define pf push_front
#define fr first
#define sc second
#define r_0 return 0
#define ld long double

using namespace std;

    const ll N = 1e2 + 7;
    const ll mod = 1e9 + 7;
    const ld eps = 1e-9;



void solve(){
    string s;
    cin >> s;
    int mx = 0, cnt =0;
    for(int i = 0; i < 3; ++ i){
        if(s[i] == 'R'){
            ++ cnt;
            mx = max(mx , cnt);
        }
        else
            cnt = 0;
    }
    cout << mx;
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll tt = 1;
    //cin >> tt;
    while(tt --){
            solve();
    }
}

/**

**/


Measured memory_bytes: 3664
def count1(x):
    global N
    return sum([(x&(1<<t))>>t for t in range(N)])

def check(k):
    global M,s,p
    for j in range(M):
        if (count1(k&s[j])-p[j])%2!=0:
            return False
    return True

N,M=map(int,input().split())
s=[]
for j in range(M):
    l=list(map(int,input().split()))
    A=sum([1<<(x-1) for x in l[1:]])
    s.append(A)
p=list(map(int,input().split()))

ans=0
for k in range(1<<N):
    if check(k):
        ans+=1

print(ans)

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

int main(){
    string S;
    int ans = 0;
    int count = 0;
    cin  >> S;
    for (int i = 0; i < S.size(); i++){
        if (S.at(i) == 'R'){
            count ++;
        }
        else{
            if (ans <= count){
                ans = count;
                count = 0;
            }
        }
    }
    if (count < ans){
        cout << ans << endl;
    }
    else {
        cout << count << endl;
    }
}

Measured memory_bytes: 3564
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define pb push_back
#define mp make_pair

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

int n;
vector<string> v;

int main() {
	while(cin >> n) {
		v.resize(n);
		rep(i, n) cin >> v[i];

		rep(i, n) {
			bool flag = true;
			for(int j = v[i].size()-1; j >= 0; j--) {
				if(v[i][j] == '.') {
					if(flag) {
						v[i][j] = '+';
						flag = false;
					} else {
						v[i][j] = ' ';
					}
				}
			}
		}

		for(int i = n-1; i >= 0; i--) {
			for(int j = v[i].size()-1; j >= 0; j--) {
				if(v[i][j] == '+') {
					int k = i;
					while(k-1 >= 0 && v[k-1][j] == ' ') {
						v[k-1][j] = '|';
						k--;
					}
				}
			}
		}

		rep(i, n) {
			cout << v[i] << endl;
		}
	}
	return 0;
}

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

const int N = 505;

int n, m, tot;
int a[N][N], ax[N * N], ay[N * N];

void Out(int x, int y) {
  if (x == n && y == m) return;
  ax[++tot] = x, ay[tot] = y;
  --a[x][y];
  if (y == m) --a[x + 1][y]; else --a[x][y + 1];
}

int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      scanf("%d", &a[i][j]);
    }
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      if (a[i][j] & 1) Out(i, j);
    }
  }
  printf("%d\n", tot);
  for (int i = 1; i <= tot; ++i) {
    printf("%d %d ", ax[i], ay[i]);
    if (ay[i] == m) printf("%d %d\n", ax[i] + 1, ay[i]);
    else printf("%d %d\n", ax[i], ay[i] + 1);
  }
  return 0;
}


Measured memory_bytes: 3968
#include <bits/stdc++.h>
typedef long long LL;
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

using namespace std;
LL p = 1000000007ll;

int main(void)
{
  vector<bool> sq(1048576);
  REP(i,1000) sq[i*i]=true;
  LL n,d;
  cin >> n >> d;
  vector<vector<LL>> vvx(n, vector<LL>(d));
  REP(i,n) REP(j,d) cin >> vvx[i][j];
  LL answer = 0;
  REP(i,n) REP(j,i) {
    LL distsq = 0ll;
    REP(k,d) {
      LL dx = vvx[i][k] - vvx[j][k];
      distsq += dx * dx;
    }
    if(sq[distsq]) ++answer;
  }
  cout << answer << endl;
  return 0;
}


Measured memory_bytes: 384
n = int(input())
p = [int(i) for i in input().split()]
ans = 0
for i in range(1, n - 1):
  p_prev, p_cur, p_next = p[i-1], p[i], p[i+1]
  ans += (p_next - p_cur ) * (p_cur - p_prev) > 0
print(ans)

Measured memory_bytes: 3060
implicit none
  integer :: D, N, out

  read(*,*) D, N

  if ( D == 0 ) then
     if ( n /= 100) then
        write(*,'(i0)') N
     else 
        write(*,'(i0)') N+1
     end if
  else if ( D == 1 ) then
     if ( n /= 100) then
        write(*,'(i0)') 100*N
     else 
        write(*,'(i0)') 100*(N+1)
     end if
  else
     if ( n /= 100) then
        write(*,'(i0)') 100*100*N
     else 
        write(*,'(i0)') 100*100*(N+1)
     end if
  end if
     
end


Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
using namespace std;

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

int tyo=0,his=0;
int h1,h2,h3;
char t;


void solve(){
	while(cin>>h1>>t>>h2>>t>>h3){
		if(h1==h2){
			his++;
		}
		if(h3*h3==(h1*h1)+(h2*h2)){
			tyo++;
		}
	}
	cout<<tyo<<endl<<his<<endl;
}



int main(){
	solve();
	return 0;
}

Measured memory_bytes: 1160
;; #!/usr/bin/env sbcl --script

(define-alien-routine getchar_unlocked char)

(declaim (optimize (speed 3) (safety 0) (debug 0))
         (inline getchar_unlocked))

(deftype int32 () '(signed-byte 32))

(declaim (ftype (function () int32) my-read-int))
(defun my-read-int ()
  (let ((is-negative nil)
        (result 0))
    (declare (type int32 result)
             (type boolean is-negative))
    (loop for cur-char of-type int32 = (getchar_unlocked) then (getchar_unlocked)
       while (and (/= cur-char 45)
                  (not (<= 48 cur-char 57)))
       finally (if (<= 48 cur-char 57)
                   (setf result (- cur-char 48))
                   (setf is-negative t)))
    (loop for cur-char of-type int32 = (getchar_unlocked) then (getchar_unlocked)
       while (<= 48 cur-char 57)
       do (setf result (+ (ash result 3) (ash result 1) (- cur-char 48))))
    (when is-negative (setf result (- result)))
    result))

(defun main ()
  (let* ((n (my-read-int))
         (k (my-read-int))
         (a (make-array n :element-type 'int32))
         (dp (make-array n :element-type 'int32 :initial-element (+ (expt 10 9) 100))))
    (dotimes (i n)
      (setf (aref a i) (my-read-int)))
    (setf (aref dp 0) 0)
    (loop for i of-type int32 from 0 below n do
      (loop with from-val of-type int32 = (aref dp i)
         for j of-type int32 from (1+ i) to (+ i k)
         while (< j n)
         for nval of-type int32 = (+ from-val (abs (- (aref a i) (aref a j))))
         if (< nval (aref dp j))
         do
           (setf (aref dp j) nval)))
    (format t "~a~%" (aref dp (- n 1)))))

(main)



Measured memory_bytes: 20708
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;


int main(void){
    int r0,w0,c,r;
    while(true){
        cin>>r0>>w0>>c>>r;
        if(r0==0 && w0==0 && c==0 &&r==0)break;
        int x = 0;
        while(true){
            if(r0+r*x-c*w0>=0)break;
            else x++;
        }
        cout<<x<<endl;
    }
    return 0;
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int n,t,h,a,ans=0;
    double min=INT_MAX, sa;
    cin>>n>>t>>a;
    for(int i=0; i<n; i++){
        cin>>h;
        sa = abs(a-(t-h*0.006));
        if(min > sa){
            min = sa;
            ans = i+1;
        }
    }
    cout<< ans <<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define pli pair<ll, int>
#define pil pair<int, ll>
#define pll pair<ll, ll>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define endl '\n'
const int inf = 1000000007;
const ll INF = 1e18;
// int mod = 998244353;
int mod = 1000000007;
const double eps = 1e-8;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
template<typename T, typename U> T pow_(T a, U b) { return b ? pow_(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { rep(i, sz(vec)) { if (i) os << " "; os << vec[i]; } return os; }
template<class T> ostream& operator << (ostream& os, const set<T>& s) { for (auto si : s) os << si << " "; return os; }
template<typename T> inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T, class T2> inline void add(T &a, T2 b) { a += b % mod; if (a >= mod) a -= mod; }
template<class T> void operator += (vector<T>& v, vector<T> v2) { rep(i, sz(v2)) v.eb(v2[i]); }

void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout << fixed << setprecision(12); // debuged
    int T;
    T = 1;
    while (T--) solve();
}

void solve() {
    int x;
    cin >> x;
    rep3(i, x, inf) {
        [&]() {
            for (int j = 2; j * j <= i; ++j) {
                if (i % j == 0) return;
            }
            cout << i << endl;
            exit(0);
        }();
    }
}


Measured memory_bytes: 3544
import java.util.Scanner;

public class Main {
    public static void main(String args[]){
        Scanner inp=new Scanner(System.in);
        int n;
        int cnt=0;
        long d,x,y;
        n=inp.nextInt();
        d=inp.nextLong();
        d=d*d;
        for(int i=0;i<n;i++){
            x=inp.nextLong();
            y=inp.nextLong();
            if(x*x+y*y<=d) cnt++;
        }
        System.out.println(cnt);
    }
}


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

using namespace std;
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/__gcd(a,b)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
typedef long int li;

int main()
{
    IOS;
    int n,x,t,l;
    cin>>n>>x>>t;
    l=n/x;
    if(n%x!=0){
        l++;
    }
    cout<<l*t<<endl;
    return 0;
}


Measured memory_bytes: 3648
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;

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


signed main(void) {
    int n;
    cin >> n;
    loop(i,1,2000){
        int cnt = 0;
        for(int j = 1; j*j <= i; j++)if(i%j == 0){
            cnt++;
            if(j*j < i)cnt++;
        }
        if(cnt == n){
            cout << i << endl;
            return 0;
        }
    }
}



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

string divide[4] = {"dream", "dreamer", "erase", "eraser"};

int main(){
  string s;
  cin >> s;
  reverse(s.begin(), s.end());
  for(int i = 0; i < 4; i++){
    reverse(divide[i].begin(), divide[i].end());
  }
  bool can = true;
  for(int i = 0; i < s.size();){
    bool can2 = false;
    for(int j = 0; j < 4; j++){
      string d = divide[j];
      if(s.substr(i, d.size()) == d){
        can2 = true;
        i += d.size();
      }
    }
    if(!can2){
      can = false;
      break;
    }
  }  
  if(can) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
} 

Measured memory_bytes: 3728
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

template<typename T>
void fill_all(T& a, const T& b)
{
	a = b;
}
template<typename T, size_t N, typename U>
void fill_all(T(& a)[N], const U& b)
{
	for (auto& i : a)
	{
		fill_all(i, b);
	}
}

int h[100000];
int main() {
	int N, K;
	cin >> N;
	for (int i = 0; i < N; i++)
	{
		cin >> h[i];
	}
	std::sort(h, h + N);

	cout << (std::accumulate(h, h + N, 0)-h[N-1]/2) << endl;
}

#if 0
int P, R, Q;
int r_num[300];
std::vector<int> resolved[300][101];

int main()
{
	cin >> P >> R >> Q;
	for (int i = 0; i < R; i++)
	{
		cin >> r_num[i];
	}



}
#endif

Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define PI 3.141592653589793
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, a, n) for (int i = a; i < (n); i++)
#define rrep(i, n, k) for (int i = (n); i >= (k); i--);
#define all(x) (x).begin(), (x).end()
#define vi vector<int>
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>vector<T> make_vector(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto make_vector(size_t a, Ts... ts){return vector<decltype(make_vector<T>(ts...))>(a, make_vector<T>(ts...));}
const int MOD = 1e9 + 7;
const int INF = 9e18;

signed main() {
    int N, K;
    cin >> N >> K;
    vector<pair<int, int>> coordinate(N);
    for (int i = 0; i < N; i++) cin >> coordinate[i].first >> coordinate[i].second;
    vector<int> x, y;
    for (auto temp : coordinate) {
        x.push_back(temp.first);
        y.push_back(temp.second);
    }
    sort(x.begin(), x.end());
    sort(y.begin(), y.end());
    int ans = INF;
    for (int x1 = 0; x1 < N; x1++) {
        for (int x2 = x1 + 1; x2 < N; x2++) {
            for (int y1 = 0; y1 < N; y1++) {
                for (int y2 = y1 + 1; y2 < N; y2++) {
                    int minX = x[x1], maxX = x[x2];
                    int minY = y[y1], maxY = y[y2];
                    int check = 0;
                    for (int i = 0; i < N; i++) {
                        auto temp = coordinate[i];
                        if (minX <= temp.first && temp.first <= maxX && minY <= temp.second && temp.second <= maxY) ++check;
                    }
                    if (check >= K) ans = min(ans, (maxX - minX) * (maxY - minY));
                }
            }
        }
    }
    cout << ans << endl;
}

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

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 long long INF = 1LL << 60;
const long long MOD = 1000000007;

int main(){
  int a, b;
  cin >> a >> b;

  if(abs(a-b) > 1){
    cout << 0 << endl;
    return 0;
  }

  ll ans = 1;
  if(a == b) ans *= 2;
  REP(i, 1, a){
    ans *= i;
    ans %= MOD;
  }
  REP(i, 1, b){
    ans *= i;
    ans %= MOD;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cassert>
typedef long long int ll;
using namespace std;

// @@ !! LIM()

int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  ll X; cin >> X;
  for (ll i = 1; i <= 360; i++) {
    if ((i * X) % 360 == 0) {
      cout << i << endl;
      return 0;
    }
  }

  return 0;
}



Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define mset(a, b) memset(a, b, sizeof(a))
#define mcpy(a, b) memcpy(a, b, sizeof(a))
#define rg register
using namespace std;
typedef long long LL;
const int N = 15;
const LL MOD = 1e9 + 7;

template <typename T> inline void read(T &AKNOI) {
	T x = 0, flag = 1;
	char ch = getchar();
	while (!isdigit(ch)){
		if (ch == '-') flag = -1;
		ch = getchar();
	}
	while (isdigit(ch)) {
		x = x * 10 + ch - '0';
		ch = getchar();
	}
	AKNOI = flag * x;
}

int n, m, g[N], bit[1<<N];
LL pw[N*N], dp[1<<N];

void init() {
	read(n); read(m);
	pw[0] = 1;
	for (int i = 1, u, v; i <= m; ++i) {
		pw[i] = pw[i-1] * 2 % MOD;
		read(u); read(v);
		--u; --v;
		g[u] |= (1<<v);
	}
}

void solve() {
	int full = (1<<n);
	dp[0] = 1;
	for (int S = 1; S < full; ++S) {
		bit[S] = bit[S>>1] + (S&1);
	}
	for (int S = 0; S < full; ++S) {
		if ((S & 1) ^ ((S>>1) & 1)) continue;
		for (int T = S; T; T = (T-1) & S) {
			if ((T & 1) ^ ((T>>1) & 1)) continue;
			LL tmp = 1;
			for (int i = 0; i < n; ++i) {
				if ((S>>i) & 1) {
					if ((T>>i) & 1) {
						tmp = tmp * pw[bit[ g[i] & (S ^ T) ]] % MOD;
					} else {
						tmp = tmp * (pw[bit[ g[i] & T ]] - 1) % MOD;
					}
				}
			}
			dp[S] = (dp[S] + tmp % MOD * dp[S^T]) % MOD;
		}
	}
	printf("%lld\n", (pw[m] - dp[full-1] + MOD) % MOD);
}

int main() {
	init();
	solve();
	return 0;
}


Measured memory_bytes: 640
#include <algorithm>
#include <array>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>

#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
using namespace std;

int main() {
    int L;
    cout << fixed << setprecision(15);

    cin >> L;
    cout << (double)L * L * L /27 << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Arrays;
public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    int k = scan.nextInt();
    int vec[];
    vec = new int[n];
    for (int i = 0; i < n; i++){
      vec[i] = scan.nextInt();
    }
    int ans = 0;
    Arrays.sort(vec);
    for (int i = 0; i < k; i++){
      ans = ans + vec[i];
    }
    System.out.println(ans);
  }
}
    

Measured memory_bytes: 38740
//
/*
ID: kfoozmi1
LANG: C++
TASK:
*/
#include <bits/stdc++.h>
using namespace std;

#ifdef kfoozminus
#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)

void faltu() {
	cerr << endl;
}

template <typename T>
void faltu(T a[], int n) {
	for(int i = 0; i < n; ++i) cerr << a[i] << ' ';
	cerr << endl;
}

template <typename First, typename ... hello>
void faltu(First arg, const hello&... rest) {
	cerr << arg << ' ';
	faltu(rest...);
}
#else
#define dbg(args...)
#endif

#define PB push_back
#define F first
#define S second
#define MP make_pair
#define SQR(a) ((a) * (a))
#define vsort(v) sort(v.begin(), v.end())
#define PQ priority_queue
#define PI acos(-1)
#define EPS 1e-9

#define B1 43
#define B2 43

#define MOD1 1000000007
#define MOD2 1000000009
#define MOD  1000000007

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

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

inline bool checkBit(ll n, int i) { return n & (1LL << i); }
inline ll setBit(ll n, int i) { return n | (1LL << i); }
inline ll resetBit(ll n, int i) { return n & (~ (1LL << i)); }
inline bool EQ(double a, double b) { return fabs(a-b) < EPS; }
inline double dist(double ix, double iy, double jx, double jy) { return sqrt(SQR(ix - jx) + SQR(iy - jy)); }

#define PMX 1000000

int marked[PMX/64+2];

#define mark(x) marked[x>>6] |= (1<<((x&63)>>1))
#define check(x) (marked[x>>6] & (1<<((x&63)>>1)))

bool isPrime(int x)
{
    return (x>1) && ((x==2) || ((x&1) && (!(check(x)))));
}

void seive(int n)
{
    int i, j;
    for(i=3; i*i<=n; i+=2)
    {
        if(!check(i))
        {
            for(j=i*i; j<=n; j+=i<<1)
            {
                mark(j);
            }
        }
    }
}

ll bigMod(ll a, ll b)
{
	ll r = 1;
	while(b) {
		if(b & 1) (r *= a) %= MOD;
		b >>= 1;
		(a *= a) %= MOD;
	}
	return r;
}

#define INF 100000000
#define MX 100007

int x[MX];

int main()
{
#ifdef kfoozminus
	//freopen("in", "r", stdin);
#endif
	int n, i, ans = 0;
	scanf("%d", &n);
	for(i = 0; i < 2 * n; i ++) {

		scanf("%d", &x[i]);
	}
	sort(x, x + 2 * n);
	for(i = 0; i < 2 * n; i += 2) {

		ans += x[i];
	}
	printf("%d\n", ans);
        return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#define MAX_N 100
using namespace std;

void display(int ary[], int size);
int selectionSort(int ary[], int size);

int main(void) {
	int N;
	int ary[MAX_N];

	cin >> N;
	for(int i = 0; i < N; i++) {
		cin >> ary[i];
	}

	int cnt = selectionSort(ary, N);
	printf("%d\n", cnt);

	return 0;
}

void display(int ary[], int size) {
	for(int i = 0; i < size; i++) {
		printf("%d", ary[i]);
		if(i == size-1) putchar('\n');
		else            putchar(' ');
	}
}

int selectionSort(int ary[], int size) {
	int cnt = 0;
	for(int i = 0; i < size; i++) {
		int minj = i;
		for(int j = i; j < size; j++) {
			if(ary[j] < ary[minj]) {
				minj = j;
			}
		}
		if(i != minj) {
			swap(ary[i], ary[minj]);
			cnt++;
		}
	}
	display(ary, size);
	return cnt;
}

Measured memory_bytes: 3240
#include<bits/stdc++.h>
using namespace std;
#define INIT  ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define mp make_pair
#define pb push_back
#define ft first
#define sc second
#define ll long long
#define pii pair<int, int>
#define count_bits __builtin_popcount
#define int ll

int n, m;
string s, t;
int dp[3010][3010];
int dir[3010][3010];


int32_t main(){
INIT
cin>>s>>t;
n=s.length(); m=t.length();
for(int i=1; i<=n; i++){
    for(int j=1; j<=m; j++){
        if(s[i-1]==t[j-1]){
            dp[i][j]=dp[i-1][j-1]+1;
            dir[i][j]=2;
        }
        if(dp[i-1][j]>=dp[i][j]){
            dir[i][j]=1;
            dp[i][j]=dp[i-1][j];
        }
        if(dp[i][j-1]>=dp[i][j]){
            dir[i][j]=3;
            dp[i][j]=dp[i][j-1];
        }

        if(dp[i-1][j-1]>=dp[i][j]){
            dir[i][j]=2; dp[i][j]=dp[i-1][j-1];
        }

    }
}



int y=n, x=m;
string lcs="";
while(y>0 && x>0){
    int direction=dir[y][x];
    int dx, dy;
    if(direction==1){
        dy=-1; dx=0;
    }
    if(direction==2){
        dy=-1; dx=-1;
    }
    if(direction==3){
        dy=0; dx=-1;
    }
    if(dp[y+dy ][x+dx]<dp[y][x]){
        lcs=s[y-1]+lcs;
    }
    y+=dy; x+=dx;
}
cout<<lcs;



return 0;
}



Measured memory_bytes: 144800
#include <bits/stdc++.h> 
#define int long long
#define quickie ios_base::sync_with_stdio(false); cin.tie(NULL);
#define rep(i, a, b) for(int i=a; i<b; i++)
#define rep1(i, a, b) for(int i=a; i<=b; i++)
#define repp(i, a, b) for(int i=b-1; i>=a; i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define db double
#define mi map<int, int>
#define mc map<char, int>
#define ms map<string, int>
#define vi vector<int>
#define qi queue<int>
#define MI(x) power(x, mod-2)
#define test int t; cin >> t;
//#define mod 1000000007LL
#define mod 998244353 
using namespace std;
int power(int x, int y) ;
int gcd(int a, int b) ;
#define pi 3.141592653589

signed main() {
    quickie
    int n, m ;
    cin >> n >> m ;
    int a[m] ;
    int s =0 ;
    rep(i, 0, m) cin >> a[i], s += a[i] ;
    if(s > n) cout << "-1\n" ;
    else cout << n-s << "\n" ;
}

int power(int x, int y) {
    int res = 1; x %= mod;
    while (y > 0) {
        if (y & 1)
            res = (res*x) % mod;
        y = y>>1;
        x = (x*x) % mod;
    }
    return res%mod;
}
 
int gcd(int a,int b){
    if(a==0) return b;
    return gcd(b%a,a);
}

Measured memory_bytes: 3688
#include<bits/stdc++.h>
using namespace std;
using ll = int64_t;
int main(){
    ll N;
    cin >> N;
    string s;
    if(N == 0){
        cout << 0 << endl;
        return 0;
    }
    string t[] = {"00", "01", "10", "11"};
    ll p[] = {0, 1, -2, -1};
    for(ll i = 0; N; i++){
        for(ll j = 0; j < 4; j++){
            if((N - p[j]) % 4 == 0){
                N = (N - p[j]) / 4;
                s = t[j] + s;
                break;
            }
        }
    }
    if(s[0] == '0') s = s.substr(1);
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <math.h>
#include <string>
#include <algorithm>
//#include <ctype.h>
#include <vector>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <bitset>
using namespace std;

#define ll long long int
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repm(i, a, n) for (int i = a; i >= n; i--)
#define INF 1e9
#define LINF 1e17
#define MOD (int)(1e9 + 7)
#define pi 3.141592653589
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vs vector<string>
#define vii vector<vector<int>>
#define vll vector<ll>
#define vllll vector<vector<ll>>
#define vd vector<double>
#define ALL(a) (a).begin(), (a).end()
#define sort_v(a) sort(a.begin(), a.end())
#define reverse_v(a) reverse(a.begin(), a.end())
#define fi first
#define se second

void print(bool c)
{
    (c) ? (cout << "Yes" << endl) : (cout << "No" << endl);
}

void Print(bool c)
{
    (c) ? (cout << "YES" << endl) : (cout << "NO" << endl);
}

//最小公倍数
template <typename T>
T gcd(T a, T b)
{
    while (1)
    {
        if (a < b)
            swap(a, b);
        if (b == 0)
            break;
        a %= b;
    }
    return a;
}

//最大公約数
template <typename T>
T lcm(T a, T b)
{
    return a * b / gcd(a, b);
}
//セカンドキー->ファーストキーの順ソート
bool cmp(const pii &a, const pii &b)
{
    if (a.second != b.second)
        return a.second < b.second;
    return a.first < b.first;
}

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

int main(void)
{
    int n;
    cin >> n;
    string s;
    cin >> s;

    map<char, ll> mp;
    rep(i, 0, n) mp[s[i]]++;
    ll ans = mp['R'] * mp['G'] * mp['B'];
    rep(i, 0, n)
    {
        rep(j, i + 1, n)
        {
            int k = j + (j - i);
            if (k >= n)
                break;
            if (s[i] != s[j] && s[k] != s[j] && s[i] != s[k])
                ans--;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3608
// </> : towhid1zaman

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair< int, int > pii;
typedef pair< pii, int > ppi;
#define fill(a,b) memset(a,b,sizeof(a))
#define all(v) (v).begin(),(v).end()
#define sp(k) cout<<setprecision(k)<<fixed;
#define rep(i,a) for(int i=0;i<a;i++)
#define rep1(i,a,b) for(int i=(a);i<=(b);++i)
#define irep(i,b,a) for(int i=(b);i>=(a);--i)
#define minv(v) *min_element(all(v))
#define maxv(v) *max_element(all(v))
#define unq(v) sort(all(v)),(v).erase(unique(all(v)),(v).end())
#define _ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"
#define sqr(a) ((a)*(a))
#define sz(a) int(a.size())
#define ff first
#define ss second
#define pb push_back

const double pi = acos(-1.0);
const int mod = 1000000007; // (int)1e9+7
const int inf = 0x3f3f3f3f;// (int)3e18;
const int maxn = 2000100;

int calc(int x) {
	int ret = 0;
	while(x % 100 == 0) {
		x /= 100;
		++ret;
	}
	return ret;
}

int main(){
        _
        int D, N;
        cin >> D >> N;
        int cnt = 0, val = 0;
        while(cnt < N) {
            ++val;
            if(calc(val) == D) ++cnt;
        }
        cout << val << endl;

return 0;
}




Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		int N = s.length;
		
		int[][] dp = new int[N+1][2];
		
		for(int i=0; i<N; i++) {
			if(i==0 || s[i-1] != s[i]) {
				dp[i+1][0] = Math.max(dp[i+1][0], dp[i][0]+1);
			}
			dp[i+1][0] = Math.max(dp[i+1][0], dp[i][1]+1);

			if(i>=1)
				dp[i+1][1] = Math.max(dp[i+1][1], dp[i-1][0]+1);

			if(i>=3 &&(s[i]!=s[i-2] || s[i-1]!=s[i-3]))
				dp[i+1][1] = Math.max(dp[i+1][1], dp[i-1][1]+1);
		}
		
		System.out.println(Math.max(dp[N][0], dp[N][1]));
		
		sc.close();
	}
}



Measured memory_bytes: 32836
def resolve():
    N = int(input())
    D, X = list(map(int, input().split()))
    A = [int(input()) for _ in range(N)]
    ans = 0
    for i in range(N):
        for j in range(201 + 1):
            if j * A[i] + 1 <= D:
                ans += 1

    print(ans+X)
    return


resolve()

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

int main() {
	vector<int> a(3);
	cin>>a[0]>>a[1]>>a[2];
	sort(a.begin(),a.end());
	if(a[1]==5 && a[0]==5 && a[2]==7){
		cout<<"YES";
	}else{
		cout<<"NO";
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int N,A[105],B[105],max=0,sum=0;
	cin>>N;
	for(int i = 0;i < N;i++){
		cin>>A[i];
		sum += A[i];
	}
	for(int i = 0;i < N;i++)
		cin>>B[i];
	sum += B[N-1];
	max = sum;
	for(int i = N-2;i>=0;i--){
		sum += B[i];
		sum -= A[i+1];
		if(sum>max) max = sum;
	}
	cout<<max<<endl;
	return 0;
	
} 

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int x = sc.nextInt();
        int y = sc.nextInt();
        int z = sc.nextInt();
        
        System.out.println(z);
        System.out.println(x);
        System.out.println(y);
    }
}

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

#define int long long int

const int mod = 1e9+7;

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

	map<string, int> s;
	int n;
	cin>>n;
	while(n--)
	{
		string ss;
		cin>>ss;
		s[ss]++;
	}
	int maxx = 0;
	for(auto p: s)
		maxx = max(maxx, p.second);
	for(auto p: s)
		if(p.second == maxx)
			cout<<p.first<<endl;

	return 0;
}

Measured memory_bytes: 23808
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  string s;
  cin>>s;
  int ans=0;
  rep(i,4){
    if(s.at(i)=='+'){
      ans++;
    }
    else{
      ans--;
    }
  }
  cout<<ans;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
using namespace std;
int N,M,K;

int main(){
    cin >> N;
    vector<int> d;
    for(int i=0;i<N;i++){
        int tmp;
        cin >> tmp;
        d.push_back(tmp);
    }
    sort(d.begin(),d.end());
    int ans = d[N/2]-d[N/2-1];
    cout << ans << endl;
}

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

int main() {
	ios_base::sync_with_stdio( false );

	int a, b;
	cin >> a >> b;

	if( a <= 0 && b >= 0 ) {
		cout << "Zero\n";
	}
	else if( a > 0 ) {
		cout << "Positive\n";
	}
	else if( b < 0 ) {
		cout << ((b-a)%2 == 0 ? "Negative" : "Positive") << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int a[100002][2];
int L;
int time(int i)
{
  int t;
  if(a[i][1] != 0) return a[i][1];
  if(a[i][0] > a[i+1][0]){
    a[i][1] = L - a[i][0];
    if(a[i][0] < a[i-1][0]) a[i][1] += a[i-1][1];
  }else{
    t = time(i+1);
    if(a[i-1][1] > t) t = a[i-1][1];
    a[i][1] = t + L - a[i][0];
  }
  return a[i][1];
}
int main()
{
  int n,i,t,m=0;
  scanf("%d%d",&n,&L);
  for(i=1;i<=n;i++){
    scanf("%d",&a[i][0]);
  }
  for(i=1;i<=n;i++){
    t = time(i);
    if(m<t) m = t;
  }
  printf("%d\n",m);
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define LLI long long int
#define FOR(v, a, b) for(LLI v = (a); v < (b); ++v)
#define FORE(v, a, b) for(LLI v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(LLI v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define fst first
#define snd second
#define popcount __builtin_popcount
#define UNIQ(v) (v).erase(unique(ALL(v)), (v).end())
#define bit(i) (1LL<<(i))

#ifdef DEBUG
#include <misc/C++/Debug.cpp>
#else
#define dump(...) ((void)0)
#endif

#define gcd __gcd

using namespace std;
template <class T> constexpr T lcm(T m, T n){return m/gcd(m,n)*n;}

template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}
template <typename T, typename U> bool chmin(T &a, const U &b){return (a>b ? a=b, true : false);}
template <typename T, typename U> bool chmax(T &a, const U &b){return (a<b ? a=b, true : false);}
template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}

struct Init{
  Init(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);
    cerr << fixed << setprecision(12);
  }
}init;



int main(){

  string d4[4] =
    {
     "aagh",
     "bbgh",
     "efcc",
     "efdd"
    };

  string d5[5] =
    {
     "abbaa",
     "a.ccb",
     "baa.b",
     "b..ac",
     "aa.ac"
    };

  string d6[6] =
    {
     "a.aabb",
     "a.b.aa",
     "ccb..b",
     ".a.aab",
     ".abc..",
     "ccbc.."
    };

  string d7[7] =
    {
     "aabbcc.",
     "dd.dd.a",
     "..d..da",
     "..d..db",
     "dd.dd.b",
     "..d..dc",
     "..d..dc"
    };
  

  int N;
  while(cin >> N){

    if(N == 2){
      cout << -1 << endl;
    }else if(N == 3){
      cout <<
        "aac" << endl <<
        "b.c" << endl << 
        "bdd" << endl;
    }else{
      vector<string> ans(N, string(N, '.'));

      int x = N / 4 - 1;

      REP(k,x){
        REP(i,4){
          REP(j,4){
            ans[i+k*4][j+k*4] = d4[i][j];
          }
        }
      }

      switch(N % 4){
      case 0: {

        REP(i,4){
          REP(j,4){
            ans[i+x*4][j+x*4] = d4[i][j];
          }
        }

        break;
      }
        
      case 1: {

        REP(i,5){
          REP(j,5){
            ans[i+x*4][j+x*4] = d5[i][j];
          }
        }

        break;
      }
        
      case 2: {

        REP(i,6){
          REP(j,6){
            ans[i+x*4][j+x*4] = d6[i][j];
          }
        }

        break;
      }

      case 3: {
        
        REP(i,7){
          REP(j,7){
            ans[i+x*4][j+x*4] = d7[i][j];
          }
        }

        break;
      }
      }

      REP(i,N){
        cout << ans[i] << endl;
      }
    }
  }

  return 0;
}


Measured memory_bytes: 2304
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <string.h>
#include <vector>

using namespace std;

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define REP1O(i,x) for(int i{ 1 }; i < (int)(x); i++)
#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); i++)
#define REPIT(i,x) for(auto i{(x).begin()}; i != (x).end(); i++)

#define PB push_back
#define MP make_pair
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

typedef int64_t ll;
typedef double dbl;
typedef vector<bool> Vb;
typedef vector<int> Vi;
typedef vector<ll> Vl;
typedef vector<string> Vs;
typedef vector<vector<int> > VVi;
typedef vector<vector<ll> > VVl;

const double pi = acos(-1);
const double eps = 1e-10;
double a, b, x;
double area;

bool check_1(double d)
{
	double t = tan(d * pi / 180);
	double tmp = b * b / 2 / t;

	return x <= tmp + eps;
}

bool check_2(double d)
{
	double t = tan(d * pi / 180);
	double tmp = area - a * a / 2 * t;

	return x <= tmp + eps;
}

int main()
{
	cin >> a >> b >> x;
	x /= a;
	area = a * b;

	if (x <= a * b / 2)
	{
		double ng = 180-eps;
		double ok = 0;
		REP(i, 100)
		{
			auto mid = (ng + ok) / 2;
			if (check_1(mid))
				ok = mid;
			else
				ng = mid;
		}

		cout << setprecision(9) << ok << endl;
		return 0;
	}

	double ng = 180 - eps;
	double ok = 0;

	REP(i, 100)
	{
		auto mid = (ng + ok) / 2;
		if (check_2(mid))
			ok = mid;
		else
			ng = mid;
	}

	cout << setprecision(10) << ok << endl;

}


Measured memory_bytes: 384