akhauriyash/Code-Regression huggingface dataset:
import java.util.*
import kotlin.collections.ArrayList

fun str() = readLine()!!
fun int() = str().toInt()
fun long() = str().toLong()

fun read(d: String = " ") = str().split(d)
fun <T> list(d: String = " ", f: String.() -> T) = read(d).map { f(it) }
fun list() = list { toInt() }

fun <T> MutableList<T>.removeLast() = this.removeAt(this.lastIndex)

const val mod = 998244353L

/**
 * Disjoint set union.
 *
 * convert from [AtCoderLibraryForJava - DSU](https://github.com/NASU41/AtCoderLibraryForJava/blob/24160d880a5fc6d1caf9b95baa875e47fb568ef3/DSU/DSU.java)
 */
class DSU(private val n: Int) {
    private val parentOrSize: IntArray = IntArray(n)

    /**
     * Merge nodes.
     */
    fun merge(a: Int, b: Int): Int {
        if (a !in 0 until n) throw IndexOutOfBoundsException("a=$a")
        if (b !in 0 until n) throw IndexOutOfBoundsException("b=$b")
        var x = leader(a)
        var y = leader(b)
        if (x == y) return x
        if (-parentOrSize[x] < -parentOrSize[y]) {
            val tmp = x
            x = y
            y = tmp
        }
        parentOrSize[x] += parentOrSize[y]
        parentOrSize[y] = x
        return x
    }

    /**
     * True if two nodes are connected.
     */
    fun same(a: Int, b: Int): Boolean {
        if (a !in 0 until n) throw IndexOutOfBoundsException("a=$a")
        if (b !in 0 until n) throw IndexOutOfBoundsException("b=$b")
        return leader(a) == leader(b)
    }

    /**
     * Get its leader node.
     */
    fun leader(a: Int): Int {
        return if (parentOrSize[a] < 0) {
            a
        } else {
            parentOrSize[a] = leader(parentOrSize[a])
            parentOrSize[a]
        }
    }

    /**
     * A group's size.
     */
    fun size(a: Int): Int {
        if (a !in 0 until n) throw IndexOutOfBoundsException("" + a)
        return -parentOrSize[leader(a)]
    }

    /**
     * Group by leader.
     */
    fun groups(): ArrayList<ArrayList<Int>> {
        val leaderBuf = IntArray(n)
        val groupSize = IntArray(n)
        for (i in 0 until n) {
            leaderBuf[i] = leader(i)
            groupSize[leaderBuf[i]]++
        }
        val result = ArrayList<ArrayList<Int>>(n)
        for (i in 0 until n) {
            result.add(ArrayList(groupSize[i]))
        }
        for (i in 0 until n) {
            result[leaderBuf[i]].add(i)
        }
        result.removeIf { obj: ArrayList<Int> -> obj.isEmpty() }
        return result
    }

    init {
        Arrays.fill(parentOrSize, -1)
    }
}

fun main() {
    abc000X()
}

fun abc000X() {
    val (n, m) = list()
    val uf = DSU(n)
    for (i in 1..m) {
        val (a, b) = list()
        uf.merge(a - 1, b - 1)
    }
    println(uf.groups().size - 1)
}


Measured memory_bytes: 63952
#include <cstdlib>
#include <iostream>
#include <typeinfo>
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
  vector<int> a(5);
  for(int &i:a){
    cin >> i;
  }
  vector<int> f(5);
  for (int i = 0; i < 5;i++){
    f.at(i) = (10 - a.at(i) % 10) % 10;
  }

  int ans = 0;
  for (int i = 0; i < 5;i++){
    ans += a.at(i) + f.at(i);
  }

  sort(f.begin(), f.end());
  ans -= f.at(4);

  cout << ans << endl;

  return 0;
}

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

int main(void) {
	int H, N;
	cin >> H >> N;
	int sumA, A;
	sumA = 0;
	for (int i = 0; i < N; i++) {
		cin >> A;
		sumA += A;
	}
	if (sumA>=H) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
  return 0;
}


Measured memory_bytes: 256
/**
 *Code Author: codeknight13
 *Institution: IIT(ISM)
**/

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

/*
use these format of input when number of inputs not provided
while(scanf("%lld",&n)!=EOF)
*/

#define fast ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long int
#define vi vector< ll >
#define vii vector< vi >
#define viii vector< vii >
#define pii pair< int , int >
#define vpii vector< pii >
#define mii unordered_map< int , int >
#define mci map< char , int >
#define pq priority_queue
#define str string
#define len length()
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define nl cout <<  endl
#define sp " "
#define all(ar) ar.begin(), ar.end()
#define rall(ar) ar.rbegin(), ar.rend()
#define iterni(n) for (int i=0; i<n; i++)
#define iternj(n) for (int j=0; j<n; j++)
#define iternk(n) for (int k=0; k<n; k++)
#define iterng(n) for (int g=0; g<n; g++)
#define riterni(n) for (int i=n-1; i>=0; i--)
#define riternj(n) for (int j=n-1; j>=0; j--)
#define riternk(n) for (int k=n-1; k>=0; k--)
#define riterng(n) for (int g=n-1; g>=0; g--)
#define sz(x) ((int)(x).size())
#define pi acos(1);                   /* pi */
#define inf (int)(1e9+7)
#define fl(x) int(x)
#define mod %(inf)
#define yes "YES"
#define no "NO"
#define null NULL
#define mac (int)(1e7)
//debugger
#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;
/*-----functions-----*/
//gcd
/*int gcd(int a, int b) {return b == 0 ? a : gcd(b, a % b);}

//disjoint set union functions
int volume[mac];
int parent[mac];

void initialise_dsu() {
	for (int i=0; i<mac; i++)volume[i]=1;
	for (int i=0; i<mac; i++)parent[i]=i;
}

int find_set(int v) {
    return (v==parent[v]?v:parent[v]=find_set(parent[v]));
}

void union_sets(int a,int b) {
	a=find_set(a);
	b=find_set(b);
	if (a!=b) {
		if (volume[a]<volume[b])swap(a,b);
		parent[b]=a;
		volume[a]+=volume[b];
	}
}
*/
//#------------------------------complete template------------------------------#//

int main () {
	string s;
  cin >> s;
  int cnt=0;
  for (int i=0; i<s.length(); i++){
    if (s[i]=='o')cnt++;}
  if (cnt+15-s.length()>=8)cout <<"YES";else cout << "NO";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <cmath>
using namespace std;

vector<string> split(const string &str, char delim){
  vector<string> res;
  size_t current = 0, found;
  while((found = str.find_first_of(delim, current)) != string::npos){
    res.push_back(string(str, current, found - current));
    current = found + 1;
  }
  res.push_back(string(str, current, str.size() - current));
  return res;
}

double isCross(double p1_x,double p1_y,double p2_x,double p2_y,double p3_x,double p3_y,double p4_x,double p4_y){  
    return ( (p1_x-p2_x)*(p3_y-p1_y) + (p1_y-p2_y)*(p1_x-p3_x)) * ((p1_x-p2_x)*(p4_y-p1_y) + (p1_y-p2_y)*(p1_x-p4_x));  
}




int main()
{
	string s;
	while(cin >> s)
	{
		vector<string> _s = split(s,',');
		double *a = new double[8];
		for(int i=0;i<8;i++)
		{
			a[i] = atoi(_s[i].c_str());
		}

		if(isCross(a[0],a[1],a[4],a[5],a[2],a[3],a[6],a[7]) > 0.0 || isCross(a[2],a[3],a[6],a[7],a[0],a[1],a[4],a[5]) > 0.0)
		{
			cout << "NO" << endl; 
		}
		else
		{
			cout << "YES" << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
using namespace std;
#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 itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
typedef long long llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define print(a) cout << a << endl;


int main(){
    int n;
    string s;
    cin >> n >> s;
    int tmp=0,ans=0;
    REP(i,n){
        if(s[i] == 'I'){
            tmp +=1;
            if(ans < tmp) ans = tmp;
        }
        else tmp-=1;
    }
    cout << ans <<endl;
}

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

int main() {
	ll a, b, c;
	cin >> a;
	b = 0;
	c = 0;
	for (int i = 1; i <= a; i++) {
		if (i % 2 == 0)b++;
		else c++;
	}
	cout << b * c << endl;
}

Measured memory_bytes: 256
import collections

n = int(input())
s = [input() for _ in range(n)]
cnt = collections.Counter(s)

values, cnts = zip(*cnt.most_common())
maxCnt = cnts[0]
maxStr = []
for i in range(len(cnts)):
    if cnts[i] == maxCnt:
        maxStr.append(values[i])
maxStr.sort()
for i in maxStr:
    print(i)

Measured memory_bytes: 59500
#include<stdio.h>
#define MAX 100000
#define NAMELEN 10
typedef struct{
  char p[NAMELEN+1];
  int t;
}P;
P matcha[MAX];
int head=1,tail=1,n;

void enq(P u){
  matcha[tail]=u;
  tail++;
  if(tail==n+1) tail=0;
}
P deq(){
  P u;
  u=matcha[head];
  head++;
  if(head==n+1) head=0;
  return u;
}

int main(){
  int i,q,total=0;
  P u;
  scanf("%d %d",&n,&q);
  for(i=1;i<=n;i++){
     scanf("%s%d",u.p,&u.t);
     enq(u);
   }

  while(head!=tail){
    if(matcha[head].t<=q){
      u=deq();
      total+=u.t;
      printf("%s %d\n",u.p,total);
    }else{
      matcha[head].t-=q;
      u=deq();
      total+=q;
      enq(u);
    }
  }
  return 0;
}



Measured memory_bytes: 2508
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#define ll long long
using namespace std;
int main(){
    ll n;
    cin>>n;
    vector<ll> abc(5);
    for(ll i=0;i<abc.size();i++){
        cin>>abc[i];
    }
    sort(abc.begin(),abc.end());
    ll ans=0;
    if(abc[0]>=n){
        ans=5;
    }else{
        ans=ceil(n/double(abc[0])+4);
    }
    cout<<ans<<endl;
    return 0;
}

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

int main() {
  int a, b, c = 0;
  cin >> a >> b;
  
  for (int i = a; i <= b; i++) {
    int s = i / 10000;
    int t = i % 10;
    int u = i / 1000 % 10;
    int v = i / 10 % 10;
    if (s == t && u == v) c++;
  }
  cout << c << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>

using namespace std;

int n;
int A[200];


int calc(int x)
{
	int res = 0;
	while ((x & 1) == 0) {
		res++;
		x >>= 1;
	}
	return res;
}

void solve()
{
	int min = 1000000;
	for (int i = 0; i < n && min; i++) {
		int t = calc(A[i]);
		min = min > t ? t : min;
	}
	cout << min << endl;
}


int main()
{
	cin >> n;
	for (int i = 0; i < n; i++) cin >> A[i];
	solve();
	return 0;
}

Measured memory_bytes: 256
n,m = map(int,input().split())
factor = []
for i in range(1,int(m**0.5)+2):
    if m%i == 0:
        factor.append(i)
        factor.append(m//i)
factor.sort()
factor.reverse()
for i in range(len(factor)):
    if m%factor[i] == 0:
        if m//factor[i] >= n:
            print(factor[i])
            break

Measured memory_bytes: 3060
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#define ll long long
using namespace std;
 
const int N=100005;
 
struct E{
	int to,next;
}mem[N<<1];
int n,num,x,y,rt;
ll all;
bool tag;
int head[N],d[N];
ll a[N],dp[N],b[N];
 
void add(int x,int y){
	num++;
	mem[num].to=y; mem[num].next=head[x];
	head[x]=num;
}
 
void dfs(int k,int pre){
	int j,u,cnt=0,mx,sum;
	if (!tag) return;
	if (d[k]==1) return;
	for (j=head[k];j;j=mem[j].next){
		u=mem[j].to;
		if (u==pre) continue;
		dfs(u,k);
	}
	for (j=head[k];j;j=mem[j].next){
		u=mem[j].to;
		if (u==pre) continue;
		b[++cnt]=dp[u];
	}
	if (!tag) return;
	sort(b+1,b+1+cnt);
	mx=0; sum=0;
	for (j=1;j<=cnt;j++) sum+=b[j];
	if (a[k]>sum){
		printf("NO\n");
		tag=0;
		return;
	}
	if (b[cnt]>sum/2) mx=sum-b[cnt];
	else mx=sum/2;
	if (a[k]<sum-mx){
		printf("NO\n");
		tag=0;
		return;
	}
	dp[k]=2ll*a[k]-sum;
}
 
int main(){
	int i;
	scanf("%d",&n);
	for (i=1;i<=n;i++) scanf("%lld",&a[i]);
	for (i=1;i<n;i++){
		scanf("%d%d",&x,&y);
		add(x,y); add(y,x);
		d[x]++; d[y]++;
	}
	if (n==2){
		if (a[1]!=a[2]) printf("NO\n");
		else printf("YES\n");
		return 0;
	}
	tag=1;
	for (i=1;i<=n;i++)
		if (d[i]>1){
			rt=i;
			break;
		}
	for (i=1;i<=n;i++)
		if (d[i]==1){
			dp[i]=a[i];
			all+=a[i];
		}
	dfs(rt,0);
	if (tag){
		if (dp[rt]) printf("NO\n");
		else printf("YES\n");
	}
	return 0;
}

Measured memory_bytes: 8192
#include<bits/stdc++.h>
#include<math.h>
const double PI = acos(-1);
using namespace std;
int main()
{

     long int t,n,i,a,b,c;
     cin>>a>>b>>c;
     swap(a,b);
     swap(a,c);
     cout<<a<<" "<<b<<" "<<c;
     
    
    
    
}

Measured memory_bytes: 3504
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pll;
#define mod 1000000007
#define maxn 200001
#define f(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rf(i,a,b) for(ll i=(ll)(a);i>=(ll)(b);i--)
#define pb push_back
#define pf(x) push_front((ll)(x))
#define nl cout << "\n";
 
//void ini(){
//	#ifndef ONLINE_JUDGE
//		freopen("input.txt","r",stdin);
//		freopen("output.txt","w",stdout);
//	#endif
//}

ll dp[1001][1001];
char a[1001][1001];

ll  path(ll n,ll m){
	if(m==0 && n==0){
		return 1;
	}

	if(dp[n][m]==-1){
		if(n==0){
			if(a[n][m-1]=='#'){
				return dp[n][m]=0;
			}else{
				return dp[n][m]=path(n,m-1)%mod;
			}
		}

		if(m==0){
			if(a[n-1][m]=='#'){
				return dp[n][m]=0;
			}else{
				return dp[n][m]=path(n-1,m)%mod;
			}
		}

		if(a[n-1][m]=='#' && a[n][m-1]=='#'){
			return dp[n][m]=0;
		}else if(a[n-1][m]=='.' && a[n][m-1]=='#'){
			return dp[n][m]=path(n-1,m)%mod;
		}else if(a[n-1][m]=='#' && a[n][m-1]=='.'){
			return dp[n][m]=path(n,m-1)%mod;
		}else{
			return dp[n][m]=(path(n-1,m)%mod+path(n,m-1)%mod)%mod;
		}

	}

	return dp[n][m]%mod;

}

int main(){
//	ini();
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	
    ll n,m;
    cin >> n >> m;
    f(i,0,n){
    	f(j,0,m){
    		cin >> a[i][j];
    		dp[i][j]=-1;
    	}
    }

    cout << path(n-1,m-1);
}

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

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int H, W;
        int[] tate = new int [100];
        int[] yoko = new int [100];
        int i=0;
        int j=0;
        int k=0;
        int l=0;
        //scan.close();
        try{
            
            while((H = scan.nextInt()) != 0 && (W = scan.nextInt()) != 0){
               
                tate[i] = H;
                yoko[i] = W;
                i++;
            }
            
            while(l<i){
                for(j=0; j<tate[l]; j++){
                    for(k=0; k<yoko[l]; k++){
                        
                        System.out.printf("#");
                    }
                    System.out.printf("\n");
                }
                
                l++;
                
                System.out.printf("\n");
        
            }
            scan.close();
        }
        
        catch(NumberFormatException e){
            System.out.println(e);
        }
    }
}


Measured memory_bytes: 64864
n = int(input())
a = [0]*n

for i in range(n):
  a[i] = int(input())

ans = []
next = 1
for i in range(n):
  if a[next-1] == 2:
    print(i+1)
    exit()
  else:
    next = a[next-1]
print(-1)
  

Measured memory_bytes: 75524
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
//#pragma GCC optimize("Ofast")
//#define _GLIBCXX_DEBUG
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
//#define int ll
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define floatprec(dig) fixed << setprecision(dig)
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
#define invar(typ, var) typ var; cin >> var;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX / 2;
const ll LLINF = 1LL<<60;
constexpr ll MOD = 1000000007;
const double EPS = 1e-9;

signed main(void) {
  cin.tie(0); ios::sync_with_stdio(false);
  
  int N, K;
  cin >> N >> K;
  string S;
  cin >> S;
  
  //0か1のどちらかの連続になっていた...
  vi ct;
  int j = 0;
  int acc = 0;
  char prev = -1;
  rep(i, S.size()) {
    if(S[i] != prev) {
      if(i == 0 && S[0] == '1') {
        
      } else {
        ct.push_back(acc);
      }
      prev = S[i];
      acc = 0;
    }
    acc ++;
  }
  ct.push_back(acc);
  ct.push_back(0);
  
  // next
  N = ct.size();
  acc = 0;
  int klen = K * 2 + 1;
  rep(i, min(N, klen)) {
    acc += ct[i];
  }
  
  if(N <= klen) {
    fin(acc);
    return 0;
  }
  
  int maxv = acc;
  for(int i=0; i<N-klen; i+=2) {
    acc = acc - ct[i] - ct[i+1] + ct[i + klen] + ct[i + klen + 1];
    chmax(maxv, acc);
  }
  
  fin(maxv);
  
}

Measured memory_bytes: 1020
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    string s, t;
    while(cin >> s >> t, s.size() == 4){
        int a = 0, b = 0;
        for (int i = 0; i < 4; ++i) {
            if(s[i] == t[i]) a++, b--;
            for (int j = 0; j < 4; ++j) {
                if(s[i] == t[j]) b++;
            }
        }
        printf("%d %d\n", a, b);
    }
    return 0;
}


Measured memory_bytes: 3180
#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main() {
  string S;
  cin >> S;
  
  vector<string> ok(16);
  ok = { "KIHBR", "KIHBRA", "KIHBAR", "KIHBARA", "KIHABR", "KIHABRA", "KIHABAR", "KIHABARA", "AKIHBR", "AKIHBRA", "AKIHBAR", "AKIHBARA", "AKIHABR", "AKIHABRA", "AKIHABAR", "AKIHABARA" };
  
  for( int i = 0; i < 16; i++ ){
    if( S == ok.at(i) ){
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
      
}

Measured memory_bytes: 256
function main(input) {
    var inputs = input.split('\n');
    var num = parseInt(inputs[0],10);
    var str = inputs[1];
    var strhalf = str.substring(0,num/2);
    if(str == (strhalf + strhalf))
        console.log('Yes');
    else
        console.log('No');
}
 
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

bool condition( ll a , ll b , ll c)
{
    return !(a % 2 || b % 2 || c % 2);
}
int main()
{
    ll a , b, c;
    cin>>a>>b>>c;
    ll ans =0;
    while( condition(a,b,c))
    {
        ll tempa = (b+c)/2;
        ll tempb = (a+c)/2;
        ll tempc = ( a+b)/2;

        if( tempa== a && tempb == b && tempc ==c)
        {
            cout<<-1;
            return 0;
        }
        ans++;
        a = tempa;
        b = tempb;
        c = tempc;
     }
    cout<<ans;
}

Measured memory_bytes: 3632
package main

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

func main() {
    scanner := bufio.NewScanner(os.Stdin)
    var r string
    var eof bool
    var answers []int
    for {
        r, eof = readOneLine(scanner)
        if (eof) {
            break;
        }
        answers = append(answers, s2i(r))
    }
    res := sum(answers)
    fmt.Print(6 - res)
}

func readOneLine(scanner *bufio.Scanner) (string, bool) {
    var s string
    var eof = false
    if scanner.Scan() {
        s = scanner.Text()
    } else {
        eof = true
    }
    return s, eof
}

func s2i(s string) int {
    var intVal,_ = strconv.Atoi(s)
    return intVal
}

func i2s(i int) string {
    return string(i)
}

func s2f(s string) float64 {
    var floatVal,_ = strconv.ParseFloat(s, 64)
    return floatVal
}

func sum(i []int) int {
    sum := 0
    for _,val := range i {
        sum += val
    }
    return sum
}

func split(s string) []string {
    return strings.Fields(s)
}

func strAry2intAry(strs []string) []int {
    var ret = make([]int, 0, len(strs))
    for _ , str := range strs {
        var intVal, _ = strconv.Atoi(string(str));
        ret = append(ret, intVal)
    }
    return ret
}

func intAry2strAry(nums []int) []string {
    var ret = make([]string, 0, len(nums))
    for _ , num := range nums {
        var strVal = strconv.Itoa(num);
        ret = append(ret, strVal)
    }
    return ret
}

func ary2str(strs []string) string {
    return strings.Join(strs, " ")
}


Measured memory_bytes: 640
import java.util.*;
 
class Main{
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Map<String, Integer> strs = new HashMap<>();
        Integer max = 1;
        for(int i=0;i<n;i++){
            String tmp = sc.next();
            if(strs.containsKey(tmp)){
                Integer p = strs.get(tmp)+1;
                max = max < p ? p : max;
                strs.put(tmp, p);
            }
            else{
                strs.put(tmp, 1);
            }
        }
        List<String> employeeByKey = new ArrayList<>(strs.keySet());
        Collections.sort(employeeByKey);
 
        for(String key : employeeByKey){
            if(strs.get(key)==max){
                System.out.println(key);
            }
        }
    }
}

Measured memory_bytes: 86612
#include <algorithm>
#include <vector>
#include <cfloat>
#include <string>
#include <cmath>
#include <set>
#include <cstdlib>
#include <map>
#include <ctime>
#include <iomanip>
#include <functional>
#include <deque>
#include <iostream>
#include <cstring>
#include <queue>
#include <cstdio>
#include <stack>
#include <climits>
#include <sys/time.h>
#include <cctype>

using namespace std;

typedef long long ll;

#define MAX_V 10000

int V;
vector <int> G[MAX_V];
vector <int> rG[MAX_V];
vector <int> vs;
bool used[MAX_V];
int cmp[MAX_V];

void add_edge(int from, int to) {
  G[from].push_back(to);
  rG[to].push_back(from);
}

void dfs(int v) {
  used[v] = true;
  for (int i = 0; i < G[v].size(); i++) {
    if (!used[G[v][i]]) dfs(G[v][i]);
  }
  vs.push_back(v);
}

void rdfs(int v, int k) {
  used[v] = true;
  cmp[v] = k;
  for (int i = 0; i < rG[v].size(); i++) {
    if (!used[rG[v][i]]) rdfs(rG[v][i], k);
  }
}

int scc() {
  memset(used, false, sizeof(used));
  vs.clear();
  for (int v = 0; v < V; v++) {
    if (!used[v]) dfs(v);
  }
  memset(used, false, sizeof(used));
  int k = 0;
  for (int i = vs.size()-1; i>= 0; i--) {
    if (!used[vs[i]]) rdfs(vs[i], k++);
  }
  return k;
}

int main() {
  int E;
  cin >> V >> E;
  for (int i = 0; i < E; i++) {
    int s, t;
    cin >> s >> t;
    add_edge(s, t);
  }
  scc();
  int q;
  cin >> q;
  for (int i = 0; i < q; i++) {
    int u, v;
    cin >> u >> v;
    cout <<  (cmp[u] == cmp[v]) << endl;
  }
}

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

int n, m;
int h[100000];
vector<int> g[100000];

bool ok(int from) {
  for (int to : g[from]) {
    if (h[to] >= h[from]) return false;
  }
  return true;
}

int main() {
  cin >> n >> m;
  for (int i = 0; i < n; ++i) cin >> h[i];
  for (int j = 0; j < m; ++j) {
    int a, b;
    cin >> a >> b;
    --a; --b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  
  int cnt = 0;
  for (int i = 0; i < n; ++i) cnt += ok(i);
  cout << cnt << endl;
}

Measured memory_bytes: 9140
#include <iostream>
#include <algorithm>
#include <array>
#include <atomic>
#include <bitset>
#include <deque>
#include <forward_list>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
using namespace std;

#define rep(i, a, n) for(int i = a; i <= n; i++)
#define sum(start, end) accumulate(start, end, 0)

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; }

template<class T, class U>
bool check(T first, U second) {
    return (first == second);
}

template<class T>
T digitSum(T num) {
    T dig;
    T sum = 0;
    while (num) {
        dig = num % 10;
        sum += dig;
        num /= 10;
    }
    return sum;
}

typedef long long ll;


string solve() {
    string str = "";
//=============================================================================

    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, 0, n-1) cin >> a[i];

    int res = 50;
    rep(i, 0, n-1) {
        int tmp = 0;
        while (a[i] % 2 == 0) ++tmp, a[i] /= 2;

        chmin(res, tmp);
    }

    str = to_string(res);


//=============================================================================
    return str;
}

int main() {	
    std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
    cout << solve() << endl;
}

Measured memory_bytes: 256
N,M,X = map(int,input().split())
L = [[int(x) for x in input().split()]for i in range(N)]

Min_price = 12*(10**5)
Check = 0                   ####条件を満たす場合があるかどうか

for i in range(2**N):
  binary = str(format(i,'b'))
  binary_zero = binary.zfill(N)
  price = 0
  skill = [0]*M
 
  for j in range(N):         ####binary_zeroについて（bit探索）
    if binary_zero[j]=='1':
      price += L[j][0]
      for k in range(M):
        skill[k] += L[j][k+1]

  if min(skill)>=X:      
    Min_price = min(Min_price,price)
    Check = 1                ####スキルについて条件を満たしたので1
    
if Check==0:
  print(-1)
else:
  print(Min_price)
    

Measured memory_bytes: 68608
import java.io.BufferedReader;
import java.io.InputStreamReader;

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

    public void solve(String[] args) {
        MyScanner scanner = new MyScanner();
        int d = scanner.nextInt(); //人数
        int n = scanner.nextInt(); //宿泊日数

        int tmp;
        if (d==0) {
        	tmp=1;
        }else if(d==1) {
        	tmp=100;
        }else {
        	tmp=10000;
        }

        int tmp2;
        if (n==100) {
        	tmp2=101;
        }else {
        	tmp2=n;
        }

        System.out.println(tmp*tmp2);

    }

    private class MyScanner {
        String[] s;
        int i;
        BufferedReader br;
        String reg = " ";
        MyScanner () {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        public String next() {
            try {
                if (i < s.length) return s[i++];
                String line = br.readLine();
                while (line.equals("")) {line = br.readLine();}
                s = line.split(reg, 0);
                i = 0;return s[i++];
            } catch (Exception e) {e.printStackTrace();}
            return null;
        }
        public int nextInt() {
            try {return Integer.parseInt(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public double nextDouble() {
            try {return Double.parseDouble(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public long nextLong()  {
            try {return Long.parseLong(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
    }
}

Measured memory_bytes: 22484
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int i = 1;
        do {
            int x = i;
            if (x % 3 == 0) {
                System.out.print(" " + i);
            } else {
                do {
                    if (x % 10 == 3) {
                        System.out.print(" " + i);
                        break;
                    }
                    x /= 10;
                } while (x != 0);
            }

        } while (++i <= n);
        System.out.println();
    }
}

Measured memory_bytes: 28716
#include<stdio.h>
int main(){
    int a, b;
    scanf("%d",&a);
    scanf("%d",&b);
    if(a<b){
        printf("a < b\n");
    }else if(a>b){
        printf("a > b\n");
    }else{
        printf("a == b\n");
    }
    return 0;
}

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

def main():
    N, K ,Q = map(int, input().split())
    if Q < K:
        for _ in range(N):
            print("Yes")
    else:
        P = [K - Q] * N
        for _ in range(Q):
            A = int(input())
            P[A-1] += 1
        for i in P:
            if i > 0:
                print("Yes")
            else:
                print("No")

if __name__ == '__main__': main()

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

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repr(i, n) for(int i = (n-1); i >= 0; --i)

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

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

const int MAX = 200005;
const int INF = 1001001001;
const int MOD = 1000000007;

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

    vector<int> p(N);
    for (auto &i : p) cin >> i, i--;

    vector<int> A(N), B(N);
    rep(i, N) A[i] = i+1, B[i] = N - i;

    rep(i, N) {
        int index = p[i];
        for (int j = index; j < N; ++j)  A[j] += i;
        for (int j = 0; j <= index; ++j) B[j] += i;
    }

    for (auto &i : A) cout << i << " ";
    cout << endl;
    for (auto &i : B) cout << i << " ";
    cout << endl;
}

Measured memory_bytes: 896
// Problem : D - 11
// Contest : AtCoder Regular Contest 077
// URL : https://atcoder.jp/contests/arc077/tasks/arc077_b
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define size(x) (int)x.size()

const int N = 1e6 + 1, mod = 1e9 + 7, inf = 2e9;

#define temptts template <class T, class... Ts>
temptts int add(T f) { return f; } temptts int add(T f, Ts... ts) { return (f + add(ts...)) % mod; }
temptts int sub(T f) { return f; } temptts int sub(T f, Ts... ts) { return (f - sub(ts...) + 1ll * mod * mod) % mod; }
temptts int mul(T f) { return f; } temptts int mul(T f, Ts... ts) { return (1ll * f * mul(ts...)) % mod; }
int binpow(ll n, ll k) { int ans = 1; while (k) { if (k & 1) ans = mul(ans, n); n = mul(n, n), k >>= 1; } return ans; }
int inv(int n) { return binpow(n, mod - 2); }
struct precompute { int f[N]; precompute() { f[0] = 1; for (int i = 1; i < N; i++) f[i] = mul(f[i - 1], i); } int operator() (int n) { return f[n]; } } fact;
int C(int n, int k) { return mul(fact(n), inv(mul(fact(k), fact(n - k)))); }

int n, a[N], cnt[N], p1, p2;

int main() { cin.tie(0)->sync_with_stdio(0);
	cin >> n;
	for (int i = 1; i <= n + 1; i++) {
		cin >> a[i];
		cnt[a[i]]++;
	}
	for (int i = 1; i < N; i++) if (cnt[i] > 1) cnt[0] = i;
	for (int i = 1; i <= n + 1; i++) {
		if (a[i] == cnt[0]) {
			if (!p1) p1 = i;
			else p2 = i;
		}
	}
	for (int k = 1; k <= n + 1; k++) {
		if (k - 1 <= n - p2 + p1) cout << sub(C(n + 1, k), C(n - p2 + p1, k - 1));
		else cout << C(n + 1, k);
		cout << '\n';
	}
}


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

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

    cout << (x < a ? 0 : 10) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  int n = 1;
  for(int i=0;i<N;i++){
  	cin >> A.at(i);
  }
  for(int i=0;i<n;i++){
   for(int k=0;k<N;k++){
     if(A.at(k)%2==0){
       A.at(k) /=2;
       if(k == N-1)
         n++;
     }else
       break;
   }
  }
  cout << n-1;
}

Measured memory_bytes: 256
# 入力
import sys
stdin = sys.stdin

def li(): return [int(x) for x in stdin.readline().split()]
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return [float(x) for x in stdin.readline().split()]
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(ns())
def nf(): return float(ns())

l = ni()
n = len(bin(l)[2:])

graph = []

# 頂点iからi+1に長さ0,2**(i-1)の辺を張る
for i in range(1,n):
    graph.append((i, i+1, 0))
    graph.append((i, i+1, 2**(i-1)))
    
# 頂点n-1から順に、バイパスを追加
res = 2**(n-1)
for j in range(n-1, 0, -1):
    if l - res >= 2**(j-1):
        graph.append((j, n, res))
        res += 2**(j-1)
        
# 出力
print(n, len(graph))
for edge in graph:
    print(*edge)

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

using namespace std;

typedef long long int ll;
typedef long double ld;

const ll mod = 1e9+7;
const ll mod1 = 998244353;

#define fill(a)  memset(a, 0, sizeof(a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back

void fastscan(ll &number)
{
	bool negative = false;
	register int c;
	number = 0;
	c = getchar();
	if (c=='-') 
	{
		negative = true;
		c = getchar();
	}
	for (; (c>47 && c<58); c=getchar())
		number = number *10 + c - 48;
	if (negative)
		number *= -1;
}

bool isprime(ll n)
{
    if (n <= 1)  return false;
    if (n <= 3)  return true;
    if (n%2 == 0 || n%3 == 0) return false;

    for (ll i=5; i*i<=n; i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
           return false;

    return true;
}

bool checkisTree(ll degree[],ll n) 
{
    ll deg_sum = 0; 
    for (ll i = 0; i < n; i++) 
        deg_sum += degree[i]; 
    return (2*(n-1) == deg_sum);
}

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

}
int main()
{
	cin.sync_with_stdio(0);
	cin.exceptions(cin.failbit);
	cin.tie(0);
	ll t=1;
	//cin>>t;
	while(t--)
	{
		ll n;
      	cin>>n;
      	cout<<3*n*n;
	}
	
}

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

int main()
{
  char s[100];		/* 入力s */
  char t[100];		/* 入力t */
  int a;			/* sの個数 */
  int b;			/* tの個数 */
  char u[100];		/* 捨てるボール */
  
  /* 入力 */
  scanf("%s %s", &s, &t);
  scanf("%d %d", &a, &b);
  scanf("%s", &u);
  
  int judge;		/* 文字列が等しいか */
  judge = strcmp(s, u);
  if(judge == 0){
    a = a - 1;
    printf("%d %d\n", a, b);
  } else {
    b = b - 1;
    printf("%d %d\n", a, b);
  }
  return 0;
}

Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
#from decimal import *

S = input()
N = len(S) + 1

l = [0]*N
r = [0]*N

tmp_l = 0
for i in range(N-1):
	if S[i] == "<":
		tmp_l += 1
		l[i+1] = tmp_l
	else:
		tmp_l = 0

tmp_r = 0
for i in range(N-1):
	if S[N-i-2] == ">":
		tmp_r += 1
		r[i+1] = tmp_r
	else:
		tmp_r = 0
r = r[::-1]

t = [max(r[i], l[i]) for i in range(N)]
print(sum(t))



Measured memory_bytes: 35184
#coding: utf-8

N = int(input())
A = list(map(int,input().split()))
L =[]
for i in range(1,N+1):
    L.append(i)

d = dict(zip(A,L))

d_sorted = sorted(d.items())

L=[]
for i in range(N):
    L.append(d_sorted[i][1])

for i in L:
    print(i, end = ' ')
print('')

Measured memory_bytes: 25772
#include <iostream>
#include <cstdint>
#include <vector>
#include <stack>

const int MOD = 1000000007;

using namespace std;

int main() {

  ios::sync_with_stdio(false);
  cin.tie(0);

  int n;
  cin >> n;

  if (n == 1) {
    int temp;
    cin >> temp;
    cout << temp << endl;
    return 0;
  }

  bool odd = n & 1 ? true : false;
  stack<int> stack;
  for (int i = 0; i < n; i++) {
    int temp;
    cin >> temp;
    stack.push(temp);
  }
  vector<int> ans(n, 0);
  auto itr = ans.begin();
  auto ritr = ans.end();
  ritr--;
  while (!stack.empty()) {
    if (odd == true) {
      if (stack.size() & 1) {
        *itr = stack.top();
        stack.pop();
        itr++;
      } else {
        *ritr = stack.top();
        stack.pop();
        ritr--;
      }
    } else {
      if (stack.size() & 1) {
        *ritr = stack.top();
        stack.pop();
        ritr--;
      } else {
        *itr = stack.top();
        stack.pop();
        itr++;
      }
    }
  }
  for (auto &i : ans) {
    cout << i << " ";
  }
  cout << endl;
}



Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define RFOR(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define REP(i,n) FOR(i,0,(n))
#define REPS(i,n) FOR(i,1,(n)+1)
#define RREP(i,n) RFOR(i,0,(n))
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define DEBUG(x)  cout << #x << " = " << (x) << endl;
#define SORT(x) sort(ALL(x));
#define RSORT(x) sort(RALL(x));
#define SUM(x) accumulate(ALL(x),0);
#define FI first
#define SE second
#define PB push_back
#define EB emplace_back
#define SZ(x) (int)(x).size()
#define BN(x) ((1<<x)-1)
#define DUP(x,y) (((x)+(y)-1)/(y))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const ll mod = 1e9+7;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

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

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

int main () {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  
  int N; cin >> N;
  vi x(N), y(N), h(N); REP(i,N) cin >> x[i] >> y[i] >> h[i];

  int H, Cx, Cy;
  int is;
  REP(i,N) {
    if (h[i] != 0) {
      is = i;
      break;
    }
  }

  REP(Cx,101) {
    REP(Cy,101) {
      bool flag = true;
      H = h[is]+abs(x[is]-Cx)+abs(y[is]-Cy);
      REP(i,N) {
        if (h[i]==0) {
          if (H-abs(x[i]-Cx)-abs(y[i]-Cy)>0) {
            flag = false;
            break;
          }
        }
        else {
          if (h[i]!=H-abs(x[i]-Cx)-abs(y[i]-Cy)) {
            flag = false;
            break;
          }
        }
      }
      if (flag == true) {
        printf("%d %d %d\n",Cx,Cy,H);
        return 0;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
//#include <regex>

/* g++ -g -std=c++0x */
/* g++ -g -std=c++11 */

using namespace std;

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

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#define FOR(i,a,b)      for (int i=(a); i < (b); ++i)
#define FORR(i,a,b)     for (int i=(a); i > (b); --i)
#define FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

string a, b;

int main()
{
/* #ifndef ONLINE_JUDGE */
/*     freopen("foo", "rt", stdin); */
/* #endif */
    std::ios::sync_with_stdio(false);

    while (cin >> a >> b) {
        bool ans = true;
        if (a.size() > b.size()) {
            ans = false;
            cout << "GREATER" << endl;
        }
        else if (a.size() < b.size()) {
            ans = false;
            cout << "LESS" << endl;
        }
        else {
            FOR(i,0,a.size()) {
                if (a[i] > b[i]) {
                    cout << "GREATER" << endl;
                    ans = false;
                    break;
                }
                if (a[i] < b[i]) {
                    cout << "LESS" << endl;
                    ans = false;
                    break;
                }
            }
        }
        if (ans)
            cout << "EQUAL" << endl;
    }
}


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

int main() {
  ios_base :: sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  vector<int> a({1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51});
  int k; cin >> k;
  k--;
  cout << a[k];
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<long long> vll;
typedef pair<long long, long long> pll;

const ll INF = 1e15;
const ll MOD = 1e9 + 7;

ll fa(ll x){
	ll ans = 1;
	while (x > 1){
		ans = (ans*x) % MOD;
		x--;
	}
	return ans;
}

int main(){
	ll N, M;
	cin >> N >> M;
	if (N < M){
		ll tmp = N;
		N = M;
		M = tmp;
	}
	if (N - M > 1){
		cout << 0 << endl;
	}
	else if (N - M == 1){
		ll ans = 1;
		while (N > 1){
			ans = (ans*N) % MOD;
			N--;
		}
		while (M > 1){
			ans = (ans*M) % MOD;
			M--;
		}
		cout << ans << endl;
	}
	else{
		ll ans = 1;
		while (N > 1){
			ans = (ans*N) % MOD;
			N--;
		}
		while (M > 1){
			ans = (ans*M) % MOD;
			M--;
		}
		ans = (ans * 2) % MOD;
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 256
int main(){
    int n,x,r=1<<29;
    for(scanf("%d",&n);n--;){
        int r0=0;
        scanf("%d",&x);
        for(;x%2<1;x/=2)r0++;
        if(r>r0)r=r0;
    }
    printf("%d\n",r);
    return 0;
}

Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
public class MainClass
{
	public const long Giri = 1000000007;
	public const long DpInf = 99999999999999;
	
	public static void Main(string[] args)
	{
		var p = Console.ReadLine();
		if(p[0] <= 'z' && p[0] >= 'a')
		{
			Console.WriteLine("a");
		}
		else
		{
			Console.WriteLine("A");
		
		}
	}

	
	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str, int offset = 0)
	{
		var r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt() + offset;
		return r;
	}
}

Measured memory_bytes: 25784
package main

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

type contest struct {
	in  io.Reader
	out io.Writer
}

func (con *contest) Scan(a ...interface{}) (int, error) {
	return fmt.Fscan(con.in, a...)
}
func (con *contest) Scanln(a ...interface{}) (int, error) {
	return fmt.Fscanln(con.in, a...)
}
func (con *contest) Scanf(f string, a ...interface{}) (int, error) {
	return fmt.Fscanf(con.in, f, a...)
}
func (con *contest) Print(a ...interface{}) (int, error) {
	return fmt.Fprint(con.out, a...)
}
func (con *contest) Println(a ...interface{}) (int, error) {
	return fmt.Fprintln(con.out, a...)
}
func (con *contest) Printf(f string, a ...interface{}) (int, error) {
	return fmt.Fprintf(con.out, f, a...)
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	con := &contest{in: in, out: out}
	con.main()
}

const eMax = 200000
const eOffset = 100000

func (con *contest) main() error {
	var N, Ma, Mb int
	con.Scan(&N, &Ma, &Mb)
	C := make([]int, N)
	D := make([]int, N)
	E := make([][]int, N)
	for i := 0; i < N; i++ {
		var a, b int
		con.Scan(&a, &b, &C[i])
		D[i] = a*Mb - b*Ma
	}
	E[0] = make([]int, eMax)
	E[0][D[0]+eOffset] = C[0]
	for i := 1; i < N; i++ {
		E[i] = make([]int, eMax)
		for j := 0; j < eMax; j++ {
			k := j - D[i]
			if 0 <= k && k < eMax && E[i-1][k] > 0 && (E[i-1][j] == 0 || E[i-1][k]+C[i] < E[i-1][j]) {
				E[i][j] = E[i-1][k] + C[i]
			} else {
				E[i][j] = E[i-1][j]
			}
		}
		if E[i][D[i]+eOffset] == 0 || C[i] < E[i][D[i]+eOffset] {
			E[i][D[i]+eOffset] = C[i]
		}
	}
	A := -1
	for i := 1; i < N; i++ {
		if E[i][eOffset] > 0 && (A < 0 || E[i][eOffset] < A) {
			A = E[i][eOffset]
		}
	}
	con.Println(A)
	return nil
}


Measured memory_bytes: 65688
#include <bits/stdc++.h>
using namespace std;
long ans=0;
int main()
{
    long N,A[5]={0};
    string S;
 
    cin >> N;
    for(int i=0; i<N; i++){
        cin >> S;
        if(S[0] == 'M'){
            A[0]++;
        }else if(S[0] == 'A'){
            A[1]++;
        }else if(S[0] == 'R'){
            A[2]++;
        }else if(S[0] == 'C'){
            A[3]++;
        }else if(S[0] == 'H'){
            A[4]++;
        }
    }

    for(int i=0; i<5; i++){
        for(int j=i+1; j<5; j++){
            for(int k=j+1; k<5; k++){
                ans += A[i] * A[j] * A[k];
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256