akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <math.h>
#include <queue>
#include <string.h>
#include <map>
#include <set>
#include <cstdlib>

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

char ToUpper(char cX) { return toupper(cX); }
char Tolower(char cX) { return tolower(cX); }

const long long INF = 1LL << 60;
const long long MOD = 1000000007;

using namespace std;
typedef unsigned long long ull;
typedef  long long ll;



vector<vector<ll>> dp;


vector<ll> d;

//sスタート
void dikstra(ll n, vector<vector<pair<ll, ll>>> &adj) {
	ll s = 0; //start
	priority_queue<pair<ll, ll>> PQ;
	vector<ll> color(n, 0);
	d = vector<ll>(n, INF);
	d[s] = 0;
	/*(-distance  ,position)*/
	PQ.push(make_pair(0, s));
	color[s] = 1;
	while (!PQ.empty()) {
		pair<ll, ll> f = PQ.top();
		PQ.pop();
		ll u = f.second;
		color[u] = 2;
		if (d[u] < f.first*(-1))
			continue;
		for (ll j = 0; j < adj[u].size(); j++) {
			ll v = adj[u][j].first;
			if (color[v] == 2)
				continue;
			if (d[v] > d[u] + adj[u][j].second) {
				d[v] = d[u] + adj[u][j].second;
				PQ.push(make_pair(d[v] * (-1), v));
				color[v] = 1;
			}
		}
	}
}


int main()
{
	ll n;
	cin >> n;
	vector <vector<pair<ll, ll>>> adj;
	adj.resize(n);
	for (ll i = 0; i < n; i++) {
		ll u, k, v, c;
		cin >> u >> k;
		adj[u].resize(k);
		for (ll j = 0; j < k; j++) {
			cin >> adj[u][j].first >> adj[u][j].second;
		}
	}
	dikstra(n, adj);

	for (ll i = 0; i < d.size(); i++) {
		cout << i << " " << d[i] << endl;
	}

	return 0;
}



Measured memory_bytes: 10812
def s()
    gets().chomp
  end
  def i()
    gets.to_i
  end
  def li()
    gets.split.map(&:to_i)
  end
  def ili()
    n = gets.to_i
    as = gets.split.map(&:to_i)
    [n, as]
  end
  def inli()
    n = gets.to_i
    as = []
    n.times {
      as << gets.split.map(&:to_i)
    }
    [n, as]
  end
  class Array
    def sum
      total = 0
      self.each do |item|
        total += item
      end
      total
    end
  end
  
  def eratosthenes(size)
    prime_list = []
    is_prime = Array.new(size, true)
    is_prime[0] = false
    is_prime[1] = false
  
    2.upto(size-1){|i|
      if is_prime[i]
        prime_list << i
        (2).upto((size.to_f/i).ceil-1){|j|
          is_prime[j*i] = false
        }
      end
    }
    [prime_list, is_prime]
  end
  
  def dijkstra(s, e, cost)
    size = cost.length
    if s==e
      return 0
    end
    dp = {}
    dp[s] = 0
    undefined_node = {}
    size.times{|i|
      if i != s
        undefined_node[i] = cost[s][i]
      end
    }
    while undefined_node.length != 0
      min = undefined_node.min_by{|_, v| v}
      stock = {}
      temp = undefined_node.clone
      temp.each{|k, v|
        if min[1] == v
          undefined_node.delete(k)
          if k == e
            return v
          end
          dp[k] = v
          stock[k] = v
        end
      }
  
      stock.each{|k, v|
        undefined_node.each{|k2, v2|
          undefined_node[k2] = v + cost[k][k2] < v2 ?  v + cost[k][k2] : v2
        }
      }
    end
  end
  
  def get_bits(len)
    res =  []
    (2**len).times{|i|
      res << i.to_s(2).rjust(len, '0')
    }
    res
  end
  
  def get_GCD(m, n)
    tmp = [n, m].max
    n = [n, m].min
    m = tmp
    while n != 0
      tmp = m % n
      m = n
      n = tmp
    end
    m
  end

a, b = li()


def solve(a, b)
    0.upto(1251) {|i|
    if a == (i*0.08).floor && b == (i*0.1).floor 
        return i
    end
  }
  return -1
end

puts solve(a, b)


Measured memory_bytes: 1916
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF = 1e9, MOD = 1e9 + 7, ohara = 1e6;
const ll LINF = 1e18;
using namespace std;

#define rep(i, n) for (int(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (int i = (a); i < (b); i++)
#define rrrep(i, a, b) for (int i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl

ll n, cnt, ans, a, b, c, d, tmp, tmpp, m, h, w, x, y, sum, pos, k, dat[ohara];
ld doua;
int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
bool fl;
struct edge
{
    int to, cost;
};
unordered_map<ll, ll> mp;

//-------------------------↓↓↓↓↓↓------------------------

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

    cin >> n;
    dat[0] = n;
    rrep(i, 1, ohara)
    {
        if (dat[i - 1] % 2 == 0)
            dat[i] = dat[i - 1] / 2;
        else
            dat[i] = dat[i - 1] * 3 + 1;
    }
    rep(i, ohara)
    {
        mp[dat[i]]++;
        if (mp[dat[i]] == 2)
        {
            Cout(i + 1);
            return 0;
        }
    }
    return 0;
}


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

class Main {

    static final int A = 0;
    static final int B = 1;
    static final int AB = 2;
    static final int O = 3;
    
    public static void main(String[] args) {

	final Scanner stdin = new Scanner(System.in);
	int[] sum = new int[4];

	while ( stdin.hasNextLine() ) {

	    final String[] input = stdin.nextLine().split( "," );
	    if ( "A".equals( input[1] ) ) {
		sum[A]++;
	    } else if ( "B".equals( input[1] ) ) {
		sum[B]++;
	    } else if ( "AB".equals( input[1] ) ) {
		sum[AB]++;
	    } else {
		sum[O]++;
	    }
	    
	}

	System.out.println( sum[A] );
	System.out.println( sum[B] );
	System.out.println( sum[AB] );
	System.out.println( sum[O] );
	
    }
    
}

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

void print(char* s, int a, int b){
    for (int i = a; i <= b; i++)
    {
        printf("%c", s[i]);
    }
    printf("\n");
}

void replace(char* s, int a, int b){
    char p[b-a+2];
    scanf("%s", p);
    strncpy(s+a, p, b-a+1);
}

void reverse(char*s, int a, int b){
    char p[b-a+2];
    strncpy(p, s+a, b-a+1);
    for (int i = a; i <= b; i++)
    {
        s[i]=p[b-i];
    }
}

int main(){
    char str[1001], o[8];
    int q, a, b;
    scanf("%s", str);
    scanf("%d", &q);
    for (int i = 0; i < q; i++)
    {
        scanf("%s %d %d", o, &a, &b);
        if(o[0]=='p')print(str, a, b);
        else if(o[2]=='p')replace(str, a, b);
        else if(o[2]=='v')reverse(str, a, b);
    }
    

}


Measured memory_bytes: 2044
# -*- coding:utf-8 -*-
"""考え方
・"Scc"という組をできるだけ多く作りたい


"""
def solve():
    sN, cN = list(map(int, input().split()))

    if 2*sN < cN:
        # SSccccc
        # SScccc で二組作れる。
        # 余ったcで、できるだけScc組を作る
        ans = sN
        restC = cN - 2*sN  # 余ったCの数

        # cが4つあれば新たにSccが作れる
        ans += restC//4
    else:
        # SSccc
        # cの数が少ない場合
        ans = cN//2
    print(ans)


if __name__ == "__main__":
    solve()


Measured memory_bytes: 2940
import math
while True:
    n=int(input())
    
    if n == 0:
        break
    
    s = list(map(int,input().split()))
    
    m = sum(s)/n
    
    S = 0
    for i in range(n):
        S += (s[i]-m)**2

    a2=  math.sqrt(S/n)



    print('{:.8f}'.format(a2))


Measured memory_bytes: 5700
r,g,b,n = map(int,input().split())
counter = 0
sorts = sorted([r,g,b],reverse=True)
a = (n // sorts[0])+1

for i in range(a):
    test = n
    test = test-(sorts[0]*i)
    c = (test//sorts[1])+1
    for j in range(c):
        left = test - (sorts[1]*j)
        if left >= 0 and   left % sorts[2] == 0:
            counter += 1
            
print(counter)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
//using namespace __gnu_pbds;
typedef long long int ll;
 
//typedef tree<pp, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
 
 
 
const ll N = 400005;
 ll mod = 1000000007;
const long long int inf = INT64_MAX;
#define pp pair<ll,ll>

typedef long double ld;
typedef vector<pp> vpl;
#define MP make_pair
#define endl "\n"
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<n;i++)
#define rrep(i,n) for(ll i=n-1;i>=0;i--)
#define repb(i,n) for(ll i=1;i<n-1;i++) 
#define trace(i,a) for(auto i=a.begin();i!=a.end();i++) 
#define mtrace(i,a) for(auto i=a.begin();i!=a.end();i++)  cout<<i->first<<" "<<i->second<<endl;   
 
const ld pi = 3.14159265359;

mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
	uniform_int_distribution<int> uid(0,lim-1);
	return uid(rang);
}

 
void fastIO(void);
void decimal(int);
ll modmulti(ll, ll);
ll modadd(ll, ll);
ll modpower(ll, ll);
ll gcd(ll, ll );
ll modinv(ll);


int main()
{
	string s;
	cin>>s;
	ll q;
	cin>>q;
	deque<char> t;
	rep(i,s.length()) t.push_back(s[i]);
	ll rev = 0;
	ll t1,t2;
	char c;
	while(q--){
		cin>>t1;
		if(t1==1){
			if(rev==0) rev = 1;
			else rev = 0;
		}
		else{
			cin>>t2>>c;
			if(rev==0){
				if(t2==1) t.push_front(c);
				else t.push_back(c);
			}
			else{
				if(t2==1) t.push_back(c);
				else t.push_front(c);
			}
		}
	}
	if(rev==0){
		while(!t.empty()){
			cout<<t.front();
			t.pop_front();
		}
	}
	else{
		while(!t.empty()){
			cout<<t.back();
			t.pop_back();
		}
	}
	cout<<endl;

	
}


	


 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
void fastIO(void)
{  ios_base::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
}
 
void decimal(int n){
   cout<<fixed;
   cout<<setprecision(n);
}
ll modmulti(ll a, ll b){
   return ((a%mod)*1ll*(b%mod))%mod;
}
ll modadd(ll a, ll b){
   ll asdfgh =  ((a%mod)+(b%mod)+mod+mod)%mod;
   asdfgh = (asdfgh+mod)%mod;
   return asdfgh;
}
ll modpower(ll a, ll n){
   if(n==0) return 1;
   if(n==1) return a%mod;
   ll b = modpower(a,n/2);
   b = modmulti(b,b);
   if(n%2==0) return b;
   return modmulti(a,b);
}
ll gcd(ll a, ll b){
   if(b==0)
      return a;
   return gcd(b,a%b);
}
ll modinv(ll a){
   return modpower(a,mod-2);
}

Measured memory_bytes: 896
#include <boost/multiprecision/cpp_int.hpp>
#include <iostream>

using namespace boost::multiprecision;
using namespace std;

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

    int *ar = new int[n+1];
    for (int i = 0; i < n; ++i) {
        cin >> ar[i];
    }

    cpp_int c = 1000; //現金
    cpp_int t = 0; //株価
    cpp_int maxc = 1000; //最大
    for (int i = 0; i < n; ++i) {
        cpp_int tempc = ar[i] * t + c;
        if (tempc > maxc) maxc = tempc;

        //今日の株価で全部買う
        t = maxc / ar[i];
        //残金
        c = maxc - (t * ar[i]);
    }
    cout << maxc;

    return 0;
}



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

int main() {
  int A,B,C,D;
  cin>>A>>B>>C>>D;
  if(A+B>C+D)
    cout<<"Left";
  else if(A+B==C+D)
    cout<<"Balanced";
  else
    cout<<"Right";
}

Measured memory_bytes: 256
tt=[]
ss=[[]]
nn=[]
def ylist(n,nn,ss,s,nstate,tt):
    if n<=1:
        tt.append(s)
        return 
    n=n-1
    for i in range(0,nstate):
        s1=s+[nn[i]]
        ss.append(s1)
        ylist(n,nn,ss,s1,nstate,tt)
    nstate=nstate+1
    s1=s+[nn[nstate-1]]
    ss.append(s1)
    ylist(n,nn,ss,s1,nstate,tt)
    return

n=int(input())  
#n=4

nn=["a","b","c","d","e","f","g","h","i","j","x"]

nstate=1    
s=["a"]
ss=[]
tt=[]
ylist(n, nn, ss, s, nstate,tt)
for t in tt:
    t2=""
    for ts in t  :
        t2=t2+ts
    print(t2)
    

Measured memory_bytes: 28364
def resolve():
    S = input()
    ans, cnt = 0, 0
    for s in S:
        if s == 'A' or s == 'C'or s == 'G' or s == 'T':
            cnt += 1
        else:
            ans = max(ans, cnt)
            cnt = 0
    ans = max(ans, cnt)
    print(ans)

resolve()


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

#define MAXN 300000

int n,v[MAXN],w[MAXN],fa[MAXN],f[513][100010];

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;++i)
	{
		scanf("%d%d",v+i,w+i);
		fa[i]=i/2;
	}
	for(int i=1;i<512;++i)
	{
		for(int j=1;j<w[i];++j)f[i][j]=f[fa[i]][j];
		for(int j=w[i];j<=100000;++j)f[i][j]=max(f[fa[i]][j],f[fa[i]][j-w[i]]+v[i]);
	}
	int q;
	scanf("%d",&q);
	while(q--)
	{
		int x,l;
		scanf("%d%d",&x,&l);
		if(x<512)
		{
			printf("%d\n",f[x][l]);
			continue;
		}
		vector<pair<int,int> > bps;
		while(x>=512)
		{
			bps.push_back(make_pair(v[x],w[x]));
			x=fa[x];
		}
		int cnt=bps.size(),ans=0;
		for(int i=0;i<(1<<cnt);++i)
		{
			int totw=0,totv=0;
			for(int j=0;j<cnt;++j)
			{
				if(!((i>>j)&1))continue;
				totv+=bps[j].first;
				totw+=bps[j].second;
			}
			if(totw<=l)ans=max(ans,f[x][l-totw]+totv);
		}
		printf("%d\n",ans);
	}
}


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

int main()
{
  int x,y,z,temp;
  cin>>x>>y>>z;
  temp=x;
  x=y;
  y=temp;
  temp=x;
  x=z;
  z=temp;
  cout<<x<<" "<<y<<" "<<z<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
while(1){
   int x, y;
   scanf("%d %d", &x, &y);
   if(x == 0 && y == 0){
      break;
   }

   if(x > y){
      int z = x;
      x = y;
      y = z;
   }
   printf("%d %d\n", x, y);
 }
}


Measured memory_bytes: 2716
# sys.stdin.readline()
import sys
input = sys.stdin.readline

n = int(input())
p = list(map(int, input().split()))
ans = 0
for i in range(n-1):
    if i+1 == p[i]:
        if p[i]+1 == p[i+1]:
            p[i+1] = p[i]
        ans += 1
if p[n-1] == n:
    ans += 1
print(ans)

Measured memory_bytes: 13876
#include <iostream>
#include <algorithm>
#include <map>
#include <string.h>
using namespace std;
int a[510][510],c[250010][4];
int main()
{
  int h,w;
  scanf("%d%d",&h,&w);
  for(int i=0;i<h;i++)
    for(int j=0;j<w;j++)
    scanf("%d",&a[i][j]);
    int k=0;
   for(int i=0;i<h;i++)
    for(int j=0;j<w-1;j++)
    {
        if(a[i][j]%2)
        {
            c[k][0]=i;
            c[k][1]=j;
            c[k][2]=i;
            c[k++][3]=j+1;
            a[i][j+1]++;
        }
    }
    for(int i=0;i<h-1;i++)
    {
      if(a[i][w-1]%2)
      {
            c[k][0]=i;
            c[k][1]=w-1;
            c[k][2]=i+1;
            c[k++][3]=w-1;
            a[i+1][w-1]++;
      }
    }
    printf("%d\n",k);
    for(int i=0;i<k;i++)
    {
        printf("%d %d %d %d\n",c[i][0]+1,c[i][1]+1,c[i][2]+1,c[i][3]+1);
    }
    return 0;
}


Measured memory_bytes: 7040
#include <cstdio>
#include <algorithm>

const int MAXN = 2e5 + 5;

int n, k, max_dist;
int arr[MAXN];

int main() {
    scanf("%d%d", &k, &n);
    for (int i = 1; i <= n; ++i) {
        scanf("%d", &arr[i]);
    }
    max_dist = (arr[1] - 0) + (k - arr[n]);
    for (int i = 1; i < n; ++i) {
        max_dist = std::max(max_dist, arr[i + 1] - arr[i]);
    }
    printf("%d", k - max_dist);
    return 0;
}

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

using namespace std;

using ll = long long;
using ld = long double;

const double PI = 3.1415926535897932384626433832795;

const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { -1, 0, 1, 0 };

int gcd(int x, int y) { return y ? gcd(y, x % y) : abs(x); }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : abs(x); }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

ll solve(ll n, ll k) {
	if (k == 0) {
		return n * n;
	}

	ll ans = 0;
	for (ll b = k + 1; b <= n; b++) {
		// b mod
		// [0, 1,... , b-1, 0, 1,..., b-1]
		ans += n / b * (b - k);
		// 0, 1,... n % b
		ans += max(0LL, (n % b) - (k - 1));
	}
	return ans;
}

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

	ll n, k;
	cin >> n >> k;

	cout << solve(n, k) << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(int i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(int i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())

int h, w;
string s[2000];
int ans = 0;

const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};

int dp[2010][2010];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin >> h >> w;
    rep(i, h) cin >> s[i];
    memset(dp, 0, sizeof(dp));
    
    rep(y, h) {
        int l = 0;
        int cnt = 0;
        
        rep(x, w + 1) {
            if ((x == w) || (s[y][x] == '#')) {
                reps(i, l, x) {
                    dp[y][i] = cnt;
                }
                
                cnt = 0;
                l = x + 1;
                continue;
            }
            
            cnt++;
        }
    }
    
    rep(x, w) {
        int l = 0;
        int cnt = 0;
        
        rep(y, h + 1) {
            if ((y == h) || (s[y][x] == '#')) {
                reps(i, l, y) {
                    dp[i][x] += cnt;
                }
                
                cnt = 0;
                l = y + 1;
                continue;
            }
            
            cnt++;
        }
    }
    
    // rep(y, h) {
    //     rep(x, w) {
    //         printf("%d%s", dp[y][x], ((x == (w - 1)) ? "\n" : " "));
    //     }
    // }
    
    rep(y, h) {
        rep(x, w) {
            ans = max(ans, dp[y][x] - 1);
        }
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 20352
#include <bits/stdc++.h>
using namespace std;
int main(){
int k;
cin>>k;
int counter=0;
for(int i=1;i<=k;i++){
    for(int j=1;j<=k;j++){
        if((j+i)%2!=0){
          counter++;
        }
    }
}
cout<<counter/2;
return 0;


}


Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

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

typedef int long long ll;
using namespace std;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;
static const int MAX = 100;
static const int INF = (1 << 23);

int main() {
    int a,b;
    cin>>a>>b;
    cout<<max({a+b,a+a-1,b+b-1});


    return 0;
}


Measured memory_bytes: 256
n=int(input())
s=input()
k=0
for i in range(n-1):
    a=s[:i+1]
    b=s[i+1:]
    c={}
    count=0
    for j in range(len(a)):
        if a[j] in b and a[j] not in c:
            count+=1
            c[a[j]]=1
    if count>k:
        k=count
print(k)

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<queue>
#include<cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<set>
#define INF 2147483647
#define lli long long int

using namespace std;
typedef vector<int> vi;
typedef vector< vector<int> > vvi;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;

void printv(vvi v){
	for(int i = 0; i < v.size(); i++){
		for (int j = 0; j < v.size(); j++){
			cout << v[i][j] << " ";
		}
		cout << endl;
	}
	cout << endl;
	return ;
}

int check_func(vvi adj,vi &check,int k){
	for (int i = 0; i < k; i++){
		int l; cin >> l;
		for (int j = 0; j < check.size(); j++){
			check[j] *= adj[j][l-1];
		}
	}

	int sum = 0;
	int ret;
	for (int i = 0; i < check.size(); i++){
		if (check[i]){
			sum++;
			ret = i;
		}
	}
	if (sum == 1){
		return ret + 1;
	}else{
		return -1;
	}
}
int main() {
	while(1){
		int ans = 0;
		int n ; cin >> n;
		if (n == 0) break;
		
		vvi adj(n,(vi(n,0)));	

		for (int i = 0; i < n; i++){
			int m; cin >> m;
			for (int j = 0; j < m; j++){
				int p; cin >> p;
				adj[i][p-1] = 1;
			}
		}
		//printv(adj);

		int k; cin >> k;
		vi check(n,1);
		ans = check_func(adj,check,k);
		cout << ans << endl;

	}

	return 0;
}

Measured memory_bytes: 3236
s = input().split()
a = int(s[0])
b = int(s[1])

def palindromic(x):
    y = list(x)
    if not y[0] == y.pop():
        return False
    if not y[1] == y.pop():
        return False
    return True

answer = 0

for i in range(a, b + 1):
    if palindromic(str(i)):
        answer += 1
    
print(answer)

Measured memory_bytes: 9052
let int_of_char c = (Char.code c) - 48;;

let to_list n =
  let rec loop l = function
      0 -> l
    | i -> loop ((int_of_char n.[10-i]) mod 10::l) (i-1)
  in loop [] 10
;;

let bottom list =
  let f x y =
    if snd x = -1 then ([], y)
    else ((((snd x) + y) mod 10)::(fst x), y)
  in
  let rec loop = function
      [e] -> e
    | l -> List.fold_left f ([], -1) l |> fst |> List.rev |> loop
  in loop list
;;

let () =
  let rec read () =
    try let l = read_line () |> to_list in
        Printf.printf "%d\n" (bottom l);
        read ()
    with
      End_of_file -> ()
  in read ()
;;

Measured memory_bytes: 2168
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
int n, a, ac, c, o;
char s[1000005];
int main(){
	scanf("%d\n%s", &n, s);
	rep(i,n){
		if(s[i] == '2') o = 2;
		if(i) c += __builtin_ctz(n-i) - __builtin_ctz(i);
		if(!c) ac ^= (s[i] - '1');
	}
	printf("%d\n", ac & ~o);
}

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

int main() {
  int summer,homework;
  cin>>summer>>homework;
  int do_day;
  rep(i,homework){
    cin>>do_day;
    summer-=do_day;
  }
  if(summer>=0) cout<<summer<<endl;
  else cout<<"-1"<<endl;
}


Measured memory_bytes: 3624
#include<stdio.h>

#define MAX 44

int Fib[MAX];

int Fibonacci(int n){
  if(n==0 || n==1) return Fib[n]=1;
  if(Fib[n]!=-777) return Fib[n];
  return Fib[n]=Fibonacci(n-2)+Fibonacci(n-1);
}

int main(){
  int n,i;
  scanf("%d",&n);
  for(i=0;i<=n;i++) Fib[i]=-777;
  printf("%d\n",Fibonacci(n));
  return 0;
}

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

int main()
{
  int a,b,c,x;
  cin >> a >> b >> c >> x;
  
  int ans = 0;
  for(int i = 0; i <= a; i++){
    for(int j = 0; j <= b; j++){
      for(int k = 0; k <= c; k++){
        if(500*i + 100*j + 50*k == x){
          ans++;
        }
      }
    }
  }
   
  cout << ans << endl;
}

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

int main(){
  ll hh,ww,ans=1e11,s[3];cin>>hh>>ww;
  if(!(hh%3)||!(ww%3)) ans=0;
  else{
    REP(k,2){
      ll h,w;
      if(k) h=hh,w=ww;
      else h=ww,w=hh;
      for(ll i=1;i<w;i++){
        s[0]=h*i;
        if(!(h%2)||!((w-i)%2)) s[1]=s[2]=h*(w-i)/2;
        else{
          s[1]=min(h,w-i)*(max(h,w-i)/2);
          s[2]=h*w-s[0]-s[1];
        }
        ans=min(ans,max({s[0],s[1],s[2]})-min({s[0],s[1],s[2]}));
      }
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.*

fun main() {
    val str = next()
    printYesNo(str[2] == str[3] && str[4] == str[5])
}

val scanner = Scanner(System.`in`)
fun next(): String = scanner.next()
fun nextInt() = scanner.nextInt()
fun nextLong() = scanner.nextLong()
fun nextList() = readLine()!!.split(" ")
fun nextIntList() = nextList().map(String::toInt)
fun nextLongList() = nextList().map(String::toLong)
fun printYesNo(isYes: Boolean) = println(if (isYes) "Yes" else "No")

fun main(args: Array<String>) = main()

Measured memory_bytes: 31012
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int (i)=(n); (i)>=(0); (i)--)
#define SIZE(x) ((int)(x).size())
#define GCD(a, b) int gcd(int a,int b){return b?gcd(b,a%b):a;}
#define QP(a, b) int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define all(v) (v).begin(),(v).end()


template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
template<typename A, size_t N, typename T>
void FILL(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

typedef vector<int, int> vint;
typedef pair<int,int> pint;
typedef vector<pint>vpint;
typedef long long ll;

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1LL << 60;
const ll MOD = 1000000007LL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n; cin >> n;
    ll h1, h2; h1 = 0;
    ll res = 0;
    rep(i,n){
        cin >> h2;
        if(h2 - h1 >= 0) res += (h2 - h1);
        h1 = h2;
    }
    cout << res;
    cout << endl;
    return 0;
}



Measured memory_bytes: 504
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <map>
#include <set>
using namespace std;
#define ll long long
#define rep(i, s, n) for(int i = s; i < n; i++)

int main() {
    int n, m;
    cin >> n >> m;
    if(n == 1 && m == 0) {
        cout << 0 << endl;
        return 0;
    }
    vector<int> s(m);
    vector<int> c(m);
    rep(i, 0, m) {
        cin >> s[i] >> c[i];
    }
    vector<int> ans(n, -1);
    rep(i, 0, m) {
        if(s[i] == 1 && c[i] == 0 && n != 1) {
            cout << -1 << endl;
            return 0;
        }
        if(ans[s[i]-1] == -1) {
            ans[s[i]-1] = c[i];
        }
        else {
            if(ans[s[i]-1] == c[i]) {

            }
            else {
                cout << -1 << endl;
                return 0;
            }
        }
    }
    rep(i, 0, n) {
        if(ans[i] == -1 && i != 0) {
            ans[i] = 0;
        }
        else if(i == 0 && ans[i] == -1) {
            ans[i] = 1;
        }
    }
    rep(i, 0, n) {
        cout << ans[i];
    }
    cout << endl;
    return 0;
}

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

int main() {
  long D;
  cin >> D;
  
  //減点量の入力
  long c[27];
  for(int i=1; i<26+1; i++){
    cin >> c[i];
  }
  
  //加点量の入力
  long s[D+1][26+1];
  for(int i=1; i<D+1; i++){
  for(int j=1; j<26+1; j++){
    cin >> s[i][j];
  }}
  
  //開催日程の入力
  long t[D+1];
  for(int i=1; i<D+1; i++){
    cin >> t[i];
  }
  
  //過去の最終開催日を保持する配列
  long past[26+1] = {0};
  
  //日々の処理
  
  for(int day=1; day<D+1; day++){
    
    //仮の満足度を保持する配列
    long tempPoint[26+1] = {0};
    for(int tt=1; tt<26+1; tt++){

      //満足度の加点計算
      tempPoint[tt] += s[day][tt];

      //満足度の減点計算
      for(int num=1; num<26+1; num++){
        tempPoint[tt] -= ( c[num] * (day - past[num]) );
      }
    }
    
    //それぞれの選択に対する満足度の変化量を表示
    //for(int i=1; i<26+1; i++){
    //  cout << i << " : " << tempPoint[i] << endl;
    //}
    
    //仮の満足度から一番高い満足度の選択を出力
    int choice=1;
    for(int i=1; i<26+1; i++){
      if(tempPoint[choice] < tempPoint[i]) choice = i;
    }
    //cout << "choice " << choice << endl;
    cout << choice << endl;
  }

  return 0;
}


Measured memory_bytes: 3692
#include "bits/stdc++.h"
using namespace std;

int main() {
	int K;
	cin >> K;
	if (K == 1) {
		cout << 1 << endl << 1 << endl;
		return 0;
	}
	int N = ((K + 3) / 4) * 2;
	vector<vector<int> > ANS(N, vector<int>(N));
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			if (i % 2 == 0) ANS[i][j] = (j - i + N) % N + 1;
			else ANS[i][j] = (j - i + N) % N + N + 1;
		}
	}
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			if (ANS[i][j] > K) ANS[i][j] -= N;
		}
	}
	cout << N << endl;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			cout << ANS[i][j];
			if (j == N - 1) cout << endl;
			else cout << ' ';
		}
	}
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
//#pragma GCC optimize("Ofast")
#define fori(a,b) for(int i=a;i<b;i++)
#define forj(a,b) for(int j=a;j<b;j++)
#define fork(a,b) for(int k=a;k<b;k++)
#define ford(i,a,b) for(int i=a;i>=b;i--)
#define seto(x,i) memset(x,i,sizeof x)
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
#define pf first
#define ps second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

int n,t;
string s;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("", "r", stdin);
    cin>>n>>s;
    fori(1,n)
        if(s[i]!=s[i-1])
            t++;
    cout<<t+1;
    return 0;
}


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

using namespace std;

#define LL long long
#define DD double
#define Pb push_back
#define Bp pop_back
#define Pf push_front
#define Fp pop_front
#define Ub upper_bound
#define Lb lower_bound
#define In insert
#define All(x) x.begin(), x.end()
#define mem(a, b) memset(a, b, sizeof(a))
#define fast ios_base::sync_with_stdio(0);cin.tie(0)
#define X first
#define Y second
#define mx1 10
#define mx2 110
#define mx3 1010
#define mx4 10010
#define mx5 100010
#define mx6 1000010

typedef vector<LL> Vl;
typedef vector<DD> Vd;
typedef vector<bool> Vb;
typedef vector<Vl> VVl;
typedef pair<LL, LL> Pll;
typedef pair<DD, DD> Pdd;
typedef vector<Pll> Vpl;
typedef vector<Pdd> Vpd;
typedef queue<LL> Ql;
typedef stack<LL> Sl;
typedef deque<LL> Dl;

LL _set(LL N, LL pos) {return N = N | (1 << pos);}
LL _reset(LL N, LL pos) {return N = N & ~(1 << pos);}
bool _check(LL N, LL pos) {return (bool)(N & (1 << pos));}
bool _upper(char a) {return a >= 'A' && a <= 'Z';}
bool _lower(char a) {return a >= 'a' && a <= 'z';}
bool _digit(char a) {return a >= '0' && a <= '9';}

LL dx[] = {1, -1, 0, 0, -1, -1, 1, 1};
LL dy[] = {0, 0, 1, -1, -1, 1, -1, 1};

///**************************DONE****************************///

int a[mx5];

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

    for(int i = 0; i < m; i++)
        cin >> a[i];

    sort(a, a + m);

    vector<int> d;

    for(int i = 1; i < m; i++)
        d.Pb(a[i] - a[i - 1]);

    sort(All(d));

    int ans = 0, it = 1;
    for(auto i: d){
        if(it > m - n)
            break;
        ans += i;
        it++;
    }

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


Measured memory_bytes: 4200
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, k int
	fmt.Scan(&n, &k)
	a := make([]int, n)
	for i := range a {
		fmt.Scan(&a[i])
	}
	sort.Ints(a)

	if a[n-1] < k {
		fmt.Println("IMPOSSIBLE")
		return
	}

	g := a[0]
	for _, v := range a {
		g = gcd(g, v)
	}

	if k%g == 0 {
		fmt.Println("POSSIBLE")
	} else {
		fmt.Println("IMPOSSIBLE")
	}
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}


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

int main(int argc, const char * argv[]) {
    // insert code here...
    int a, b;
    cin >> a >> 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: 3092
fn main() {
    let mut input;
    loop {
        input = String::new();
        match std::io::stdin().read_line(&mut input) {
            Ok(0) => break,
            Err(_) => break,
            Ok(_) => {}
        };
        let n = input.trim().parse::<u32>().expect("Error parse");
        let mut count = 0;
        for i in 0..10 {
            for j in 0..10 {
                for k in 0..10 {
                    for l in 0..10 {
                        if i + j + k + l == n {
                            count += 1;
                        }
                    }
                }
            }
        }
        println!("{}", count);
    }
}



Measured memory_bytes: 5020
#include<bits/stdc++.h>
using namespace std;
#define ld long double
#define lli long long int
#define vi vector<int>
#define vlli vector<lli>
#define vvi vector<vi >
#define str string
#define vs vector<str>
#define vb vector<bool>
#define slli set<lli>
#define mii map<int, int>
#define mlli map<int, lli>
#define msi map<str, int>
#define mp make_pair
#define pii pair<int, int>
#define pll pair<lli, lli>
#define vpii vector<pii >
#define vpll vector<pll >
#define pb push_back
#define loop(i, s, l, j) for(int i = s; i < l; i += j)
#define rloop(i, s, l, j) for(int i = s; i >= l; i -= j)
#define rep(i, n) loop(i,0,n,1)
#define rrep(i, n) rloop(i,n-1,0,1) 
#define fastio() ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define ft first
#define sd second   
#define mit mii::iterator
#define vit vi::iterator
#define all(a) a.begin(),a.end()
#define min3(a, b, c) min(a, min(b, c))
#define mod 998244353
#define inf 100000000000000000
#define limit 200005
/**********************************************************************************************************************************************/
int dx4[4] = {0, -1, 0, 1};
int dy4[4] = {1, 0, -1, 0};
int dx8[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
int dy8[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
int Power(int base,int exp){int ans=1;  while(exp > 0){if(exp&1)ans=(1LL*ans*base)%mod; exp=exp>>1; base=(1LL*base*base)%mod;}  return ans;}
/**********************************************************************************************************************************************/ 

void input()
{
 	int n;
 	cin >> n;

 	vlli a(n);
 	rep(i,n)
 		cin >> a[i];

 	int ans = 0;
 	rep(i,n)
 		loop(j,i+1,n,1)
 			loop(k,j+1,n,1)
 			{
 				if(a[i] == a[j] || a[i] == a[k] || a[j] == a[k])
 					continue;
 				int b[3] = {a[i], a[j], a[k]};
 				sort(b, b+3);
 				if(b[0] + b[1] > b[2])
 					ans++;
 			}
 	cout << ans << '\n';
}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
 
    fastio();
    int q = 1;
    //cin >> q;
    while(q--)
        input();
}

Measured memory_bytes: 3660
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <cassert>
using namespace std;

#define GET_ARG(a,b,c,F,...) F
#define REP3(i,s,e) for (i = s; i <= e; i++)
#define REP2(i,n) REP3 (i,0,(int)(n)-1)
#define REP(...) GET_ARG (__VA_ARGS__,REP3,REP2) (__VA_ARGS__)
#define RREP3(i,s,e) for (i = s; i >= e; i--)
#define RREP2(i,n) RREP3 (i,(int)(n)-1,0)
#define RREP(...) GET_ARG (__VA_ARGS__,RREP3,RREP2) (__VA_ARGS__)
#define DEBUG(x) cerr << #x ": " << x << endl

vector<int> e[100001];
bool used[100001];

int dfs(int u) {
    used[u] = true;
    vector<int> chs;
    for (auto v: e[u]) if (!used[v]) {
        chs.push_back(dfs(v));
    }
    sort(chs.begin(),chs.end());
    int ret = 0;
    for (auto x: chs) {
        ret = max(ret,x)+1;
    }
    return ret;
}

int main(void) {
    int i, n;
    scanf("%d",&n);
    REP (i,2,n) {
        int a;
        scanf("%d",&a);
        e[a].push_back(i);
    }
    printf("%d\n",dfs(1));
    return 0;
}


Measured memory_bytes: 13568
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <functional>
#include <set>
#include <deque>
using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
const int INF = 1<<29;
#define LNF __LONG_LONG_MAX__
const ll MOD = 1000000007;
const int MAX = 200000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// 法mでのaの逆元を計算
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
//最大公約数
int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }
//最小公倍数
int lcm(int x, int y) { return x / gcd(x, y) * y; }
// nが大きく,kが10^7程度の時の二項係数
long long com[200005];
void combination(long long n,long long k){
    com[0] = 1;
    for(int i=1;i<=k;i++){
        com[i] = (com[i-1]*(n-i+1)%MOD)*modinv(i,MOD)%MOD;
    }
}

int main(){
    string S; cin >> S;
    if(S[1]=='B'){
        cout << "ARC" << endl;
    }else{
        cout << "ABC" << endl;
    }
    return 0;
}


Measured memory_bytes: 3600
A=input()
N=len(A)
B=[]
C=[]
for i in range(N):
    flag=0
    for j in range(len(B)):
        if B[j]==A[i]:
            C[j]+=1
            flag=1
            break
    if flag==0:
        B.append(A[i])
        C.append(1)
M=((N*(N-1))//2)+1
for i in C:
    M -= (i*(i-1))//2
print(M)


Measured memory_bytes: 3500
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define int long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define all(x) (x).begin(), (x).end()
#define forn(i,n) for(int i=0;i<(int)(n);i++)
#define for1(i,n) for(int i=1;i<=(int)(n);i++)
const int MOD = 1e9 + 7 ;
int mpow(int a,int b,int p=MOD){a=a%p;int res=1;while(b>0){if(b&1)res=(res*a)%p;a=(a*a)%p;b=b>>1;}return res%p;}
const int N=400002;

int32_t main(){
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);
      int n;
      cin>>n;
      vector<pii> v;
      for(int i=0;i<n;i++)
      {
            int x,y;
            cin>>x>>y;
            v.pb({x,y});
      }

      if(n==1)
      {
            cout<<"1";
            return 0;
      }
      int an=1e17;
      for(int i=0;i<n;i++)
      {
            for(int j=0;j<n;j++)
            {
                  if(i==j) continue;
                  int p=v[j].fi-v[i].fi;
                  int q=v[j].se-v[i].se;
                  // if(p==0||q==0) continue;
                  map<pii,int> ma;
                  for(int k=0;k<n;k++)
                  {
                        //if(k==i||k==j) continue;
                        ma[{v[k].fi,v[k].se}]++;
                  }
                  int ans=0;
                  for(auto u:ma)
                  {
                        if(u.se==0) continue;
                        ans++;
                        int x=u.fi.fi;
                        int y=u.fi.se;
                        pii foo={x,y};
                        pii fooo={x,y};
                        ma[{x,y}]--;
                        while(1)
                        {
                              pii nn={foo.fi+p,foo.se+q};
                              if(ma[nn]>0)
                              {
                                    ma[nn]--;
                              }
                              else break;
                              foo=nn;
                        }
                        while(1)
                        {
                              pii nn={fooo.fi-p,fooo.se-q};
                              if(ma[nn]>0)
                              {
                                    ma[nn]--;
                              }
                              else break;
                              fooo=nn;
                        }
                  }
                  an=min(ans,an);
            }
      }
      cout<<an;

}
// I never lose. I either win or I learn

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
using namespace std;
#define int long long
#define inf 1000000007

vector<int>wl, sl;

void hyoji() {
	for (int i = 0; i < sl.size(); i++)cout << sl[i] << endl;
}
signed main() {
	int a, b, c, d, e, f;
	cin >> a >> b >> c >> d >> e >> f;

	for (int i = 0; i < 40; i++) {
		for (int j = 0; j < 40; j++) {
			int w = a * 100 * i + b * 100 * j;
			if (w <= f)wl.push_back(w);
		}
	}
	for (int i = 0; i < 40; i++) {
		for (int j = 0; j < 40; j++) {
			int s = c*i + d*j;
			if (s <= f)sl.push_back(s);
		}
	}
	sort(wl.begin(), wl.end());
	sort(sl.begin(), sl.end());
	wl.erase(unique(wl.begin(), wl.end()), wl.end());
	sl.erase(unique(sl.begin(), sl.end()), sl.end());
	int sug, wat;
	double per = -3;
	for (int i = 0; i < wl.size(); i++) {
		for (int j = 0; j < sl.size(); j++) {
			double w = wl[i], s = sl[j];
			if (sl[j] + wl[i] > f)continue;
			if (sl[j] == 0 && wl[i] == 0)continue;
			if (sl[j] > (wl[i] / 100)*e)continue;
			if (per < (100 * s / (w + s))) {
				per = (100 * s / (w + s));
				sug = sl[j], wat = wl[i];
			}
		}
	}
	cout << sug + wat << ' ' << sug << endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <limits>
#include <cmath>
#include <iomanip>
#include <functional>
#include <random>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using ll = long long;
namespace mp = boost::multiprecision;
ll BASE_NUM = 1000000007;

int main()
{
  // 整数の入力

  ll A;
  double B;
  cin >> A >> B;
  ll llB = llround(B*100);
  cout << A * llB/100 << endl;
  return 0;
}

Measured memory_bytes: 3744
#include <bits/stdc++.h>
#define rep(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define repr(i, n, m) for (int i = (int)(n) - 1; i >= (int)(m); i--)
using namespace std;
using ll = int64_t;
const int MOD = 1000000007; // 10^9+7

int main() {
    int n;
    cin >> n;
    vector<int> buka(n + 1, 0);

    rep(i, 2, n + 1)
    {
        // **ASCENDING ORDER** from n to m (m is **EXCLUDED**)
        int a;
        cin >> a;
        buka[a]++;
    }

    rep(i, 1, n + 1)
    {
        // **ASCENDING ORDER** from n to m (m is **EXCLUDED**)
        cout << buka[i] << endl;
    }

}


Measured memory_bytes: 4024
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    int H,W,h,w;
    cin>>H>>W>>h>>w;
    cout<<(H-h)*(W-w)<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <forward_list>

using namespace std;

typedef long long ll;
typedef vector<long long> vi;
typedef pair<long long, long long> ii;
typedef vector<pair<long long, long long>> vii;
typedef stringstream ss;
ll mil() { return numeric_limits<long long>::min(); }
ll mal() { return numeric_limits<long long>::max(); }

#define R3(i, a, b) for (long long i = (a); i < (b); ++i)
#define R2(i, b) for (long long i = 0; i < (b); ++i)
#define R1(b) for (long long i = 0; i < (b); ++i)
#define RR(i, a, b) for (long long i = a; i > b; --i)
#define PB(x) push_back(x)
#define MP(x, y) make_pair(x, y)

// build: ctrl + f9

// run: shift + f10
// sanitize: shift + f11
// debug: shift + f9

void A() {
    string S;

    cin >> S;

    if(S == "ABC")
        cout << "ARC" << endl;
    else
        cout << "ABC" << endl;
}

int main()
{
    A();
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int k;
	string s;
	cin>>k;
	cin>>s;
	int a[26]={0},b[26]={0};
	for(int i=0;i<k;i++)
	{
		a[s[i]-'a']++;
	}
	int u=0;
	for(int i=0;i<k;i++)
	{
		a[s[i]-'a']--;
		b[s[i]-'a']++;
		int p=0;
		for(int j=0;j<26;j++)
			if(a[j]!=0&&b[j]!=0)
				p++;
		u=max(u,p);
		//cout<<u<<endl;
	}
	cout<<u<<endl;
} 

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

using namespace std;

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

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

main(){
	int n; cin  >> n;
	ll arr[n];
	for(int i=0;i<n;++i) cin >> arr[i];	
	ll g1[n], g2[n];
	g1[0] = arr[0];
	for(int i=1;i<n;++i){
		g1[i] = gcd(g1[i-1],arr[i]);
	}
	g2[n-1] = arr[n-1];
	for(int i=n-2;i>=0;i--){
		g2[i] = gcd(g2[i+1],arr[i]);
	}
	ll ans = 1;
	for(int i=0;i<n;++i){
		if(i==0) ans = max(ans,g2[1]);
		else if(i==n-1) ans = max(ans,g1[n-2]);
		else ans = max(ans,gcd(g1[i-1],g2[i+1]));
	}
	cout << ans << endl;
}

Measured memory_bytes: 2560
using System;

using System.Linq;

using System.Collections.Generic;



namespace hello_cs

{

    class Program

    {

        static void Main(string[] args)

        {

            var chars = System.Console.ReadLine().ToCharArray();

            if(chars[2] == chars[3] && chars[4]==chars[5]){

                System.Console.WriteLine("Yes");

            }

            else

            {

                System.Console.WriteLine("No");

            }

        }

    }

}



Measured memory_bytes: 11092
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>

using namespace std;

int main() {
	string S, T;	cin >> S >> T;
	char dum;
	if (S == T) {
		cout << "Yes" << endl;
		cin >> S;
		return 0;
	}
	for (int i = 0; i < S.size(); ++i) {
		dum = S[0];
		for (int j = 0; j < S.size() - 1; ++j) {
			S[j] = S[j + 1];
		}
		S[S.size() - 1] = dum;
		if (S == T) {
			cout << "Yes" << endl;
			cin >> S;
			return 0;
		}
	}
	cout << "No" << endl;
	cin >> S;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <cctype>
#include <limits.h>
#include <math.h>
#include <complex>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define BINARY(x) static_cast<bitset<16> >(x);
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)
#define if_range(x, y, w, h) if (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))

const int INF = 1e9;
const double EPS = 1e-8;
const double PI = 3.14159;
int dx[4]={0, 1, 0, -1}, dy[4]={-1, 0, 1, 0};
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;

/* struct P {
	int x, y, n;
	P(int n, int x, int y):n(n), x(x), y(y){}
	P(){}
}; */

/** Problem2400 : You Are the Judge **/
struct Team {
	int id, ac, penalty;
	Team(int i, int c, int p):id(i), ac(c), penalty(p){}
	Team(){id=0; ac=0; penalty=0;}
};

bool comp(const Team &a, const Team &b) {
	if (a.ac == b.ac) {
		if (a.penalty == b.penalty) return a.id<b.id;
		return a.penalty<b.penalty;
	}
	return a.ac>b.ac;
}

int main()
{
	int T, P, R;
	while (cin>>T>>P>>R, T) {
		vector<Team> result(T);
		vector<vector<int> > wrong(T, vector<int>(P));
		
		for (int i=0; i<T; i++) {
			result[i].id = i+1;
		}
		
		for (int r=0; r<R; r++) {
			int tid, pid, time; string m;
			cin>>tid>>pid>>time>>m; tid--, pid--;
			
			if (m == "CORRECT") {
				result[tid].ac++;
				result[tid].penalty += 1200*wrong[tid][pid] + time;
			} else {
				wrong[tid][pid]++;
			}
		}
		
		sort(result.begin(), result.end(), comp);
		
		for (int i=0; i<T; i++) {
			cout << result[i].id << " " << result[i].ac << " " << result[i].penalty << endl;
		}
	}
}

Measured memory_bytes: 1240