akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public final class Main {

    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        final int n = Integer.parseInt(in.nextLine());
        final String num = in.nextLine();
        int bitCount = 0;
        for (int i = 0; i < n; i++) {
            bitCount += num.charAt(i) == '1' ? 1 : 0;
        }
        if (bitCount == 1) {
            for (int i = 0; i < n; i++) {
                if (num.charAt(i) == '1') {
                    System.out.println(0);
                } else {
                    if (i == n - 1 || num.charAt(n - 1) == '1') {
                        System.out.println(2);
                    } else {
                        System.out.println(1);
                    }
                }
            }
            return;
        }
        final long[] plusOne = new long[n];
        final long[] minusOne = new long[n];
        long tempPlusOne = 0;
        long tempMinusOne = 0;
        long runningPlus = 1;
        long runningMinus = 1;
        for (int i = n - 1; i >= 0; i--) {
            plusOne[i] = runningPlus;
            minusOne[i] = runningMinus;
            if (num.charAt(i) == '1') {
                tempPlusOne += runningPlus;
                tempMinusOne += runningMinus;
            }
            runningPlus = (runningPlus * 2) % (bitCount + 1);
            runningMinus = (runningMinus * 2) % (bitCount - 1);
        }
        for (int i = 0; i < n; i++) {
            if (num.charAt(i) == '0') {
                System.out.println(f((tempPlusOne + plusOne[i]) % (bitCount + 1)));
            } else {
                System.out.println(f((tempMinusOne - minusOne[i]) % (bitCount - 1)));
            }
        }
    }

    private static int f(long n) {
        int res = 1;
        while (n > 0) {
            n %= Long.bitCount(n);
            res++;
        }
        return res;
    }
}


Measured memory_bytes: 62768
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <set>
#include <stack>
#include <climits>
#include <cmath>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define reps(i,s,n) for(int i=s, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
typedef long long ll;
const char sp = ' ';


using namespace std;

int main(void){
    ll N;
    ll p[25], count=0;
    cin>>N;
    rep(i, N) cin>>p[i];
    rep(i, N-2){
        ll la=p[i], pre=p[i+1], nex=p[i+2];
        if(min({la, pre, nex})!=pre && max({la, pre, nex})!=pre) count++;
   }
    cout<<count<<endl;
    return 0;
}


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

string in;
int tot[55][55];

int main()
{
	int n;
	scanf("%d",&n);
	string ans = "";
	for(int a=0;a<n;a++)
	{
		cin>>in;
		int len = in.length();
		for(int b=0;b<len;b++)
		tot[a][in[b]-'a']++;
	}
	for(int a=0;a<26;a++)
	{
		int maxi;
		for(int b=0;b<n;b++)
		{
			if(b==0) maxi = tot[b][a];
			maxi = min(maxi,tot[b][a]);
		}
		for(int b=0;b<maxi;b++) ans+=(a+'a');
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
  long long int bottom, top, i, number_k, limit_loop;
  scanf("%lld %lld %lld", &bottom, &top, &number_k);
  limit_loop = (bottom + number_k < top + 1)? bottom + number_k : top + 1;
  for(i = bottom; i < limit_loop; i++) {
    printf("%lld\n", i);
  }
  for(i = ((top - number_k + 1) > i)? top - number_k + 1 : i; i <= top; i++) {
    printf("%lld\n", i);
  }
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cctype>
#include <cstdlib>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#define rep(i, n) for(int i = 0; i < n; ++i)
using namespace std;

int comp(const void* a, const void* b){
	return *(int*)a - *(int*)b;
}

int main() {
	int s, cnt = 0;
	cin >> s;
	while(1){
		if(s == 4 || s == 2 || s== 1){
			cout << cnt+4 << endl;
			break;
		}else{
			if(s % 2 == 0){
				s /= 2;
				cnt++;
			}else{
				s = 3*s+1;
				cnt++;
			}
		}
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <array>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <cstdint>
#include <unordered_set>
#include <ctime>
#include <numeric>

typedef long long int llint;

int main(void){

  llint x;
  std::cin >> x;

  int count = 0;
  llint yokin = 100;
 
  while(yokin < x){
    count++;
    yokin *= 1.01;
  }

  std::cout << count << std::endl;
  
  return 0;
}


Measured memory_bytes: 3624
import java.util.*;

class Main{
public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    long[] L = new long[n+1];
    L[0] = 2;
    L[1] = 1;
    if(n == 1) {
    	System.out.println(1);
    } else {
        for(int i = 2; i <= n; i++) {
        	L[i] = L[i-1] + L[i-2];
        	if(i == n) {
        		System.out.println(L[i]);
        	}
        }
    }
}
}


Measured memory_bytes: 23124
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
	static void solve(){//Here is the main function
      ArrayList<Integer> one = nextIntArray();
      myout(lcm(one.get(0), one.get(1)));
	}
	//Method addition frame start

static long gcd(long m, long n) {return n != 0 ? gcd(n, m % n) : m;}
static long lcm(long m, long n) {return Math.max(m,n) / gcd(m, n) * Math.min(m,n);}

	//Method addition frame end
}


Measured memory_bytes: 32948
#include<iostream>
#include<algorithm>
#include<queue>
#include<map>

using namespace std;

int x_move[4]={0,0,1,-1};
int y_move[4]={1,-1,0,0};


struct puzzle{
    int xy[4][6];
    int zero_x;
    int zero_y;
    int count;
};



int go_int(puzzle temp){
    int sum=0;
    for(int i=1; i<=2; i++){
        for(int j=1; j<=4; j++){
            sum=sum*10+temp.xy[i][j];
        }
    }
    return sum;
}
int syoki[4][6]={
    -1,-1,-1,-1,-1,-1,
    -1,0,1,2,3,-1,
    -1,4,5,6,7,-1,
    -1,-1,-1,-1,-1,-1
};


int main(){

    puzzle temp;
    for(int i=0; i<4; i++){
        for(int j=0; j<6; j++){
            temp.xy[i][j]=syoki[i][j];
        }
    }
    for(int i=1; i<=2; i++){
        for(int j=1; j<=4; j++){
            if(temp.xy[i][j]==0){
                temp.zero_x=i;
                temp.zero_y=j;
                break;
            }
        }
    }
    temp.count=0;
    
    queue<puzzle> BFS;
    map<int, int> m;
    
    
    BFS.push(temp);
    m[go_int(temp)]=temp.count;
    
    while(!BFS.empty()){
        temp = BFS.front();
        BFS.pop();
        
        
        for(int i=0; i<4; i++){
            puzzle temp2=temp;
            if(temp.xy[temp.zero_x+x_move[i]][temp.zero_y+y_move[i]]!=-1){
                swap(temp2.xy[temp.zero_x+x_move[i]][temp.zero_y+y_move[i]],temp2.xy[temp.zero_x][temp.zero_y]);
                temp2.zero_x+=x_move[i];
                temp2.zero_y+=y_move[i];
                temp2.count++;
                int temp3=go_int(temp2);
                if(m.count(temp3)==0){
                    BFS.push(temp2);
                    m[temp3]=temp2.count;
                }
            }
        }
    }

    
    while(cin>>temp.xy[1][1]>>temp.xy[1][2]>>temp.xy[1][3]>>temp.xy[1][4]>>temp.xy[2][1]>>temp.xy[2][2]>>temp.xy[2][3]>>temp.xy[2][4]){

        
        
        cout<<m[go_int(temp)]<<endl;
    }
}

Measured memory_bytes: 2260
#include <bits/stdc++.h>
using namespace std;
typedef int64_t int64;
typedef uint32_t uint;
typedef uint64_t uint64;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    vector<bool> vTF(100, false);
    for(uint p=0; ; ++p){
        for(uint q=0; ; ++q){
            if(4*p+7*q>100){ break; }
            vTF[4*p+7*q] = true;
        }
        if(4*p>100){ break; }
    }
    
    uint N; cin >> N;
    cout << (vTF[N] ? "Yes":"No") << endl;
    
    return 0;
}

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

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << "\n";
}
template <typename Arg1, typename... Args>
void __f(const char* na, Arg1&& arg1, Args&&... args) {
  const char* c = strchr(na + 1, ',');
  cerr.write(na, c - na) << " : " << arg1 << " , ";
  __f(c + 1, args...);
}
#define endl "\n"
#define all(v) v.begin(), v.end()
#define UNIQUE(v) sort(all(v)),v.erase(unique(all(v)),v.end())
typedef long long LL;
typedef pair <int,int> pii;
const double pi = acos(-1.0);
const double eps = 1e-8;
const int mod = 1e9 + 7;
const int inf = 1e9;
const LL INF = 1e18;
const int N = 1e5 + 5;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0); cout.tie(0);
  #ifdef LOCAL
    freopen("input.txt", "r", stdin);
  #endif // LOCAL
  int n;
  cin >> n;
  LL ans = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      for (int k = 1; k <= n; k++) {
        ans += __gcd(i, __gcd(j, k));
      }
    }
  }
  cout << ans << endl;
  return 0;
}



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

using namespace std;

int main(void) {
    string  o, e;
    cin >> o >> e;

    for (int i = 0; i < o.length() + e.length(); i++) {
        cout << ((i % 2 == 0) ? o[i/2] : e[i/2]);
    }
    cout << endl;

    return 0;
}

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

bool f(int x) {
  int keta = 0;
  while(x) {
    keta++;
    x /= 10; // 10で割ると最後の桁が消える
  }
  return keta%2 == 1;
}

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

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

  return 0;
}

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

#define int long long
#define x first
#define y second
#define PII pair<int,int>
#define LL long long
#define pb push_back
#define pqp priority_queue<PII,vector<PII>,greater<PII>>
#define pqi priority_queue<int,vector<int>,greater<int>>
#define PSS pair<string,string>
#define in insert
#define line inline
#define sort(s) sort(s.begin(),s.end());
#define reverse(s) reverse(s.begin(),s.end());
#define V vector<int>
#define VV vector<V>
#define PDD pair<double,double>

using namespace std;

const int N = 1000010;

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

inline int read()
{
    int x = 0, f = 1;
    char ch = getchar();
    while(ch < '0' || ch > '9'){
        if (ch == '-')
            f = -1;
        ch = getchar();
    }
    while(ch >= '0' || ch <= '9'){
        x = (x<<1) + (x<<3) + (ch^48);
        ch = getchar();
    }
    return x * f;
}

int ac,tle,re,wa;

void print(){
    printf("AC x %d\n",ac);
    printf("WA x %d\n",wa);
    printf("TLE x %d\n",tle);
    printf("RE x %d\n",re);
    }

void solve()
{
    string s; cin >> s;
    if(s == "AC") ac ++;
    if(s == "TLE") tle ++;
    if(s == "RE") re ++;
    if(s == "WA") wa ++;

}
signed main()
{
    int _; cin >> _ ;while(_ --)
    solve();
    print();

    return 0;
}


Measured memory_bytes: 3704
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<chrono>
#include<random>
#include<cstdio>
#include<set>
#include<map>
#include<numeric>
#define MAX_N 100
#define MAX_M 100
#define INF 10000000
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;

int main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if(b-d>2){
        cout<<1;
    }else{
        cout<<0;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define pb push_back

using namespace std;


ll n;
ll a[350];
ll dp[350][302*302 + 2];
ll dp1[350][302*302];
const ll mod = 998244353;
ll ME(ll x,ll nn,ll M)
{
    ll result=1;
    while(nn>0)
    {
        if(nn % 2 ==1)
            result=(result * x)%M;
        x=(x*x)%M;
        nn=nn/2;
    }
    return result;
}
ll solve(ll id, ll sum)
{
        if(sum < 0) return 0LL;
        if(id == n+1){
                if(sum == 0) return 1LL;
                return 0;
        }
        ll &ret = dp[id][sum];
        if(ret != -1) return ret;
        ret = solve(id+1, sum - a[id]);
        ret = (ret + 2*solve(id+1 , sum))%mod;
        return ret;
}
ll solve2(ll id ,ll sum)
{
        if(sum<0) return 0;
        if(id == n+1) {
                if(sum == 0) return 1LL;
                return 0;
        }
        ll &ret = dp1[id][sum];
        if(ret != -1) return ret;
        ret = solve2(id+1, sum);
        ret = (ret + solve2(id+1, sum-a[id]))%mod;
        return ret;
}
int main()
{
        cin >> n;
        ll sum=0;
        for(ll i=1;i<=n;i++) {
                cin >> a[i];
                sum += a[i];
        }
        ll ans = ME(3,n,mod);
        ans = (ans * ME(3LL , mod-2,mod))%mod;
        memset(dp,-1,sizeof dp);
        for(ll i=(sum+1)/2; i <= sum; i++) {
                ans = (ans - solve(1 , i) + mod)%mod;
        }
        //memset(dp,-1,sizeof dp);
        if(sum%2 == 0){
        memset(dp1,-1,sizeof dp1);
        ans = (ans + solve2(1 , (sum)/2))%mod;
        }
        ans = (ans*3LL)%mod;
        cout << ans << endl;
        return 0;
}


Measured memory_bytes: 499072
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
const int MOD=1000000007;
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
#define fi first
#define se second
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};
const int MAX_N=2e5+5;

lint LCM(lint a,lint b){
  if(a==0 || b==0) return 0;
  lint tmp,r,x;
  x=a*b;
  if(a<b) tmp=a,a=b,b=tmp;
  r=a%b;
  while(r!=0) a=b,b=r,r=a%b;
  x=x/b;
  return x;
}

lint GCD(lint a,lint b){
  if(a==0 || b==0) return max(a,b);
  else return (a*b)/LCM(a,b);
}

int main(void){
    lint N;
    string S;
    lint ans=0;
    cin >> N >> S;
    rep(i,N){
        for(int j=1;j<=N;j++){
            char c[3];
            if(i+j>=N) break;
            if(i+2*j>=N) break;
            c[0]=S[i];
            c[1]=S[i+j];
            c[2]=S[i+2*j];
            sort(c,c+3);
            if(c[0]=='B' && c[1]=='G' && c[2]=='R') ans--;
        }
    }
    lint cnt[3]={};
    rep(i,N){
        if(S[i]=='B') cnt[0]++;
        else if(S[i]=='G') cnt[1]++;
        else cnt[2]++;
    }
    rep(i,N){
        lint add=1;
        int now;
        if(S[i]=='B') now=0,cnt[0]--;
        else if(S[i]=='G') now=1,cnt[1]--;
        else now=2,cnt[2]--;
        rep(j,3) if(j!=now) add*=cnt[j];
        ans+=add;
    }
    cout << ans << endl;
}

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

int main(){
  ll N,i;
  ll A[222222],B[222222];
  cin >> N;
  for(i=0;i<=N-1;i++)
    cin >> A[i] >> B[i];
  sort(A,A+N);
  sort(B,B+N);
  ll min,max,ans;
  if(N%2==0){
    min = (A[N/2] + A[N/2-1]);
    max = (B[N/2] + B[N/2-1]);
    ans = max - min + 1;
  }
  else{
    min = A[(N-1)/2];
    max = B[(N-1)/2];
    ans = max - min + 1;
  }
  cout << ans << endl;
}



Measured memory_bytes: 6748
def main():
    W, H, x, y = map(int, input().split())

    if 2*x == W and 2*y == H:
        return H*W/2, 1
    else:
        return H*W/2, 0

if __name__ == '__main__':
    # print(main())
    output = main()
    print(' '.join(map(str, output)))

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

int main() {
    int dif;
    string s;
    getline(cin,s);
    dif = 'A'-'a';
    REP(i,s.size()){
    if(s[i]>='a' && s[i] <='z') s[i] += dif;
    }
    cout << s << endl;
    return 0;
}



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

using ll = long long;

const int mod = 1000000007;
const int INF = 1000000000;
const double EPS = 1e-9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    vector<int> H(N);
    for (int i = 0; i < N; ++i) cin >> H[i];
    sort(H.begin(), H.end());
    ll ans = 0;
    for (int i = 0; i < N - K; ++i) ans += H[i];
    cout << ans << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
 
typedef pair<int,int> P;
struct edge{int to, id;};
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1000000000000


int main(){
    int n;
    string s;
    cin >> n;
    cin >> s;
    int list[1001];
    rep(i,1001){
        list[i] = 0;
    }
    ll ans = 0;
    for(int i = 0; i < 10; i++){
        for(int j = 0; j < 10; j++){
            for(int k = 0; k < 10; k++){
                string temp = to_string(i)+to_string(j)+to_string(k);
                int index = 0;
                for(int l = 0; l < n; l++){
                    if(s[l] == temp[index]){
                        index++;
                        if(index == 3){
                            ans++;
                            break;
                        }
                    }
                }
            }
        }
    }
    cout << ans << endl;

}

Measured memory_bytes: 3760
#include<iostream>

using namespace std;

int main() {

	char a, b, c, d;
	cin >> a >> b >> c >> d;
	if (a == b && c == d && a != c) {
		cout << "Yes" << endl;
	}
	else if
	 (a == c && b == d && a != b) {
		cout << "Yes" << endl;
	}

	else if (a == d && b == c && a != b) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void)
{
    char S[4];
    cin >> S;
    int F = 10 * (S[0] - '0') + (S[1] - '0');
    int L = 10 * (S[2] - '0') + (S[3] - '0');
    if (F > 12 && L > 12)
    {
        cout << "NA";
    }
    else if (F == 0 && L == 0)
    {
        cout << "NA";
    }
    else if (F == 0 && L > 12)
    {
        cout << "NA";
    }
    else if (F > 12 && L == 0)
    {
        cout << "NA";
    }
    else if (F > 12)
    {
        cout << "YYMM";
    }
    else if (L > 12)
    {
        cout << "MMYY";
    }
    else if (F == 0)
    {
        cout << "YYMM";
    }
    else if (L == 0)
    {
        cout << "MMYY";
    }
    else
    {
        cout << "AMBIGUOUS";
    }
}


Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

#define INF (1 << 30)
#define INFL (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define EPS 1e-10

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

int main() {
    int n, ans = 1;
    string s;
    cin >> n >> s;
    for (int i = 0; i < n - 1; ++i) {
        if (s[i] != s[i + 1])
            ans++;
    }
    cout << ans << endl;

    return 0;
}

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

#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <stdint.h>
#include <string.h>

//#define _USE_MATH_DEFINES
//#include <math.h>

#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <deque>
#include <string>

#include <algorithm>
#include <functional>
#include <bitset>
#include <functional>
#include <chrono>
#include <random>
#define sqr(x) (x) * (x)

typedef unsigned int u32;
typedef int i32;
typedef unsigned long long int u64;
typedef int long long i64;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;
using namespace std::chrono;

const i64 mod = 1000000007ll;
const i64 smod = 998244353ll;
const i64 inf = 1000000007; // 10000000000000007ll;

const double eps = 1e-8;

const i64 MAXN = 300004;

i64 n;
i64 a[MAXN];

int main(int argc, char* argv[]) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(15); cout.setf(ios::fixed);

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

    i64 r = 1;
    i64 l = 100;
    for (i64 i = 0; i < n; i++) {
        r = max(r, a[i]);
        l = min(l, a[i]);
    }

    i64 bv = inf;
    i64 bx = -1;

    for (i64 x = l; x <= r; x++) {
        i64 v = 0;
        for (i64 i = 0; i < n; i++) {
            v += sqr(x - a[i]);
        }
        if (bv > v) {
            bv = v;
            bx = x;
        }
    }

    cout << bv << endl;
    return 0;
}

Measured memory_bytes: 256
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::str::FromStr;
use std::io::*;
use std::collections::*;
use std::cmp::*;

struct Scanner<I: Iterator<Item = char>> {
    iter: std::iter::Peekable<I>,
}

macro_rules! exit {
    () => {{
        exit!(0)
    }};
    ($code:expr) => {{
        if cfg!(local) {
            writeln!(std::io::stderr(), "===== Terminated =====")
                .expect("failed printing to stderr");
        }
        std::process::exit($code);
    }}
}

impl<I: Iterator<Item = char>> Scanner<I> {
    pub fn new(iter: I) -> Scanner<I> {
        Scanner {
            iter: iter.peekable(),
        }
    }

    pub fn safe_get_token(&mut self) -> Option<String> {
        let token = self.iter
            .by_ref()
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            Some(token)
        }
    }

    pub fn token(&mut self) -> String {
        self.safe_get_token().unwrap_or_else(|| exit!())
    }

    pub fn get<T: FromStr>(&mut self) -> T {
        self.token().parse::<T>().unwrap_or_else(|_| exit!())
    }

    pub fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.get()).collect()
    }

    pub fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }

    pub fn char(&mut self) -> char {
        self.iter.next().unwrap_or_else(|| exit!())
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.get::<String>().chars().collect()
    }

    pub fn line(&mut self) -> String {
        if self.peek().is_some() {
            self.iter
                .by_ref()
                .take_while(|&c| !(c == '\n' || c == '\r'))
                .collect::<String>()
        } else {
            exit!();
        }
    }

    pub fn peek(&mut self) -> Option<&char> {
        self.iter.peek()
    }
}

trait Joinable {
    fn join(self, sep: &str) -> String;
}

impl<U: ToString, T: Iterator<Item = U>> Joinable for T {
    fn join(self, sep: &str) -> String {
        self.map(|x| x.to_string()).collect::<Vec<_>>().join(sep)
    }
}
fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin.bytes().map(|c| c.unwrap() as char));
    let N: usize = sc.get();
    let B: Vec<usize> = sc.vec(N-1);
    let mut ans = 0;
    ans += B[0];
    for i in 0..N-2 {
        if B[i] > B[i+1] {
            ans += B[i+1];
        } else {
            ans += B[i];
        }
    }
    ans += B[N-2];
    println!("{}", ans);
}


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

using namespace std;

using ll = long long;

constexpr char newl = '\n';
constexpr int dh[] = {1, -1, 0, 0};
constexpr int dw[] = {0, 0, 1, -1};

void bfs(int src, int n, const vector<int>& ex, vector<int>& cost) {
    deque<int> q;
    q.push_back(src);

    while (!q.empty()) {
        int cur = q.front();
        int ch = cur / n, cw = cur % n;
        q.pop_front();

        for (int i = 0; i < 4; ++i) {
            int nh = ch + dh[i], nw = cw + dw[i];
            if (nh < 0 || nh >= n || nw < 0 || nw >= n) continue;

            int nex = nh * n + nw;
            int new_cost = cost[cur] + ex[cur];
            if (cost[nex] <= new_cost) continue;

            cost[nex] = new_cost;
            if (ex[cur]) q.push_back(nex);
            else q.push_front(nex);
        }
    }
}

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

    int n;
    cin >> n;

    int m = n * n;
    vector<int> cost(m, 0);
    vector<int> ex(m, true);
    for (int i = 0; i < m; i++) {
        int h = i / n, w = i % n;
        cost[i] = min({h, w, n - 1 - h, n - 1 - w});
    }

    ll ans = 0;
    for (int i = 0; i < m; i++) {
        int p;
        cin >> p;
        --p;

        ans += cost[p];
        ex[p] = false;
        bfs(p, n, ex, cost);
    }
    cout << ans << newl;

    return 0;
}

Measured memory_bytes: 5696
import java.math.*;
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc =new Scanner(System.in);
		int n = sc.nextInt();
		for(int i = 0; i < n; i++) {
			BigInteger a=sc.nextBigInteger();
			a = a.add(sc.nextBigInteger());
			String tmp = a.toString();
			if(tmp.length() > 80) {
				System.out.println("overflow");
			}
			else {
				System.out.println(tmp);
			}

		}

	}

}

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

int main()
{
	int n;cin>>n;
    double a[n];
   for(int i=0;i<n;i++)
    cin>>a[i];
  
  double dp[n+1][n+1];
  dp[1][0]=1-a[0];
  dp[1][1]=a[0];
 for(int i=2;i<=n;i++)
 {
   for(int j=0;j<=i;j++)
   {
     if(j==0)
     {
       dp[i][j]=dp[i-1][j]*(1-a[i-1]);
      }
     else if(j==i)
     {
       dp[i][j]=dp[i-1][j-1]*(a[i-1]);
     }
     else
     {
        dp[i][j]=dp[i-1][j-1]*(a[i-1])+dp[i-1][j]*(1-a[i-1]);
      }
   }
   
 }
  
 double sum=0;
  for(int i=n/2+1;i<=n;i++)
  {
    sum+=dp[n][i];
    
  }
  cout<<setprecision(10)<<fixed<<sum;
    return 0;
}

Measured memory_bytes: 70400
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define max(a, b)	(((a) > (b)) ? (a) : (b))		/* ２個の値の最大値 */
#define min(a, b)	(((a) < (b)) ? (a) : (b))		/* ２個の値の最小値 */
#define ENTER		printf("\n")					/* 改行プリント */
int DBG = 1;										/* デバッグプリント 提出時は0 */
/* main *************************************************************/

int compare4(const void *a, const void *b) {
	int aa = *((int *)a);
	int bb = *((int *)b);
	if (aa > bb) return 1;
	if (aa < bb) return -1;
	return 0;
}
void qsort4(int *base, int count) {
	/* void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *)); */
	qsort((void *)base, count, sizeof(int), compare4);
}

int main()
{
	int		a[256],b,c,i,j,k,n,m,x,y,ans = 0;
	float	v[256];
	
	scanf("%d", &n);
	for(i=0;i<n;i++) {
		scanf("%d", &a[i]);
		
	}

	qsort4(a, n);
	
	for(i=0;i<n;i++) v[i] = (float)a[i];
	
	for(i=1;i<n;i++) {
		v[i] = (v[i-1] + v[i])/2;
	}

	printf("%f\n",v[n-1]);

	return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
#include<iostream>
#include<fstream>
#include<string.h>

using namespace std;

int solve(int l,char w[]){

	if (l == 1) return 1;
	
	while (1){
		int s=-1;
		for (int i = 0; i < l; i++){
			if (w[i]>1){
				char c = w[i];
				int n = 0;
				for (int j = i; j < l; j++){
					if (w[j] == c){
						n++;
						w[j] = 1;
					}
				}
				if (n == 1 || n % 2 == 1)return 1;
			}
		}
		if (s == -1)return 0;
	}


}


int main(){

	char w[110];
	for (int i = 0; i < 110; i++)w[i] = 0;
	cin >> w;

	int l = strlen(w);

	int res = solve(l,w);
	
	if (res == 0)printf("Yes\n");
	else printf("No\n");

	return 0;
}

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

using namespace std;

int main()
{
  long int n;
  scanf("%ld",&n);
  string s[n];
  long int i;
  for(i=0;i<n;++i)
  {  cin>>s[i];
     sort(s[i].begin(),s[i].end());
  }
  
  sort(s,s+n);
  
  long long int cnt=0,max=0;
  for(i=0;i<n-1;++i)
  {
    if(s[i]==s[i+1])
        cnt++;
    
    else
    {
      
      max+=cnt*(cnt+1)/2;
      cnt=0;
    }
  }
  
  if(s[i]==s[i-1])
  {
    
    max+=cnt*(cnt+1)/2;
  }
  
  printf("%lld",max);
}
  
  

Measured memory_bytes: 7296
def main():
    N, K = map(int,input().split())

    list_i = [0]*N

    for i in range(K):
        d = int(input())
        A = list(map(int,input().split()))
        for j in range(d):
            list_i[ A[j]-1 ] += 1

    cnt = 0
    for judge in list_i:
        if judge == 0:
            cnt += 1

    return cnt

print(main())


Measured memory_bytes: 9096
n = int(input())
a = list(map(int, input().split()))

a = sorted(a)

min = a[0]
max = a[n-1]

ans = []

for i in range(1,n-1):
    temp = a[i]
    if(temp < 0):
        ans.append('{} {}'.format(max, temp))
        max -= temp
    else:
        ans.append('{} {}'.format(min, temp))
        min -= temp

ans.append('{} {}'.format(max, min))
max -= min

print(max)

for i in range(n-1):
    print(ans[i])


Measured memory_bytes: 69708
use std::io::prelude::*;
use std::io;

fn read_to_string() -> String {
    let mut buf = String::new();
    let mut stdin = io::stdin();
    stdin.read_to_string(&mut buf);
    buf
}

fn solve(p: Vec<u64>, q: Vec<u64>) -> u64 {
    let w = p.len();
    let h = q.len();
    let mut pq: Vec<_> = p.iter()
        .map(|c| (*c, 'p'))
        .chain(q.iter()
            .map(|c| (*c, 'q')))
        .collect();
    pq.sort();
    let mut a = w as u64 + 1;
    let mut b = h as u64 + 1;
    pq.iter()
        .map({
            |e| match *e {
                (c, 'p') => {
                    a -= 1;
                    b * c
                }
                (c, 'q') => {
                    b -= 1;
                    a * c
                }
                _ => 0
            }
        })
        .fold(0, std::ops::Add::add)
}

fn main() {
    let input = read_to_string();
    let mut words = input.split_whitespace();
    let w: usize = words.next().unwrap().parse().unwrap();
    let h: usize = words.next().unwrap().parse().unwrap();
    let p: Vec<u64> = words.by_ref().take(w).map(|i| i.parse().unwrap()).collect();
    let q: Vec<u64> = words.by_ref().take(h).map(|i| i.parse().unwrap()).collect();
    println!("{}", solve(p, q));
}


Measured memory_bytes: 14972
#!/usr/bin/env python3
import sys, math, fractions, itertools


def solve(W: int, a: int, b: int):
    if (b-a-W)*(b+W-a) < 0:
        print(0)
    else:
        print(min(abs(b-a-W), abs(b+W-a)))
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    W = int(next(tokens))  # type: int
    a = int(next(tokens))  # type: int
    b = int(next(tokens))  # type: int
    solve(W, a, b)

if __name__ == '__main__':
    main()


Measured memory_bytes: 5048
#include <stdio.h>

int main(void){
  int a, b, c;
  scanf("%d %d %d", &a, &b, &c);
   
  if ((a<c && c<b) || (b<c && c<a)){
    printf("Yes\n");
  }
  else{
    printf("No\n");
  }
  return 0;
}




Measured memory_bytes: 128
"use strict";

const main = arg => {
    let arr = arg.trim().split('');
    let last = arr.slice(-1)[0];
    if(last == 2 ||last == 4 || last ==5 || last ==7 || last ==9) {
     console.log('hon');   
    } else if (last == 0 || last ==1 || last ==6 || last ==8) {
        console.log('pon');
    } else {
        console.log('bon');
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));  

Measured memory_bytes: 29548
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define MAX(a,b) a=a>b?a:b
#define MIN(a,b) a=a>b?a:b
#define REP(i,x,n) for(int i=x;i<n;i++)
#define REPR(i,x,n) for(int i=n-1;i>=x;i--)
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll MOD =1e9 + 7;



int main(){
	string s;
    int n=0;
    cin>>s;
    rep(i,s.size()/2)if(s[i]!=s[s.size()-i-1])n++;
    cout<<n<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){

  int n;
  scanf("%d", &n);
  int p[n];
  for (int i = 0; i < n; i++) {
    scanf("%d", &p[i]);
  }
  int count = 0;
  for (int i = 0; i < n; i++) {
    if (p[i] == i+1) {
      count++;
      i++;
    }
  }
  printf("%d\n", count);

  return 0;
}

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

ll solve() {
    ll N, M;
    cin >> N >> M;
    vector<vector<int>> G(N);
    ll a, b;
    vector<int> deg_in(N), topo, dep(N);
    for ( int i = 0; i < N-1+M; i++ ) {
        cin >> a >> b;
        a--, b--;
        G[a].push_back(b);
        deg_in[b]++;
    }
    queue<int> q;
    for ( int i = 0; i < N; i++ ) {
        if ( deg_in[i] == 0 ) {
            q.push(i);
            dep[i] = 0;
        }
    }
    while ( !q.empty() ) {
        int v = q.front();
        q.pop();
        topo.push_back(v);
        for ( int u : G[v] ) {
            deg_in[u]--;
            if ( deg_in[u] == 0 ) q.push(u);
            dep[u] = max(dep[u], dep[v]+1);
        }
    }

    vector<int> ans(N, -1);
    queue<int> q2;
    q2.push(topo[0]);
    while ( !q2.empty() ) {
        int v = q2.front();
        q2.pop();
        for ( int u : G[v] ) {
            if ( dep[u] - dep[v] == 1 ) {
                ans[u] = v;
                q2.push(u);
            }
        }
    }

    for ( int i = 0; i < N; i++ ) {
        cout << ans[i] + 1 << "\n";
    }
    return 0;
}

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

Measured memory_bytes: 7928
// atcoder/abc138/C/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n;
  while (cin >> n) {
    priority_queue<double> q;
    for (int i = 0; i < n; ++i) {
      double x;
      cin >> x;
      q.push(-x);
    }
    while (1 < q.size()) {
      double a = q.top(); q.pop();
      double b = q.top(); q.pop();
      q.push((a + b) / 2);
    }
    printf("%.10lf\n", -q.top());
  }

  return 0;
}


Measured memory_bytes: 256
import sys

N = int(input())
c = list(input())

right_R = N
for i in range(N-1,-1,-1):
    if c[i] == 'R':
        right_R = i
        break

left_W = -1
for i in range(N):
    if c[i] == 'W':
        left_W = i
        break

if right_R == N or left_W == -1:
    print(0)
    sys.exit(0)

ans = 0
p = left_W
q = right_R
while p < q:
    for i in range(p+1,N):
        if c[i] == 'W':
            p = i
            break
        if i == N-1:
            p = N
    for i in range(q-1,-1,-1):
        if c[i] == 'R':
            q = i
            break
        if i == 0:
            q = -1
    ans += 1

print(ans)

Measured memory_bytes: 10820
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
    int n,count = 0,ans = 0;
    char a[101],b[101],c[101];
    scanf("%d %s %s %s",&n,a,b,c);

    for (int i = 0; i < n; i++)
    {
        count = 0;
        if(a[i] == b[i])count++;
        if(b[i] == c[i])count++;
        if(c[i] == a[i])count++;

        if(count == 0)ans += 2;
        if(count == 1)ans += 1;
    }
    printf("%d",ans);
}

Measured memory_bytes: 128
using System;

namespace _084b
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] read = Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
            string S = Console.ReadLine();
            bool flag = true;
            if(S[read[0]]=='-'){
                for(int i = 0; i < S.Length; i++){
                    int j = 0;
                    if(i != read[0]){
                        if(int.TryParse(S[i].ToString(),out j)){

                        }else{
                            flag = false;
                        }
                    }
                }
            }else{
                flag=false;
            }
            Console.WriteLine(flag?"Yes":"No");
        }
    }
}

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

using namespace std;

using ll = long long;

const long long MOD = 1e9 + 7;
const int INF = 1e9 + 7;

int F(long long x) {
    int res = 0;
    while (x > 0) x /= 10, res++;
    return res;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long N;
    cin >> N;
    int ans = INF;
    for (long long i = 1; i * i <= N; ++i) {
        if (N % i != 0) continue;
        long long A, B;
        A = i;
        B = N / i;
        int f = max(F(A), F(B));
        ans = min(ans, f);
    }
    cout << ans << endl;
}

Measured memory_bytes: 764
/* Filename: ABC042B.java
 * Author: Mushiyo
 */

import java.util.Scanner;
import java.util.Arrays;

public class Main{

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

		while (input.hasNext()) {
			int N = input.nextInt();
			int L = input.nextInt();
			String[] S = new String[N];
			
			for(int i = 0; i < S.length; ++i){
				S[i] = input.next();
			}
			
			Arrays.sort(S);
			
			StringBuilder sol = new StringBuilder();
			for(int i = 0; i < S.length; ++i){
				sol.append(S[i]);
			}
			
			System.out.println(sol);
		}
	}

}


Measured memory_bytes: 9940
program lunlun_number
  implicit none
  integer :: k, l = 9, i, j, m, n = 9, p = 1, q = 2
  integer(8) :: a(2,60000) = 0_8
  read(*,*) k
  if (k < 10) then
    write(*,'(i0)') k
    stop
  end if
  a(1,1:9) = (/1_8, 2_8, 3_8, 4_8, 5_8, 6_8, 7_8, 8_8, 9_8 /)
  do
    do i = 1, 9
      m = 0
      do j = 1, l
        if (mod(a(p,j),10_8) /= 0_8) then
          m = m+1
          a(q,m) = a(p,j)*10_8+mod(a(p,j),10_8)-1_8
          n = n+1
          if (n == k) then
            write(*,'(i0)') a(q,m)
            stop
          end if
        end if
        m = m+1
        a(q,m) = a(p,j)*10_8+mod(a(p,j),10_8)
        n = n+1
        if (n == k) then
          write(*,'(i0)') a(q,m)
          stop
        end if
        if (mod(a(p,j),10_8) /= 9_8) then
          m = m+1
          a(q,m) = a(p,j)*10_8+mod(a(p,j),10_8)+1_8
          n = n+1
          if (n == k) then
            write(*,'(i0)') a(q,m)
            stop
          end if
        end if
      end do
      p = 3-p
      q = 3-p
      l = m
    end do
  end do
end program lunlun_number

Measured memory_bytes: 896
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            Out.Flush();
            Read();
        }

        static void Solve()
        {
            var (A, B) = Slice2<long>();
            var ban = new char[100][];
            for (var i = 0; i < 50; ++i) ban[i] = Enumerable.Repeat('#', 100).ToArray();
            for (var i = 50; i < 100; ++i) ban[i] = Enumerable.Repeat('.', 100).ToArray();
            for (var i = 1; i < 50; i += 2)
                for (var j = 0; j < 100; j += 2)
                {
                    if (0 < --A) ban[i][j] = '.';
                    if (0 < --B) ban[i + 50][j] = '#';
                }
            WriteLine("100 100");
            for (var i = 0; i < 100; ++i)
                WriteLine(string.Join("", ban[i]));
        }

        static long Mod = 998244353;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
    }
}

Measured memory_bytes: 28564
#include<stdio.h>

int main(){
    int num[2];
    int ans = 0;
    int i;

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

    for(i=0; i<2; i++){
        if(num[0] > num[1]){
            ans += num[0];
            num[0] = num[0] - 1;
        }else{
            ans += num[1];
            num[1] = num[1] - 1;
        }
    }
    printf("%d", ans);
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<climits>
#include<set>
#include<tuple>
#include<stack>


using namespace std;
typedef pair<int, int> pii;
typedef long long int ll;
typedef pair<ll, ll> pll;
typedef tuple<int, int, int> tpl;
int dx[4] = { 1,0,0,-1 };
int dy[4] = { 0,1,-1,0 };

#define ARRAY_MAX 1500

const int INF = 1 << 30;
const int MOD = 1e9 + 7;

int main() {


	string a, b, c;
	cin >> a >> b >> c;
	reverse(a.begin(), a.end());
	reverse(b.begin(), b.end());
	reverse(c.begin(), c.end());
	int now = 0;
	while (true)
	{
		if (now == 0)
		{		
			if (a.size() == 0)
			{
				cout << 'A' << endl;
				return 0;
			}
			char ch = a.back();
			a.pop_back();
			now = ch - 'a';
		}
		else if (now == 1)
		{
			if (b.size() == 0)
			{
				cout << 'B' << endl;
				return 0;
			}
			else
			{
				char ch = b.back();
				b.pop_back();
				now = ch - 'a';
			}

		}
		else
		{
			if (c.size() == 0)
			{
				cout << 'C' << endl;
				return 0;
			}
			else
			{
				char ch = c.back();
				c.pop_back();
				now = ch - 'a';
			}
		}
	}
	
	


	return 0;
}

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

int MaxSuger(int c, int d, int limit) {
    int result = 0;
    for (int x = 0; x <= limit / c; ++x) {
        int y = (limit - x * c) / d;
        result = std::max(result, x * c + y * d);
    }
    return result;
}

int Compare(int a, int b) {
    if (a == b) {
        return 0;
    } else {
        if (a < b) {
            return -1;
        } else {
            return 1;
        }
    }
}

int CompareRational(std::pair<int, int> x, std::pair<int, int> y) {
    return Compare(x.first * y.second, y.first * x.second);
}

int main() {
    int water[2];
    int suger[2];
    int enough;
    int full;
    scanf("%d %d", water, water+1);
    scanf("%d %d", suger, suger+1);
    scanf("%d %d", &enough, &full);

    int ansWater = 100 * water[0];
    int ansSuger = 0;
    auto totalWater = [&water](int x, int y) {
        return (x * water[0] + y * water[1]) * 100;
    };
    for (int x = 0; totalWater(x, 0) <= full; ++x) {
        for (int y = 0; totalWater(x, y) <= full; ++y) {
            int water = totalWater(x, y);
            int sugerLimit = std::min(full - water, water / 100 * enough);
            int maxSuger = MaxSuger(suger[0], suger[1], sugerLimit);
            // fprintf(stderr, "%d %d\n", maxSuger, water);
            if (CompareRational({maxSuger, water}, {ansSuger, ansWater}) > 0) {
                ansWater = water;
                ansSuger = maxSuger;
            }
        }
    }
    printf("%d %d\n", ansSuger + ansWater, ansSuger);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<set>
#include<algorithm>
#include<cmath>
#include<cstdio>
 
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define MAX 300001
 
using namespace std;
typedef unsigned long long ull;
int n,m,L,R;
char s[MAX],o[5];
set<ull> ans;
const ull B = 9973ULL;
const ull inv = 9063375710536127837ULL;
ull H,Bmax;
 
int main()
{
 cin.tie(0);
 ios::sync_with_stdio(false);

  Bmax = 1;
  L = R = 0;
  scanf("%d %d",&n,&m);
  scanf("%s",&s[0]);
  H = s[0];
 
  rep(_,m)
    {
      scanf("%s",&o[0]);
 
      if(o[0] == 'R')
	{
	  if(o[1] == '+')
	    {
	      R++;
	      Bmax *= B;
	      H = H + s[R]*Bmax; 
	    }
	  else
	    {
	      H = H - s[R]*Bmax;
	      Bmax = Bmax*inv;
	      R--;
	    }
	}
      else
	{
	  if(o[1] == '+')
	    {
	      H = (H-s[L])*inv;
	      Bmax *= inv;
	      L++;
	    }
	  else
	    {
	      L--;
	      H = H * B + s[L];
	      Bmax *= B;
	    }
	}
      ans.insert(H);
    } 
 
  cout << ans.size() << endl;
 
  return 0;
}

Measured memory_bytes: 15580