akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
typedef long long ll;
typedef long double ld;
//typedef ll long long ull;
typedef pair<long long, long long> pll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll,ll> ii;
typedef vector<pair<ll,ll> > vii;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef pair<ll,pair<ll,ll> > iii;
#define PI 3.141592653589793
#define mod (ll)(1000*1000*1000 + 7)
//# define N 300005
template<typename T> T gcd(T a,T b) { if(a==0) return b; return gcd(b%a,a); }
template<typename T> T pow(T a,T b, ll m){T ans=1; while(b>0){ if(b%2==1) ans=((ans%m)*(a%m))%m; b/=2; a=((a%m)*(a%m))%m; } return ans%m; }
# define INF (ll)2e18
# define LN 20  
# define EPS 1e-9
typedef pair<ll,pair<ll,ll> > pii;
# define INF1 1e9
# define maxn 1000006
# define offset 100005
const ld eps = 1e-10L;
//# define ll short
/*void LPS()
{
	len = s.length();
    lps[0] = 0;
    for(ll i=1;i<len;i++){

        ll j = lps[i-1];
        while(j > 0 && s[j] != s[i])    j = lps[j-1];
        if(s[i] == s[j])    j++;
        lps[i] = j;
    }
}*/

/*************************************************
struct Coupon {
	ll l;
	ll r;
	ll id;

	Coupon(ll l, ll r, ll id): l(l), r(r), id(id) {} // Initialization

	bool operator<(const Coupon& c) { // Sorting
		return l < c.l;    
	}
};

**************************************************/
int h,w,n;
int x,y;
string s,t;

bool out(int x,int y)
{
	if(x<=0 || x>h || y<=0 || y>w) return true;
	return false;
}

int main()
{
	cin >> h >> w >> n;
	cin >> x >> y;
	int u=x,v=y;
	cin >> s >> t;

	for(int i=0;i<n;i++)
	{
		if(s[i]=='U')
			x--;
		if(out(x,y))
		{
			cout << "NO";
			return 0;
		}
		if(t[i]=='D')
		if(!out(x+1,y))
			x++;	
	}

	x=u,y=v;
	for(int i=0;i<n;i++)
	{
		if(s[i]=='D')
			x++;
		if(out(x,y))
		{
			cout << "NO";
			return 0;
		}
		if(t[i]=='U')
		if(!out(x-1,y))
			x--;	
	}

	x=u,y=v;
	for(int i=0;i<n;i++)
	{
		if(s[i]=='L')
			y--;
		if(out(x,y))
		{
			cout << "NO";
			return 0;
		}
		if(t[i]=='R')
		if(!out(x,y+1))
			y++;	
	}

	x=u,y=v;
	for(int i=0;i<n;i++)
	{
		if(s[i]=='R')
			y++;
		if(out(x,y))
		{
			cout << "NO";
			return 0;
		}
		if(t[i]=='L')
		if(!out(x,y-1))
			y--;	
	}

	cout << "YES";
}

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

using namespace std;
int c[13],a[13][13];
int main(){
	ios::sync_with_stdio(false);
	int n,m,x,maxx=10000000,k,sf=0;
	cin>>n>>m>>x;
	for(int i=1;i<=n;i++){
		cin>>c[i];
		for(int j=1;j<=m;j++){
			cin>>a[i][j];
		}
	}
	int book[n+1],understand[m+1],pd=0,dj=0;
	for(int i=1;i<=n;i++){
		book[i]=0;
	}
	while(book[0]!=1){
		for(int i=1;i<=m;i++){
			understand[i]=0;
		}
		dj=0;pd=0;
		for(int i=1;i<=n;i++){
			for(int j=1;j<=m;j++){
				if(book[i]==1)understand[j]+=a[i][j];
			}
		}
		for(int i=1;i<=m;i++){
			if(understand[i]<x)pd=1;
		}
		for(int i=1;i<=n;i++)
			if(book[i]==1)dj+=c[i];
		if(pd==0&&dj<=maxx){
			maxx=dj;
			sf=1;
		}
		int k=n;
		while(book[k]!=0){
			k--;
		}
		book[k]=1;
		for(int i=k+1;i<=n;i++){
			book[i]=0;
		}
	}
	if(sf==0)cout<<"-1";
	else cout<<maxx;
	return 0;
}

Measured memory_bytes: 3604
w = gets.chomp.split("")
gets
while cmd = gets do
  cmd, op1, op2, op3 = cmd.split
  op1 = op1.to_i
  op2 = op2.to_i
  case cmd
  when "print"
    puts w[op1..op2].join
  when "reverse"
    w[op1..op2] = w[op1..op2].reverse
  when "replace"
    w[op1..op2] = op3.split("")
  end
end

Measured memory_bytes: 9372
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		int[] a = new int[5];
		for (int i = 0; i < a.length; i++) {
			a[i] = sc.nextInt();
		}
		int k = sc.nextInt();

		for(int i = 0; i < a.length - 1; i++) {
			for(int j = i + 1; j < a.length; j++) {
				if (Math.abs(a[i] - a[j]) > k) {
					System.out.println(":(");
					return;
				}
			}
		}

		System.out.println("Yay!");
	}

}

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

int main() {
  string s, t;
  cin >> s >> t;
  map<char, vector<int>> m;
  for (int i = 0; i < s.size(); i++) {
    m[s[i]].push_back(i);
  }
  for (int i = 0; i < s.size(); i++) {
    m[s[i]].push_back(i + s.size());
  }
  int now = 0;
  ll ans = 0;
  for (int i = 0; i < t.size(); i++) {
    if (m[t[i]].empty()) {
      cout << -1 << endl;
      return 0;
    }
    now = *lower_bound(m[t[i]].begin(), m[t[i]].end(), now) + 1;
    if (now >= s.size()) {
      now -= s.size();
      ans += s.size();
    }
  }
  ans += now;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1724
#include <stdio.h>
int main(void){
	int N,M,X,Y,i;
	int x[101];
	int y[101];
	scanf("%d %d %d %d",&N,&M,&X,&Y);
	int xmax=X;
	int ymin=Y;
	for(i=0;i<N;i++){
		scanf("%d",&x[i]);
		if(xmax<x[i])xmax=x[i];
	}
	for(i=0;i<M;i++){
		scanf("%d",&y[i]);
		if(ymin>y[i])ymin=y[i];
	}
	if(xmax<ymin){
		printf("No War");
	}else{
		printf("War");
	}
	return 0;
}

Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader bf = null;
		bf = new BufferedReader(new InputStreamReader(System.in));
		int n,ans = 0,temp = 0;
		int[] h;
		String str;
		String[] s;
		str = bf.readLine();
		n = Integer.parseInt(str);
		h = new int[n];
		str = bf.readLine();
		s = str.split(" ");
		for(int i = 0;i < n;++i) {
			h[i] = Integer.parseInt(s[i]);
			if(h[i] >= temp) {
				temp = h[i];
				ans++;
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 22612
n=int(input())
tensu=[None]*n
tensu=list(map(int,input().split()))
total=0
for i in range(n):
    total+=tensu[i]
a=tensu[0]
i=0
while i<n:
    if a>tensu[i]:
        a=tensu[i]
        i+=1
    else:
        i+=1
b=tensu[0]
i=0
while i<n:
    if b<tensu[i]:
        b=tensu[i]
        i+=1
    else:
        i+=1
print(str(a)+' '+str(b)+' '+format(total))
    


Measured memory_bytes: 6680
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
    ll n;
    cin>>n;
    vector <vector<ll>> dp(n, vector<ll> (3));
    int a, b, c;
    cin>>a>>b>>c;
    dp[0][0] = a;
    dp[0][1] = b;
    dp[0][2] = c;
    
    for(int i = 1; i < n; i++){
        cin>>a>>b>>c;
        dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + a;
        dp[i][1] = max(dp[i - 1][2], dp[i - 1][0]) + b;
        dp[i][2] = max(dp[i - 1][0], dp[i - 1][1]) + c;
    }
    cout<<max({dp[n - 1][0], dp[n - 1][1], dp[n - 1][2]})<<endl;
    return 0;
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(ll i=0; i<n; i++)
#define repr(i, s, e) for(ll i=s; i>=e; i--)
#define reps(i, s, e) for(ll i=s; i<=e; i++)
#define inf 1e18
#define all(v) v.begin(),v.end()
#define vsort(v) sort(v.begin(), v.end())
#define vsortr(v) sort(v.begin(), v.end(), greater<ll>())
#define ok cout << "ok" << endl;
#define sp << " " <<
template<typename T> inline bool chmax(T &a, T b){ if(a<b) a=b; return a<b; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a) a=b; return b<a; }
template<typename T> void vdeb(T v){
    cout << "#vector set debug" << endl;
    for(auto vv : v) cout << vv << " ";
    cout << endl;
}
template<typename T1, typename T2> void adeb(T1 arr[], T2 n){
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}
template<typename T1> void mdeb(T1 mp){
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){ fill((T*)array, (T*)(array+N), val); }
void ans(bool b){ cout << (b ? "Yes" : "No") << endl; }
void ans2(bool b){ cout << (b ? "YES" : "NO") << endl; }
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};


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

    int n;
    vector<ll> a;
    ll tmpa;
    cin >> n;
    n *= 3;
    rep(i, n){
        cin >> tmpa;
        a.push_back(tmpa);
    }

    sort(all(a));
    ll sum = 0;
    for(int i=n-2; i>=n/3; i-=2){
        sum += a[i];
    }

    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 5872
class SegmentTree:
    __slots__ = ('n', 'op', 'tree')

    def __init__(self, seq, op=max):
        self.n = len(seq)
        self.op = op
        self.tree = [-1] * self.n + seq
        for i in reversed(range(1, self.n)):
            self.tree[i] = op(self.tree[2*i], self.tree[2*i+1])

    def modify(self, pos, val):
        assert pos < self.n
        pos += self.n
        self.tree[pos] = val
        while pos > 1:
            self.tree[pos//2] = self.op(self.tree[pos], self.tree[pos ^ 1])
            pos //= 2

    def query(self, L, R):
        assert L <= R and L >= 0 and R <= self.n
        res = 0
        L += self.n
        R += self.n
        while L < R:
            if L % 2 == 1:
                res = self.op(res, self.tree[L])
                L += 1
            if R % 2 == 1:
                R -= 1
                res = self.op(res, self.tree[R])

            L //= 2
            R //= 2

        return res


def solve(n, heights, beauty):
    dp = SegmentTree([0] * (n+1), op=max)
    query = dp.query
    modify = dp.modify

    for flower in range(n):
        pos = heights[flower]
        best = query(0, pos)
        modify(pos, best + beauty[flower])

    return dp.tree[1]


def main():
    n = int(input())
    heights = [int(c) for c in input().split()]
    beauty = [int(c) for c in input().split()]
    ans = solve(n, heights, beauty)
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 121852
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <limits>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

const ll INF = 1000000007;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int pr[100010];
void uini(int n) {
	for (size_t i = 0; i <= n; i++)
	{
		pr[i] = i;
	}
}

int parent(int x) {
	if (x == pr[x]) return x;
	return pr[x] = parent(pr[x]);
}

bool unit(int x, int y) {
	int px = parent(x);
	int py = parent(y);

	if (px == py) return false;
	if (px < py) {
		pr[py] = px;
	}
	else {
		pr[px] = py;
	}
	return true;
}
ll ar[40];
bool use[40];
bool table[40][40];

void solv() {
	
	ll k;
	cin >> k;
	ll a[100010];
	for (size_t i = 0; i < k; i++)
	{
		cin >> a[i];
	}
	if (a[k - 1] != 2) {
		cout << -1 << endl;
		return;
	}
	ll ma = 3;
	ll mi = 2;
	for (int i = k - 2; i >= 0; i--)
	{
		if (a[i] > ma) {
			cout << -1 << endl;
			return;
		}
		if (a[i] < mi) {
			ll tmi = mi;
			mi = a[i] * (mi / a[i]);
			if (tmi > mi) mi += a[i];
			if (mi > ma) {
				cout << -1 << endl;
				return;
			}
			ma = a[i] * ((ma / a[i])) + (a[i] - 1);
		}
		else {
			mi = a[i];
			ma = (a[i] * 2LL) - 1LL;
		}

	}

	cout << mi << " " << ma << endl;
}




int main() {
	solv();

	return 0;
}


Measured memory_bytes: 1152
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from heapq import heapify, heappop, heappush

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
L = LIST()

l = sorted(L)
if l[-1] < sum(l[:-1]):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3900
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = Integer.parseInt(sc.next());
		int B = Integer.parseInt(sc.next());
		sc.close();

		int add = A + B;
		int max = add;
		if(max < A - B) {
			max = A - B;
		}
		if(max < A * B) {
			max = A * B;
		}
		System.out.println(max);
	}
}

Measured memory_bytes: 23636
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <iomanip>
#include <bitset>
#include <string>
#include <stdlib.h>
using namespace std;
//cout <<  << endl;
typedef long long int ll;
typedef long double ld;

int main() {
    ld a,b;
    cin >> a >> b;
    if (a<b){
        cout << "LESS" << endl;
    }else if(a>b){
        cout << "GREATER" << endl;
    }else{
        cout << "EQUAL" << endl;
    }
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n;i >= 0;--i)
#define FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define FI first
#define SE second
#define PB(a) push_back(a)
#define DEBUG(x) cerr << __LINE__ << ":" << #x << ": " << x << "\n";
#define SZ(x) ((int)(x).size())
#define SO(x) sizeof((x)) / sizeof((x)[0])
//#define int long long
using namespace std;
using lint = long long;
struct Fast{Fast(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};} fast;
const int INF = INT_MAX;
const lint LINF = LLONG_MAX;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
inline int in() {int x; cin >> x; return x;}
inline lint IN() {lint x; cin >> x; return x;}
inline void co(int a[], int n) {REP(i, n) cout << a[i] << " "; cout << "\n";}
//if (IO > 1e5){lint a;	scanf(%lld, &a);	printf("%lld\n", a);}

signed main(){
	string n;
	cin >> n;
	REP(i,3){
		if (n[i] == '1'){
			n[i] = '9';
		}else{
			n[i] = '1';
		}
	}
	cout << n << endl;
return 0;
}


Measured memory_bytes: 256
import Data.List
import Control.Monad
main=do
 n<-readLn
 a<-group.sort<$>replicateM n getLine
 m<-readLn
 b<-group.sort<$>replicateM m getLine
 print.maximum$0:(map(\s->(length s)+sum(map(\t->if (head s)/=(head t)then 0 else -length t)b))a)

Measured memory_bytes: 764
a = int(input())
b = input().split(" ")
if int(b[0]) % a == 0:
    print("OK")
elif int(b[1]) % a == 0:
    print("OK")
elif int(b[0]) // a * a + a > int(b[1]):
    print("NG")
else:
    print("OK")

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

int main(){
	int N;
	cin >> N;
	vector<int> A(N);
	for(auto &i:A)cin >> i;
	int ans=1;
	multiset<int> m;
	m.insert(A[0]);
	
	for(int i=1;i<N;i++){
		
		auto it=m.lower_bound(A[i]);
		if(it==m.begin()){
			ans++;
			m.insert(A[i]);
		}
		else{
			it--;
			m.erase(it);
			m.insert(A[i]);
		}
	}
	cout << ans << endl;
	return 0;
}

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

#define LL long long
#define Dl double
#define Pb push_back
#define Po pop_back
#define Mp make_pair
#define Ub upper_bound
#define Lb lower_bound
#define In insert
#define All(x) x.begin(), x.end()
#define mem(a, b) memset(a, b, sizeof(a))
#define fast ios_base::sync_with_stdio(0);cin.tie(0)

using namespace std;

typedef vector<LL> Vl;
typedef vector<Vl> VVl;
typedef pair<LL, LL> Pll;
typedef vector<Pll> Vpl;
typedef queue<LL> Ql;
typedef stack<LL> Sl;
#define X first
#define Y second
#define mx3 1010
#define mx4 10010
#define mx5 100010
#define mx6 1000010

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

    LL w, a, b;
    cin >> w >> a >> b;

    if(b < a)
        swap(a, b);

    a += w;
    b -= a;

    if(b > 0)
        cout << b << '\n';
    else
        cout << 0 << '\n';

    return 0;
}



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

int main() {
    string S, T;
    cin >> S >> T;

    int count = 0;
    for(int i = 0; i < 3; i++){
        if(S[i] == T[i]){
            count++;
        }
    }

    cout << count << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
using ll = long long;

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

int main() {
  int n, r;
  cin >> n >> r;
  int ans;
  if (n >= 10)
    ans = r;
  else
    ans = r + 100 * (10 - n);

  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
import itertools
n = int(input())
xy = [list(map(int,input().split())) for _ in [0]*n]

seq = [i+1 for i in range(n)]
#print(seq)
p_seq = list(itertools.permutations(seq))
#print(p_seq[0][1])

#距離を求める関数。引数はリストのインデックス
def dis(num1,num2):
  d = ((xy[num1][0]-xy[num2][0])**2 + (xy[num1][1]-xy[num2][1])**2)**0.5
  return d

l = len(p_seq)
ans = 0
for i in range(l):
  for j in range(1,n):
    ans += dis(p_seq[i][j-1]-1,p_seq[i][j]-1)
    
print(ans/l)

  
  
  



Measured memory_bytes: 8052
#include <stdio.h>

#define MAXMEMBERS 200000

int main()
{
  int N,t;
  int A[MAXMEMBERS];
  
  scanf("%d\n", &N);
  
  for(int i=0; i<=N; i++)
    A[i]='\0';
  
  for(int i=2; i<=N; i++)
  {
    scanf("%d",&t);
    ++(A[t]);
  }
  for(int i=1; i<=N; i++)
    printf("%d\n", A[i]);
  
  return 0;
  
}


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

int a[11][11];

int main()
{
  int i, j;
  int n;
  
  while (1){
    cin >> n;
    if (n == 0){
      break;
    }
    for (i = 0; i <= n; i++){
      for (j = 0; j <= n; j++){
        a[i][j] = 0;
      }
    }

    for (i = 0; i < n; i++){
      for (j = 0; j < n; j++){
        cin >> a[i][j];
      }
    }

    for (i = 0; i < n; i++){
      for (j = 0; j <= n; j++){
        a[i][n] += a[i][j];
      }
    }
    for (j = 0; j <= n; j++){
      for (i = 0; i <= n; i++){
        a[n][j] += a[i][j];
      }
    }
    for (i = 0; i <= n; i++){
      a[i][n] /= 2;
    }
    for (j = 0; j <= n; j++){
      a[n][j] /= 2;
    }

    for (i = 0; i <= n; i++){
      printf("%5d", a[i][0]);
      for (j = 1; j <= n; j++){
        printf("%5d", a[i][j]);
      }
      cout << endl;
    }
  }
  return 0;
}

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

int main(){
  char b;
  cin>>b;
  if(b=='A'){
    cout<<'T'<<endl;
  }
  else if(b=='T'){
    cout<<'A'<<endl;
  }
  else if(b=='C'){
    cout<<'G'<<endl;
  }
  else if(b=='G'){
    cout<<'C'<<endl;
  }
}


Measured memory_bytes: 3592
#![allow(unused_imports)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_mut)]
use num::integer::gcd;
use proconio::fastout;
use proconio::input;
use proconio::marker::{Bytes, Chars};
use std::f64::consts::PI;
use std::mem::swap;

type Pi = (i32, i32);

fn pri<T: std::fmt::Display>(x: T) {
    println!("{}", x);
}

#[fastout]
fn main() {
    input! {
        n: usize, a:[usize; n-1],
    }
    let mut ans = vec![0; n];
    for num in a {
        ans[num - 1] += 1;
    }
    for e in ans {
        pri(e);
    }
}


Measured memory_bytes: 5552
#include<bits/stdc++.h>
#define inf 0x3f3f3f3f
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef double dd;
const int N = 1e5+5;
const dd eps = 1e-8;
const int mod = 1e9+7;

int n,m,h[N],u,v,vis[N],ans,all;
vector<int> g[N];

int main(){
  ios::sync_with_stdio(false);
  // freopen("input.txt","r",stdin);
  cin>>n>>m;
  all = n;
  memset(vis,1,sizeof(vis));
  for(int i = 1;i <= n;i++) cin>>h[i];
  for(int i = 1;i <= m;i++){
    cin>>u>>v;
    if(h[u] < h[v]) vis[u] = 0;
    else if(h[v] < h[u]) vis[v] = 0;
    else{
      vis[u] = 0;vis[v] = 0;
    }
  }
  for(int i = 1;i <= n;i++) if(vis[i]) ans++;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 6740
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(long long i=0;i<(n);++i)
#define Fr(i,n) for(long long i=1;i<=(n);++i)
#define ifr(i,n) for(long long i=(n)-1;i>=0;--i)
#define iFr(i,n) for(long long i=(n);i>0;--i)
using Graph = vector<vector<int>>;
 
  int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n,k,ans;
  ans=0;
  cin>>n>>k;
  int arr[n];
  fr(i,n){
    int f;
    cin>>f;
    arr[i]=f;
  }
  sort(arr,arr+n);
  fr(i,k){
    ans+=arr[i];
  }
  cout<<ans;
}


Measured memory_bytes: 3668
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#define rep(i,n) for (int i=0;i<n;i++)
using ll = long long;
using namespace std;

void solve(){

}
int gcd(int a,int b){
    if(b==0) return a;
    else return gcd(b,a%b);
}
int main (){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int k;
    cin >> k;
    ll ans=0;
    for(int i=1;i<=k;i++){
        for(int j=1;j<=k;j++){
            for(int v=1;v<=k;v++){
                ans+=gcd(i,gcd(j,v));
            }
        }
    }
    cout << ans;

    return 0;
}

Measured memory_bytes: 3536
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <stack>
#include <iomanip>
#include <queue>
#include <deque>
#include <sstream>
#include <stdio.h>
#include <string>
#include <cmath>
#include <map>
#include <utility>
using namespace std;

#define s(n) scanf("%d",&n)
#define sc(n) scanf("%c",&n)
#define ss(n) scanf("%s",&n)
#define MOD 1000000007
#define ll long long int
#define vi vector<int>
#define vii vector< vector<int> >
#define PI 3.1415926535897932384626433832795

int main() {
	int n;
	cin >> n;
	int count = 0;
	int maxat = 1;
	for(int i = 1; i <= n; i++) {
		int x = i;
		int cc = 0;
		while(x%2 == 0) {
			x/= 2;
			cc++;
		}
		if(cc > count) {
			count = cc;
			maxat = i;
		}
	}
	cout << maxat;
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'
#define all(x) (x).begin(),(x).end()
const int INF=1e9+5;
const int N=3e5+5;
const int mod=1e9+7;

int product[18][1<<18];
int a[1<<18];

vector<pair<int,int>> v[N];
int maps[1<<18];

void add(int par2,int par1,int val){
	if(v[par2].empty()||v[par2].back().first<par1) v[par2].emplace_back(par1,val);
	else{
		v[par2].back().second+=val;
		//~ cout<<par2<<" ~~ "<<par1<<endl;
		if(v[par2].back().second>=mod) v[par2].back().second-=mod;
	}
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int k;
	cin>>k;
	int L=1<<(k-1);
	for(int i=L;i<L+L;++i){
		product[0][i]=i;
		for(int j=1;j<k;++j){
			product[j][i]=(1ll*product[j-1][i]*(i>>j))%mod;
		}
	}
	for(int i=L;i<L+L;++i){
		int x;
		cin>>x;
		a[i]=x+L-1;
	}
	for(int k1=k-1;k1>=0;--k1){
		for(int k2=k-1;k2>=0;--k2){
			for(int i=L;i<L+L;++i){
				int op=a[i];
				int prod=(1ll*product[k1][i]*product[k2][op])%mod;
				int par1=(i>>k1),par2=(op>>k2);
				add(par2,par1,prod);
			}
		}
	}
	//~ for(int i=0;i<L;++i){
		//~ for(pair<int,int> x:v[i]) cout<<x.first<<" ";
		//~ cout<<endl;
	//~ }
	ll ans=0;
	for(int i=1;i<=L;++i){
		int left=i*2;
		int right=i*2+1;
		for(pair<int,int> x:v[right]) maps[x.first]=x.second;
		for(pair<int,int> x:v[left]){
			int num=x.first;
			if(num==1) continue;
			unsigned long long val=(1ll*x.second*maps[num^1])%mod;
			val=(val*i*(num>>1))%mod;
			ans+=val;
		}
		for(pair<int,int> x:v[right]) maps[x.first]=0;
	}
	cout<<ans%mod;
	return 0;
}	


Measured memory_bytes: 271732
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

type ints []int
func (f ints) Len() int {
	return len(f)
}

func (f ints) Less(i, j int) bool {
	return f[i] < f[j]
}

func (f ints) Swap(i, j int) {
	f[i], f[j] = f[j], f[i]
}

func SortInt(x []int) []int {
	i := ints(x[:])
	sort.Sort(i)
	return i
}


func BinarySearch(l []int, key int, isOk func([]int, int, int) bool) (int, int) {
	left := -1
	right := len(l)

	for right - left > 1 {
		mid := left + (right - left) / 2
		if isOk(l, mid, key) {
			right = mid
		} else {
			left = mid
		}
	}

	return left, right
}

func LowerBoundIndex(l []int, key int) int {
	_, right := BinarySearch(l, key, func(l []int, mid int, key int) bool {
		return l[mid] > key
	})
	return right
}

func UpperBoundIndex(l []int, key int) int {
	left, _ := BinarySearch(l, key, func(l []int, mid int, key int) bool {
		return l[mid] >= key
	})
	return left
}

func ZeroOr(x int) int {
	if x < 0 {
		return 0
	}
	return x
}

func main() {
	n := nextInt()
	d := make([]int, n)
	for i := 0; i< n; i++ {
		d[i] = nextInt()
	}
	l := SortInt(d)

	total := 0
	for i := 0; i< n - 2; i++ {
		a := l[i]
		for j := i + 1; j< n -1; j++ {
			b := l[j]
			lower := b - a
			upper := a + b
			lowerI := LowerBoundIndex(l[j+1:n], lower)
			upperI := UpperBoundIndex(l[j+1:n], upper)
			total += ZeroOr(upperI - lowerI + 1)
		}
	}

	fmt.Printf("%d", total)
}


Measured memory_bytes: 640
# https://atcoder.jp/contests/abc095/tasks/arc096_a


# A1枚→A円
# B1枚→B円
# A,B両方一枚→AB円


# もし2AB<=A+Bならmin(X,Y)になるまで買ったほうが安い
# Aだけ必要→A<AB→Aを買う、違うならABを買う
# Bだけ必要→上に同じ

# もし2AB<=A+Bでなかった場合
# A,B<ABの場合→A,Bを個別に買う
# A<2AB の場合→Aは個別で
# この議論は上に統合される

a, b, c, x, y = map(int, input().split())
# 両方買うほうがお得のときは先に買っておく
ans = 0
if 2 * c <= a + b:
    n = min(x, y)
    ans += 2 * n * c
    x -= n
    y -= n

# print(x, y, ans)

# Aだけ買う
if a <= 2 * c:
    ans += x * a
else:
    ans += x * 2 * c

if b <= 2 * c:
    ans += y * b
else:
    ans += y * 2 * c
print(ans)


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

#define COUT(x) cout << #x << " = " << (x) << ", "
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
typedef long long ll;
const int MOD = 1000000007;


bool compare_by_b(pair<int,int> a, pair<int, int> b){
  if(a.second != b.second){
    return a.second < b.second;
  }else{
    return a.first < b.first;
  }
}

int main(){
  int N,M;
  cin >> N >> M;
  vector<pair<int,int>> a(M);
  for(int i = 0; i < M; i++){
    cin >> a[i].first >> a[i].second;
  }
  sort(a.begin(), a.end(), compare_by_b);
  int res = 0;
  int right = -1;
  for(int i = 0; i < M; i++){
    int tmp = a[i].first;
    if(tmp > right){
      res++;
      right = a[i].second - 1;
    }
  }
  cout << res << endl;
}


Measured memory_bytes: 1024
N,M,C = map(int,input().split(' '))
B = list(map(int,input().split(' ')))
A = [input().split(' ') for i in range(N)]
result = 0
for i in range(N):
    ans = 0
    for x in range(M):
        ans = ans + (int(A[i][x]) * B[x])
    if ans + C > 0:
        result = result + 1

print(result)

Measured memory_bytes: 3064
from collections import deque

def main():
    while True:
        n, m = [int(i) for i in input().split()]
        if n == 0 and m == 0:
            return
        _, *a = [int(i) for i in input().split()]
        _, *b = [int(i) for i in input().split()]
        _, *c = [int(i) for i in input().split()]
        a.insert(0, 0)
        b.insert(0, 0)
        c.insert(0, 0)

        q = deque()
        q.appendleft([a, b, c, 0, -1])
        tmp = [i for i in range(0, n+1)]

        while q:
            a, b, c, d, t = q.pop()
            if d > m:
                print(-1)
                break
            if a == tmp or c == tmp:
                print(d)
                break

            if a[-1] > b[-1] and t != 1 and t != 0:
                q.appendleft([a[:-1], b+[a[-1]], c[:], d+1, 0])
            if b[-1] > a[-1] and t != 0 and t != 1:
                q.appendleft([a+[b[-1]], b[:-1], c[:], d+1, 1])
            if b[-1] > c[-1] and t != 3 and t != 2:
                q.appendleft([a[:], b[:-1], c+[b[-1]], d+1, 2])
            if c[-1] > b[-1] and t != 2 and t != 3:
                q.appendleft([a[:], b+[c[-1]], c[:-1], d+1, 3])

if __name__ == '__main__':
    main()


Measured memory_bytes: 6012
#include <iostream>
#include <vector>
#include <algorithm>
#include <cassert>
#include <iomanip>

using namespace std;

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

    int t = (a / c + 1) * (b / d + 1);

    vector<vector<int>> x(a, vector<int>(b, t));

    for (int i = 0; i + c - 1 < a; i += c) {
        for (int j = 0; j + d - 1 < b; j += d) {
            x[i + c - 1][j + d - 1] = -t * (c * d - 1) - 1;
        }
    }

    long long s = 0;

    for (int i = 0; i < a; i++) {
        for (int j = 0; j < b; j++) {
            s += x[i][j];
        }
    }

    if (s <= 0) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;

        for (int i = 0; i < a; i++) {
            for (int j = 0; j < b; j++) {
                cout << x[i][j] << " \n"[j + 1 == b];
            }
        }
    }
}


Measured memory_bytes: 3072
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int num;

		for(;;){
			String str = sc.next();
			if(str.equals("-"))break;
			String[] strArray = str.split("");
			String[] ans = new String[strArray.length];
			//String[] sans = new String[strArray.length];
			int m = sc.nextInt();

			for(int i=0; i<m; i++){
				int h = sc.nextInt();

				for(int j=0; j<strArray.length; j++){
					int add = j + h;
					if(add>=strArray.length){
						num = add - strArray.length;
					}else{
						num = add;
					}
					ans[j]=strArray[num];
				}

				for(int j=0; j<strArray.length; j++){
					strArray[j]=ans[j];
				}
			}
			for(int j=0; j<ans.length; j++){
				System.out.print(ans[j]);
			}
			System.out.println();
		}
	}
}


Measured memory_bytes: 26044
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i = 0; i < (ll)(n); ++i)
#define FOR(i, a, b) for(ll i=(a); i < (ll)(b); ++i)
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;}

int main(){
	string s;
	cin >> s;
	
	int n = (int)s.size();
	int i=n;

	while(i > 0){
		if(i-7 >= 0 && s.substr(i-7,7)=="dreamer"){
			i -= 7;
		}else if(i-5 >= 0 && s.substr(i-5,5)=="dream"){
			i -= 5;
		}else if(i-6 >= 0 && s.substr(i-6,6)=="eraser"){
			i -= 6;
		}else if(i-5 >= 0 && s.substr(i-5,5)=="erase"){
			i -= 5;
		}else{
			cout << "NO\n";
			return 0;
		}
	}
	
	cout << "YES\n";
	
	
	return 0;
}

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

int main() {
    int a, b, c;
    int count = 0;
    cin >> a >> b >> c;

    for (int x = a; x <= b; x++) {
        if (c % x == 0) {
            count++;
        }
    }
    cout << count << endl;

    return 0;
}



Measured memory_bytes: 3084
(let* ((n (read))
       (m (read))
       (l (sort (loop :repeat m :collect (read)) #'>))
       (ll (sort (mapcar #'- l (cdr l)) #'<)))
  (if (<= m n)
      (princ 0)
      (princ (reduce #'+ (subseq ll 0 (- m n))))))

Measured memory_bytes: 59748
#include <iostream>
#include<stack>
#include<cstdlib>
#include<string.h>
#include<string>
using namespace std;

int main()
{
    stack<int> s;
    char c[20];
//    cout<<"Fucking Life!!"<<endl;
    int a,b;
    while(cin>>c){//输入cin>>string类型是以空格为隔断的
 //       cout<<c<<endl;
        if(c[0]=='+'){
            b=s.top();
            s.pop();
            a=s.top();
            s.pop();
            s.push(a+b);
        }
        else if(c[0]=='-'){
            b=s.top();
            s.pop();
            a=s.top();
            s.pop();
            s.push(a-b);
        }
        else if(c[0]=='*'){
            b=s.top();
            s.pop();
            a=s.top();
            s.pop();
            s.push(a*b);
 //           cout<<s.top()<<endl;
        }
        else {
            s.push(atoi(c));
        }

    }
    cout<<s.top()<<endl;
    return 0;
}



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

typedef long long ll;
#define pii pair<int , int>
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAXX 1005

int H , A;

int main()
{
    _FastIO;
    cin >> H >> A;
    cout << (H + A - 1) / A << endl;
    return 0;
}


Measured memory_bytes: 3676
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <queue>
#include <set>

typedef long long ll;

int main(int argc, char* argv[])
{
  ll n;
  std::cin >> n;
  std::priority_queue< ll > que;

  for (ll i = 0; i < n; i++) {
    ll a;
    std::cin >> a;
    que.push(a);
  }

  ll a = 0;
  ll b = 0;
  ll pre_x = -1;
  ll count = 0;
  while (!que.empty()) {
    ll x = que.top();
    //std::cout << pre_x << " " << x << " " << count << std::endl;
    if (x == pre_x) {
      count++;
      if (count == 2) {
	if (a == 0) {
	  a = x;
	} else if (b == 0) {
	  b = x;
	  break;
	}
	count -= 2;
      }
    } else {
      count = 1;
    }

    que.pop();
    pre_x = x;
  }

  std::cout << a * b << std::endl;
  return 0;
}


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

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

    int count = 0;
    for(int i = 1; i < n; i++) {
        if(n - i > i){
            count++;
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
	ll po = 9;
	ll n;
	cin >> n;
	while(1){
		if(po * 10 + 9 <= n){
			po = po * 10 + 9;
		}else{
			break;
		}
	}
	ll yo = 1;
	while(yo <= po) yo *= 10;
	if(po > n){
		cout << n << endl;
	}else{
		while(yo + po <= n) po += yo;
		ll ans = 0;
		while(po){
			ans += po % 10;
			po /= 10;
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 256
N, A, B = map(int, input().split())
if N == 1 and A == B:
    print(1)
    quit()
if N < 2 or A > B:
    print(0)
else:
    AN = A * (N - 1) + B
    BN = A + (N - 1) * B
    print(BN-AN+1)

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

void print(vector<int>& A) {
  cout << A[0];
  for (int i = 1; i < A.size(); i++) {
    cout << ' ' << A[i];
  }
  cout << endl;
}

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  print(A);
  for (int i = 1; i < N; i++) {
    int key = A[i];
    int j = i - 1;
    while (j >= 0 and A[j] > key) {
      A[j+1] = A[j];
      j--;
    }
    A[j+1] = key;
    print(A);
  }
}


Measured memory_bytes: 3088
#include<bits/stdc++.h>
using namespace std;
main(){
  long long n;
  cin>>n;
  for(int i=0;i<n;i++){
    long long s,d;
    cin>>s>>d;
    long long ans=0;
    while(s<d){
      long long n_=1;
      long long next=1;
      while(n_<=d-s){
	if(s%n_==0){
	  next=n_;
	}
	n_*=2;
      }
      s+=next;
      ans++;
    }
    cout<<ans<<endl;
  }
}

Measured memory_bytes: 3068
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();

int main() {
    int A, B, C;
    cin >> A >> B >> C;
    cout << max(0, C-(A-B)) << endl;
    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <list>
#include <algorithm>
#include <set>
#include <queue>
 
using namespace std;
#define ll long long
 
int main()
{
    int t=1;
    //cin>>t;
    while (t--)
    {
        double n;
        scanf("%lf", &n);
        printf("%.6lf\n", 2*3.1416*n);
    }
    
    return 0;
}
/*
 
riaadmorshed@gmail.com
 
*/
/*
4
7 5 3
6 1 1
6 6 1
5 2 2
*/

Measured memory_bytes: 3836
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
using namespace std;  
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;

map<int, int> ma;

int main() {  
  int n, m; cin >> n >> m;
  int wa = 0, ac = 0;
  rep(i, 0, m){
    int p; string s; cin >> p >> s;
    if(s == "WA"){
      if(ma[p] != -1)
      ma[p]++; 
    }
    if(s == "AC"){
      if(ma[p] != -1){
        ac++;
        wa += ma[p];
      }
      ma[p] = -1;
    }
  }
  
  cout << ac << " " << wa << endl;

  return 0;
}


Measured memory_bytes: 4992
module Main where

import Data.List
import Control.Monad
import Debug.Trace
import qualified Data.ByteString.Char8 as BC
import Data.Maybe (fromJust)


readTuple2 :: IO (Int, Int)
readTuple2 = do
    [a, b] <- map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine
    return (a, b)

readTuple3 :: IO (Int, Int, Int)
readTuple3 = do
    [a, b, c] <- map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine
    return (a, b, c)

readInt :: IO Int
readInt = fst . fromJust . BC.readInt <$> BC.getLine

readInts :: IO [Int]
readInts = map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine

split :: (a -> Bool) -> [a] -> [[a]]
split f [] = []
split f as = let
    (fo, la) = span f as
    las = case la of
        [] -> []
        xs -> split f $ tail xs
    in
        case fo of
            [] -> las
            xs -> xs : las
solve :: [Int] -> [Int]
solve as = 
    fst <$> (sortOn snd $ zip [1..] as)


divMax :: Int -> Int -> (Int, Int)
divMax a b = go a 0 where
    go acc n = let
        (x, y) = acc `divMod` b
        in
            if y == 0 then go x (n + 1) else (acc, n)

primeNums :: Int -> [(Int, Int)]
primeNums a = if last == 1 then reverse primeList else reverse $ (last, 1) : primeList where
    findMax = floor . sqrt . fromIntegral $ a
    go (acc, lst) divisor = 
        let
            (dividedNum, count) = acc `divMax` divisor
        in
            if count == 0 then (acc, lst) else (dividedNum, (divisor, count) : lst)
    (last, primeList)  = foldl' go (a, []) [2..findMax]
    
main = do
    (a, b) <- readTuple2
    print $ (+1) . length $ intersect (fst <$> primeNums a) (fst <$> primeNums b)

Measured memory_bytes: 892
#include<stdio.h>
int main()
{
    int a,b,c;
    //char s[101];
    // スペース区切りの整数の入力
    scanf("%d %d",&b,&c);

    if(b<=8 && c <= 8) {
    	printf("Yay!\n");
    } else {
    	printf(":(\n");    
    }

    return 0;
}

Measured memory_bytes: 128
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define PB push_back
#define MP make_pair
#define ll long long

inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}

int main(){
    std::ios::sync_with_stdio(false);
    string s;
    cin >> s;
    bool ret = true;
    for(int i=0;i<s.length();++i)
    {
        if((i%2) == 0)
        {
            if(s[i] != 'h') ret = false;
        }
        else
        {
            if(s[i] != 'i') ret = false;
        }
    }
    if((s.length() % 2) == 1) ret = false;
    if(ret)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
N = int(input())

a = list(map(int, input().split()))

ans = False
b = [0]*N


for i in range(N, 0 ,-1):
    b_sum = 0
    for j in range(i, N+1, i):
        b_sum += b[j-1]
    if b_sum % 2 != a[i-1]: b[i-1] = 1
if b==[0]*N:print(0)      
else:
    print(sum(b))
    print(*[k+1 for k, l in enumerate(b) if l==1])

Measured memory_bytes: 71516
l = list(map(int, input().split()))
l_2 = list(i % 2 for i in l)
cnt = 0
##偶奇そろえて
for r in (0, 1):
    if l_2.count(r) == 2:
        cnt += 1
        for i in range(len(l)):
            if l[i] % 2 == r:
               l[i] += 1
##全体からmaxを引いたものを正負反転して/2
##print(cnt)
l_d = list(abs(i - max(l)) // 2 for i in l)
##print(l)
##print(l_d)
cnt += sum(l_d)
print(cnt)
    

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

#define fast ios::sync_with_stdio(0); cin.tie(NULL); 
#define fi first
#define se second
#define mp make_pair
#define pi 3.14159265359
#define MOD 1000000007
typedef long long ll;
#define mp make_pair
#define ALL(v) v.begin(), v.end() 
#define F(i,s,n) for(i=s;i<n;++i)
#define pb push_back
#define tin freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
ll max(ll a,ll b)
{
    return a*(a>=b)+b*(b>a);
}
/*----------------------------------------------------------*/

void solve()
{
	ll n;cin>>n;vector<ll>a(n),dp(n);
  	for(auto &i:a)cin>>i;
  	if(n==1){cout<<"0";return;}
  	dp[0]=0;dp[1]=abs(a[1]-a[0]);
  	for(ll i=2;i<n;++i)
    {
      dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
    }
  cout<<dp[n-1];
}

int main()
{
    //tin
    fast
    ll tc=1;//cin>>tc;
   for(ll i=1;i<=tc;++i)
   {
    //cout<<"Case #"<<i<<": ";
    solve();
    if(i!=tc)cout<<"\n";
   }
return 0;
}
//End-Cases
//Precomputation
//Segmentation Fault
//Complexity
//Break it up
//Sub Problems


Measured memory_bytes: 4764
//Ruthless Coding 
#include <bits/stdc++.h>

#define uni(x)      (x).resize(unique(ALL(x)) - (x).begin())
#define fprint(v)   for(auto x : v) cout << x << ' '
#define ALL(x)      (x).begin(), (x).end()
#define MP(x, y)    make_pair(x, y)
#define SZ(x)       int((x).size())
#define PB(x)       push_back(x)
#define ll          long long
#define S           second 
#define F           first
#define nl          '\n'

using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
mt19937_64 rnd;

const int N = 2e5 + 5;

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    ll n, k;
    cin >> n >> k;
    vector<int> a(n + 1, 0);
    for(int i = 1; i <= n; i++){
        cin >> a[i];
    }
    vector<int> vis(n + 1, 0), dis(n + 1, 0);
    int idx = 1;
    int len = 0;
    while(vis[idx] == 0){
        vis[idx] = 1;
        dis[idx] = len;
        idx = a[idx];
        len++;
    }
    int cycleS = idx; // start cycle node
    int cycleL = len - dis[cycleS];
    if(k - dis[cycleS] < 0){
        int pos = 1;
        while(k--){
            pos = a[pos];
        }
        cout << pos;
    }else{
        k -= dis[cycleS];
        ll L = cycleL;
        k = k % L;
        int pos = cycleS;
        while(k--){
            pos = a[pos];
        }
        cout << pos;
    }
    return 0;
}
/*
    *** Most Impo.. -> check base case always
    1. Overflow Check (*, +)
    2. Index check (0 - based or 1 - based)
    3. Check for n = 1, 2, 3, 4....
    4. Corner Cases
*/

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

int main(void){
  int n;
  cin >> n;
  
  vector<int> weight(n);
  
  for (int i = 0; i < n; i++) {
    cin >> weight.at(i);
  }
   int ansAbsValue = 200000;
 
  for (int t = 0; t < n-1; t++ ){
    int s1 = 0;
    for (int i = 0; i<= t; i++) {
      s1 += weight.at(i);
    }
    
    int s2 = 0;
    for (int j = t + 1; j < n; j++) {
      s2 += weight.at(j);
    }
    
    if (abs(s1-s2) < ansAbsValue) {
      ansAbsValue = abs(s1-s2);
    }
  }
    
  cout << ansAbsValue << endl;
   
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<map>
using namespace std;
int main() {
  long long n,a[10000]={},b[10000]={},cnta=0,cntb=0;
  cin >> n;
  for(int i=0; i<n; i++) {
    cin >> a[i];
  }
  for(int i=0; i<n; i++) {
    cin >> b[i];
    if(a[i]>b[i]) {
      cntb+=a[i]-b[i];
    }
    else {
      cnta+=(b[i]-a[i])/2;
    }
  }
  if(cnta>=cntb) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 384
#include <stdio.h>
#include<string.h>
 
 
int main(void){
    char a[200];
    char b[100];
    char *d;
    int i,j,k;
    int c = 0;
    int ans = 0;
    scanf("%s",a);
    scanf("%s",b);
 
    for (i = 0;a[i] != '\0';i++);
while(c != i){
  if (strcmp(a,b) == 0){
      ans = 1;
      break;
  }
   else {
        d = b[0];
       for(j=0;j<i-1;j=j+1){
       b[j] = b[j+1];
        }
        b[i-1]=d;
        c = c+1;
   }
}
 
 
 
if (ans == 1){
    printf("Yes");
}
else printf("No");
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

ll pw(ll n, ll a) {
	if (a == 0) return 1;
	else return n * pw(n, a - 1);
}

ll dfs(int n) {
	if (n == 0) return 1;
	else {
		ll t = dfs(n - 1);
		return 1 + t + 1 + t + 1;
	}
}

ll dfs2(int n, ll i) {
	if (n == 0) {
		return 1;
	}
	ll sum = dfs(n);
	if (i <= 1) return 0;
	else if (i < sum / 2 + 1) return dfs2(n-1, i-1);
	else if (i == sum / 2 + 1) return 1 + dfs2(n-1, i-2);
	else return (pow(2ll, (ll) n + 1) - 1) - dfs2(n, sum - i);
}

void solve() {
	int n;
	ll x;
	cin >> n >> x;
	cout << dfs2(n, x) << endl;
	
}

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

Measured memory_bytes: 4100
#include<stdio.h>
int main(void){
  int a,b,c;
  scanf("%d",&a);
  scanf("%d",&b);
  scanf("%d",&c);
  if(b-a*c>=0){
    printf("%d",c);
  }
  else{
    printf("%d",b/a);
  }
  return 0;
}
    
  


Measured memory_bytes: 128