akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
  int n;
  cin>>n;
  long long a[n];
  for (int i=0; i<n; i++) cin>>a[i];
  long long min_a = a[0], max_a = a[0];
  int idx_min = 0, idx_max = 0;
  for (int i=1; i<n; i++) {
    if (a[i] < min_a) {
      min_a = a[i];
      idx_min = i;
    }
    if (a[i] > max_a) {
      max_a = a[i];
      idx_max = i;
    }
  }
  vector<pair<int, int> > ans;
  if (min_a < 0 && max_a > 0) {
    if (abs(min_a) > max_a) {
      for (int i=0; i<n; i++) {
        if (a[i] != min_a) {
          a[i] += min_a;
          ans.emplace_back(idx_min, i);
        }
      }
      max_a += min_a;
    } else {
      for (int i=0; i<n; i++) {
        if (a[i] != max_a) {
          a[i] += max_a;
          ans.emplace_back(idx_max, i);
        }
      }
      min_a += max_a;
    }
  }
  if (min_a >= 0) {
    for (int i=1; i<n; i++) {
      if (a[i] < a[i-1]) {
        ans.emplace_back(i-1, i);
        a[i] += a[i-1];
      }
    }
  } else {
    for (int i=n-2; i>=0; i--) {
      if (a[i] > a[i+1]) {
        a[i] += a[i+1];
        ans.emplace_back(i+1, i);
      }
    }

  }
  cout<<ans.size()<<endl;
  for (auto i: ans) {
    cout<<i.first+1<<" "<<i.second+1<<endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <deque>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0; i<n; i++)

int main(){
    int n; cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    int ans=0;
    bool b = true;
    while(b){
        for (int i = 0; i < n; ++i) {
            if(a[i]%2==0) continue;
            else{
                b = false;
                break;
            }
        }
        rep(i,n) a[i] /= 2;
        ans++;
    }
    cout << ans-1 << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
    string s;
    cin >> s;
    set<char> cs;
    rep(i,s.size()) cs.insert(s[i]);
    rep(i,26) {
        char c = 'a'+i;
        if(cs.find(c) == cs.end()) {
            cout << c << endl;
            return 0;
        }
    }
    cout << "None" << endl;
}

Measured memory_bytes: 512
#include<stdio.h>
#include<stdlib.h>

int main(){
		int n,i,txy[100001][3]={0},f=0;
		scanf("%d",&n);
		txy[0][0]=0;
		txy[0][1]=0;
		txy[0][2]=0;
		for(i=1;i<=n;i++){
				scanf("%d%d%d",&txy[i][0],&txy[i][1],&txy[i][2]);
				if((txy[i][0]-txy[i-1][0])%2==(abs(txy[i][1]+txy[i][2]-txy[i-1][1]-txy[i-1][2])%2)&&(txy[i][0]-txy[i-1][0])-abs(txy[i][1]+txy[i][2]-txy[i-1][1]-txy[i-1][2])>=0);
				else f=1;
		}
		if(f==0)puts("Yes");
		else puts("No");
		return 0;
}


Measured memory_bytes: 1280
#include<stdio.h>
#include<math.h>
#include<stdlib.h>

int parent(int);
int left(int);
int right(int);

void maxHeapify(int*,int,int);

int main(){
  int i,n;
  int *num;
  int p;

  scanf("%d",&n);

  num=malloc(sizeof(int)*(n+2));

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

  
  for(i=n/2;i>=1;i--){
    maxHeapify(num,i,n+1);
  }
  for(i=1;i<n+1;i++){
    printf(" %d",num[i]);
  }
  printf("\n");

  return 0;

}

int parent(int i){
  return i/2;
}

int left(int i){
  return 2*i;
}

int right(int i){
  return 2*i+1;
}

void maxHeapify(int *num,int i,int n){
  int r,l;
  int largest;
  int tmp;
  l=left(i);
  r=right(i);

  if(l<=n && num[l]>num[i]){
    largest=l;
  }
  else{ largest=i; }

  if(r<=n && num[r]>num[largest]){
    largest=r;
  }

  if(largest!=i){
    tmp=num[i];
    num[i]=num[largest];
    num[largest]=tmp;
    maxHeapify(num,largest,n);
  }
    
}

Measured memory_bytes: 2556
n, a, b = map(int, input().split())
s = input()
cnt = 0
b_cnt = 0
for c in s:
    if c == 'b':
        b_cnt += 1
        if b_cnt <= b and cnt < a+b:
            cnt += 1
            print('Yes')
        else:
            print('No')
    elif c == 'a':
        if cnt < a+b:
            cnt += 1
            print('Yes')
        else:
            print('No')
    else:
        print('No')

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

int main() {
    int n, ans=0; cin >> n;
    int a[n];
    rep(i,1,n+1){
        cin >> a[i];
    }
    rep(i, 1, n+1) {
        if(a[i] == i){
            swap(a[i],a[i+1]);
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
namespace AtCoder.AGC016
{
    class ColorfulHat
    {
        public static void Main()
        {
            var yes = "Yes";
            var no = "No";
            var n = int.Parse(ReadLine());
            var testinomial = ReadLine().Trim().Split(' ').Select(_ => int.Parse(_));
            var suspect = testinomial.Distinct().OrderBy(_ => _).ToArray();
            if (suspect.Length > 2) WriteLine(no);
            else if (suspect.Length == 2 && ((suspect[0] + 1) != suspect[1])) WriteLine(no);
            else {
                var smaller = new Color(suspect[0], n);
                var bigger = new Color(suspect[0] + 1, n);
                foreach (var t in testinomial) {
                    if (smaller == t) {
                        smaller.Many++;
                        bigger.Single++;
                    }
                    else {
                        bigger.Many++;
                    }
                }
                if (smaller.IsNotParadoxical() || bigger.IsNotParadoxical()) WriteLine(yes);
                else WriteLine(no);
            }
        }
        struct Color
        {
            int ColorNum;
            int Num;
            public int Single, Many;
            public Color(int color, int n)
            {
                ColorNum = color;
                Num = n;
                Single = Many = 0;
            }
            public static implicit operator int(Color c)
            {
                return c.ColorNum;
            }
            public bool IsNotParadoxical()
            {
                return Num == Single + Many && ColorNum >= Single + ((Many == 0) ? 0 : 1) && ColorNum <= Single + Many / 2;
            }
        }


    }
}


Measured memory_bytes: 23904
#include <bits/stdc++.h>
#define FOR(i,a) for(int i=0;i<a;i++)
#define boost ios::sync_with_stdio(0); cin.tie(0);
using namespace std;

int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	boost;
	int m;
	cin >> m;
	vector<bool> visit(m);
	int cur = 0, ret = -1;
	for (int i = 0; ; ++i) {
		cur = (cur * 10 + 7) % m;
		if (visit[cur]) break;
		visit[cur] = true;
		if (cur == 0) {
			ret = i + 1;
			break;
		}
	}
	cout << ret << endl;
	return 0;
}


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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

ll R[200005];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, P;
    cin >> N >> P;
    string S;
    cin >> S;

    ll p = 1;
    REP(i, P - 2) {
        p = (p * 10LL) % P;
    }
    map<ll, ll> M;
    M[0]++;
    ll n = 0;
    ll pp = 1;
    ll ans = 0;
    if (P == 2) {
        REP(i, N) {
            if ((S[i] - '0') % 2 == 0) {
                ans += i + 1;
            }
        }
    }
    else if (P == 5) {
        REP(i, N) {
            if ((S[i] - '0') % 5 == 0) {
                ans += i + 1;
            }
        }
    }
    else {
        REP(i, N) {
            n = (S[i] - '0') + n * 10;
            n %= P;
            ll m = n * pp % P;
            ans += M[m];
            M[m]++;
            pp = (pp * p) % P;
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, T, A;
    cin >> N >> T >> A;
    ll answer = -1;
    double near = 1e6;
    for(int i = 0; i < N; i++)
    {
        double temp;
        cin >> temp;
        double diff = abs(A - (T - temp * 0.006));
        if(near > diff)
        {
            answer = i + 1;
            near = diff;
        }
    }
    cout << answer << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

typedef long long ll;

const int MAX_N = 1e5 + 10;

int main(int argc, char const *argv[])
{
    int n;
    ll h[MAX_N];

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

    bool tf = true;

    for (int i = n-1; i > 0 && tf; --i) {
        if (h[i]<h[i-1]) {
            h[i-1]--;
        }
    }

    
    for (int i = 0; i < n-1 && tf; ++i) {
        if (h[i]>h[i+1]) {
            tf = false;
        }
    }

    if (tf) {
        cout << "Yes" << endl;
    }
    else cout << "No" << endl;
    return 0;
}

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

// 数字の各桁の和を返す
int sumDigits (int n) {
    int s;
    while (n > 0) {
        s += n % 10;
        n /= 10;
    }
    return s;
}

// 最大公約数を返す
int gcd (int x, int y) {
  if (y == 0) return x;
  return gcd(y, x%y);
}

int main () {
    int H, W; cin >> H >> W;
    string S[50]; rep(i, H) cin >> S[i];

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

    rep(i, H) {
        rep(j, W) {
            if (S[i][j] == '#') continue;

            int num = 0;
            rep(k, 8) {
                int x = j + dx[k];
                int y = i + dy[k];

                if (x<0 || W<=x) continue;
                if (y<0 || H<=y) continue;

                if (S[y][x] == '#') num++;
            }
            S[i][j] = char(num + '0');
        }
    }
    rep(i, H) cout << S[i] << endl;
}

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

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

template<class T> bool umin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool umax(T &a, T b) { return a < b ? (a = b, true) : false; }

using namespace std;

int main(int argc, char** argv)
{
#ifdef HOME
	if (IsDebuggerPresent())
	{
		freopen("../in.txt", "rb", stdin);
		freopen("../out.txt", "wb", stdout);
	}
#endif
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.precision(10);
	cout << fixed;
	uint32_t N;
	cin >> N;
	vector<vector<int64_t> > a(N, vector<int64_t>(N));
	vector<int64_t> dp(1 << N);
	for (auto& ar : a)
		for (auto& ai : ar)
			cin >> ai;
	forn(i, 1 << N)
	{
		forn(j, N)
		{
			if ((1 << j)&i)
			{
				forn(k, j)
				{
					if ((1 << k)&i)
						dp[i] += a[j][k];
				}
			}
		}
	}
	auto dp2 = dp;
	forn(i, 1 << N)
	{
		int mask = i;
		while (mask)
		{
			int mask2 = i ^ mask;
			umax(dp2[i], dp2[mask] + dp2[mask2]);
			mask = (mask - 1)&i;
		}
	}
	cout << dp2.back() << endl;
	return 0;
}


Measured memory_bytes: 1280
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
 
int main(){
    string S;
    cin >> S;
    for(int i = 0; i < S.size(); i++){
        for(int j = i + 1; j < S.size(); j++){
            if(S[i] == S[j]){
                cout << "no" << endl;
                return 0;
            }
        }
    }
    cout << "yes" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;

map<long long,int> prime_factor(long long n){
    map<long long,int> mp;
    for(long long i = 2; i * i <= n; i++){
        while(n % i == 0){
            mp[i]++;
            n /= i;
        }
    }
    if(n != 1) mp[n]++;
    return mp;
}

signed main(){
    ll n;
    cin >> n;
    map<ll, int> cnt;
    for(ll i = 2; i <= n; i++){
        map<ll, int> mp = prime_factor(i);
        for(auto i : mp){
            cnt[i.first] += i.second;
        }
    }
    ll ans = 1;
    for(auto i : cnt){
        ans *= i.second + 1;
        ans %= MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,mx=0,coun=0;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    for(int i=1;i<n;i++)
    {
        if(a[i]>a[i-1])
            {
                mx =max(mx,coun);
                coun =0;
            }
        else
            coun++;
    }
    mx  = max(mx,coun);
    cout<<mx<<endl;
    return 0;
}


Measured memory_bytes: 640
n = int(input())
*preorder, = map(int, input().split())
*inorder, = map(int, input().split())


def reconstruction(l, r):
    global preorder
    global inorder

    if l >= r:
        return ""
    a = ""
    c = preorder.pop(0)
    i = inorder.index(c)
    a += reconstruction(l, i)
    a += reconstruction(i+1, r)
    a += f"{c} "
    return a


print(reconstruction(0, n).strip())



Measured memory_bytes: 5612
//#include <boost/multiprecision/cpp_dec_float.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <math.h>
#include <algorithm>
#include <bitset>
using namespace std;
//namespace mp = boost::multiprecision;
//using llll = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
//using Real = mp::number<mp::cpp_dec_float<1024>>;
using ll = long long;
const double EPS = 1e-10;
const ll MOD = 7+(1e+9);

int main(){
  ll n,ans=-1;
  ll a,b;
  cin>>a>>b;
  if(a<10&&b<10)ans=a*b;
  cout<<ans<<endl;
}


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

int main(){
	int index,jndex;
	for(index = 1; index <= 9 ; index++){
		for(jndex = 1 ; jndex <= 9 ; jndex++){
			cout<<index<<"x"<<jndex<<"="<<index*jndex<<endl;
		}
	}
	
} 

Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = ll(1e9) + 1;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, n) for(int i = 1; i <= (int)(n); i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

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

  vector<ll> p(a);
  vector<ll> q(b);
  vector<ll> r(c);
  for (int i = 0; i < a; ++i) {
    cin >> p[i];
  }
  sort(p.begin(),p.end(),greater<ll>());
  for (int i = 0; i < b; ++i) {
    cin >> q[i];
  }
  sort(q.begin(),q.end(),greater<ll>());
  for (int i = 0; i < c; ++i) {
    cin >> r[i];
  }
  sort(r.begin(),r.end(),greater<ll>());

  vector<ll> total(x+y+c);
  for (int i = 0; i < x; ++i) {
    total[i] = p[i];
  }
  for (int i = 0; i < y; ++i) {
    total[x+i] = q[i];
  }
  for (int i = 0; i < c; ++i) {
    total[x+y+i] = r[i];
  }
  ll ans = 0;
  sort(total.begin(),total.end(),greater<ll>());
  for (int i = 0; i < x + y; ++i) {
    ans += total[i];
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 4736
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.AGC_Challenge
{
    class _010_C
    {
        static void Main(string[] args)
        {
            Method(args);
            ReadLine();
        }

        static void Method(string[] args)
        {
            int n = ReadInt();
            long[] cnts = ReadLongs();
            List<int>[] graph = new List<int>[n];
            for (int i = 0; i < n; i++) graph[i] = new List<int>();
            for(int i = 0; i < n - 1; i++)
            {
                int[] ab = ReadInts();
                int a = ab[0] - 1;
                int b = ab[1] - 1;
                graph[a].Add(b);
                graph[b].Add(a);
            }
            bool[] visited = new bool[n];
            Stack<int> stack = new Stack<int>();
            bool ok = true;
            long cnt = DFS(graph, cnts, ref visited, ref ok, 0);
            if (ok && cnt != 0 && cnt != cnts[0]) ok = false;
            WriteLine(ok ? "YES" : "NO");
        }

        static long DFS(List<int>[] graph,long[] cnts,
            ref bool[] visited, ref bool ok, int now)
        {
            if (!ok) return 0;

            visited[now] = true;
            long cnt = 0;
            int nodes = 0;
            for(int i = 0; i < graph[now].Count; i++)
            {
                if (visited[graph[now][i]]) continue;
                nodes++;
                long tmp = DFS(graph, cnts,
                    ref visited, ref ok, graph[now][i]);
                if (cnts[now] < tmp)
                {
                    ok = false;
                    return 0;
                }
                cnt += tmp;
            }
            if (nodes == 0) return cnts[now];
            if (cnt < cnts[now] || cnt > cnts[now] * 2)
            {
                ok = false;
                return 0;
            }
            return cnts[now] * 2 - cnt;
        }

        private static string Read() { return ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


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

int main(){
  string a;
  cin >> a;
  int sum;
  while(a!="0"){
    sum=0;
    for(int i=0;i<a.size();i++){
      sum += a[i]-48;
    }
    cout << sum << endl;
    cin >> a;
  }
  return 0;
}



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

typedef long long ll;
const ll INF = ll(1e18) + 1;

bool C(ll K, vector<ll> &A, ll x) {
    int n = (int)A.size();
    ll count = 0;
    for (int i = 0; i < n; i++) {
        if (A[i] < 0) {
            int l = -1, r = n;
            while (r - l > 1) {
                int mid = (l + r) / 2;
                if (A[mid] * A[i] < x) {
                    r = mid;
                } else {
                    l = mid;
                }
            }
            count += n - r;
        } else {
            int l = -1, r = n;
            while (r - l > 1) {
                int mid = (l + r) / 2;
                if (A[mid] * A[i] < x) {
                    l = mid;
                } else {
                    r = mid;
                }
            }
            count += r;
        }
        if (A[i] * A[i] < x) count--;
    }
    count /= 2;
    return count < K;
}

int main() {
    ll N, K;
    cin >> N >> K;
    vector<ll> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];

    sort(A.begin(), A.end());
    ll lb = -INF, ub = INF;
    while (ub - lb > 1) {
        ll x = (lb + ub) / 2;
        if (C(K, A, x)) {
            lb = x;
        } else {
            ub = x;
        }
    }

    cout << lb << endl;
    return 0;
}

Measured memory_bytes: 1792
#import math
#import bisect
#import numpy as np
#import itertools
#import copy
import sys

ipti = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)

def main():
    n = int(input())
    s = input()

    if n % 2 == 0:
        if s[0:n//2] == s[n//2:n]:
            print('Yes')
        else:
            print('No')
    else:
        print('No')

if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i <(n) ; ++i)
#define PI 3.14159265
using namespace std;
using ll = long long;
void self_max(int &a,int b){
	a = max(a,b);
}
void self_min(ll &a,ll b){
	a = min(a,b);
}

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

	rep(i,n+1){
		d = i; d*=1.08;
		int x = (int)d;
		if(x == n){
			cout << i << endl;
			return 0;
		}
	}

	cout << ":(" << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main(void){

  int t;
  cin >> t;

  while(t--){
    int p,q;
    cin >> p >> q;
    int tmp=p*p+q*q,cnt=0;

    for(int n=0;n*n<=tmp;n++){
      for(int m=0;m*m<=tmp;m++){
        if(m*m+n*n<1)continue;
        if((m*p+n*q)%(m*m+n*n)==0 && (m*q-n*p)%(m*m+n*n)==0)cnt++;
      }
    }

    if(cnt*2<=8)cout << "P" << endl;
    else cout << "C" << endl;
  }
  return 0;
}

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

int main(void) {
	int n, a[1025], len, i, j, k, t, u, v;
	char str[1025];
	char ans[77];
	char let[9][6] = {{'.', ',', '!', '?', ' ', 0}, 
						{'a', 'b', 'c', 0},
						{'d', 'e', 'f', 0},
						{'g', 'h', 'i', 0},
						{'j', 'k', 'l', 0},
						{'m', 'n', 'o', 0},
						{'p', 'q', 'r', 's', 0},
						{'t', 'u', 'v', 0},
						{'w', 'x', 'y', 'z', 0}};
	
	scanf("%d", &n);
	while (n--) {
		scanf("%s", str);
		len = strlen(str);
		
		for (i = 0; i < len; i++)
			a[i] = str[i] - '0';
		a[len] = -1;
		
		for (i = 0; i < 77; i++)
			ans[i] = '\0';
		
		i = 0;
		j = 0;
		while (1) {
			if (a[i] == -1) break;
			t = 0;
			if (a[i] != 0) {
				u = a[i] - 1;
				while (1) {
					if (a[i] == 0) {
						v = t % strlen(let[u]);
						if (v)
							ans[j] = let[u][v-1];
						else
							ans[j] = let[u][strlen(let[u]) - 1];
						
						i++;
						j++;
						break;
					}
					t++;
					i++;
				}
			} else {
				i++;
			}
		}
		printf("%s\n", ans);
	}
	
	return 0;
}

Measured memory_bytes: 596
N = gets.to_i
a_list = gets.split.map(&:to_i).sort
b_list = gets.split.map(&:to_i).sort
rev_b_list = b_list.reverse
c_list = gets.split.map(&:to_i).sort

b_count_list = Array.new(N) { 0 }
rev_b_list.each.with_index do |b, i|
  ci = c_list.bsearch_index { |c| c > b }
  b_count_list[N - 1 - i] = b_count_list[N - 1 - i + 1] if i > 0
  next unless ci
  b_count_list[N - 1 - i] += N - ci
end
sum = 0

a_list.each do |a|
  i = b_list.bsearch_index { |b| b > a }
  break unless i
  sum += b_count_list[i]
end
puts sum


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

int main() {
    ll N;
    cin >> N;
    vector<ll> A(N),B(N);
    for(int i=0;i<N;i++){
        cin >> A[i];
    }
    for(int i=0;i<N;i++){
        cin >> B[i];
    }
    priority_queue<P> pq;
    for(int i=0;i<N;i++){
        ll v = B[i] - B[(N+i-1)%N] - B[(i+1)%N];
        // cerr <<"i=" << i <<"v=" << v << endl;
        if(v>0){
            pq.push(P(v,i));
        }
    }
    ll ans = 0;
    while(!pq.empty()){
        P p = pq.top();
        pq.pop();
        // cerr <<"t=" << p.second <<", val= " << p.first << endl;
       
        if(p.first  <A[p.second]){
            continue;
        }
        ll diff = B[p.second] - p.first;
        if(diff==0){
            continue;
        }
        ll n = (B[p.second] - A[p.second])/diff;
        B[p.second] -= diff*n;
        ans += n;
        for(int i=-1;i<2;i++){
            ll ni = (p.second + i +N)%N;
            ll v = B[ni] - B[(N+ni-1)%N] - B[(ni+1)%N];
            // cerr <<"ni=" << ni <<"v=" << v <<endl;
            if(v>0){
                pq.push(P(v,ni));
            }
        }
    }
    for(int i=0;i<N;i++){
        if(A[i] != B[i]){
            cout << -1 << endl;
            return 0;
        }
    }
    cout << ans << endl;

    

    return 0;
}

Measured memory_bytes: 5492
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iomanip>
using namespace std;
 
typedef long long ll;
 
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=(b-1);i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;
 
#define MOD 1000000007
 
int main(void) {
    ll d,n;
    cin>>d>>n;
    vector<vector<ll> > v(3,vector<ll>());
    rep(i,1,2000000){
        if(i%1000000==0){

        }
        else if(i%10000==0){
            v[2].pb(i);
        }
        else if(i%100==0){
            v[1].pb(i);
        }
        else{
            v[0].pb(i);
        }
    }
    sort(all(v[0]));
    sort(all(v[1]));
    sort(all(v[2]));
    cout << v[d][n-1] << endl;
    return 0;
}

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

int main(){
    ll n; cin>>n;
    cout<<n/2+n%2<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <time.h>
#include <stdio.h>
#include <vector>
#define int long long
constexpr auto INF = 1000000007;
using namespace std;
int gcd(int x, int y) {
    if (y == 0)return x;
    return gcd(y, x%y);
}
int lcm(int x, int y) {
    return x / gcd(x, y)*y;
}
int kai(int x) {
    int cnt = 1;
    if (x == 0)return 1;
    cnt = kai(x - 1);
    return x * cnt;
}
int prime(int n) {
    for (int i = 2; i*i <= n; i++) {
        if (n%i == 0)return false;
    }
    return n != 1;
}
/*Library End!*/

signed main() {
    int n;
    cin>>n;
    if(n==25)cout<<"Christmas"<<endl;
    else if(n==24)cout<<"Christmas Eve"<<endl;
    else if(n==23)cout<<"Christmas Eve Eve"<<endl;
    else cout<<"Christmas Eve Eve Eve"<<endl;
}


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

int ordena(const void* a, const void* b){
    if(*(int*)a < *(int*)b)
        return -1;
    if(*(int*)a > *(int*)b)
        return 1;
    else
        return 0;
}

int main(){
    int n, q;
    scanf("%d", &n);
    int vetor[n];
    for(int i=0;i<n;i++){
        scanf("%d",&vetor[i]);
    }
    qsort(vetor,n,sizeof(int),ordena);
    int medio=n/2;
    q=vetor[medio]-vetor[medio-1];
    printf("%d\n", q);

    return 0;
}


Measured memory_bytes: 892
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
	ios::sync_with_stdio(0);cin.tie(0);
	int n;
	cin>>n;
	vector<int> v(n);
	unordered_map<ll,ll> mp;
	ll ans = 0,x,y,q;
	for(int &t: v){cin>>t;ans+=t;mp[t]++;}
	cin>>q;
	while(q--)
	{
		cin>>x>>y;
		if(mp[x])
		{
			ans -= mp[x]*x;
			ans += mp[x]*y;
			mp[y] += mp[x];
			mp[x] = 0;
			cout<<ans<<'\n';
		}
		else cout<<ans<<'\n';
	}
}


Measured memory_bytes: 7368
#include<bits/stdc++.h>
#include<iostream>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=1e9+7;
const ll mod=1e9+7;
signed main(){
    ll n;cin>>n;
    string s;cin>>s;
    ll ans=0;
    ll r=0,g=0,b=0;
    rep(i,n){
        if(s[i]=='R')r++;
        else if(s[i]=='G')g++;
        else b++;
    }
    ans+=r*g*b;
    rep(i,n){
        REP(j,1,n){
            ll x=i+j,y=i+2*j;
            if(y>n-1)continue;
            if(s[i]!=s[x]&&s[i]!=s[y]&&s[x]!=s[y])ans--;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3636
from fractions import Fraction
from decimal import Decimal

n=int(input())
a=[Fraction(Decimal(input())) for _ in range(n)]

num=[aa.numerator*10**9//aa.denominator for aa in a]

cnt=[[0]*50 for _ in range(50)]
pair=[]

for nu in num:
    c2=0
    c5=0
    while nu>0 and nu%2==0:
        nu//=2
        c2+=1
    
    while nu>0 and nu%5==0:
        nu//=5
        c5+=1
    
    cnt[c2][c5]+=1
    pair.append((c2,c5))
ans=0

for i in range(49,-1,-1):
    for j in range(49,-1,-1):
        if i+1<49:
            cnt[i][j]+=cnt[i+1][j]
        if j+1<49:
            cnt[i][j]+=cnt[i][j+1]

        if i+1<49 and j+1<49:
            cnt[i][j]-=cnt[i+1][j+1]

for c2,c5 in pair:
    ans+=cnt[max(0,18-c2)][max(0,18-c5)]
    if c2>=9 and c5>=9:
        ans-=1

print(ans//2)

Measured memory_bytes: 214920
#include <iostream>
#include<algorithm>
#include<string>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#pragma region Macros
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define all(x) (x).begin(),(x).end()
#define swap(a,b) (a += b,b = a - b,a -= b)
#define ceil(a,b) ((a+b-1)/b)
int gcd(int a, int b) // assuming a,b >= 1
{
    if (a < b)
        swap(a, b);
    if (b == 0)
        return a;
    if (a % b == 0)
        return b;
    return gcd(b, a % b);
}
int lcm(int a, int b) // assuming a,b >= 1
{
    return  a * b / gcd(a, b);
}
using namespace std;
#pragma endregion
signed main() {
    string S;
    int X = 0;
    cin >> S ;
    rep(i, 4) {
        if (S[i] == '+')
            X++;
        else
            X--;
    }
        cout << X;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repp(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define rrep(i, n, m) for (int i = n; i >= m; i--)
#define p(s) cout << s << endl;
typedef long long LL;
template <class T>
bool contain(const std::string &s, const T &v)
{
    return s.find(v) != std::string::npos;
}

int main()
{
    int r,g,b; cin>>r>>g>>b;
    if((r*100+g*10+b)%4==0) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}


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

using namespace std;
using ll = long long;

const ll MOD = 998244353;

template <typename T, typename U>
T mypow(T b, U n) {
    if (n == 0) return 1;
    if (n == 1) return b % MOD;
    if (n % 2 == 0) {
        return mypow(b * b % MOD, n / 2);
    } else {
        return mypow(b, n - 1) * b % MOD;
    }
}

bool linear(pair<int, int> a, pair<int, int> b, pair<int, int> c) {
    int dx[2] = {b.first - a.first, c.first - a.first};
    int dy[2] = {b.second - a.second, c.second - a.second};

    return dx[0] * dy[1] == dx[1] * dy[0];
}

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

    pair<int, int> x[N];
    for (int i = 0; i < N; ++i) {
        cin >> x[i].first >> x[i].second;
    }

    set<set<int>> lineset;
    for (int i = 0; i < N; ++i) {
        for (int j = i + 1; j < N; ++j) {
            set<int> s = {i, j};

            for (int k = 0; k < N; ++k) {
                if (k == i || k == j) continue;
                if (linear(x[i], x[j], x[k])) s.insert(k);
            }

            lineset.insert(s);
        }
    }

    ll ans = (mypow(2LL, N) - N - 1 + MOD) % MOD;

    for (auto s : lineset) {
        int n = s.size();
        ans += MOD - (mypow(2LL, n) - n - 1);
        ans %= MOD;
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3968
#include<bits/stdc++.h>
using namespace std;
struct bracket
{
	int a,b;
}c[1000005],d[1000005];
bool cmp(bracket x,bracket y)
{
	return x.a+x.b>y.a+y.b;
}
bool cmp2(bracket x,bracket y)
{
	return x.b<y.b;
}
int main()
{
	int n,cnt1=0,cnt2=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		int t=0,maxt=0;
		char ch=getchar();
		while(ch!=')'&&ch!='(')ch=getchar();
		while(ch=='('||ch==')')
		{
			if(ch=='(')t++;
			else t--;
			maxt=max(maxt,-t);
			ch=getchar();
		}
		if(t>=0)c[++cnt1].a=t,c[cnt1].b=maxt;
		else d[++cnt2].a=t,d[cnt2].b=max(-t,maxt);
	}
	sort(c+1,c+cnt1+1,cmp2);
	int now=0;
	for(int i=1;i<=cnt1;i++)
	if(c[i].b>now)
	{
		puts("No");
		return 0;
	}
	else now+=c[i].a;
	sort(d+1,d+cnt2+1,cmp);
	for(int i=1;i<=cnt2;i++)
		if(d[i].b>now)
		{
			puts("No");
			return 0;
		}
		else now+=d[i].a;
	if(now)puts("No");
	else puts("Yes");
	return 0;
}

Measured memory_bytes: 11448
container = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
unser = int(input())
print(container[unser - 1])

Measured memory_bytes: 3060
#!/usr/bin/env python

n = int(input())

def g1(n, p): 
    ''' 
    How many times can n! be divided by p?
    '''
    if n == 0:
        return 0
    return n//p + g1(n//p, p)

def g2(n, p): 
    ''' 
    How many times can n!! be divided by p?
    '''
    if n%2 == 1:
        return g1(n, p) - g2(n-1, p)

    res = g1(n//2, p)
    if p == 2:  
        res += n//2
    return res 

ans = min(g2(n, 5), g2(n, 2)) 
print(ans)


Measured memory_bytes: 9092
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

template <typename T>
struct edge
{
    int src, to;
    T cost;
    edge(int to, T cost) : src(-1), to(to), cost(cost) {}
    edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}
    edge &operator=(const int &x)
    {
        to = x;
        return *this;
    }
    operator int() const { return to; }
};

template <typename T>
using Edges = vector<edge<T>>;

template <typename T>
using WeightedGraph = vector<Edges<T>>;

template <typename T>
using UnweightedGraph = vector<vector<T>>;

template <typename T>
using Matrix = vector<vector<T>>;

template <typename T>
pair<T, int> dfs(const WeightedGraph<T> &G, int v, int par)
{
    pair<T, int> res = {0, v};
    for (auto &e : G[v])
    {
        if (e.to == par)
            continue;
        auto dist = dfs(G, e.to, v);
        dist.first += e.cost;
        res = max(res, dist);
    }
    return res;
}

template <typename T>
T tree_diameter(const WeightedGraph<T> &G)
{
    auto p = dfs(G, 0, -1);
    auto q = dfs(G, p.second, -1);
    return q.first;
}

int main()
{
    int N;
    cin >> N;
    WeightedGraph<int> G(N);
    for (int i = 0; i + 1 < N; i++)
    {
        int x, y, z;
        cin >> x >> y >> z;
        G[x].emplace_back(y, z);
        G[y].emplace_back(x, z);
    }
    cout << tree_diameter(G) << endl;
}


Measured memory_bytes: 15900
#include<iostream>
#include <algorithm>
#include<string>
#include <bitset>
#include <vector>
#include <functional>
#include <climits>
#include <iomanip>
#include <utility>
#include <stack>
#include <queue>
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <numeric>
using namespace std;
using ll = long long;

typedef pair <int, int> pii;

int main()
{

	ll a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, ans = 0;
	//cout << LONG_MAX << endl;
	//long long n, A[1000000000];
	//ll n, m, q;
	string s, t;
	ll n, m;
	cin >> n;
	cin >> m;
	if (n>=m)
	{
		cin >> s;
		cin >> t;
	}
	else
	{
		cin >> t;
		cin >> s;
		swap(n, m);
	}
	a = n;
	b = m;
	ll x = a * b;
	ll tmp;
	/* 自然数 a > b を確認・入替 */
	if (a<b) {
		tmp = a;
		a = b;
		b = tmp;
	}

	/* ユークリッドの互除法 */
	ll r = a % b;
	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}
	a = x / b;
	//b = min(a / n, a / m);
	//c = max(a / n, a / m);
	b = a/n;
	c = a/m;
	d = 0;
	for (ll i = 0; i < a; i+=c)
	{
		//if (i>d)
		//{
		//	d += c;
		//}
		while (i>d)
		{
			d += b;
		}

		if (i==d)
		{
			if (s[i/b]!=t[i/c])
			{
				cout << -1 << endl;
				return 0;
			}
		}
	}

	cout << a << endl;
	//cout <<  << endl;

	////std::cout << std::fixed;
	//cout << std::setprecision(20) << << endl;
	//cout << d+1 << endl;
	//cout << "" << endl;

	return 0;
}
//accumulate(x, x + a, 0);
//memcpy(x, visited, sizeof(ll)*n);
//void kansuu(ll num, ll visited[10]) {}
//kansuu(1, zz);
//cout << setprecision(15) << v << endl;
//cout << char(z - 'a');
//log10(i) + 1 //10進数の桁数を取得

//int temp;
//for (int i = 0; i < n - 1; i++) {
//	for (int j = n - 1; j > i; j--) {
//		if (w[j - 1] < w[j]) {  /* 前の要素の方が大きかったら */
//			temp = w[j];        /* 交換する */
//			w[j] = w[j - 1];
//			w[j - 1] = temp;
//		}
//	}
//}



Measured memory_bytes: 512
n,m = gets.split.map(&:to_i)
wa = Array.new(n+1, 0)
ac = Array.new(n+1, false)
cnt = 0
m.times.map{
  q,s = gets.split
  q = q.to_i
  if !ac[q]
    if s=="AC"
      ac[q] = true
      cnt += 1
    else
      wa[q] += 1
    end
  end
}

wac = 0
(1..n).each{|i|
  wac += wa[i] if ac[i]
}

puts [cnt, wac]*" "

Measured memory_bytes: 4220
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#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;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

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

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

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

    vector<int> l(n+1, 0);
    for(int i=0; i<n; i++){
        if(s[i] == '<') l[i+1] = l[i] + 1;
    }

    vector<int> r(n+1, 0);
    for(int i=n-1; i>=0; i--){
        if(s[i] == '>') r[i] = r[i+1] + 1;
    }

    ll ans = 0;
    for(int i=0; i<=n; i++){
        ans += max(l[i], r[i]);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 4764
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep3(i, l, n) for (int i = l; i < n; ++i)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define out(a) cout << a << endl
#define outa(a, n) rep(_, n) cout << a[_] << " "; cout << endl
#define SZ(v) (int)v.size()
#define inf (int)(1e9+7)

int main() {
    int n;
    cin >> n;
    int t = 0, x = 0, y = 0;
    rep(i, n) {
        int a, b, c;
        cin >> a >> b >> c;
        if ((abs(b - x) + abs(c - y)) % 2 != (a - t) % 2) { out("No"); return 0; }
        if ((abs(b - x) + abs(c - y)) > (a - t)) { out("No"); return 0; }
        t = a; x = b; y = c;
    }
    out("Yes");
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
template <class T> inline bool chmin(T& a, T b) {
  if(a > b) {
    a = b;
    return true;
  }
  return false;
}

int INF = 1e9;
int main() {
  int N;
  cin >> N;
  vector<int> l2r(N + 2, 0);
  vector<int> r2l(N + 2, 0);
  string S;
  cin >> S;
  { // 先頭からお尻への黒の累積和
    int count = 0;
    for(int i = 1; i <= S.size(); ++i) {
      if(S[i - 1] == '#') {
        count++;
      }
      l2r[i] = count;
    }
  }
  { // お尻から先頭への白の累積和
    int count = 0;
    for(int i = S.size(); i >= 1; --i) {
      if(S[i - 1] == '.') {
        count++;
      }
      r2l[i] = count;
    }
  }
  int ans = INF;
  for(int i = 1; i <= S.size(); ++i) {
    chmin(ans, l2r[i - 1] + r2l[i + 1]);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 2180
def main():
    n, m = map(int, input().split())
    s = input()
    ss = s[::-1]
    if n <= m:
        print(n)
    else:
        cnt = 0
        for i in range(n + 1):
            if s[i] == "1":
                cnt += 1
            else:
                cnt = 0
            if cnt >= m:
                print(-1)
                exit()
        pos = 0
        res = []
        while n != pos:
            for i in reversed(range(m + 1)):
                if pos + i > n:
                    continue
                if ss[pos + i] != "1":
                    pos += i
                    res.append(i)
                    break
        print(*res[::-1])


if __name__ == '__main__':
    main()


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

int main() {
	long long n,co=0;
	cin>>n;
	long long int a[n];
	for (int i = 0; i < n; i++) {
	    cin>>a[i];
	}    
	long long maax=a[0];
	for(int i=1;i<n;i++)
	{
	    maax=max(maax,a[i]);
	   co+=maax-a[i];
	}
	cout<<co;
	return 0;
}


Measured memory_bytes: 5196
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>

#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,x,n) for(int i=x; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()
#define X first
#define Y second
#define pb push_back
#define eb emplace_back

using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

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 (a>b) { a=b; return 1; } return 0; }

template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

const ll INF = 0x3fffffff;


int main(){
	//ios_base::sync_with_stdio(0);
	int N;

	cin >> N;
	vector<string> a(N);
	rep(i,N) cin >> a[i];

	int ans = INF, al = 0;
	bool list[1000]={};
	rep(i,N){
		bool f = true;
		rep(j,N) if( a[j][i] == '.' ) f = false;
		if( f ){
			al++;
			list[i] = true;
		}
	}
	rep(i,N){
		bool f = true;
		rep(j,N) if( a[i][j] == '.' ) f = false;
		if( f ) chmin(ans, N - al);
	}
	bool check = true;
	rep(i,N){
		int b = 1;
		rep(j,N) if( a[j][i] == '#' ) b = 0;
		int cnt = 0;
		rep(j,N) if( a[i][j] == '.' ) cnt++;
		chmin( ans, (int)b + cnt + N - al );
		if( b == 0 ) check = false;
	}

	if( check ) ans = -1;
	cout << ans << endl;

	return 0;
}


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

using namespace std;

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<(b);i++)
#define repr(i,b,a) for(int i=int(b);i>=(a);i--)
#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool valid(int lx,int ux,int ly,int uy,int x,int y){
	return lx<=x&&x<ux&&ly<=y&&y<uy; 
}
ll power(ll x,ll p){
	if(p==0)return 1;
	ll res=power(x*x%mod,p/2);
	if(p%2==1)res=res*x%mod;
	return res;
}

int main()
{
	string s;
	cin>>s;
	cout<<(s=="ABC"?"ARC":"ABC")<<endl;
	return 0;
}

Measured memory_bytes: 3600
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main(){
    string S; cin >> S;
    long long res = 0;
    const int N = S.size();
    const int P = 2019;
    int m = 1;
    vector<int> mod(N);
    int val = 0;
    for(int i=N-1;i>=0;i--){
        val += m * (S[i]-'0');
        val %= P;
        mod[i] = val;
        m = 10 * m % P;
    }
    vector<int> cnt(P, 0);
    for(int i=0;i<N;i++){
        ++cnt[mod[i]];
        res += (mod[i] == 0 ? cnt[mod[i]] : cnt[mod[i]] - 1);
    }
    cout << res << endl;
}


Measured memory_bytes: 4420
def solve():
  N, C, K = map(int, input().split())
  ans = 1
  cnt = 0
  T = [int(input()) for _ in range(N)]
  T.sort()
  for i in range(N):
    if i==0:
      now = T[i]
    cnt += 1
    if now+K<T[i] or cnt>C:
      ans += 1
      cnt = 1
      if i<N-1:
        now = T[i]
  return ans
print(solve())

Measured memory_bytes: 13092
#include <iostream>
#include <string>
#include<vector>

int main() {
	int N; std::cin >> N;
	std::vector<std::string> S(N);
	int ac{ 0 };
	int wa{ 0 };
	int tle{ 0 };
	int re{ 0 };
	for (auto& r : S) {
		std::cin >> r;
		if (r == "AC")
			++ac;
		else if (r == "WA")
			++wa;
		else if (r == "TLE")
			++tle;
		else
			++re;
	}
	std::cout << "AC x " << ac << std::endl;
	std::cout << "WA x " << wa << std::endl;
	std::cout << "TLE x " << tle << std::endl;
	std::cout << "RE x " << re << std::endl;

	return 0;
}


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

int main() {
  int n;
  cin >> n;
  vector<int> t(n+1),x(n+1),y(n+1);
  for(int i=1;i<=n;i++){
    cin >> t.at(i) >> x.at(i) >> y.at(i);
  }
  
  int a,k=0;
  for(int i=0;i<n;i++){
    a = t.at(i+1)-t.at(i);
    a-= max(x.at(i)-x.at(i+1),x.at(i+1)-x.at(i));
    a-= max(y.at(i)-y.at(i+1),y.at(i+1)-y.at(i));
    if(a<0 || a%2 == 1){
      k=-1;
      break;
    }
  }
  
  if(k==0){
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  
  return 0;
}


Measured memory_bytes: 1408
import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)

  val x = sc.next
  val y = sc.next

  val alphabets = "ABCDEF"

  val res =
    if(alphabets.indexOf(x) > alphabets.indexOf(y)) ">"
    else if (alphabets.indexOf(x) < alphabets.indexOf(y)) "<"
    else "="

  println(res)

}

Measured memory_bytes: 27460
package main

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

func solve() {
	n := getInt()

	ans := "No"
	for i := 1; i <= 9; i++ {
		for j := 1; j <= 9; j++ {
			if i*j == n {
				ans = "Yes"
			}
		}
	}

	fmt.Fprintln(wr, ans)
}

// -----------------------------------------

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

func main() {
	// buf := 200001
	// sc.Buffer(make([]byte, buf), buf)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}

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

func getIntSlice(n int) []int {
	is := make([]int, n)
	for i := range is {
		is[i] = getInt()
	}
	return is
}

func getString() string {
	sc.Scan()
	s := sc.Text()
	return s
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#define rep(i, n) for(int i = 0; i < n; i++)
template<class T> inline void chmin(T& a, T b) {if (a>b) a=b; }
template<class T> inline void chmax(T& a, T b) {if (a<b) a=b; }
using namespace std;
typedef long long ll;
const ll LINF = 1e18;
const int INF = 1e9;

const int MAXN = 1005;
const int MAXV = MAXN*(MAXN-1)/2;
vector<int> to[MAXV];
int id[MAXN][MAXN];
int toId(int i, int j) {
    if (i>j) swap(i,j);
    return id[i][j];
}

bool visited[MAXV];
bool calculated[MAXV];
int dp[MAXV]; // max length of path from v
int dfs(int v) {
    if (visited[v]) {
        if(!calculated[v]) return -1;
        return dp[v];
    }
    visited[v] = true;
    dp[v] = 1;
    for (int u: to[v]) {
        int res = dfs(u);
        if (res==-1) return -1;
        dp[v] = max(dp[v], res+1);
    }
    calculated[v] = true;
    return dp[v];
}

int main() { 
    int n;
    cin >> n;
    vector<vector<int>> a(n, vector<int>(n-1));
    rep(i,n) {
        rep(j,n-1) {
            cin >> a[i][j];
            a[i][j]--;
        }
    }
    int V = 0;
    rep(i,n)rep(j,n) {
        if(i<j) {
            id[i][j] = V++;
        }
    }
    rep(i, n){
        rep(j, n-1) {
            a[i][j] = toId(i, a[i][j]);
        }
        rep(j,n-2) {
            to[a[i][j+1]].push_back(a[i][j]);
        }
    }
    int ans = 0;
    rep(i,V) {
        int res = dfs(i);
        if(res == -1) {
            puts("-1");
            return 0;
        }
        ans = max(ans, res);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 38528