akhauriyash/Code-Regression huggingface dataset:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Tarek
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        AAC solver = new AAC();
        solver.solve(1, in, out);
        out.close();
    }

    static class AAC {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            String s = in.next();
            if (s.equals("ABC")) {
                out.println("ARC");
            } else out.println("ABC");
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

    }
}



Measured memory_bytes: 32652
N, M = map(int, input().split())
xyz = [[int(i) for i in input().split()] for _ in range(N)]

ret = -float('inf')
for i in [-1, 1] :
    for j in [-1, 1] :
        for k in [-1, 1] :
            ret = max(ret, sum(sorted([x * i + y * j + z * k for x, y, z in xyz])[N-M:]))
            
print(ret)

Measured memory_bytes: 40176
#include <stdio.h>
#define MAX 2000000

void CountingSort(int);

int A[MAX+1], B[MAX+1], C[10000+1], n;

int main() {
  int i;

  scanf("%d", &n);
  for ( i = 1; i <= n; i++ ) scanf("%d", &A[i]);


  CountingSort(10000);

  for ( i = 1; i <= n; i++ ) {
    printf("%d", B[i]);
    if ( i < n ) printf(" ");
  }
  printf("\n");

  return 0;
}

void CountingSort(int k) {
  int i, j;

  for ( i = 0; i <= k; i++ ) C[i] = 0;

  for ( j = 1; j <= n; j++ ) C[A[j]]++;

  for ( i = 1; i <= k; i++ ) C[i] = C[i] + C[i-1]; 

  for ( j = n; j >= 1; j-- ) {
    B[C[A[j]]] = A[j];
    C[A[j]]--;
  }

}

Measured memory_bytes: 16264
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<queue>
#include<map>
using namespace std;                       
typedef long long ll;
 int main()
 {  ll  n,t=100,sum=0;
    ll t1=0;
    cin>>n;
    while(t<n)
    {  t=t*1.01;
       sum++;
	}
	cout<<sum<<endl;

}

Measured memory_bytes: 3636
class Dice:
    same_dice_index = ('123456', '135246', '142536', '154326',
                       '214365', '231645', '246135', '263415',
                       '312564', '326154', '351624', '365214',
                       '415263', '421653', '456123', '462513',
                       '513462', '536142', '541632', '564312',
                       '624351', '632541', '645231', '653421')
 
    def __init__(self, num_list):
        self.faces = num_list
 
    def is_same(self, dice):
        for i in Dice.same_dice_index:
            example_faces = []
            for j in i:
                example_faces.append(self.faces[int(j) - 1])
            if example_faces == dice.faces:
                return 'Yes'
        return 'No'
 
num_list1 = list(map(int, input().split()))
num_list2 = list(map(int, input().split()))
 
dice1 = Dice(num_list1)
dice2 = Dice(num_list2)
 
ans = dice1.is_same(dice2)
 
print(ans)

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

struct node{
    int parent;
    int left;
    int right;
    int degree;
    int depth;
    int height;
    node(){
        parent = -1;
        left   = -1;
        right  = -1;
        degree = -1;
        depth  = -1;
        height = -1;
    }
};

class tree{
private:
    int n;
public:
    vector<node> T;
    tree(int n_in){
        n = n_in;
        T.resize(n);
    }
    int find_root(){
        for (int i = 0; i < T.size(); i++) {
            if (T[i].parent == -1) return i;
        }
    }

    void calc_depth(int id, int depth){
        if (id == -1) return;
        T[id].depth = depth;
        calc_depth(T[id].left , depth + 1);
        calc_depth(T[id].right, depth + 1);
    }

    int calc_height(int id){
        if (id == -1) return -1;
        int left_height  = calc_height(T[id].left) + 1;
        int right_height = calc_height(T[id].right) + 1;
        return T[id].height = max(left_height, right_height);
    }

    int find_sibling(int id) {
        int p = T[id].parent;
        if (p == -1) return -1;
        if (T[p].left  == id) return T[p].right;
        if (T[p].right == id) return T[p].left ;
    }

    string return_type(int id) {
        if (T[id].parent == -1) return "root";
        if (T[id].left == -1 && T[id].right == -1) return "leaf";
        return "internal node";
    }
};


int main(){
    int n;
    cin >> n;
    tree Tree(n);
    for (int i = 0; i < n; i++) {
        int id, left, right;
        cin >> id >> left >> right;
        Tree.T[id].left      = left;
        Tree.T[id].right     = right;
        Tree.T[left].parent  = id;
        Tree.T[right].parent = id;
    }
    int root = Tree.find_root();
    Tree.calc_depth(root, 0);
    Tree.calc_height(root);

    for (int i = 0; i < n; i++) {
        cout << "node " << i << ": parent = " << Tree.T[i].parent;
        cout << ", sibling = " << Tree.find_sibling(i);
        cout << ", degree = ";
        cout << (Tree.T[i].left != -1) + (Tree.T[i].right != -1);
        cout << ", depth = " << Tree.T[i].depth;
        cout << ", height = " << Tree.T[i].height;
        cout << ", " << Tree.return_type(i) << endl;
    }
    return 0;
}

Measured memory_bytes: 3140
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
/************************************************/
#define rep(i,n) for(int i=0;i<n;i++)
#define m_p make_pair
#define pb push_back
#define fr first
#define se second
#define forn(i,a,n) for(int i=a;i<n;i++)
#define foreach(i,c) for(__typeof(c.begin())i=(c.begin());i!=(c).end();i++)
#define pii pair<int,int>
#define vi vector<int>
#define ll long long
#define sz(s) s.size()
#define all(s) s.begin(),s.end()
#define zero(x) memset(x,0,sizeof(x))
#define vii vector<pair<int,int> >
#define mpis map<int,string>
#define mpii map<int,int>
#define mpsi map<string,int>
#define re return
#define mod 1000000007
/************************************************/
using namespace std;

long long get(){
	char c=getchar();
	long long x=0LL;
	while(c<'0'||c>'9')
	c=getchar();
	while(c>='0'&&c<='9'){
		x*=10LL;
		x+=(c-'0');
		c=getchar();
	}
	return x;
}
ll ans;
int n;
int main(){
	ios::sync_with_stdio(0);
	cin>>n;
	forn(i,1,n+1){
		if(i%3!=0&&i%5!=0)
		ans+=i;
	}
	cout<<ans;
	re 0;
}

Measured memory_bytes: 3648
import math
import numpy

a,b,h,m = map(int, input().split())

hun = h * 60 + m

p = numpy.array([a*math.cos(hun*math.pi/30), a*math.sin(hun*math.pi/30)])
q = numpy.array([b*math.cos(hun*math.pi/360), b*math.sin(hun*math.pi/360)])
u = p-q

print(numpy.linalg.norm(u))

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

int dp[2002][12];
int N,K;
vector<int> vs[12];
vector<int> rs[12];

int solve(int num,int k){
  if( dp[num][k] != -1 ) return dp[num][k];
  if( num == K ) return dp[num][k] = 0;
  if( k == 10 ) return dp[num][k] = 0;
  int ret = 0;
  for(int i=0;i<rs[k].size();i++){
    if( num + i > K ) break;
    ret = max( solve( num + i , k+1) + rs[k][i] + ((i>0)?(i-1)*i:0), ret );
  }
  return dp[num][k] = ret;
}

int main(){
  memset(dp,-1,sizeof(dp));
  cin >> N >> K;
  for(int i=0;i<N;i++){
    int c,g;
    cin >> c >> g;
    g--;
    vs[g].push_back(c);
  }
  for(int i=0;i<10;i++) {
    rs[i] = vector<int>(vs[i].size()+1,0);
    sort(vs[i].rbegin(),vs[i].rend());
    for(int j=0;j<(int)vs[i].size();j++){
      rs[i][j+1] = rs[i][j] + vs[i][j];
    }
  }
  cout << solve(0,0) << endl;
}

Measured memory_bytes: 1344
n=int(input())
S=input().split()

s=list(S)

for i in range(n):
    s[i]=int(s[i])
#print(s)

def ikeruka(s):
    sum=0
    for i in range(len(s)):
        if s[i]==1:
            sum+=1

    if sum>=1:
        return True
    else:
        return False

#print(ikeruka(s))

if ikeruka(s):

    #j  blocknumber
    #l
    j=0
    l=1
    while j<=n-1:
        if s[j]==l:
            l+=1
            j+=1

            if j>n:
                break
            
        else:
            j+=1

    print(n-l+1)

else:
    print(-1)
    


Measured memory_bytes: 25716
object Main extends App {
  // The size of Int is enough since 2 <= x <= 10^8
  def isPrime(x: Int): Boolean = x match {
    case 1 => false
    case 2 => true
    case _ if x % 2 == 0 => false
    case _ =>
      val upperLimit = scala.math.sqrt(x).toInt
      3.to(upperLimit, 2).view.forall(x % _ != 0)
  }


  val num = scala.io.StdIn.readLine().toInt
  val candidates = for (i <- 0 until num) yield scala.io.StdIn.readLine().toInt
  println(candidates.filter(isPrime).size)
}

Measured memory_bytes: 78812
#include <iostream>
using namespace std;
int main(void){
    int N, X, Y;
    cin >> N >> X >> Y;
    
    
    int root1Length = X + ((Y-X))/2 + ((Y-X)%2);
    //cout << "root1" << root1Length << endl;
    int root2Length = ((Y-X))/2 + ((Y-X)%2) + (N-Y) + 1;
    //cout << "root2" << root2Length << endl;
    int root3Length = Y - X + 1;
    //cout << "root3" << root3Length << endl;
    int root4Length = N - root3Length + 2;
    
    for(int k = 1; k <= N-1; k++){
        //cout << ":" << k << ":" << endl;
        int root1Count = max(min(X - 1, root1Length - k), 0) * 2 - max(X - k, 0);
        if((Y-X)%2 == 1 && root1Length - k <= X - 1 && root1Count != 0){
            root1Count --;
        }
        //cout << "root1:"  << root1Count << endl;
        int root2Count = max(min(N - Y, root2Length - k), 0) * 2 - max(N - Y + 1 - k, 0);
        if((Y-X)%2 == 1 && root2Length - k <= N - Y && root2Count != 0){
            root2Count --;
        }
        //cout << "root2:" << root2Count << endl;
        int root3Count = 0;
        if(root3Length > k * 2){
            root3Count = root3Length;
        }else if(root3Length == k * 2){
            root3Count = root3Length / 2;
        }else{
            root3Count = 0;
        }
        //cout << "root3:" << root3Count << endl;
        int root4Count = 0;
        
        if(X != 0 && Y != N && k <= root4Length){
            root4Count = min(min(min(X - 1, N - Y), root4Length - k), k - 2);
        }
        
        if(root4Count < 0){
            root4Count = 0;
        }
        //cout << "root4:" << root4Count << endl;
        cout << root1Count + root2Count + root3Count + root4Count << endl;
    }
    
    
}


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

int main(){
  long long Q,H,S,D,N;
  cin >> Q >> H >> S >> D >> N;
  long long min1=min({Q*4,H*2,S});
  long long min2=min({Q*8,H*4,S*2,D});
  cout << (N/2)*min2+(N%2)*min1 << endl;
}

Measured memory_bytes: 256
import java.io.PrintWriter

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = nextList().map(String::toInt)
fun nextLongList() = nextList().map(String::toLong)
fun nextDoubleList() = nextList().map(String::toDouble)

val pw = PrintWriter(System.out)
fun print(s: Any = "") = pw.print(s)
fun println(s: Any = "") = pw.println(s)

fun <T> Iterable<T>.join(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "") = joinToString(separator, prefix, postfix)
fun <T> Array<T>.join(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "") = joinToString(separator, prefix, postfix)

fun main(args: Array<String>) {
    main()
    pw.flush()
}

fun main() {
    val N = nextLong()
    var ans = keta(N)
    for (a in 2..100000) {
        if (N % a != 0L) continue
        val b = N / a
        if (a > b) break
        if (ans > keta(b)) ans = keta(b)
    }
    println(ans)
}

fun keta(v: Long) = v.toString().length

Measured memory_bytes: 33336
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i ,n) for(int i = 0 ; i < (n) ; i ++ )
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using vin=vector<int>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;

int main() {
  ll n,a,b,c,d,e;
  cin>>n>>a>>b>>c>>d>>e;
  ll mn;
  mn=min(a,b);
  mn=min(min(c,d),min(mn,e));
  ////////////
  if(mn>n){
    cout<<5<<endl; 
  }
  else{
    ll ans=0;
    ans+=5;
    ans+=(n-1)/mn;
    cout<<ans<<endl;
  }
}

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

public class Main {
    void run() {
        while (true) {
            int n = readInt();
            if (n == 0) break;
            int y = readInt();
            double mMax = 0;
            int idMax = -1;
            for (int i = 0; i < n; i++) {
                int b = readInt();
                int r = readInt();
                int t = readInt();
                double m;
                if (t == 1) {
                    m = 1 + 1.0 * y * r / 100;
                } else {
                    m = Math.pow(1 + 1.0 * r / 100, y);
                }
                if (mMax < m) {
                    mMax = m;
                    idMax = b;
                }
            }
            sysout.println(idMax);
        }
    }

    public static void main(String[] args) {
        new Main().run();
    }

    // flush automatically iff you call `println` or `printf` or `format`.
    PrintWriter sysout = new PrintWriter(System.out, true);

    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer buffer = new StringTokenizer("");

    String read() {
        if (!buffer.hasMoreTokens()) {
            try {
                buffer = new StringTokenizer(in.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return buffer.nextToken();
    }

    int readInt() {
        return Integer.parseInt(read());
    }

    long readLong() {
        return Long.parseLong(read());
    }

    double readDouble() {
        return Double.parseDouble(read());
    }

    String readLine() {
        buffer = new StringTokenizer("");
        try {
            return in.readLine();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}

Measured memory_bytes: 24872
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<ctime>
#include<map>
#include<bitset>
#include<set>
#define LL long long
#define mp(x,y) make_pair(x,y)
#define pll pair<long long,long long>
#define pii pair<int,int>
using namespace std;
inline int read()
{
	int f=1,x=0;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int stack[20];
template<typename T>inline void write(T x)
{
	if(x<0){putchar('-');x=-x;}
    if(!x){putchar('0');return;}
    int top=0;
    while(x)stack[++top]=x%10,x/=10;
    while(top)putchar(stack[top--]+'0');
}
template<typename T>inline void pr1(T x){write(x);putchar(' ');}
template<typename T>inline void pr2(T x){write(x);putchar('\n');}
const int MAXN=100005;
struct edge{int x,y,c,next;}a[2*MAXN];int len,last[MAXN];
void ins(int x,int y,int c){len++;a[len].x=x;a[len].y=y;a[len].c=c;a[len].next=last[x];last[x]=len;}
int tot[MAXN];LL ans;
int n,G,f[MAXN],mn;
void dfs(int x,int fa,LL up)
{
	tot[x]=1;f[x]=0;
	for(int k=last[x];k;k=a[k].next)
	{
		int y=a[k].y;
		if(y!=fa)dfs(y,x,a[k].c),tot[x]+=tot[y],f[x]=max(f[x],tot[y]);
	}
	ans+=2LL*up*min(tot[x],n-tot[x]);
	f[x]=max(f[x],n-tot[x]);
	if(!G||f[x]<f[G])G=x;
}
int main()
{
	n=read();
	for(int i=1;i<n;i++)
	{
		int x=read(),y=read(),c=read();
		ins(x,y,c);ins(y,x,c);
	}
	dfs(1,0,0);mn=(1LL<<31-1);int cnt=0;
	for(int i=1;i<=n;i++)if(f[i]==f[G])++cnt;
	if(cnt==1)for(int k=last[G];k;k=a[k].next)mn=min(mn,a[k].c);
	else for(int k=last[G];k;k=a[k].next)if(f[a[k].y]==f[G])mn=a[k].c;
	pr2(ans-mn);
	return 0;
}


Measured memory_bytes: 9728
import math
import sys
from operator import itemgetter

# N, K = map(int, input().split())
# h = list(map(int, input().split()))
# S = [input() for _ in range(H)]
# X = [[0 for j in range(100)] for i in range(200)]

# if __name__ == '__main__':


rt1 = list(map(int, input().split()))
rt2 = list(map(int, input().split()))
rt3 = list(map(int, input().split()))

for r in rt1:
	if (r in rt2) and (r in rt3):
		print("NO")
		sys.exit()
print("YES")



Measured memory_bytes: 3060
n,x = map(int,input().split())
a = list(map(int,input().split()))
a_sorted = sorted(a)
total = 0
happy = 0
for v in a_sorted[:-1]:
  total += v
  if total <= x:
    happy += 1 
if sum(a) == x:
  happy = len(a)
print(happy)

Measured memory_bytes: 3060
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
   int n;
   cin >> n;
   if(n == 1 ||
      n == 2 ||
      n == 3 ||
      n == 5 ||
      n == 6 ||
      n == 9 ||
      n == 10 ||
      n == 13 ||
      n == 17 ||
      n == 25){
          cout << "No" << endl;
      }
      else{
          cout << "Yes" << endl;
      }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long a, b, c, k;
int main()
{
	cin >> a >> b >> c >> k;
	while (k--)
	{
		if (b <= a)b *= 2;
		else if (c <= b)c *= 2;
	}
	if (b <= a || c <= b)cout << "No";
	else cout << "Yes";
}


Measured memory_bytes: 3612
#include <iostream>
using namespace std;
typedef long long ll;
const int maxn = 5e5 + 5;
const ll mod = 1e9 + 7;
ll fac[maxn], inv[maxn];
ll qpow(ll a, ll b)
{
	ll res = 1;
	while (b)
	{
		if (b & 1)
		{
			res *= a;
			res %= mod;
		}
		a *= a;
		a %= mod;
		b /= 2;
	}
	return res % mod;
}
ll C(ll m, ll n)
{
	ll ans = fac[m];
	ans = ans * inv[m - n] % mod;
	ans = ans * inv[n] % mod;
	return ans;
}
ll A(ll m, ll n)
{
	ll ans = fac[m];
	ans = ans * inv[m - n] % mod;
	return ans;
}
int main()
{
	ll n, m, ans = 0;
	cin >> n >> m;
	fac[0] = 1;
	for (ll i = 1; i <= m; i++)
	{
		fac[i] = i * fac[i - 1];
		fac[i] %= mod;
	}
	inv[m] = qpow(fac[m], mod - 2);
	for (ll i = m - 1; i >= 0; i--)
	{
		inv[i] = inv[i + 1] * (i + 1);
		inv[i] %= mod;
	}
	for (ll i = 0; i <= n; i++)
	{
		ll temp = C(n, i) * A(m, i) % mod;
		temp = temp * qpow(A(m - i, n - i), 2) % mod;
		if (i % 2)
			temp = -temp;
		temp = (temp % mod + mod) % mod;
		ans = (ans + temp) % mod;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 11344
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
typedef long long int ll;
typedef unsigned long long int ull;
#define deb(x) cout << #x << " => " << x << endl
using namespace std;
using namespace boost::multiprecision; 

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

    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    vector<bool> dp(k + 1);
    for (int i = 0; i <= k; i++) {
        for (auto x : a) {
            if (i >= x and !dp[i - x]) {
                dp[i] = true;
            }
        }
    }

    cout << (dp[k] ? "First" : "Second") << endl;

    return 0;
}

Measured memory_bytes: 384
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;


public class Main {
	
	public static void main(String[] args) throws Exception {
		
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        String str = br.readLine();
        int n = Integer.parseInt(str);
        String box[] = new String[n];
        for(int i = 0;i<n;i++){
        	box[i] = br.readLine();
        }
        Arrays.sort(box);
        for(int i = 0;i<n;i++){
   		// System.out.println(box[i]);
        }
       
         int boxnum = box.length;
         
         for(int i=0;i<box.length-1;i++){
    	//	 System.out.println("Hello");
    	//	 System.out.println("Heey" + box[i] + box[i+1]);
        	 if(box[i].equals(box[i+1])){
        		 boxnum--;
        	//	 System.out.println("Hi,I'm" + i);
        	 }	 
         }
        System.out.println(boxnum);
        
        
}
}


Measured memory_bytes: 22612
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cstring>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
using namespace std;
#define INT(x) int x; scanf("%d",&x)
#define INPUT(x) scanf("%d",&x)
#define REP1(x,n) for(int x = 0; x < n; x++)
#define REP2(x,s,e) for(int x = s; x <= e; x++)
#define RREP1(x,n) for(int x = n-1; x >= 0; x--)
#define RREP2(x,s,e) for(int x = s; x >= e; x--)
#define BR printf("\n")
#define INF 2000000000

typedef long long ll;

int main(){
    INT(N);INT(A);INT(B);
    char s[100001];
    cin >> s;
    int len = strlen(s);
    
    int sanka = 0;
    int BBrank = 1;
    REP1(i,len){
        if (s[i] == 'a') {
            if (sanka < A+B) {
                cout << "Yes";
                sanka++;
            }else{
                cout << "No";
            }
        }else if(s[i] == 'b'){
            if (sanka < A+B && BBrank <= B) {
                cout << "Yes";
                sanka++;
                BBrank++;
            }else{
                cout << "No";
                BBrank++;
            }
        }else{
            cout << "No";
        }
        cout << endl;
    }
    
    return 0;
}

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

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

    if ((a+b) % 2 == 0) {
        cout << (a+b) / 2 << endl;
    } else {
        cout << "IMPOSSIBLE" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll>pii;
typedef vector<int>vi;

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define fi first
#define se second
#define de(x) cout<<#x<<"="<<x<<"\n"
#define dd(x) cout<<#x<<"="<<x<<" "
#define pb(x) push_back(x)
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define lowbit(a) ((a)&-(a))
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
const int N=2e3+5;
const ll mod = 1e9 +7;
int n,m;
int ans[N][N],s[N][N];
int sub(int x,int y){
	int ss = 0;
	if(x > 0)ss += s[x-1][y];
	if(y > 0)ss += s[x][y-1];
	if(x >0 && y > 0)ss -= s[x-1][y-1];
	ss = (ss%2 + 2)%2;
	return ss;
}
int main()
{
	cin>>n>>m;
	int mx = max(n,m);
	int len = (1<<mx);
	ans[1][1] = s[1][1] = 1;
	for(int i = 4;i<=len;i*=2){
		for(int j = 0;j < i/2;j++){
			for(int k = 0;k<i/2;k++){
				s[j + i/2][k] = s[j][k +  i/2] = s[j][k];
				s[j + i/2][k + i/2] = (s[j][k] + 1)%2;
			}
		}
		for(int j = 0;j < i/2;j++){
			for(int k = 0;k<i/2;k++){
				ans[j][k + i/2] = (s[j][k + i/2] - sub(j,k + i/2) + 2)%2;
				ans[j + i/2][k] = (s[j + i/2][k] - sub(j + i/2,k) + 2)%2;
				ans[j + i/2][k + i/2] = (s[j + i/2][k + i/2] - sub(j + i/2,k + i/2) + 2)%2;
				
			}
		}
	}
	rep(i , 1 , (1<<n)){
		rep(j , 1 , (1<<m)){
			cout<<ans[i][j];
		}
		cout<<"\n"; 
	}
	return 0;	
}



Measured memory_bytes: 19712
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const long double EPS=1e-9;
const long double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
long double ABS(long double a){return max(a,-a);}
int p[110000];
vector<int>g[210000];
int A[110000];
int B[110000];
int w[110000];
long long UF[210000];
int at[110000];
long long FIND(int a){if(UF[a]<0)return a;return UF[a]=FIND(UF[a]);}
void UNION(int a,int b){a=FIND(a);b=FIND(b);if(a==b)return;UF[a]+=UF[b];UF[b]=a;}
pair<int,pair<int,int> > edge[110000];
int lab[210000];
int cur;
int num[210000];
long long SZ[210000];
int N;
void dfs(int a,int b,long long c){
	if(a<N){
		num[a]=b;
		if(c!=-1)SZ[a]=c;
	}
	if(b==-1&&lab[a]){
		b=a;
		c=SZ[a];
	}
	for(int i=0;i<g[a].size();i++){
		dfs(g[a][i],b,c);
	}
}
int main(){
	int a,b;scanf("%d%d",&a,&b);N=a;
	for(int i=0;i<a;i++)scanf("%d",p+i);
	for(int i=0;i<b;i++){
		scanf("%d%d%d",A+i,B+i,w+i);A[i]--;B[i]--;
		edge[i]=make_pair(w[i],make_pair(A[i],B[i]));
	}
	std::sort(edge,edge+b);
	for(int i=0;i<a;i++)UF[i]=-p[i];
	for(int i=0;i<a;i++)at[i]=i;
	int sz=a;
	for(int i=0;i<a;i++){
		SZ[i]=p[i];
	}
	for(int i=0;i<b;i++){
		if(FIND(edge[i].second.first)==FIND(edge[i].second.second))continue;
		int left=FIND(edge[i].second.first);
		int right=FIND(edge[i].second.second);
		g[sz].push_back(at[left]);
		g[sz].push_back(at[right]);
		UNION(left,right);

	//	printf("%d: %d %d, ",sz,at[left],at[right]);
		at[left]=sz;
		SZ[sz]=-UF[left];
		if(-UF[left]>=edge[i].first){
			lab[sz]=1;
		}
	//	printf("%d\n",lab[sz]);
		sz++;
	}
	dfs(sz-1,-1,-1);
	int ret=b;
	for(int i=0;i<b;i++){
		if(num[A[i]]==num[B[i]]&&w[i]<=SZ[A[i]])ret--;
	}
	printf("%d\n",ret);
}

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

int main() {
    int N;
    int cnt = 0;
    cin >> N;
    int A[N];
    for(int i = 0; i < N; i++)
        cin >> A[i];
    int flag = 1;
    while (flag)
    {
        flag = 0;
        for(int i = N - 1; i >= 1; i--)
        {
            if(A[i] < A[i - 1])
            {
                swap(A[i], A[i - 1]);
                cnt++;
                flag = 1;
            }
        }
    }
    for(int i = 0; i < N; i++)
    {
        if(i > 0)
            cout << " ";
        cout << A[i];
    }
    cout << endl;
    cout << cnt << endl;
    return 0;
}



Measured memory_bytes: 3116
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001;

template<int SZ> struct DSU {
    int par[SZ], sz[SZ];
    DSU() {
        F0R(i,SZ) par[i] = i, sz[i] = 1;
    }
    
    int get(int x) { // path compression
    	if (par[x] != x) par[x] = get(par[x]);
    	return par[x];
    }
    
    bool unite(int x, int y) { // union-by-rank
    	x = get(x), y = get(y);
    	if (x == y) return 0;
    	if (sz[x] < sz[y]) swap(x,y);
    	sz[x] += sz[y], par[y] = x;
    	return 1;
    }
};

DSU<401> DD;

int N,H, deg[401];
bool existsNeg[401], involve[401], unbalanced[401];

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> N >> H;
    F0R(i,N) {
        int A,B,C,D; cin >> A >> B >> C >> D;
        if (C == 0) C = -A;
        if (D == 0) D = -B;
        deg[200+C] ++, deg[200-D] --;
        involve[200+C] = involve[200-D] = 1;
        // cout << "HI " << 200+C << " " << 200-D << "\n";
        DD.unite(200+C,200-D);
    }
    F0R(i,401) if (involve[i]) {
        if (deg[i] != 0) {
            if ((deg[i] > 0) ^ (i < 200)) {
                cout << "NO";
                exit(0);
            }
            if (deg[i] != 0) unbalanced[DD.get(i)] = 1;
        }
    }
    F0R(i,401) if (involve[i] && !unbalanced[DD.get(i)]) {
        cout << "NO";
        exit(0);
    }
    cout << "YES";
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?) ARRAY OUT OF BOUNDSS

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

int main(){
    int n, c, k;
    cin >> n >> c >> k;
    vector<int> t(n);
    for (int i = 0; i < n; i++) cin >> t[i];
    sort(t.begin(), t.end());
    int ans = 0;
    int end = 1'000'000'001;
    int cnt = 0;
    for (int i = 0; i < n; i++){
        if (t[i] <= end && t[i] + k >= end && cnt < c){
            cnt++;
        }
        else{
            ans++;
            end = t[i] + k;
            cnt = 1;
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 640
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
typedef long long int ll;
#define forn for(int i=0;i<n;i++) 
#define form for(int j=0;j<n;j++) 
#define fora(i,a,b) for(int i = a; i < (b); i++)
#define pb push_back 
#define mp make_pair 
#define sc second 
#define f first 
#define kek cout<<"\n" 
#define all(v) ((v).begin()), ((v).end()) 
#define pob pop_back() 
const ll MOD = 1e9 + 7;
const int MAXN = 100005;
const int INF = 1e8;
using namespace std;
int main()

{
#if defined(_DEBUG)
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
   int n,k;
   cin>>n>>k;
   if(n>=10) cout<<k;
   else cout<<k+100*(10-n);
   return 0;
     
 
}

Measured memory_bytes: 256
MOD = 1000000007
N = int(input())
A = [int(a) for a in input().split()]
cnt = [0] * N
for a in A:
  cnt[a] += 1

if N % 2 == 1:
  if cnt[0] != 1:
    print(0)
  else:
    for i in range(2,N,2):
      if cnt[i] != 2:
        print(0)
        break
    else:
      print(2**(N//2)%MOD)
else:
  for i in range(1,N,2):
    if cnt[i] != 2:
      print(0)
      break
  else:
    print(2**(N//2)%MOD)

Measured memory_bytes: 13880
#include  <stdio.h>

int main(void)
{
   int num1, num2, num3;
    scanf("%d %d %d",&num1, &num2, &num3);
    if(num1+num2+num3 >= 22) {
        puts("bust");
    }
    else { 
        puts("win");
    }
    return 0;
}

Measured memory_bytes: 1612
N,M = map(int,input().split())
E = [set() for _ in range(N)]
for i in range(M):
  a,b = map(int,input().split())
  a -= 1
  b -= 1
  E[a].add(b)
  E[b].add(a)
#print(E)

def dfs(v,c):
  if c == N:
    return 1
  res = 0
  for u in E[v]:
    if not visited[u]:
      visited[u] = True
      res += dfs(u,c+1)
      visited[u] = False
  return res

visited = [True] + [False for _ in range(N-1)]
print(dfs(0,1))

Measured memory_bytes: 41564
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  
  vector<int> A(N);
  vector<int> C(N);
   
  for (int i = 0; i < N-1 ; i++) {
    cin >> A.at(i);
  }
  
  for (int i = 1; i < N ; i++) {
    C.at(A.at(i-1)-1) += 1;
  }
  
  for (int i = 0; i < N-1 ; i++) {
    cout << C.at(i) << endl;
  }
    cout << 0 << endl;
}

Measured memory_bytes: 4820
"""
# 標準入力取得
## 文字列
 = sys.stdin.readline().rstrip()
 = list(sys.stdin.readline().rstrip())

## 数値
 = int(sys.stdin.readline())
 = map(int, sys.stdin.readline().split())
 = list(map(int, sys.stdin.readline().split()))
 = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]
"""

import math
import sys
import itertools
import queue
from fractions import gcd

def lcm(a, b):
    return a * b // gcd(a, b)

mod = 1000000007

if __name__ == "__main__":
    n = int(input())
    a = list(map(int,input().split()))

    #累積GCD
    left = [0]*n
    right = [0]*n

    for i in range(n-1):
        left[i+1] = gcd(left[i],a[i])
        right[-i-2] = gcd(right[-i-1],a[-i-1])
        # print("left:",left)
        # print("right:",right)

    gcd_t = 1
    for i in range(n):
        gcd_t = max(gcd_t,gcd(left[i],right[i]))
    print(gcd_t)




Measured memory_bytes: 16164
from functools import reduce
import math

def main():
    # 文字列の2進数を数値にする
    # '101' → '5'
    # 文字列の頭に'0b'をつけてint()にわたす
    # binary = int('0b'+'101',0)

    # 2進数で立っているbitを数える
    # 101(0x5) → 2
    # cnt_bit = bin(5).count('1')
    
    # N! を求める
    # f = math.factorial(N)

    # N の逆元
    # N_inv = pow(N,MOD-2,MOD)

    # nCr
    # Nの階乗 * rの階乗の逆元 * n-rの階乗の逆元
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    INF = float("inf")

    # 大きな素数
    MOD = 10**9+7
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    N = int(input())
    l = []
    r = []
    ans = 0
    for i in range(N):
        s1,s2 = (int(_) for _ in input().split())
        ans += s2 - s1 +1

    
    print(ans)
    
if __name__ == '__main__':
    main()


Measured memory_bytes: 3572
N, M = map(int, input().split())
if N == 1 or M == 1:
    if N > 2 or M > 2:
        ans = max(N, M) - 2
    elif N == 2 or M == 2:
        ans = 0
    else:  # N==M==1
        ans = 1
elif N == 2 or M == 2:
    ans = 0
else:
    ans = N*M-(2*N+2*M-4)
print(ans)


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

public class Main {

	public static class FastReader {
		BufferedReader br;
		StringTokenizer root;
		
 
		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
 
		String next() {
			while (root == null || !root.hasMoreTokens()) {
				try {
					root = new StringTokenizer(br.readLine());
				} catch (Exception addd) {
					addd.printStackTrace();
				}
			}
			return root.nextToken();
		}
 
		int nextInt() {
			return Integer.parseInt(next());
		}
 
		double nextDouble() {
			return Double.parseDouble(next());
		}
 
		long nextLong() {
			return Long.parseLong(next());
		}
 
		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception addd) {
				addd.printStackTrace();
			}
			return str;
		}
	}
	
	public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
	
	public static FastReader sc = new FastReader();
 
	static int mod = (int) (1e9+7),MAX=(int) (2e5+100);
    static List<Integer>[] edges;
    static Long[][] dp;
    
	public static void main(String[] args) {
	
	    int n = sc.nextInt();
	    long[] a = new long[MAX];
	    SegmentTree st = new SegmentTree(a,a.length);
	    long ans = 0;
	    int[] h = new int[n];
	    for(int i=0;i<n;++i) 
	    	h[i] = sc.nextInt();
	    for(int i=0;i<n;++i) {
	    	int b = sc.nextInt();
	    	long max = st.query(a,0,h[i]-1);
	    	ans = Math.max(ans, max+b);
	    	st.update(a, h[i]-1, max+b);
	    }
	    out.print(ans);
		out.close();
   }
	public static class SegmentTree 
	{ 
		long seg[];  

		SegmentTree(long[] a, int n) { 
			seg = new long[4*n];
			buildTree(a,0,n-1,1);
		} 
		
		public void buildTree(long[] a, int start, int end, int i) {
			if(start == end) {
				seg[i] = a[start];
				return;
			}
			int mid = start +(end-start)/2;
			buildTree(a,start,mid,2*i);
			buildTree(a,mid+1,end,2*i+1);
			//seg[i] = seg[2*i] + seg[2*i+1];
			seg[i] = Math.max(seg[2*i] , seg[2*i+1]);
			
		}

		public long query(long[] a, int l,int r) {
			return query(0,a.length-1,1,l,r);
		}
		
		public long query(long m, long mid2, int i, int l, int r) {
			// OUTSIDE
			if(m>r || mid2<l)
				return 0;
			//INSIDE
			if(m>=l && mid2<=r)
				return seg[i];
			// PARTIAL
			long mid = m+(mid2-m)/2;
			long ansl = query(m,mid,2*i,l,r);
			long ansr = query(mid+1,mid2,2*i+1,l,r);
			
			return Math.max(ansl,ansr);
			
		}

		public void update(long[] a,int idx,long ans) {
			updateTree(a,0,a.length-1,1,idx,ans);
		}
		public void updateTree(long[] a,int start, int end, int i, int idx, long ans) {
			if(start == end) {
				a[idx] = ans;
				seg[i] = ans;
				return;
			}
			
			int mid = start+(end-start)/2;
			if(idx>mid)
				updateTree(a,mid+1,end,2*i+1,idx,ans);
			else updateTree(a,start,mid,2*i,idx,ans);
			
			//seg[i] = seg[2*i+1] + seg[2*i];
			seg[i] = Math.max(seg[2*i], seg[2*i+1]);
			
		}

	}



    }



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

int main() {
    int N;
    string S;
    int moji;
    cin >> N >> S;
    for (int i = 0; i < S.size(); i++){
        moji = (int)S.at(i) + N;
        if(moji > 90)moji -= 26;
        cout << (char)moji;
    }
    cout << endl;
}

Measured memory_bytes: 256
import Data.List

rotJenny 0 = [1,4,1,4,1,2,1,2]
rotJenny n = (last (rotJenny (n-1))):(init (rotJenny (n-1)))

lstToInt [] val = val
lstToInt (x:xs) val = lstToInt xs (val*10+x)

jennyToInt n = lstToInt (rotJenny n) 0

waitLst waits = rotJenny $ fst $ head sorted'
    where waits' n = zipWith (\x y->if x<y then 0 else x-y) waits $ rotJenny n
          sorted = sortBy (\x y->compare (sum $ snd x) (sum $ snd y)) $ map (\x->(x,waits' x)) [0..7]
          minsum = sum $ snd $ head sorted
          filtered = filter (\x->(sum $ snd x)==minsum) sorted
          sorted' = sortBy (\x y->compare (jennyToInt $ fst x) (jennyToInt $ fst y)) filtered

mystr :: [Int]->String
mystr (x:xs) = if null xs then (show x) else (show x)++" "++(mystr xs)

solve ::[Int]->IO ()
solve waits = do
    putStrLn $ mystr $ waitLst waits

main = do
    ss <- getContents
    mapM_ solve $ map (\x->map (\y->read y::Int) $ words x) $ lines ss

Measured memory_bytes: 4208
use std::io;
use std::collections::HashMap;

fn main(){
   loop {
        let v = read_vu();
        let n = v[0];
        let m = v[1];

        if n == 0 && m == 0 {break;}

        let vh = make_acv(n);
        let vw = make_acv(m);

        let mh = make_hm(n, vh);
        let mw = make_hm(m, vw);

        let mut cnt = 0;
        
        for (hl, ch) in &mh {
            cnt += match mw.get(&hl) {
                Some(cw) => ch * cw,
                None => 0,
            };
        }
        println!("{}", cnt);
   }
}

fn read_vu() -> Vec<usize> {
   let mut buf = String::new();
   io::stdin().read_line(&mut buf).expect("read error");
   buf.trim().split_whitespace().map(|e| e.parse().unwrap()).collect()
}

fn make_acv(l:usize) -> Vec<u32> {
   let mut v: Vec<u32> = vec![0; l + 1];
   for i in 0 .. l {
       let mut buf = String::new();
       io::stdin().read_line(&mut buf).expect("read error");
       let x: u32 = buf.trim().parse().unwrap();
       v[i+1] = v[i] + x;
   }
   v
}

fn make_hm(l: usize, v:Vec<u32>) -> HashMap<u32, u32> {
   let mut map: HashMap<u32, u32> = HashMap::new();
   for i in 0..l {
       for j in i+1 .. l+1 {
           let d = v[j] - v[i];
           let cnt = map.entry(d).or_insert(0);
           *cnt += 1;
       }
   }
   map
}



Measured memory_bytes: 26856
#include <iostream>
#include <queue>
#include <vector>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, k;
    cin >> n >> k;
    vector<vector<int>> tree(n);
    vector<pair<int, int>> edges(n - 1);
    for (auto& i : edges) {
        cin >> i.first >> i.second;
        i.first--; i.second--;
        tree[i.first].push_back(i.second);
        tree[i.second].push_back(i.first);
    }
    vector<vector<int>> dists(n, vector<int>(n, -1));
    for (auto i = 0; i < n; i++) {
        queue<int> que;
        que.push(i);
        dists[i][i] = 0;
        while (!que.empty()) {
            auto pos = que.front();
            que.pop();
            for (auto& j : tree[pos]) {
                if (dists[i][j] >= 0) continue;
                dists[i][j] = dists[i][pos] + 1;
                que.push(j);
            }
        }
    }
    int result = n;
    if (k % 2) {
        for (auto& i : edges) {
            int cnt = 0;
            for (auto j = 0; j < n; j++)
                if (min(dists[i.first][j], dists[i.second][j]) > k / 2) cnt++;
            result = min(result, cnt);
        }
    }
    else {
        for (auto i = 0; i < n; i++) {
            int cnt = 0;
            for (auto j = 0; j < n; j++)
                if (dists[i][j] > k / 2) cnt++;
            result = min(result, cnt);
        }
    }
    cout << result << endl;
    return 0;
}


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

template<class T> inline bool chmax(T& a, T b)
{
    if(a<b)
    {
        a=b;
        return true;
    }
    return false;
}

int main(void)
{
    int h, w, n;
    int ans=0;

    cin >> h >> w >> n;
    chmax(h, w);

    int i = 0;
    while(n > ans)
    {
        ans += h;
        i++;
    }

    cout << i << endl;

    return 0;
}

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

int main() {
    int r;

    cin >> r;

    if(r < 1200) {
        cout << "ABC" << endl;
        return 0;
    }
    if(r < 2800) {
        cout << "ARC" << endl;
        return 0;
    }
    if(2800 <= r) {
        cout << "AGC" << endl;
    }
}


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

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define rep(i, n) repd(i, 0, n)

using namespace std;

using ll = long long;
using ul = unsigned long long;
ll mod = 1000000007;

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

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

int main() {
source:
    ll n, m;
    cin >> n >> m;
    ll a[n];
    rep(i, n) {
        ll temp;
        cin >> temp;
        a[i] = temp / 2;
    }
    ll count = __builtin_ffs(a[0]);
    rep(i, n) {
        if (__builtin_ffs(a[i]) != count) {
            cout << 0 << endl;
            return 0;
        }
    }
    ll lcm_all = a[0];
    rep(i, n) {
        lcm_all = lcm(lcm_all, a[i]);
        if (lcm_all > m) {
            cout << 0 << endl;
            return 0;
        }
    }
    cout << (m / lcm_all + 1) / 2 << endl;
    return 0;
}



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

int n, t = 0;
int v[100][100];
int d[100], f[100], r[101];

void st(int id) {
	if (!r[id]) {
		r[id]++;
		d[id - 1] = ++t;
		for (int i = 0; i < n; i++)
			if (v[id - 1][i])
				st(i + 1);
		f[id - 1] = ++t;
	}
}

int main()
{
	cin >> n;

	for (int i = 0; i < n; i++) {
		int u, k, s;

		cin >> u >> k;

		for (int j = 0; j < k; j++) {
			cin >> s;
			v[u - 1][s - 1] = 1;
		}
	}

	for(int i = 0; i < n; i++)
		st(i + 1);

	for (int i = 0; i < n; i++)
		cout << i + 1 << " " << d[i] << " " << f[i] << endl;

	return 0;
}


Measured memory_bytes: 3108
using System;
using System.Collections.Generic;

namespace abc146
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string S = Console.ReadLine();
            string ans = "";
            var obj= new Dictionary<char, int>(){
                {'A', 1}, {'B', 2}, {'C', 3}, {'D', 4}, {'E', 5}, {'F', 6}, {'G', 7}, {'H', 8}, {'I', 9},
                {'J', 10}, {'K', 11}, {'L', 12}, {'M', 13}, {'N', 14}, {'O', 15}, {'P', 16}, {'Q', 17}, {'R', 18},
                {'S', 19}, {'T', 20}, {'U', 21}, {'V', 22}, {'W', 23}, {'X', 24}, {'Y', 25}, {'Z', 26}
            };
            var _obj = new Dictionary<int, char>(){
                { 1,'A'},{ 2,'B'},{ 3,'C'},{ 4,'D'},{ 5,'E'},{ 6,'F'},{ 7,'G'},{ 8,'H'},{ 9,'I'},
                {10,'J'},{11,'K'},{12,'L'},{13,'M'},{14,'N'},{15,'O'},{16,'P'},{17,'Q'},{18,'R'},
                {19,'S'},{20,'T'},{21,'U'},{22,'V'},{23,'W'},{24,'X'},{25,'Y'},{26,'Z'}
            };
            int num = 0;
            for(int i=0; i<S.Length; i++){
                num = obj[S[i]] + N;
                if(num > 26){
                    ans += _obj[num-26];
                }else{
                    ans += _obj[num];
                }
            }
            Console.WriteLine(ans);

        }
    }
}

Measured memory_bytes: 35028
/************************************
/ AUTHOR : YATHARTH GOSWAMI         /  
/ ALIAS : hacker_yg                 /
/ INSTITUTE : IIT Kanpur            /
************************************/
//          TEMPLATE                //

#include <bits/stdc++.h>

#define ll long long
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define PI 3.14159265359

using namespace std;

/*ll powMod(ll a, ll y)
{
    ll ans = 1;
    
    while (y > 0) 
    { 
        if (y & 1) 
            ans = (ans*a) % MOD; 
  
        y = y>>1;
        a = (a*a) % MOD; 
    } 
    return ans;
}*/

/*ll modInv(ll a)
{
    return powMod(a, MOD-2);	
}*/

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int n;
    cin >> n;
    vector <int> v(n);
    ll sum = 0;
    map <int, int> m;
    for (int &x : v) {
        cin >> x;
        m[x]++;
        sum += x;
    }
    int q;
    cin >> q;
    while (q--) {
        int b, c;
        cin >> b >> c;
        sum = sum + (c-b)*m[b];
        m[c] += m[b];
        m[b] = 0;
        cout << sum << endl;
    }
    return 0;
}




Measured memory_bytes: 8176
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
#define base 31
#define MOD 1e9+7
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define FORs(i, a, b) for(int i = a; i >= b; i--)
#define REP(i, a, b) for(int i = a; i < b; i++)
#define __FOR(i, a, b, k) for(int i = a; i <= b; i+= k)
#define __REP(i, a, b, k) for(int i = a; i < b; i+= k)
#define pb push_back
#define _io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define Read_ freopen("input.inp", "r", stdin)
#define Write_ freopen("output.out", "w", stdout);
using namespace std;
typedef pair <int, int> ii;
typedef vector <ii> vii;
#define fi first
#define se second
#define mp make_pair
#define N  500
int n,a[N][N],res=0;
int main(){
    _io;
    cin>>n;
    FOR(i,1,n)
    FOR(j,1,2){
        cin>>a[i][j];
    }
    FOR(i,1,n-2){
        if (a[i][1]==a[i][2]&&a[i+1][1]==a[i+1][2]&&a[i+2][1]==a[i+2][2]) ++res;
    }
    if(res) cout<<"Yes"; else cout<<"No";
}




Measured memory_bytes: 3780
#include<bits/stdc++.h>
#include<math.h>
#include<queue>
#include<cstdio>
#include<set>
#include<map>
using namespace std;
using ll = long long;

int main(){
    ll N;
  	cin >> N;
    vector<ll> f(N+1,1);
    ll sum=1;
    for(ll i=2; i<=N; i++){
        ll k=1;
        while(k*i<=N){
            f.at(k*i)++;
          	k++;
        }
        sum += i*f.at(i);
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 81324
#include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;
int N;
vector<int> A;
unordered_map<int, int64_t> memo[3];
int64_t dfs(int idx, int skip) {
  if(idx >= N) return 0;
  if (memo[skip].count(idx)) return memo[skip][idx];

  int64_t ret = dfs(idx + 2, skip) + A[idx];
  if(skip > 0) ret = max(ret, dfs(idx + 1, skip-1));
  memo[skip][idx] = ret;
  return ret;
}

int main(void) {
  ios::sync_with_stdio(false);
  cin >> N;
  A.resize(N);
  for(int i = 0; i < N; ++i) cin >> A[i];
  int skip = (N % 2 == 0) ? 1 : 2;
  cout << dfs(0, skip) << endl;  
  return 0;
}


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

int main() {
  int a;
  scanf("%d",&a);
  if(a==1) cout<<"Hello World"<<endl;
  else{
  	int b,c;
    scanf("%d %d",&b,&c);
    printf("%d\n",b+c);
  }
  return 0;
}


Measured memory_bytes: 256