akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;


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

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

    int ans = 0;
    rep(i, k) ans += v[i];

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

Measured memory_bytes: 3596
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        int A = int.Parse(ReadLine());
        int B = int.Parse(ReadLine());
        if(A != 1 && B != 1)
        {
            WriteLine(1);
        }
        else if(A != 2 && B != 2)
        {
            WriteLine(2);
        }
        else
        {
            WriteLine(3);
        }
    }
}

Measured memory_bytes: 13140
#include<cstdio>
using namespace std;
int main(){
  long k;
  scanf("%ld",&k);
  printf("50\n");
  for(int i=1;i<=50;i++){
    if(k%50>=i)
      printf("%ld ",50*(k/50+1)+49-k+k/50+1);
    else
      printf("%ld ",50*(k/50)+49-k+k/50);
  }
  printf("\n");
}

Measured memory_bytes: 128
#include <iostream>
#include <cmath>
#include <unordered_map>
#include <fstream>
using namespace std;

void getdig(int sol, int dig[]){
	for(int i=0; i<6; i++) dig[i] = 0;
	for(int i=1; i<6; i++){
		dig[i] = (sol % static_cast<int>(pow(10, i)));
		sol -= dig[i];
		dig[i] /= static_cast<int>(pow(10, i-1));
		if(sol==0){
			for(int j=i+1; j<6; j++){
				dig[j]=-1;
			}
			return;
		}
	}
}

bool judge(unordered_map<int, bool> &mp, int dig[]){
	for(int i=1; i<6; i++){
		if(mp[dig[i]]){
			return false;
		}
	}
	return true;
}


int main(){
//	ifstream File("data");

	int N, K;
	int temp;
	unordered_map<int, bool> mp;
	cin >> N >> K;
//	File >> N >> K;
	for(int i=0; i<K; i++){
		cin >> temp;
//		File >> temp;
		mp[temp]=true;
	}

	int sol=N;
	int dig[6];
	while(1){
		getdig(sol, dig);
		if(judge(mp, dig)){
			cout << sol << endl;
			return 0;
		}else{
			sol++;
		}
	}
}


Measured memory_bytes: 384
#include <cstdio>

int g[300000];
int i,n;

int main()
{
	scanf("%d",&n);
	for (i=1;i<=n;i++)
		scanf("%d",&g[i]);
	for (i=n;i>0;i=i-2)
		printf("%d ",g[i]);
	i=1-i;
	for (;i<=n;i=i+2)
		printf("%d ",g[i]);
	return 0;
}

Measured memory_bytes: 2816
import java.util.Scanner;

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

        if(A*B % 2 == 0){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }

    }
}


Measured memory_bytes: 23252
#include <bits/stdc++.h>
#include <atcoder/all>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#ifdef ENABLE_DEBUG
#define dump(a) cerr<<#a<<"="<<a<<endl
#define dumparr(a,n) cerr<<#a<<"["<<n<<"]="<<a[n]<<endl
#else
#define dump(a) 
#define dumparr(a,n) 
#endif
#define FOR(i, a, b) for(ll i = (ll)a;i < (ll)b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(ll i = (ll)b-1LL;i >= (ll)a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)
#define SIGN(a) (a==0?0:(a>0?1:-1))

typedef long long int ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<ll, ll> pll;
typedef pair<ll,pll> ppll;
typedef vector<ll> vll;
typedef long double ld;
typedef pair<ld,ld> pdd;

pll operator+(pll a,pll b){
  return pll(a.first+b.first,a.second+b.second);
}
pll operator-(pll a,pll b){
  return pll(a.first-b.first,a.second-b.second);
}
pll operator*(ll a,pll b){
  return pll(b.first*a,b.second*a);
}
const ll INF=(1LL<<60);
#if __cplusplus<201700L
ll gcd(ll a, ll b) {
  a=abs(a);
  b=abs(b);
  if(a==0)return b;
  if(b==0)return a;
  if(a < b) return gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
#endif
template<class T>
bool chmax(T& a,const T& b){
  if(a<b){
    a=b;
    return true;
  }
  return false;
}
template<class T>
bool chmin(T& a,const T& b){
  if(a>b){
    a=b;
    return true;
  }
  return false;
}
template<class S,class T>
std::ostream& operator<<(std::ostream& os,pair<S,T> a){
  os << "(" << a.first << "," << a.second << ")";
  return os;
}
template<class T>
std::ostream& operator<<(std::ostream& os,vector<T> a){
  os << "[ ";
  REP(a.size()){
    os<< a[i] << " ";
  }
  os<< " ]";
  return os;
}
template<class T>
std::ostream& operator<<(std::ostream& os,set<T> a){
  os << "[ ";
  for (auto &&i : a)
  {
    os<< i << " ";
  }
  os<< " ]";
  return os;
}

ll add (ll a,ll b){
  return a+b;
}
ll zero(){
  return 0LL;
}

void solve(long long N, std::vector<long long> x, std::vector<long long> y){
  using namespace atcoder;
  dsu d(N);
  set<pll> s;
  vector<tuple<ll,ll,ll>> ps;
  REP(N){
    ps.push_back(make_tuple(x[i],y[i],i));
  }
  sort(ps.begin(),ps.end());
  REP(N){
    auto [x,y,idx]=ps[i];
    if(s.empty()||s.upper_bound(pll(y,-1))==s.begin()){
      s.insert(pll(y,idx));
    }else{
      auto end = s.upper_bound(pll(y,-1));
      for (auto itr = s.begin(); itr != end; ++itr)
      {
        d.merge(idx,itr->second);
      }
      s.erase(next(s.begin()),end);
      dump(s);
    }
  }
  REP(N){
    cout<<d.size(i)<<endl;
  }
}

int main(){
  cout<<setprecision(1000);
    long long N;
    scanf("%lld",&N);
    std::vector<long long> x(N);
    std::vector<long long> y(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&x[i]);
        scanf("%lld",&y[i]);
        --x[i];--y[i];
    }
    solve(N, std::move(x), std::move(y));
    return 0;
}


Measured memory_bytes: 16712
a = list(map(int,input().split()))
#b = list(map(int,input().split()))
b=int(input())

for i in range(b):
    if a[2]<=a[1]:
        a[2]=2*a[2]
    elif a[1]<=a[0]:
        a[1]=2*a[1]
if a[0]<a[1]<a[2]:
    print("Yes")
else:
    print("No") 


Measured memory_bytes: 9108
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		while(true){
			String input = br.readLine();

			String[] tmpArray = input.split(" ");
			int h = Integer.parseInt(tmpArray[0]);
			int w = Integer.parseInt(tmpArray[1]);

			if(h == 0 && w == 0){
				break;
			}

			int map[][] = new int[h][w];

			//init map
			for(int i = 0; i < h; i++){
				tmpArray = br.readLine().split(" ");

				for(int j = 0; j < w; j++){
					map[i][j] = Integer.parseInt(tmpArray[j]);
				}
			}

			int result = 0;

			for(int width = 3; width <= w; width++){
				for(int height = 3; height <= h; height++){
//					System.out.println("height "+height+" width "+width);



					for(int i = 0; i + height <= h; i++){
						for(int j = 0; j + width <= w; j++){
//							System.out.println("left top ("+j+", "+i+")");

							int outerMinHeight = 10;
							int innerMaxHeight = 0;
							int sumHeight = 0;

							for(int k = i; k < i + height; k++){
								for(int l = j; l < j + width; l++){
									if(k == i || k == i + height - 1 || l == j || l == j + width - 1){
										outerMinHeight = Math.min(outerMinHeight, map[k][l]);
									}
									else {
										innerMaxHeight = Math.max(innerMaxHeight, map[k][l]);
										sumHeight += map[k][l];
									}
								}
							}

							if(outerMinHeight > innerMaxHeight){
								result = Math.max(result, (width - 2)*(height - 2)*outerMinHeight - sumHeight);
//								System.out.println("result update -> "+result);
							}
						}
					}
				}
			}

			System.out.println(result);
		}
	}

}



Measured memory_bytes: 28124
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;

int main(void) {
    int n;
    cin>>n;
    int res=0;
    int div=10;
    if(n<10){
        cout << n << endl;
        return 0;
    }
    while(n>div){
        res+=9*div/10;
        div*=100;
    }
    res+=max(0,n-div/10+1*(n!=div));
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string.h>
#include <math.h>
#include <stdio.h>
#include <deque>
#include <bits/stdc++.h>
//#include "D:\C++\test_lib_projects\testlib.h"
using namespace std;
#define ll long long
#define pii pair<int,int>
#define qi ios::sync_with_stdio(0)

bool debug=true;

/*    *************************************
	  * Written in New Computer           *
	  * The following code belongs to     *
	  * XiaoGeNintendo of HellHoleStudios *
	  *************************************
*/
template<typename T1,typename T2>ostream& operator<<(ostream& os,pair<T1,T2> ptt){
	os<<ptt.first<<","<<ptt.second;
	return os;
}
template<typename T>ostream& operator<<(ostream& os,vector<T> vt){
	os<<"{";
	for(int i=0;i<vt.size();i++){
		os<<vt[i]<<" ";
	}
	os<<"}";
	return os;
}

ll n,k; 

ll has(ll max,ll mod,ll rem){
	return max/mod+(max%mod>=rem);
}

int main(int argc,char* argv[]){
	cin>>n>>k;
	if(k%2){
		//Odd
		cout<<(n/k)*(n/k)*(n/k)<<endl;
	}else{
		//Even
		cout<<(n/k)*(n/k)*(n/k)+has(n,k,k/2)*has(n,k,k/2)*has(n,k,k/2)<<endl;
	}
	return 0;
}



Measured memory_bytes: 256
#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;}


signed main() {
    int N;
    cin >> N;
    vector<int> d(N);
    rep(i, N) cin >> d[i];
    SORT(d);

    int res = 1;
    FOR(i, 1, N) {
        if(d[i-1]==d[i]) continue;
        res++;
    }
    
    cout << res << endl;
    return 0;
}

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

using namespace std;

int main(void){
    int N;
    cin >> N;
    vector<int> p(N);
    for(auto& x : p){
        cin >> x;
        x--;
    }

    int ans = 0;
    for(int i=0; i<N; i++){
        if(i == p[i]){
            if(i == N-1) swap(p[i], p[i-1]);
            else swap(p[i], p[i+1]);
            
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF=1LL<<60;
const int inf=1<<30;
const int mod=1e9+7;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin >> n;
    ll ans=0;
    for(int i=1;i<=n;i++){
        if(i%3!=0&&i%5!=0){
            ans+=i;
        }
    }
    cout << ans << endl;
}


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

using namespace std;

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

	if (N == 0) {
		cout << X << endl;
		return 0;
	}

	int upside = X, downside = X;
	vector<int> p;
	for (int i = 0; i < N; i++) {
		p.push_back(0);
		cin >> p[i];
	}

	sort(p.begin(), p.end());
	int d_up = 0, d_down = 0;
	for (auto i : p) {
		if (upside == i) {
			upside++;
			d_up++;
		}
	}

	for (int i = (int)p.size() - 1; i >= 0; i--) {
		if (downside == p[i]) {
			downside--;
			d_down++;
		}
	}

	if (d_up >= d_down) {
		cout << downside << endl;
	}
	else {
		cout << upside << endl;
	}

	return 0;
}

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

using namespace std;

typedef long long ll;

int main()
{
    ll N;
    ll d[100];
    cin >> N;
    map<int, int> cnt;
    for (int i = 0; i < N; i++) {
        cin >> d[i];
        if (cnt.count(d[i])) {
            cnt[d[i]]++;
        } else {
            cnt.insert(make_pair(d[i], 0));
        }
    }
    cout << cnt.size() << endl;
}

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

constexpr int MAX_N = 100;
constexpr int MAX_W = 100000;
int64_t dp[MAX_N + 1][MAX_W + 1];

int64_t solve(const int N, const int W, const vector<int64_t>& w, const vector<int64_t>& v) {
  // Initialize dp table
  for (auto i = 0; i <= MAX_W; ++i) {
    dp[0][i] = 0;
  }

  // dp
  for (auto i = 1; i <= N; ++i) {
    for (auto j = 0; j <= W; ++j) {
      if (j - w[i - 1] >= 0) {
        dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - w[i - 1]] + v[i - 1]);
      } else {
        dp[i][j] = dp[i - 1][j];
      }
    }
  }

  // Find max value
  int64_t max_value = 0;
  for (auto i = 1; i <= MAX_W; ++i) {
    max_value = max(max_value, dp[N][i]);
  }

  return max_value;
}

int main() {
  // Input
  int N, W;

  cin >> N >> W;

  vector<int64_t> w(N), v(N);
  for (auto i = 0; i < N; ++i) {
    cin >> w[i] >> v[i];
  }

  // Solve
  auto ans = solve(N, W, w, v);

  // Answer
  cout << ans << endl;

  return 0;
}


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

signed main(){
    ll n,m;
    cin >> n >> m;
    ll x[n],y[m];
    REP(i,n){
        cin >> x[i];
    }
    REP(i,m){
        cin >> y[i];
    }
    ll x_sum = 0, y_sum = 0;
    for(ll i = 1; i < n; i++){
        x_sum += (x[i] - x[i - 1]) * i * (n - i);
        x_sum %= MOD;
    }
    for(ll i = 1; i < m; i++){
        y_sum += (y[i] - y[i - 1]) * i * (m - i);
        y_sum %= MOD;
    }
    cout << x_sum * y_sum % MOD << endl;
    return 0;
}

Measured memory_bytes: 1792
N, M = map(int, input().split(" ")) 
p1 = []
p2 = []
p3 = []
p4 = []
for i in range(N):
  x, y, z = map(int, input().split(" "))
  p1.append(x+y+z)
  p2.append(x+y-z)
  p3.append(x-y+z)
  p4.append(x-y-z)
p1.sort()
p2.sort()
p3.sort()
p4.sort()
a1 = a2 = a3 = a4 = a_1 = a_2 = a_3 = a_4 = 0
for i in range(M):
  a1 += p1[i]
  a2 += p2[i]
  a3 += p3[i]
  a4 += p4[i]
  a_1 += p1[len(p1)-1-i]
  a_2 += p2[len(p2)-1-i]
  a_3 += p3[len(p3)-1-i]
  a_4 += p4[len(p4)-1-i]
ans_re = [-a1, -a2, -a3, -a4, a_1, a_2, a_3, a_4]
ans_re.sort()
print(ans_re[7])

Measured memory_bytes: 3188
import java.util.*;
 
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int K = Integer.parseInt(sc.next());
        int S = Integer.parseInt(sc.next());
        int C = 0;

        int nam = 0;

      
      for(int a=0;a<=K;a++){
       for(int b=0;b<=K;b++){
         C = S-a-b;
         if(0<=C&&C<=K){
           nam = nam +1;
         }
       }
      }
      System.out.print(nam);
    }
}

Measured memory_bytes: 21844
#include <iostream>
#include <iomanip>
#include <string>
#include <map>
#include <math.h>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <set>
#include <queue>
#include <sstream>
#include <stack>
#include <deque>
#include <memory.h>
#include <cassert>
#include <ctime>
#include <climits>
#include <list>
#include <time.h>
#include <unordered_map>
#include <bitset>
#include <exception>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned long long ull;
#define pb push_back
#define mp make_pair
#define FILE "file"
#define lc v << 1
#define rc (v << 1) + 1
#define inf 1e+9
#define linf ll(1e+18)
#define dinf 1e+14

typedef long long ll;
#define pb push_back
#define mp make_pair

int cnt[3];

void solve()
{
    int n, y;
    cin >> n >> y;
    
    y /= 1000;
    
    for(int i = y / 10; i >= 0; i--)
    {
        for(int k = (y - i * 10) / 5; k >= 0; k--)
        {
            int j = n - i - k;
            if(j >= 0 && i * 10 + k * 5 + j == y)
            {
                cout << i << " " << k << " " << j;
                return;
            }
        }
    }
    
    cout << -1 << " " << -1 << " " << -1;
}

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    //freopen(FILE ".in", "r", stdin);freopen(FILE ".out", "w", stdout);
    //freopen("file.in", "r", stdin);freopen("file.out", "w", stdout);
    int t = 1;
    //cin >> t;
    
    while(t--)
    {
        solve();
    }
    
    return 0;
}


Measured memory_bytes: 256
using System;
    using System.Linq;
    using System.Collections.Generic;


    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string[] input = Console.ReadLine().Split(' ');
            int[] A = new int[N];
            for(int i=0; i<N; i++){
                A[i] = int.Parse(input[i]);
            }

            string different = "YES";
            /*
            bool quit = false;

            for(int i=0; i<N-1; i++){
                for(int j=i+1; j<N; j++){
                    if(A[j]==A[i]){
                        different = "NO";
                        quit = true;
                        break;
                    }
                }
                if(quit==true) break;
            }
            */

            if(A.Length == A.Distinct().Count()){
                different = "YES";
            }else{
                different = "NO";
            }

            Console.WriteLine(different);
        }
    }

Measured memory_bytes: 40860
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <map>
#include <vector>
#include <queue>
#define maxn 309
using namespace std;
const int MOD = 998244353;
int a[maxn];
long long dp[maxn][maxn * maxn][2][2];
int sum[maxn];

inline void add(long long &x, long long y){
	x += y;
	if(x >= MOD)
		x -= MOD;
}

int main(){
	dp[0][0][0][0] = 1;
	
	int n;
	cin >> n;
	
	for(int i = 1; i <= n; i++)
		cin >> a[i];
		
	for(int i = 1; i <= n; i++)
		sum[i] = sum[i - 1] + a[i];
		
	for(int i = 0; i < n; i++){
		for(int j = 0; j <= sum[i]; j++){
			for(int x = 0; x < 2; x++)
				for(int y = 0; y < 2; y++){
					long long cur = dp[i][j][x][y];
					add(dp[i + 1][j + a[i + 1]][x][y], cur);
					add(dp[i + 1][j][1][y], cur);
					add(dp[i + 1][j][x][1], cur); 
				}
		}
	}
	
	long long tot = 0;
	for(int i = 0; i <= sum[n]; i++){
		if(2 * i >= sum[n]){
			add(tot, dp[n][i][1][1]);
		}
	}
	
	tot = tot * 3 % MOD;
	
	long long P = 1;
	long long ans = 1;
	for(int i = 1; i <= n; i++){
		P = P * 2 % MOD;
		ans = ans * 3 % MOD;
	}
	
	P = 3 * (P - 2) % MOD;
	P += MOD;
	P %= MOD;
	
	long long Q = 3;
	
	ans = ans - (P + Q + tot);
	ans %= MOD;
	ans += MOD;
	ans %= MOD;
	
	cout << ans << endl;
	return 0;
	
}

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

namespace CSharpSpiral {
	class Program {
		static void Main(string[] args) {
			var sw = new StreamWriter(Console.OpenStandardOutput()) {
				AutoFlush=
#if DEBUG
			true
#else
			false
#endif
			};
			Console.SetOut(sw);
			new Program().Solve(new ConsoleInput(
#if DEBUG
			new StreamReader("../../../inputData.txt")
#else
			Console.In
#endif
			, ' '));
			Console.Out.Flush();
		}
		public void Solve(ConsoleInput cin) {
			var X = cin.ReadIntArray(5);
			Console.WriteLine(X.ToList().IndexOf(0)+1);
		}

	}
	static class ExtendClass {
		public static string Join<T>(this IEnumerable<T> X, string separator = " ") => string.Join(separator, X);
	}
	class ConsoleInput {
		private readonly TextReader _stream;
		private readonly char _separator = ' ';
		private readonly Queue<string> inputStream;
		public ConsoleInput(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; }
		public double[] ReadDoubleArray(long N) { var ret = new double[N]; for(long i = 0; i<N; ++i) ret[i]=ReadDouble; return ret; }
		public bool isEOF {
			get { return _stream.Peek()==-1; }
		}
	}
}

Measured memory_bytes: 28236
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define all(a) (a).begin(), (a).end()
 
 
int main() {
  string s;
  cin >> s;
  sort(all(s));
  if(s == "abc") cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, K;
  cin >> N >> K;
  vector<int> vec(N);
  for (int i = 0; i < K; i++) {
    int d;
    cin >> d;
    for (int j = 0; j < d; j++) {
      int A;
      cin >> A;
      for (int k = 1; k < 101; k++) {
        if (A == k) {
          vec.at(k - 1)++;
        }
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (vec.at(i) == 0) {
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3636
while True:
    n = int(input())
    if n == 0:
        break
    walk = []
    for i in range(n):
        p,d1,d2 = map(int,input().split())
        walk.append([d1+d2,p])
    walk.sort(reverse = True)
    print(walk[0][1],walk[0][0])


Measured memory_bytes: 7108
#include<iostream>

using namespace std;

int main()
{
	int n, i,j,a, b, c,flag;

	cin >> n;
	for (i = 0; i < n; i++) {
		b = c = 0;
		flag = 1;
		for (j = 0; j < 10; j++) {
			cin >> a;
			if (a > b) {
				b = a;
			}
			else if (a > c) {
				c = a;
			}else {
				flag = 0;
			}
		}

		if (flag == 1) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}

	return 0;
}


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

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

using namespace std;

int main(){
	string s1,s2,s3;
	int q,t=0; cin>>s1>>q;
	rep(_,q){
		int type; scanf("%d",&type); type--;
		if(type==0){
			t^=1;
		}
		else{
			char c; scanf("%d %c",&type,&c); type--;
			if(type==t) s2+=c;
			else        s3+=c;
		}
	}

	if(t==0){
		reverse(s2.begin(),s2.end());
		cout<<s2<<s1<<s3<<'\n';
	}
	else{
		reverse(s3.begin(),s3.end());
		reverse(s1.begin(),s1.end());
		cout<<s3<<s1<<s2<<'\n';
	}

	return 0;
}


Measured memory_bytes: 1088
#include<stdio.h>
int main(void)
{
	int N, tmp1, tmp2, tmp3, tmp4;
	scanf("%d", &N);
	tmp1 = N % 10; N /= 10;
	tmp2 = N % 10; N /= 10;
	tmp3 = N % 10; N /= 10;
	tmp4 = N % 10; N /= 10;
	if ((tmp1 == tmp2 && tmp1 == tmp3) || (tmp2 == tmp3 && tmp2 == tmp4)) {
		printf("Yes");
	}
	else {
		printf("No");
	}
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll M=1e9+7;
 
 
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n,m;
	cin>>n>>m;
	ll i,j,sum=0;
	for(i=m;i<=n;i++){
		ll a=(i*(i-1))/2;
		ll c=n-i;
		ll b=(n*(n+1))/2-(c*(c+1))/2;
		sum=(sum+b-a+1)%M;
	}
	cout<<(sum+1)%M<<endl;
	
	return 0;
} 

Measured memory_bytes: 3656
#include <iostream>
#include <vector>

int main() {
	int n, w;
	std::cin >> n >> w;
	std::vector<int> max_value_with_weight(w + 1, -1);
	max_value_with_weight[0] = 0;
	for (auto i = 0; i < n; ++i) {
		int value, weight, m;
		std::cin >> value >> weight >> m;
		auto j = 0;
		for (; (1 << (j + 1)) <= m; ++j) {
			auto multiper = (1 << j);
			for (auto weight_index = w - weight * multiper; weight_index >= 0; --weight_index) {
				if (max_value_with_weight[weight_index] != -1) {
					if (max_value_with_weight[weight_index + weight * multiper] < value * multiper + max_value_with_weight[weight_index])
						max_value_with_weight[weight_index + weight * multiper] = value * multiper + max_value_with_weight[weight_index];
				}
			}
		}
		auto multiper = m - (1 << j) + 1;
		for (auto weight_index = w - weight * multiper; weight_index >= 0; --weight_index) {
			if (max_value_with_weight[weight_index] != -1) {
				if (max_value_with_weight[weight_index + weight * multiper] < value * multiper + max_value_with_weight[weight_index])
					max_value_with_weight[weight_index + weight * multiper] = value * multiper + max_value_with_weight[weight_index];
			}
		}
	}
	int max = 0;
	for (auto i = 0; i < max_value_with_weight.size(); ++i) {
		if (max < max_value_with_weight[i]) max = max_value_with_weight[i];
	}
	std::cout << max << std::endl;
}


Measured memory_bytes: 3132
#include <stdio.h>

int main()
{
		int i;
		int one=0, two=0, three=0;
		int height;
		
		for(i=0; i<10; i++ ){
				scanf("%d", &height );
				if( one < height ){
						three = two;
						two = one;
						one = height;
				}else if( two < height ){
						three = two;
						two = height;
				}else if( three < height ){
						three = height;
				}
		}

		printf("%d\n%d\n%d\n", one, two, three );

		return 0;
}

Measured memory_bytes: 600
n,m,x=map(int,input().split())
clis=[]
alis=[]
for _ in range(n):
  tu=list(map(int,input().split()))
  clis.append(tu[0])
  alis.append(tu[1:])


ma_c=[]
for i in range(2**n):
  bag=[]
  price=0
  for j in range(n):
    if ((i>>j)&1):
      price+=clis[j]
      bag.append(alis[j])
  pac=[0]*m
  for t in range(len(bag)):
    for k in range(m):
        pac[k]+=bag[t][k]
  if all([pac[t]>=x for t in range(m)]):
    ma_c.append(price)


if len(ma_c)!=0:
  print(min(ma_c))
else:
  print(-1)

Measured memory_bytes: 68784
#include <bits/stdc++.h>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
#define li long long int
#define pb push_back

bool f(vector<li>& A,li cut,li size)
{
    if(size<=0)
    return false;
    li ct=0;
    for(int i=0;i<A.size();i++)
    {
        ct+= A[i]%size==0 ? A[i]/size - 1 : A[i]/size ;
    }
    //cout<<ct<<" "<<cut<<" "<<size<<" \n";
    if(ct<=cut)
    return true;
    return false;
}

li bs(vector<li>& A,li k)
{
    li lb=0,ub=999999999999;
    li md;

    while(lb <= ub)
    {
        md=(lb+ub)/2;
        if(f(A,k,md) && f(A,k,md-1)==false)
            return md;
        if(f(A,k,md))
            ub=md-1;
            else
            lb=md+1;
    }
    return -1;
}

int main() {
    li t,i,j,l=0;
    li N,M,K,Z;
    cin>>N>>K;
    vector<li> A(N);
    for(i=0;i<N;i++)
    cin>>A[i];

    M=bs(A,K);
    cout<<M;
    
    return 0;
}


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

using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    A[i]--;
  }
  vector<bool> used(N, false);
  int current = 0;
  int answer = 0;
  while (true) {
    if (current == 1) {
      cout << answer;
      return 0;
    }
    if (used[current]) {
      cout << -1;
      return 0;
    }

    used[current] = true;
    current = A[current];
    answer++;
  }

  return 0;
}


Measured memory_bytes: 640
#include <iostream>

using namespace std;
typedef long long ll;

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


Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	var X int64
	fmt.Scan(&X)
	num_500 := X / 500
	X_remain := X - num_500 * 500
	num_5 := X_remain / 5
	fmt.Println(1000 * num_500 + 5 * num_5)
}

Measured memory_bytes: 640
x = int(input())

if 400<= x and x <= 599:
  print("8")
elif 600<= x and x <= 799:
  print("7")
elif 800<= x and x <= 999:
  print("6")
elif 1000<= x and x <= 1199:
  print("5")
elif 1200<= x and x <= 1399:
  print("4")
elif 1400<= x and x <= 1599:
  print("3")
elif 1600<= x and x <= 1799:
  print("2")
elif 1800<= x and x <= 1999:
  print("1")

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

int main()
{
    int s;
    cin >> s;
    int hour, minute, second;
    second = s % 60;
    hour = s / 60 / 60;
    minute = (s - (hour * 60 * 60) - second) / 60;
    cout << hour << ":" << minute << ":" << second << endl;
}


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

int n;
double dp[301][301][301]{};
array<int, 4> cnt{};

double go() {
    if (dp[cnt[1]][cnt[2]][cnt[3]] > 0)
        return dp[cnt[1]][cnt[2]][cnt[3]];
    // expected value of ops to pick a plate with some sushi
    double E = double(n) / double(cnt[1] + cnt[2] + cnt[3]);
    for (int i = 1; i <= 3; i++) {
        if (cnt[i]) {
            // prob. of picking a plate that has i sushis
            double p = double(cnt[i]) / double(cnt[1] + cnt[2] + cnt[3]);
            cnt[i]--, cnt[i - 1]++;
            E += p * go();
            cnt[i]++, cnt[i - 1]--;
        }
    }
    return dp[cnt[1]][cnt[2]][cnt[3]] = E;
}

int main() {
    ios::sync_with_stdio(false), cin.tie(nullptr);
    // fill_n(&dp[0][0][0], 301 * 301 * 301, -1.0);
    cin >> n;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        cnt[x]++;
    }
    dp[1][0][0] = double(n);
    cout << fixed << setprecision(10) << go() << '\n';
    return 0;
}

Measured memory_bytes: 111152
#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

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

    int n;
    cin >> n;

    vector <ll> A(n+1), B(n);
    for (int i = 0; i <= n; i++) cin >> A[i];
    for (int i = 0; i < n; i++) cin >> B[i];

    ll sum = 0LL;
    ll rem = 0LL;

    for (int i = 0; i < n; i++) {
        sum += min(rem, A[i]);
        A[i] = max(0LL, A[i] - rem);

        sum += min(A[i], B[i]);
        rem = max(0LL, B[i] - A[i]);
    }

    sum += min(rem, A[n]);
    cout << sum << "\n";
    return 0;
}

Measured memory_bytes: 1792
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;

constexpr long double PI = 3.14159265358979323846264338327950288L;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

class DFourColoring {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      int h, w, d; cin >> h >> w >> d;
      vector<vector<char>> dp(h+w, vector<char>(h+w));
      rep(i, h+w) {
        rep(j, h+w) {
          if (i%(2*d)<d && j%(2*d)<d) {
            dp[i][j] = 'R';
          } else if (i%(2*d)<d) {
            dp[i][j] = 'Y';
          } else if (j%(2*d)<d) {
            dp[i][j] = 'B';
          } else {
            dp[i][j] = 'G';
          }
        }
      }

      rep(i, h) {
        rep(j, w) {
          cout << dp[i+j][i-j+w-1];
        }
        cout << '\n';
      }
    }
};

signed main() {
  DFourColoring solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

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

int main(){
    using namespace std;
    unsigned long N;
    cin >> N;
    vector<long> prime, sieve(31622, 1);
    for(long i = 2; i < 31622; ++i)
        if(sieve[i]){
            prime.push_back(i);
            for(auto j = i * i; j < 31622; j += i)sieve[j] = 0;
        }

    vector<long> a(N);
    long C;
    for(auto& i : a)cin >> i;
    cin >> C;
    long u{C};
    for(const auto i : a)u = __gcd(u, abs(i));

    vector<long> ans;
    for(const auto p : prime)
        if(u % p == 0 && (ans.push_back(p), 1))
            while(u % p == 0)u /= p;
        else if(C % p == 0 && p <= N){
            vector<long> v(p);
            for(unsigned long j = 0, k = 0; j < N; ++j, k = k == p - 2 ? 0 : ++k)v[k] += a[j];
            if(none_of(v.begin(), v.end(), [&p](auto x){return x % p;}))ans.push_back(p);
        }
    for(const auto i : ans)cout << i << endl;
    if(u ^ 1)cout << u << endl;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
typedef long long ll;
long long mod = 1e9 + 7;
const int iINF = 0x3f3f3f3f;
const long long INF = 1LL << 60;
using namespace std;

template <class T>
inline bool chmin(T &a, T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}

template <class T>
inline bool chmax(T &a, T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}

int main()
{
  int R;
  cin >> R;
  cout << 2 * R * M_PI << endl;
  return 0;
}


Measured memory_bytes: 3796
#include <iostream>
#include <algorithm>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

int calc(const int x, const int k)
{
  int sum = x;
  REP(i, k)
    sum *= 2;
  return sum;
}

int main()
{
  int v[3];
  int k;
  REP(i, 3) cin >> v[i];
  cin >> k;
  sort(v, v + 3, greater<int>());
  cout << calc(v[0], k) + v[1] + v[2] << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
// const int N=1010;
int main()
{
   long long n;
  cin>>n;
  long long m;
  cin>>m;
  if(n%m==0)cout<<"0";
  else{
    if(n<m){
      if(abs(n-m)<n)cout<<abs(n-m);
      else cout<<n;
    }
    else{
      long long  k=n/m +1;
      cout<<abs(n-m*k);
    }
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MAXN 100005
#define INF 1000000000
#define MOD 1000000007
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int n,k,a[MAXN];
int main()
{
    scanf("%d",&n);
    if(n>=400&&n<600) puts("8");
    else if(n>=600&&n<800) puts("7");
    else if(n>=800&&n<1000) puts("6");
    else if(n>=1000&&n<1200) puts("5");
    else if(n>=1200&&n<1400) puts("4");
    else if(n>=1400&&n<1600) puts("3");
    else if(n>=1600&&n<1800) puts("2");
    else if(n>=1800&&n<2000) puts("1");
    return 0;
 }

Measured memory_bytes: 3764
while True:
    w, h = map(int, input().split())
    if w == 0 and h == 0:
        break
    m = []
    for _ in range(h):
        m.append(list(input()))
    visited = [[False] * w for _ in range(h)]
    dxy = [(1, 0), (0, 1), (-1, 0), (0, -1)]
    answer = 0


    def rec(x, y):
        global answer
        visited[x][y] = True
        answer += 1
        for (dx, dy) in dxy:  # 4方向の移動を試す
            x2 = x + dx
            y2 = y + dy
            if 0 <= x2 < h and 0 <= y2 < w:
                if m[x2][y2] == '.':
                    if not visited[x2][y2]:
                        rec(x2, y2)  # 再帰呼び出し


    for i in range(h):
        for j in range(w):
            if m[i][j] == '@':
                rec(i, j)
                break
        else:
            continue
        break
    print(answer)



Measured memory_bytes: 5760
get_number(Number) :-
    get_string(String),
    number_string(Number, String).

get_string(String) :-
    current_input(Input),
    read_string(Input, ' \n', '', _, String).

/* memo
    code(int)
    string_code(1, S, C), (C: code)
    char_code(X, Y) (X: char, Y: code)
*/

main:-
    get_number(K),
    get_number(X),
    (500 * K >= X) -> writeln("Yes") ; writeln("No").


Measured memory_bytes: 7952
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();

    int[] num;
    num = new int[3];
    num[0] = A+B ;
    num[1] = 2*A-1 ;
    num[2] = 2*B-1 ;

    int max = 0;
    for(int i = 0; i < num.length ; i++) {
        if(max < num[i]) {
            max = num[i];
        }
    }
    System.out.println(max);
  }
}

Measured memory_bytes: 22612
/*
 * ID:  ITP1_10_A
 * Problem: Distance
 */

#include <stdio.h>
#include <math.h>

int main(void)
{
    double x1, y1, x2, y2;

    scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);
    printf("%f\n", hypot(x1 - x2, y1 - y2));

    return 0;
}



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

int main() {
    //
    int num;
    string str;
    int que1, que2;
    string tmpStr;
    bool Rchk = true;

    cin >> str >> num;

    for (int i = 0; i < num; i++) {
        cin >> que1;
        if (que1 == 1) {
            //反転
            Rchk = !Rchk;
        } else if (que1 == 2) {
            cin >> que2 >> tmpStr;
            if (que2 == 1) {
                //　先頭
                if (Rchk == true)
                    str = tmpStr + str;
                else
                    str += tmpStr;
            } else if (que2 == 2) {
                // 末尾
                if (Rchk == true)
                    str += tmpStr;
                else
                    str = tmpStr + str;
            }
        }
    }

    if (Rchk == false) reverse(str.begin(), str.end());
    cout << str;
}

Measured memory_bytes: 4672
#include <iostream>
#include <vector>

using namespace std;

class UnionFind
{
public:
    vector<int> parent;
    vector<int> rank;
    
    UnionFind(int n): parent(n), rank(n)
    {
        for(int i=0;i<n;i++)
            parent[i] = i,
            rank[i] = 0;
    }

    int root(int x)
    {
        return parent[x]==x ? x : parent[x] = root(parent[x]);
    }

    bool same(int x, int y)
    {
        return root(x)==root(y);
    }

    void unite(int x, int y)
    {
        x = root(x);
        y = root(y);
        if (x != y)
        {
            if (rank[x] < rank[y])
                parent[x] = y;
            else
                parent[y] = x;
            if (rank[x]==rank[y])
                rank[x]++;
        }
    }
};

int main()
{
    int N, M;
    cin>>N>>M;
    vector<int> a(M), b(M);
    for (int i=0; i<M; i++)
        cin>>a[i]>>b[i],
        a[i]--, b[i]--;

    int ans = 0;
    for (int i=0; i<M; i++)
    {
        UnionFind u(N);
        for (int j=0; j<M; j++)
        if (j != i)
            u.unite(a[j], b[j]);
        bool ok = false;
        for (int j=0; j<N; j++)
            if (u.root(j) != u.root(0))
                ok = true;
        if (ok)
            ans++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    L, R, d = map(int, rl().split())
    
    ans = 0
    for i in range(L, R + 1):
        if i % d == 0:
            ans += 1
    print(ans)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 61932
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using P = pair<int, int>;
int mod = (int) 1e9 + 7;

int main(){
    
    int x, n;
    cin >> x >> n;
    
    if(n == 0){
        cout << x << "\n";
        return 0;
    }
    
    set<int> s;
      
    rep(i, n){
        int a;
        cin >> a;
        s.emplace(a);
    }
    
    rep(i, 100){
        int a = x - i;
        int b = x + i;
        if(s.count(a) == 1 && s.count(b) == 1) continue;
        
        if(s.count(a) == 0){
            cout << a << "\n";
            return 0;
        } else {
            cout << b << "\n";
            return 0;
        }
        
    }

    return 0;
}



Measured memory_bytes: 3132
while True:
    x,y,s = map(int, input().split())
    if x == 0 and y == 0 and s == 0:
        break
    else:
        maxtax1 = 0
        maxtax2 = 0
        i = 1
        for i in range(1,s):
            for j in range(i,s):
                if (j*(100 + x) // 100) + (i*(100 + x) // 100) == s:
                    check = (i * (100 + y)) // 100
                    check2 = (j * (100 + y)) // 100
                    if (check + check2) > (maxtax1 + maxtax2):
                        maxtax1 = ((i*(100 + y)) // 100)
                        maxtax2 = ((j*(100 + y)) // 100)
        print(maxtax1 + maxtax2)


Measured memory_bytes: 5600
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>

using namespace std;

#define vi vector<int>
#define vii vector<vector<int>>

// int date[12] = {31,28}

void testcase()
{
    string s;
    cin >> s;
    // string a = s.substr(0,2);
    // string b = s.substr(2,4);
    int x = (s[0] - '0') * 10 + s[1] - '0';
    int y = (s[2] - '0') * 10 + s[3] - '0';
    int mm = 0, yy = 0;
    // cout << x << " " << y <<"\n";
    if (x <= 12 && x > 0)
    {
        mm++;
    }
    else
    {
        yy++;
    }
    if (y <= 12 && y > 0)
    {
        mm++;
    }
    else
    {
        yy++;
    }

    if (yy == 2)
    {
        cout << "NA\n";
    }
    else if (mm == 2)
    {
        cout << "AMBIGUOUS\n";
    }
    else
    {
        if (x <= 12 && x > 0)
        {
            cout << "MMYY\n";
        }
        else
        {
            cout << "YYMM\n";
        }
    }
}

int main()
{
    ios_base ::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    testcase();
    return 0;
}

Measured memory_bytes: 3592
#include <cstdio>
#include <queue>
#include <complex>
#include <algorithm>
using namespace std;

#define INF 10e100

typedef complex<double> Point;
typedef pair<double, int> Pair;

struct Circle {
  Point center;
  double radius;
};

struct Edge {
  double len;
  int to;
};

int n;
Point ps[2];
Circle cs[10000];
vector<Edge> es[10003];
priority_queue<Pair, vector<Pair>, greater<Pair> > q;
double mind[10003];

int main() {
  for (int i=0; i<2; i++) {
    double x, y;
    scanf("%lf%lf", &x, &y);
    ps[i] = Point(x, y);
  }

  scanf("%d", &n);
  for (int i=0; i<n; i++) {
    double x, y, r;
    scanf("%lf%lf%lf", &x, &y, &r);
    cs[i] = {Point(x, y), r};
  }

  for (int j=0; j<2; j++) {
    for (int i=0; i<n; i++) {
      struct Edge e;
      e.len = max(abs(cs[i].center-ps[j]) - cs[i].radius, 0.0);
      e.to = i;
      es[n+j].push_back(e);
      e.to = n+j;
      es[i].push_back(e);
    }
  }

  for (int i=0; i<n; i++) {
    for (int j=i+1; j<n; j++) {
      struct Edge e;
      e.len = max(abs(cs[i].center-cs[j].center)-cs[i].radius-cs[j].radius, 0.0);
      e.to = i;
      es[j].push_back(e);
      e.to = j;
      es[i].push_back(e);
      
    }
  }

  struct Edge e;
  e.len = abs(ps[0]-ps[1]);
  e.to = n+1;
  es[n].push_back(e);
  e.to = n;
  es[n+1].push_back(e);

  fill(mind, mind+n+2, INF);
  mind[n] = 0.0; 
  q.push(Pair(mind[n], n));
  while (!q.empty()) {
    Pair p = q.top(); q.pop();
    double c = p.first;
    int v = p.second;

    if (mind[v] < c) continue;
    for (int i=0; i<es[v].size(); i++) {
      Edge &e = es[v][i];
      int u = e.to;
      double l = e.len;
      if (mind[u] > mind[v]+l) {
        mind[u] = mind[v] + l;
        q.push(Pair(mind[u], u));
      }
    }
  }

  printf("%.10f\n", mind[n+1]);
}


Measured memory_bytes: 21140
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,n) for (int i = 0; i < (n); ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF=1LL<<60;
const int inf=(1<<30)-1;
const int mod=1e9+7;
int dx[8]={1,0,-1,0,-1,-1,1,1};
int dy[8]={0,1,0,-1,-1,1,-1,1};
template< typename T >
struct BIT {
  int N; int max_2beki;

  vector< T > data;
  // 初期化 1-indexedでデータを管理する 0で初期化
  BIT(int size){
      N = ++size;
      data.assign(N, 0);
      max_2beki = 1;
      while(max_2beki * 2 <= N) max_2beki *= 2;
  }

  // [0,k](閉区間)の総和 閉区間に注意！
  T sum(int k) {
    if(k < 0) return 0; // k<0のとき0を返す
    T ret = 0;
    for(++k; k > 0; k -= k & -k) ret += data[k];
    return (ret);
  }

  // [l,r](閉区間)の総和
  inline T sum(int l,int r){
    return sum(r) - sum(l-1);
  }

  // 一点取得 更新はできないことに注意
  inline T operator[](int k){
    return sum(k) - sum(k-1);
  }

  // data[k] += x;
  void add(int k, T x) {
    for(++k; k < N; k += k & -k) data[k] += x;
  }

  // imos法 [l,r]にxを加算
  void imos(int l,int r,T x){
    add(l , x); add(r + 1 , -x);
  }

  // lower_bound sum(i)がval以上となる最小のi
  int lower_bound(T w){
    if(w <= 0) return 0;
    int x = 0;
    for(int k = max_2beki; k > 0; k /= 2){
      if(x+k <= N - 1 && data[x + k] < w){
        w -= data[x + k];
        x += k;
      }
    }
    return x;
  }

  // upper_bound sum(i)がvalより大きくなる最小のi
  int upper_bound(T w){
    if(w < 0) return 0;
    int x = 0;
    for(int k = max_2beki; k > 0; k /= 2){
      if(x+k <= N - 1 && data[x + k] <= w){
        w -= data[x + k];
        x += k;
      }
    }
    return x;
  }

};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,k;cin >> n >> k;
    vector<pair<ll,ll>> p(n+1);
    vector<ll> sum(n+1);
    rep(i,n){
        ll a;cin >> a;
        sum[i+1]=sum[i]+a;
    }
    BIT<int> bit(n+1);
    rep(i,n+1){
        p[i]={sum[i]-k*i,i};
    }
    sort(p.begin(),p.end());
    ll ans=0;
    rep(i,n+1){
        ans+=bit.sum(p[i].second);
        bit.add(p[i].second,1);
    }
    cout << ans << endl;
}

Measured memory_bytes: 5760
#include<bits/stdc++.h>
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rept(i,x,y) for(int i=x;i<=y;i++)
#define per(i,x,y) for(int i=y;i>=x;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define pii pair<int,int>
//	ios::sync_with_stdio(false);
//	cin.tie(0);
const int maxx = 2e5+7;
const int maxn = 1e9+7;
typedef long long ll;
using namespace std;
inline int read(){
   int s=0,w=1;
   char ch=getchar();
   while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
   while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
   return s*w;
}
ll t,n,a,b,c,d,k;
int main(){
	cin>>a>>b>>c>>d>>k; 
	if(c<a){
		c+=24;
	}else {
		if(c==a){
			if(b>d)c+=24;
		}
	}
	int op=c*60+d-a*60-b;
	if(op<=k)cout<<0<<endl;
	else cout<<op-k<<endl;
	return 0;
}


Measured memory_bytes: 3584
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
using namespace std;

const int N = 2e5+10;
int a[N];
int n;
int main(){
    cin >> n;
    for(int i=1;i<=n;++i)   cin >> a[i];
    sort(a+1,a+1+n);
    int ok = 0;
    for(int i=1;i<n;++i)    if(a[i] == a[i+1]) ok = 1;
    if(ok)  cout <<"NO\n";
    else cout <<"YES\n";




    return 0;
}

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

int main(){
    int x, y;
    cin >> x >> y;
    rep(i, x)rep(j, x){
        if(x == i + j){
            if(y == i * 4 + j * 2){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3632
#include <algorithm>
#include <array>
#include <cmath>
#include <functional>
#include <iostream>
#include <iomanip>
#include <map>
#include <string>
#include <utility>
#include <vector>

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

using namespace std;

int main() {
  std::cout<<std::fixed<<std::setprecision(10);
  std::string M1, M2, D1, D2;
  cin >> M1 >> D1;
  cin >> M2 >> D2;

  if(M1 == M2)
    cout << 0 << endl;
    else
    cout << 1 << endl;



  return 0;
}


Measured memory_bytes: 256