akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifndef ONLINE_JUDGE
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
int isPos(vector<int> A, int L, int k) {
	int n = A.size(), count = 0;
	for(int i=0;i<n;i++) {
		if(A[i]<=L) continue;
		count+=(A[i]-1)/L;
	}
	if(count<=k) return 0;
	else return 1;
}
int main() {
	int n,k;
	cin>>n>>k;
	vector<int> A(n);
	int l= 0 , r = 1e9, maxi = -1;
	for(int &i:A) {
		cin>>i;
		//R = max(R,i);
		maxi = max(maxi,i);
	}
	if(k==0) {
		cout<<(int)maxi;
		return 0;
	}
	//double prospect = 0;
	while(r-l>1) {
		int mid = (l+r)/2;
		debug()<<imie(mid);
		int check  =0;
		for(int i=0;i<n;i++) {
			check+=(A[i]-1)/mid;
		}
		if(check<=k) {
			r = mid;
		} else {
			l = mid;
		}
	}
	cout<<r;
}



Measured memory_bytes: 4044
#include "bits/stdc++.h"
using namespace std;
const int MOD = 1e9 + 7;
typedef long long lint;
const int INF = 1e7;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repi(i, k, n) for (int i = (k); i < (int)(n); ++i)
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).rbegin(), (x).rend()
#define pb push_back
int main()
{
    int a, b, k;
    cin >> a >> b >> k;
    int count = 0;
    vi v;
    for (int i = 1; i < 101; i++)
    {
        if (a % i == 0 && b % i == 0)
        {
            count++;
            v.push_back(i);
        }
    }
    sort(all(v));
    cout << v[k-1] << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll mod = 1e9 + 7;
string L;
vector<int> on;

ll exp(ll x, ll y){
    if(y == 0) return 1;
    
    ll e = exp(x, y / 2) % mod;
    e = e * e % mod;
    if(y % 2 == 1) e = e * x % mod;
    return e;
}

int main(){
    cin >> L;
    reverse(L.begin(), L.end());
    for(int i = 0; i < L.size(); i++){
        if(L[i] == '1') on.push_back(i);
    }
    ll ans = exp(2, on.size());
    for(int i = 0; i < on.size(); i++){
        ll res1 = exp(2, (int)on.size() - i - 1);
        ll res2 = exp(3, on[i]);
        ans += res1 * res2 % mod;
        ans %= mod;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1148
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

const int M=2005;
int n,m,k,dp[2*M][M],s[2*M][M];

int main(){
	cin>>n>>m>>k;
	dp[0][0]++;
	fill(s[0],s[0]+M,1);
	for(int i=1;i<2*M;i++){
		for(int j=0;j<M;j++){
			dp[i][j]=s[i-1][j];
			if(j>=k) dp[i][j]=(dp[i][j]-s[i-1][j-k]+mod)%mod;
			s[i][j]=(dp[i][j]+(j?s[i][j-1]:0))%mod;
		}
	}
	int res=0;
	for(int i=0;i*(k-1)<n;i++) for(int j=0;j*(k-1)<m;j++){
		int A=n-i*(k-1),B=m-j*(k-1),L=(A+B-1)/(k-1);
		(res+=(dp[L][A]-dp[L-1][A]+mod)%mod)%=mod;
	}
	cout<<res<<endl;
}

Measured memory_bytes: 63104
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
#define rep2(i,a,n) for(int i=a;i<n;i++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INFL = 1e18;
const int INF = 1001001001; 
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
int mod =1000000007;
const double PI = acos(-1);
int main(){
    ll x,k,d;cin>>x>>k>>d;
    ll a =abs(x)/d;
    if(a<=k){
        k-=a;
        if(k%2){
            cout<<min(abs(x+((a+1)*d)),abs(x-((a+1)*d)))<<endl;
        }
        else
        {
            cout<<min(abs(x+(a*d)),abs(x-(a*d)))<<endl;
        }
        
    }
    else{
        cout<<min(abs(x+(k*d)),abs(x-(k*d)))<<endl;
    }
}

Measured memory_bytes: 3632
#include <stdio.h>

#define OUTPUT__LENGTH (128)
char _out[OUTPUT__LENGTH];
char *_o = _out;
void write_uint(int n) {
    if(!n) {
        *_o++ = '0';
        return;
    }
    char buf[11];
    int i = 0;
    while(n) buf[i++] = (n % 10 + '0'), n /= 10;
    while(i--) *_o++ = buf[i];
}
int get_uint() {
    int n = 0;
    int c = getchar_unlocked();
    if(c < 48 || 57 < c) return c;
    while(47 < c && c < 58) {
        n = 10 * n + (c & 0xf);
        c = getchar_unlocked();
    }
    return n;
}
int *find(int *first, int *last, const int value) {
    for(;first!=last;++first)
        if(*first == value) return first;
    return last;
}

typedef struct Node {
    int parent, left, right, depth, height, sibling;
} Node;
typedef struct BinaryTree {
    Node nodes[40];
    int root;
} BinaryTree;
void bt_init(BinaryTree *BT) {
    for(int i = 0; i < 40; ++i) BT->nodes[i].parent = -1;
}
void bt_make(BinaryTree *BT) {
    for(int i = 0; i < 40; ++i) {
        if(BT->nodes[i].parent == -1) {
            BT->root = i;
            break;
        }
    }
}
void bt_add_node(BinaryTree *BT, int id, int l, int r) {
    BT->nodes[id].left = l;
    BT->nodes[id].right = r;
    if(~l) BT->nodes[l].parent = id;
    if(~r) BT->nodes[r].parent = id;
}
int bt_pre_in(BinaryTree *BT, int *pre, int *in, int l, int r) {
    static int pos = 0;
    if(l >= r) return -1;
    int root = pre[pos++];
    int mid = (int)(find(in, in+r, root) - in);
    int ln = bt_pre_in(BT, pre, in, l, mid);
    int rn = bt_pre_in(BT, pre, in, mid+1, r);
    bt_add_node(BT, root, ln, rn);
    return root;
}
void bt_pr_postorder(BinaryTree *BT, int id) {
    if(id == -1) return;
    bt_pr_postorder(BT, BT->nodes[id].left);
    bt_pr_postorder(BT, BT->nodes[id].right);
    *_o++ = ' ';
    write_uint(id+1);
}
int main(int argc, char **argv) {
    int n = get_uint();
    int pre[n], in[n];
    for(int i = 0; i < n; ++i) pre[i] = get_uint()-1;
    for(int i = 0; i < n; ++i) in[i] = get_uint()-1;
    BinaryTree BT;
    bt_init(&BT);
    bt_pre_in(&BT, pre, in, 0, n);
    bt_make(&BT);
    bt_pr_postorder(&BT, BT.root);
    for(char *p = _out+1; p!=_o;++p) putchar_unlocked(*p);
    putchar_unlocked('\n');
    return 0;
}




Measured memory_bytes: 2144
#include<algorithm>
#include<iostream>
#include<functional>
#include<cmath>
#include<iomanip>
using namespace std;
int main(){
  bool ok=false;
  int n,ans[110000];
  cin>>n;
  for(int j=1;j<n+1;j++){
    cin>>ans[j];
  }
  int num,count=1;
  num=ans[1];
  if(num==2)
    cout<<1<<endl;
  else{
  for(int k=0;k<n+100000;k++){
    num=ans[num];
    count++;
    if(num==2){
      ok=true;
      break;
    }
  }
  if(ok)
    cout<<count<<endl;
  else
    cout<<-1<<endl;
  }
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int max(int a,int b,int c=INT_MIN)
{
    return (a>b ? ((a>c)?a:c) : (b>c)?b:c);
}
int main() {
    vector<vector<int> > arr;
    int n,t;
    cin>>n;
    arr.resize(n);
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<3;j++)
        {
            cin>>t;
            arr[i].push_back(t);
        }
    }
    vector<vector<int> > ans(n,vector<int> (3,0));
    for(int i=0;i<3;i++)
    ans[0][i]=arr[0][i];
    for(int i=1;i<n;i++)
    {
        for(int j=0;j<3;j++)
        {
            if(j==0)
                ans[i][j]=arr[i][j]+max(ans[i-1][1],ans[i-1][2]);
            if(j==1)
                ans[i][j]=arr[i][j]+max(ans[i-1][0],ans[i-1][2]);
            if(j==2)
                ans[i][j]=arr[i][j]+max(ans[i-1][0],ans[i-1][1]);
        }
    }
    /*for(int i=0;i<n;i++)
    {
        for(int j=0;j<3;j++)
        cout<<ans[i][j]<<" ";
        cout<<"\n";
    }*/
    int m=INT_MIN;
    for(int i=0;i<3;i++)
    {
        if(m<ans[n-1][i])
        m=ans[n-1][i];
    }
    cout<<m;
	return 0;
}

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

int fac[10];

int get_order(vector<int> & num, int n)
{
    vector<bool> st(n + 1, false);
    int res = 0;
    for(int i = 0; i < n; i ++)
    {
        int cnt = 0;
        for(int j = 1; j != num[i]; j ++)
        {
            if(!st[j]) cnt ++;
        }
        res += cnt * fac[n-i-1];
        st[num[i]] = true;
    }
    return res;
}

int main()
{
    int n;
    cin >> n;
    fac[0] = 1;
    for(int i = 1; i < 10; i ++)
    {
        fac[i] = i * fac[i-1];
    }
    vector<int> p (n, 0);
    vector<int> q (n, 0);
    for(int i = 0; i < n; i ++) cin >> p[i];
    for(int j = 0; j < n; j ++) cin >> q[j];
    int a = get_order(p, n);
    int b = get_order(q, n);
    cout << abs(a - b) << endl;
    return 0;
}

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

using namespace std;

int main(void){
	int N;
	cin >> N;
	int ans = 77777;
	int w;
	int i;
	for(i = 1; i <= 50000;i++){
		w = i * 108;
		w = w / 100;
		if(w == N){
			ans = i;
			break;
		}
	}
	if(ans != 77777){
		cout << ans <<endl;
	}
	else{
		cout<<":("<<endl;
		}
	return 0;
}




Measured memory_bytes: 256
import math
 
h,n=map(int,input().split())
a=[0]*n
b=[0]*n
for i in range(n):
    a[i],b[i]=list(map(int,input().split()))
 
 
dp=[[b[0]] * (h+1) for i in range(n+1)]
for j in range(h+1):
    dp[0][j]=math.ceil(j/a[0])*b[0]
for i in range(n):
    for j in range(h+1):
        if j<a[i]: dp[i+1][j]=min(dp[i][j],b[i])
        else:dp[i+1][j]=min(dp[i][j],dp[i+1][j-a[i]]+b[i])
print(dp[n][h])

Measured memory_bytes: 198280
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(){
    int n,dp[11]={},ans=0;
    char s[11];
    scanf("%s",s);
    n=strlen(s);
    for(int i=0;i<n;i++){
        if(s[i]=='A'||s[i]=='C'||s[i]=='T'||s[i]=='G'){
            dp[i+1]=dp[i]+1;
            ans=max(ans,dp[i+1]);
        }
    }
    printf("%d\n",ans);
}

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

int main(){
  int N ,X;
  cin >> N >> X;
  int L[N];
  for (int i = 0;i<N;i++){
    cin >> L[i];
  }

  int D[N+1];
  D[0] = 0;
  for (int i = 0;i<N;i++){
    D[i+1] = D[i] + L[i];
  }
  int ans =0;
  for (int i=0;i<N+1;i++){
    if(D[i]<=X){
      ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
require 'pp'

n= gets.chomp!.to_i
a_n = gets.chomp!.split(" ").map!(&:to_i)
a_n.sort!

ans = []

while a_n.length != 1
    head = a_n.shift
    tail = a_n.pop
    if a_n.empty? || a_n[-1] < 0
       ans << "#{tail} #{head}"
       a_n.push(tail - head)
    else
       ans << "#{head} #{tail}"
       a_n.unshift(head - tail)
    end
end

puts a_n[0]
puts ans


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

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str[] = br.readLine().split(" ");
		int x = Integer.parseInt(str[0]), y = Integer.parseInt(str[1]), rest;

		if (x < y) {
			int temp = x;
			x = y;
			y = temp;
		}

		do {
			rest = x % y;
			x = y;
			y = rest;
		} while (y != 0);

		System.out.println(x);
	}
}

Measured memory_bytes: 16896
# include <cstdio>
# include <iostream>
# include <vector>
# include <map>
# include <set> 
# include <algorithm> 
# include <string>
# include <cstring>
# include <queue> 
# include <stack> 
using namespace std ; 

int main()
{
	int n, m ; 
	cin >> n >> m ; 
	cout << n * m << "\n" ;
	//cout << "Hello World\n" ; 
	return 0 ; 
}

Measured memory_bytes: 3172
n, k = map(int, input().split())
D = list(map(int, input().split()))
D = set(D)

while True:
    s = list(str(n))
    flag = True
    for i in range(len(s)):
        if int(s[i]) in D:
            flag = False
    if flag:
        break
    else:
        n += 1
print(n)

Measured memory_bytes: 41072
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <iomanip>

using namespace std;

int main(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	if(a+b+c+d==1+9+7+4 && a*b*c*d==1*9*7*4){
		cout << "YES" << endl;
	}else{
		cout << "NO" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

// ABC099C - Strange Bank
// https://atcoder.jp/contests/abc099/tasks/abc099_c

func min(a, b int) int {
	if a >= b {
		return b
	}
	return a
}

func main() {
	const inf = 100001
	var dp [100010]int
	dp[0] = 0
	for n := 1; n <= 100000; n++ {
		dp[n] = inf
		power := 1
		for power <= n {
			dp[n] = min(dp[n], dp[n-power]+1)
			power *= 6
		}
		power = 1
		for power <= n {
			dp[n] = min(dp[n], dp[n-power]+1)
			power *= 9
		}
	}
	var N int
	fmt.Scan(&N)
	fmt.Println(dp[N])
}


Measured memory_bytes: 1408
// Author : Mohamed sameh
#include <bits/stdc++.h>
typedef long long ll ;
#define pb push_back
#define f first
#define s second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define SZ(a) (int)a.size()
#define Flush fflush(stdout);
using namespace std ;
const int N = 3e5+9, Lg = 26;
int R[N], C[N], H, W, M;
vector<int> adj[N];
map<pair<int,int>, bool> mp;
int spt[N][Lg], Log[N];
void buildSparse()
{
	for (int i = 2; i < N; i++)
		Log[i] = Log[i>>1] + 1;
	for (int i = 1; i <= W; i++)spt[i][0] = C[i];
	for (int j = 1; j < Lg; j++)
		for (int i = 1; i + (1<<j) <= W+1; i++)
			spt[i][j] = max(spt[i][j-1], spt[i + (1<<(j-1))][j-1]);
}
int query(int l, int r)
{
	if (l > r)return 0;
	int sz = Log[r - l + 1];
	return max(spt[l][sz], spt[r - (1<<sz)+1][sz]);
}
int get(int row)
{
	adj[row].erase(unique(all(adj[row])), adj[row].end());
	int sz = SZ(adj[row]); 
	int best = 0;
	for (int i = 1; i < sz; i++)
	{
		best = max(best, query(adj[row][i-1]+1, adj[row][i]-1));
	}
	return best; 
}
int main()
{
	cin >> H >> W >> M;
	for (int i = 0; i < M; i++)
	{
		int r, c;
		cin >> r >> c;
		R[r]++;
		C[c]++;
		adj[r].pb(c); 
		mp[{r,c}] = 1; 
	}
	buildSparse();
	int Mx_c = C[1], col = 1;
	for (int i = 1; i <= W; i++)
	{
		if (C[i] > Mx_c)
		{
			Mx_c = C[i];
			col = i;
		}
	}
	int ans = 0;
	for (int i = 1; i <= H; i++)
	{
		adj[i].pb(0);
		adj[i].pb(W+1);
		sort(all(adj[i]));
		int cur = R[i] + Mx_c;
		if (mp.find({i,col}) != mp.end())cur--;
		ans = max(ans, cur);
		ans = max(ans, R[i] + get(i));
	}
	cout << ans << '\n';
}


Measured memory_bytes: 74312
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;
use std::collections::HashMap;

#[allow(dead_code)]
struct Scanner<'a> {
    cin: StdinLock<'a>,
}
#[allow(dead_code)]
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }

    fn read<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }

    fn input<T: FromStr>(&mut self) -> T {
        self.read().unwrap()
    }
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);

    let n: usize = sc.input();
    let a: Vec<usize> = (0..n)
        .map(|_| sc.input())
        .collect();

    let mut hashmap: HashMap<usize, usize> = HashMap::new();

    for num in a {
        let count = hashmap.entry(num).or_insert(0);
        *count += 1;
    }

    let mut rem: usize = 0;
    for (key, value) in &hashmap {
        if *value >= 2 {
            rem += value - 1;
        }
    }

    println!("{}", hashmap.len() - (rem % 2));
}


Measured memory_bytes: 12540
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int mod=1e9+7;

int n,tot=1,cnt,ans=1;

map<pair<int,int>,int> m;
map<pair<int,int>,int>::iterator it;

int qpow(int a,int b){
    int res=1LL;
    for(;b;b>>=1){
        if(b&1)
            res=(res*a)%mod;
        a=(a*a)%mod;
    }
    
    return res;
}

signed main(){
    cin>>n;
    
    for(int i=1;i<=n;i++){
        int u,v,now;
        cin>>u>>v;
        
        if(u==0 && v==0){
            cnt++;
            continue;
        }
        
        now=__gcd(u,v);
        u/=now,v/=now;
        
        if(u<0)
            u=-u,v=-v;
            
        m[make_pair(u,v)]++;
    }
    
    for(it=m.begin();it!=m.end();it++){
        if(it->second==0)
            continue;
        int x=it->first.first,y=it->first.second;
        int p=qpow(2,m[make_pair(x,y)])%mod;
        
        y=-y;
        if(y<0)
            x=-x,y=-y;
            
        if(m.count(make_pair(y,x))){
            p=(p+qpow(2,m[make_pair(y,x)])-1)%mod;
            m[make_pair(y,x)]=0;
        }
        
        ans=(ans*p)%mod;
    }
    
    cout<<((ans+cnt-1)%mod+mod)%mod<<"\n";
    
    return 0;
}

Measured memory_bytes: 16016
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;
int INF = INT_MAX / 2;

int main() {
	int N; cin >> N;
	if (N % 2 == 1) {
		cout << "NA" << endl;
		return 0;
	}
	vector<int> X(N), Y(N);
	for (int i = 0; i < N; i++)
		cin >> X[i] >> Y[i];
	set<i_i> s;
	for (int i = 0; i < N / 2; i++) {
		int x = X[i] + X[N / 2 + i];
		int y = Y[i] + Y[N / 2 + i];
		s.insert(i_i(x, y));
	}
	if (s.size() > 1) {
		cout << "NA" << endl;
		return 0;
	}
	i_i p = *(s.begin());
	printf("%.10f %.10f\n", p.first / 2.0, p.second / 2.0);
}

Measured memory_bytes: 1228
#include <iostream>
using namespace std;
int main(void) {
	int a, b, c, n;
	cin >> a >> b >> c >> n;
	if (a > b) {
		if (a > c) {
			for (int i = 0; i != n; i++) {
				a = a * 2;
			}
			cout << a + b + c << '\n';
		}
		else {
			for (int i = 0; i != n; i++) {
				c = c * 2;
			}
			cout << a + b + c << '\n';
		}
	}
	else {
		if (b > c) {
			for (int i = 0; i != n; i++) {
				b = b * 2;
			}
			cout << a + b + c << '\n';
		}
		else {
			for (int i = 0; i != n; i++) {
				c = c * 2;
			}
			cout << a + b + c << '\n';
		}
	}
	return 0;
}


Measured memory_bytes: 256
s = [int(i) for i in input()]
f = s[0]*10 + s[1]
l = s[2]*10 + s[3]

if 1 <= f <= 12 and 1 <= l <= 12:
  print("AMBIGUOUS")
elif 1 <= f <= 12:
  print("MMYY")
elif 1 <= l <= 12:
  print("YYMM")
else:
  print("NA")

Measured memory_bytes: 3060
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        int d = sc.nextInt();
        int res = 0;
        for(int i=l; i<=r; i++) {
            if(i%d == 0) res++;
        }
        System.out.println(res);
    }

}

Measured memory_bytes: 35612
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <deque>
#include <map>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define rep(i, up) for (ll i = 0; i < up; ++i)
#define repp(i, up) for (ll i = 0; i <= up; ++i)
#define rrep(i, lo, up) for (ll i = lo; i < up; ++i)
#define rrepp(i, lo, up) for (ll i = lo; i <= up; ++i)
#define eep(i, lo, up) for ((i) = (lo); (i) < (up); ++(i))
#define eepp(i, lo, up) for ((i) = (lo); (i) <= (up); ++(i))

#define rdi(i) ll i; scanf("%lld", &i)
#define rds(s) string s; cin >> s
#define rdc(c) char c; cin >> c

#define INF 10000000000
#define MOD 1000000007

ll gcd(ll a, ll b)
{
    if (a < b) {
        return gcd(b, a);
    }
    ll r;
    while (r = a % b) {
        a = b;
        b = r;
    }
    return b;
}

int main()
{
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) {
        cin >> a[i];
    }
    ll result = 0;
    map<ll, ll> work;
    ll i = n - 1;
    while (true) {
        ++work[i - a[i]];
        --i;
        if (i < 0) {
            break;
        }
        result += work[i + a[i]];
    }
    cout << result << endl;
    return 0;
}

Measured memory_bytes: 27064
A, B = map(int, input().split())

import math

X_MIN_FROM_A = math.ceil(A / 0.08)
X_MAX_FROM_A = math.ceil((A + 1) / 0.08)

ans_set_from_a = set(range(X_MIN_FROM_A, X_MAX_FROM_A))

X_MIN_FROM_B = math.ceil(B / 0.10)
X_MAX_FROM_B = math.ceil((B + 1) / 0.10)

ans_set_from_b = set(range(X_MIN_FROM_B, X_MAX_FROM_B))

ans_set = ans_set_from_a & ans_set_from_b

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

Measured memory_bytes: 3064
n=int(input())
a=list(map(int,input().split()))
al=0
for i in range(n):
  if a[i]>=3200:
    al+=1
    a[i]=8
  else:
    a[i]=a[i]//400
if al==0:
  cl=len(set(a))
else:
  cl=len(set(a))-1
if cl==0:
  mi=1
else:
  mi=cl
ma=al+cl
print(mi,ma)

Measured memory_bytes: 9112
#include<bits/stdc++.h>
#define eps 1e-6
#define ll long long
#define IOS cin.sync_with_stdio(false);cin.tie(0);cout.tie(0);
//#define int long long
#define MEM(x,y) memset(x,y,sizeof(x))
#define rep(i,a,n) for (ll i=a;i<n;i++)
#define fi first
#define se second
#define endl "\n"
const ll mod=1000000007;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
ll Max(ll a,ll b){return a>=b?a:b;}
ll Min(ll a,ll b){return a<=b?a:b;}
ll qpow(ll a,ll b){ll s=1;while(b>0){if(b%2==1){s=s*a;}a=a*a;b=b>>1;}return s;}
ll qpowmod(ll a, ll b, ll c){ll res,t;res=1;t=a%c;while(b){if(b&1){res=res*t%c;}t=t*t%c;b>>=1;}return res;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
inline long long read(){long long k=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){k=k*10+ch-'0';ch=getchar();}return k*f;}
inline void write(long long x){if(x<0)x=-x,putchar('-');if(x>9)write(x/10);putchar(x%10+'0');}
using namespace std;
//head file
int main()
{
    IOS;
    int x;
    cin>>x;
    for(ll i=-400;i<=400;i++)
    {
        for(ll j=-400;j<=400;j++)
        {
            if(i*i*i*i*i-j*j*j*j*j==x)
            {
                cout<<i<<" "<<j<<endl;
                return 0;
            }
        }
    }
}


Measured memory_bytes: 3652
import sys

sys.setrecursionlimit(1000000000)

def dfs(i, special):
    if (i > N - 1):
        return 0
    if (special > 0):
        return dfs(i + 1, special - 1)
    else:
        return  MONSTERS[i] + dfs(i + 1, special)       

N, K = map(int, input().split())
MONSTERS = map(int, input().split())
MONSTERS = list(reversed(sorted(MONSTERS)))
print(dfs(0, K))


Measured memory_bytes: 192784
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define F .first
#define S .second 
using ll=long long;
using ld=long double;
using namespace std;
const ll mod=1e9+7;
ll a[20];
ll x[30][30],y[30][30];

main(){
  ll n,ans=0,tmp=0;
  cin>>n;
  rep(i,0,n){
    cin>>a[i];
    rep(j,0,a[i]){
      cin>>x[i][j]>>y[i][j];
      x[i][j]--;
    }
  }
  bool p=false;
  for(int mask = 0; mask < (1 << n); mask++){
      p=true;
      tmp=0;
      rep(i,0,n){
        if(mask&(1<<i)){
          rep(j,0,a[i]){
            if((mask>>(x[i][j])&1)^y[i][j])p=false;
          }
        }
      }
      if(p){
        rep(i,0,n)if(mask&(1<<i))tmp++;
        ans=max(ans,tmp);
      } 
  }
  cout<<ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cmath>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main() {
  string s;
  cin >> s;
  int midr = s.size()/2, midl = (s.size()-1)/2;
  while (midl+1 < s.size()) {
    if (s[midr] != s[midr-1] || s[midl] != s[midl+1])
      break;
    midr--; midl++;
  }
  cout << midl+1 << endl;
  return 0;
}

Measured memory_bytes: 512
use std::io::*;
use std::str::FromStr;
use std::iter::*;

struct Scanner<R: Read> {
    reader: R,
}

#[allow(dead_code)]
impl<R: Read> Scanner<R> {
    fn new(reader: R) -> Scanner<R> {
        Scanner { reader: reader }
    }

    fn safe_read<T: FromStr>(&mut self) -> Option<T> {
        let token = self.reader.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            token.parse::<T>().ok()
        }
    }

    fn read<T: FromStr>(&mut self) -> T {
        if let Some(s) = self.safe_read() {
            s
        } else {
            writeln!(stderr(), "Terminated with EOF").unwrap();
            std::process::exit(0);
        }
    }
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);

    loop {
        let n = sc.read();
        if n == 0 {
            break;
        }
        let a: Vec<f64> = (0..n).map(|_| sc.read()).collect();
        let m = a.iter().fold(0.0, |acc, x| acc + x) / n as f64;
        let s = a.iter().fold(0.0, |acc, x| acc + (x - m).powf(2.0)) / n as f64;
        println!("{:09}", s.sqrt());
    }
}



Measured memory_bytes: 5080
import java.util.Scanner;

import static java.lang.Math.PI;
import static java.lang.Math.sin;
import static java.lang.Math.pow;
import static java.lang.Math.cos;
import static java.lang.Math.sqrt;

class Main{
    
    public static void main(String[] arg){

        Scanner in = new Scanner(System.in);

        String input = in.nextLine();
        String [] param_line = input.split(" ", 0);

        double a = Double.parseDouble(param_line[0]);
        double b = Double.parseDouble(param_line[1]);
        double c_do = Double.parseDouble(param_line[2]);

        double c_rad = c_do/180*Math.PI;

        double h = b*Math.sin(c_rad);

        double S = a * h / 2;

        // 
        double c = sqrt(pow(a,2)+pow(b,2)-2*a*b*cos(c_rad));

        double L = a + b + c;

        System.out.println(S);
        System.out.println(L);
        System.out.println(h);
    }
}

Measured memory_bytes: 26072
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

int main(){
  int n, m, k;
  cin >> n >> m >> k;
  combination cb(n*m);
  mint ans = 0;
  mint pc = cb(n*m-2, k-2);
  rep2(i, 1, n){
    mint add = pc * (n-i) * m * m * i;
    ans += add;
  }
  rep2(i, 1, m){
    mint add = pc * (m-i) * n * n * i;
    ans += add;
  }
  cout << ans.x << endl;
  return 0;
}

Measured memory_bytes: 3328
#include<stdio.h>

int main(){
    while(true){
        int h,w;
        scanf("%d %d",&h,&w);
        if(h == 0 && w == 0) break;
        for(int i = 0;i < h;i++){
            for(int j = 0;j < w;j++){
                if(((i + j)%2) == 0) printf("#");
                else printf(".");
            }
            printf("\n");
        }
        printf("\n");
    }
}


Measured memory_bytes: 2612
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	for(int i = 1; i<=n;i++)
	{
		if(int(i * 1.08) == n)
		{
			cout<<i<<endl;
			return 0;
		}
		else
			continue;
	}
	cout<<":("<<endl;
	return 0;
}

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

ll gcd(ll a, ll b) {
    if (b == 0) {
        return a;
    }
    return gcd(b, a % b);
}
int main() {
    int N;
    cin >> N;
    ll m = 1;
    for (int i = 0; i < N; i++) {
        ll t;
        cin >> t;
        m = m / gcd(m, t) * t ;
    }
    cout << m << endl;

    return 0;
}


Measured memory_bytes: 256
a,b,c = (int(x) for x in input().split())
co = 0
if a==b:
	if a!=c:
		co=1
elif a==c:
	if a!=b:
		co=1
elif b==c:
	if a!=b:
		co=1
if co==1:
	print("Yes")
else:
	print("No")

Measured memory_bytes: 3060
#include <cstdio>
#include <queue>
#include <vector>
#include <algorithm>
using namespace std;

class Act
{
public:
	int m,p,r,tn;
	Act(int m, int p, int r, int tn)
	:m(m),p(p),r(r),tn(tn)
	{}
};

class Dct
{
public:
	int p,sp;
	vector<Act> ac;
	Dct(int p, int sp)
	:p(p),sp(sp)
	{}
	
	Dct(int np, bool f, Dct& d)
	:sp(d.sp),ac(d.ac)
	{
		if(f)
		{
			p=d.p;
			if(sp&(1<<np)) ac.push_back(Act(0,np+1, d.p, np));
			else ac.push_back(Act(1,np+1, d.p, np));
			
			if(sp&(1<<np)) sp-=(1<<np);
			else 		   sp|=(1<<np);
		}
		else
		{
			p=np;
			ac.push_back(Act(2,np+1, -1, -1));
		}
	}
};

class Room
{
public:
	vector<int> to,sw;
};

int main()
{
	int N,M,K;
	while(scanf("%d%d", &N,&M),(N||M))
	{
		int sp=0;
		bool h[32768][15]={0};
		Room rm[15];
		
		while(M--)
		{
			int s,t;
			scanf("%d%d", &s,&t);
			s--;t--;
			rm[s].to.push_back(t);
			rm[t].to.push_back(s);
		}
		
		for(int i=0; i<N; i++)
		{
			int t;
			scanf("%d", &t);
			sp|=(t<<i);
		}
			
		for(int i=0; i<N; i++)
		{
			scanf("%d", &K);
			while(K--)
			{
				int t;
				scanf("%d", &t);
				t--;
				rm[i].sw.push_back(t);
			}
			
			if(!rm[i].sw.empty()) sort(rm[i].sw.begin(), rm[i].sw.end());
		}
		
		queue<Dct> q;
		q.push(Dct(0,sp));
		
		int st=-1;
		while(!q.empty())
		{
			Dct d=q.front(); q.pop();
			
			if(d.p==N-1)
			{
				if(d.sp==(1<<(N-1)))
				{
					st=1;
					printf("You can go home in %d steps.\n", d.ac.size());
					for(int i=0; i<d.ac.size(); i++)
					{
						if(d.ac[i].m==2) printf("Move to room %d.\n", d.ac[i].p);
						else	printf("Switch %s room %d.\n", (d.ac[i].m==1?"on":"off"), d.ac[i].p);
					}
					break;
				}
				else st=0;
			}
			
			for(int i=0; i<rm[d.p].to.size(); i++)
			{
				int next=rm[d.p].to[i];
				if(!(d.sp&(1<<next))) continue;
				
				if(h[d.sp][next]) continue;
				h[d.sp][next]=1;
				
				q.push(Dct(next, 0, d));
			}
			
			for(int i=0; i<rm[d.p].sw.size(); i++)
			{
				int next=rm[d.p].sw[i];
				if(d.p==next) continue;
				if(!d.ac.empty())
				{
					int t=d.ac[d.ac.size()-1].tn;
					if(t!=-1&&t>=next) continue;
				}
				
				int tsp=d.sp;
				if(tsp&(1<<next)) tsp-=(1<<next);
				else 			  tsp|=(1<<next);
				
				if(h[tsp][d.p]) continue;
				h[tsp][d.p]=1;
				
				q.push(Dct(next, 1, d));
			}
		}
		
		if(st==0) puts("You can not switch off all lights.");
		if(st==-1) puts("Help me!");
	}
}

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


#include "boost/multiprecision/cpp_int.hpp"
#include "boost/multiprecision/cpp_dec_float.hpp"
namespace mp = boost::multiprecision;
typedef mp::cpp_int LL;
typedef mp::number<mp::cpp_dec_float<1024>> DD;// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)

 
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define rrep(i,r,l) for(ll i=r;i>=l;i--)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"
#define SORT(v) sort(v.begin(),v.end())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define POSL(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define POSU(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
template<class T,class S>
inline bool chmax(T &a, S b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T,class S>
inline bool chmin(T &a, S b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

void mod_print(ll k){
    ll P=1000;
    rep(y,1,P){
        ll x=mod(y*k);
        if(x+P>=i_7){
            x-=i_7;
        }
        if(abs(x)<=P){
            cout<<x<<"/"<<y<<endl;
            return;
        }
    }
    cout<<"nun"<<endl;
}
#define all(c) c.begin(),c.end()
//////////////////////////

#define N 1000
bool a[N];
int main(){fastio
    
    ll x,n;cin>>x>>n;
    rep(i,0,n-1){
        ll c;cin>>c;
        a[c]=true;
    }
    ll mi=0;
    rep(i,1,N-1){
        if(a[i])continue;
        if(abs(i-x)<abs(mi-x))mi=i;
    }
    cout<<mi;
    
    return 0;
}


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

int main() {
	char a; cin >> a;
	if(a=='A') cout << 'T' << endl;
	else if(a=='T') cout << 'A' << endl;
	else if(a=='C') cout << 'G' << endl;
	else cout << 'C' << endl;
}

Measured memory_bytes: 256
import numpy as np

N = int(raw_input())
A = [0] * N
for idx in xrange(N):
  A[idx] = int(raw_input())
total =  0
pre = 0
for item in A:
  total += (item+pre) / 2
  if item == 0:
    pre = 0
  else:
    pre = (item+pre) % 2

print total

Measured memory_bytes: 22604
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

a,b = na()
ans = -1
for i in range(1, 1001):
    if a == math.floor(i * 0.08) and b == math.floor(i * 0.10):
        ans = i
        break
print(ans)


Measured memory_bytes: 10848
from bisect import bisect_left, bisect_right

maxA = 10**5

N, M = map(int, input().split())
As = list(map(int, input().split()))

As.sort()

def isOK(v):
    num = 0
    for A in As:
        i = bisect_left(As, v-A)
        num += N-i
    return num >= M

ng, ok = 2*maxA+1, 0
while abs(ok-ng) > 1:
    mid = (ng+ok) // 2
    if isOK(mid):
        ok = mid
    else:
        ng = mid

accRevAs = [As[-1]]
for A in reversed(As[:-1]):
    accRevAs.append(accRevAs[-1]+A)
accRevAs.reverse()

v = ok
ans = 0
numGt = 0
#numEq = 0
for A in As:
#    iL = bisect_left(As, v-A)
    iR = bisect_right(As, v-A)
    if iR < N:
        ans += accRevAs[iR] + A*(N-iR)
    numGt += N-iR
#    numEq += iR-iL

ans += v * (M-numGt)
print(ans)


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

using namespace std;

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

    vector<size_t> flag(M, 0);
    vector<size_t> seq;

    seq.reserve(M);
    size_t pri_X = X;
    size_t n1 = 1;
    size_t n2 = N;
    for (size_t n = 1; n <= N; ++n)
    {
        size_t A = (n == 1) ? X : (pri_X * pri_X) % M;

        if (flag[A] > 0)
        {
            n1 = flag[A];
            n2 = n;
            break;
        }

        seq.push_back(A);
        flag[A] = n;
        pri_X = A;
    }

    vector<size_t> head, roop, tail;

    head.assign(seq.begin(), seq.begin() + (n1 - 1));
    roop.assign(seq.begin() + (n1 - 1), seq.end());
    size_t hlen = head.size();
    size_t rlen = roop.size();

    size_t num  = (N - hlen) / rlen;
    size_t rest = N - hlen - rlen * num;

    size_t out = 0;
    for (size_t i = 0; i < roop.size(); ++i) { out += roop[i]; };

    out *= num;
    for (size_t i = 0; i < head.size(); ++i) { out += head[i]; };
    for (size_t i = 0; i < rest; ++i) { out += roop[i]; };


    cout << out << endl;


    return 0;
}


Measured memory_bytes: 4716
#include<stdio.h>

int main(){

   int a, b;

   scanf("%d %d", &a, &b);

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

   return 0;
}

   


Measured memory_bytes: 2068
#include <stdio.h>

int main() {
    unsigned long long int p = 1;
    int n;

    scanf("%d", &n);

    for (int i = 1; i <= n; i++) {
        p = (p * i) % 1000000007;
    }
    printf("%llu\n", p);
    return 0;
} 


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ios ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define endl '\n'
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
bool sortbysec(const pair<int,int>&a,const pair<int,int>&b)
{
    return (a.second<b.second);
}
int main()
{
    ios;
    int n;
    cin>>n;
    map<string,int>m;
    string s;
    while(n--)
    {
        cin>>s;
        m[s]++;
    }
    cout<<"AC x "<<m["AC"]<<endl;
    cout<<"WA x "<<m["WA"]<<endl;
    cout<<"TLE x "<<m["TLE"]<<endl;
    cout<<"RE x "<<m["RE"]<<endl;






}




































































Measured memory_bytes: 3672
#include <bits/stdc++.h>
typedef long long int ll;

using namespace std;
const int N=2*1e5+5;
vector<vector<int>>g(N);
vector<int>h(N);
multiset<int>s;
int ans[N];

void dfs(int node,int p=0)
{
	
	s.insert(h[node]);
	int prev=-1;
	auto it=s.lower_bound(h[node]);
	if(++it!=s.end())
	{
		prev=*it;
		s.erase(it);
	}
	ans[node]=s.size();
	for(int v:g[node])
	{
		if(v!=p)
		dfs(v,node);
	}
	   
	   
	if(prev!=-1)
	s.insert(prev);
	
	s.erase(s.find(h[node]));
	
	
}
int main() {
	// your code goes here
	int t;
	t=1;
	///solve();
	while(t--)
	{
		int n;
		cin>>n;
		for(int i=1;i<=n;i++)
		{
			cin>>h[i];
			
		}
		
		for(int i=1;i<n;i++)
		{
			int u,v;
			cin>>u>>v;
			g[u].push_back(v);
			g[v].push_back(u);
		}
		dfs(1);
	//	cout<<n<<"\n";
		for(int i=1;i<=n;i++)
		cout<<ans[i]<<"\n";
		
		
			
	
		
	}
	return 0;
}

Measured memory_bytes: 29948
import java.util.Scanner;
import java.lang.Math;
public class Main{
  public static void main(String[] args){
	Scanner a = new Scanner(System.in);
    long x = a.nextLong();
    long y = a.nextLong();
    long z = x%y;
    System.out.println(Math.min(z,Math.abs(y-z)));
  }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
  int n;
  cin >> n;

  vector<int> nums;
  int sum = 0;
  int w;
  for (int i = 0; i < n; i++)
  {
    cin >> w;
    nums.push_back(w);
    sum += w;
  }

  int sub1 = 0;
  int sub2 = sum;
  int res = sum;

  for (int i = 0; i < n; i++)
  {
    sub1 += nums[i];
    sub2 -= nums[i];

    res = min(res, abs(sub1 - sub2));
  }

  cout << res << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    int N;
    cin >> N;
    map<string,int>Map;
    int cnt = 0;
    vector<string>S(N);
    for(int i = 0; i < N; i++) {
        cin >> S[i];
        Map[S[i]]++;
        cnt = max(cnt,Map[S[i]]);
    }
    sort(S.begin(),S.end());
    for(int i = 0; i < N; i++) {
        if(Map[S[i]] == cnt) {
            cout << S[i] << endl;
            Map[S[i]] = 0;
        }
    }
}


Measured memory_bytes: 25100
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
using namespace std;

int main() {
    int len;
    cin >> len;
    char a[len], b[len];
    cin >> a >> b;
    for (int i = 0; i < len; i++) {
        cout << a[i] << b[i];
    }

    return 0;
}


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

const int MAX_N = 10000000;
bool flag[MAX_N];
typedef long long int ll;

vector<ll> eratosthenes(int n) {
  vector<ll>vec;
  for(int i = 0 ; i < MAX_N ; i++){
    flag[i] = false;
  }
  for(int i = 2 ; i < MAX_N ; i++){
    if(flag[i])continue;
    vec.push_back(i);
    flag[i] = true;
    for(int j = i+i ; j < MAX_N ; j += i){
      flag[j] = true;
    }
  }
  return vec;
}

int main(){
  ll x,y;
  vector<ll> primes = eratosthenes(MAX_N);
  cin >> x >> y;
  if(x % y == 0){
    cout << -1 << endl;
    return 0;
  }
  ll prime = 2;
  for(int i = 0 ; i < primes.size() ; i++){
    if(x % primes[i] != 0 && y % primes[i] != 0){
      prime = primes[i];
      break;
    }
  }
  cout << prime * x << endl;
  return 0;
}


Measured memory_bytes: 21224
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <bitset>
#include <iomanip>
#include <deque>
#include <tuple>
#include <algorithm>

using namespace std;

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

    cout << "ABC" << a << endl;
}


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

#define MAX 500005

int main(int, char**)
{
  int n, k;
  cin >> n >> k;

  vector<int> a(n);
  rep(i,n) { cin >> a[i]; --a[i]; }

  int l = 0, r = 0, kind = 0;
  int ans = n + 1;
  map<int, int> count;
  for (;;) {
    while (r < n && kind < k) {
      if (a[r] < k && count[a[r]]++ == 0) kind++;
      r++;
    }
    if (kind < k) break;
    ans = min(ans, r-l);
    if (a[l] < k && --count[a[l]] == 0) kind--;
    l++;
  }
  if (ans > n) ans = 0;
  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 7776
#include <iostream>
using namespace std;
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <vector>
#define MOD 1000000007
using namespace std;
typedef long long ll;
ll kai[700001], inv[700001];
int n, k;
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 /= 2;
  }
  return res;
}
void init() {
  kai[0] = 1LL;
  for (ll i = 1LL; i <= 700000; i++) {
    kai[i] = kai[i - 1] * i;
    kai[i] %= MOD;
  }
  inv[700000] = mod_pow(kai[700000], MOD - 2LL, MOD);
  for (ll i = 699999; i >= 0; i--) {
    inv[i] = inv[i + 1] * (i + 1);
    inv[i] %= MOD;
  }
}

ll comb(ll r, ll c) {
  ll res;
  res = kai[r];
  res *= inv[c];
  res %= MOD;
  res *= inv[r - c];
  res %= MOD;
  return res;
}

int main() {
  ll x, y, d;
  cin >> x >> y;
  d = x + y;
  d /= 3LL;
  if ((x + y) % 3 || x < d || y < d) {
    cout << 0 << endl;
    return 0;
  }
  init();
  if (x < y) {
    x ^= y;
    y ^= x;
    x ^= y;
  }
  cout << comb(d, (d - (x - y)) / 2LL) << endl;
}

Measured memory_bytes: 11136
N, M = map(int,input().split())
A = [int(a) for a in input().split()]

abc = [(A[i],1) for i in range(N)]

for j in range(M):
    B, C = map(int, input().split())
    abc.append((C,B))
    
abc.sort()
abc.reverse()

ans = 0
cnt = N

for (c,b) in abc:
    num_c = min(b,cnt)
    ans += num_c * c
    cnt -= num_c

print(ans)

Measured memory_bytes: 29304
#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
#pragma GCC optimize("Ofast")

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
#define int long long int
typedef complex<long double> cd;
const long double pi=acos(-1);
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <db, db> pdd;
typedef vector<int> vi;
typedef vector<vector<int> > matrix;

#define m1 make_pair
#define pb push_back
#define flush fflush(stdout)
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define reset(x,v) memset(x,v,sizeof(x))

#define fi first
#define se second
#define endl "\n"
#define debug(x) (cerr << #x << ": " << x << "\n")
#define setbits(x) __builtin_popcount(x)
#define setbitsll(x) __builtin_popcountll(x)
#define all(x) x.begin(),x.end()
#define pii pair<int,int>

inline ll gcd(ll a,ll b){if(a==0) return b;return gcd(b%a,a);}
inline ll power(ll a,ll n,ll m){if(n==0)return 1;ll p=power(a,n/2,m);p=(p%m*p%m)%m;if(n%2) return (p%m*a%m)%m;else return p;}
const double EPS = 1e-9;
const ll MOD =998244353;
const ll hell=1000000007;
const int INF = 1e18;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
template<typename T>
using ordered_set=tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

auto seed = chrono::high_resolution_clock::now().time_since_epoch().count();
std::mt19937 rng(seed);

double startTime;
double getCurrentTime() {
    return ((double)clock() - startTime) / CLOCKS_PER_SEC;
}
const int dx[] = { -1, 0, 1, 0 };
const int dy[] = { 0, 1, 0, -1 };

const int N=1000005;
int cnt[N+1];

void solve()
{

int n;
cin>>n;
int g=0;
int a[n];
for(int i=0;i<n;i++)
{
    cin>>a[i];
    g=gcd(g,a[i]);
    cnt[a[i]]++;
}
for(int i=1;i<=N;i++)
{
    for(int j=2*i;j<=N;j+=i)
    cnt[i]+=cnt[j];
    cnt[i]=(cnt[i]*(cnt[i]-1))/2;
}
for(int i=N;i>=1;i--)
{
    for(int j=2*i;j<=N;j+=i)
    cnt[i]-=cnt[j];
}


if(cnt[1]!=((n*(n-1)/2)))
{
    if(g==1)
    {
        cout<<"setwise coprime"<<endl;
        return;
    }
    else
    {
        cout<<"not coprime"<<endl;
        return;
    }
    
}
cout<<"pairwise coprime"<<endl;



}

int32_t main()
{
   IOS;
    int t;
    t=1;
    //cin>>t;
    
    while(t--)
    {
       
        
        solve();
    }
    return 0;
}






Measured memory_bytes: 19272
A = [[[0 for i in range(10)] for i in range(3)] for i in range(4)]

info = int(input())
for i in range(info):
    b,f,r,v = [int(i) for i in input().split()]
    A[b-1][f-1][r-1] += v
    if A[b-1][f-1][r-1] < 0:
        A[b-1][f-1][r-1] = 0
    elif A[b-1][f-1][r-1] > 9:
        A[b-1][f-1][r-1] = 9

for i in range(3):
    print(' '+' '.join([str(i) for i in A[0][i]]))
print('#'*20)
for i in range(3):
    print(' '+' '.join([str(i) for i in A[1][i]]))
print('#'*20)
for i in range(3):
    print(' '+' '.join([str(i) for i in A[2][i]]))
print('#'*20)
for i in range(3):
    print(' '+' '.join([str(i) for i in A[3][i]]))

Measured memory_bytes: 7732