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

int main() {
    int n;
    while (cin >> n, n) {
        vector<string> w(n);
        rep(i,n) cin >> w[i];

        int start = 0;
        while (start++ < n) {
            int cnt = 0, f = 1;
            vector<int> lens(5, 0);
            for (int j = start-1; j < n; ++j) {
                lens[cnt] += w[j].length();
                switch (cnt) {
                    case 0:
                    case 2: if (lens[cnt] == 5) { cnt++; } else if (lens[cnt] > 5) { f = 0; j = n+1; } break;
                    case 4: if (lens[cnt] == 7) { j = n+1; } else if (lens[cnt] > 7) { f = 0; j = n+1; } break;
                    default: if (lens[cnt] == 7) { cnt++; } else if (lens[cnt] > 7) { f = 0; j = n+1; } break;
                }
            }
            if (f) {
                cout << start << endl;
                break;
            }
        }
    }
}

Measured memory_bytes: 3152
// INCLUDES
#include <bits/stdc++.h>
#include<assert.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
//DEFINES
#define MAX 1000001
#define pii pair<int, int>
#define c1 __builtin_popcount
#define F first
#define S second
#define all(s) begin(s),end(s)
#define MIN3POS(a, b, c) (a) =< (b) ? ((a) =< (c) ? 1 : 3) : ((b) =< (c) ? 2 : 3)
#define MAX3POS(a,b,c) (a) >= (b) ? ((a) >= (c) ? 1 : 3) : ((b) >= (c) ? 2:3)
#define endl '\n'
#define int long long
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define FOR(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define IOS   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//NAMESPACES
using namespace __gnu_pbds; 
using namespace std;
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#ifdef XOX
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif
template <typename T> 
ostream& operator<<(ostream& os, const vector<T>& v) 
{ 
    os << "["; 
    for (int i = 0; i < v.size(); ++i) { 
        cout << v[i]; 
        if (i != v.size() - 1) 
            os << ", "; 
    } 
    os << "]"; 
    return os; 
} 
template <typename T> 
ostream& operator<<(ostream& os, const set<T>& v) 
{ 
    os << "["; 
    for (auto it : v) { 
        os << it; 
        if (it != *v.rbegin()) 
            os << ", "; 
    } 
    os << "]"; 
    return os; 
} 
  template <typename T, typename S> 
ostream& operator<<(ostream& os, const map<T, S>& v) 
{ 
    for (auto it : v)  
        cout << it.first << " : " 
           << it.second << "\n"; 
      
    return os; 
} 
template <typename T, typename S> 
ostream& operator<<(ostream& os, const pair<T, S>& v) 
{ 
    os << "("; 
    cout << v.first << ", " 
       << v.second << ")"; 
    return os; 
} 
  
// D

void solve(){
int n,k;
cin>>n>>k;
vector<int> v(n);
FOR(i,0,n) cin>>v[i];
sort(all(v));
int sum = 0;
FOR(i,0,k) sum+=v[i];
cout<<sum;
}
int32_t main()
{
IOS
int t=1;
// cin>>t;
while(t--) {
    solve();
}

return 0;
}
// Use emplace back in place of pushback
// Use tie function , for object destructuring

Measured memory_bytes: 3660
#include<bits/stdc++.h>
using namespace std;
const int maxn = 25;
char str[maxn][maxn];
int vis[maxn][maxn];
struct node {                        
    int x,y,step;
} dot[maxn];
int dir[][2] = {{1,0},{-1,0},{0,1},{0,-1}};  
int n,m;
int ans = 0,res = 0;                                
int main(void) {
    int BFS(int start_x,int start_y);
    scanf("%d%d",&n,&m);
    for(int i = 1; i <= n; i ++) {
        for(int j = 0; j <= m; j ++) {
            scanf("%c",&str[i][j]);
        }
    }
    ans = 0;
    for(int i = 1; i <= n; i ++) {
        for(int j = 1; j <= m; j ++) {
            if(str[i][j] == '#') continue;
            res = BFS(i,j);
            ans = max(ans,res);
        }
    }
    cout << ans << endl;
    return 0;
}

bool Check(int x,int y) {
    if(x < 1 || y < 1 || x > n || y > m) return false;
    if(vis[x][y] || str[x][y] == '#') return false;
    if(str[x][y] == '.') return true;
}

int BFS(int start_x,int start_y) {
    memset(vis,0,sizeof(vis));
    int count = 0;                                               
    queue<node>queues;
    while(!queues.empty()) queues.pop();
    node first,second;
    first.x = start_x,first.y = start_y,first.step = 0;
    queues.push(first);
    vis[start_x][start_y] = 1;
    while(!queues.empty()) {
        first = queues.front();
        queues.pop();
        count = max(count,first.step); 
        for(int i = 0; i < 4; i ++) {
            second.x = first.x + dir[i][0];
            second.y = first.y + dir[i][1];
            if(!Check(second.x,second.y)) continue;
            second.step = first.step + 1;
            queues.push(second);
            vis[second.x][second.y] = 1;
        }
    }
    return count;
}

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

int main(){
    int a , b;    
    cin >> a >> b;
    if(a == b){
    cout << "a == b"<< endl;
    }
    if(a < b){
    cout << "a < b"<< endl;
    }
    if(a > b){
    cout << "a > b" << endl;
    }
 return 0;
}

Measured memory_bytes: 1156
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<vector>
#include<cmath>
#define pb push_back
#define ll long long
#define inf 0x3f3f3f3f
#define fill(a,b) memset(a,b,sizeof(a))
#define cpy(a,b) memcpy(a,b,sizeof(b))
template<typename T> inline bool MIN(T &a,const T &b) {return a>b? a=b,1:0;}
template<typename T> inline bool MAX(T &a,const T &b) {return a<b? a=b,1:0;}
#define mod 1000000007
inline int plu(int a,int b) {return a+b>=mod? a+b-mod:a+b;}
inline int sub(int a,int b) {return a-b<0? a-b+mod:a-b;}
inline int mul(int a,int b) {return (ll)a*b%mod;}
inline int inc(int &a,int b) {a+=b;if (a>=mod) a-=mod;}
inline int dec(int &a,int b) {a-=b;if (a<0) a+=mod;}
#define mp make_pair
#define SZ(a) ((int)a.size())
#define BK(a) (a[SZ(a)-1])
#define fi first
#define se second
#define N 100010
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pii;

int n,A[N];

vi q;

int main()
{

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

    }
    sort(A+1,A+n+1);
    for (int i=1,j=1;i<=n;i=j) {

        for (;j<=n&&A[i]==A[j];++j);

        if (j-i>1) q.pb(A[i]);
        if (j-i>3) q.pb(A[i]);
    }
    sort(q.begin(),q.end());
    if (SZ(q)>1) printf("%lld\n",(ll)q[SZ(q)-1]*q[SZ(q)-2]);
    else printf("0\n");
    return 0;
}


Measured memory_bytes: 1024
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
# def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  s=list(S())[::-1]
  n=len(s)
  dp=[[0]*13 for _ in range(n+1)]

  dp[0][0]=1
  mul=1
  for i in range(n):
    for j in range(13):
      if s[i]=='?':
        for k in range(10):
          dp[i+1][(j+k*mul)%13]+=dp[i][j]
          dp[i+1][(j+k*mul)%13]%=mod
      else:
        dp[i+1][(j+int(s[i])*mul)%13]+=dp[i][j]
        dp[i+1][(j+int(s[i])*mul)%13]%=mod
    mul*=10
    mul%=13

  return dp[n][5]%mod

# main()
print(main())


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

int main(){
    int n, a, b;
    cin >> n;
    vector<int> cnt(200030, 0);
    for(int i = 0; i < n; i++){
        cin >> a >> b;
        cnt[a+b]++;
    }
    for(int i = 0; i < 200020; i++){
        cnt[i+1] += cnt[i]/2;
        if(cnt[i]%2)    cout << i << " " << 0 << endl;
    }
    return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 200005;
vector<int> adjlist[N];
struct ii{
    int x,y;
    ii (){}
    ii (int _x, int _y): x(_x),y(_y){
    }
    bool operator<(const ii &b)const{
        return ((ll)x*b.y < (ll)b.x*y);
    }
    ii operator+(const ii &b){
        return ii(x+b.x,y+b.y);
    }
    bool operator!=(const ii &b) const{
        return (b.x!=x)||(b.y!=y);
    }
};
ii sz[N];
int p[N];
int s[N];
int rt[N];
long long ans = 0;
priority_queue<pair<ii,int> > pq;

int find(int x){
    return x == rt[x] ? x : rt[x] = find(rt[x]);
}
void merge(int x, int y){
    x = find(x);
    ans += (ll)sz[x].y*sz[y].x;
    sz[x] = sz[x]+sz[y];
    pq.push(make_pair(sz[x],x));
    rt[y] = x;
}
int main(){
    int n;
    scanf("%d",&n);
    p[1] = 1;
    iota(rt,rt+N,0);
    for (int i = 2; i <= n; i++){
        scanf("%d",&p[i]);
    }
    for (int i = 1; i <= n; i++){
        scanf("%d",&s[i]);
        if (s[i] == 0) sz[i] = {1,0};
        if (s[i] == 1) sz[i] = {0,1};
        if (i != 1) pq.push({sz[i],i});
    }
    while (pq.size()){
        while (pq.size() && sz[pq.top().second] != pq.top().first){
            //printf("remove %d %d %d\n",pq.top().first.x,pq.top().first.y,pq.top().second);
            pq.pop();
        }
        if (pq.empty()) break;
        auto k = pq.top(); pq.pop();
        //printf("processing %d %d %d\n",k.first.x,k.first.y,k.second);
        if (k.second == 1) continue;
        merge(p[k.second],k.second);
    }
    printf("%lld ",ans);

}


Measured memory_bytes: 13300
import java.io.PrintWriter;
import java.util.*;

public class Main {


    static Scanner sc;
    static PrintWriter out;

    public static void main(String[] args) {
        sc = new Scanner(System.in);
        out = new PrintWriter(System.out);
        new Main().solve();
        out.flush();
    }

    public void solve() {
        int n = sc.nextInt();
        out.println(1-n);
    }

}


Measured memory_bytes: 35816
#include <bits/stdc++.h>
using namespace std;
#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define _rep(i,n) _repl(i,0,n)
#define rep(...) GET_MACRO(__VA_ARGS__, _repl, _rep)(__VA_ARGS__)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cout<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cout<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream &o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream &o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define MOD 1000000007

typedef vector<vector<long>> mat;

// return A*B
mat mat_mul(const mat &A, const mat &B){
  int n=A.size(), m=B[0].size(), l=B.size();
  mat ret(n, vector<long>(m, 0));
  rep(i,n) rep(k,l) if(A[i][k]!=0) rep(j,m){
    (ret[i][j] += A[i][k] * B[k][j]) %= MOD;
  }
  return ret;
}

// A^p
mat mat_pow(const mat &A, long p){
  int n = A.size();
  mat tmp(A), ret(n, vector<long>(n,0));
  rep(i,n) ret[i][i] = 1;
  while(p>0){
    if(p&1) ret = mat_mul(tmp, ret);
    tmp = mat_mul(tmp, tmp);
    p /= 2;
  }
  return ret;
}

int main(){
  int n,k,c,T;
  cin>>n>>k>>c>>T;
  c--;

  vector<int> a(k), b(k), t(k);
  rep(i,k) cin>>a[i]>>b[i]>>t[i];
  rep(i,k) a[i]--;

  int sz = 5*n;

  mat A(sz, vector<long>(sz, 0));
  rep(i,n,sz){
    A[i-n][i] += 1;
  }

  rep(i,k){
    rep(j,n){
      int to = (t[i]-1)*n + j;
      if(j < a[i]) to += b[i];
      else if(j < a[i]+b[i]) to -= a[i];
      A[to][j] += 1;
    }
  }

  A = mat_pow(A, T);

  cout << A[0][c] << endl;

  return 0;
}

Measured memory_bytes: 4196
#include <bits/stdc++.h>
	  #define endl "\n"
	  #define ll long long int
	  #define mod 1000000007
	  #define inf 1000000000000000001;
	  using namespace std;
	  int main()
	  {
	    //  #ifndef ONLINE_JUDGE
	    //  // for getting input from input.txt
	    //  freopen("input.txt", "r", stdin);
	    //  // for writing output to output.txt
	    //  freopen("output.txt", "w", stdout);
	    // #endif
	    std::ios::sync_with_stdio(false);
	    cin.tie(NULL);
	    int n,p=0;
	    cin>>n;
	    vector<int> v(n+1,0);
	    for (int i = 1; i <= n; ++i)
	    {
	    	cin>>v[i];
	    }
	    for (int i = 1; i <= n; ++i)
	    {
	    	/* code */
	    	if(v[i]%2 != 0 && i%2 != 0 ) 
	    		p++;
	    }
	    cout<<p<<endl;
	    return 0;
	  }


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

#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define mod 998244353
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0);
#define INF LONG_MAX
#define PI 3.1415926535897932384626
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define rep(x,j,n)for(ll x=j;x<n;x++)
#define repr(x,j,n)for(ll x=j;x>n;x--)
typedef vector<pair<ll,ll>> vpi;
typedef vector<ll> vi;
typedef vector<vi> vvi;
const int N=2e6+7;
ll modexp(ll a,ll b,ll m)
{
    ll r=1;
    a=a%m;
    while(b>0)
    {
    if(b&1)
    r=(r*a)%m;
    b=b/2;
    a=(a*a)%m;
    }
    return r%m;
}

int main()
{
 ios::sync_with_stdio(0);
    cin.tie(0);
ll k;
cin>>k;
ll s=0;
rep(i,1,k+1)
{
    rep(b,1,k+1)
    {
        rep(c,1,k+1)
        {
            s+=__gcd(i,__gcd(b,c));
        }
    }
}

cout<<s;
}



Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n,i;
    scanf("%lld",&n);
    long long int ar[n+9],val[n+9]={0};
    for(i=1;i<=n;i++)
    {
        scanf("%lld",&ar[i]);
    }
    val[1]=0;
    val[2]=abs(ar[2]-ar[1]);
    for(i=3;i<=n;i++)
    {
        val[i]=min(abs(ar[i]-ar[i-1])+val[i-1],abs(ar[i]-ar[i-2])+val[i-2]);
    }
    printf("%lld\n",val[n]);
}


Measured memory_bytes: 1792
<?php
$input = fgets(STDIN);
$multi = array_map('intval', explode(' ',fgets(STDIN)));
$sum = true;
for ($i = 0; $i < $input; $i++) {
    (int)$sum *= $multi[$i];
}
$limit = pow(10,18); 
if($sum>$limit) {
    echo -1;
} else {
    echo (int)$sum;
}

Measured memory_bytes: 28568
package main

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

func main() {
	fmt.Println(ReadInt() + ReadInt()/2)
}

var sc = bufio.NewScanner(os.Stdin)

func init()        { sc.Buffer(make([]byte, 256), 1e9); sc.Split(bufio.ScanWords) }
func Read() string { sc.Scan(); return sc.Text() }

func ReadInt() int {
	v, e := strconv.Atoi(Read())
	if e != nil {
		panic(e.Error())
	}
	return v
}


Measured memory_bytes: 1772
#include<iostream>
using namespace std;
typedef long long ll;

const int N = 1e5+10;

ll a[N],b[N];

int main()
{
	ll n;
	cin >> n;
	
	ll sum = 0;
	
	for (ll i = 0; i < n+1 ; i ++ ) cin >> a[i];
	
	for (ll i = 0; i < n; i ++ ) cin >> b[i];
	
	for (ll i = 0; i < n; i ++ )
	{
		if(a[i] < b[i])
		{
			sum += a[i];
			ll t = b[i] - a[i];//剩下的数量 
			
			if(t >= a[i+1])
			{
				sum += a[i+1];
				a[i+1] = 0;
			}
			else
			{
				sum += t;
				a[i+1] -= t;
			}
		}
		else//a[i] >= b[i]
		{
			a[i] -= b[i];
			sum += b[i];
		}
	}
	
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 1792
n = gets.to_i
a = gets.chomp.split.map(&:to_i)
mod = 10**18
sum = 1
a.sort!
if a[0] == 0 then
    puts "0"
    exit
end
a.each{|item|
    sum = sum*item
    if sum > mod then
        puts "-1"
        exit
    end
}
puts sum


Measured memory_bytes: 24272
#include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <functional>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <bitset>
#define pb push_back
#define YES cout<<"YES"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define No cout<<"No"<<endl
#define INF (1<<10)
#define LLINF (1LL<<60)
#define MOD 1000000007
typedef long long ll;
using namespace std;

int main(){
  int n, p;
  string s;
  ll ans=0;
  cin>>n>>p>>s;

  if(p==2){
    for(int r=n-1;r>=0;r--){
      if((s[r]-'0')%2==0)ans+=r+1;
    }
  }
  else if(p==5){
    for(int r=n-1;r>=0;r--){
      if((s[r]-'0')%5==0)ans+=r+1;
    }
  }
  else{
    int ten=1;
    int num[200005]={}, count[10005]={};
    for(int i=n-1;i>=0;i--){
      num[i]=((s[i]-'0')*ten+num[i+1])%p;
      count[num[i]]++;
      ten*=10;
      ten%=p;
    }
    for(int r=n-1;r>=0;r--){
      if(r==n-1)ans+=count[0];
      else{
        int t=num[r+1];
        count[t]--;
        ans+=count[t];
      }
    }
  }

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


Measured memory_bytes: 1412
#include<bits/stdc++.h>
  using namespace std;
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define ll  long long
  #define ld long double
  #define pb push_back
  #define mp3 make_pair
  #define rep1(i,a,b) for(ll i=a;i<=b;i++)
  #define rep2(i,a,b) for(ll i=a;i<b;i++)
  const ll  mod=998244353;
  template<typename T> T pow(T a,T b, long long m){T ans=1; while(b>0){ if(b%2==1) ans=(ans*a)%m; b/=2; a=(a*a)%m; } return ans%m; }
  template<typename T> T add(T a,T b,ll m){a+=b;while(a>=0)a-=m;while(a<0)a+=m; return a;}
  template<typename T> T mul(T a,T b,ll m){return (a*1ll*b)%m;}

 int main(){
   IOS;
  ll n;
  cin>>n;
  ll a[n];
  for(ll i=0;i<n;i++)
  cin>>a[i];
  ll x=0,ans=0;
  for(ll i=1;i<n;i++){
      if(a[i]<a[i-1]){
        x=a[i-1]-a[i];
        a[i]+=x;
        ans+=x;
      }
  }
  cout<<ans<<endl;
 }

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


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

struct edge {int to; ll cost; };

int dx[] = {-1, 1, 0,  0};
int dy[] = { 0, 0, 1, -1};
 
int main(){
  int n;
  cin >> n;
   vector<int> p(n), q(n), v(n);
  for(int i=0; i<n; i++) v[i] = i+1;
  for(int i=0; i<n; i++) cin >> p[i];
  for(int i=0; i<n; i++) cin >> q[i];
  int i=1;
  int a, b;
  do{
    bool tp=true, tq=true;
    for(int j=0; j<n; j++){
      if(v[j]!=p[j]) tp = false;
    }
    for(int j=0; j<n; j++){
      if(v[j]!=q[j]) tq = false;
    }
    if(tp) a = i;
    if(tq) b = i;
    i++;
  }while(next_permutation(v.begin(), v.end()));
  int ans = abs(a-b);
  cout << ans << endl;
  return 0;
}


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

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

    int S;
    cin >> S;

    bool ym = true;
    bool my = true;

    int l = S % 100;
    int h = S / 100;

    if (0 == l || l > 12) ym = false;
    if (0 == h || h > 12) my = false;

    if (ym && my)  cout << "AMBIGUOUS" << endl;
    else if (~ym && my) cout << "MMYY" << endl;
    else if (ym && ~my) cout << "YYMM" << endl;
    else cout << "NA" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>

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

#if DEBUG_ON
    freopen("input", "r", stdin);
#endif

    int n, m, arr[4] = {-1, -1, -1, -1};
    std::cin >> n >> m;
    bool good = true;
    for (int i = 0; i < m; ++i) {
        int pos, val;
        std::cin >> pos >> val;
        if (arr[pos] != -1 && arr[pos] != val) {
            good = false;
            break;
        }
        arr[pos] = val;
    }
    if (arr[1] == 0 && n > 1) {
        good = false;
    } else if (arr[1] == -1 && n == 1) {
        arr[1] = 0;
    } else if (arr[1] == -1) {
        arr[1] = 1;
    }
    if (arr[2] == -1) arr[2] = 0;
    if (arr[3] == -1) arr[3] = 0;
    if (good) {
        for (int i = 1; i <= n; ++i) {
            std::cout << arr[i];
        }
        std::cout << '\n';
    } else {
        std::cout << "-1\n";
    }
    return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
b = []
for i in range(n):
    if a[i] % 2 == 0:
        b.append(a[i])
for i in range(len(b)):
    if b[i] % 3 !=0 and b[i] % 5 != 0:
        print("DENIED")
        exit()
print("APPROVED")

Measured memory_bytes: 3060
#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)
#define _ << " " <<

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

const int mod = 1e9 + 7, MAXN = 3005;

int add(int x, int y) {
  x += y;
  if(x >= mod) return x - mod;
  return x;
}
int mul(int x, int y) {
  return (ll) x * y % mod;
}

int N, R;
int dp[MAXN][MAXN][2];

int f(int n, int r, int flag) {
  if(dp[n][r][flag] != -1)
    return dp[n][r][flag];

  if(r > R || r < 0)
    return 0;

  if(r == 0)
    flag = 1;

  if(n == 0 && flag)
    return 1;
  else if(n == 0)
    return 0;

  int ret = 0;
  ret = add(ret, f(n - 1, r + 1, flag));
  ret = add(ret, f(n - 1, r - 1, flag));
  ret = add(ret, f(n - 1, r, (r == 1 ? 1 : flag)));

  if(r != 0 && r != R)
    ret = add(ret, f(n - 1, r, flag));

  return dp[n][r][flag] = ret;
}

int main() {

  memset(dp, -1, sizeof dp);

  cin >> R >> N;

  int sol = 0;
  REP(i, R + 1) {
    sol = add(sol, f(N, i, 0));
  }

  cout << sol;
}


Measured memory_bytes: 70912
# pragma GCC optimize("O3")
# include <bits/stdc++.h>
# define maxn 100005
# define ll long long
# define clock (clock() * 1000.0 / CLOCKS_PER_SEC)
# define rc(s) return cout << s,0
# define _ ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
# define db(x) cerr << #x << " = " << x << '\n'
# define pb push_back
# define mp make_pair
# define sz(x) (int)((x).size())
//# define int ll
using namespace std;

int n,x,mx,a[1 << 21];

int32_t main(){_
    //freopen("input","r",stdin);
	cin >> n;
	for(int i = 1;i <= n;i++)
	{
		cin >> a[i];
	}
	int i = 1;
	while(i <= n)
	{
		x = 0;
		while(i <= n && i == a[i])
		{
			i++;
			x++;
		}
		mx += (x + 1) / 2;
		i++;
	}
	rc(mx);
}


Measured memory_bytes: 640
#include <iostream>
#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;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)




int main() {

	int N;
	cin >> N;
	long long s = 0;
	rep(i, N) {
		if ((i+1) % 3 != 0 && (i+1) % 5 != 0) {
			s += i+1;
		}
	}
		cout << s << endl;
	


}


Measured memory_bytes: 3636
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
s=[0]*(n+1)

for i in range(n):
    s[i+1]=s[i]+a[i]
c=Counter(s)
ans=0
for b in c.items():
    k=b[0]
    i=b[1]
    if k==0:
        ans+=i-1
        if i>2:
            ans+=(i-1)*(i-2)//2
    elif i>1:
        ans+=i*(i-1)//2
print(ans)

Measured memory_bytes: 131984
#include <iostream>
#include <cstdio>
#include <stack>
using namespace std;

int n, sz, cnt;
string a, ans;
int main()
{
	int i;
	cin >> n;
	cin >> a;
	for (i = 0; i < a.size(); i++) {
		if (a[i] == '(') {
			sz++;
		} else {
			if (sz == 0) {
				cnt++;
			} else {
				sz--;
			}
		}
	}
	for (i = 0; i < cnt; i++) ans += '(';
	ans += a;
	for (i = 0; i < sz; i++) ans += ')';
	cout <<ans;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 2147483600

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

  if(a<=c && c<=b) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,i,k,l,a[50],b;
int main(){
  for(cin>>n>>k;i<n;i++)cin>>a[i];
  sort(a,a+n,greater<int>());
  for(i=0;i<k;i++)b+=a[i];
  cout<<b<<endl;
}

Measured memory_bytes: 256
from collections import defaultdict


d = defaultdict(int)
A, B, C = map(int, input().split())
# A, B, C = 14, 14, 14
# A, B, C = 4, 12, 20
# A, B, C = 454, 414, 444


cnt = 0
ans = 0
while True:
     if A %2 == 1 or B % 2 == 1 or C % 2 == 1:
         ans = cnt
         break
     if d[str([A, B, C])] == 1:
         ans = -1
         break
     else:
         d[str([A, B, C])] = 1
     cnt += 1
     A, B, C = B // 2 + C // 2, A // 2 + C // 2, A // 2 + B // 2

print(ans)


Measured memory_bytes: 3316
def partition(a, p, r):
    x = a[r]
    i = p - 1
    for j in range(p, r):
        if a[j] <= x:
            i = i + 1
            a[i], a[j] = a[j], a[i]
    a[i + 1], a[r] = a[r], a[i + 1]
    return(i + 1)

n = int(input())
a = list(map(int, input().split()))

i = partition(a, 0, n - 1)
a[i] = "[" + str(a[i]) + "]"
print(" ".join(map(str, a)))


Measured memory_bytes: 16384
intNum = int(input())
numList = [int(x) for x in input().split()]

total = 1
judgeNum = 10 ** 18

if 0 in numList:
    total = 0
else:
    for num in numList:
        total *= num

        if total > judgeNum:
            total = -1
            break

print(total)

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

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

int gcd( int a, int b );

int main() {
	int a, b; cin >> a >> b;

	if( a < b ) {
		int tmp = a;
		a = b;
		b = tmp;
	}

	cout << gcd( a, b ) << endl;
}

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


Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
void Main();

using i8  = int8_t;   /* -128 ~ 127 */
using u8  = uint8_t;  /* 0 ~ 255 */
using i16 = int16_t;  /* -32,768 ~ 32,767 */
using u16 = uint16_t; /* 0 ~ 65,535 */
using i32 = int32_t;  /* -2,147,483,648 ~ 2,147,483,647 */
using u32 = uint32_t; /* 0 ~ 4,294,967,295 */
using i64 = int64_t;  /* -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 */
using u64 = uint64_t; /* 0 ~ 18,446,744,073,709,551,615 */
using f32 = float;    /* (-3.4 * 10^38) ~ (3.4 * 10^38) */
using f64 = double;   /* (-1.7 * 10^308) ~ (1.7 * 10^308) */
using f80 = __float80;
template <class T> using Vec = vector<T>;
constexpr i64 INF = 1010000000000000017;
constexpr i64 MOD = 1e9 + 7;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define ALL(v) v.begin(), v.end()
#define YN(a, b, c) ((c)? a : b)
#define GCD(a, b) __gcd(a, b) /* 最大公約数 */
#define LCM(a, b) a / __gcd(a, b) * b /* 最小公倍数 */

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}

void Main() {
    i32 D, T, S;
    cin >> D >> T >> S;
    cout << YN("Yes", "No", S * T >= D) << endl;
}


Measured memory_bytes: 3636
import math
from fractions import gcd

def number_calc(A,B,x):
    left = A//x
    right = B//x
    res = right-left
    return res

A,B,C,D = map(int,input().split())
A -= 1
ans = B-A
ans -=number_calc(A,B,C)
ans -=number_calc(A,B,D)
lcm = (C*D)//gcd(C,D)
ans +=number_calc(A,B,lcm)

print(ans)


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

using namespace std;

int main() {
  //
  int N[5], rest_min=100, rest_i=-1;
  for (int i = 0; i < 5; ++i) {
    cin >> N[i];

    int rest = N[i] % 10;
    if(rest > 0){
      if(rest_min > rest){
        rest_min = rest;
        rest_i = i;
      }
    }
//    cout << rest << endl;

  }

//  cout << rest_i << endl;

  //
  int sum = 0;
  for (int i = 0; i < 5; ++i) {
    if(i == rest_i) {
      sum += N[i];

    }else{
      int rest = N[i] % 10;
      if(rest > 0) sum += 10 - rest;
      sum += N[i];
    }
  }


  cout << sum << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <bitset>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
 
using namespace std;
typedef long long ll;

const int MOD=1000000007;

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

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

  int amax=1000010;
  vector<ll> inv(amax);
  
  inv[1]=1;
  for(int i=2;i<amax;i++){
    inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
  }

  
  vector<int> lcm(amax,0);
  for(int i=0;i<N;i++){
    int ai=A[i];
    int cur=0;
    for(int j=2;j*j<=ai;j++){
      if(ai%j!=0) continue;
      cur=0;
      while(ai%j==0){
	ai/=j; cur++;
      }
      lcm[j]=max(lcm[j],cur);
    }
    lcm[ai]=max(lcm[ai],1);
  }

  ll ans=0;
  ll L=1;
  for(int i=2;i<amax;i++){
    for(int j=0;j<lcm[i];j++){
      L*=i;
      L%=MOD;
    }
  }
  
  for(int i=0;i<N;i++){
    ans+=L*inv[A[i]]%MOD; ans%=MOD;
  }
  
  cout << ans << endl;
  //cout << g << "," << G << endl;
  
  return 0;
}


Measured memory_bytes: 12032
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
int const MAXN=200100;
#define ll long long 
ll n, h[MAXN], b[MAXN], ft[MAXN]; 
ll query(int i){
	ll ans=0;
	while(i>0){
		ans=max(ans,ft[i]);
		i-=i&(-i);
	}
	return ans;
}
void upd(int i, ll val){
	while(i<MAXN){
		ft[i]=max(ft[i],val);
		i+=i&-i;
	}
}
int main(){
	cin>>n;
	for(int i=0;i<n;i++)
		cin>>h[i];
	for(int i=0;i<n;i++)
		cin>>b[i];
	for(int i=0;i<n;i++){
		ll ans=query(h[i]);
		upd(h[i],ans+b[i]);
	}	
	cout<<query(n);
}


Measured memory_bytes: 4992
class RollingHash(object):
    def __init__(self, S, base, mod):
        self.mod = mod
        l = len(S)

        self.hash_lst = [0] * (l + 1)
        self.pow_lst = [1] * (l + 1)

        for i in range(l):
            self.hash_lst[i + 1] = (self.hash_lst[i] * base + ord(S[i])) % mod
            self.pow_lst[i + 1] = (self.pow_lst[i] * base) % mod

    def get_hash(self, left, right):
        return (self.hash_lst[right] - self.hash_lst[left] * self.pow_lst[right - left] % self.mod) % self.mod


N = int(input())
S = input()

base = 1007
mod = pow(10, 9) + 7
rh = RollingHash(S, base, mod)

left = 0
right = N // 2

while left <= right:
    mid = (left + right) // 2

    found_hash = {}
    found = False
    for i in range(N - mid + 1):
        h = rh.get_hash(i, i + mid)

        if h not in found_hash:
            found_hash[h] = i
        else:
            if found_hash[h] <= i - mid:
                found = True
                break

    if found:
        left = mid + 1
    else:
        right = mid - 1


print(right)


Measured memory_bytes: 4128
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int x, y;
		while (true) {
			x = scanner.nextInt();
			y = scanner.nextInt();
			if (x == 0 && y == 0)
				break;
			if (x < y)
				System.out.println(x + " " + y);
			else
				System.out.println(y + " " + x);
		}
		scanner.close();
	}
}

Measured memory_bytes: 25448
/***
**   AUTHOR::ASHUTOSH MOUDGIL
***/


#include<bits/stdc++.h>
using namespace std;

#define pb push_back
#define mp make_pair
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL);
#define F first
#define S second
#define int long long
//#define ll long long
#define all(x) x.begin(),x.end()
#define rsort(x) sort(all(x)); reverse(all(x));
#define endl '\n'
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define vi vector<int>
#define vlli vector<long long>
#define pii pair<int,int>
#define mod 1000000007
#define LMAX 1e18
#define deb(x) cout<<#x<<" : "<<x<<endl;
#define PI 3.141592654
#define dbg1(x) cout << #x <<"="<< x <<endl;
#define dbg2(x,y) cout << #x <<"="<<x<<", "<<#y<<"="<<y <<endl;
#define dbg3(x,y,z) cout << #x <<"="<<x<<", "<<#y<<"="<<y <<", "<<#z<<"="<<z<<endl;
#define dbg4(x,y,z,a) cout << #x <<"="<<x<<", "<<#y<<"="<<y <<", "<<#z<<"="<<z<< ", "<<#a <<"="<<a << endl;
#define dbgarr(x) cout << #x<<endl;for(int i : x){cout << i <<" ";} cout <<endl;



void mymain(){
   int n,x,y;
   cin >> n >> x >> y;
   vi ans(n,0);
   for(int i=1;i<=n;i++){
    for(int j=i+1;j<=n;j++){
        int d = j-i;
        d = min(d,abs(i-x)+abs(j-y)+1);
        d = min(d,abs(i-y)+abs(j-x)+1);
        ans[d]++;
    }
   }
   for(int i=1;i<n;i++)
    cout << ans[i] << endl;


}

signed main(){
IOS;
///freopen("input.txt", "r", stdin);
///freopen("output.txt", "w", stdout);
int t=1;
//cin>>t;
for(int tt=0;tt<t;tt++){
   ///cout << "Case #" << tt+1 <<": ";
   mymain();
   }
return 0;
}
/*

*/


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int t;
	t=n%10;
	if(t==2||t==4||t==5||t==7||t==9)
	{
		cout<<"hon"<<endl;
		
	}
	if(t==0||t==1||t==6||t==8)
	{
		cout<<"pon"<<endl;
	}
	if(t==3)
	{
		cout<<"bon"<<endl;
	}
	return 0;
}

Measured memory_bytes: 3100
/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
#define rep(i, n) for(long long int i = 0; i < (n); i++)


int Len(int n) {
  int s=0;
  while(n!=0) s++, n/=10;
  return s;
}


int Sint(int n) {
  int m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
  return m;
}


int Svec(vector<int> v){
  int n=0;
  for(int i=0;i<v.size();i++) n+=v[i];
  return n;
}


int GCD(int a,int b){
  int r,tmp;
/*自然数 a > b を確認・入替*/
  if(a<b){
    tmp=a,a=b,b=tmp;
  }
/*ユークリッドの互除法*/
  r=a%b;
  while(r!=0){
    a=b,b=r,r=a%b;
  }
  return b;
}


int LCM(int a,int b){
  int c=a,d=b,r,tmp;
/*自然数 a > b を確認・入替*/
  if(a<b){
    tmp=a,a=b,b=tmp;
  }
/*ユークリッドの互除法*/
  r=a%b;
  while(r!=0){
    a=b,b=r,r=a%b;
  }
  return c/b*d;
}


int Factorial(int n){
  int m=1;
  while(n>=1) m*=n,n--;
  return m;
}


/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  int n,k;
  cin>>n>>k;
  cout<<(n+k-3)/(k-1)<<endl;
}

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

int main(){
  int n,m;
  long long k;
  cin >> n >> m >> k;
  long long a[n+1];
  long long b[m+1];
  int counta=0;
  int countb=0;
  long long timea=0;


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

  for(int i=1;i<=n;i++){
    if(timea<=k-a[i]){
      timea +=a[i];
      counta =i;
    }
    else break;
  }


  for(int i=1;i<=m;i++) {
    cin >> b[i];
  }

  int j=1;
  long long count = counta;
  long long counti = counta;
  long long ans = counta;
  long long time = timea;
  long long timei = timea;

  while(timei<=k-b[j]&&j<=m){
    timei +=b[j];
    j++;
    counti ++;
  }
  ans = counti;
j=1;
  for(int i=counta;1<=i;--i){
     time -= a[i];
     count --;
     while((time<=k-b[j])&&j<=m){
       time +=b[j];
       j++;
       count ++;
     }
     ans = max(ans,count);
     if(j==m+1) break;
  }


  cout << ans <<endl;


}

Measured memory_bytes: 6724
#include <iostream>
using namespace std;
int main()
{
        int n,d,x;
        cin >> n >> d >> x;

        int ans=x,a;
        for(int i=0;i<n;i++){
                cin >> a;
                for(int j=0;j*a+1<=d;j++){
                        ans++;
                }
        }

        cout << ans << endl;

        return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#include <map>
#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int MOD = 1000000007;

int main() {
  int N, M; cin >> N >> M;
  int tree[N+1][N+1] = {};
  rep(i, M) {
    int a, b; cin >> a >> b;
    tree[a][b] = 1; tree[b][a] = 1;
  }

  int result = 0;
  int v[N]; rep(i, N) v[i] = i+1;
  do {
    if (v[0]!=1) continue;
    bool ok = true;
    rep(i, N-1) { if (tree[v[i]][v[i+1]]==0) ok = false;}
    if (ok) result++;
  } while( next_permutation(v, v+N) );


  cout << result << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main()
{
	int n,t,x,y,tt,xx,yy;
	while(~scanf("%d",&n))
	{
		t=0,x=0,y=0;
		int flag=0;
		for(int i=0;i<n;i++)
		{
			cin>>tt>>xx>>yy;
			if(flag)
				continue;
			int te=tt-t-(abs(yy-y)+abs(xx-x));
			if(te<0)
				flag=1; 
			else
			{
				if(te&1)
					flag=1;			
			} 
			t=tt,x=xx,y=yy;
		}
		if(flag)
			cout<<"No";
		else
			cout<<"Yes";
	}
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main{

    public static final int FIRST_NUMBER = 0;
    public static final int SECOND_NUMBER = 1;

    public static void main(String[] args) throws NumberFormatException, IOException {

	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	int vertical = Integer.parseInt(br.readLine());
	int horizontal = Integer.parseInt(br.readLine());

	/*
	 * for (int i = 0; i < horizontal; i++) {
	 * 
	 * }
	 */

	//
	List<int[]> inputArrays = new ArrayList<>();
	for (int i = 0; i < horizontal; i++) {
	    String[] queryStr = br.readLine().split(",");
	    int[] query = new int[2];
	    query[FIRST_NUMBER] = Integer.parseInt(queryStr[FIRST_NUMBER]);
	    query[SECOND_NUMBER] = Integer.parseInt(queryStr[SECOND_NUMBER]);
	    inputArrays.add(query);
	}

	//
	int[] outputArray = getDrawedArray(inputArrays, vertical, horizontal);

	//
	for (int i = 1; i < outputArray.length; i++) {
	    System.out.println(outputArray[i]);
	}

    }

    private static int[] getDrawedArray(List<int[]> inputArrays, int amidaLength, int loopCount) {
	// ?????\?????????????????????????????????????????????
	// outputArray[0]????????¨?????????
	int[] outputArray = new int[amidaLength + 1];
	for (int i = 1; i < outputArray.length; i++) {
	    outputArray[i] = i;
	}

	for (int[] query : inputArrays) {
	    int mediator = 0;

	    mediator = outputArray[query[FIRST_NUMBER]];
	    outputArray[query[FIRST_NUMBER]] = outputArray[query[SECOND_NUMBER]];
	    outputArray[query[SECOND_NUMBER]] = mediator;

	}

	return outputArray;

    }

}

Measured memory_bytes: 24232
import java.util.*;


public class Main {
    public static void main(String[] args) {
      
      Scanner sc = new Scanner(System.in);
      int a = Integer.parseInt(sc.next());
      int b = Integer.parseInt(sc.next());
      if ((a +b) % 2 == 0) {
        System.out.print((a +b) / 2);
      } else {
        System.out.print("IMPOSSIBLE");
      }
    }
}

Measured memory_bytes: 23764
#include<iostream>
#include<math.h>
#include<algorithm>
using namespace std;

int main(){
    int N, a[110];
    cin >> N;
    for(int i = 0; i < N; i++) cin >> a[i];
    sort(a, a + N, greater<int>());
    int b = 0;
    for(int i = 0; i < N; i++) b += a[i] * pow(-1,i);
    cout << b << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int n,a,b,c,i;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d %d %d",&a,&b,&c);
		a*=a;
		b*=b;
		c*=c;
		if(a==b+c||b==a+c||c==a+b) printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 0
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();

		int x=Math.max(a, b);
		int y=Math.min(a, b);

		while (x%y!=0) {
			int z=x%y;
			x=y;
			y=z;
		}
		System.out.println(y);
	}

}



Measured memory_bytes: 26344
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mod 1000000007
#define ff first
#define ss second
#define endl '\n'
using namespace std;
const ll inf=1e18 ;
/*ll power(ll x,ll y)
{
    ll res=1;
    while(y>0)
    {
        if(y%2==1)
            res=(res*x)%mod;
        x=(x*x)%mod;
        y=y/2;
    }
    return res;
}*/
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
	ll a,b;
	cin>>a>>b;
	if(a>9 || b>9)
    {
        cout<<-1;
        return 0;
    }
    cout<<a*b;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
typedef unsigned int ui; 
ll mod_pow(ll x,ll n, ll mod) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x%mod;
		x = x * x%mod;
		n >>= 1;
	}
	return res;
}
int main() {
	int i;
	ll pum[200001];
	pum[0] = (ll)1;
	for (i = 1; i < 200001; i++) {
		pum[i] = (pum[i - 1] * (ll)i) % MOD;
	}
	ll invpum[200001];
	for (i = 0; i < 200001; i++) {
		invpum[i] = mod_pow(pum[i],MOD-2,MOD);
	}
	int h, w, a, b;
	cin >> h >> w >> a >> b;
	ll sum = 0;
	for (i = 0; i < min(h - a, w - b); i++) {
		int k, l; k = h - a - i; l = b+1+i;
		ll csum1 = (((pum[k + l-2] * invpum[k-1]) % MOD)*invpum[l-1]) % MOD;
		ll csum2 = (((pum[h + w - (k + l)] * invpum[h - k]) % MOD)*invpum[w - l]) % MOD;
		csum1 = (csum1 * csum2)%MOD;
		sum = (sum + csum1) % MOD;
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n; i >= 0; --i)
#define FOR(i, n, m) for (int i = m; i < n; i++)
#define MM(i, n, m) for (int i = m; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

typedef long long ll;
/**
 * C問以降は ll を使う.
 * double型にするのを忘れない.
 * nC2の求め方 (1/2)*n*(n-1)
 * vector<型> 変数名(要素数, 初期値)
*/
int main()
{
  int n;
  cin >> n;
  cout << 48-n << endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
S = input()

ans = 0
for i in range(N):
    X, Y = set(), set()
    for j in range(N):
        if j < i:
            X.add(S[j])
        else:
            Y.add(S[j])

    same = len(X & Y)
    if same > ans:
        ans = same
print(ans)

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

int main() {
  int N, K;
  std::cin >> N >> K;

  std::vector<int> hn(N);
  int count = 0;
  for (auto &h : hn) {
    std::cin >> h;
    if (h >= K) {
      ++count;
    }
  }

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

Measured memory_bytes: 640
n = int(input())
p = list(map(float, input().split()))
dp = [0] * (n + 1) # dp[i]: i tosses, probability that there are i heads so far
dp[0] = 1
for coin in range(n):
    for i in range(coin + 1, -1, -1):
        if i - 1 >= 0:
            dp[i] = dp[i - 1] * p[coin] + dp[i] * (1 - p[coin])
        else:
            dp[i] = dp[i] * (1 - p[coin])
res = 0
for heads in range(n + 1):
    tails = n - heads
    if heads > tails:
        res += dp[heads]
print(res)

Measured memory_bytes: 41692
import collections

def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    Aitems = list(collections.Counter(A).items())
    Aitems.sort(key=lambda x: x[1], reverse=True)
    ans = 0    
    remain = len(Aitems) - K
    for r in range(remain):
        tmp = Aitems.pop()
        ans += tmp[1]
    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 37800
N = int(input())

counter = 0

cand = set()

cand.add(1)
i = 1
while 6 ** i <= N:
    cand.add(6 ** i)
    i += 1

i = 1
while 9 ** i <= N:
    cand.add(9 ** i)
    i += 1

c = sorted(cand, reverse=True)

T = [N+1] * (N + 1)
T[0] = 0
for i in range(len(c)):
    for j in range(N - c[i] + 1):
        T [j + c[i]] = min(T[j + c[i]], T[j] + 1)

print(T[N])

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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2019/03/12  Problem: ABC 084 D / Link: http://abc084.contest.atcoder.jp/tasks/abc084_d  ----- */


struct Cumusum {
	vector<LL>csum;
	Cumusum(vector<LL>&a) {
		csum.assign((int)a.size() + 1, 0);
		for (int i = 0; i < (int)a.size(); i++) {
			csum[i + 1] = csum[i] + a[i];
		}
	}
	LL query(int l, int r) {
		return csum[r] - csum[l];
	}
};

auto make_prime(long long  N) {
	vector<long long >a;
	vector<LL> prime(N + 1,0);
	FOR(i, 0, N + 1) {
		prime[i] = 1;
	}prime[0] = prime[1] = 0;

	for (LL i = 2; i <= N; i++) {
		if (prime[i]) {
			a.push_back((long long)i);
			for (LL j = i * 2; j <= N; j += i)
				prime[j] = 0;
		}
	}
	return prime;
}
int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(false);

	auto ispr = make_prime(1e5 + 10);
	VL like2017(1e5 + 10);
	FOR(i, 3, 1e5 + 10) {
		if (ispr[i] && ispr[(i + 1) / 2])like2017[i] = 1;
	}
	Cumusum psum(like2017);
	LL Q; cin >> Q;
	FOR(_, 0, Q) {
		LL L, R; cin >> L >> R;
		LL ans = psum.query(L,R+1);
		cout << (ans) << "\n";
	}

	return 0;
}


Measured memory_bytes: 3124
n = int(input())
a = [list(map(int,input().split())) for i in range(n)]
a.sort(key = lambda x:x[1])
j = 0

for i in range(n):
    j += a[i][0]
    if j > a[i][1]:
        print('No')
        exit(0)

print('Yes')

Measured memory_bytes: 46896
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
#define pb push_back
int main(void){
    ll n,m,x;
    cin>>n>>m>>x;
    ll a[n][m],c[n];
    rep(0,i,n){
        cin>>c[i];
        rep(0,j,m)cin>>a[i][j];
    }
    ll ans=1e9;
    rep(0,bit,(1<<n)){
        vector<ll>s;
        rep(0,i,n){
            if(bit&(1<<i))s.pb(i);
        }
        ll tmp=0,na[m];
        rep(0,i,m)na[i]=0;
        rep(0,i,s.size()){
            ll x=s[i];
            tmp+=c[x];
            rep(0,j,m)na[j]+=a[x][j];
        }
        bool t=true;
        rep(0,i,m)if(na[i]<x)t=false;
        if(t)ans=min(ans,tmp);
    }
    if(ans==1e9)cout<<-1;
    else cout<<ans;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define rep3(i, s, n) for (int i = s; i > (int)(n); i--)
#define all(obj) obj.begin(), obj.end()
#define db(x) cerr << #x << ":" << x << " "
#define dbl(x) cerr << #x << ":" << x << "\n"
#define dbv(vec) cerr << #vec << ":"; for (auto e : vec) cerr << e << " "; cout << "\n"
#define dbvv(vv) cerr << #vv << ":\n"; for (auto vec : vv) { for (auto e : vec) cerr << e << " "; cerr << endl; }
#define YN(f) cout << (f ? "YES" : "NO") << endl
#define Yn(f) cout << (f ? "Yes" : "No") << endl
#define yn(f) cout << (f ? "yes" : "no") << endl
/*
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
*/

int main() {
	int N; cin >> N;
	int L; cin >> L;
	multiset<string> ms;
	rep(i, N) {
		string S; cin >> S;
		ms.insert(S);
	}
	for (string S : ms) {
		cout << S;
	}
	cout << endl;
}

Measured memory_bytes: 256
open System

let n = Console.ReadLine() |> int

let ans =
    match n % 10 with
    | 2
    | 4
    | 5
    | 7
    | 9 -> "hon"
    | 0
    | 1
    | 6
    | 8 -> "pon"
    | _ -> "bon"

ans |> Console.WriteLine

Measured memory_bytes: 27944