akhauriyash/Code-Regression huggingface dataset:
x, y = map(int,input().split())
money = 0
def yy(money):
    if y == 1:
        money += 300000
    elif y ==2:
        money += 200000
    elif y==3:
        money += 100000
    else:
        money +=0
    print(money)

if x==1 and y==1:
    print(300000*2+400000)
else:
    if x == 1:
        money += 300000
        yy(money)
    elif x ==2:
        money += 200000
        yy(money)
    elif x ==3:
        money += 100000
        yy(money)
    else:
        money +=0
        yy(money)

Measured memory_bytes: 3064
n , k = map(int,input().split())
ans = 0
if k == 0:
    ans = n**2
else:
    for b in range(k+1,n+1):
        ans += ((n-b+1)//b + 1)*(b-k)
        if k - 1 < n % b < b-1:
            ans += n % b - k + 1
print(ans)

Measured memory_bytes: 38896
#include<bits/stdc++.h>
using namespace std;
int a[105];
int main(){
int n;
cin>>n;
for(int i=1;i<=n;i++){
    cin>>a[i];
}
int MIN=0x3f3f3f3f;
for(int  i=1;i<=n;i++){
        int s1=0,s2=0;
    for(int j=1;j<=n;j++){
        if(j<=i){s1=s1+a[j];}
        else {s2=s2+a[j];}
    }
       if(abs(s1-s2)<MIN)MIN=abs(s1-s2);
}
cout<<MIN<<endl;
return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <tuple>
#include <vector>

using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;

#define INF (1e9)

int N;
vi L;

int count(int from, int to, int floor_target, int ceil_target) {
    // floor_targetより大きい、最初の要素の位置
    int left = upper_bound(L.begin(), L.end(), floor_target) - L.begin();

    if (left <= from) left = from + 1;
    // ceil_targetより小さい、最後の要素の位置
    int right = lower_bound(L.begin(), L.end(), ceil_target) - L.begin() - 1;
    if (to <= right) right = to - 1;
    return max(0, right - left + 1);
}

int main() {
    cin >> N;

    L = vi(N);
    for (int i = 0; i < N; i++) {
        cin >> L[i];
    }
    sort(L.begin(), L.end());

    int ans = 0;
    for (int i = 0; i < N; i++) {
        int a = L[i];
        for (int j = i + 1; j < N; j++) {
            int b = L[j];

            ans += count(j, N, max(a - b, b - a), a + b);
        }
    }

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


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include<vector>
using namespace std;

const int max_idx = 300000;

long long counts[max_idx] = {0};
long long totalCombs[max_idx] = {0};
long long totals_sum = 0;


void solve(long long N, std::vector<long long> A){
    for(int i = 0; i < max_idx; i++) counts[i] = 0;
    for(int i = 0; i < max_idx; i++) totalCombs[i] = 0;

    for(int i = 0; i < A.size(); i++) {
        counts[A[i]]++;
    }
    for(int i = 0; i < max_idx; i++) {
        if(counts[i] == 0) continue;
        totalCombs[i] = counts[i] * (counts[i] -1) / 2;
        totals_sum += totalCombs[i];
    }

    for(int i = 0; i < A.size(); i++) {
        cout << totals_sum + (counts[A[i]] - 1)*(counts[A[i]] - 2) / 2 - totalCombs[A[i]] << endl;
    }
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 8832
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    int cnt = 0;
    for(int i = 0; i < n; i++){
        int a, b;
        cin >> a >> b;
        if(a == b){
            ++cnt;
            if(cnt == 3){
                cout << "Yes\n";
                return 0;
            }
        }
        else{
            cnt = 0;
        }
    }
    cout << "No\n";
    return 0;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
#define ll                  long long
#define dl                 double
#define pb                push_back
#define F                  first
#define S                  second
#define endl              "\n"
#define rep(i,a,b)       for(i=a;i<b;i++)
#define all(v)             v.begin(),v.end()
#define allr(v)            v.rbegin(),v.rend()
#define mod              1000000007
#define CIN(V,s,n)      for(int i=s;i<n;i++){cin >> V[i];}
#define COUT(V,s,n)   {for(int i=s;i<n;i++){cout <<  V[i] << " "  ;} cout << endl;}
#define fast               ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define CLEAR(V);      for(ll i=0;i<V.size();i++) V[i] = 0;
#define N                  100000LL
#define tmod            998244353
using namespace std;

bool sBs(const pair<int,int> &a,const pair<int,int> &b)
{   return (a.second < b.second);   }

ll SUMD(ll n);
ll BS(vector<ll> &PS,ll s,ll e,ll ser);
ll MI(ll a, ll m);
bool P[N + 1];
void Sieve(int n=N);
ll Powb(ll b,ll n);

int main()
{
//fast;
ll q=1;
//cin >> q;
while(q--)
{
    ll n,m,k,i,j,l,r,a,b,c=0,g,counter=0,u,v,d,e,x,w,y;//flag=1;
    //n=m=i=j=l=r=a=t=b=c=u=v=w=p=x=y=0;
    cin >> n >>m;
    priority_queue<ll> Q;
    for(i=0;i<n;i++)
    {
        cin >> x;
        Q.push(x);
    }
    for(i=0;i<m;i++)
    {
        x = Q.top();Q.pop();Q.push(x/2);
    }
    ll ans = 0;
    while(!Q.empty())
    {
        ans += Q.top();Q.pop();
    }
    cout << ans;

}
    return 0;
}

//*****************************************************************************************************************************************

ll Powb(ll b,ll n)
{
    if(n==0) return 1LL;
    if(n==1) return b;
    ll temp = Powb(b,n/2);
    if(n%2==0){return (temp*temp)%mod;}
    else{return (b*((temp*temp)%mod))%mod;}
}

ll SUMD(ll n)
{   ll sum=0;
    while(n>0){sum += n%10;n = n/10;}
    return sum;

}
ll BS(vector<ll> &PS,ll s,ll e,ll ser)
{
    if(s>e)
        return s;
    ll mid = (s+e)/2;
    if(PS[mid]==ser)
    {
        return mid;
    }
    else if(PS[mid] > ser)
    {
        return BS(PS,s,mid-1,ser);
    }
    else
        return BS(PS,mid+1,e,ser);
}
ll MI(ll a, ll m)
{
    ll m0 = m;
    ll y = 0, x = 1;
    if (m == 1)
      return 0;
    while (a > 1)
    {
        ll q = a / m;
        ll t = m;
        m = a % m, a = t;
        t = y;
        y = x - q * y;
        x = t;
    }
    if (x < 0)
       x += m0;
    return x;
}

void Sieve(int n)
{
    memset(P,true,sizeof(P));
    P[0] = false;
    P[1]= false;
    for(ll i=2;i*i<=n;i++)
    {
        if(P[i])
        {
            for(ll j=i*i;j<=n;j+=i)
            {
                P[j]=false;
            }
        }
    }

}


Measured memory_bytes: 1400
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
int a[101];
bool cmp(int a,int b){
    return a>b;
}
int main(){
	int m,n,i;
	cin>>m>>n;
	for(i=1;i<=m;i++)
	  cin>>a[i];
	sort(a+1,a+m+1,cmp);
	
	int sum=0;
	for(i=1;i<=n;i++){
		sum+=a[i];
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 256
from collections import deque
n=int(input())
a=list(map(int,input().split()))
b=deque(maxlen=2*10**5)
if n%2==0:
  for i in range(n):
    if i%2==1:
      b.appendleft(a[i])
    else:
      b.append(a[i])
else:
  for j in range(n):
    if j%2==0:
      b.appendleft(a[j])
    else:
      b.append(a[j])
print(*b)
    

Measured memory_bytes: 25536
# input()
# int(input())
# map(int,input().split())
# list(map(int,input().split()))
# [input() for _ in range(n)]

import collections
import math

n = int(input())

c = collections.Counter()
i=2
nn = n
while nn!=1:
  #print(i)
  if i>math.sqrt(nn):
    c[nn]+=1
    break
  if nn%i==0:
    c[i]+=1
    nn = nn // i
  else:
    i += 1
#print(c)

ans = 0
for i in c.keys():
  j = 1
  while j<=c[i]:
    ans+=1
    c[i]-=j
    j+=1

if n==1:
  ans = 0

print(ans)


Measured memory_bytes: 9476
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
using namespace std;
typedef long long ll;
typedef string str;

int main(){
  str s;
  cin >> s;
  str first, second;
  first += s[0], second += s[1];
  int ans = 0;
  for(int i=1; i<s.length()/2; i++){
    if(first==second) ans = i*2;
    first = first + second[0];
    second = second.substr(1,i)+s[2*i]+s[2*i+1];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <ctime>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(a) a.begin(),a.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;

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

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

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


int main() {
  string s;
  cin >> s;
  int ans = 0;
  int N = s.size();
  rep(i,N) {
    for(int j = 1;j+i<=N; j++) {
      bool f = true;
      string t = s.substr(i,j);
      int st = t.size();
      rep(k,st) {
	if(t[k] == 'A' || t[k] == 'T' || t[k] == 'G' || t[k] == 'C') continue;
	f = false;
      }
      if(f) ans = max(ans,j);
    }
  }
  cout << ans << endl;
  return 0;
}







Measured memory_bytes: 3144
#include<stdio.h>
int main(){
    int x,i,j,k,n,max=0;
    scanf("%d",&x);
    for(i=0;i<=x;i++){
        n=i;
        for(j=0;j<x;j++){
            n*=i;
            if(n>x) break;
            if(max<n) max=n;
        }
    }
    printf("%d\n",max);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int MAX_N = 100005;
ll N;
ll A[MAX_N];

bool ok(int x)
{
	int idx = N-x;
	ll temp = A[idx];
	rep(i,N)
	{
		if (i != idx)
		{
			if (A[i] <= temp * 2)
			{
				temp += A[i];
			}
			else
			{
				return false;
			}
		}
	}
	return true;
}

int main()
{
	cin >> N;
	rep(i,N)
	{
		cin >> A[i];
	}
	sort(A,A+N);
	int l = 1, r = N+1;
	while(l + 1 < r)
	{
		int m = (l+r)/2;
		if (ok(m)) l = m;
		else r = m;
	}
	cout << l << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);i++)
int main(){
	int N;
	int l,r;
	int ans=0;
	cin >> N;
	REP(i,N){
	    cin >> l >> r;
	    ans+=(r-l+1);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
using namespace std;
long long feibo(long long a)
{
	 long long  f;
	 long long f1=2,f2=1;

	if(a==0){
		f=f1;
		return f;
}
   if(a==1){
   	   f=f2;
   	   return f;
   }
   if(a>1){
   	   for(long long j=2;j<=a;j++){
   	   	   f=f1+f2;
   	   	   f1=f2;
   	   	   f2=f;
	   }
	   return f;
   }
}
   int main()
   {
   long long  i,x;
   scanf("%lld",&x);  
   i=feibo(x);
   printf("%0.0lld\n",i);
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(700000)

def s_in():
    return input()

def n_in():
    return int(input())

def l_in():
    return list(map(int, input().split()))
n=n_in()
A=l_in()

res = 1

if 0 in A:
    print(0)
    exit()


for a in A:
    res *= a


    if res > 10**18:
        print(-1)
        exit()
        
print(res)


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

#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 ll long long
static const int MAX = 10000;
static const ll INFTY = 1e12;

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

const ll MRINF = 5000000000000000;

int main() {

  string S;
  cin >> S;
  ll ans = 0;
  REP(i, 4){
    if(S[i]=='+'){
      ans++;
    }else{
      ans--;
    }
  }
  cout << ans << endl;

  
}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/

Measured memory_bytes: 3624
H, W = map(int, input().split())
N = int(input())
a = list(map(int, input().split()))

tmp = []

for i in range(N):
    tmp += [i+1] * a[i]

ans = [[] for _ in range(H)]

for i in range(H):
    if i % 2 == 0:
        ans[i] = tmp[i * W: (i + 1) * W]
    else:
        ans[i] = tmp[(i + 1) * W - 1: i * W - 1: -1]


for i in ans:
    print(' '.join(list(map(str, i))))

Measured memory_bytes: 3572
c,t,d[4010]={1};main(j){for(;t+=(j=getchar())&8?j=0:2;d[c<t?-1:c-t]=!t--)for(j=c+=j%3;j;d[j--]%=998244353)d[j]+=d[j-1];printf("%d",d[c]);}

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

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

int main(){
  int i;
  int n;
  int v[1000];
  float ans=0;
  
  scanf("%d",&n);//nを入手
  
  for(i=0;i<n;i++){
  scanf("%d",&v[i]);//vを入手
  }
  
  qsort(v, n, sizeof(int), compare_int);
  ans=v[0]+v[1];
  
  for(i=2;i<n;i++){
    ans+=pow(2,i-1)*v[i];
  }
  
  ans=ans/pow(2,n-1);
  printf("%f",ans);
      
}

Measured memory_bytes: 128
#include<stdio.h>
int main(void)
{
  int n,s,a[100],max=0,min=1000;
  scanf("%d",&n);
  for(s=0;s<n;s++){
    scanf("%d",&a[s]);
  }
  for(s=0;s<n;s++){
    if(max<a[s])
      max=a[s];
    if(min>a[s])
      min=a[s];
  }
  printf("%d",max-min);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main()
{
  string S;
  int P;
  pair<pair<string, int>, int> p[110];
  int N;
  cin >> N;
  for (int i = 0; i < N; i++)
  {
    cin >> S >> P;
    p[i] = make_pair(make_pair(S, -P), i);
  }
  sort(p, p + N);
  for (int i = 0; i < N; i++)
    printf("%d\n", p[i].second + 1);
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    string s; cin>>s;
    int n=s.size();
    rep(i,n){
        if(i%2){
            if(s[i]=='R'){
                cout<<"No"<<endl;
                return 0;
            }
        }
        else{
            if(s[i]=='L'){
                cout<<"No"<<endl;
                return 0;
            }
        }
    }
    cout<<"Yes"<<endl;
}


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

int main(){
  int n ;
  string x;
  cin >> n;
  
  for(int i = 0; i<n; i++){
    cin >> x;
    if(x == "Y"){
      cout << "Four" << endl;
      break;
    }
    else if(x != "Y" && i == n-1){
      cout << "Three" << endl;
      break;
    }
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long//防止NOIP2018PJT2惨案
using namespace std;
int a,b,x;
signed main()//singed=int
{
    scanf("%lld%lld%lld",&a,&b,&x);
    printf("%lld",!(a%x)?b/x-a/x+1:b/x-a/x);//压行,思路与楼下相同
    return 0;
}

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

using namespace std;

int N, H[10];

void solve() {
	int big=0, small=0;
	for (int i = 0; i < 10; i++) {
		if (big < small) swap(big, small);
		if (H[i] < small) {
			printf("NO\n");
			goto JUMP;
		}

		if (H[i] > big) big = H[i];
		else if (H[i] > small) small = H[i];

	}
	printf("YES\n");
JUMP:
	;
}

int main() {
	cin >> N;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < 10; j++) {
			cin >> H[j];
		}
		solve();
	}

	return 0;
}

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

int a,b,c,ans;

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

	cin >> a >> b >> c;

	ans = a * b / 2;

	cout << ans << endl;

	return 0;

}

Measured memory_bytes: 256
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const char White = '.';
    const char Black = '#';
    const long Mod = 1000000007;

    static void Main(string[] args) {
        checked {
#if DEBUG
            MyDebugger.Test(process, "../TextFile1.txt");
            //TestCaseMaker.MakeTestCase1("../TextFile2.txt");
            //MyDebugger.Test(process, "../TextFile2.txt");
#else
            object ret = process(new StreamReader(Console.OpenStandardInput()));
            Console.WriteLine(ret);
#endif
        }
    }

    static object process(TextReader input) {
        var k = int.Parse(input.ReadLine());

        long x = 7;
        long co = 0;

        while (true) {
            x = x % k;
            if(x == 0) break;
            x =  x * 10 + 7;
            co++;

            if(co >= 1000000){
                return -1;
            }
        }

        return co+1;
    }
}


Measured memory_bytes: 27460
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-8;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;



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

	cin >> N;
	vector<int>v(N);
	vector<int>w(N);
	for (auto &i : v)cin >> i;
	for (auto &i : w)cin >> i;
	vector<int>p(N);
	int a = 0, b = 0;
	for (int i = 0; i < N; i++)p[i] = i + 1;
	int cnt = 0;
	do {
		if (p == v)a = cnt;
		if (p == w)b = cnt;
		cnt++;
	} while (next_permutation(p.begin(), p.end()));
	cout << abs(a - b) << endl;

}


Measured memory_bytes: 3660
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main() {
    int N;
    cin >> N;
    vector<long long int> A(N);
    long long int ans=0;
    long long int mna=1e9+1;
    bool flag=true;
    for(int n=0; n<N; n++) {
        cin >> A[n];
        mna = min(mna, abs(A[n]));
        ans += abs(A[n]);
        if(A[n]<0) {
            flag = flag ? false : true;
        }
    }
    if(flag) {
        cout << ans << endl;
    } else {
        cout << ans-mna*2 << endl;
    }

    return 0;
    
}

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

using ll = long long;
#define REP(i,n) for(int i = 0;i < n;i++)

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

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

    REP(i,5){
        int64_t foo;cin >> foo;
        if(foo == 0){
            cout << i+1 << '\n';
            return 0;
        }
    }
}


Measured memory_bytes: 3604
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<vector<ll> > mat;

int t[100005],x[100005],y[100005];

int main()
{ios_base::sync_with_stdio(false);
int n;
cin>>n;
rep(i,1,n)cin>>t[i]>>x[i]>>y[i];

rep(i,1,n)
{
	int d=t[i]-t[i-1];
	int dd=abs(x[i]-x[i-1])+abs(y[i]-y[i-1]);
	if(dd>d)
	{
		ol("No");
		return 0;
	}
	if(dd%2!=d%2)
	{
		ol("No");
		return 0;
	}
}
ol("Yes");
return 0;
}



Measured memory_bytes: 1408
#include <cstdio>

using namespace std;

const int MAX_N = 105;
const int dy[4] = {0, 1, 0, -1};  // j
const int dx[4] = {-1, 0, 1, 0};  // i

int H, W;
char M[MAX_N][MAX_N];

void dfs(int x, int y, char c) {
  M[x][y] = '.';
  for (int i = 0; i < 4; i++) {
    int nx = x + dx[i], ny = y + dy[i];
    if (0 <= nx && nx < H && 0 <= ny && ny < W && M[nx][ny] == c) {
      dfs(nx, ny, c);
    }
  }
  return;
}
int main() {
  for (;;) {
    scanf("%d %d", &H, &W);
    if (H == 0) break;
    for (int i = 0; i < H; i++) {
      char c;
      for (int j = 0; j < W; j++) {
        do {
          c = getchar();
        } while (c != '#' && c != '*' && c != '@');
        M[i][j] = c;
      }
    }
    int ans = 0;
    for (int i = 0; i < H; i++) {
      for (int j = 0; j < W; j++) {
        if (M[i][j] != '.') {
          ans++;
          dfs(i, j, M[i][j]);
        }
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}


Measured memory_bytes: 3316
#include <iostream>
using namespace std;
#define ll long long

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

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

using namespace std;
typedef long long ll;

#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mp make_pair
#define pb push_back
#define lp(i,s,f) for(ll i = s; i < ll(f); i++)
#define inF freopen("input.in", "r", stdin);
#define outF freopen("output.in", "w", stdout);
#define endl '\n'
#define MOD 1000000007

int main()
{ FAST
    string s; cin >> s;
    int q; cin >> q;
    int f1 = 0;
    vector<char> fron;
    vector<char> bac;
    while(q--){
        int a; cin >> a;
        if(a == 1){
            if(f1 == 0){
                f1 = 1;
            }
            else{
                f1 = 0;
            }
        }
        else{
            int f; cin >> f;
            char c; cin >> c;
            if(f1 == 1){
                if(f == 1){
                    f = 0;
                }
                else{
                    f = 1;
                }
            }
            if(f == 1){
                fron.pb(c);
            }
            else{
                bac.pb(c);
            }
        }
    }
    if(f1){
        reverse(bac.begin(), bac.end());
        for(int i = 0; i < bac.size(); i++){
            cout << bac[i];
        }
        reverse(s.begin(), s.end());
        cout << s;
        for(int i = 0; i < fron.size(); i++){
            cout << fron[i];
        }
        return 0;
    }
    reverse(fron.begin(), fron.end());
    for(int i = 0; i < fron.size(); i++){
        cout << fron[i];
    }
    cout << s;
    for(int i = 0; i < bac.size(); i++){
        cout << bac[i];
    }
    return 0;
}


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

int solve(vector<set<int>> &st, int l, int r) {
	int res = 0;
	rep(i, 26) {
		auto mn = st[i].lower_bound(l);
		auto mx = st[i].upper_bound(r);
		if(mx != mn) res++;
	}
	return res;
}

int main() {
	int n, q;
	string s;
	cin >> n >> s >> q;
	vector<set<int>> st(26);
	rep(i, n) {
		int now = (int) (s[i] - 'a');
		st[now].insert(i);
	}
	rep(Q, q) {
		int type;
		cin >> type;
		if(type == 1) {
			int i;
			char c;
			cin >> i >> c;
			i--;
			s[i] = c;
			rep(j, 26) {
				if(st[j].count(i)) {
					st[j].erase(i);
				}
			}
			int now = (int) (c - 'a');
			st[now].insert(i);
		} else {
			int l, r;
			cin >> l >> r;
			l--; r--;
			printf("%d\n", solve(st, l, r));
		}
	}
	return 0;
}

Measured memory_bytes: 24196
import java.util.*;
public class Main{
	public static void main(String[] args){
	  Scanner sc = new Scanner(System.in);
	  String s = sc.nextLine();
	  String t;
	  if(s.equals("Sunny"))t="Cloudy";
	  else if(s.equals("Cloudy"))t="Rainy";
	  else t="Sunny";
	  System.out.println(t);
	}
}

Measured memory_bytes: 21588
#include <algorithm>
#include <cstring>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
using ll = long long;

int main() {
  int n, m;
  cin >> n >> m;
  int s = n * (n - 1) / 2 + m * (m - 1) / 2;
  cout << s;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

#define MIN(X,Y) ((X)<(Y)?(X):(Y))
#define MAX(X,Y) ((X)>(Y)?(X):(Y))

int main(void){
    int a,b,c,d;
    scanf("%d%d%d%d", &a,&b,&c,&d);
    printf("%d\n",MAX(a*b,c*d));
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <iomanip>
#include <map>
#define rep(i,n) for(int i = 0; i < n; i++)
#define rep1(i,n) for(int i = 1; i <= n; i++)
#define co(x) cout << x <<endl
#define cs(x) cout << x <<" "
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
using namespace std;

int main()
{
	ll N, K;
	cin >> N >> K;
	vector<ll> a(100010, 0);
	rep(i, N)
	{
		ll tmp1, tmp2;
		cin >> tmp1 >> tmp2;
		a[tmp1] += tmp2;
	}

	ll ind = 0;
	for(int i=1;i<=100000;i++)
	{
		K -= a[i];
		ind = i;
		if (K <= 0) break;
		
	}
	co(ind);
	return 0;
}

Measured memory_bytes: 1024
/*
  Contest 072
  A - Sandglass2
  Rakesh Kumar --> 09/09/2020
 */

#include <bits/stdc++.h>

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

    int x = 0, t = 0;
    std::cin >> x >> t;
    if (x > t)
        std::cout << x - t << std::endl;
    else
        std::cout << 0 << std::endl;

    return 0;
}


Measured memory_bytes: 3648
S = input()
targets = ['dream', 'dreamer', 'erase', 'eraser']
while True:
    isEndTarget = False
    for target in targets:
        if S.endswith(target):
            S = S[:-len(target)]
            isEndTarget = True
            break
    if not isEndTarget:
        print('NO')
        break
    elif S == '':
        print('YES')
        break


Measured memory_bytes: 3188
import itertools
n,m,q=map(int,input().split())

ql=[]
for _ in range(q):
    ql.append(tuple(map(int,input().split())))

def check(t):
    ret=0
    for q in ql:
        if t[q[1]-1]-t[q[0]-1]==q[2]:
            ret+=q[3]

    return ret

print(max(map(check,itertools.combinations_with_replacement(range(1,m+1),n))))


Measured memory_bytes: 9196
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 1000000007;
const ld PI = acos(-1);  
const ld EPS = 0.0000000001;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define REP(i, n) for(ll i=0; i<(ll)(n); i++)
#define REPD(i, n) for(ll i=n-1; 0<=i; i--)
#define FOR(i, a, b) for(ll i=a; i<(ll)(b); i++)
#define FORD(i, a, b) for(ll i=a; (ll)(b)<=i; i--)
#define ALL(x) x.begin(), x.end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main(){
    int n;  cin >> n;
    vector<ll> a(n);
    REP(i, n)   cin >> a[i];
    deque<ll> dq;
    REP(i, n){
        ll itr = lower_bound(ALL(dq), a[i]) - dq.begin();
        if(itr==0) dq.push_front(a[i]);
        else dq[itr-1] = a[i];
    }
    cout << dq.size() << endl;
}

Measured memory_bytes: 1792
import itertools

N = int(input())
L = [i for i in range(1, N+1)]
P = list(map(int, input().split()))
Q = list(map(int, input().split()))

if P == Q:
  print(0)
  exit()

cnt = a = b = 0

for v in list(itertools.permutations(L)):
  cnt += 1
  if list(v) == P:
    a = cnt
  elif list(v) == Q:
    b = cnt

print(abs(a-b))

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

int main()
{
    int N;
    cin >> N;
    int a[26];
    int b[26];
    for (int j = 0; j < 26; j++)
    {
        //        b[j] = 0;
        a[j] = 50;
    }

    for (int i = 0; i < N; i++)
    {
        string s;
        cin >> s;
        int ssize = s.size();
        for (int j = 0; j < 26; j++)
        {
            b[j] = 0;
            //            a[j] = 50;
        }
        for (int j = 0; j < ssize; j++)
        {
            for (int k = 0; k < 26; k++)
            {
                char S = k + 'a';
                if (s[j] == S)
                {
                    b[k]++;
                }
            }
        }
        for (int j = 0; j < 26; j++)
        {
            //           cout << "j=" << j << ",b=" << b[j] << endl;
            a[j] = min(a[j], b[j]);
        }
    }
    for (int i = 0; i < 26; i++)
    {
        char c;
        //      cout << a[i] << endl;
        while (a[i] > 0)
        {
            c = i + 'a';
            cout << c;
            a[i]--;
        }
    }
    cout << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int gcd(int a, int b){
    if(a % b == 0){
        return b;
    }
    else{
        return gcd(b, a % b);
    }
}

int main(){
    int k;
    cin >> k;
    int result = 0;
    for(int a = 1; a < k + 1; a++){
        for(int b = 1; b < k + 1; b++){
            for(int c = 1; c < k + 1; c++){
                result += gcd(a, gcd(b, c));
            }
        }
    }
    cout << result << endl;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
#pragma warning(disable:4996)
#ifdef _MSC_VER
#  define __builtin_popcount __builtin_popcountll
#  define __builtin_popcountll __popcnt
#endif
#define int long long
using namespace std;
using ll = long long;
using ld = long double;
const long double PI = acos(-1.0);
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
inline void my_io() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	std::cout << fixed << setprecision(10);
}


bool pairCompare(const pair<int,int>& firstElof, const pair<int,int>& secondElof)
{
	
	return firstElof.second < secondElof.second;
}

signed main() {
	map<char, int>mp;
	for (int i = 0; i < 4; i++) {
		char ch;
		cin >> ch;
		mp[ch]++;
	}
	if (mp.size() != 2) {
		cout << "No" << endl;
		return 0;
	}
	for (auto e : mp) {
		if (e.second != 2) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}


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

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef pair<ll,ll> pll;


const ll inf=10000000000;

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


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

 ll n;
  cin >> n;
  vector<pll> a(n),b(n);
  rep(i,0,n) {
    cin >> a[i].first;
    a[i].second=i;
  }
    rep(i,0,n){
      cin >> b[i].first;
      b[i].second=i;
    }
  
  sort(a.begin(),a.end());
  sort(b.begin(),b.end());
 
  rep(i,0,n) if(a[i].first>b[i].first) {
    cout << "No" << endl;
    return 0;
  }
  rep(i,0,n-1) if(a[i+1].first<=b[i].first) {
    cout << "Yes" << endl; 
    return 0;
  }
  
  
  vll pos(n);
  rep(i,0,n) pos[a[i].second]=b[i].second;
  
  ll x=0,cnt=0;
  do{
    x=pos[x];
    cnt++;
  }while(x!=0);
    
    if(cnt!=n) cout <<"Yes" << endl;
   else cout << "No" << endl;


}


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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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; }



i64 n, a[101];
void solve(){
	cin >> n;
	i64 lcm = 1;
	for(int i = 0; i < n; i++){
		cin >> a[i];
		lcm = lcm/__gcd(a[i],lcm)*a[i];
	}
	
	cout << lcm << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}

Measured memory_bytes: 256
//Love and Freedom.
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#define ll long long
#define inf 20021225
#define N 210
using namespace std;
int read()
{
	int s=0,t=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')	t=-1; ch=getchar();}
	while(ch>='0' && ch<='9')	s=s*10+ch-'0',ch=getchar();
	return s*t;
}
int k;
int f(int x)
{
	if(x%k==0)	return x/k;
	if(x<k)	return 0;
	int v=((x%k-1)/(x/k+1)+1)*(x/k+1);
	return f(x-v);
}
int main()
{
	int n=read(),sg=0;
	for(int i=1;i<=n;i++)
	{
		int x=read(); k=read();
		sg^=f(x);
	}
	puts(sg?"Takahashi":"Aoki");
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
    int N; cin>>N;
    vint t(N+1),x(N+1),y(N+1);
    for(int i=1;i<=N;i++)
        cin>>t[i]>>x[i]>>y[i];

    REP(i,N){
        int dt=t[i+1]-t[i];
        int dx=abs(x[i+1]-x[i]);
        int dy=abs(y[i+1]-y[i]);
        if(dt<dx+dy or dt%2!=(dx+dy)%2){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;

}


Measured memory_bytes: 2560
# -*- coding: utf-8 -*-

loop{ #無限ループをするメソッド
  a, op, b = STDIN.gets.split
  a = a .to_i
  b = b .to_i
  c = c .to_i
  op = op .to_s
  case op
  when '+' 
    c = a + b
    puts c
  when '-' 
    c = a - b
    puts c
  when '*' 
    c = a * b
    puts c
  when '/'  
    c = a/b
    puts c
  when '?'
    break
  end
}

Measured memory_bytes: 8644
#include<bits/stdc++.h>  
using namespace std;  
typedef long long ll;  
int main()  
{  
    int n;  
    cin >> n;  
    ll a, b, pr;  
    ll ans;  
    for(int i = 1;i <= n; i++)  
    {  
        cin >> a >> b;  
        pr = a * b;  
        ll t = sqrt(pr);  
        if(t * (t + 1) < pr)  
            ans = t * 2 - 1;  
        else if(t * t == pr)  
        {  
            if(a == b)  
                ans = (t - 1) * 2;  
            else  
                ans = (t - 1) * 2 - 1;  
        }  
        else  
            ans = (t - 1) * 2;  
        cout << ans << endl;  
    }  
    return 0;  
}  

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
const int MOD=1e9+7;


int main() {
    ios_base::sync_with_stdio(false); 
    
    int n,m,x;
    cin >> n >> m >> x;
    vector<int> c(n);
    vector<vector<int>> a(n,vector<int>(m));
    rep(i,n) {
        cin >> c[i];
        rep(j,m) cin >> a[i][j];
    }
    int ans=1e9;
    rep(bit,(1<<n)) {
        vector<int> r(m);
        int cost=0;
        rep(i,n) {
            if (bit & (1<<i)) {
                rep(j,m) r[j]+=a[i][j];
                cost+=c[i];
            }
        }
        bool flag=1;
        rep(j,m) {
            if (r[j]<x) flag=0;
        }
        if (flag) ans=min(ans,cost);
    }
    if (ans==1e9) ans=-1;
    cout << ans << endl;

    return 0;
}

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

int main() {
    while (true) {
        int n;
        cin >> n;
        if (n == 0) break;

        int ans = n+1;
        double dif = 1<<19;
        rep(i, n) {
            int p;
            double h, w;
            cin >> p >> h >> w;
            double bmi = 10000*w/h/h;
            if (dif >= abs(bmi-22)) {
                if (dif == abs(bmi-22)) ans = min(ans, p);
                else ans = p;
                dif = abs(bmi-22);
            }
        }

        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 3192
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#define PI 3.141592653589793238462643383279


void change(int *x, int *y){
	int z;
	z = *x;
	*x = *y;
	*y = z;
}
int compare_int(const void *a, const void *b){
	return *(int*)a - *(int*)b;
}
int gcd(int a, int b)
{
    int c;
    if (a < b) {
        a+=b; b=a-b; a-=b;
    }
    while (b != 0) {
        c = a % b;
        a = b;
        b = c;
    }
    return a;
}

int main(void){
int n,m;
	scanf("%d %d", &n, &m );
        if(n==1) printf("%d", m);
	else{for(int i=m/2+1;i>0;i--){
		if(m%i==0){
			if(m/i>=n){
				printf("%d",i);
				break;
			}
		}
	}}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <climits>
#include <numeric>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
int Max(int(a), int(b), int(c)) {
	return max(max(a, b), c);
}
int Min(int(a), int(b), int(c)) {
	return min(min(a, b), c);
}


int main() {

	ll N, K;
	cin >> N >> K;
	vector<ll> A(N);
	vector<ll> B(N);
	for (ll i = 0; i < N; i++) {
		cin >> A.at(i);
		B.at(i) = -1;
	}
	ll j = 1, i = 1, k = 1;
	B.at(0) = 0;
	while (1) {
		i = A.at(i - 1);
		if (B.at(i-1) > -1) {
			k = k - B.at(i-1);
			break;
		}
		else {
			B.at(i-1) = k;

			k++;
		}

	}
	
	if (K > B.at(i - 1)) {
		K = (K - B.at(i - 1)) % k;
		
	}
	else {
		i = 1;
	}
	
	rep(p, K) {
		i = A.at(i - 1);
	}
	cout << i << endl;
	


}


Measured memory_bytes: 6428
#include  <stdio.h>

int main(void)
{		
  int n,i,j,temp,x[100],count=0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&x[i]);
  }
  for (i=0;i<n;i++) {
    for (j=n-1;j>=i+1;j--) {
      if (x[j-1]>x[j]){ 
	temp=x[j];      
	x[j]=x[j-1];
	x[j-1]=temp;
	count++;
      }
    }	
  }
  for(i=0;i<n;i++){
    if(i==n-1)
      printf("%d\n",x[i]);
    else
      printf("%d ",x[i]);
  }
  printf("%d\n",count);
  return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long int ll;
bool isprime(int n){

	for(int i=2; i<=(int)sqrt(n); i++) {
		if(n%i==0) {
			return false;
		}
	}
	return true;
}
int main()
{

	ios_base:: sync_with_stdio(false); cin.tie(0);
	int n; cin>>n;
	while(!isprime(n)) {
		n++;
	}
	cout<<n<<endl;



	return 0;
}


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

int main(void){
    
   string s,a="",b="";
   int l=0,r=0;
   cin >> s;

   a = s[0];
   a += s[1];
   b = s[2];
   b += s[3];
   
   l = stoi(a);
   r = stoi(b);
   
   if(l > 12){
     if(r <= 12 && r!= 0) cout << "YYMM" << endl;
     else cout << "NA" << endl;
   }
   else if(l == 0){
       if(r == 0) cout << "NA" << endl;
       else if(r <= 12) cout << "YYMM" << endl;
       else cout << "NA" << endl;
   }
   else{
       if(r == 0)  cout << "MMYY" << endl;
       else if(r <= 12) cout << "AMBIGUOUS" << endl;
       else cout << "MMYY" << endl;
   }
}

Measured memory_bytes: 3616
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, a, output int
	fmt.Scanf("%d", &n)
	var tmp []int
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &a)
		tmp = append(tmp, a)
	}
	sort.Sort(sort.IntSlice(tmp))
	output = 1
	for i := 1; i < n; i++ {
		if tmp[i] > tmp[i-1] {
			output++
		}
	}
	fmt.Println(output)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
map<long long, long long> m;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    long long n; cin >> n;
    auto f = [&](auto f, long long n) -> long long {
        if (n == 1) return 2;
        if (n == 0) return 1;
        if (m.count(n)) return m[n];
        long long x = f(f, n/2);
        long long y = f(f, n/2-1);
        if (n & 1) return m[n] = (2 * x + y) % mod;
        return m[n] = (x + 2 * y) % mod;
    };
    cout << f(f, n) << "\n";
    return 0;
}

Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,M,*A = map(int,read().split())

MOD = 10**9 + 7

dp = [0] * (N+10)
dp[0] = 1
is_broken = [False] * (N+1)

for x in A:
    is_broken[x] = True

for n in range(1,N+1):
    if is_broken[n]:
        continue
    x = dp[n-1] + dp[n-2]
    if x >= MOD:
        x -= MOD
    dp[n] = x

answer = dp[N]
print(answer)

Measured memory_bytes: 11620
A = int(input())
B = int(input())
C = int(input())
X = int(input())

b = 0

for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if 500*i + 100*j + 50*k == X:
                b += 1
            else:
                continue

print(b)


Measured memory_bytes: 3060
n, m, x, y = map(int, input().split())
xx = max(list(map(int, input().split())))
yy = min(list(map(int, input().split())))
for i in range(xx + 1, yy + 1):
    if x < i <= y:
        print("No War")
        exit()
print("War")


Measured memory_bytes: 3060
#include <malloc.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

//ABC171D
int main(void) {
  long long n, k, q, i, cou=0, tmp, map[100001];
  scanf(" %lld", &n);
  long long a[n];
  for(i=0; i<n; i++){
    scanf(" %lld", &a[i]);
  }
  scanf(" %lld", &q);
  long long b[q], c[q];
  for(i=0; i<q; i++){
    scanf(" %lld %lld", &b[i], &c[i]);
  }

  for(i=0; i<100001; i++)
    map[i]=0;
  for(i=0; i<n; i++)
    map[a[i]]++, cou+=a[i];

  for(i=0; i<q; i++){
    cou=cou+(c[i]-b[i])*map[b[i]];
    map[c[i]]+=map[b[i]];
    map[b[i]]=0;
    printf("%lld\n", cou);

    //for(k=0; k<10; k++)printf("%lld ", map[k]);
    //printf("\n");
  }

}

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

signed main(){
	int A, B, C, D;
	scanf("%d%d%d%d", &A, &B, &C, &D);
	while(1){
		C -= B;
		if(C <= 0){
			printf("Yes\n");
			return 0;
		}
		A -= D;
		if(A <= 0){
			printf("No\n");
			return 0;
		}
	}
}

Measured memory_bytes: 3760
using System;

namespace AtCoder.BeginnersSelections
{
    class Test
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            double a = int.Parse(str[0]);
            double b = int.Parse(str[1]);

            int ans = (int)((a + b) / 2 + 0.9);

            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 11092
(defparameter a (make-hash-table))
(let ((n (read))
    (ans 0))
    
    (dotimes (i n)
        (let ((s (read)))
            (if (eq Nil (gethash s a))
                (setf (gethash s a) 1)
                (incf (gethash s a))
            )
        )
    )
    (maphash #'(lambda (key value)
            (if (not (= key value))
                (if (< key value)
                    (incf ans (- value key))
                    (incf ans value)
                )
            )
        )
    a)

    (princ ans)
)

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

int main() {
	int N;
  	cin >> N;
  
  	if(N >= 64) {
      cout << 64 << endl;
    }else if(N >= 32 && N < 64) {
      cout << 32 << endl;
    }else if(N >= 16 && N < 32) {
      cout << 16 << endl;
    }else if(N >= 8 && N < 16) {
      cout << 8 << endl;
    }else if(N >= 4 && N < 8) {
      cout << 4 << endl;
    }else if(N == 2 || N == 3) {
      cout << 2 << endl;
    }else {
      cout << 1 << endl;
    }
  	
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define IFOR(i, m, n) for(int i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
const ll INF = 1e18;
/* テンプレートここまで */

int main() {
  ll n; cin >> n;
  ll a[n+1];
  ll ans = 0;
  REP(i, n){
    cin >> a[i];
    ans += i%2 == 0 ? a[i] : -a[i];
  }
  a[n] = a[0];

  REP(i, n){
    cout << ans;
    if(i==n-1) cout << endl;
    else cout << " ";
    ans = 2*a[i]-ans;
  }
}

Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
#define int long long int
signed main(){
  int n;cin>>n;
  int k=0;
  n-=400;
  if(n<200)k=8;
  else if(n<400)k=7;
  else if(n<600)k=6;
  else if(n<800)k=5;
  else if(n<1000)k=4;
  else if(n<1200)k=3;
  else if(n<1400)k=2;
  else if(n<1600)k=1;
  cout<<k;
}

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

#define ll long long 
#define inf 0x3f3f3f3f
#define infll 0x3f3f3f3f3f3f3f3f
#define all(x) (x).begin (),(x).end()
#define f(i, a, b) for (int i=a; i<(signed)(b); ++i)
#define pc __builtin_popcount // counts number of 1's in bin(num)
#define pb push_back

const double pi = 2*acos(0.0);
//__gcd(n1, n2);
//cout << fixed;
//cout << setprecision(6); //fixes # of dp
//tgamma(i+1) is 1!


void solve(){
    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;
}

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

    solve();
}








Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0; i<(n); ++i)
#define REPR(i,n,m) for (int i=(n); i>=(m); --i)
using namespace std;
using LL = long long;
using LD = long double;
using PLL = pair<long long, long long>;
using PLD = pair<long double, long double>;
using VLL = vector<long long>;
using VLD = vector<long double>;
using VPLD = vector<PLD>;

const int INF = numeric_limits<int>::max();

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

    int a; cin >> a;
    cout << a+a*a+a*a*a << endl;

    return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int MAXN = 2e5 + 4;
int n;
int A[MAXN] , B[MAXN];
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;i++)scanf("%d%d",&A[i],&B[i]);
    sort(A+1,A+n+1);
    sort(B+1,B+n+1);
    if(n&1){
        printf("%lld\n",1LL + B[(n+1)/2] - A[(n+1)/2]);
    }
    else{
        int p = n/2;
        printf("%lld\n",1LL + B[p+1] - A[p+1] + B[p] - A[p]);
    }
    return 0;
}


Measured memory_bytes: 5348