akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>

#define STARTUP {(cin.tie(0));\
 (ios::sync_with_stdio(false));}

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).size()
#define MAX(list) std::max(list)
#define MIN(list) std::min(list)
#define YESNO(cond,yes,no){cout <<((cond)?(yes):(no))<<endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(),(list).rend())
#define CINVEC(vec) const int size = (vec).size(); REP(i,size) cin>>(vec)[i];

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
std::istream& operator>>(std::istream& is, std::pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2>& p) {
    os << p.first << p.second;
    return os;
}

using ll = long long;
using namespace std;
ll mod = 1'000'000'007;

const int INF = 1'050'000'000;

int main() {
    STARTUP;

    int A, B;
    cin >> A >> B;

    if (A + B >= 10) {
        cout << "error" << endl;
   }
    else {
        cout << A + B << endl;
    }
    return 0;
}

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

int main(){
    int a, b, t;
    int c=0;
    cin >> a >> b >> t;
    for(int i=1; i<=20; i++){
        if(a*i<=t+0.5){
            c+=b;
        }
        else
            break;
    }
    cout << c << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<long long>;
using pll = pair<long long, long long>;
#define rep(i,n) for(long long i(0);(i)<(n);(i)++)

bool isATGA(char c){
    if(c == 'A'||c == 'T'||c == 'G'||c == 'C'){
        return true;
    }
    else return false;
}
void solve(std::string S){
    ll ans = 0, cnt =0;
    for(auto x:S){
        if(isATGA(x)) {
            cnt++;
            ans = max(ans, cnt);
        }
        else{
            cnt = 0;
        }
    }
    cout << ans << endl;
}

int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include <stdlib.h>
int flag[1000005];
int a[200005];
int repeat[1000005];
int main()
{
    int n,maxn=0,ans=0;
    scanf("%d",&n);
    for(int i=1;i<=200000;i++)
    {
        flag[i]=0;repeat[i]=0;
    }
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&a[i]);
        if(a[i]>maxn)
            maxn=a[i];
    }
    for(int i=1;i<=n;i++)
    {
        if(repeat[a[i]])
        {
            flag[a[i]]=1;
        }
        repeat[a[i]]=1;
        for(int j=2;j*a[i]<=maxn;j++)
            flag[j*a[i]]=1;
    }
    for(int i=1;i<=n;i++)
    {
        if(!flag[a[i]])
            ans++;
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 10272
#include <iostream>
#include <string>

using namespace std;

string s;
int cnt[26];

int main(void)
{
	cin >> s;
	
	for(int i = 0 ;i < s.size();i ++){
		cnt[s[i]-'a']++;
	}
	
	for(int i = 0; i < 26; i++){
		if(cnt[i] % 2){
			cout << "No" << endl;
			return 0;
		}
	}
	
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
def solve():
    N=int(input())
    AL=[int(x) for x in input().split()]
    total=sum(AL)
    target=total/2

    now=0
    for i,a in enumerate(AL):
        now+=a
        if now>target:
            ans1=(now-target)*2
            ans2=(target-now+a)*2
            return int(min(ans1,ans2))
print(solve())


Measured memory_bytes: 26224
#include<bits/stdc++.h>
#define int long long
using namespace std;
string a,b;
int t,q;
vector<int> p[26];
signed main(){
	cin>>a>>b;
	for(int i=0;i<a.size();++i)
	{
		p[a[i]-'a'].push_back(i+1);
	}
	if(!p[b[0]-'a'].size())
	{
		cout<<-1;
		return 0;
	}
	int ans=0;
	int k=p[b[0]-'a'][0];
	ans+=k;
	for(int i=1;i<b.size();++i)
	{
		t=b[i]-'a';
		if(!p[t].size())
		{
			cout<<-1;
			return 0;
		}
		q=upper_bound(p[t].begin(),p[t].end(),k)-p[t].begin();
		if(q==p[t].end()-p[t].begin())
		{
			ans+=p[t][0]+a.size()-k;
			k=p[t][0];
		}
		else
		{
			ans+=p[t][q]-k;
			k=p[t][q];
		}
	}
	cout<<ans;
	
	return 0;
}

Measured memory_bytes: 1724
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;
using static AtCoder.Program;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            new ABC133().SolveC(new ConsoleInput(Console.In, ' '));
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }

    }
  class ABC133
  {
    public void SolveC(ConsoleInput cin)
        {
            var l = cin.ReadLong;
            var r = cin.ReadLong;
            long MOD = 2019;
            int loopCount = 0;
            long result = MOD;
            for (long i = l; i <= Min(r, l + 1 + MOD); i++)
            {
                for (long j = i + 1; j <= Min(r, l + 1 + MOD); j++)
                {
                    result = Min(result, ((i % MOD) * (j % MOD)) % MOD);
                    loopCount++;
                }
                if (result == 0)
                {
                    break;
                }
            }
            WriteLine(result);
            ReadLine();
        }
  }
}


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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int a, b, c, d;

int main() {
	string u;
	cin >> u;
	
	a = u[0] - '0';
	b = u[1] - '0';
	c = u[2] - '0';
	d = u[3] - '0';
	
	inc(i, 2) {
	inc(j, 2) {
	inc(k, 2) {
		int s[2] = { +1, -1 };
		string t[2] = { "+", "-" };
		if(a + s[i] * b + s[j] * c + s[k] * d == 7) {
			cout << a << t[i] << b << t[j] << c << t[k] << d << "=7" << endl;
			return 0;
		}
	}
	}
	}
	
	return 0;
}


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

const int N = 100005;

int n, m, q;
int V[N], D[N], C[N];
vector<int> G[N];
bool vis[N][11];
int color[N];

int paint(int u, int d, int c) {
	if (vis[u][d]) return 1;
	if (d == 0) {
		color[u] = c;
		return vis[u][d] = 1;
	}

	paint(u, d - 1, c);
	for (int v : G[u]) paint(v, d - 1, c); 
	return vis[u][d] = 1;
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> n >> m;
	while(m--) {
		int u, v; cin >> u >> v;
		G[u].push_back(v); G[v].push_back(u);
	}
	cin >> q;
	for (int i = 1; i <= q; ++i) {
		cin >> V[i] >> D[i] >> C[i];
	}

	for (int i = q; i >= 1; --i) {
		paint(V[i], D[i], C[i]);
	}

	for (int i = 1; i <= n; ++i) printf("%d\n", color[i]);
}

Measured memory_bytes: 9208
#include <bits/stdc++.h>
using namespace std;
int main(){
  char n;
  cin >> n;
  if(n=='A')
    cout << 'T' << endl;
    else if(n=='T')
      cout << 'A' << endl;
  else if(n=='C')
    cout << 'G' << endl;
  else
    cout << 'C' << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
typedef long long ll;
int main(void){
    int n,cnt = 0;
    cin >> n;
    vector<int> p(n);
    for(int i = 0;i < n;i++) cin >> p[i];
    for(int i = 1;i < n-1;i++){
        if(p[i] > p[i-1] && p[i] < p[i+1]) cnt++;
        if(p[i] < p[i-1] && p[i+1] < p[i]) cnt++;
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
fun main(args :Array<String>){
  var input:String?=readLine()
  var first:String? =""
  var second:String? = ""
  var num:Int = input!!.length
  var index:Int = 0
  input!!.forEach{
    if (index<=(num-1)/2-1){
      first += it.toString()
      index++
    }else if(index>=(num+3)/2-1){
      second += it.toString()
      index++
    }else{
      index++
    }
  }
  if(first==second){
    println("Yes")
  }else{
    println("No")
  }
}

Measured memory_bytes: 33524
#include<bits/stdc++.h>
using namespace std;
int main(){
      long long int a,b,c,d,e,f;
      cin>>a>>b>>c>>d;
      e=a*b;
      f=c*d;
      if(e>f)printf("%lld",e);
      else if(e<f)printf("%lld",f);
      else printf("%lld",e);
}


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

int main(){
    int n, m; cin >> n >> m;
    vector<ll> a(n);
    vector<ll> b(n);
    for(int i=0; i<n; i++) cin >> a[i] >> b[i];
    vector<pair<int, int>> ab(n);
    for(int i=0; i<n; i++) ab[i] = make_pair(a[i], b[i]);
    sort(ab.begin(), ab.end());
    ll ans = 0;
    for(int i=0; i<n; i++){
        int buy = min(m, ab[i].second);
        ans += (ll)buy * ab[i].first;
        m -= buy;
    }
    cout << ans << endl;
    return 0;

}

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

int main() {
	int a, b, p, q;
	cin >> a >> b >> p >> q;
	int i = 0;
	while (a > 0 && p > 0) {
		if (i & 1) {
			a = a - q;
		} else {
			p = p - b;
		}
		i++;
	}

	if (a <= 0) {
		cout << "No" << endl;
	}
	else {
		cout << "Yes" << endl;
	}
}

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

int main(){
    int n;
    cin>> n;
    
    int answer;
    for(int i = 0; i < 6; i++){
        if(n >= pow(10, i) && n < pow(10, i + 1)){
            switch(i){
                case 0:
                    answer = n;
                    break;
                case 1:
                    answer = 9;
                    break;
                case 2:
                    answer = 9 + n - 99;
                    break;
                case 3:
                    answer = 909;
                    break;
                case 4:
                    answer = 909 + n - 9999;
                    break;
                case 5:
                    answer = 90909;
                    break;
            }
        }
    }
    
    cout << answer << endl;
}

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

int main() {
  int n, p; cin >> n >> p;
  vector<int> A(n);
  rep(i,n) cin >> A[i];

  const int N = 55;
  vector<vector<ll>> pas(N, vector<ll>(N,1));
  rep(i,N) {
    rep(j,N) {
      if (0<j && j<=i) {
        pas[i][j] = pas[i-1][j-1] + pas[i-1][j];
      } else {
       if (i<j) pas[i][j] = 0;
      }
    }
  }

  int oddcnt = 0, evencnt = 0;
  rep(i,n) {
    if (A[i] % 2) oddcnt++;
    else evencnt++;
  }

  ll es = 0, os = 0;
  for (int i = 0; i<= evencnt; i++) {
    es += pas[evencnt][i];
  }
  for (int i = p; i <= oddcnt; i+=2) {
    os += pas[oddcnt][i];
  }
  cout << es * os << endl;
  return 0;
}

Measured memory_bytes: 3636
from collections import Counter
N, M = map(int, input().split())
A = [0] + [int(i) for i in input().split()]

for i in range(N):
    A[i + 1] += A[i]
    A[i + 1] %= M
    
def comb(n, k):
    k = min(k, n - k)
    result = 1
    for i in range(n, n - k, -1):
        result *= i
    for i in range(1, k + 1):
        result //= i 
    return result

ans = 0
for i in Counter(A).values():
    if i > 1:
        ans += comb(i, 2)

print(ans)

Measured memory_bytes: 14628
#coding: UTF-8
def isPrime(n):
  if n == 1:
    return False
  import math
  m = math.floor(math.sqrt(n))
  for i in range(2,m+1):
    if n % i == 0:
      return False
  return True

n = int(input())
count = 0
for j in range(n):
  m = int(input())
  if isPrime(m):
    count += 1

print(count)


Measured memory_bytes: 5684
#include <stdio.h>

int main(void)
{
	int n;
	int i;
	int a;
	long s=0,max=-10000000,min=10000000;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a);
		if(max<a)max=a;
		if(min>a)min=a;
		
		s+=a;
	}
	printf("%d %d %ld\n",min,max,s);
	return 0;
}

Measured memory_bytes: 600
#include<stdio.h>
int main(void)
    {
	int S,h,m,s;
	scanf("%d",&S);
	h=S/3600;
	S=S%3600;
	m=S/60;
	s=S%60;
	printf("%d:%d:%d\n",h,m,s);
	return 0;
}	

Measured memory_bytes: 592
#include"bits/stdc++.h"
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define INF 1e+9


int main() {
	pair<int, char> p[100001];
	int n,a;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a;
		if (a == i) p[i] = make_pair(a,'x');
		else p[i] = make_pair(a, 'o');
	}

	int ans = 0;
	for (int i = 1; i <= n; i++) {
		if (p[i].second == 'x') {
			if (p[i + 1].second == 'x') {
				p[i + 1].second = 'o';
				ans++;
			}
			else {
				ans++;
			}
		}
	}

	cout << ans << endl;

	return 0;
}

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

int main()
{
	int n;
	while( cin >> n ){
		int ansA, ansV;
		ansA = 100, ansV = 0;
		for( int i = 0; i < n; ++i ){
			int a, v;
			cin >> a >> v;
			if( ansV < v ){
				ansA = a;
				ansV = v;
			}else if( ansV == v && ansA > a ){
				ansA = a;
			}
		}
		cout << ansA << " " << ansV << endl;
	}

	return 0;
}

Measured memory_bytes: 3076
N=int(input())
a=list(map(int,input().split()))
rate=[400,800,1200,1600,2000,2400,2800,3200]
a.sort()
answer=0
counter=0
i=0
j=0
while i<N:
    if a[i]>=rate[j]:
        j+=1
    else:
        answer+=1
        while i<N and a[i]<rate[j]:
            i+=1
        j+=1
    if i<N and j==8:
        counter+=N-i
        break
print(max(answer,1),answer+counter)

Measured memory_bytes: 3064
#include<iostream>
#include<stack>
using namespace std;
typedef long long ll;
ll n,m;
int main(){
	ios::sync_with_stdio(false);
	cin >> n >> m;
	if(n>m) swap(n,m);
	if(n==1){
		if(m==1) cout << 1 << endl;
		else cout << m-2 << endl;
	}
	else{
		cout << (n-2)*(m-2) << endl;
	}
}

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

int main() {
    
  int K,s;
  string S;
  
  cin >> K >> S;
  s = S.size();
  if (K >= s){
    cout << S << endl;
  }else{
    for (int i=0; i<K; i++){
      char a = S.at(i);
      cout << a;
    }
    cout << "..."<< endl;
  }
  
  
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define nyan "(=^･ω･^=)"
#define mkp make_pair
#define lP pair<ll, ll>
#define iP pair<int,int>
typedef long long ll;
using namespace std;

int N, M, ansl, ansr, A, a[300][300];

int main() {
	cin >> N >> M;
	ansr = N;
	for (int i = 0; i != N; ++i) {
		for (int j = 0; j != M; ++j) {
			cin >> a[i][j];
			--a[i][j];
		}
	}
	while (ansl + 1 != ansr) {
		int t = (ansl + ansr) / 2;
		vector<bool> b(M, true);
		bool f = false;
		int c = 0;
		while (!f && c != M) {
			vector<int>cnt(M, 0);
			for (int i = 0; i != N; ++i) {
				for (int j = 0; j != M; ++j) {
					if (b[a[i][j]]) {
						++cnt[a[i][j]];
						break;
					}
				}
			}
			f = true;
			for (int i = 0; i != M; ++i) {
				if (cnt[i] > t) {
					f = false;
					b[i] = false;
					++c;
				}
			}
		}
		if (f)
			ansr = t;
		else
			ansl = t;
	}
	cout << ansr << endl;
	return 0;
}

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

void print(int A[],int N){
    for(int i=0;i<N;i++){
        if(i){
            cout <<" ";
        }
            cout <<A[i];

    }
    cout <<endl;
}

int bubbleSort(int A[],int N){
    int sw = 0;

    bool flag =1;

    for(int i =0 ;flag;i++){
        flag=0;

        for(int j=N-1;j>=i+1;j--){
            if(A[j]<A[j-1]){

                swap(A[j], A[j-1]);
                flag=1;
                sw++;
            }
        }
        // print(A,N);
    }
    return sw;
}


int main(){
    int A[100],N,sw;

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

    sw =bubbleSort(A, N);

    print(A, N);

    cout <<sw << endl;

    return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <string>
#include <utility>
#include <map>
#include <cmath>
#include <bitset>
#include <deque>
#include <queue>
#define INF (1LL<<31)
#define fst first
#define snd second
typedef long long ll;
typedef std::pair<int,int> ii;
using namespace std;

int main(){
  int n;
  cin>>n;
  cout<<"ABC"<<n<<endl;
  return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("O3", "unroll-loops")
#pragma GCC target("avx2")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define int long long
#define double long double
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define ms(v,x) memset(v,x,sizeof(v))
#define pii pair<int,int>
#define ff first
#define ss second
#define frr(i,n) for(int i=0;i<n;i++)
#define td(v) v.begin(),v.end()
#define inf 1000000000 // 1e9
#define M   1000000007 // 1e9 + 7
using namespace std;
inline int mod(int n, int m){ int ret = n%m; if(ret < 0) ret += m; return ret; }
int gcd(int a, int b){return (b == 0 ? a : gcd(b, a%b));}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int exp(int a,int b,int m){
    if(b==0) return 1;
    if(b==1) return mod(a,m);
    int k = mod(exp(a,b/2,m),m);
    if(b&1){
        return mod(a*mod(k*k,m),m);
    }
    else return mod(k*k,m);
}
string s;
int v[] = {1,10,9,12,3,4};
int dp[100100][13];
int f(char c){
    return (c-'0');
}
int add(int a,int b){
    int ret = a + b;
    if(ret >= M) ret-= M;
    return ret;
}
int solve(int idx,int mdl){
    int &x = dp[idx][mdl];
    if(x!=-1){
        return x;
    }
    if(s[idx]!='?'){
        return x = solve(idx+1,(mdl + f(s[idx]) * v[idx%6]) % 13 );
    }
    else{
        x = 0;
        for(int i=0;i<=9;i++){
            x = add(x,solve(idx+1, (mdl + i * v[idx%6])%13 )) ;
        }
        return x;
    }
}
int32_t main(){
    fastio;
    cin >> s;
    reverse(td(s));
    ms(dp,-1);
    for(int i=0;i<13;i++) dp[s.size()][i] = 0;
    dp[s.size()][5] = 1;
    cout << solve(0,0) << endl;
}

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

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define ALL(v) (v.begin(),v.end())
#define COUT(x) cout<<(x)<<"\n"

int main(){
    int a,b,c,d,e,f;
    cin >> a >> b >> c >> d >> e >> f;
    
    set<int> water_set, sugar_set;

    //water
    for(int i=0;i<30;i++){
        for(int j=0;j<=30;j++){
            if(i==0&&j==0) continue;
            int w = 100*a*i+100*b*j;
            if(w<=f)water_set.insert(w);
        }
    }

    //sugar
    for(int i=0; i<=3000;i++){
        for(int j=0; j<=3000;j++){
            int s = c*i+d*j;
            if(s<=f)sugar_set.insert(s);
        }
    }
    
    double maxratio = -1.0;
    int sw=0,s=0;
    for(int x:water_set){
        for(int y:sugar_set){
            int sugar_water = x+y;
            if(sugar_water>f)continue;
            if((x/100)*e<y)continue;
            double ratio = (double)y/sugar_water;
            if(maxratio<ratio){
                maxratio = ratio;
                sw = sugar_water;
                s = y;
            }
        }
    }
    cout << sw << " " << s << endl;
    return 0;
}  

Measured memory_bytes: 384
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        int n=scan.nextInt();
        int A[]=new int[n];
//        double B[]=new double[n];

        for(int i=0;i<n;i++){
            A[i]=scan.nextInt();
        }

        double c=0;
        Arrays.sort(A);
        c=(A[0]+A[1])/2.0;
        for(int i=2;i<n;i++){
            c=(c+A[i])/2.0;
        }
        System.out.println(c);
    }
}


Measured memory_bytes: 21844
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass
{
	public const long Giri = 1000000007;
	public const long DpInf = 99999999999999;
	
	public static void Main(string[] args)
	{
		var n = Console.ReadLine().ToInt();
		var wa = new long[n+1];
		var k = new Dictionary<string, int>();
		for(int i = 0; i < n; i++)
		{
			var p = Input();
			k.Add(p[0], i);
			wa[i+1] = p[1].ToInt() + wa[i];
		}
		var s = Console.ReadLine();
		Console.WriteLine(wa[n] - wa[k[s]+1]);

	}

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

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

Measured memory_bytes: 13268
console.log((args=>{
  const [N,...A] = args.trim().split`\n`.map(v=>v|0);
  const ex = new Map();
  for ( let i = 0; i < N; i++ ) ex.set( A[i], ex.get(A[i])^1 );
  let s = 0;
  for ( const [,v] of ex ) s += v;
  return `${s}`;
})(require('fs').readFileSync('/dev/stdin', 'utf8')));


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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int ans = 0;
    rep (i, s.size()) if (s[i] == '2') ans++;
    cout << ans << endl;
    
    return 0;
}



Measured memory_bytes: 256
n, k = map(int, input().split())
pl = list(map(int, input().split()))

dp = [0] * (n + 1)

for i in range(n):
    dp[i+1] = dp[i] + (pl[i] + 1)/2

ans = 0
for i in range(k, n+1):
    ans = max(ans, dp[i] - dp[i-k])

print(ans)

Measured memory_bytes: 25060
#include <stdio.h>

int main(){
	int n;
	scanf("%d", &n);
	long long int sum=0;
	long long int ans=0;
	for (int i=1; i<=n; i++){
		
		if (i%3==0 && i%5==0){
			ans++;
		}
		else if(i%3==0){
			ans++;
		}
		else if(i%5==0){
			ans++;
		}
		else{
			sum+=i;
		}
	}
	printf("%lld\n", sum);
	return 0;
}

Measured memory_bytes: 1676
using System;

namespace B___Acrostic
{
    class Program
    {
        static void Main (string[] args)
        {
            var s = Console.ReadLine ();
            var w = int.Parse (Console.ReadLine ());
            var ans = "";
            for (var i = 0; i < s.Length; i += w)
            {
                ans += s[i];
            }
            Console.WriteLine (ans);
        }
    }
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
//define
#define rep(x,y) for(int i=x;i<y;i++)
#define REP(x,y) for(int j=x;j<y;j++)
#define all(x) x.begin(),x.end()
#define pb() push_back()
#define mod 100000007
#define elif else if
#define str string

// int hantei(string S){
//   for(int i=0;i<S.size(),i++){
//     for(int j=0;j<)
//   }
// }
//main
signed main(){
  int N,M,O,P,X,count=0,count2=0;
  double D=0,d;
  int c='A'-'a';
  //char C;
  str S,T;
  cin>>N;
  M=N/100;
  if(N-100*M<=M*5)cout<<1<<endl;
  else cout<<0<<endl;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define sz 100002
#define pb push_back
#define ff first
#define ss second
#define ll long long
#define pi pair<int,int>
#define PQ priority_queue<double, vector<double>, greater<double> >q
#define _sort(v) sort(v.begin(),v.end())
#define MP map<ll int, int>mp
#define MEM(x) memset(x,0,sizeof(x))
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define vec() vector<ll int>v1,v2
#define VEC(n) ll int x; vector<ll int>v;for(int i=0;i<n;i++){cin>>x;v.pb(x);}
#define TEST() int test;cin>>test; while(test--)
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
//Upper_bound   auto x=upper_bound(v[a].begin(),v[a].end(),les);les=*x; if(x==v[a].end())break;
//ll int LCM(ll int a,ll int b) { ll int gcd=__gcd(a,b);ll int lcm=a*b/gcd;return lcm;}
//ll int bigmod(ll int b, ll int p, ll int m){if(p==0)return 1;if(p%2!=0) return b%m*fun(b,p-1,m)%m;if(p%2==0){ ll int res=fun(b,p/2,m);return (res%m*res%m)%m;}}
//ll mod_inverse(ll a, ll mod){return bigmod(a,mod-2,mod);}
//void seive() { prime[np++]=2;for(i=3; i<=sz; i+=2){if(mark[i]==0){ prime[np++]=i;for(j=i*i; j<=sz; j+=i) mark[j]=1; } }}
//string add(string s1,string s2) {string s;int j=s1.size()-1,c=0,m; for(int i=s2.size()-1; i>=0; i--) {if(j>=0)m=s2[i]-'0'+s1[j]-'0'+c;else m=s2[i]-'0'+c; if(m>9) { s+=m%10+'0';c=m/10; } else {  c=0;s+=m+'0'; }j--; } if(c!=0) {s+=c+'0'; }reverse(s.begin(),s.end());return s;}
//int pos;string mul(int n) {string s;for(int i=0; i<pos; i++) { s+="0"; }pos++;int c=0,m; for(int i=s1.size()-1; i>=0; i--) { m=(s1[i]-'0')*n+c;if(m>9) { s+=m%10+'0';c=m/10;} else { c=0; s+=m+'0';} }while(c!=0) { s+=c%10+'0';c=c/10;}    reverse(s.begin(),s.end());return s;}

int main()
{
    ll int a,b,c,d,res=0,mx=-900000000002;
    cin>>a>>b>>c>>d;
    cout<<max({a*c,a*d,b*c,b*d})<<endl;

}





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

int main(void){
    int N,M; cin >> N >> M;
    vector<int> P(M), Y(M);
    vector<int> V[100001];

    for(int i=0; i<M; i++){
        cin >> P[i] >> Y[i];
        V[P[i]].push_back(Y[i]);
    }

    for(int i=1; i<=N; i++) sort(V[i].begin(), V[i].end());

    for(int i=0; i<M; i++){
        auto it1=lower_bound(V[P[i]].begin(), V[P[i]].end(), Y[i]);
        int rank=it1-V[P[i]].begin()+1;
        printf("%06d%06d\n", P[i], rank);
    }

}

Measured memory_bytes: 7808
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main(){
    int a, b; cin >> a >> b;
    
    if(a < b) {
        for(int i = 0; i < b; i++) cout << a;
        cout << endl;
    }
    else {
        for(int i = 0; i < a; i++) cout << b;
        cout << endl;
    }
}

Measured memory_bytes: 256
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

IN=lambda : map(int, input().split())
mod=1000000007

#+++++

def main():
	#a = int(input())
	k, n = IN()
	#s = input()
	bb=[0]*n
	for i in range(n,0,-1):
		pattern = pow((n//i), k, mod)
		for b in range(2, n+1):
			if (i * b)-1 >= n:
				break
			pattern -= bb[(i*b)-1]
			pattern %= mod
		bb[i-1]=pattern
	ret=0
	#print(bb)
	for i, v in enumerate(bb):
		ret += v*(i+1)
		ret %=mod
	return ret
		
		
		
	
	
	ret=pow(b,c,mod)
	print(ret)
	
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 68892
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String n = sc.next();
        int sum = 0;
        for (int i = 0, len = n.length(); i < len; i++) {
            sum += Integer.parseInt(String.valueOf(n.charAt(i)));
        }
        if ((sum % 9) == 0) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
        sc.close();
    }
}

Measured memory_bytes: 49908
#include <stdio.h>

int main(void)
{
	char num[5];
	int n1, n2, n3, n4;

	scanf("%s", num);
	n1 = num[0] - '0';
	n2 = num[1] - '0';
	n3 = num[2] - '0';
	n4 = num[3] - '0';

	if (n1 + n2 + n3 + n4 == 7)
		printf("%d+%d+%d+%d=7\n", n1, n2, n3, n4);
	else if (n1 + n2 + n3 - n4 == 7)
		printf("%d+%d+%d-%d=7\n", n1, n2, n3, n4);
	else if (n1 + n2 - n3 + n4 == 7)
		printf("%d+%d-%d+%d=7\n", n1, n2, n3, n4);
	else if (n1 + n2 - n3 - n4 == 7)
		printf("%d+%d-%d-%d=7\n", n1, n2, n3, n4);
	else if (n1 - n2 + n3 + n4 == 7)
		printf("%d-%d+%d+%d=7\n", n1, n2, n3, n4);
	else if (n1 - n2 + n3 - n4 == 7)
		printf("%d-%d+%d-%d=7\n", n1, n2, n3, n4);
	else if (n1 - n2 - n3 - n4 == 7)
		printf("%d-%d-%d-%d=7\n", n1, n2, n3, n4);
	else if (n1 - n2 - n3 + n4 == 7)
		printf("%d-%d-%d+%d=7\n", n1, n2, n3, n4);

	return 0;
}

Measured memory_bytes: 128
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

if __name__ == '__main__':
    s =input()
    print(s[:len(s)-8])

Measured memory_bytes: 3828
import java.util.Arrays;
import java.util.Scanner;

final class Solver {
	static final Solver INSTANCE = new Solver();

	void solve(Scanner sc) {
		int N = Integer.parseInt(sc.next());
		int M = Integer.parseInt(sc.next());
		int[] A = new int[N];
		Arrays.setAll(A, $ -> Integer.parseInt(sc.next()));
		int sum = Arrays.stream(A).sum();
		long count = Arrays.stream(A).filter(i -> 4 * i * M >= sum).count();
		System.out.println(count < M ? "No" : "Yes");
	}
}

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

		Solver.INSTANCE.solve(in);

		in.close();
	}
}

Measured memory_bytes: 27476
#include "stdio.h"

int main()
{
	int N=0,A=0;

	scanf("%d", &N); //円
	scanf("%d", &A); //1円の枚数

        if(A>=(N%500))
	{
		printf("Yes\n");
	}
	else
	{
		printf("No\n");
	}

	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <string>
#include <map>
#include <queue>
#include <vector>
#include <cstdlib>
#define mp make_pair
#define pb push_back
#define mem(i,a) memset(i,a,sizeof(i))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
const int DMAX=500010+5;
const int MOD=1000000000+7;
template<class T> inline void read(T &x){
    x=0;
    T f=1;
    char ch=getchar();
    while(ch<'0' || ch>'9'){
        if(ch=='-'){
            f=-1;
        }
        ch=getchar();
    }
    while(ch<='9' && ch>='0'){
        x=x*10+(ch-'0');
        ch=getchar();
    }
    x*=f;
}
struct edge{
    ll l,r; 
};
edge g[DMAX];
ll n;
ll cnt1,cnt2;
int main(){
    read(n);
    for(int i=1;i<n;i++){
        read(g[i].l),read(g[i].r);
        cnt1+=min(g[i].l,g[i].r)*(n-max(g[i].l,g[i].r)+1);
    }
    for(int i=1;i<=n;i++){
        cnt2+=i*(n-i+1);
    }
    cout<<cnt2-cnt1<<endl;
    return 0;
}

Measured memory_bytes: 6756
#include <stdio.h>
int main(void){
   double s,l,r,PI=3.141592653589;
   scanf("%lf",&r);
   s = r*r*PI;
   l = 2*r*PI;
   
   printf("%.7lf %.7lf\n",s,l);
    
    return(0);
    
}



Measured memory_bytes: 2040
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections
 
mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000
 
d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))
 
N, K = LI()
A = LI()
 
if K > 50:
    print(" ".join([str(N) for i in range(N)]))
    sys.exit()
 
for i in range(K):
    A_new = [0 for i in range(N)]
    imos_table = [0 for i in range(N)]
 
    for j in range(N): # ここで一度状態の差分についてをimos_tableに保存
        left = max(0, j - A[j])
        right = j + A[j] + 1
        imos_table[left] += 1
        if right >= N:
            pass
        else:
            imos_table[right] -= 1
    
    # tmp を使って前から順に状態を計算していく
    tmp = 0
    for j in range(N):
        tmp += imos_table[j]
        A_new[j] += tmp
 
    A = copy.deepcopy(A_new)
 
print(" ".join(map(str, A)))

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

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

    vector<int> a(n), b(n);
    rep (i, n)
        cin >> a[i];
    rep (i, n)
        cin >> b[i];

    int ans = 0;
    bool flag;
    rep (i, n)
    {
        bool flag = true;
        int temp = 0;
        rep (j, n)
        {
            if (j == i)
            {
                flag = false;
                temp += a[j];
            }

            if (flag)
                temp += a[j];
            else
                temp += b[j];
        }
        ans = max(ans, temp);
    }

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

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}
const int INF = 1e18;

signed main() {
    int N, K;
    cin >> N >> K;
    vi p(N);
    rep(i, N) cin >> p[i];
    SORT(p);
    int res = 0;
    rep(i, K) res += p[i];

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 3596
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>    
#include <cstring>
#include <array>
#include <cctype>
#include <string.h>
#include <vector>
#include <limits.h>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cassert>
#include <algorithm>
#include <functional>
#include <sstream>
#include <iomanip>
#include <cstdlib>
#include <stdio.h>
#include <bitset>
using namespace std;
#define PI 3.14159265359
#define mp make_pair
#define pb push_back
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REP(i,n) FOR(i,0,n)
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
const int INF = 1<<29;
typedef long long ll;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

int A,B;

int main(){
	ios_base::sync_with_stdio(false); //Fast I/O
	cin.tie(NULL);
	//freopen("in.txt","r",stdin);
	//freopen("output.txt","w",stdout);	

	cin >> A >> B;

	if(A<=8 && B<=8)
		cout << "Yay!\n";
	else
		cout << ":(\n";

	return 0;
}


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

int main(){
  int n;
  double s=0;
  cin >> n;
  vector<int>a(n);
  for(int i=0;i<n;i++){
    cin >> a.at(i);
    s += a.at(i);
  }
  s/=n;
  int m=round(s),c=0;
  for(int i=0;i<n;i++)
    c+=pow(a.at(i)-m,2);
  cout << c << endl;
}

Measured memory_bytes: 3624
#include <stdio.h>

int main(int argc, char *argv[])
{
	int a,b;
	scanf("%d %d",&a,&b);

	if(a < b){
		printf("a < b\n");
	}else if(a == b)
	{
		printf("a == b\n");
	}else
	{
		printf("a > b\n");
	}

return 0;
}



Measured memory_bytes: 2104
#include<stdio.h>
int main(){
  int n,i,j;
  int data[6];
  for(i=0;i<5;i++){
    scanf("%d",&data[i]);
  }
  for(i=0;i<4;i++){
    for(j=0;j<4-i;j++){
      if(data[j]<data[j+1]){
	int temp;
	temp=data[j];
	data[j]=data[j+1];
	data[j+1]=temp;
      }
    }
  }
  for(i=0;i<5;i++){
    printf("%d",data[i]);
    if(i==4){
      printf("\n");
    } else{
      printf(" ");
    }
  }
  return(0);
}

Measured memory_bytes: 600
import java.util.Scanner;
//import java.io.*;
//import java.util.Arrays;
public class Main {
	public static void main(String[] args) throws java.io.IOException {
		Scanner scan = new Scanner(System.in);
		//InputStreamReader is = new InputStreamReader(System.in);
		//BufferedReader br = new BufferedReader(is);
		//String text = scan.next();
		int n = scan.nextInt();
		int k = scan.nextInt();
		int ai[] = new int[k];
		int bi[] = new int[k];
		for(int i = 0 ; i < k ; i++){
			ai[i] = scan.nextInt();
			bi[i] = scan.nextInt();
		}
		if(n % 2 == 1){
			for(int i = 0 ; i < k ; i++){
				int Ai = 0;
				int Bi = 0;
				if(ai[i] <= n/2+1 && bi[i] <= n/2+1){
					Ai = ai[i];
					Bi = bi[i];
				}else if(ai[i] > n/2+1 && bi[i] <= n/2+1){
					Ai = n-ai[i]+1;
					Bi = bi[i];
				}else if(ai[i] <= n/2+1 && bi[i] > n/2+1){
					Ai = ai[i];
					Bi = n-bi[i]+1;
				}else{
					Ai = n-ai[i]+1;
					Bi = n-bi[i]+1;
				}
				if(Ai <= Bi){
					if(Ai % 3 == 0){
						System.out.println(3);
					}else if(Ai % 3 == 1){
						System.out.println(1);
					}else{
						System.out.println(2);
					}
				}else{
					if(Bi % 3 == 0){
						System.out.println(3);
					}else if(Bi % 3 == 1){
						System.out.println(1);
					}else{
						System.out.println(2);
					}
				}
			}
		}else{
			for(int i = 0 ; i < k ; i++){
				int Ai = 0;
				int Bi = 0;
				if(ai[i] < n/2+1 && bi[i] < n/2+1){
					Ai = ai[i];
					Bi = bi[i];
				}else if(ai[i] > n/2 && bi[i] < n/2+1){
					Ai = n-ai[i]+1;
					Bi = bi[i];
				}else if(ai[i] < n/2+1 && bi[i] > n/2){
					Ai = ai[i];
					Bi = n-bi[i]+1;
				}else{
					Ai = n-ai[i]+1;
					Bi = n-bi[i]+1;
				}
				if(Ai <= Bi){
					if(Ai % 3 == 0){
						System.out.println(3);
					}else if(Ai % 3 == 1){
						System.out.println(1);
					}else{
						System.out.println(2);
					}
				}else{
					if(Bi % 3 == 0){
						System.out.println(3);
					}else if(Bi % 3 == 1){
						System.out.println(1);
					}else{
						System.out.println(2);
					}
				}
			}
		}
		
	}
}

Measured memory_bytes: 35356
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#define F first
#define S second
#define vec vector
#define ms multiset
#define pb push_back
#define pll pair<ll,ll>
#define pdd pair<ld, ld>
#define pq priority_queue
#define umap unordered_map
#define uset unordered_set
#define pii pair<int, int>
#define pnn pair<Node*, Node*>
#define uid uniform_int_distribution
#define FILE ifstream in("sumsqr.in");ofstream out("sumsqr.out");
#define fast cin.tie(0);cout.tie(0);cin.sync_with_stdio(0);cout.sync_with_stdio(0);
using namespace std;
typedef string str;
typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

int main() {
    fast;
    ll c = 100;
    ll a, o =0; cin>>a;
    for(; c<a; o++) c += c/100;
    cout<<o;
}

Measured memory_bytes: 3628
#include <iostream>
//#include <string>
#include <algorithm>
#include <cmath>
//#include <vector>
//#include <limits>

using namespace std;
/*void amin(long long  &x,long long  y)
{
    if ( y < x ) {
        x   =   y;
    }
}*/

int main()
{
    int N;//,a;
    long long sum[200001];
    sum[0] = 0;
    long long min_num = 2 * 10000000000;//pow(10, 9.0);

    cin >> N;

    for (int i = 1; i <= N; i++) {
        //cin >> a;
        cin >> sum[i];
        sum[i] += sum[i - 1];// + a;
    }
    
    for ( int i = 1; i < N; i++) {
        min_num = min(min_num, abs(sum[N] - (2 * sum[i])));
        //amin(min_num, abs(sum[N] - (2 * sum[i])));
    }
    cout << min_num << '\n';

}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>

using namespace std;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

typedef long long ll;
//No change above here

const ll maxi = (2 * 1e6 + 3);
ll mod = (1e9 + 7);

//function for power
ll power(ll x, ll n) {
	ll res = 1;
	x %= mod;
	while (n) {
		if (n & 1)
			res = (res * x) % mod;
		x = (x * x) % mod;
		n >>= 1;
	}
	return res;
}

ll dir[4][2] = { {1, 0}, {-1, 0}, {0, 1}, {0, -1} };

ll p, q;
bool valid(ll i, ll j) { return i >= 1 && i <= p && j >= 1 && j <= q; }

//declare needed things here

int main()
{
	IOS;
	ll a=0;
	string s1, s2;
	cin >> s1;
	cin >> s2;
	for (int i = 0; i < s1.length(); ++i)
		if (s1[i] != s2[i])
			++a;
	cout << a << endl;
	return 0;
}

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

int main(void){
    string s, t;
    cin >> s >> t;
    int cnt = 0;
    rep(i, s.size())
        if(s[i] != t[i]) ++cnt;
    cout << cnt << endl;
    return 0;
}

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

int main(){
    string s;
    getline(cin,s);
    //vector<char> c(s.size());
    for(int i=0;i<s.size();i++){
        if(toupper(s.at(i))!=s.at(i)) s.at(i)=toupper(s.at(i));
        else s.at(i)=tolower(s.at(i));
    }

cout << s <<endl;
}


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

#define endl '\n'
#define fi first
#define se second
#define pb push_back
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
const int MOD = 1e9 + 7;
const int maxn = 1e6 + 5;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-8;

void header() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}

void solve() {
    string s;
    cin >> s;
    for (int i = 0; i < s.size(); i++) cout << 'x';
    cout << endl;
}

int main() {
	header();
	solve();
	return 0;
}


Measured memory_bytes: 256
nab = list(map(int, input().split()))
_ = 0
for i in range(1, nab[0]+1, 1):
    # print("i",i)
    k = str(i)
    sum_k = 0
    k_len = len(k)
    for j in k:
        sum_k += int(j)
    # print("sum_k",sum_k)
    if nab[1] <= sum_k <= nab[2]:
        _ += i

print(_)

Measured memory_bytes: 3060
#include <iostream>
#include <string>

using namespace std;

int main()
{
    string A, B, C;
    cin >> A >> B >> C;
    
    if( A.c_str()[A.length()-1] == B.c_str()[0] && B.c_str()[B.length()-1] == C.c_str()[0] )
        cout << "YES" << endl;
    else cout << "NO" << endl;
    
    return 0;
}

Measured memory_bytes: 256
INF = float('inf')
def dfs(a=0,b=0,c=0,d=0):
    if d==N:
        return abs(A-a)+abs(B-b)+abs(C-c)-30 if min(a,min(b,c)) else INF
    ans = dfs(a,b,c,d+1)
    ans = min(ans,dfs(a+l[d],b,c,d+1)+10)
    ans = min(ans,dfs(a,b+l[d],c,d+1)+10)
    ans = min(ans,dfs(a,b,c+l[d],d+1)+10)
    return ans

N,A,B,C = map(int,input().split())
l = [int(input()) for i in range(N)]
print(dfs())


Measured memory_bytes: 46044
#include <iostream>
using namespace std;
long long const mod = 1e9+7;
int main(void){
    int n, m;
    long long X = 0, Y = 0;
    cin >> n >> m;
    for(int i=0;i<n;i++){
        long long x;
        cin >> x;
        X += (x + mod) * (2*i - n + 1 + mod);
        X %= mod;
    }
    for(int i=0;i<m;i++){
        long long y;
        cin >> y;
        Y += (y + mod) * (2*i - m + 1 + mod);
        Y %= mod;
    }
    cout << (X * Y) % mod << endl;
}


Measured memory_bytes: 384
N = int(input())
C = [0]*(N-1)
for i in range(N-1):
    C[i] = list( map( int, input().split()))
for i in range(N-1):
    k = i
    ans = 0
    while k < N-1:
        if ans <= C[k][1]:
            ans = C[k][1] + C[k][0]
        else:
            ans += (C[k][2] - ans)%C[k][2] + C[k][0]
        k += 1
    print(ans)
print(0)

Measured memory_bytes: 3188
#include <algorithm>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;

int main() {
  const int MAX = 55555;
  vector<bool> isp(MAX + 1, true);
  vector<int> ans;
  for (int p = 2; p <= MAX; p++) {
    if (isp[p]) {
      if (p % 5 == 1) {
        ans.push_back(p);
      }
      for (int kp = p + p; kp <= MAX; kp += p) isp[kp] = false;
    }
  }
  int N;
  while (cin >> N) {
    for (int i = 0; i < N; i++) cout << ans[i] << " ";
    cout << endl;
  }
  return 0;
}


Measured memory_bytes: 256
//https://onlinejudge.u-aizu.ac.jp/challenges/sources/VPC/UTPC/2259

#include <bits/stdc++.h>

using namespace std;

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

    int ans = 0;
    for (int i = 0; i < m; ++i) {
        int tmp = 0;
        for (int j = 0; j < n; ++j) {
            int a;
            cin >> a;
            tmp += a;
        }
        ans = max(ans, tmp);
    }

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

/*
 *
 */


Measured memory_bytes: 3104
#include <iostream>
#include <cstdio>
#define N 200005
using namespace std;

int n, c, s, a[N], ans[N];
int main()
{
	int i, j;
	cin >> n;
	for (i = 1; i <= n; i++) scanf("%d", &a[i]);
	for (i = n; i >= 1; i--) {
		s = 0;
		for (j = 2; i * j <= n; j++) s += ans[i * j];
        ans[i] = s % 2 != a[i];
        c += ans[i];
	}
    cout << c << endl;
    for (i = 1; i <= n; i++) if (ans[i]) printf("%d ", i);
    return 0;
}

Measured memory_bytes: 2432
N = int(input())
A = list(map(int, input().split()))
B = list(a ** 2 for a in A)
m = 10 ** 9 + 7
ans = int((sum(A) ** 2) // 2)
ans %= m
ans -= int(sum(B) // 2)
ans %= m
print(ans)

Measured memory_bytes: 31752