akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}
ll nextLong() { ll x; scanf("%lld", &x); return x;}

int main2() {
  int N = nextInt();
  int K = nextInt();
  int C = nextInt();
  string S; cin >> S;

  vector<int> left(N + 1);
  vector<int> right(N + 1);

  {
    int last = -C-1;
    for (int i = 1; i <= N; i++) {
      left[i] = left[i-1];
      if (S[i-1] == 'o' && last + C < i) {
        left[i]++;
        last = i;
      }
    }
  }
  {
    int last = N + C + 1;
    for (int i = N-1; i >= 0; i--) {
      right[i] = right[i+1];
      if (S[i] == 'o' && last - C > i) {
        right[i]++;
        last = i;
      }
    }
  }
  // cout << S << endl;
  // pv(ALL(left));
  // pv(ALL(right));

  REP(i, N) if (S[i] == 'o') {
    bool need = left[i] + right[i+1] < K;
    if (need)
      printf("%d\n", i + 1);
  }
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}

Measured memory_bytes: 3332
#include <bits/stdc++.h>
using namespace std;
double dp[3000][3000];

int main()
{
    int n;
    cin>>n;
    double a[n+1],b[n+1],ans=0;
    for(int i=1; i<=n; i++)
        cin>>a[i];
    b[1]=1-a[1];
    for(int i=2; i<=n; i++)
        b[i]=b[i-1]*(1-a[i]);
    memset(dp,0,sizeof(0));
    dp[1][1]=a[1];
    for(int i=2; i<=n; i++)
        dp[i][1]=dp[i-1][1]*(1-a[i]) + b[i-1]*a[i];
    for(int i=2; i<=n; i++)
        for(int j=2; j<=i; j++)
            dp[i][j]=dp[i-1][j-1]*a[i]+dp[i-1][j]*(1-a[i]);
    for(int i=n/2 + 1; i<=n; i++)
        ans+=dp[n][i];
    cout<<fixed;
    cout<<setprecision(10)<<ans<<endl;
    return 0;
}


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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

int N;
std::vector<int> A, sortedA, B;

int main(){
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);

  std::cin >> N;

  A.resize(N);

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

  std::copy(A.begin(), A.end(), std::back_inserter(sortedA));
  std::sort(sortedA.begin(), sortedA.end());

  for(int i=0;i<N;i+=2){
      B.emplace_back(sortedA[i]);
  }
  
  int res = 0;

  for(int i=0;i<N;i+=2){
      unless(std::binary_search(B.begin(), B.end(), A[i])){
          res += 1;
      }
  }

  std::cout << res << std::endl;
}


Measured memory_bytes: 1528
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
const ll MOD=998244353;

int main(){
  int N; cin >> N; string S; cin >> S;
  int cnt[6] = {}; ll ans = 1;
  rep(i, 3*N){
    if(S[i]=='B'){
      if(cnt[5]){
        ans*=cnt[5]; ans%=MOD; cnt[5]--;
      }
      else if(cnt[1]){
        ans*=cnt[1]; ans%=MOD; cnt[1]--; cnt[3]++;
      }
      else if(cnt[2]){
        ans*=cnt[2]; ans%=MOD; cnt[2]--; cnt[4]++;
      }
      else cnt[0]++;
    }
    else if(S[i]=='G'){
      if(cnt[3]){
        ans*=cnt[3]; ans%=MOD; cnt[3]--;
      }
      else if(cnt[0]){
        ans*=cnt[0]; ans%=MOD; cnt[0]--; cnt[4]++;
      }
      else if(cnt[1]){
        ans*=cnt[1]; ans%=MOD; cnt[1]--; cnt[5]++;
      }
      else cnt[2]++;
    }
    else if(S[i]=='R'){
      if(cnt[4]){
        ans*=cnt[4]; ans%=MOD; cnt[4]--;
      }
      else if(cnt[0]){
        ans*=cnt[0]; ans%=MOD; cnt[0]--; cnt[3]++;
      }
      else if(cnt[2]){
        ans*=cnt[2]; ans%=MOD; cnt[2]--; cnt[5]++;
      }
      else cnt[1]++;
    }
  }
  rep(i, N){
    ans*=(i+1); ans%=MOD;
  }
  cout << ans << endl;
}

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

int main()
{
    string s;
    cin >> s;
    int i = 0;
    if (s[2] == s[3] && s[4] == s[5])
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define si(X) scanf("%d", &(X))
#define sll(X) scanf("%lld",&(X))
#define INFL 0x3f3f3f3f3f3f3f3fLL
const int mod = 1e9+7;
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll expo(ll base,ll pow){ll ans = 1;
   while(pow!=0){if(pow&1==1){ans = ans*base;ans = ans%mod;}
   base *= base;base%=mod;pow/=2;}return ans;}
ll inv(ll x){return expo(x,mod-2);}
ull llrand() {ull r = 0;for(int i = 0; i < 5; ++i){r = (r << 15)|(rand() & 0x7FFF);}return r & 0xFFFFFFFFFFFFFFFFULL;}
int dx[8] = {1 , 0 , -1 , 0 , 1 , -1 , -1 , 1};    // last 4 diagonal
int dy[8] = {0 , 1 , 0 , -1 , 1 , 1 , -1 , -1};
/*---------------------------------------------------------------------------------------------------------------------*/

const int M = 100001;

int arr[333][333] , cut[333][333] , temp[333][333];

int main(){
    //freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "wt", stdout);



    int n;
    si(n);

    for(int i = 1 ; i <= n ; i++){
        for(int j = 1 ; j <= n ; j++){
            sll(arr[i][j]);
            temp[i][j] = arr[i][j];
        }
    }

    memset(cut , -1 , sizeof(cut));

    for(int k = 1 ; k <= n ; k++){
        for(int i = 1 ; i <= n ; i++){
            for(int j = 1 ; j <= n ; j++){
                ll here = arr[i][k] + arr[k][j];
                if(k == i || i == j || j == k) continue;
                if(here <= arr[i][j]){
                    cut[i][j] = k;
                  //  cout<<i<<"  "<<j<<"  "<<k<<endl;
                    arr[i][j] = here;
                }
            }
        }
    }

    /*for(int i = 1 ; i <= n ; i++){
        for(int j = 1 ; j <= n ; j++){
            cout<<arr[i][j]<<" ";
        }
        cout<<endl;
    }*/
    for(int i = 1 ; i <= n ; i++){
        for(int j = 1 ; j <= n ; j++){
            if(temp[i][j] != arr[i][j]){
                cout<<"-1";
                return 0;
            }
        }
    }

    ll ans = 0;

    for(int i = 1 ; i <= n ; i++){
        for(int j = i + 1 ; j <= n ; j++){
            if(cut[i][j] == -1){
                //cout<<i<<" hh "<<j<<endl;
                ans += arr[i][j];
            }
        }
    }


    cout<<ans;







}














Measured memory_bytes: 1408
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		int n = Integer.parseInt(scanner.nextLine());
		String line = scanner.nextLine();
		String[] splits = line.split(" ");
		int[] a = new int[splits.length];
		Boolean isOK = true;
		for(int i = 0; i < splits.length; i++){
			a[i] = Integer.parseInt(splits[i]);
			if(a[i] % 2 == 0 && (a[i]%3 != 0 && a[i] % 5 != 0)){
				isOK = false;
				break;
			}else{

			}
		}
		String result = isOK ? "APPROVED" : "DENIED";

		System.out.println(result);
	}

}


Measured memory_bytes: 21460
#include<stdio.h>
int main(){
	int N,Y,b,sum;
	scanf("%d %d",&N,&Y);
	for(int i = 0;i<Y;i++){
		scanf("%d",&b);
	}
	sum = 0;
	for(;;){
		N = N / 2;
		sum = sum + N;
		if(N==1)	break;
	}
	printf("%d\n",sum-Y);
}

Measured memory_bytes: 2760
//#pragma comment(linker, "/stack:200000000") //  (UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")  // $ (UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)\

#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 fast_cin ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
#define pb push_back
#define all(con) (con).begin(), (con).end()
#define fi first
#define se second
#define rep(i,a,b) for(int i=a;i<b;++i)
#define fre(i,a,b) for(int i=a;i<=b;i++)
#define rpe(i,a,b) for(i=a-1;i>=b;i--)
#define rp(i,n) rep(i,0,n)
#define fr(i,n) fre(i,1,n)
#define ff(i,a,b) for(int i=a;i<=b;i++)

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// order_of_key (val): returns the no. of values less than val
// find_by_order (k): returns the iterator to kth largest element.(0-based)

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

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

template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}

int modpow(int x, int n, int m) {
	x %= m;
	int res = 1;
	while(n > 0) {
		if(n & 1)
		res = res * x % m;
		x = x * x % m;
		n >>= 1;
	}
	return res;
}

const long long inf = 2e18 ;
const int mod = 1e9+7 ;
// const int mod = 998244353 ;

const int N = 1e5 + 10 ;

void solve() {
	int n;
	cin>>n;
	int a[n+10];
	ff(i,1,n) {
		cin>>a[i];
	}
	int mn=2e18;
	int ans=0;
	for(int i=1;i<=n;i++) {
		if(a[i]<=mn) {
			ans++;
		}
		mn=min(mn,a[i]);
	}
	cout<<ans<<endl;
}

signed main() {
        fast_cin;
	srand(chrono::high_resolution_clock::now().time_since_epoch().count());
        #ifndef ONLINE_JUDGE
        // freopen("input.txt", "r", stdin);
        // freopen("output.txt", "w", stdout);
    	#endif

	int tests=1;
	// cin>>tests;
	while(tests--) {
		solve();
	}

return 0 ;
}



Measured memory_bytes: 1792
l = []
a = 'AKIHABARA'

def rec(s, i):
    if i == len(a):
        l.append(s)
        return
    if a[i] == 'A':
        rec(s, i+1)
    rec(s + a[i], i+1)

rec('', 0)
print("YES" if input() in l else "NO")

Measured memory_bytes: 9056
n = input()
a = map(int, raw_input().split())
b = [-1] * n
for i in range(n):
    b[n/2 - (2*(i%2) - 1) * ((i+1)/2)] = a[i]
if n % 2 == 1:
    b = b[::-1]
print " ".join(map(str, b))

Measured memory_bytes: 28272
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    s = S()
    t = "SUN,MON,TUE,WED,THU,FRI,SAT".split(",")
    for i in range(7):
        if t[i] == s:
            return 7 - i

    return -1


print(main())





Measured memory_bytes: 7124
def chmin(a, b):
  if (a > b):
    return b

  return a

def chmax(a, b):
  if (a < b):
    a = b
    return True

  return False

N = int(input())
li = list(map(int, input().split()))

dp = [10**9] * N

for n in range(N):
  if n == 0:
    dp[n] = 0
    continue
  if n == 1:
    dp[n] = abs(li[n] - li[n-1])
    continue

  dp[n] = chmin(dp[n], dp[n-1] + abs(li[n] - li[n-1]))
  dp[n] = chmin(dp[n], dp[n-2] + abs(li[n] - li[n-2]))

print(dp[-1])

Measured memory_bytes: 13924
#-swank
(unless (member :child-sbcl *features*)
  (quit
   :unix-status
   (process-exit-code
    (run-program *runtime-pathname*
                 `("--control-stack-size" "128MB"
                   "--noinform" "--disable-ldb" "--lose-on-corruption" "--end-runtime-options"
                   "--eval" "(push :child-sbcl *features*)"
                   "--script" ,(namestring *load-pathname*))
                 :output t :error t :input t))))
(defmacro dp (name args memo-size &body body)
  (let ((memo (gensym)))
    `(let ((,memo (make-array ,memo-size :initial-element nil)))
       (defun ,name ,args
         (or (aref ,memo ,@args)
             (setf (aref ,memo ,@args)
                   ,@body))))))

(defun split (x str)
  (let ((pos (search x str))
        (size (length x)))
    (if pos
      (cons (subseq str 0 pos)
            (split x (subseq str (+ pos size))))
      (list str))))

(defmacro collect-times (time body)
  `(loop repeat ,time collect ,body))

(defun read-times (time)
  (collect-times time (read)))

(defun main (n)
  (apply #'min
         (loop for i from 1
               until (> (* i i) n)
               when (zerop (mod n i))
                 collect (- (+ i (/ n i)) 2))))

(princ (main (read)))

(main 10)


Measured memory_bytes: 18744
#include<stdio.h>
#include<tuple>
#include<string>
#include<algorithm>
#include<iostream>
#include<map>
#include<string.h>
#include<vector>
#include<math.h>
#include<stdlib.h>
#include<set>
#include<ctype.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef tuple<int,int,int> t3;

const int MX = 200005;
const int MM = 924844033;

int D[MX], E[MX], F[MX];
int N;

bool chk()
{
	for(int i = 1; i <= 2*N-1; i++) F[i] = -1;
	for(int i = 1; i+1 <= 2*N-1; i++){
		if( E[i] == E[i+1] ) F[i] = F[i+1] = E[i];
	}
	pii l = pii(-1, -1), r = pii(-1, -1);
	for(int i = N; i >= 1; i--) if( F[i] != -1 ){
		l = pii(N-i, E[i]);
		break;
	}
	for(int i = N; i <= 2*N-1; i++) if( F[i] != -1 ){
		r = pii(i-N, E[i]);
		break;
	}
	if( F[N] != -1 ) return E[N];
	if( l.first == -1 || r.first == -1 ){
		if( l.first == -1 && r.first == -1 ) return E[1];
		else if( l.first == -1 ) return r.second;
		else return l.second;
	}
	return l.first < r.first? l.second : r.second;
}

int main()
{
	scanf("%d", &N);
	for(int i = 1; i <= 2*N-1; i++) scanf("%d", D+i);
	int s = 1, e = 2*N-1, m;
	while(s <= e){
		m = (s+e) / 2;
		for(int i = 1; i <= 2*N-1; i++) E[i] = D[i] >= m;
		if( !chk() ) e = m-1;
		else s = m+1;
	}swap(s, e);
	printf("%d\n", s);
}


Measured memory_bytes: 2688
#include<bits/stdc++.h>
using namespace std;
const int N=400005;
int n,x,y,ne[N],fi[N],zz[N],ans,tot,Maxsd[N],sd[N];
void jb(int x,int y){
	ne[++tot]=fi[x];
	fi[x]=tot;
	zz[tot]=y;
}
void dfs(int x,int y,int z){
	Maxsd[x]=sd[x]=z;
	for (int i=fi[x];i;i=ne[i])
		if (zz[i]!=y){
			dfs(zz[i],x,z+1);
			ans=max(ans,Maxsd[x]+Maxsd[zz[i]]-2*sd[x]);
			Maxsd[x]=max(Maxsd[x],Maxsd[zz[i]]);
		}
}
int main(){
	scanf("%d",&n);
	for (int i=1;i<n;i++){
		scanf("%d%d",&x,&y);
		jb(x,y);jb(y,x);
	}
	dfs(1,0,0);
	if (ans%3==1)puts("Second");
	else puts("First");
}

Measured memory_bytes: 16128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll ;
const int maxn = 15 ;
char s[maxn] ;
bool ok()
{
	int len = strlen(s) ;
	if(len % 2 == 1)  return 0 ;
	for(int i = 0 ; i < len ; i ++)
	{
		if(i % 2 == 0 && s[i] != 'h')  return 0 ;
		if(i % 2 == 1 && s[i] != 'i')  return 0 ;
	}
	return 1 ;
}
int main()
{
	scanf("%s" , s) ;
	if(ok())  printf("Yes\n") ;
	else  printf("No\n") ;
}

Measured memory_bytes: 256
from collections import deque
m=[[1,0],[-1,0],[0,1],[0,-1]]
h,w=map(int,input().split())
l=list()
l.append('#'*(w+2))
p=0
for i in range(h):
    j=input()
    p+=j.count('#')
    l.append('#'+j+'#')
l.append('#'*(w+2))
q=deque([[1,1]])
s=[[-1 for j in i] for i in l]
s[1][1]=1
while len(q)>0:
    x,y=q.popleft()
    for i,j in m:
        if l[x+i][y+j]=='.' and s[x+i][y+j]==-1:
            q.append([x+i,y+j])
            s[x+i][y+j]=s[x][y]+1
    if s[h][w]!=-1:
        break
print(h*w-p-s[h][w] if s[h][w]!=-1 else -1)

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

int main() {
  string atcoder;
  string contest;
  string str;
  cin >> atcoder >> str >> contest;

  char a = atcoder.at(0);
  char s = str.at(0);
  char c = contest.at(0);

  cout << a << s << c << endl;

}

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

template<class T> void vin(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

int main() {
    int N;
    cin >> N;
    string s;
    cin >> s;
    int w=0, b=0;
    rep(i, s.size()) {
        if (s[i] == '#') b++;
        else w++;
    }
    int ans = min(w, b);
    int tmpw=0, tmpb=0;
    rep(i, s.size()) {
        if (s[i] == '#') tmpb++;
        else tmpw++;
        ans = min(ans, tmpb + (w - tmpw));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
def hoge():
  dp = [0] * (n + 5)
  for i in range(1, n):
    p = [dp[j] + abs(h_list[i] - h_list[j]) for j in range(max(0, i - k), i)]
    dp[i] = min(p)
  return dp[n - 1]

def solve():
  global n, k, h_list
  n, k = map(int, input().split())
  h_list = list(map(int, input().split()))
  ans = hoge()
  print(ans)
  return 0

if __name__ == "__main__":
  solve()

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

int main(){
  constexpr int64_t INF= 1e18;
  int N;
  cin >> N;

  vector<int64_t> data(N+1);
  for(int d=0; d<=N; d++){
    cin >> data.at(d);
  }

  vector<int64_t> bottomup(N+1);
  bottomup.at(N)= data.at(N);
  for(int d=N; d>0; d--){
    bottomup.at(d-1)= data.at(d-1)+ bottomup.at(d);
  }
  
  int64_t cnt= 0;
  int64_t topdown= 1;
  bool has_overflowed= false;
  bool is_satisfied= true;
  for(int d=0; d<=N; d++){
    int64_t cnt_d= min(topdown, bottomup.at(d));
    if(cnt_d < data.at(d)){
      is_satisfied= false;
      break;
    }
    else{
      cnt+= cnt_d;

      topdown= !has_overflowed ? 2*(topdown- data.at(d))
                               : INF;
      has_overflowed= (topdown >= INF);
    }
  }

  int64_t ans= is_satisfied ? cnt
                            : -1;
  cout << ans << endl;
}

Measured memory_bytes: 4832
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>

using namespace std;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    char b, ans;
    cin >> b;
    if (b == 'A') {
        ans = 'T';
    } else if (b == 'T') {
        ans = 'A';
    } else if (b == 'G') {
        ans = 'C';
    } else {
        ans = 'G';
    }
    cout << ans << endl;

    return 0;
}

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

using namespace std;

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

    vector<int> wa(N);
    vector<int> ac(N);
    int wa_cnt = 0;
    int ac_cnt = 0;

    for(int i=0;i<M; i++){
        int p;
        string S;
        cin >> p >> S;

        if(S == "WA" && ac.at(p-1) == 0){
            wa.at(p-1)++;
        }
        if(S == "AC" && ac.at(p-1) == 0){
            wa_cnt += wa.at(p-1);
            ac_cnt += 1;
            ac.at(p-1)++;
        }

    }

    cout << ac_cnt << " " << wa_cnt << endl;
    return 0;

}

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

int N;
bool prime[1001];
int cnt[1001];
int dp[333][333];

void solve()
{
	memset(prime,true,sizeof(prime));
	prime[0]=prime[1]=false;
	for(int i=2;i<=1000;++i)if(prime[i]){
		for(int j=i*2;j<=1000;j+=i) prime[j]=false;
	}
	for(int i=2;i<=N;++i)if(prime[i]){
		int x = N;
		while(x >= i){
			cnt[i] += x / i;
			x /= i;
		}
	}
	dp[0][1]=1;
	for(int i=1;i<=N;++i)for(int j=0;j<=75;++j){
		for(int k=1;k<=cnt[i]+1;++k)if(j*k<=75){
			dp[i][j*k]+=dp[i-1][j];
		}
	}
	cout << dp[N][75] << '\n';
}

int main()
{
	cin >> N;
	solve();
	return 0;
}

Measured memory_bytes: 3696
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <algorithm>
#include <vector>
#include <cstring>
#include <stack>
#include <cctype>
#include <utility>
#include <map>
#include <string>
#include <climits>
#include <set>
#include <sstream>
#include <utility>
#include <ctime>
#include <cassert>
#include <fstream>
using namespace std;
typedef long long LL;
#define MS(A) memset(A, 0, sizeof(A))
#define MSV(A,a) memset(A, a, sizeof(A))
#define MP make_pair
#define PB push_back
#define getcx getchar_unlocked
#define INF (int(1e9))
#define INFL (LL(1e18))
#define EPS 1e-12
#define chkbit(s, b) (s & (1<<b))
#define setbit(s, b) (s |= (1<<b))
#define chk(a) cerr << endl << #a << " : " << a << endl
#define chk2(a,b) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << endl
#define chk3(a,b,c) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << "\t" << #c << " : " << c << endl
#define chk4(a,b,c,d) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << "\t" << #c << " : " << c << "\t" << #d << " : " << d << endl
#define rep(i, a, n) for(i=a;i<n;i++)
#define rev(i, a, n) for(i=a;i>=n;i--)
#define rep_itr(itr, c) for(itr = (c).begin(); itr != (c).end(); itr++)
#define MOD 1000000007
#define MAX 1000000

int main() {

	int x, y, ans =0;

	cin>>x>>y;


	int flag = 0;

	//fix turtle, find cranes

	for(int i = 0 ; i <=x; i++) {

		int turtle = i;
		int crane = (x-i);

		if(turtle*4 + crane *2 == y) {
			flag = 1;
			cout<<"Yes"<<endl;
			return 0;
		}
	}

	cout<<"No"<<endl;
	

	//only cranes

// 	if(y % 2 == 0 && 2*x == y) {
// 		cout<<"Yes"<<endl;
// 		return 0;
// 	}

// 	if(y % 4 == 0 && 4 * x == y) {
// 		cout<<"Yes"<<endl;
// 		return 0;
// 	}

// 	if((y - (2*x)) % 2 == 0) {
// 		int b = y - 2*x;
// 		b = b/2;

// 		if(x - b >=0 && (x-b) * 2  == (y-4*b)) {
// 			cout<<"Yes"<<endl;
// 		} else cout<<"No"<<endl;
// 	} else {


// 		if((4*x - y) % 2 == 0) {
// 			int a = 4*x - y;
// 			a = a/2;


// 			if(x - a >=0 && (x-a)*4 == (y-2*a)) {
// 				cout<<"No"<<endl;
// 		} else {
// 			cout<<"No"<<endl;
// 		}
// 	}
// }

	return 0;
}

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

using namespace std;

int main(int argc, const char * argv[]) {
    int N = 0; // string length
    int K = 0; // where to replace
    string S;
    cin >> N >> K;
    cin >> S;
    
    S[K-1] = tolower(S[K-1]);
    cout << S << endl;
    
    return 0;
}


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

long long n;
string s;

long long solve();

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

  cout << solve() << endl;
  return 0;
}

long long solve() {
  long long ans = 0;
  for(int i = 0; i < n;) {
    char now = s[i];
    while(i < n && s[i] == now) ++i;
    ++ans;
  }
  return ans;
}

Measured memory_bytes: 512
n = int(input())
S = tuple(map(int, input().split()))
q = int(input())
T = tuple(map(int, input().split()))

c = 0
for t in T:
    l = 0
    r = len(S)
    while (r - l) > 1:
        m = (l + r)//2
        if S[m] > t:
            r = m
        else:
            l = m
        
        if S[l] == t:
            c += 1
            break
        
print(c)




Measured memory_bytes: 16940
h,w=map(int,input().split())
a=[list(input()) for i in range(h)]

dp=[[10**9]*w for i in range(h)]
if a[0][0]==".":
    dp[0][0]=0
else:
    dp[0][0]=1
    
for i in range(h):
    for j in range(w):
        if i!=0:
            if a[i-1][j]=="." and a[i][j]=='#':
                dp[i][j]=min(dp[i][j],dp[i-1][j]+1)
            else:
                dp[i][j]=min(dp[i][j],dp[i-1][j])
        if j!=0:
            if a[i][j-1]=="." and a[i][j]=='#':
                dp[i][j]=min(dp[i][j],dp[i][j-1]+1)
            else:
                dp[i][j]=min(dp[i][j],dp[i][j-1])
print(dp[-1][-1])

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  if (N % 2 != 0 ) {
    cout << 0 << endl;
    return 0;
  }
  vector<int> d(N);
  for (int i = 0; i < N; i++)
    cin >> d.at(i);
  sort(d.begin(), d.end());
  int n = N/2;
  if (d.at(n-1) == d.at(n) ) {
    cout << 0 << endl;
    return 0;
  }
  else {
    int a = d.at(n-1);
    int b = d.at(n);
    cout << b - a << endl;
  } 
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    ll n,m;
    cin>>n;
    string s;
    map<string,ll>mp;
    map<string,ll>:: iterator it;
    for(int i=0; i<n; i++)
    {cin>>s;mp[s]++;}
    cin>>m;
    for(int i=0; i<m; i++)
    {cin>>s;mp[s]--;}
    ll x=-99999190191091;
    for(it=mp.begin(); it!=mp.end(); it++)
    {x=max(x,it->second);}
    if(x<0) {cout<<0<<endl;}
    else{cout<<x<<endl;}
    return 0;
}



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

void judge(){
    int a,b;
    cin >> a;
    cin >> b;
    if(a > b){
        cout <<  "a > b" << endl;
    }
    else if (a < b){
        cout << "a < b" << endl;
    }
    else{
        cout << "a == b" << endl;
    }
}
int main(int argc, const char * argv[]) {
    judge();
    return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <climits>
#include <set>
#include <string>
#include <algorithm>
#include <vector>
#define MAX 1000000007


using namespace std;
#define ll long long
#define dbg if(0)
#define ISRANGE(val,lo,hi) ((lo<=val)&&(val<hi))



int main(){
    ll ans;
    char a[3];
    for(int i=0;i<3;i++){
        string b;
        cin >>b;
        a[i]=((char)b[0]-('a'-'A'));
    }

    dbg{
    if(true)cout <<"YES"<<endl;
    else cout <<"NO"<<endl;
    }

    cout <<a<<endl;

    return 0;

}

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

const int MAX_N = 10000000, sqrt_N = 1000;
bool prime[MAX_N];
int wei[1000000];

int main()
{
  int N, i, j, k;

  for (i = 1; i <= 5; i += 4){
    for (j = i; j <= sqrt_N; j += 6){
      for (k = 1; k <= sqrt_N && (N = 4 * k * k + j * j) <= N; ++k){
        prime[N] = !prime[N];
      }
      for (k = j + 1; k <= sqrt_N && (N = 3 * k * k - j * j) <= N; k += 2){
        prime[N] = !prime[N];
      }
    }
  }
  for (i = 2; i <= 4; i += 2){
    for (j = i; j <= sqrt_N; j += 6){
      for (k = 1; k <= sqrt_N && (N = 3 * k * k + j * j) <= N; k += 2){
        prime[N] = !prime[N];
      }
      for (k = j + 1; k <= sqrt_N && (N = 3 * k * k - j * j) <= N; k += 2){
        prime[N] = !prime[N];
      }
    }
  }
  for (i = 3; i <= sqrt_N; i += 6){
    for (j = 1; j <= 2; ++j){
      for (k = j; k <= sqrt_N && (N = 4 * k * k + i * i) <= N; k += 3){
        prime[N] = !prime[N];
      }
    }
  }
  for (i = 5; i <= sqrt_N; ++i){
    if (prime[i]){
      for (j = i * i; j <= N; j += i * i){
        prime[j] = false;
      }
    }
  }
  prime[2] = prime[3] = true;

  for (i = 2; i < 1000000; ++i){
    wei[i] += wei[i - 1];
    if (prime[i]) wei[i]++;
  }

  while (cin >> N) cout << wei[N] << '\n';
  return 0;
}

Measured memory_bytes: 11388
#include <iostream>
#include <vector>
int main()
{
	int N, M, C;
	std::vector<int> B;
	std::vector<std::vector<int>> A;
	std::cin >> N >> M >> C;
	for (int i = 0; i < M; i++) {
		int temp;
		std::cin >> temp;
		B.push_back(temp);
	}

	for (int i = 0; i < N; i++) {
		std::vector<int> a;
		for (int j = 0; j < M; j++) {
			int temp;
			std::cin >> temp;
			a.push_back(temp);
		}
		A.push_back(a);
	}

	int ans = 0;
	for (int i = 0; i < N; i++) {
		int sum = 0;
		for (int j = 0; j < M; j++) {
			sum += B[j] * A[i][j];
		}
		sum += C;
		if (sum > 0) ans++;
	}

	std::cout << ans << std::endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
 
int main(){
  string x, y;
  cin >> x >> y;
  
  sort(x.begin(), x.end());
  sort(y.begin(), y.end());
  reverse(y.begin(), y.end());
  if(x < y){
  	cout << "Yes"  << endl;
  } else {
    cout << "No" << endl;
  }
}

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

int main(){
    int n; cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    int pre = -999;
    rep(i,n){
        if(pre <= a[i]-1){
          pre = a[i]-1;
        }else if(pre <=a[i]){
          pre = a[i];
        }else{
          puts("No");
          return 0;
        }
    }
  puts("Yes");
  return 0;
}

Measured memory_bytes: 640
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;
import std.container;

alias sread = () => readln.chomp();
alias route = Tuple!(long, "From", long, "To");
long bignum = 1_000_000_007;

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void main()
{
    long n, k;
    scan(n, k);
    if (k > 1)
        writeln(n - k);
    else
        writeln(0);
}

Measured memory_bytes: 256
#include <iostream>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <queue>
#include <map>
 
using namespace std;
typedef long long int ll;
typedef pair <int,int> pii;
typedef pair<ll,ll> pll;
 
 
/*bool compare_function(const pair<int, int> a, const pair<int, int> b)
{
    return a.first < b.first;
}*/
// use case
//sort(V.begin(), V.end(), compare_function);
 
/*struct compare
{
    bool operator ()(const pair<int, int> &a, const pair<int, int> &b) {
    if (a.second-a.first==b.second-b.first)
    {
        return a.first>b.first;
    }
    return a.second-a.first < b.second-b.first;}
};
priority_queue <pair<int,int>, vector <pair<int,int>>, compare> Q;*/
 
/*void print1(vector <int> X)
{
    for (int i=0; i<X.size(); i++)
    {
        cout<<X[i]<<" ";
    }
    cout<<endl;
    return;
}
 
void print2(vector <vector <int>> X)
{
    for (int i=0; i<X.size(); i++)
    {
    for (int j=0;j<X[i].size();j++) {
        cout<<X[i][j]<<" ";}
    cout<<endl;}
    return;
}*/

int solve(set<int> &A, set<int> &B) {
	if (A.empty() || B.empty()) {return 0;}
	int ats=0;
	int b=*A.rbegin();
	int a=*B.begin();
	while (b>a) {
		A.erase(b);
		B.erase(a);
		A.insert(a);
		B.insert(b);
		b=*A.rbegin();
		a=*B.begin();
		ats++;
		}
	return ats;
	}
 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    set <int> A;
    set <int> B;
    for (int i=0;i<n;i++) {
		char x;
		cin>>x;
		if (x=='R') {A.insert(i);}
		else {B.insert(i);}
		}
	cout<<solve(A,B)<<endl;
    return 0;
}


Measured memory_bytes: 13032
#include <vector>
#include <cstdlib>
#include <iostream>
class BIT {
public:
	BIT(const int &n = 0) :vector(n, 0), number(0) {
		for (auto i = 0; i < n; ++i) {
			add(i);
		}
	}
	int find(int idx) {
		if (idx >= vector.size()) {
			return find(vector.size() - 1) + find(idx - vector.size());
		}
		else {
			int result = 0;
			while (idx >= 0) {
				result += vector.at(idx);
				idx -= righten_zero(idx);
			}
			return result;
		}
	}
	void remove(int idx) {
		//std::cout << "---" << idx << "---" << number << std::endl;
		//show();
		while (idx < vector.size()) {
			--vector.at(idx);
			idx += righten_zero(idx);
		}
		--number;
	}
	void add(int idx) {
		while (idx < vector.size()) {
			++vector.at(idx);
			idx += righten_zero(idx);
		}
		++number;
	}
	void show() {
		int d = 2, c = 0;
		while (c < vector.size()) {
			auto idx = c;
			while (idx < vector.size()) {
				std::cout << vector.at(idx) << " ";
				idx += d;
			}
			std::cout << std::endl;
			c = d - 1;
			d <<= 1;
		}
	}
	int size() { return vector.size(); }
	int max() { return number; }
private:
	std::vector<int> vector;
	int number;
	int righten_zero(const signed int &n) {
		return (-n - 1) & (n + 1);
	}
};
int binsearch(BIT &bit, const int &pivot, int called) {
	int target;
	if (((called) & 1) == 1) {
		target = bit.find(pivot) + bit.max() - (called % bit.max()) + 1;
	}
	else {
		target = bit.find(pivot) + called % bit.max() + 1;
	}
	//std::cout << "T" << target << "P" << pivot << "C" << called << "MAX" << bit.max() << std::endl;
	int a = pivot + bit.size(), b = 0;
	while (a != b) {
		auto mid = (a + b) / 2;
		if (bit.find(mid) >= target) {
			a = mid;
		}
		else {
			b = mid + 1;
		}
	}
	return a;
}
int main() {
	int n, m, q;
	std::cin >> n >> m >> q;
	BIT bit(n);
	std::vector<bool> number(n, true);
	int pivot;
	{
		int a;
		std::cin >> a;
		if ((a & 1) == 0) {
			pivot = a;
		}
		else {
			pivot = n - (a % n);
		}
		bit.remove(pivot);
		number.at(pivot) = false;
	}
	for (auto i = 1; i < m; ++i) {
		//bit.show();
		//std::cout << "--" << pivot << "--" << std::endl;
		//std::cout << bit.find(pivot) << "-" << bit.find(pivot - 1) << std::endl;;
		//bit.show();
		int a;
		std::cin >> a;
		pivot = binsearch(bit, pivot, a) % n;
		number.at(pivot) = false;
		bit.remove(pivot);
	}
	for (auto i = 0; i < q; ++i) {
		int q;
		std::cin >> q;
		if (number.at(q)) {
			std::cout << "1\n";
		}
		else {
			std::cout << "0\n";
		}
	}
	return 0;
}

Measured memory_bytes: 1956
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;

const ll MOD = 1000000007;

ll modpow(ll x, ll n){
    ll res = 1;
    ll mul = x;
    while(n){
        if(n % 2) res = res * mul % MOD;
        mul = mul * mul % MOD;
        n /= 2;
    }
    return res;
}

int main()
{
    ll n;
    cin >> n;
    ll c[200002];
    for(int i = 0; i < n; i++) cin >> c[i];
    sort(c, c + n);
    ll ans = 0;
    ll r = modpow(2, MOD - 2);
    for(int i = 0; i < n; i++) ans = (ans + c[i] * n % MOD * r % MOD) % MOD;
    for(int i = 0; i < n; i++){
        ans = (ans + MOD * 2 - c[i] * (n - 1) % MOD * r % MOD * r % MOD - c[i] * i % MOD * r % MOD * r % MOD) % MOD;
    }
    ans = ans * modpow(2, n * 2) % MOD;
    cout << ans << endl;
}

Measured memory_bytes: 1792
#include <iostream>

using namespace std;

int main()
{
    int x;
    cin >> x;
    
    switch(x/100)
    {
        case 19:
        case 18: cout << "1\n"; break;
            
        case 17:
        case 16: cout << "2\n"; break;
            
        case 15:
        case 14: cout << "3\n"; break;
            
        case 13:
        case 12: cout << "4\n"; break;
            
        case 11:
        case 10: cout << "5\n"; break;
            
        case 9:
        case 8: cout << "6\n"; break;
            
        case 7:
        case 6: cout << "7\n"; break;
            
        case 5:
        case 4: cout << "8\n"; break;
    }
    
    return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <cstdio>
#include <vector>
#include <map>
#include <string>
#include <utility>
#include <algorithm>
#include <functional>
#include <climits>
#include <math.h>
#include <iomanip>
using namespace std;
int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
   	int a,b;
   	cin>>a>>b;
   	string s;
   	cin>>s;
   	for(int i=0;i<a;i++){
   	if(s[i]=='0'||s[i]=='1'||s[i]=='2'||s[i]=='3'||s[i]=='4'||s[i]=='5'||s[i]=='6'||s[i]=='7'||s[i]=='8'||s[i]=='9'){}else{
   		cout<<"No"<<endl;goto end1;
   	}
   	}
   	if(s[a]!='-'){cout<<"No"<<endl;goto end1;}
   	for(int i=a+1;i<a+b+1;i++){
   	if(s[i]=='0'||s[i]=='1'||s[i]=='2'||s[i]=='3'||s[i]=='4'||s[i]=='5'||s[i]=='6'||s[i]=='7'||s[i]=='8'||s[i]=='9'){}else{
   		cout<<"No"<<endl;goto end1;
   	}
   	}
   	cout<<"Yes"<<endl;
   	end1:
	return 0;
}

Measured memory_bytes: 256
s = input()
t = input()

c_set = set()
for c in s:
    c_set.add(c)

t_set = set()
for c in c_set:
    isFirst = True
    tTemp = ""

    for i in range(len(s)):
        if isFirst:
            if s[i] == c:
                tTemp = t[i]
                isFirst = False
                if tTemp in t_set:
                    print("No")
                    exit()
                t_set.add(tTemp)
        else:
            if s[i] == c:
                if t[i] != tTemp:
                    print("No")
                    exit()

print("Yes")



Measured memory_bytes: 3632
N, Y = map(int, input().split())

for yuk in range(N + 1):
    for hig in range(N - yuk + 1):
        if yuk * 10000 + hig * 5000 + (N-yuk-hig) * 1000 == Y:
            print('%d %d %d' % (yuk, hig, N-yuk-hig))
            exit()
print('-1 -1 -1')

Measured memory_bytes: 40812
def enum_divisors(n):
    res = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            res.append(i)
            if i != n // i:
                res.append(n // i)
    return res


N, M = map(int, input().split())
divs = sorted(enum_divisors(M), reverse=True)
ans = max(d for d in divs if M // d >= N)
print(ans)


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

int main(){
#ifndef ONLINE_JUDGE
	freopen("in.txt","r",stdin);
#endif
	string s,sub;
	cin>>s>>sub;
	int ls=s.length(),lsub=sub.length(),l=ls-lsub;
	int maxn=0;
	for(int i=0;i<=l;++i){
		int cnt=0;
		for(int j=0;j<lsub;++j){
			if(s[j+i]==sub[j]) ++cnt;
		}
		if(cnt>maxn) maxn=cnt;
	}
	cout<<lsub-maxn<<endl;
	return 0;
}

Measured memory_bytes: 3652
#include <iostream>
using namespace std;
int main() {
    int k;
    cin >> k;
    int a = 7;
    int count = 1;
    for(int i=0;i<k;i++){
        if(a % k == 0){
            break;
        }
        count ++;
        a = (10 * a + 7) % k;
    }
    if(count == k+1){
        cout << -1 << endl;
    }
    else{
        cout << count << endl;
    }
}

Measured memory_bytes: 3592
while True:
    try:
        a = list(map(int, input().split()))
        b = list(map(int, input().split()))
    except:
        break
    hit = blow = 0
    for i in range(4):
        if a[i] == b[i]:
            hit += 1
        for j in range(4):
            if i != j and a[i] == b[j]:
                blow += 1
    print(hit, blow)

Measured memory_bytes: 7568
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using st=string;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
st abc="abcdefghijklmnopqrstuvwxyz";
st ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct edge{ll to,cost;};

int main() {
  ll N;
  cin >> N;
  ll a;
  bool B=false;
  rep(i,N){
    cin >> a;
    if(a%2==1){
      B=true;
    }
  }
  if(B){
    cout << "first" << endl;
  }
  else{
    cout << "second" << endl;
  }
}


Measured memory_bytes: 256
n, m = map(int, input().split())
nums = [0, 1]
broken = set()
for i in range(m):
    broken.add(int(input()))
def fib(n):
    for i in range(n):
        if i+1 in broken:
            nums.append(0)
        else:
            a = nums[i]
            b = nums[i+1]
            nums.append((a+b)%1000000007)
    return nums[-1]
print(fib(n))

Measured memory_bytes: 11884
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod=1e9+7;

int main()
{
    ll n,d;
    cin>>n>>d;
    if(n%(2*d+1))
        cout<<n/(2*d+1)+1;
    else
        cout<<n/(2*d+1);
    return 0;
}


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

int main(){
    string S; cin >> S;
    S[3]='8';
    cout << S;
}

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

int main()
{
  int n;
  cin >> n;
  int max_n = 0;
  int max = 1;
  for(int i = 1;i <= n;i++){
    bool flag = true;
    int t = i;
    int cnt = 0;
    while(flag){
      if(t%2 == 0){
        t = t / 2;
        cnt++;
      } else {
        flag = false;
      }
    }
    if(cnt > max_n){
      max_n = cnt;
      max = i;
    }
  }
  cout << max << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

struct E {
    int u, v, w;
};

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

    int n = 20, m = 0;
    E e[60];
    int o = 10000000;
    int t = l, s = 1, b = 1, c = -o;

    while (1) {
        int r = t % 2;
        for (int i = 0; i < r; i++) {
            e[m++] = { s, n, c };
            c += b;
        }
        t /= 2;

        if (t == 0) {
            s++;
            break;
        }

        for (int i = 0; i < 2; i++) {
            e[m++] = { s, s + 1, b * i };
        }
        s++;
        b *= 2;

        if (t == 1) {
            o += b;
            break;
        }
    }
    n = s;

    cout << n << ' ' << m << endl;
    for (int i = 0; i < m; i++) {
        if (e[i].v > n) e[i].v = n;
        if (e[i].w < 0) e[i].w += o;
        cout << e[i].u << ' ' << e[i].v << ' ' << e[i].w << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;
void swap(int &a, int &b);

int main()
{
	int H[300], W[300];
	int count = 0;
	while (true)
	{
		cin >> H[count] >> W[count];
		if (H[count] == 0 && W[count] == 0)
			break;
		count++;
	}

	for (int i = 0; i < count; ++i)
	{
		for (int j = 0; j < H[i]; ++j)
		{
			for (int k = 0; k < W[i]; ++k)
			{
				if ((j + k) % 2 == 0)
					cout << "#";
				else
					cout << ".";
			}
			cout << endl;
		}
		cout << endl;
	}

	return 0;
}




Measured memory_bytes: 3072
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>

typedef long long int ll;


using namespace std;

string s;

char calc(){
	if(s[4]!='s'){
		if((s[0]==s[4]&&s[4]==s[8])||(s[2]==s[4]&&s[4]==s[6])){
			return s[4];
		}
	}
	for(int i=0; i<3; i++){
		if(s[i*3]=='s')continue;
		if(s[i*3]==s[i*3+1]&&s[i*3]==s[i*3+2])return s[i*3];
	}
	for(int i=0; i<3; i++){
		if(s[i]=='s')continue;
		if(s[i]==s[i+3]&&s[i]==s[i+6])return s[i];
	}
	return 'd';
}

int main(){
	while(cin>>s){
		cout<<calc()<<endl;
	}
}

Measured memory_bytes: 1172
import java.util.*;
 
import java.io.*;
 
public class Main{

    public static long Combination(long n, long r){
        long A = 1;
        long B = 1;
        for(long i = 0; i < r; i++){
            A = A*(n-i);
            B = B*(r-i);
        }
        if(A == 0) return 0;
        return A/B;
    }

    public static long solve(int i, int j, boolean check, int N, String S){
        if(i == N){
            if(j == 0){
                return 1;
            }else{
                return 0;
            }
        }

        if(j == 0) return 1;

        if(check){
            return Combination(N-i, j)*(long)Math.pow(9, j);
        }else{
            if(S.charAt(i) == '0') return solve(i+1, j, false, N, S);
            long Z = solve(i+1, j, true, N, S);
            long A = solve(i+1, j-1, true, N, S)*(S.charAt(i)-'1');
            long P = solve(i+1, j-1, false, N, S);
            return Z+A+P;
        }


    }
 
	public static void main(String[] $){
		Scanner s = new Scanner(System.in);
        int H = s.nextInt();
        int N = s.nextInt();
        int[] A = new int[N];
        for(int i = 0; i < N; i++){
            A[i] = s.nextInt();
        }
        for(int i = 0; i < N; i++){
            H = H - A[i];
        }
        if(H <= 0){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
        
	}
} 

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

int main() {
    ll N,M;
    cin >> N >>M;
    vector<ll> X(N);
    for(int i=0;i<M;i++){
        ll a,b;
        cin >> a >>b;
        --a;--b;
        if(a!=0){
            X[a]++;
        }
        if(b!=0){
            X[b]++;
        }
    }
    for(int i=0;i<N;i++){
        if(X[i]%2!=0){
            cout <<"NO" << endl;
            return 0;
        }
    }
    cout<<"YES"<<endl;

    return 0;
}

Measured memory_bytes: 1024
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"

using namespace std;

const long long int MOD = 1000000007;

long long int N, M, K, H, W, L, R;


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

	cin >> N;
	while(N){
	    vector<int>v(2 * N + 1, 2);
	for (int i = 0; i < N; i++) {
		cin >> M;
		v[M] = 1;
	}
	L = N;
	R = N;
	int cnt = 0;
	int turn = 0;
	while (L&&R) {
		if (turn % 2) {
			if (cnt == 2 * N) {
				cnt = 0;
				turn++;
				continue;
			}
			for (int i = cnt + 1; i <= 2 * N; i++) {
				if (v[i] == 2) {
					v[i] = 0;
					cnt = i;
					R--;
					break;
				}
				if (i == 2 * N)cnt = 0;
			}
		}
		else {
			if (cnt == 2 * N) {
				cnt = 0;
				turn++;
				continue;
			}
			for (int i = cnt + 1; i <= 2 * N; i++) {
				if (v[i] == 1) {
					v[i] = 0;
					cnt = i;
					L--;
					break;
				}
				if (i == 2 * N)cnt = 0;
			}
		}
		turn++;
	}
	cout << R << endl << L << endl;
	cin>>N;
	}
	return 0;
}


Measured memory_bytes: 3216
#include <stdio.h>
int goukeif(int n){
int sum=0;
  while(n>0){
    sum+=n%10;
    n/=10;
}
return sum;
}
int main() {
int n,a,b;
int i,out;
  scanf("%d%d%d",&n,&a,&b );
      for(i=0;i<=n;i++){
          int s=goukeif(i);
            if(s>=a && s<=b){
                out+=i;
    }
  }
  printf("%d",out);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
 
using namespace std;
#define ll long long
#define ld long double
#define PI 3.141592653L
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const ll INF = (ll)1e18;
const int N = 2e5 + 5;
const ll MOD = 1e9+7;
 
int parent[N];
 
int gcd(int a, int b) { 
    if (a == 0) 
        return b;  
    return gcd(b%a, a);  
} 
   
int lcm(int a, int b) {  
    return (a*b)/gcd(a,b);  
} 
 
ll pow(ll x, ll y, ll p) {
    if(y == 0) return 1;
    ll res = 1;
    x %= p;
    if(x == 0) return 0LL;
    while(y > 0) {
        if(y & 1) res = (res*x) % p;
        y >>= 1;
        x = (x*x) % p;
    }
    return res;
}
 
int find(int x) {
    return x == parent[x] ? x : parent[x] = find(parent[x]);
}
 
void Union(int x, int y) {
    int xPar = find(x), yPar = find(y);
    if(xPar != yPar) parent[xPar] = yPar;
}
 
ll nCr(ll n, ll r) {
    ll res = 1;
    for(ll i=1;i<=r;i++) {
        res = res * (n - r + i) / i;
        // is different from
        // res *= (n -r + i) / i;
    }
    return res;
}
 
int ask(int i, int j) {
    cout << "? " << i + 1 << ' ' << j + 1 << endl;
    int v;
    cin >> v;
    return v;
}

void solve() {
    string s, t;
    cin >> s >> t;
    int n = s.length(), m = t.length();
    int res = m;
    for(int i=0;i<n-m+1;i++) {
        string cur = s.substr(i, m);
        int cnt = 0;
        for(int j=0;j<m;j++) if(cur[j] != t[j]) cnt++;
        res = min(res, cnt);
    }
    cout << res << endl;
    return;
} 

int main()
{
    IOS
    //int t;
    //cin >> t;
    //while(t--) 
    solve();
    return 0; 
}


Measured memory_bytes: 3564