akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>

int main () {
    int N;
    scanf("%d", &N);
    char *S = malloc((1+N) * sizeof(char));
    scanf("%s", S);
    char prev = S[0];
    int ans = 1;
    for (int i = 1; i < N; i++) {
        if (prev != S[i])
            ans++;
        prev = S[i];
    }

    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 256
'use strict';
const main = input => {
  let n = input[0], words = input[1].split(' '), s = words[0], t = words[1], ans = '';
  
  for(let i=0; i<n; i++) {
    ans += s[i];
    ans += t[i];
  }
  console.log(ans);
  
}
main(require("fs").readFileSync("/dev/stdin", "utf8").split('\n'));

Measured memory_bytes: 21064
#include <iostream>

using namespace std;

int main(void)
{
    int H, W;

    cin >> H >> W;
    while ((H != 0) || (W != 0))
    {
        for (int i=0; i<H; i++)
        {
            for (int j=0; j<W; j++)
            {
                char c = '#';
                if ((i != 0) && (i != H-1))
                    if ((j != 0) && (j != W-1))
                        c = '.';
                cout << c;
            }
            cout << endl;
        }
        cout << endl;
        cin >> H >> W;
    }
}


Measured memory_bytes: 3076
#include<iostream>
#include<algorithm>
#define MAX 1000
using namespace std;

int n, W[MAX], s;
int T[MAX*10+1],A[MAX+1];

int solve()
{
	int ans = 0;
	bool V[MAX];
	for(int i = 0; i < n; i++){
		A[i] = W[i];V[i] = false;
	}
	sort(A, A+n);
	for(int i = 0; i < n; i++)	T[A[i]] = i;
	for(int i = 0; i < n; i++){
		int cur = i; 
		int S = 0; 
		int an = 0; 
		int m = MAX*10+1;
		while(1){
			V[cur] = true;
			an++;
			int v = W[cur];
			S += v;
			m = min(m, v);
			cur = T[v];
			if(V[cur])	break;
		}
		ans += min(S+m*(an-2), (an+1)*s+m+S);
	}
	return ans;
}
int main(){
	s = MAX*10+1;
	cin>>n;
	for(int i = 0; i < n; i++){
		cin>>W[i]; s = min(s, W[i]);
	}
	cout<<solve()<<endl;
	return 0;
}







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

int main()
{
	char s[15];
	scanf("%s", s);
	
	int idx=0;
	char arr[15] = {'\0'};
	int len = strlen(s);
	
	for (int i=0; i<len ; i++)
	{
		if(s[i]=='0')
		{
			arr[idx]='0';
			idx++;
		}
		else if (s[i]=='1')
		{
			arr[idx]='1';
			idx++;
		}
		else if (s[i]=='B')
		{
			if (idx!=0){
			idx--;
			arr[idx]='\0';
			}
		}
	}
	printf("%s", arr);
	return 0;
}

Measured memory_bytes: 1708
#include<cstdio>
#include<algorithm>
using namespace std;
const int MAXN=105;
int n,a[MAXN],sum;
long long ans;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
		sum+=a[i];
	}
	sum=int(sum*1.0/n+((sum>=0)?(0.5):(-0.5)));
	for(int i=1;i<=n;i++)
		ans+=(a[i]-sum)*(a[i]-sum);
	printf("%lld\n",ans);
}

Measured memory_bytes: 128
#include<stdio.h>
int main(){
  int n,i,ac=0,wa=0,tle=0,re=0;
  char c[3];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s",c);
    if(c[0]=='A'){ac++;}
    if(c[0]=='W'){wa++;}
    if(c[0]=='T'){tle++;}
    if(c[0]=='R'){re++;}
  }
  printf("AC x %d\n",ac);
  printf("WA x %d\n",wa);
  printf("TLE x %d\n",tle);
  printf("RE x %d\n",re);
}

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

int main() {
	int n,q;
	cin>>n;
	long long int sum=0;
	vector<int> res(n,0);
	map<long long int,long long int> freq;
	for(int i=0;i<n;i++)
	{
	    cin>>res[i];
        sum+=res[i];
        freq[res[i]]++;
	}
	cin>>q;
	while(q--)
	{
	   long long int a,b;
	    cin>>a>>b;
	    long long int temp=freq[a];
	    freq[a]=0;
	    freq[b]+=temp;
	    sum=sum-(temp*a)+(temp*b);
	    
	    
	    cout<<sum<<endl;
	    
	}
	
	return 0;
}

Measured memory_bytes: 9380
#include <iostream>

using namespace std;

void outputArray(int* arr, int& s){
	int i;
	for(i=0;i<s;i++){
		cout << arr[i];
		if(i!=s-1){cout << ' ';}
		else      {cout << endl;}
	}
}

int main(){
	int n, i, j, k, v;
	bool sorted = false;
	cin >> n;
	int a[n];
	for(i=0;i<n;i++){
		cin >> a[i];
	}

	outputArray(a, n);

	//insertion sort
	for(i=1;i<n;i++){
		v = a[i];
		j = i - 1;
		while(j>=0&&a[j]>v){
			a[j+1] = a[j];
			j--;
		}
		a[j+1] = v;

		outputArray(a, n);
	}

}



Measured memory_bytes: 3100
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repe(i,n) for (int i = 0; i <= (n); ++i)
#define repe1(i,n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
using namespace std;
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;
const int INF = 1e9;
const ll mod = 1000000007;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a * b / gcd(a, b);}

ll pow_kai(ll a, ll n) {
    ll x = 1;
    while(n > 0) {
        if(n&1) {
            x = x*a;
        }
        a = a*a;
        n >>= 1;
    }
    return x;
}

int main() {
    vector<int> A(1000000);
    cin >> A[0];
    for(int i=1; i<A.size(); ++i) {
        if ((A[i-1])%2 == 0) {
            A[i] = A[i-1]/2;
        } else {
            A[i] = 3*A[i-1]+1;
        }
        rep(j,i) {
            if (A[i] == A[j]) {
                cout << i+1 << "\n";
                return 0;
            }
        }
    }
}

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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = (int)1e9 + 7;
void dbg(){ cerr << "\n"; }  template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }


int main(){
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n; cin >>n;
	VI a(n);
	rep(i, n) cin >>a[i];
	ll ans = 1LL<<60;
	rep2(i, -100, 101){
		ll sm =0;
		rep(j, n) sm += (a[j]-i)*(a[j]-i);
		ans = min(ans, sm);
	}
	cout << ans <<"\n";
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long ll;
typedef double db;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n;
	cin >> n;
	vector<pair<int, int>> a(n);
	for (int i = 0; i < n; ++i)
	{
		cin >> a[i].first;
		a[i].second = i;
	}
	sort(all(a));
	reverse(all(a));
	vector<vector<ll>> dp(n + 1, vector<ll>(n + 1, 0));
	dp[0][0] = 0;
	for (int i = 0; i < n; ++i)
	{
		for (int j = 1; j <= i + 1; ++j)
			{
				dp[j][i + 1 - j] = max(dp[j][i + 1 - j], dp[j - 1][i + 1 - j] + 1ll * a[i].first * abs(a[i].second + 1 - j));
				dp[i + 1 - j][j] = max(dp[i + 1 - j][j], dp[i + 1 - j][j - 1] + 1ll * a[i].first * abs(a[i].second - (n - j)));
			}
	}
	ll ans = 0;
	for (int i = 0; i <= n; ++i)
		ans = max(ans, dp[i][n - i]);
	cout << ans;
	return 0;
}

Measured memory_bytes: 34616
#include <stdio.h>
#include <string.h>
int min(int a,int b){
	int min = a;
	if(min>b)min=b;
	return min;
}
int main(void){
	int num0=0;
	int num1=0;
	char s[100000];
	scanf("%s",s);
	int n = strlen(s);
	int i;
	for(i=0;i<n;i++){
		if(s[i]=='0'){
			num0++;
		}else if (s[i]=='1'){
			num1++;
		}
	}
	int ans = min(num0,num1)*2;
	//printf("num0 = %d\n",num0);
	//printf("num1 = %d\n",num1);
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 256
n,m = map(int,input().split())
tree = [[] for _ in range(n)]
for i in range(m):
  start,to = map(int,input().split())
  tree[start - 1].append(to - 1)
  tree[to - 1].append(start - 1)
for i in range(n):
  print(len(tree[i]))

Measured memory_bytes: 3060
import itertools

n = int(input())
l = list(map(int, input().split()))

c = list(itertools.combinations(l, 3))
ans = 0
for i in c:
    j = sorted(i)
    if j[0] != j[1] != j[2] != j[0]:
        if j[2] < j[0]+j[1]:
            ans += 1
print(ans)


Measured memory_bytes: 20612
import math
n = int(input())
ls = list(map(int,input().split()))
ls.sort()
di = ls[:]
di.append(ls[-1]//2)
di.sort()
ind = di.index(ls[-1]//2)
il,ir = -1,-1
if ind > 0:
    il = ind - 1 
if ind < n-1:
    ir = ind + 1
if il < 0 or ir < 0:
    now = max(ir,il)
else:
    if ls[-1] % 2 == 0:
        if abs(ls[-1]//2 - di[ir]) < abs(ls[-1]//2 - di[il]):
            now = di[ir]
        else:
            now = di[il]
    else:
        if min(abs(ls[-1]//2 - di[ir]),abs(ls[-1]//2 + 1 - di[ir])) < min(abs(ls[-1]//2 - di[il]),abs(ls[-1]//2 + 1 - di[il])):
            now = di[ir]
        else:
            now = di[il]
print(ls[-1],now)

Measured memory_bytes: 19828
m, k = map(int, input().split())
if k >= 2 ** m:
	print("-1")
elif k == 0:
	res = []
	for i in range(2 ** m):
		res += [i, i]
	print(" ".join(map(str, res)))
elif m == 0:
	print("0 0")
elif m == 1:
	if k == 0:
		print("0 0 1 1")
	else:
		print(-1)
else:
	used = set()
	pair = []
	for i in range(2 ** m):
		if i not in used:
			used.add(i)
			used.add(i ^ k)
			pair.append((i, i ^ k))
	res = []
	for i in range(0, len(pair), 2):
		res += [pair[i][0], pair[i][1], pair[i + 1][0], pair[i + 1][1],
				pair[i][1], pair[i][0], pair[i + 1][1], pair[i + 1][0]]
	print(" ".join(map(str, res)))

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

using namespace std;

int a[100001];
int u[100001];

int main () {
	int n;
	cin >> n;
	int mx = 0;
	for (int i = 1;i <= n;i ++) {
		cin >> a[i];
		mx = max (mx, a[i]);
		u[a[i]] ++;	
	}
	if (u[mx] < 2) {
		cout << "Impossible";
		return 0;
	}
	for (int i = mx;i >= (mx + 1) / 2;i --) {
		if (mx % 2 == 0 && i == (mx + 1) / 2) {
			if (!u[i]) {
				cout << "Impossible";
				return 0;
			}
			u[i] -= 1;
			continue;
		}
		if (u[i] <= 1) {
			cout << "Impossible";
			return 0;
		}
		u[i] -= 2;
	}
	for (int i = 1;i <= mx;i ++) {
		if (i >= (mx + 1) / 2 + 1) continue;
		if (u[i]) {
			cout << "Impossible";
			return 0;
		}
	}
	cout << "Possible";
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<iterator>
#include<complex>
#include<stack>
using namespace std;
string s;
using MIte = multimap<vector<char>, int>::iterator;

int main() {
	int A ,B;
	cin >> A >> B;

	if ((A + B) % 2 == 0) {
		int ans = (A + B) / 2;
		cout << ans << endl;
	}
	else {
		cout << "IMPOSSIBLE" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <stack>
#include <queue>
#include <array>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <random>
#include <chrono>
#include <utility>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <sstream>
#include <assert.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

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

template<typename T, typename V> void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";} void _print() {cerr << "]\n";}
template <typename T, typename... V>void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef HOME
#warning CHECK int:ll::INT_MAX:LLONG_MAX
#define maxn 20
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define maxn 2000006
#define gcd __gcd
#define debug(x...)
#endif

#define ff first
#define endl '\n'
#define ss second
#define inf 0x3f3f3f3f
#define MOD 1000000007
#define PI 3.14159265358979323846264338327950L
#define f(i,x,n) for(int i=x;i<=n;i++)
#define fr(i,x,n) for(int i=x;i>=n;i--)
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;

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

vector<int> parent(maxn + 1);
vector<int> sze(maxn + 1, 1);

int find_parent(int v) {
	if (v == parent[v]) return v;
	return parent[v] = find_parent(parent[v]);
}

void union_set(int a, int b) {
	a = find_parent(a);
	b = find_parent(b);

	if (a != b) {
		if (sze[a] < sze[b]) swap(a, b);

		parent[b] = a;
		sze[a] += sze[b];
	}
	return;
}

int main() {
	iota(parent.begin(), parent.end(), 0);
	int n, m; cin >> n >> m;
	// vector<vector<int>> gr(n+1);
	for (int i = 1; i <= m; i++) {
		int u, v; cin >> u >> v;
		// gr[u].push_back(v);
		// gr[v].push_back(u);
		union_set(u, v);
	}

	int ans = 0;
	for (int i = 1; i <= n; i++) {
		if (i == find_parent(i)) ans++;
	}

	cout << ans - 1;



	return 0;
}

Measured memory_bytes: 18644
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>

using namespace std;
#define ll long long

int main(){
  int Q;
  cin >> Q;
  vector<int> L, R;
  int max = 0;
  for(int i=0; i<Q; i++){
    int l, r;
    cin >> l >> r;
    L.push_back(l);
    R.push_back(r);
    if(max < r)
      max = r;
  }
  vector<int> prime;
  bool memo[max];
  for(int i=0; i<max; i++)
    memo[i] = true;
  memo[0] = false;
  int tmp = 1;
  for(int i=0; i<max; i++){
    if(memo[i]){
      prime.push_back(i+1);
      for(int j=(i+1); j<max; j+=(i+1))
        memo[j-1] = false;
    }
  }
  // for(int i=0; i<prime.size(); i++)                                                                                                   
  //   cout << prime[i] << ' ';                                                                                                          
  // cout << endl;                                                                                                                       

  int memo2[max];
  memo2[0] = 0;
  for(int i=1; i<max; i++){
    int tmp = i+1;
    if(tmp % 2 == 1 &&
       (find(prime.begin(), prime.end(), tmp) != prime.end()) &&
       (find(prime.begin(), prime.end(), (tmp+1)/2) != prime.end()))
        memo2[i] = memo2[i-1] + 1;
    else
      memo2[i] = memo2[i-1];
  }
  // for(int i=0; i<max; i++)                                                                                                            
  //   cout << memo2[i] << ' ';                                                                                                          
  // cout << endl;                                                                                                                       

  for(int i=0; i<Q; i++){
    int l = L[i]; int r = R[i];
    cout << memo2[r-1] - memo2[l-1-1] << endl;
  }
  return 0;
}


Measured memory_bytes: 2164
import java.util.*;

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

        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] a = new int[M];
        int[] b = new int[M];
        int[] c = new int[N + 1];

        for(int i=0; i<M; i++){
            a[i] = sc.nextInt();
            b[i] = sc.nextInt();
            if(a[i]==1){
                c[b[i]]++;
            }
            if(b[i]==N){
                c[a[i]]++;
            }
        }

        for(int i=1; i<N; i++){
            if(c[i]>1){
                System.out.println("POSSIBLE");
                return;
            }
        }
        System.out.println("IMPOSSIBLE");
    }
}

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

int main() {
	int n;
	cin>>n;
	int tans=0, gans=0;
	int last = -1;
	while(n--) {
		int a;
		cin>>a;
		if (a > last)
			tans = 0;
		else
			tans++;
		last = a;
		gans = max(gans, tans);
	}
	cout<<gans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
std::vector <int> vec[100005];
int ans1[100005],ans2[100005];
int vis[100005];
int cnt1,cnt2;
void bfs(int begin, int ans[])
{
    std::queue <int> q;
    ans[begin] = 0;
    vis[begin] = 1;
    for (int i = 0; i < vec[begin].size(); i++)
    {
        q.push(vec[begin][i]);
        ans[vec[begin][i]] = 1;
        vis[vec[begin][i]] = 1;
    }
    while (!q.empty())
    {
        int z = q.front();
        int tmp = ans[z];
        q.pop();
        vis[z] = 1;
        for (int i = 0; i < vec[z].size(); i++)
        {
            if (vis[vec[z][i]])
                continue;
            vis[vec[z][i]] = 1;
            q.push(vec[z][i]);
            ans[vec[z][i]] = tmp + 1;
        }
    }
}
int main()
{
//    freopen("in.txt", "r", stdin);
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n - 1; i++)
    {
        int a,b;
        scanf("%d%d", &a, &b);
        vec[a].push_back(b);
        vec[b].push_back(a);
    }
    bfs(1, ans1);
    memset(vis, 0, sizeof(vis));
    bfs(n, ans2);
    for (int i = 1; i <= n; i++)
    {
        if (ans1[i] <= ans2[i])
            cnt1++;
        else
            cnt2++;
    }
    if (cnt1 > cnt2)
        printf("Fennec\n");
    else
        printf("Snuke\n");
    return 0;
}

Measured memory_bytes: 7040
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e6+10;
const ll mod = 998244353;
int prime[N],mu[N],tot;
bool vis[N];
ll ksm(ll a,ll p)
{
	ll res=1;
	while(p)
	{
		if(p&1)
		res=res*a%mod;
		a=a*a%mod;
		p>>=1;
	}
	return res;
}
void sieve()
{
	memset(vis,1,sizeof vis);
	vis[0]=vis[1]=0;
	mu[1]=1;
	for(int i=2;i<N;i++)
	{
		if(vis[i])
		{
			prime[tot++]=i;
			mu[i]=-1;
		}
		for(int j=0;j<tot&&1ll*i*prime[j]<N;j++)
		{
			int x=prime[j];
			vis[i*x]=0;
			if(i%x==0)
			{
				mu[i*x]=0;
				break;
			}
			else
			mu[i*x]=-mu[i];
		}
	}
}
ll n,a[N],f[N],cnt[N],ma;
int main()
{
	sieve();
	scanf("%lld",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&a[i]);
		cnt[a[i]]++;
		ma=max(ma,a[i]);
	}
	for(int i=1;i<=ma;i++)
	{
		ll sum=0;
		for(int j=i;j<=ma;j+=i)
		{
			f[i]=(f[i]+cnt[j]*(cnt[j]-1)/2*j%mod*j%mod+sum*j*cnt[j]%mod)%mod;
			sum=(sum+j*cnt[j]%mod)%mod;
		}
	}
	ll ans=0;
	for(int i=1;i<=ma;i++)
	{
		ll now=0;
		for(int j=i;j<=ma;j+=i)
		now=(f[j]*mu[j/i]%mod+now)%mod;
		ans=(ans+now*ksm(i,mod-2))%mod;
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 24832
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
 
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0
#define speed() cin.tie(0), cout.tie(0), ios_base::sync_with_stdio(false)
// #define exit(a, b) return cout << a, b;
 
// debugger
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#define debug(stuff) cout << #stuff << ": " << stuff <<endl
#define debugc(stuff) cout << #stuff << ": "; for(auto x: stuff) cout << x << " "; cout << endl;
// 
 
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define all(v) v.begin(), v.end() 
 
#define print(stuff) cout << stuff << endl
#define printc(stuff) for(auto x: stuff) cout << x << " "; cout << endl;
#define printPrec(stuff) cout << fixed << setprecision(15) << stuff << endl;
#define len length
#define ret0 return 0
#define ret return 
 
 
#define ll long long
#define ld long double
#define fi first
#define endl '\n'
#define se second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define fill(ar, x) memset(ar, x, sizeof ar)
 
#define vl vector<ll> 
#define sl set<ll>
#define pll pair<ll, ll>
#define mll map<ll, ll> 
#define pq priority_queue<ll>
 
// typedef tree<ll,null_type,less<ll>,rb_tree_tag,
// tree_order_statistics_node_update> indexed_set;
 
#define inf (long long int) 1e18
#define eps 0.000001
#define mod 1000000007
#define mod1 998244353
#define MAXN (ll)2e5+5
#define N (1ll<<10)

void solve(){
    string s;
    cin>>s;
    if(s == "ABC") print("ARC");
    else print("ABC");
}
 
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    #ifndef ONLINE_JUDGE
        start_routine();
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
 
    ll t = 1;
    // cin>>t;
    while(t--){
        solve();
    }
        
    #ifndef ONLINE_JUDGE
        end_routine();
    #endif
}


Measured memory_bytes: 3640
#065a
X,A,B = map(int, input().split())

#賞味期限を X+1日以上過ぎた食品を食べると、お腹を壊します。
#賞味期限を過ぎずに食べると、おいしく感じます。そうでない場合、おいしく感じません。

if B-A <= 0:
    print("delicious")
elif (B-A)-X <= 0:
    print("safe")
else:
    print("dangerous")

Measured memory_bytes: 2940
let () =
  let (n:int),(quantum:int) = Scanf.scanf "%d %d\n" (fun a b -> a,b) in
  let (q:(string * int) Queue.t) = Queue.create () in
  for i=1 to n do
    Queue.push (Scanf.scanf "%s %d\n" (fun a b -> a,b)) q
  done;
  let (sum:int ref) = ref 0 in
  while not (Queue.is_empty q) do
    match Queue.pop q with
      p,t when t <= quantum ->
      sum := !sum + t;
      Printf.printf "%s %d\n" p !sum
    | p,t ->
      Queue.push (p,t-quantum) q;
      sum := !sum+quantum
  done

Measured memory_bytes: 12648
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vii = vector<vi>;
using in6 = int64_t;
using ind = double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int n;
  cin >> n;
  vi data(n);
  rep(i,n) cin >> data[i];
  vi so(n);
  rep(i,n) so[i] = data[i];
  sort(so.begin(), so.end());
  int ans1 = so[n/2 - 1];
  int ans2 = so[n/2];
  rep(i,n) {
    if(data[i]  <= ans1) cout << ans2 << endl;
    else cout << ans1 << endl;
  }
}


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

int main(void){
    long long n;
    cin >> n;
    
    long long min = (long long)sqrt(n);
    while(n % min != 0){
        min--;
    }
    
    n /= min;
    
    int ans = 0;
    while(n){
        ans++;
        n /= 10;
    }
    
    cout << ans << 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 count = 0;
  long sum = 0;

  for (int i = 0; i < N; i++) {
    int v ;
    cin >> v;
    if (v < 0) {
      count++;
    }
    A[i] = abs(v);
    sum += A[i];
  }

  sort(A.begin(), A.end());

  if (count % 2 != 0) {
    sum -= (2 * A[0]);
  }

  cout << sum << endl;
  
}

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

void print_array(int a[], int n)
{
    for(int i=0;i<n;i++)
    {
        cout << a[i];
        if(i!=n-1) cout << " ";
    }
    cout << endl;
}

int selectionSort(int A[], int N) {
    int count = 0;
    int minj;
    for(int i=0;i<N;i++){
        minj = i;
        for(int j=i+1;j<N;j++){
            if(A[j]<A[minj]){
                minj = j;
            }
        }
        if(minj != i){
            swap(A[i], A[minj]);
            count++;
        }
    }
    return count;
}

int main() {
    int A[100], N, count;
    cin >> N;
    for ( int i = 0; i < N; i++ ) cin >> A[i];
    
    count = selectionSort(A, N);
    
    print_array(A, N);
    cout << count << endl;
}


Measured memory_bytes: 3088
# coding: utf-8
# Your code here!
n = input()
d = len(n)

res = 0
if d >= 2:
    res = 9*(d-1) + int(n[0]) - 1

res = max(res,sum(map(int,n)))
# print(n[0])
# print(sum(map(int,n)))
print(res)

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

int main(){
  long long A,B;
  cin >> A >> B;
  map<long long,int> cd;
  vector<long long> v(1,1);
  cd[1]=1;
  for(long long loop=2;loop<=(int)sqrt(A);loop+=2){
    if(!(A%loop)){
      cd[loop]=0;
      A/=loop;
      v.push_back(loop);
      while(!(A%loop)) A/=loop;
    }
    if(loop==2) loop--;
  }
  if(A!=1){
    cd[A]=0;
  	v.push_back(A);
  }
  for(long long loop=2;loop<=(int)sqrt(B);loop+=2){
    if(!(B%loop)){
      if(cd.count(loop)){
        cd[loop]=1;
      }
      B/=loop;
      while(!(B%loop))
        B/=loop;
    }
    if(loop==2) loop--;
  }
  if(cd.count(B)) cd[B]=1;
  long long ans=0;
  for(long long loop=0;loop<v.size();loop++){
    if(cd[v[loop]]) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main()
{
  int a, b, c, d;
  int cnt = 0;

  scanf("%d %d %d %d", &a, &b, &c, &d);
  
  while(1)
  {
    ++cnt;
    
    if(cnt % 2 == 1)
      c -= b;
    
    else
      a -= d;
    
    if(a <= 0)
    {
      printf("No");
      break;
    }
    
    else if(c <= 0)
    {
      printf("Yes");
      break;
    }
  }

  return 0;
}

Measured memory_bytes: 1732
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<functional>
#include<string>
#include<string.h>
#include<vector>
#include<map>
#include<math.h>
using namespace std;

#define ll long long

#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

template<class S, class T> inline void chmax(S &a, T b){ if (a < b)a = b; }
template<class S, class T> inline void chmin(S &a, T b){ if (a > b)a = b; }

int main(){
	string str;
	cin >> str;
	int point1(0), point2(1);
	int ans1(-1), ans2(-1);
	while (point1 < str.size() - 1){
		if (str[point1] == str[point2]){
			ans1 = point1+1, ans2 = point2+1;
			break;
		}
		else if (point2 + 1 < str.size() && str[point1] == str[point2 + 1]){
			ans1 = point1+1, ans2 = point2 + 2;
			break;
		}
		else point1++,point2=point1+1;
	}
	cout << ans1 << " " << ans2 << endl;
	return 0;
}

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

#define SORT(c) sort((c).begin(), (c).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
#define ANS(ans) cout << (ans) << endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;
typedef pair<int, int> P;

// repetition
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define REP(i, n) for (long long i = 0; i < (n); ++i)

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

  if (s[3] == s[2] && s[4] == s[5]) {
    ANS("Yes")
  } else {
    ANS("No");
  }
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		int W,H,x,y,r;
		Scanner in = new Scanner(System.in);
		
		W = in.nextInt();
		H = in.nextInt();
		x = in.nextInt();
		y = in.nextInt();
		r = in.nextInt();
		
		if(x+r <= W && x-r >=0 && y+r <= H && y-r >=0){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
		in.close();
	}
}

Measured memory_bytes: 17228
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <cctype>
#include <bitset>
#include <type_traits>

#include <list>
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define YES(j) cout << (j ? "YES" : "NO") << endl;
#define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
#define yes(j) std::cout << (j ? "yes" : "no") << endl;

int main(void)
{
    int n;
    cin >> n;
    int a[n];
    int max1 = 0;
    int maxnum = 0;
    int max2 = 0;
    REP(i, n)
    {
        int t;
        cin >> t;
        a[i] = t;
        if (max1 < t)
        {
            max2 = max1;
            max1 = t;
            maxnum = 1;
        }
        else if (max1 == t)
        {
            maxnum++;
        }
        if (max2 < t && t < max1)
        {
            max2 = t;
        }
    }

    if (maxnum >= 2)
    {
        REP(i, n)
        {
            cout << max1 << endl;
        }
    }
    else
    {
        REP(i, n)
        {
            if (a[i] == max1)
            {
                cout << max2 << endl;
            }
            else
            {
                cout << max1 << endl;
            }
        }
    }
}

Measured memory_bytes: 2432
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        int[] l = new int[m];
        int[] r = new int[m];
        ArrayList<Integer> id = new ArrayList<>();
 
        l[0] = scanner.nextInt();
        r[0] = scanner.nextInt();
        for (int i = l[0]; i <= r[0]; i++) {
            id.add(i);
        }
 
        if(m > 1) {
            for (int i = 1; i < m; i++) {
                l[i] = scanner.nextInt();
                r[i] = scanner.nextInt();
 
                if (id.size() == 0) {
                    break;
                }
 
                while (id.get(0) < l[i]) {
                    id.remove(0);
                    if (id.size() == 0) {
                        break;
                    }
                }
                              if (id.size() == 0) {
                    break;
                }
                while (id.get(id.size() - 1) > r[i]) {
                    id.remove(id.size() - 1);
                    if (id.size() == 0) {
                        break;
                    }
                }
            }
        }
        System.out.println(id.size());
    }
}

Measured memory_bytes: 85864
#include<stdio.h>

int main()
{
  int n,i,k,b=0,q;

  scanf("%d",&n);

  int A[n];

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

  scanf("%d",&q);
  for(i=0;i<q;i++)
    {
      scanf("%d",&k);
      if(sensearch(&A[0],n,k))b++;
    }
  printf("%d\n",b);

  return 0;
}

int sensearch(int *A,int n,int k)
{
  int i=0;
  A[n]=k;
  while(A[i]!=k)i++;

  return i != n;
}




Measured memory_bytes: 2108
#include <bits/stdc++.h>
#include <cstdlib>  // abs() for integer 絶対値求めやつ
#include <cmath>    // abs() for float, and fabs()
#include <algorithm>
#include <vector>
#include <string>
#include<iomanip>//浮動小数点数を出力する制度の指定
//使い方　数値をnumとして　cout<<setprecision(n)<<num ;nは桁数
#define rep(i,n) for(int i = 0; i < (n);i++)
#define SORT(a) sort((a).begin(),(a).end())
#define REV(a) reverse((a).begin(),(a).end())
using namespace std;
using ll =long long;
using db = double;
#define INF 2000000000
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
#define che(a,string) cout<<"//"<<string <<"=="<<(a)<<"//" <<endl;
bool IsInt(double a){int b = a/1;if(a==b){return true;}else {return false;}}
/*覚えてないことメaモ
  数値型から文字列に変換　to_string(number);これは簡単
  文字列から数値型に変換　stoi(number)
  文字列からllに変換　stoll(number)
  __gcd(a,b)は最大公約数を取ってくれる、aとb
  の大きい方をNとしたとき、計算量は√N
 */

//ここから書き始める
int main(){
	string s ;
	cin >> s;
	int judge = 1;
	for(int i = 0 ; i < s.size(); i++){
		if(i%2==0){ //キ数番目
			if(s[i]=='L'){
				cout <<"No"<<endl;
				judge = 0;
				break;
			}
		}
		else {
			if(s[i]=='R'){
				cout<<"No"<<endl;
				judge = 0;
				break;
			}
		}
	}
	if(judge) cout<<"Yes"<<endl;
}



Measured memory_bytes: 256
h,w=gets.split.map(&:to_i)
s=h.times.map{gets.chomp+?.}
s<<?.*(w+1)
flag=true
h.times{|i|w.times{|j|
  flag=false if s[i][j]==?#&&[[1,0],[0,1],[-1,0],[0,-1]].all?{|x,y|s[i+x][j+y]==?.}
}}
puts flag ? "Yes" : "No"

Measured memory_bytes: 1788
//
//  main.cpp
//

#include <algorithm>
#include <array>
#include <assert.h>
#include <iostream>
#include <limits>
#include <math.h>
#include <memory>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = long long;
using ull = unsigned long long;

int main() {
	struct Test {
		ll b;
		ll l;
		ll u;
	};
	ll N, X;
	vector<Test> tests;
	cin >> N >> X;
	for (int i = 0; i < N; i++) {
		int bi, li, ui;
		cin >> bi >> li >> ui;
		tests.push_back({bi, li, ui});
	}
	auto full_score = [X](Test test) {
		return (X - test.b) * test.u - (0 - test.b) * test.l;
	};
	sort(tests.begin(), tests.end(), [&full_score](Test lhs, Test rhs) {
		return full_score(lhs) > full_score(rhs);
	});
	vector<ll> full_score_sum;
	{
		ll sum = 0;
        full_score_sum.push_back(sum);
		for (Test test : tests) {
			sum += full_score(test);
			full_score_sum.push_back(sum);
		}
	}
	ll zero_score = 0;
	for (Test test : tests) {
		zero_score += (0 - test.b) * test.l;
	}
	ll lower = -1;
	ll upper = N * X;
	while (lower + 1 < upper) {
		ll time = (lower + upper) / 2;
		ll full_cnt = time / X;
		ll residue = time % X;
		ll score_max = numeric_limits<ll>::min();
		if (residue == 0) {
			ll score = 0;
            score = full_score_sum[full_cnt];
			score_max = max(score_max, score);
		} else {
			for (int i = 0; i < tests.size(); i++) {
				ll score = 0;
				if (residue < tests[i].b) {
					score = (residue - tests[i].b) * tests[i].l
						- (0 - tests[i].b) * tests[i].l;
				} else {
					score = (residue - tests[i].b) * tests[i].u
						- (0 - tests[i].b) * tests[i].l;
				}
                if (i >= full_cnt) {
                    score += full_score_sum[full_cnt];
                } else {
                    score += full_score_sum[i];
                    score += full_score_sum[full_cnt + 1] - full_score_sum[i + 1];
                }
				score_max = max(score_max, score);
			}
		}
        if (score_max + zero_score >= 0) {
            upper = time;
        } else {
            lower = time;
        }
	}
	cout << upper << endl;
}


Measured memory_bytes: 5104
#include<bits/stdc++.h>
#define U [1<<17]={}
#define G(a)((c=A[a]+A[P[a]]+C[a])%k?c:0)
typedef long long L;using namespace std;map<L,L>T U;L P U,E U,Z U,H U,C U,A U,O U,X U,B U,k,n,a,b,c;char s U;L D(L a){L d;Z[a]=1;for(map<L,L>::iterator I=T[a].begin();I!=T[a].end();I++)d=I->first,d-P[a]?P[d]=a,E[d]=E[a]+1,C[d]=I->second,D(d),Z[a]+=Z[d],!H[a]|Z[H[a]]<Z[d]?H[a]=d:0:0;}L M(L i){return i?B[i]+M(i^i&-i):0;}L S(L x,L i){for(x=G(x)+M(i++)-M(i);i<1e5;i+=i&-i)B[i]+=x;}L K(L f){a=X[f];n=X[b];return a-n?M(O[E[a]<E[n]?a=n,n=b,b=f,n:f])-M(O[a])+G(a)+K(P[a]):abs(M(O[f])-M(O[b]));}main(){for(cin>>n>>k;--n;T[a][b]=T[b][a]=c)cin>>a>>b>>c;for(D(a=b=0);n<*Z;a=H[P[++n]]-n?n:0)for(;!b|a;S(a=H[a],O[a]=b++))X[a]=n;for(cin>>a;cin>>s>>a>>b;*s&2?cout<<K(a)<<endl,0:A[a]+=b,S(H[a],O[a]),a&&S(a,O[a]-1));}

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

int main(int argc, const char * argv[]) {
    int n,a=0;
    cin>>n;
    int t[n],x[n],y[n],dt[n],dx[n],dy[n],dxy[n];
    for(int i=0;i<n;i++){
        cin>>t[i]>>x[i]>>y[i];
    }
    dt[0]=t[0];
    dx[0]=x[0];
    dy[0]=y[0];
    dxy[0]=abs(dx[0])+abs(dy[0]);
    //cout<<dt[0]<<' '<<dx[0]<<' '<<dy[0]<<endl;
    
    
    for(int i=0;i<n-1;i++){
        dt[i+1]=t[i+1]-t[i];
        dx[i+1]=x[i+1]-x[i];
        dy[i+1]=y[i+1]-y[i];
        dxy[i+1]=abs(dx[i+1])+abs(dy[i+1]);
        //cout<<dt[i+1]<<' '<<dx[i+1]<<' '<<dy[i+1]<<endl;
    }
    for(int i=0;i<n;i++){
        if(dt[i]%2==0 && dxy[i]%2==0 && dt[i]>=dxy[i])a=a+1;
        else if(dt[i]%2==1 && dxy[i]%2==1 && dt[i]>=dxy[i])a=a+1;
        //cout<<a<<endl;
    }
    //cout<<a<<endl;
    if(a==n)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 2944
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	int c=(s[0]-'0')*10+(s[1]-'0');
	int d=(s[2]-'0')*10+(s[3]-'0');
	if(c<=12&&c>=1&&d<=12&&d>=1) 
	{
		cout<<"AMBIGUOUS";
		return 0;
	}
	else if(c<=12&&c>=1) cout<<"MMYY";
	else if(d<=12&&d>=1) cout<<"YYMM";
	
	else cout<<"NA";
	return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    abc150c()
}

fun abc150c() {
    val n = readLine()!!.toInt()
    val p = readLine()!!.split(' ').map { it.toInt() }.joinToString("")
    val q = readLine()!!.split(' ').map { it.toInt() }.joinToString("")

    val perms = permutations((1..n).toList()).map { it.joinToString("") }.sorted()

    val a = perms.indexOf(p)
    val b = perms.indexOf(q)

    val answer = Math.abs(a - b)

    println(answer)
}

fun <T> permutations(src: List<T>): List<List<T>> {
    if (src.size == 1) return listOf(src)
    val perms = mutableListOf<List<T>>()
    val insertElement = src[0]
    permutations(src.drop(1)).forEach { perm ->
        for (i in 0..perm.size) {
            val newPerm = perm.toMutableList()
            newPerm.add(i, insertElement)
            perms.add(newPerm.toList())
        }
    }
    return perms
}


Measured memory_bytes: 53652
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define INF 100000000000000 //10^14
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
int main()
{
    ll K;
    cin >> K;
    vector<ll> A(K+1);
    A.at(0) = 1;
    rep(i, K) cin >> A.at(i+1);
    vector<pair<ll, ll>> est(K+1);
    est.at(K) = {2, 2};
    rep(i, K){
        ll r = est.at(K-i).second % A.at(K-i);
        if(est.at(K-i).first > est.at(K-i).second - r){
            cout << -1 << endl;
            return 0;
        }
        est.at(K-i).second -= r;
        r = est.at(K-i).first % A.at(K-i);
        if(r != 0){
            est.at(K-i).first += A.at(K-i) - r;
        }
        est.at(K-1-i).first = est.at(K-i).first;
        est.at(K-1-i).second = est.at(K-i).second + A.at(K-i) - 1;
    }
    cout << est.at(0).first << " " << est.at(0).second << endl;
}

Measured memory_bytes: 5552
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_map>
#include <map>
#define rep(i, a) for (int i = 0; i < (a); i++)
using namespace std;

int main() {
    long long int N,K;
    cin >> N >> K;
    long long int ans = 1;
    for(long long int i = 0; i < N; i++){
        ans = min(ans*2, ans+K);
    }    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Text;

namespace Fish.aizu
{
	public static class AizuOnlineJudge
	{
		public static int[] SplitToInts(string line)
		{
			return line.Split(' ').Select(x => int.Parse(x)).ToArray();
		}
		public static double[] SplitToDoubles(string line)
		{
			return line.Split(' ').Select(x => double.Parse(x)).ToArray();
		}
		public static long[] SplitToLongs(string line)
		{
			return line.Split(' ').Select(x => long.Parse(x)).ToArray();
		}
		public static int Main()
		{
			Compute(Console.In, Console.Out);
			return 0;
		}
		
		public static void Compute(TextReader reader, TextWriter writer)
		{
			var vv = SplitToInts(reader.ReadLine());
			var N = vv[0];
			var M = vv[1];
			var L = vv[2];
			
			var A = new long[N,M];
			var B = new long[M,L];
			var C = new long[N,L];
			
			for (var n = 0; n < N; n++)
			{
				var vvv = SplitToInts(reader.ReadLine());
				for (var m = 0; m < M; m++)
				{
					A[n,m] = vvv[m];
				}
			}
			for (var m = 0; m < M; m++)
			{
				var vvv = SplitToInts(reader.ReadLine());
				for (var l = 0; l < L; l++)
				{
					B[m,l] = vvv[l];
				}
			}
			for (var n = 0; n < N; n++)
			{
				for (var l = 0; l < L; l++)
				{
					for (var m = 0; m < M; m++)
					{
						C[n,l] += A[n,m] * B[m,l];
					}
				}
			}
			for (var n = 0; n < N; n++)
			{
				for (var l = 0; l < L; l++)
				{
					writer.Write(C[n,l]);
					if (l != L - 1)
					{
						writer.Write(' ');
					}
				}
				writer.WriteLine();
			}
		}
	}
}

Measured memory_bytes: 6444
#include <iostream>

using namespace std;

int main() {
	int n, count;
	while (cin >> n) {
		count = 0;
		for (int a = 0; a < 10; a++) {
			for (int b = 0; b < 10; b++) {
				for (int c = 0; c < 10; c++) {
					for (int d = 0; d < 10; d++) {
						if (a + b + c + d == n) {
							count++;
						}
					}
				}
			}
		}
		cout << count << endl;
	}
	return 0;
}

Measured memory_bytes: 3048
#include <iostream>
#include <iomanip> //! for setprecision(10)
#include <math.h>
#include <algorithm>
#include <functional> 
#include <string>
#include <vector>

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>

using namespace std;

typedef long long LL;

#define dump(c) { for (auto it = c.begin(); it != c.end(); ++it) if (it == c.begin()) cout << *it; else cout << ' ' << *it; cout << endl; } 
#define rep(i,n) for (int i = 0; i < (n); ++i)

const int MOD = 1000000007;

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

    int N, K;
    cin >> N >> K;

    vector<int> cnt(N);
    rep(i, K) {
        int d;
        cin >> d;
        rep(j, d) {
            int A;
            cin >> A;
            --A;
            ++cnt[A];
        }
    }

    int ans = 0;
    rep(i, N) {
        if (cnt[i] == 0) ++ans;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3656
#include<iostream>
#include<string>
#include<string.h>
#include<stdio.h>
#include<algorithm>
using namespace std;
int main()
{
	long long sum=0;
	int n,i;
	scanf("%d",&n);
	for (i=1;i<=n;i++)
	{
		int a;
		scanf("%d",&a);
		sum+=(long long)a-1;
	}
	printf("%lld",sum);
	return 0;
}

Measured memory_bytes: 256
from collections import defaultdict
import heapq

T = int(input())
test_cases = [list(map(int,input().split())) for _ in range(T)]


for test_num in range(T):
    hq = []
    kake_patterns = [2,3,5]
    cost_patterns = [test_cases[test_num][1],test_cases[test_num][2],test_cases[test_num][3]]
    plmi_cost = test_cases[test_num][4]
    heapq.heappush(hq,-test_cases[test_num][0])
    memo = defaultdict(int)
    memo[test_cases[test_num][0]] = 0
    memo[0] = plmi_cost*test_cases[test_num][0]
    
    while len(hq)>0:
        checking = heapq.heappop(hq)
        checking = -checking
        cost = memo[checking]
        
        if checking in [0,1]:
            continue
        for i,kake in enumerate(kake_patterns):
            if checking%kake == 0:
                devided1 = checking//kake
                devided2 = checking//kake
            else:
                devided1 = checking//kake
                devided2 = checking//kake + 1
                
            #devided1 = math.floor(checking/kake)
            #devided2 = math.ceil(checking/kake)
            
            added_cost1 = cost + abs(devided1*kake-checking)*plmi_cost + cost_patterns[i]
            added_cost2 = cost + abs(devided2*kake-checking)*plmi_cost + cost_patterns[i]
            
            if devided1 in memo:
                if added_cost1 < memo[devided1]:
                    memo[devided1] = added_cost1
            else:
                memo[devided1] = added_cost1
                heapq.heappush(hq,-devided1)
            
            if devided2 in memo:
                if added_cost2 < memo[devided2]:
                    memo[devided2] = added_cost2
            else:
                memo[devided2] = added_cost2
                heapq.heappush(hq,-devided2)
            
            if added_cost1 + devided1*plmi_cost < memo[0]:
                memo[0] = added_cost1 + devided1*plmi_cost
            if added_cost2 + devided2*plmi_cost < memo[0]:
                memo[0] = added_cost2 + devided2*plmi_cost
            
    print(memo[0])

Measured memory_bytes: 11316
import sys
input = lambda: sys.stdin.readline().rstrip("\r\n")
import random
D = int(input())
c = [int(x) for x in input().split()]
s = []
for _ in range(D):
    s.append([int(x) for x in input().split()])
t = [random.randint(1, 26) for x in range(D)]
last = [0]*26
ans = 0
for i in range(1, D + 1):
    ans += s[i - 1][t[i - 1] - 1]
    last[t[i - 1] - 1] = i
    for j in range(26):
        ans -= c[j]*(i - last[j])
    #print(ans)
print(*t, sep="\n")



Measured memory_bytes: 78044
n = int(input())
lis = [0 for i in range(10000000)]
cou = 1
while 1:
    if lis[n] == 1:
        print(cou)
        exit()
    lis[n] = 1
    if n % 2 == 0:
        n = n // 2
    else:
        n = 3 * n +1
    cou += 1

Measured memory_bytes: 83480
#include "bits/stdc++.h"
#include <random>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, m;
    cin >> n >> m;
    vector<P> v(n);
    rep(i,n) cin >> v[i].first >> v[i].second;
    sort(v.begin(), v.end());
    ll ans = 0;
    rep(i,n){
        if(m <= v[i].second){
            ans += v[i].first * m;
            break;
        }
        ans += v[i].first * v[i].second;
        m -= v[i].second;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4784
from collections import deque

n=int(input())
a_num = ord("a")
deque = deque()
deque.append(("a", a_num))
ans = []

if n > 1:
    while len(deque) > 0:
        s, s_num = deque.popleft()
        for i in range(a_num, s_num + 2):
            s_nxt = s + chr(i)
            s_num = max(s_num, i)
            if len(s_nxt) == n:
                print(s_nxt)
            else:
                deque.append((s_nxt, s_num))
else:
    print("a")

Measured memory_bytes: 6556
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
#define rep(i,a,b) for(int i=a;i<b;i++)
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/
 
 
typedef long long ll;
int N, A, B, H[101010];
//---------------------------------------------------------------------------------------------------
bool check(ll x) {
    ll c = 0;
    rep(i, 0, N) {
        ll h = 1LL * H[i] - 1LL * x * B;
        if (h <= 0) continue;
        c += h / A;
        if (h % A) c++;
    }
    return c <= x;
}
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N >> A >> B;
    A -= B;
    rep(i, 0, N) cin >> H[i];
 
    int ng = 0, ok = 1010101010;
    while (ng + 1 != ok) {
        int x = (ng + ok) / 2;
        if (check(x)) ok = x;
        else ng = x;
    }
    cout << ok << endl;
}

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


int main()
{
	ll N,A,B;
	cin>>N>>A>>B;
	ll min_v=A*(N-1)+B;
	ll max_v=A+(N-1)*B;
	cout<<max(max_v-min_v+1,(ll)0)<<endl;
	return 0;
}


Measured memory_bytes: 3504