akhauriyash/Code-Regression huggingface dataset:
#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;

int main(){
  int n; cin >> n;
  set<string> st;

  rep(i, n){
    string s; cin >> s;
    st.insert(s);
  }

  cout << st.size() << endl;

  return 0;
}


Measured memory_bytes: 19260
fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let a: u64 = sc.read();
    let b: u64 = sc.read();
    let c: u64 = sc.read();
    let rest = a - b;
    if c > rest {
        println!("{}", c - rest);
    } else {
        println!("0");
    }
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 4352
#include<cstdio>

int main(void) {
	int N, i;
	int a[100000], c[3], ans;


	scanf("%d", &N);
	for(i = 0; i < N; i++) {
		scanf("%d", &a[i]);
	}

	c[0] = 0;
	c[1] = 0;
	c[2] = 0;
	for (i = 0; i < N; i++) {
		if (a[i] % 4 == 0) {
			c[2]++;
		}
		else if (a[i] % 2 == 0) {
			c[1]++;
		}
		else { c[0]++; }

	}
	ans = 0;
	if (c[1] == 0) { if (c[0] <= c[2] + 1) { ans = 1; } }
	if (c[1] >= 1) { if (c[0] <= c[2]) { ans = 1; } }
	if (ans == 1) { 
		printf("Yes\n");
	}
	else { 
		printf("No\n");
	}
}

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

using namespace std;

signed main()
{
  int N;
  cin >> N;
  vector<int> L(N);
  int maxl=0, suml=0;
  for(int i=0;i<N;i++) {
    cin >> L[i];
    maxl = max(maxl, L[i]);
    suml += L[i];
  }
  if(maxl < suml - maxl) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define watch(x) cout<<(#x)<<"="<<(x)<<'\n'
#define mset(d,val) memset(d,val,sizeof(d))
#define setp(x) cout<<fixed<<setprecision(x)
#define forn(i,a,b) for(int i=(a);i<(b);i++)
#define fore(i,a,b) for(int i=(a);i<=(b);i++)
#define pb push_back
#define F first
#define S second
#define pqueue priority_queue
#define fbo find_by_order
#define ook order_of_key
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef long double ld;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
void amin(ll &a, ll b){ a=min(a,b); }
void amax(ll &a, ll b){ a=max(a,b); }
const ll INF = ll(1e18);
const int MOD = 998244353;

const int MAXN = 100005;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	ll x,y; cin>>x>>y;
	fore(i,0,x){
		if(i*2+(x-i)*4==y){
			cout<<"Yes\n"; return 0;
		}
	}
	cout<<"No\n";
	
	return 0;
}


Measured memory_bytes: 3612
#include <stdio.h>

int
main(int argc, char *argv[])
{
  int n, a[10000], ans = 0;
  scanf("%d", &n);
  for(int i = 0; i < n; i++){
    scanf("%d", &a[i]);
    while(a[i] % 2 != 1){
      ans++;
      a[i] /= 2;
    }
  }
  printf("%d\n", ans);
  return 0;
}
 

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

const int queue_size = 200000;
template<class T>
class Queue{
  public:
    Queue(){
      head = tail = 0;
    }
    bool isEmpty(){
      return head == tail;
    }
    bool isFull(){
      return head == (tail + 1) % queue_size;
    }
    void enqueue(T x){
      if(isFull()){
        cout << "error";
      }else{
        queue[tail] = x;
        if(tail + 1 == queue_size){
          tail = 0;
        }else{
          tail++;
        }
      }
    }
    T dequeue(){
      if(isEmpty()){
        cout << "error Empty";
      }else{
        T x = queue[head];
        if(head + 1 == queue_size){
          head = 0;
        }else{
          head++;
        }
        return x;
      }
    }
  private:
    int head;
    int tail;
    T queue[queue_size];
};


int main(){
  Queue<int> queue_number;
  Queue<string> queue_name;
  int n, q;
  cin >> n >> q;
  for(int i = 0;i < n;i++){
    string x;
    int y;
    cin >> x >> y;
    queue_name.enqueue(x);
    queue_number.enqueue(y);
  }
  int counttime = 0;
  while(!(queue_name.isEmpty())){
    string w = queue_name.dequeue();
    int z = queue_number.dequeue();
    if(z <= q){
      counttime += z;
      cout << w << " " << counttime << endl;
    }else{
      counttime += q;
      queue_name.enqueue(w);
      queue_number.enqueue(z - q);
    }
  }
}



Measured memory_bytes: 7856
import java.util.*;
public class Main{
  public static void main(String[] args)
  {
    Scanner input = new Scanner(System.in);
    int n = input.nextInt();
    int g = 0;
    
    HashMap<Integer,Integer> map = new HashMap<>();
    
    for(int i=1;i<=n;i++)
    {
      if(n%i==0)
        map.put(i,n/i);
    }
    int h = -1;
    for(int p:map.keySet())
    {
      if(p<10&&map.get(p)<10){
        System.out.println("Yes");
        h=0;
        break;
      }
      else
        h = -1;
      
    }
    if(h==-1)
      System.out.println("No");
    
  }
}


Measured memory_bytes: 21844
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
// ascending order
#define asort(array, N) sort(array, array + N)
// descending order
#define asort_r(array, N) sort(array, array + N, greater<int>())
#define vunique(v) v.erase(unique(v.begin(), v.end()), v.end())
#define mp make_pair
#define ts(x) to_string(x)
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	int d[N];
	for(int i = 0; i < N; i++) cin >> d[i];
	int num[101];
	for(int i = 0; i <= 100; i++) num[i] = 0;
	for(int i = 0; i < N; i++) {
		num[d[i]]++;
	}
	int res = 0;
	for(int i = 1; i <= 100; i++) {
		if(num[i] > 0) {
			res++;
		}
	}
	cout << res << endl;

}


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

#define REP(i, n, N) for(ll i=(n); i<(N); i++)
#define RREP(i, n, N) for(ll i=(N-1); i>=n; i--)
#define CK(n, a, b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(),(v).end()
#define MCP(a, b) memcpy(b,a,sizeof(b))
#define p(s) cout<<(s)<<endl
#define p2(a, b) cout<<(a)<<" "<<(b)<<endl
#define v2(T) vector<vector<T>>
typedef long long ll;
using namespace std;
const ll mod = 1e9 + 7;
const ll inf = 1e18;

ll N, X;
ll P[55];
ll sum[55];
ll ans;
ll dfs(ll a, ll x){

    ll ret = 0;
    if(x<=a){
        return 0;
    }else if(x==1) ret=1;
    else{
        if(x==sum[a]){
            ret+=P[a];
        }
        else if(x==sum[a]/2+1){
            ret += 1 + P[a-1];
        }
        else if(x < sum[a]/2+1){
            ret += dfs(a-1, x-1);
        }else if(x > sum[a]/2){
            ret += dfs(a-1, x-P[a]) + P[a-1] + 1;
        }
    }
    return ret;
}
int main() {
    cin >> N >> X;
    P[0] = 1;
    sum[0]=1;
    REP(i,1,N+1){
        P[i] = 2*P[i-1]+1;
        sum[i] = 2*sum[i-1]+3;
    }
    int f=0;
    if(X==sum[N]){
        p(P[N]);
        return 0;
    }
    if(X==sum[N]/2+1){
        p(1 + P[N-1]);
        return 0;
    }
    else if(X>sum[N]/2){
        X -= P[N]-1;
        ans += P[N-1]+1;
    }
    ans += dfs(N-1, X-1);
    p(ans);
    return 0;
}


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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod =(1e9)+7;
using P = pair<ll,ll>;

int main(){
    ll n;cin >>n;
    vector<P>task;
    for (int i = 0; i < n; ++i) {
        ll a,b;cin >>a>>b;
        task.push_back({b,a});
    }
    sort(all(task));
    ll now=0;
    bool flg=true;
    for (int i = 0; i < n; ++i) {
        now+=task[i].second;
        if(now>task[i].first)flg=false;
    }
    if(flg)puts("Yes");
    else puts("No");
    return 0;
}



Measured memory_bytes: 6384
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (progn (ql:quickload '(:cl-debug-print :fiveam))
                 (shadow :run)
                 (use-package :fiveam)))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)

;; BEGIN_INSERTED_CONTENTS
(declaim (inline split-ints-into-vector))
(defun split-ints-into-vector (string dest-vector &key (offset 0) (key #'identity))
  (declare (string string)
           (function key)
           ((array * (*)) dest-vector)
           ((integer 0 #.most-positive-fixnum) offset))
  (loop with position = 0
        for idx from offset below (length dest-vector)
        do (setf (values (aref dest-vector idx) position)
                 (parse-integer string :start position :junk-allowed t))
           (setf (aref dest-vector idx) (funcall key (aref dest-vector idx)))
        finally (return dest-vector)))

(defmacro define-int-types (&rest bits)
  `(progn
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
(define-int-types 2 4 7 8 15 16 31 32 62 63 64)

(defmacro println (obj &optional (stream '*standard-output*))
  `(let ((*read-default-float-format* 'double-float))
     (prog1 (princ ,obj ,stream) (terpri ,stream))))

(defconstant +mod+ 1000000007)

;; Hauptteil

(defun main ()
  (declare #.OPT (inline sort))
  (let* ((n (read))
         (m (read))
         (xs (make-array m :element-type 'int32))
         (deltas (make-array (- m 1) :element-type 'uint32)))
    (declare (uint32 m n))
    (split-ints-into-vector (read-line) xs)
    (setf xs (sort xs #'<))
    (dotimes (i (- m 1))
      (setf (aref deltas i) (- (aref xs (+ i 1)) (aref xs i))))
    (setf deltas (sort deltas #'<))
    (println
     (loop for i below (max (- m n) 0)
           sum (aref deltas i) of-type fixnum))))

#-swank(main)


Measured memory_bytes: 39012
m = 10**9 + 7
n = int(input())
l = list(map(int, input().split()))

f = 1
d = 0
A = 0
 
for i in range(1, n):
  d = (d*i + f) % m
  A = (A*i + (l[i]-l[i-1])*d) % m
  f = f*i % m
 
print(A)

Measured memory_bytes: 14252
import java.util.*;

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

    public static void main(String[]$) {
        int n = scanner.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];

        long aSum = 0;
        for (int i = 0; i < n; i++) {
            aSum += a[i] = scanner.nextInt();
        }
        long bSum = 0;
        long r = 0;
        int count = 0;
        for (int i = 0; i < n; i++) {
            b[i] = scanner.nextInt();
            bSum += b[i];

            if (a[i] < b[i]) {
                count++;
                r += b[i] - a[i];
            }
            a[i] = Math.max(0, a[i] - b[i]);
        }

        if (aSum < bSum) {
            System.out.println(-1);
        } else {
            Arrays.sort(a);
            for (int i = n - 1; i >= 0 && a[i] != 0; i--) {
                if (r <= 0) {
                    break;
                }
                count++;
                r -= a[i];
            }
            System.out.println(count);
        }
    }
}

Measured memory_bytes: 67224
#include <iostream>
using namespace std;
int main() {
	int N = 0;
	int T = 0;
	long long SUM = 0;
	cin >> N >> T;
	int previous = 0; 
	int now = 0;
	int load = T;
	for (int i = 0; i < N; i++) {
		cin >> now;
		if (load - now <= 0) {
			SUM += T;
			load = now + T;
		}
		else {
			SUM += now - previous;
			load = now + T;
		}
		previous = now;
	}
	SUM += T;
	cout << SUM << endl;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b,ans;
  cin >> a >> b;
  int ansA=a+b,ansB=a-b,ansC=a*b;
  if(ansA>=ansB && ansA>=ansC) ans=ansA;
  else if(ansB>=ansA && ansB>=ansC) ans=ansB;
  else ans=ansC;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<cstdio>
const int N=100002;
int n,a[N],i,x=1<<30,y=0,l,r,s;
int max(int x,int y){
	return x>y?x:y;
}
int min(int x,int y){
	return x<y?x:y;
}
int main(){
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		scanf("%d",a+i);
		x=min(x,a[i]);
		y=max(y,a[i]);
	}
	if(y-x>1){
		printf("No");
		return 0;
	}
	if(x==y){
		l=1;r=n/2;
		if(l<=x&&x<=r||x==n-1)
			printf("Yes");
		else
			printf("No");
		return 0;
	}
	for(i=1;i<=n;i++)
		if(a[i]==x)
			s++;
	if(s==n-1){
		printf("No");
		return 0;
	}
	l=s+1;
	r=s+(n-s)/2;
	if(l<=y&&y<=r)
		printf("Yes");
	else
		printf("No");
}
	

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const int limit = 300001
;
int main(){
	vector<bool> isprime(limit+1, true);
	isprime[0] = isprime[1] = false;
	for(int i=0; i<=limit; i++){
		if(!(i%7==1 || i%7==6)){
			isprime[i] = false;
		}
	}
	for(int i=0; i*i<=limit; i++){
		if(!isprime[i]) continue;
		for(int j=2*i; j<=limit; j+=i){
			isprime[j] = false;
		}
	}

	while(1){
		int n;
		cin >> n;
		if(n == 1) break;

		cout << n << ":";
		for(int i=0; i<=limit; i++){
			if(isprime[i] && n%i==0){
				cout << " " << i;
			}
		}
		cout << endl;
	}
	return 0;
}


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

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

  const int NMAX = 50;
  int A[NMAX], B[NMAX];

  for (int i = 0; i < M; i++) {
    cin >> A[i] >> B[i];
  }

  int road[NMAX] = {0};

  for (int i = 0; i < M; i++) {
    road[A[i] - 1]++;
    road[B[i] - 1]++;
  }

  for (int i = 0; i < N; i++) {
    cout << road[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include <stdlib.h>
void qsort(
  void *base, size_t num, size_t size,
  int (*compare)(const void *a, const void *b)
);
int asc(const void *a, const void *b) {
  return *(int *)a - *(int *)b;
}

int main(void){
  int n;
  scanf("%d",&n);
  int v[n];
  for(int i=0;i<n;i++){
    scanf("%d",&v[i]);
  }
  qsort(v, sizeof(v) / sizeof(int), sizeof(int), asc);
  for(int i=0;i<n-1;i++){
    if(v[i]==v[i+1]){
      printf("NO");
      return 0;
    }
  }
  printf("YES");
  return 0;
}


Measured memory_bytes: 1788
#include<stdio.h>
int main()
{
    int A,B;
    char c;
    scanf("%d %c %d",&A,&c,&B);

    if(c == '+')
    {
        printf("%d\n",(A+B));
    }

    else
    {
        printf("%d\n",(A-B));
    }
}



Measured memory_bytes: 128
#import sys
#import numpy as np
import math
#import itertools
#from fractions import Fraction
#import itertools
from collections import deque
from collections import Counter
#import heapq
#from fractions  import gcd
#input=sys.stdin.readline
#import bisect
n=int(input())
l=[chr(i) for i in range(97, 97+26)]
n-=1
i=1
res=0
ans=[]
while True:
    if n>=pow(26,i)+res:
        res+=pow(26,i)
        i+=1
    else:
        keta=i
        n-=res
        break
ans=""
for i in range(keta):
  r=n%pow(26,keta-i-1)
  s=n//pow(26,keta-i-1)
  ans+=l[s]
  n=r
print(ans)

Measured memory_bytes: 9480
#include<stdio.h> 

int main(void){
	int a,b,c,d,e;
	int n,m;
	int fl[103],fll[103];
	while(1){
		for(a=0;a<100;a++){
			fl[a]=0;
			fll[a]=0;
		}
		scanf("%d %d",&n,&m);
		if(n==0 && m==0)break;
		for(a=0;a<m;a++){
			fl[a]=0;
			fll[a]=a;
		}
		for(a=0;a<n;a++){
			for(b=0;b<m;b++){
				scanf("%d",&c);
				fl[b]+=c;
			}
		}
		for(a=0;a<m-1;a++){
			for(b=a;b<m;b++){
				if(fl[b]>fl[a]){
					d=fl[b];
					fl[b]=fl[a];
					fl[a]=d;
					e=fll[b];
					fll[b]=fll[a];
					fll[a]=e;
				}
			}
		}
		for(a=0;a<m-1;a++){
			for(b=a;b<m;b++){
				if(fl[b]==fl[a] && fll[a]>fll[b]){
					d=fl[b];
					fl[b]=fl[a];
					fl[a]=d;
					e=fll[b];
					fll[b]=fll[a];
					fll[a]=e;
				}
			}
		}
		
		
		for(a=0;a<m;a++){
			printf("%d", fll[a]+1);
			if(a!=m-1)printf(" ");
		}		
		printf("\n");
	}
	return 0;	
}

Measured memory_bytes: 0
#include <iostream>

using namespace std;
typedef long long ll;
#define REP(i,n) for (ll i = 0; i < (n); ++i)

int main(){
    ll a, b, c;
    cin >> a >> b >> c;
    ll ans = c % 2 * a * b;
    ans = min(ans, a % 2 * b * c);
    ans = min(ans, b % 2 * a * c);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
#include<iomanip>
using namespace std;
#define rep(i,a,n) for(llint i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<a>>
#define UF  UnionFind 
#define Pint pair<int,int>
#define Pll pair<llint,llint>
#define keta(a)  fixed << setprecision(a)
const ll mod = 1000000007;
//辞書順はnext_permutation( begin( v ), end( v ) );やで！
const ll INF = 1000000000;

long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

// mod. m での a の逆元 a^{-1} を計算するよ！
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}


//aCbをmod.mで割った余りを求める
llint C(llint n, llint r, llint m) {
	llint ans = 1;
	for (llint i = 0; i < r; i++) {
		ans *= n - i;
		ans %= m;
	}
	for (llint i = 1; i <= r; i++) {
		ans *= modinv(i, m);
		ans %= m;
	}
	return ans;
}


int main() {
	int n;
	cin >> n;
	vector<queue<int>> que(n);
	whei(int) a(n, hei(int)(n - 1));
	rep(i, 0, n) {
		rep(j, 0, n - 1) {
			cin >> a[i][j];
			a[i][j]--;
			que[i].push(a[i][j]);
		}
	}
	bool x = true;
	int ans = 0;
	while (x) {
		ans++;
		hei(bool) y(n, false);
		x = false;
		rep(i, 0, n) {
			if (que[i].empty()||y[i])continue;
			int v = que[i].front();
			if (!y[v]&&i==que[v].front()) {
				que[i].pop();
				que[v].pop();
				y[i] = true;
				y[v] = true;
				x = true;
			}
		}
		if (x==false) {
			rep(i, 0, n) {
				if (!que[i].empty()) {
					cout << -1 << endl;
					return 0;
				}
			}
		}
	}
	ans--;
	cout << ans << endl;
    return 0;
}

Measured memory_bytes: 11956
#include <bits/stdc++.h>
#define db(x) cout << (x) << '\n';
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pii;
typedef pair<double,ll> pdi;
typedef pair<string,ll> psi;
typedef pair<ll,string> pls;
typedef pair<string,string> pss;
typedef pair<ll,pii> pip;
typedef pair<pii,pii> ppp;

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

    ll x;
    cin >> x;
    int res=0;
    ll a=100;
    while(a<x)
    {
        res++;
        a+=(a/100);
    }
    db(res)

    return 0;
}


Measured memory_bytes: 3648
#include<iostream>
#include <algorithm>
using namespace std;
int a[6],b[4];
int cnt;
int main(){
	for(int i=0;i<6;i++) cin>>a[i];
	for(int i=0;i<4;i++){
		cnt=0;
	    for(int j=0;j<6;j++){
		    if(a[j]==i+1) cnt++;	
	    }
	    b[i]=cnt;
	}
	sort(b,b+4);
	if(b[0]==1&&b[1]==1&&b[2]==2&&b[3]==2) cout<<"YES\n";
	else cout<<"NO\n";
		return 0;
}


Measured memory_bytes: 384
import java.util.*;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int D = sc.nextInt();
		int G = sc.nextInt();
		int p[] = new int[D];
		int c[] = new int[D];
		for(int i = 0; i < D; i++) {
			p[i] = sc.nextInt();
			c[i] = sc.nextInt();
		}
		
		int ans = Integer.MAX_VALUE;
		out : for (int i = 0; i < (Math.pow(2, D)); i++) {
			int cnt = 0;
			int point = 0;
			boolean flag[] = new boolean[D];
			Arrays.fill(flag, false);
			for (int j = 0; j < D; j++) {
				if ((1&i>>j) == 1) {
					cnt += p[j];
					point = point + p[j] * (j + 1) * 100 + c[j];
					flag[j] = true;
				}
			}
			if(point >= G) {
				ans = Math.min(ans, cnt); 
			} else {
				in : for(int j = D - 1; j >= 0; j--) {
					if(!flag[j]) {
						for(int k = 0; k < p[j] - 1; k++) {
							cnt++;
							point = point + (j + 1) * 100;
							if(point >= G) {
								break in;
							}
						}
						continue out;
					}
				}
			ans = Math.min(ans, cnt);
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 23124
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	N := ReadString()
	ok := true
	for i := 1; i < len(N); i++ {
		if N[i] != '9' {
			ok = false
			break
		}
	}

	if ok {
		ans := 0
		for i := 0; i < len(N); i++ {
			ans += int(N[i] - '0')
		}
		fmt.Println(ans)
		return
	}

	if N[0] == '1' {
		fmt.Println((len(N) - 1) * 9)
		return
	}

	ans := int(N[0]-'0') - 1
	ans += (len(N) - 1) * 9
	fmt.Println(ans)
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


Measured memory_bytes: 1840
#include<cstdio>
#include<iostream>
using namespace std;
int main()
{
    int m,d,sum=0;
    scanf("%d%d",&m,&d);
    for(int i=4;i<=m;i++)
    {
        for(int j=22;j<=d;j++)
        {
            if((j%10>=2)&&(j/10>=2)&&((j%10)*(j/10)==i)) sum++;
        }
    }
    printf("%d\n",sum);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 200005
using namespace std;
int n;
struct node{
	int a,b;
	bool operator<(const node &_)const{return b<_.b;}
}A[N];
void solve(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d %d",&A[i].a,&A[i].b);
	}
	sort(A+1,A+n+1);
	int k=0;
	for(int i=1;i<=n;i++){
		k+=A[i].a;
		if(A[i].b<k){
			puts("No");
			return;
		}
	}puts("Yes");
}
int main(){
	solve();
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vs vector<string>
#define vc vector<char>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class T> inline bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    vi v(n);
    rep(i,n) v[i] = i;
    vector<pair<double,double>> town(n);
    rep(i,n) cin >> town[i].first >> town[i].second;
    double sum = 0;
    int cnt = 0;
    do {
        double now = 0;
        rep(i,n-1) {
            now += sqrt(pow(town[v[i]].first-town[v[i+1]].first,2.0)+pow(town[v[i]].second-town[v[i+1]].second,2.0));
        }
        sum += now;
        cnt++;
    } while(next_permutation(all(v)));
    sum /= cnt;
    printf("%.8f",sum);
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rrep(i, n) for(int i = n-1; i >= 0; --i)
#define fi first
#define se second
using namespace std;
using lint = long long;
using uint = unsigned int;
using ulint = unsigned long long;
using ldouble = long double;
using pii = pair<int, int>;
using pli = pair<lint, lint>;
using pdd = pair<double, double>;
using pld = pair<ldouble, ldouble>;
using v1i = vector<int>;
using v1li = vector<lint>;
using v2i = vector<vector<int>>;
using v2li = vector<vector<lint>>;
using v3i = vector<vector<vector<int>>>;
using v3li = vector<vector<vector<lint>>>;
using v1b = vector<bool>;
using v2b = vector<vector<bool>>;
using v3b = vector<vector<vector<bool>>>;
using v1c = vector<char>;
using v2c = vector<vector<char>>;
using v3c = vector<vector<vector<char>>>;
constexpr lint mod1 = 1e9+7;
constexpr lint mod2 = 998244353;

int main(){
  int n; cin >> n;
  bool b = 0;
  v1li v(n+1), u(n+1, 1); rep(i, n+1) cin >> v[i];
  lint a = 0, tmp = 0, tt = 0;
  rep(i, n+1){
    if(u[i] < v[i]){
      b = 1; break;
    }
    if(i < n){
      u[i+1] = (u[i] - v[i])*2;
      if(u[i+1] > 1e15) u[i+1] = 1e15;
    }
  }
  rrep(i, n+1){
    tt += v[i];
    tmp = min(tt, u[i]);
    a += tmp;
    tt = tmp;
  }
  if(n == 0) a = v[0];
  if(b) a = -1;
  cout << a << "\n";
  return 0;
}


Measured memory_bytes: 4848
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int a[100001] = {0};
int main()
{
	int x,q, k, n;
	scanf("%d%d%d",&n,&k,&q);
	for (int i = 0; i < q; i++)
	{
		scanf("%d",&x);
		a[x]++;
	}
	for (int i = 1; i <= n; i++)
	{
		if (a[i] + k - q > 0)
			printf("Yes\n");
		else
			printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 1024
stepableodd = True
stepableeven = True
step = input()
for i in range(1,len(step)+1):
    if i % 2 == 1:
        if step[i-1] == "R" or step[i-1] == "D" or step[i-1] == "U":
            if stepableodd == False:
                stepableodd = False
        else:
            stepableodd = False
    elif i % 2 == 0:
        if step[i-1] == "L" or step[i-1] == "D" or step[i-1] == "U":
            if stepableeven == False:
                stepableeven = False
        else:
            stepableeven = False
if stepableodd == True and stepableeven == True:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
def writeanderase(n , a):

    ans = {}
    count = 0

    for i in range(n):
        if a[i] in ans:
            ans[a[i]] += 1
        else:
            ans[a[i]] = 1

    for i in ans.values():
        count += i % 2

    return count

def main():
    n = int(input())
    a = [int(input()) for i in range(n)]
    print(writeanderase(n , a))

if __name__ == '__main__':
    main()

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    cin >> N;
    vector<vector<int>> G(N, vector<int> (3));
    for(int i=0; i<N; i++){
        for(int j=0; j<3; j++){
            cin >> G[i][j];
        }
    }
    vector<int> ans(N,0);
    for(int i=0; i<3; i++){
        map<int,int> mp;
        for(int j=0; j<N; j++){
            mp[G[j][i]]++;
        }
        for(int j=0; j<N; j++){
            if(mp[G[j][i]] == 1){
                ans[j] += G[j][i];
            }
        }
    }
    for(int i=0; i<N; i++){
        cout << ans[i] << "\n";
    }
    return 0;

}


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

int main() {
    string str;
    cin >> str;
    if (str[str.length() - 1] == 's') {
        str.append("es");
    } else {
        str.append("s");
    }
    cout << str << endl;
    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main() {
    ios::sync_with_stdio(false);cin.tie(0);
    int n,k;
    cin>>n;
    k=2;
    vector<int> dp(n),h(n);
    for(int i=0;i<n;i++)
    {
        cin>>h[i];
        if(i)
            dp[i] = dp[i-1]+abs(h[i]-h[i-1]);
        for(int j=i-1;j>=i-k&&j>=0;j--)
        {
            dp[i] = min(dp[i],dp[j]+abs(h[i]-h[j]));
        }
    }
    cout<<dp[n-1];
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+10;
vector<int>a[110];
pair<int,int>ans[maxn];
int main(){
    int n,cnt=0,res=1,tot=0;
    scanf("%d",&n);
    if(n&1){
        res=0;
        a[++cnt].push_back(n);
    }
    for(int i=1;i<=n/2;i++){
        a[++cnt].push_back(i);
        a[cnt].push_back(n-i+res);
    }
    for(int i=1;i<cnt;i++){
        for(int j=0;j<a[i].size();j++){
            int u=a[i][j];
            for(int k=0;k<a[i+1].size();k++){
                int v=a[i+1][k];
                ans[++tot]=make_pair(u,v);
            }
        }
    }
    if(cnt>2){
        for(int i=0;i<a[1].size();i++){
            int u=a[1][i];
            for(int j=0;j<a[cnt].size();j++){
                int v=a[cnt][j];
                ans[++tot]=make_pair(u,v);
            }
        }
    }
    printf("%d\n",tot);
    for(int i=1;i<=tot;i++) printf("%d %d\n",ans[i].first,ans[i].second);
    return 0;
}

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

int64_t gcd(int a, int b)
{
  if (a < b)
    return gcd(b, a);

  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}

int main()
{
  int n;
  int64_t x, ans;
  cin >> n >> x;
  vector<int64_t> X(n+1), sub(n);
  for (int i = 0; i < n; ++i) cin >> X[i];
  X[n] = x;
  sort(X.begin(), X.end());

  for (int i = 0; i < n; ++i) sub[i] = X[i+1] - X[i];
  ans = sub[0];
  for (int i = 0; i < n-1; ++i)
    ans = min(ans, gcd(sub[i], sub[i+1]));
  cout << ans << "\n";
}

Measured memory_bytes: 1792
'use strict'

function main(arg) {
    let N = String(arg).split("").map(n=>parseInt(n));
    let answer;


    if( N[1] <= N[0] && N[2] <= N[0] ) {
        answer = String(N[0]) + String(N[0]) + String(N[0]);
        console.log(answer);
    } else {
        answer =  String(N[0]+1) + String(N[0]+1) + String(N[0]+1);
        console.log(answer);
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

ll P[100005];
ll Q[100005];

int main()
{
    int W, H;
    cin >> W >> H;
    REP(i, W)
    {
        cin >> P[i];
    }
    REP(i, H)
    {
        cin >> Q[i];
    }
    sort(P, P + W);
    P[W] = INF;
    sort(Q, Q + H);
    Q[H] = INF;
    int pi = 0, qi = 0;
    ll sum = 0;
    ll w = W, h = H;
    while (pi < w || qi < h)
    {
        ll p = P[pi], q = Q[qi];
        if (p < q)
        {
            W--;
            pi++;
            sum += p * (H + 1);
        }
        else
        {
            H--;
            qi++;
            sum += q * (W + 1);
        }
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<long,long>
#define INF 1000000000000000000
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 MOD = 1000000007;
using namespace std;
typedef long long ll;
map<int, int> mp;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
class Union_Find {
private:
	vector<int> par;
	vector<int> rank;
public:
	Union_Find(int n) {
		rep(i, n) {
			par.push_back(i);
			rank.push_back(0);
		}
	}
	int find(int x) {
		if (par.at(x) == x) return x;
		else return par.at(x) = find(par.at(x));
	}
	void unite(int x, int y) {
		x = find(x);
		y = find(y);
		if (x == y) return;
		if (rank.at(x) < rank.at(y)) {
			par.at(x) = y;
		}
		else {
			par.at(y) = x;
			if (rank.at(x) == rank.at(y)) rank.at(x)++;
		}
	}
	bool same(int x, int y) {
		return find(x) == find(y);
	}
};

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	vector<int> a(n), b(n), sum(n);
	for (int i = 0; i < n; i++) { cin >> a[i]; }
	rep(i, n) cin >> b[i];
	rep(i, n) sum[i] = a[i] + b[i];
	int ans2 = 0;
	for (int i = 0; i < n; i++) {
		int ans = 0;
		// 各行について判定
		for (int j = 0; j < n; j++) {
			if (j < i) {
				ans += a[j];
			}
			else if (j > i) {
				ans += b[j];
			}
			else {
				ans += sum[j];
			}
		}
		ans2 = max(ans, ans2);
	}
	cout << ans2 << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <cmath>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>

typedef  long long ll;
#define mop 1000000007
using namespace std;

struct pro{
    ll s,t,c;

};
vector <pro> vpre, lis;

bool asc_ct( const pro& left, const pro& right ) {
    return left.c == right.c ? left.t < right.t : left.c < right.c;
}

bool asc_ts( const pro& left, const pro& right ) {
    return left.t == right.t ? left.s < right.t : left.t < right.t;
}

int main() {
    

    ll n,c;
    cin >> n >> c;
    for (ll i=0;i<n;i++){
        pro p;
        cin >> p.s >> p.t >> p.c;
        vpre.push_back(p);
    }
    sort(vpre.begin(), vpre.end(), asc_ct);

    ll pres, pret, prec;
    for(ll i=0;i<n;i++){
        pres = vpre[i].s;
        pret = vpre[i].t;
        prec = vpre[i].c;
        while(i != n-1 and vpre[i].c == vpre[i+1].c and vpre[i].t == vpre[i+1].s){
            pret = vpre[i+1].t;
            i++;
        }
//        cout << i << " " << pres << " " << pret << " " << prec << endl;
        pro p;
        p.s = pres;
        p.t = pret;
        p.c = prec;
        lis.push_back(p);
    }
    sort(lis.begin(), lis.end(), asc_ts);

//    for (ll i=0;i<lis.size();i++){
//        cout << lis[i].s << " " << lis[i].t << " " << lis[i].c << endl;
//    }
    ll ans = 0;
    ll sumlis[100002] = {};
    for (ll i=0;i<lis.size();i++){
        sumlis[lis[i].s]++;
        sumlis[lis[i].t+1]--;
    }
    ll now = 0;
    for (ll i=0;i<100002;i++){
        now += sumlis[i];
        sumlis[i] = now;
        if(ans < now){
            ans = now;
        }
    }
    cout << ans << endl;

}

Measured memory_bytes: 8560
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()




int main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    a-=c; b-=d;
    cout<<a*b<<endl;
}

Measured memory_bytes: 256
using System;
using System.Text;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using E = System.Linq.Enumerable;
using System.IO.Pipes;
using System.Threading;

class Program
{
    static char[] abc = "abcdefghijklmnopqrstuvwxyz".ToCharArray();
    static long mod = 1000000007;
    static void Main(string[] args)
    {
        //var S = Console.ReadLine();
        //var N = long.Parse(Console.ReadLine());
        //var N = long.Parse(Console.ReadLine());
        var HW = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
        var N = HW[0];
        var M = HW[1];

        var exist = new bool[N + 1];
        var balls = new long[N + 1];

        for (int i = 1; i <= N; i++)
        {
            balls[i] = 1;
            
        }
        exist[1] = true;

        for (int i = 0; i < M; i++)
        {
            var XY = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
            var X = XY[0];
            var Y = XY[1];

            if (exist[X])
            {
                exist[Y] = true;
            }

            balls[Y]++;
            balls[X]--;

            if(balls[X] == 0)
            {
                exist[X] = false;
            }
        }

        long ans = 0;
        for (int i = 1; i <= N; i++)
        {
            if (exist[(int)i])
            {
                ans++;
            }
        }

        Console.WriteLine(ans);

    }

}

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

using namespace std;

vector <int> g[10];

int visited[10];
int n, ans = 0;

void dfs(int u) {
	visited[u] = 1;
	bool todo = true;
	for (int i = 0; i < n; ++i) {
		if (visited[i] == 0) {
			todo = false;
			break;
		}
	}
	if (todo) {
		ans++;
		visited[u] = 0;
		return;
	}
	for (int i = 0; i < g[u].size(); i++) {
		int v = g[u][i];
		if (visited[v] == 0) {
			dfs(v);	
		}	
	}
	visited[u] = 0;
}

int main() {
	for (int i = 0; i < 10; i++) {
		visited[i] = 0;
		g[i].clear();
	}	
	int m;
	scanf("%d %d", &n, &m);
	for (int i = 0; i < m; i++) {
		int x, y;
		scanf("%d %d", &x, &y);
		g[x - 1].push_back(y - 1);
		g[y - 1].push_back(x - 1);
	}
	dfs(0);
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
using namespace std;
string str[1005];
int main(){
	int n;
	scanf("%d%*d",&n);
	for(int i=1;i<=n;i++){
		cin>>str[i];
	}
	sort(str+1,str+n+1);
	for(int i=1;i<=n;i++){
		cout<<str[i];
	}
	cout<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<bitset>
#include<vector>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<iomanip>
#include <functional>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const int INF = 1 << 30;
const double EPS = 1e-10;
//cout << fixed << std::setprecision(9)
//memset(a, 0, sizeof(a));
//--------------------------

int a, b, c, d;

int main()
{
	cin >> a >> b >> c >> d;
	cout << min(a, b) + min(c, d) << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
# define N 20
#define endl "\n"
#define IO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);


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

    cin>>a>>b;
    cout<<a*b<<endl;

}




Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define pb push_back
int n;
vector<int>vec;
int main(){
	cin>>n;
	for(int i=1;i<=1000;i++){
		for(int j=1;j<=10;j++){
			int mx = 19;
			if(j%2 == 1 || i%3 == 0) mx = 20;
			for(int k=1;k<=mx;k++){
				vec.pb(i*2000000+j*1000+k);
			}
		}
	}
	
	while(n--){
		int y,m,d; cin>>y>>m>>d;
		int a = y*2000000+m*1000+d;
		int b = 1000 * 2000000 + 1001;
		cout << lower_bound(vec.begin(),vec.end(),b)-lower_bound(vec.begin(),vec.end(),a) << endl;
	}
}
		



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


int main() {
	double n, r, a, b, c, d, e, f;
	while(1){
	cin >> a >> b >> c;
	if(a == 0 && b == 0 && c == 0) break;
	a *= a; b *= b; c *= c;
	d = sqrt(b + c) / 2;
	e = sqrt(a + c) / 2;
	f = sqrt(a + b) / 2;
        cin >> n;
	for(int i = 0;i < n;++i){
		cin >> r;
		if(d < r || e < r || f < r) cout << "OK" << endl;
		else cout << "NA" << endl;
	    }
	}
	return 0;
}

Measured memory_bytes: 1216
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
using namespace std;
using llong = long long;

llong n;
llong a, b;
llong mina, minb;

int main() {

    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a >> b;

        if (mina < a) {
            mina = a;
            minb = b;
        }
    }

    cout << mina + minb << endl;

    return 0;
}


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

#define ll long long
const int MOD = 1e9 + 7;
int main() {
	ll n,m;
	cin >> n >> m;
	if (2*n > m) cout << m/2 << '\n';
	else cout << n+(m-n*2)/4 << '\n';
	return 0;
}


Measured memory_bytes: 3640
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int dp[301][301];
int maxn, maxm, maxlen;
string str;

void lcs(int n, int m, bool rest = true) {
    for (int i = 0; i < n; i++) fill(dp[i], dp[i]+m+1, 0);
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (str[i] == str[n+j]) {
                dp[i+1][j+1] = dp[i][j]+1;
            }
            else {
                dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j]);
            }
        }
    }
    if (rest && dp[n][m] > maxlen) {
        maxlen = dp[n][m];
        maxn = n, maxm = m;
    }
}

void getSubseq() {
    char seq[maxlen+1];
    seq[maxlen] = '\0';
    string x = str.substr(0, maxn);
    string y = str.substr(maxn);
    lcs(maxn, maxm, false);
    int i = maxn, j = maxm;
    int index = maxlen;

    while (i > 0 && j > 0) {
        if (x[i-1] == y[j-1]) {
            seq[index-1] = x[i-1];
            i--; j--; index--;
        }
        else if (dp[i-1][j] > dp[i][j-1]) i--;
        else j--;
    }
    cout << seq << endl;
}



int main()
{
    for (; ;) {
        cin >> str;
        if (str == "#END") break;
        maxlen = 0;
        int size = str.size();
        for (int i = 1; i < str.size(); i++) {
            lcs(i, size-i);
        }
        getSubseq();
    }
    return 0;
}



Measured memory_bytes: 3456
H, W = map(int, input().split())
G = [list(map(int, input().split())) for i in range(H)]

N = 0
ans = []
for h in range(H):
    for w in range(W - 1):
        if G[h][w] % 2 == 1:
            N += 1
            ans.append((h, w, h, w + 1))
            G[h][w + 1] += 1
            G[h][w] -= 1

for h in range(H - 1):
    if G[h][W - 1] % 2 == 1:
        N += 1
        ans.append((h, W - 1, h + 1, W - 1))
        G[h + 1][W - 1] += 1
        G[h][W - 1] -= 1

print(N)
for y1, x1, y2, x2 in ans:
    print(y1 + 1, x1 + 1, y2 + 1, x2 + 1)


Measured memory_bytes: 22824
import sys
input = sys.stdin.readline

h, w, d = [int(x) for x in input().split()]
n = h*w
a = [[int(x) for x in input().split()] for _ in range(h)]
q = int(input())
lr = [[int(x) for x in input().split()] for _ in range(q)]

from collections import defaultdict
b = defaultdict(list)
for i in range(h):
    for j in range(w):
        b[a[i][j] - 1] = [i, j]
dist = [float('inf')]*n
for i in range(d):
    dist[i] = 0
    while i + d < n:
        x1, y1 = b[i]
        x2, y2 = b[i + d]
        dist[i + d] = dist[i] + abs(x1 - x2) + abs(y1 - y2)
        i += d
for i in range(q):
    l, r = lr[i]
    l -= 1
    r -= 1
    print(dist[r] - dist[l])

Measured memory_bytes: 84572
// Gaurav Nuti
 
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii > vii;
typedef vector<pll > vll;
#define pb push_back
#define mp make_pair 
#define ar array
#define mod 1000000007
#define F first
#define S second
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define For(i, a, b) for(__typeof (a) i=a; i<=b; i++)
#define inp_arr(a,n) for(__typeof (n) i=0; i<n; ++i) {cin>>a[i];}
#define debug_arr(a,n) {{for(__typeof (n) i=0; i<n; ++i) {cout<<a[i]<<" ";}cout<<"\n";}}
#define INF 1e9 

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

ll power_without_mod(ll x, ll y) 
{ 
    ll res = 1;   
    while (y > 0) { 
        if (y & 1) 
            res = (res*x); 
        y = y>>1;
        x = (x*x); 
    } 
    return res; 
}

bool comparep(pair<ll, ll> i1, pair<ll, ll> i2){
	return (i1.S < i2.S);
} 

ll modInverse(ll a)
{
    return power(a , mod - 2);
}

vector<vector<ll>> graph;
vector<bool> visited;
vector<ll> dist;
map<ll,ll> mymap;
ll max_dist = 1;

void bfs(int u1){
    visited[u1] = 1;
    dist[u1] = 1;
    mymap[1] = u1;
    queue<ll> q;
    q.push({u1});
    while(!q.empty()){
        ll u = q.front();
        q.pop();
        for(auto i=graph[u].begin();i!=graph[u].end();i++){
            if(!visited[*i]){
                dist[*i] = dist[u] + 1;
                visited[*i] = 1;
                max_dist = max(dist[*i],max_dist);
                mymap[dist[*i]] = *i;
                q.push({*i});
            }
        }
    }
}

// int next_lunlun(ll n){
//     vector<int> digits;
//     while(n){
//         digits.pb(n%10);
//         n /= 10;
//     }
//     // reverse(digits.begin(),digits.end());
//     ll num_digits = digits.size(); 
//     int count_9 = 0;
//     for(int i: digits)
//         if(i == 9)
//             count_9++;
//     if(count_9 == num_digits)
//         return ;
//     for(int i=0;i<(num_digits-1);i++){
//         if(digits)
//     }
// }

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
 
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout); 
    #endif  
	
    ll t;
    // cin>>t;
    t = 1;
    for(ll z=0;z<t;z++){
        ll n,k;
        cin>>n>>k;
        ll h[n];
        inp_arr(h,n);
        ll dp[n] = {0};
        for(ll i=1;i<n;i++){
            dp[i] = 1e18;
            for(ll j = 1;(i-j)>=0 && j <= k;j++){
                dp[i] = min(dp[i-j] + abs(h[i] - h[i-j]),dp[i]);
            }
        }
        cout<<dp[n-1];
    }
}

Measured memory_bytes: 5168
#include <bits/stdc++.h>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)

using namespace std;
string S;
bool V;

bool capital(string S){
	bool v = false;
	for(int i = 2; i < S.length() - 1; i++)
		if(!v && S[i] == 'C') v = true;
		else if(S[i] == 'C') return false;
	return v;
}

bool found(string S){
	int s = 0;
	for(int i = 0; i < S.length(); i++)
		if(S[i] - 'A' > -1 && S[i] - 'A' < 26) s++;
	return (s < 3);
}

int main(void){
	//IO("test.in", "test.out");
	V = true;
	cin >> S;
	if(S[0] != 'A') V = false;
	else if(!capital(S)) V = false;
	else if(!found(S)) V = false;
	if(V) printf("AC\n");
	else printf("WA\n");
}

Measured memory_bytes: 256
n, m = map(int, input().split())
ac = []
for _ in range(m):
    a,_ = map(int, input().split())
    c = sum([2**(int(i)-1) for i in input().split()])
    ac.append([a, c])
dp = [float('inf')] * 2**n
dp[0] = 0
for s in range(2**n):
    for a, c in ac:
        t = s|c
        cost = dp[s] + a
        dp[t] = min(dp[t], cost)
ans = dp[-1]
if ans == float('inf'):
    ans = -1
print(ans)


Measured memory_bytes: 45016
import re
s = list(input())
n = len(s)

cnt = 0
a_cnt = 0
i = 0

while True:
  if i >= n-1:
    break
  if s[i] == 'A':
    a_cnt += 1
    i += 1
  elif s[i] == 'B':
    if s[i+1] == 'C':
      cnt += a_cnt
      i += 2
    else:
      a_cnt = 0
      i += 1
  elif s[i] == 'C':
    a_cnt = 0
    i += 1

print(cnt)


Measured memory_bytes: 5096