akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define _p(...) (void)printf(__VA_ARGS__)
#define forr(x,arr) for(auto&& x:arr)
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) _rep3(i,0,n)
#define _rep3(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2,)(__VA_ARGS__)
#define _rrep2(i,n) _rrep3(i,0,n)
#define _rrep3(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2,)(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()
#define bit(n) (1LL<<(n))
#define sz(x) ((int)(x).size())
#define fst first
#define snd second
using ll=long long;
using pii=pair<int,int>;using pll=pair<ll,ll>;using pil=pair<int,ll>;using pli=pair<ll,int>;
using vs=vector<string>;using vvs=vector<vs>;using vvvs=vector<vvs>;
using vb=vector<bool>;using vvb=vector<vb>;using vvvb=vector<vvb>;
using vi=vector<int>;using vvi=vector<vi>;using vvvi=vector<vvi>;
using vl=vector<ll>;using vvl=vector<vl>;using vvvl=vector<vvl>;
using vd=vector<double>;using vvd=vector<vd>;using vvvd=vector<vvd>;
using vpii=vector<pii>;using vvpii=vector<vpii>;using vvvpii=vector<vvpii>;
template<class T,class U>istream&operator>>(istream&is,pair<T,U>&P){is>>P.fst;is>>P.snd;return is;}
template<class T>T read(){T t;cin>>t;return t;}
template<class T,class U>ostream&operator<<(ostream&o,const pair<T,U>&p){return o<<'('<<p.fst<<", "<<p.snd<<')';}
template<class T>ostream&operator<<(ostream&o,const vector<T>&t){o<<"{";rep(i,sz(t))o<<t[i]<<",";o<<"}"<<endl;return o;}
vs s_p_l_i_t(const string&s,char c){vs v;stringstream ss(s);string x;while(getline(ss,x,c))v.emplace_back(x);return move(v);}
void e_r_r(vs::iterator it){cerr<<endl;}
template<class T,class... Args>void e_r_r(vs::iterator it,T a,Args... args){cerr<<it->substr((*it)[0]==' ',it->length())<<" = "<<a<<", ";e_r_r(++it,args...);}
#define out(args...){vs a_r_g_s=s_p_l_i_t(#args,',');e_r_r(a_r_g_s.begin(),args);}

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

void Main() {
  int n = read<int>();
  int ma = read<int>();
  int mb = read<int>();

  int inf = 1e9;
  vvi dp(401, vi(401, inf));

  int ma_a = 0;
  int ma_b = 0;

  dp[0][0] = 0;

  rep(_, n) {
    int a = read<int>();
    int b = read<int>();
    int c = read<int>();
    rrep(i, ma_a+1) rrep(j, ma_b+1) if (dp[i][j] < inf) {
      amin(dp[i+a][j+b], dp[i][j] + c);
      ma_a = max(ma_a, i+a);
      ma_b = max(ma_b, j+b);
    }
  }

  int ans = inf;

  rep(a, 1, 401) {
    int bA = a * mb;
    if (bA % ma == 0) {
      int b = bA / ma;
      if (b < 0) continue;
      if (b > 400) continue;
      ans = min(ans, dp[a][b]);
    }
  }

  if (ans >= inf) cout << -1 << endl;
  else cout << ans << endl;
}
int main() { cin.tie(nullptr); ios::sync_with_stdio(false); Main(); return 0; }


Measured memory_bytes: 896
//#include <sstream>
//#include <fstream>
//#include <deque>
//#include <queue>
//#include <stack>
//#include <set>
//#include <list>
//#include <map>
//#include <unordered_map>
//#include <functional>
//#include <utility>
//#include <bitset>
//#include <cstdlib>
//#include <ctime>
//#include <cstdio>


#include <stdlib.h>
#include <iostream>
//#include <chrono> //clock
//#include <vector>
#include <string>
#include <iomanip>  //setprecision function
//#include <cmath>	//math
//#include <cstdio>
//#include <vector>	//vector array
//#include <algorithm>	//STL algorithm
//#include <set> //STL library set
//#include <sstream> // for stringstream


using namespace std;
//using namespace std::chrono; 



//c++ templte for help...........................................................

//#define deb(x) cout<<#x<<" "<<x<<endl;/* for debuging  printing variable with name*/
//#define debb(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;										
//#define debbb(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;			

//typedef long long ll;

	
//for taking multiple input
//template<typename... T>
//void input(T&... t){
	//((cin>>t),...);
	//}
	
//for loop
//#define fo(i,n) for(ll i=0;i<(ll)n;i++)
//#define Fo(i,k,n) for(ll i=k;i<n;i++)


//to print vector element 
//template<typename T>
//void printV(T vec){
		//fo(i,vec.size()) cout<<vec[i]<<" "<<flush;
	//}
	







//c++ template for help........................................................


int main() {
	//stringstream ss;
	//ss<<"akhil";
	//cout<<ss.str()<<endl;
	cout<<setprecision(16);
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	
	 // TESTCASE KO DEKH KA BHAUT SARA CONDITION GENERATE MAT KRO 
	 // PAPER PD CONFIRM HO JAO THORA JADA TIME HI KYU NA LGA
	 
	 // WHILE DOING THE QUESTION OF DYNAMIC PROGRAMMING GREEDY KA TRAH SOCHNA BAND KRO
	 // DP M DATA KA BHI USE KRNA PDTA HA BE BHULO MT 
	 // DP BHI WO LEETCODE WALE MATRIX KA QUESTION KI TARAH HA
	 // CONSTRAIN WILL BE THE DIMENSION OF DP
	 // DP MA STATE PTA KRO AUR PHIR FUNCTION GENERATE KRO
	 // OBJECT KO CHOOSE KIA YA NAE KIA AGAR KIA TO KYA HOGA AUR NAE KIA TO KYA HOGA
	 // KYA KYA CHEJ IMPORTANT HA WO STATE BN JYAGA AUR HUM LOG STATE KO CHANGE KR SKTA HA JYSA KNPSACK 2 WALE PROBLEM MA KIA THA
	 

	double r;
	cin>>r;
	cout<<2*3.141592653589793238*r<<endl;












	
	
	return 0;
}





























Measured memory_bytes: 3792
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		List<int>[] E = new List<int>[N];
		for(int i=0;i<N;i++) E[i] = new List<int>();
		for(int i=0;i<N;i++){
			for(int j=0;j<N;j++){
				if(S[i][j] == '1') E[i].Add(j);
			}
		}
		int[] bw = new int[N];
		for(int i=0;i<N;i++) bw[i] = -1;
		var q = new Queue<int>();
		bw[0] = 0;
		q.Enqueue(0);
		while(q.Count > 0){
			var now = q.Dequeue();
			foreach(var nxt in E[now]){
				if(bw[nxt] == -1){
					bw[nxt] = bw[now] ^ 1;
					q.Enqueue(nxt);
				} else if(bw[nxt] == bw[now]){
					Console.WriteLine(-1);
					return;
				}
			}
		}
		
		int ma = 0;
		for(int i=0;i<N;i++){
			int[] dep = new int[N];
			for(int j=0;j<N;j++) dep[j] = -1;
			dep[i] = 0;
			q = new Queue<int>();
			q.Enqueue(i);
			while(q.Count > 0){
				var now = q.Dequeue();
				foreach(var nxt in E[now]){
					if(dep[nxt] == -1){
						dep[nxt] = dep[now] + 1;
						q.Enqueue(nxt);
					}
				}
			}
			//Console.WriteLine(String.Join(" ",dep));
			for(int j=0;j<N;j++){
				ma = Math.Max(dep[j] + 1, ma);
			}
		}
		
		Console.WriteLine(ma);
		
		
		
	}
	int N;
	String[] S;
	public Sol(){
		N = ri();
		S = new String[N];
		for(int i=0;i<N;i++){
			S[i] = rs();
		}
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 13396
#include<iostream>
#include<string>
#include<cmath>
#include<cstdlib>
#include<vector>
#include<map>
#include<set>
#include<algorithm>

using namespace std;

int main(){
  int n;
  cin>>n;
  string s;
  cin>>s;
  int ans = 0;
  for(int i=0;i<n;i++){
    int tmp[2][30];
    for(int j=0;j<2;j++){
      for(int k=0;k<30;k++)tmp[j][k]=0;
    }
    for(int j=0;j<i;j++)tmp[0][s[j]-'a']++;
    for(int j=i;j<n;j++)tmp[1][s[j]-'a']++;
    int cnt = 0;
    for(int j=0;j<30;j++){
      if((tmp[0][j]>0) && (tmp[1][j]>0))cnt++;
    }
    //for(int j=0;j<2;j++){
    //  for(int k=0;k<n;k++)cout<<tmp[j][k]<<" ";cout<<endl;
    //}cout<<endl;
    ans = max(ans,cnt);
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
a = int(input())
b = int(input())
c = int(input())
x = int(input())

ans = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if x == 500*i+100*j+50*k:
                ans += 1

print(ans)

Measured memory_bytes: 3060
import java.util.*;

public class Main {
    public static void main(String[] args){
        ABC161A();
    }
    private static void ABC161A() {
        // no comment, no error check
        final int INPUT_LINES_CNT = 1;
        final String DATA_SPLIT_SPACE = " ";

        ArrayList<String> inputLines = getStdInMultiLines(INPUT_LINES_CNT);

        if (inputLines.size() == 0) {
            System.out.println(0);
            return;
        }

        List<String> inputLineList= 
        Arrays.asList((inputLines.get(0)).split(DATA_SPLIT_SPACE));

        System.out.println(inputLineList.get(2) + " " + inputLineList.get(0) + " " + inputLineList.get(1) + " ");
        return;
    }

    private static int getStdInNum() {
        String line1 = getStdInSingleLine();
        if (isNumber(line1)) {
            return Integer.parseInt(line1);
        }
        return 0;
    }

    private static ArrayList<String> getStdInMultiLines() {
        int cnt = 0; 
        int max = 0;

        Scanner cin = new Scanner(System.in);
        ArrayList<String> list = new ArrayList<String>();
        for (;cin.hasNext();) {
            list.add(cin.nextLine());
            if (cnt++ == 0) {
                max = Integer.parseInt((list.get(0)).split(" ")[0]);
            }
            else if (cnt == max + 1) {
                break;
            }
        }
        cin.close();
        return list;
    }
    private static ArrayList<String> getStdInMultiLines(int inputLinesCnt) {
        int cnt = 0; 

        Scanner cin = new Scanner(System.in);
        ArrayList<String> list = new ArrayList<String>();
        for (;cin.hasNext();) {
            list.add(cin.nextLine());
            if (++cnt == inputLinesCnt) {
                break;
            }
        }
        cin.close();
        return list;
    }

    private static String getStdInSingleLine() {
        Scanner cin = new Scanner(System.in);

        for (;cin.hasNext();) {
            cin.close();
            return cin.nextLine();
        }

        cin.close();
        return "";
    }

    private static boolean isNumber(String val) {
        try {
            Integer.parseInt(val);
            return true;
        }
        catch (NumberFormatException nfex) {
            return false;
        }
    }

    private static List<Integer> toArrayInteger(List<String> array) {
        try {
            List<Integer> list = new ArrayList<Integer>(array.size());
            for (int i = 0; i < array.size(); i++) {
                list.add(Integer.valueOf(array.get(i)));
            }
            return list;
        }
        catch (NumberFormatException nfex) {
            return new ArrayList<Integer>();
        }
    }
}


Measured memory_bytes: 23764
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
		int n = int.Parse(Console.ReadLine());
    long answer = 0;

    for(int i = 1; i <= 1000000; i++)
    {
      answer += (n-1)/i;
    }

		Console.WriteLine(answer);
	}
}

Measured memory_bytes: 27524
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         fozubaoyou    pass System Test!
*/
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define int long long
#define pb push_back
using ll = long long;
using namespace std;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

signed main(){
  int N = 0;
  int temp = 0;
  int pre = 0;
  int ans = 0;
  cin >> N;
  cin >> pre; //B[0] = pre
  ans = pre;
  REP(i,N-2){
    cin >> temp;
    if(pre <= temp){
      ans = ans + pre;
    }else{
      ans = ans + temp;
    }
    pre = temp;
  }
  ans = ans + pre;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
s = gets.chomp
max = 0
l = s.size - 1
(0..s.size).each do |i|
  sub_str = s[i..l]
  if sub_str == nil
    break
  end
  if m = /[ACGT]+/.match(sub_str)
    size = m[0].size
    if max < size
      max = size
    end
  end
end
puts max


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

using namespace std;

#define pb push_back
#define fs first
#define sc second
#define sz size
#define forn(i, n) for (ll i = 0; i < (ll) (n); ++i)
#define forni(i, n) for (ll i = 1; i <= (ll) (n); ++i)
#define IO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

using ll = long long;
const ll inf = 1e9+5; 

const double PI =  3.141592653589793;

int main(){
	IO;
	ll x,a;
	cin>>x>>a;
	(x<a)?cout<<"0\n":cout<<"10\n";
	return 0;
}

// _   .-')                .-. .-')                 .-')                                               
//( '.( OO )_              \  ( OO )               ( OO ).                                             
// ,--.   ,--.).-'),-----. ,--. ,--.  .-'),-----. (_)---\_) ,--. ,--.     .-----.  ,-.-')  .-'),-----. 
// |   `.'   |( OO'  .-.  '|  .'   / ( OO'  .-.  '/    _ |  |  | |  |    '  .--./  |  |OO)( OO'  .-.  '
// |         |/   |  | |  ||      /, /   |  | |  |\  :` `.  |  | | .-')  |  |('-.  |  |  \/   |  | |  |
// |  |'.'|  |\_) |  |\|  ||     ' _)\_) |  |\|  | '..`''.) |  |_|( OO )/_) |OO  ) |  |(_/\_) |  |\|  |
// |  |   |  |  \ |  | |  ||  .   \    \ |  | |  |.-._)   \ |  | | `-' /||  |`-'| ,|  |_.'  \ |  | |  |
// |  |   |  |   `'  '-'  '|  |\   \    `'  '-'  '\       /('  '-'(_.-'(_'  '--'\(_|  |      `'  '-'  '
// """    """     """""""" """  """"      """""""  """""""  """"""""      """"""   """         """""""


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long n,m,b,e;
    cin>>n;
    long long a[n];
    for(long long i=0;i<n;i++){
        cin>>a[i];
    }
    cin>>m;
    for(long long i=0;i<m;i++){
        cin>>b>>e;
        reverse(a+b,a+e);
    }
    for(long long i=0;i<n-1;i++){
        cout<<a[i]<<" ";
    }
    cout<<a[n-1]<<endl;
    return 0;
}


Measured memory_bytes: 3120
// AOJ 2088: Spirograph
// 2017.11.21 bal4u@uu

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

#define PI 3.1415926535897932384626433832795
#define DIV_NUM 10000
int P, Q, R;
double a, b, c;

int gcd(int a, int b)
{
	int r;
	while (b != 0) r = a % b, a = b, b = r;
	return a;
}

double f(double x) 
{
	return sqrt(a*(b-c*cos(P*x/Q)));
}

int main()
{
	int i, g;
	double h, h2, ans, x, xmin, xmax;

	while (scanf("%d%d%d", &P, &Q, &R) && P > 0) {
		if (R == 0) { printf("%.10lf\n", 2*PI*(P-Q)); continue; }
		g = gcd(P-Q, Q), xmin = 0, xmax = 2*PI*Q/g;

		b = Q*Q;
		a = (P-Q)*(P-Q), a /= b;	// a = (p-q)^2 / q^2
		b += R*R;					// b = q^2 + r^2
		c = 2*Q*R;					// c = 2 * q * r

		h = (xmax - xmin) / (2.0*DIV_NUM), h2 = 2*h;
		x = xmin;
		ans = f(x);
		for (i = 1; i < DIV_NUM; i++) {
			ans += 4*f(x+h) + 2*f(x+h2);
			x += h2;
		}
		ans += 4*f(x+h) + f(x+h2);
		ans *= h/3; 
		printf("%.10lf\n", ans);
	}
	return 0;
}

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

#define LL long long
#define Dl double
#define Pb push_back
#define Po pop_back
#define Mp make_pair
#define Ub upper_bound
#define Lb lower_bound
#define In insert
#define All(x) x.begin(), x.end()
#define mem(a, b) memset(a, b, sizeof(a))
#define fast ios_base::sync_with_stdio(0);cin.tie(0)

using namespace std;

typedef vector<LL> Vl;
typedef vector<Vl> VVl;
typedef pair<LL, LL> Pll;
typedef vector<Pll> Vpl;
typedef queue<LL> Ql;
typedef stack<LL> Sl;
#define X first
#define Y second
#define mx3 1010
#define mx4 10010
#define mx5 100010
#define mx6 1000010

VVl g;
bool vis[12];
LL n, m;

LL dfs(LL u)
{
    LL x = 0;
    for(LL i = 1; i <= n; i++)
        if(vis[i])
            x++;

    if(x == n)
        return 1;

    LL ans = 0;
    for(auto i: g[u]){
        if(!vis[i]){
            vis[i] = true;
            ans += dfs(i);
            vis[i] = false;
        }
    }

    return ans;
}

int main()
{
    //freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);

    cin >> n >> m;

    g.resize(n + 5);
    for(LL i = 0; i < m; i++){
        LL a, b;
        cin >> a >> b;

        g[a].Pb(b);
        g[b].Pb(a);
    }

    vis[1] = true;
    cout << dfs(1) << '\n';
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int x,s=0;
    cin>>x;

    if(x == 0)
    {
        cout<<0<<endl;
    }
    else
    {
      while(x>4)
      {

          if(x>=500)
          {
              x-=500;
              s+=1000;
          }
          else
            {
                x-=5;
                s+=5;
            }
      }
      cout<<s<<endl;
    }

   return 0;
}


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

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

using namespace std;

using ll = long long;
using P = pair<int , int>;
  
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  int a[5]; rep(i, 5) cin >> a[i];
  int mark, num = 9;
  rep(i, 5) {
    if(a[i] % 10 < num && a[i] % 10 != 0) {
      mark = i; num = a[i] % 10;
    }
  }
  int ans = 0;
  rep(i, 5) {
    if(i != mark) ans += a[i] + (a[i] % 10 != 0) * 10 - a[i] % 10;
    else ans += a[i];
  }cout << ans;
}


Measured memory_bytes: 256
n=int(input())
c=list(map(int, input().split()))
ans = 1
mod = 10**18

if 0 in c:
    print(0)
else:
    for i in c:
        ans = ans*i
        if ans <= mod:
            pass
        else:
            print('-1')
            break
    if ans <= mod:
        print(ans)

Measured memory_bytes: 21536
#include <stdio.h>
#include <math.h>

int cul(int r);

int  main(void){
	int r,m;
	scanf("%d",&r);
	m = cul(r);
	printf("%d\n",m);
	return 0;
}


int cul(int r){
	int m;
	m = int(3 * pow(double(r),2.0));
	return m;
}

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


int N, M;
vector<int> P, Y;


void input() {
    cin >> N >> M;
    P = Y = vector<int>(M);
    rep(i, M) cin >> P[i] >> Y[i];
}


int main() {
    input();
    vector<pair<int, int>> w(M);
    rep(i, M) w[i] = make_pair(Y[i], i);
    sort(w.begin(), w.end());
    vector<int> num(N, 1);
    vector<int> X(M);
    for (auto p : w) {
        int i = p.second;
        X[i] = num[P[i]-1]++;
    }
    rep(i, M) {
        cout << setw(6) << setfill('0') << P[i];
        cout << setw(6) << setfill('0') << X[i] << endl;   
    }
}


Measured memory_bytes: 3840
// Author: HarshKumar

#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
const ll N = 1e6 + 6, M = 1e9 + 7;
int main()
{
    ios::sync_with_stdio(false), cin.tie(nullptr);
    string s;
    cin >> s;
    if (s.back() == 's')
        s += 'e';
    cout << s + 's';
}

Measured memory_bytes: 3656
#include <stdio.h>

int main(void)
{
	int N, D, X, A[100];
	int goukei = 0;

	scanf("%d %d %d", &N, &D, &X);

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

	for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= D; j+= A[i]) {
			goukei++;
		//	printf("%d %d %d\n", i, j, goukei);
		}
	}
	printf("%d", goukei + X);

	//system("pause");

	return 0;
}

Measured memory_bytes: 128
import java.io.*;
import java.util.*;
import java.math.*;
import java.util.concurrent.ThreadLocalRandom;
public class Main 
{
	
	static long gcd(long a, long b) 
	{
		if (b == 0)
		{	
			return a;
		}
		
		else
		{
			 return gcd(b, a % b);
		}
	}
	public static void main(String[] args) throws Exception
	{

		
		   PrintWriter out = new PrintWriter(System.out);
		   Scanner in = new Scanner(System.in);
		 // long n , k , q;
		  
		int n;
		n = in.nextInt();
		//b = in.nextInt();
		int cnt = 0;
		boolean flag = true;
		HashSet<Integer> s = new HashSet<Integer>(); 
		int kk[] = new int[n];
		int a[] = new int[n];
		for(int i = 0; i < n; i++)
		{
			
			a[i] = in.nextInt();
		    kk[a[i]]++;
		}
	//	for(int i = 0; i < n; i++) out.print(kk[i] + " ");
		if( n % 2 == 0)
		for(int i = 0; i < n; i++)
		{
			
			if(kk[i]!= 2&& kk[i]!= 0) flag = false;
		}
		else 
		for(int i = 1 ; i < n; i++)
		{
			
			if(kk[i]!= 2 && kk[i]!= 0) flag = false;
		}
	  if( n % 2 != 0)if(kk[0] != 1) flag = false;
		cnt = 1;
		int i = 0;
		while(i < n / 2){ cnt = cnt * 2 % (1000000000 + 7);i++;}
		if(flag)
		out.println(cnt);
		else out.println(0);
	
		
//		for(int i = 0; i < n; i++)
//		{
//			sum += t[i];
//		}
//		out.println(sum);
	   out.close();
	}
}

Measured memory_bytes: 33416
module Main where

import Control.Applicative
import Numeric
import Data.List (transpose)

main :: IO ()
main = do
  { [r, c] <- getInts
  ; mat <- loop r
  ; mapM_ putInts (hoge mat)
  }

loop :: Int -> IO [[Int]]
loop 0 = return []
loop r = do
  { xs <- getInts
  ; xss <- loop (r-1)
  ; return (xs : xss)
  }

hoge :: [[Int]] -> [[Int]]
hoge = transpose . map addSum . transpose . map addSum

addSum :: [Int] -> [Int]
addSum xs = xs ++ [sum xs]

--
getInts :: IO [Int]
getInts = map read . words <$> getLine

putInts :: [Int] -> IO ()
putInts = putStrLn . unwords . map show

getDoubles :: IO [Double]
getDoubles = map read . words <$> getLine

putDoubles :: [Double] -> IO ()
putDoubles = putStrLn . unwords . map showDouble

showDouble :: Double -> String
showDouble d = showFFloat Nothing d ""



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

vector<vector<int>> to;
vector<int> ans;
void dfs(int x, int p=-1) {
    for (int u : to[x]) {
        if (u == p) continue;
        ans[u] += ans[x];
        dfs(u,x);
    }
}

int main() {
    int n, q;
    cin >> n >> q;
    to.resize(n);
    rep(i,n-1) {
        int a, b;
        cin >> a >> b;
        --a; --b;
        to[a].push_back(b);
        to[b].push_back(a);
    }
    ans.resize(n);
    rep(i,q) {
        int p, x;
        cin >> p >> x;
        --p;
        ans[p] += x;
    }
    dfs(0);
    rep(i,n) {
        if (i != n-1) cout << ans[i] << " ";
        else cout << ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 23424
D,G = map(int,input().split())
pc = []
for i in range(D):
    p,c = map(int,input().split())
    pc.append([i+1,p,c])
pc.sort(reverse = True)
ansc = []
for i in range(2**D):
    count = 0
    sumb = 0
    pc2 = []
    for j in range(D):
        if (i >> j) & 1 == 1:
            sumb += 100*pc[j][0]*pc[j][1] + pc[j][2]
            count += pc[j][1]
        else:
            pc2.append(pc[j])
    pc2 = sorted(pc2,reverse = True)
    c2 = 0
    while sumb < G:
        sumb += 100*pc2[0][0]
        count += 1
        c2 += 1
        if c2 == pc2[0][1]:
            count = 10**9
            break
    ansc.append(count)
print(min(ansc))

Measured memory_bytes: 3064
object Main extends App {
  val in = scala.io.Source.stdin.getLines.toSeq
  val S = in.head
  val f = S.take(2).toInt
  val s = S.drop(2).toInt
  private def month(n:Int):Boolean = {
    1 <= n && n <= 12
  }
  val mx = month(f)
  val xm = month(s) 
  
  if(mx && xm) println("AMBIGUOUS")
  else if(xm) println("YYMM")
  else if(mx) println("MMYY")
  else if(!(mx || xm)) println("NA")
  else println("XXXXXXXXX")
}


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

int main() {
  int A, B, n=0;
  cin >> A >> B;
  for (int i=A; i<=B; i++) {
    int x0 = i/10000;
    int x1 = i/1000 - x0*10;
    int x2 = i%10;
    int x3 = (i%100 - x2)/10;
    if (x0==x2 && x1==x3) n++;
  }
  cout << n << endl;
}

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

int main(){
	int a,b;
  	cin>>a>>b;
  
  	if(a>b){
      	for(int i=0;i<a;++i)
          cout<<b;
    }
  	else
      for(int i=0;i<b;++i)
        cout<<a;
  	return 0;
}

Measured memory_bytes: 256
#include <iostream>
static const int N = 8;
using namespace std;
bool board[N][N];
int row[N], col[N], dpos[2 * N - 1], dneg[2 * N - 1];

void solve(int i)
{
    // cout<<i<<endl;
    if (i == N)
    {
        for (int i = 0; i < N; ++i)
        {
            for (int j = 0; j < N; ++j)
            {
                if (board[i][j] && row[i] != j) return;
            }
        }

        for (int i = 0; i < N; ++i)
        {
            for (int j = 0; j < N; ++j)
            {
                cout<<((row[i] == j) ? 'Q':'.');
            }
            cout<<endl;
        }
    }

    for (int j = 0; j < N; ++j)
    {
        if (col[j] == 1 || dpos[i+j] == 1 || dneg[i-j+N-1] == 1) continue; 
        row[i] = j;
        col[j] = dpos[i+j] = dneg[i-j+N-1] = 1;
        solve(i+1);
        row[i] = col[j] = dpos[i+j] = dneg[i-j+N-1] = -1;
    }
    return;
}


int main()
{
    int k;
    for (int i = 0; i < 8; ++i)
    {
        for (int j = 0; j < 8; ++j)
        {
            board[i][j] = false;
        }
    }
    for (int i = 0; i < N; ++i)
    {
        row[i] = -1;
        col[i] = -1;
    }
    for (int i = 0; i < 2 * N - 1; ++i)
    {       
        dpos[i] = -1;
        dneg[i] = -1;
    }
    cin>>k;
    for (int i = 0; i < k; i++)
    {
        int r,c;
        cin>>r>>c;
        board[r][c] = true;
    } 
    
    solve(0);

    return 0;
}

Measured memory_bytes: 3072
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>


using namespace std;

int main() {
    int n;  cin >> n;
    int *a = new int[n];
    int **x = new int*[n], **y = new int *[n];
    
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        x[i] = new int[a[i]];
        y[i] = new int[a[i]];
        for (int j = 0; j < a[i]; j++)
            cin >> x[i][j] >> y[i][j];
    }

    int ans = 0;

    for (int bit = 0; bit < (1<<n); bit++) {
        bool *check = new bool[n];
        vector<vector<int> > v(n);
        vector<int> S;
        for (int i = 0; i < n; i++) {
            if ((1<<i) & bit) {
                S.push_back(i);
            }
            else 
                v[i].push_back(0);
        }

        bool can = true;
        int sz = S.size();
        int j = 0;
        

        for (int i = 0; i < sz; i++) {
            v[S[i]].push_back(1);
            for(int j = 0; j < a[S[i]]; j++) {
                int t = x[S[i]][j]-1;
                v[t].push_back(y[S[i]][j]);
            }
        }

        int k = 0;
        for (int i = 0; i < n; i++) {
            int sz_ = v[i].size();

            
            for (int j = 0; j < sz_-1; j++) {
                
                if (v[i][j] != v[i][j+1]) {
                    can = false;
                    break;
                }
            }
            if (!can)
                break;
        }

        if (can)
            ans = max(ans, sz);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1280
def battle():
    condition = input()
    condition_list = condition.split()
    A = int(condition_list[0])
    B = int(condition_list[1])
    C = int(condition_list[2])
    D = int(condition_list[3])
    
    while True:
        C -= B
        if C <= 0:
            print('Yes')
            return
        
        A -= D
        if A <= 0:
            print('No')
            return

battle()

Measured memory_bytes: 9100
#include<bits/stdc++.h>
#define Tp template<typename Ty>
#define Ts template<typename Ty,typename... Ar>
#define Reg register
#define RI Reg int
#define Con const
#define CI Con int&
#define I inline
#define W while
#define N 200000
using namespace std;
int n;char s[N+5];
int main()
{
	RI i,t=0;long long ans=0;scanf("%s",s+1),n=strlen(s+1);
	for(i=n;i;--i) s[i]=='W'?++t:(ans+=t);return printf("%lld\n",ans),0;
}

Measured memory_bytes: 4016
#include <stdio.h>

constexpr int kN = int(5E3 + 10);
typedef long long int ll;

ll dp[kN];

int main() {
	int n, m, l, r, pos = 2;
	ll ans = 0;
	scanf("%d%d", &n, &m);
	for (int i = 0; i < n; i++) dp[i] = 1;
	l = 3;
	r = n;
	while (r > l) {
		for (int i = pos; i < n; i++) dp[i] = (dp[i] + dp[i - pos]) % m;
		for (int i = pos; i < n; i++) dp[i] = (dp[i] + dp[i - pos]) % m;
		l++;
		r--;
		pos++;
	}
	if (l == r) for (int i = pos; i < n; i++) dp[i] = (dp[i] + dp[i - pos]) % m;
	for (int i = 0; i < n; i++) ans += (n - i) * dp[i] % m;
	printf("%lld\n", ans % m);
}


Measured memory_bytes: 256
# coding: utf-8
#68

n = int(input())
C=[]
for i in range(n):
    C.append(input())
#print(C)
S=["S 1","S 2","S 3","S 4","S 5","S 6","S 7","S 8","S 9","S 10","S 11","S 12","S 13","H 1","H 2","H 3","H 4","H 5","H 6","H 7","H 8","H 9","H 10","H 11","H 12","H 13","C 1","C 2","C 3","C 4","C 5","C 6","C 7","C 8","C 9","C 10","C 11","C 12","C 13","D 1","D 2","D 3","D 4","D 5","D 6","D 7","D 8","D 9","D 10","D 11","D 12","D 13"]

#A= set(C)^set(S)
#a=[A]
a=sorted(set(C)^set(S),key=S.index)
#a.split()
#a.replase('{','}',',')
for j in range(len(a)):
    print(a[j])




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

int main(){
  int M, N, L;
  int c = 0;
  while(1){
    cin >> L;
    if(L == 0) break;
    for (int i = 0; i < 12; i++){
      cin >> M >> N;
      if(L <= 0) continue;
      L -= M - N;
      c++;
    }
    if(L > 0) cout << "NA" << endl;
    else cout << c << endl;
    c = 0;
  }
  return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define int long long 
const long long INF=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long, long > > vpll;
typedef vector<pair<int, int > > vpii;
#define FORR(x,arr) for(auto& x:arr)

bool isprime(int x){
	for(int i = 2;i*i<=x;i++){
		if(x%i == 0)return false;
	}
	return x!=1;
}
int gcd(int a, int b) 
{ 
    if (a == 0) 
       return b; 
    if (b == 0) 
       return a; 
   
    if (a == b) 
        return a; 
   
    if (a > b) 
        return gcd(a-b, b); 
    return gcd(a, b-a); 
} 


//3111111111111111111111111111111






	void solve(){

		ini(n);
		int x = 1;
		int x1 = 1;
		FOR(i,0,n){
			ini(morty);
			ini(morty1);
			int ma = max(((x+morty-1)/morty),((x1+morty1-1)/morty1));
			x = ma*morty;
			x1 = ma*morty1;
		}
		out(x+x1);


	}









































int32_t main() {
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall 
	oneforall

	solve();
	


	return 0;
}

Measured memory_bytes: 256
//大文字->小文字 tolower(),逆はtoupper()
//int a = stoi(c); 文字列をintへ
//途中の出力をそのまま残さない
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

// Nの桁数
ll dig(ll N) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= 10;
	}
	return dig;
}
// x,yの最大公約数
ll gcd(ll x, ll y) {
	ll r;
	while (x%y) {
		r = x % y;
		x = y;
		y = r;
	}
	return y;
}

int main() {
	vector<int> A(3);
	cin >> A[0] >> A[1] >> A[2];

	int mi = 1000;
	do {
		int x = abs(A[1] - A[0]) + abs(A[2] - A[1]);
		if (x < mi) mi = x;
	} while (next_permutation(ALL(A)));

	cout << mi << endl;
}

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

using namespace std;

#define fi  first
#define se  second

const int   N   = 1e5 + 1;
const int   inf = 1e9 + 7;

typedef pair<int,int>   ii;

vector<int> g[N];
int n, k;
ii  L[N];
int h[N];
int ans[N];

void dfs(int u,int p)   {
	for(int v : g[u])
		if(v != p)  {
			h[v] = h[u] + 1;
			dfs(v,u);
		}
}

int main()  {
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	
	cin >> n;
	
	for(int i = 1 ; i <= n ; ++i)
		L[i] = ii(-inf,inf);
	
	for(int i = 1 ; i <  n ; ++i)   {
		int x, y;   cin >> x >> y;
		g[x].push_back(y);
		g[y].push_back(x);
	}
	
	dfs(1,0);
	
	queue<int>  q;
	
	cin >> k;
	
	int m = -1;
	
	while(k--)  {
		int u, p;   cin >> u >> p;
		L[u] = ii(p,p);
		q.push(u);
		int c = (p + h[u]) % 2;
		if(m == -1)  m = c;
		if(m != c)  {
			cout << "No";
			exit(0);
		}
	}
	
	while(q.size()) {
		int u = q.front();  q.pop();
		for(int v : g[u])   {
			ii  tmp = L[v];
			tmp.fi = max(tmp.fi,L[u].fi - 1);
			tmp.se = min(tmp.se,L[u].se + 1);
			if(tmp.fi > tmp.se) {
				cout << "No";
				exit(0);
			}
			if(tmp != L[v]) {
				L[v] = tmp;
				q.push(v);
			}
		}
	}
	
	cout << "Yes\n";
	for(int i = 1 ; i <= n ; ++i)   {
		cout << L[i].fi << "\n";
		for(int u : g[i])
			L[u] = ii(max(L[u].fi,L[i].fi - 1),min(L[u].se,L[i].fi + 1));
	}
}

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

int solve(int A, int B) {
    if (A >= 13)
        return B;
    else if (A >= 6)
        return B/2;
    else
        return 0;
}

int main() {
    int A, B;

    cin >> A >> B;

    int answer = solve(A, B);
    cout << answer;

    return 0;
}

Measured memory_bytes: 3148
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(void){
  int n,i,x[1000],y[1000];
  double sum=0,max=0;
   
  scanf("%d",&n);
  for(i=0;i<n;i++){
      scanf("%d",&x[i]);
  }
  for(i=0;i<n;i++){
      scanf("%d",&y[i]);
  }
   
  for(i=0;i<n;i++){
      sum+=abs(x[i]-y[i]);
  }
  printf("%f\n",sum);
  sum=0;
   
  for(i=0;i<n;i++){
       sum+=abs(x[i]-y[i])*abs(x[i]-y[i]);
  }
  printf("%f\n",sqrt(sum));
  sum=0;
   
  for(i=0;i<n;i++){
       sum+=abs(x[i]-y[i])*abs(x[i]-y[i])*abs(x[i]-y[i]);
  }
  printf("%f\n",pow(sum,1.0/3.0));
   
  for(i=0;i<n;i++){
      if(max<abs(x[i]-y[i])) max=abs(x[i]-y[i]);
  }
  printf("%f\n",max);
   
  return 0;
}


Measured memory_bytes: 2108
#include<iostream>
#include<string>
#include<map>
using namespace std;

int main(){
    int n;
    cin >> n;
    string s;
    map<string, int> m;
    for(int i=0; i<n ;i++){
        cin >> s;
        m[s] = 1;
    }
    cout << m.size() << endl;
    return 0;
}


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

int main() {
  string S;
  
  cin >> S;
  
  int i = 0;
  
  bool flg = false;
  
  while(i < S.size()){
    if((i + 1) % 2 == 0){
      if(S.at(i) == 'R'){
        flg = true;
        break;
      }
    }else{
      if(S.at(i) == 'L'){
        flg = true;
        break;
      }
    }
    
    i++;
  }
  
  if(flg){
    cout << "No" << endl;
  }else{
    cout << "Yes" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
map<string,ll>mp;
vector<string>v;

int main()
{
	string s;
	ll n, i, t, mx=0;
	cin>>t;
	while(t--)
	{
		cin>>s;
		v.push_back(s);
		mp[s]++;
		mx=max(mx,mp[s]);
	}
	sort(v.begin(),v.end());
	v.resize(unique(v.begin(),v.end())-v.begin());
	for(i=0; i<v.size(); i++)
	{
		if(mp[v[i]]==mx){
			cout<<v[i]<<endl;
		}
	}
}

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

/* editorial */

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

    int N, K;
    string S;
    cin >> N >> K >> S;

    vector<int> nums;
    int cnt = 0;
    int now = 1; // numsは1の個数から始めたほうが都合がいい。Sの1文字目が0ならnumsの最初の要素は0になる。
    for (int i = 0; i < N; i++)
    {
        if (S[i] == (char)('0' + now))
        {
            cnt++;
        }
        else
        {
            nums.push_back(cnt);
            now = 1 - now;
            cnt = 1;
        }
    }
    if (cnt != 0)
    {
        nums.push_back(cnt);
    }

    // numsは 1の個数-0の個数-1の個数-0の個数...となるようにしたいので、
    // 0の個数で終わっている（sizeが偶数）なら0を追加（擬似的な1の個数）
    if (nums.size() % 2 == 0)
    {
        nums.push_back(0);
    }

    // 累積和
    vector<int> sums(nums.size() + 1); // sums[0]は何も足していないとみなして0を入れる
    for (int i = 0; i < nums.size(); i++)
    {
        sums[i + 1] = sums[i] + nums[i];
    }

    int ans = 0;
    int add = 2 * K + 1; // 半開区間 (left, right]
    for (int i = 0; i < sums.size(); i += 2)
    {
        int left = i;
        int right = min(i + add, (int)sums.size() - 1);
        ans = max(ans, sums[right] - sums[left]);
    }
    cout << ans << endl;

    return 0;
}

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

using namespace std;
typedef long long ll;

int H,W;
string s[55];
queue<pair<int,int>> q;
int m[55][55];
int d[5] = {0,-1,0,1,0};

int main(){
    cin >> H >> W;
    for(int i=0;i<H;i++) cin >> s[i];
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            m[i][j] = -1;
        }
    }
    q.push(make_pair(0,0));
    m[0][0] = 1;
    while(!q.empty()){
        pair<int,int> p = q.front();
        q.pop();
        int x = p.first;
        int y = p.second;
        if(x == H-1 && y == W-1) break;
        for(int i=0;i<4;i++){
            int xx = x + d[i];
            int yy = y + d[i+1];
            if(xx < 0 && xx >= H) continue;
            if(yy < 0 && yy >= W) continue;
            if(m[xx][yy] != -1) continue;
            if(s[xx][yy] == '#') continue;
            m[xx][yy] = m[x][y] + 1;
            q.push(make_pair(xx,yy)); 
        }
    }
    if(m[H-1][W-1] == -1){
        cout << -1 << endl;
        return 0;
    }
    int c = 0;
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            if(s[i][j] == '#') c++;
        }
    }
    cout << H*W - c - m[H-1][W-1] << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<vector>
#define INF 999999
using namespace std;
bool prime[1000000]={0};
int main(){
    prime[1]=1;
    for(int i=2;i*i<=1000000;i++){
        if(prime[i]==0){
            for(int j=i;j<1000000;j+=i){
                prime[j]=1;
            }
            prime[i]=0;
        }
    }
    int N;
    while(cin>>N,N){
            int sum=0;
        for(int i=2;N!=0;i++){
            if(prime[i]==0){sum+=i;N--;}
        }
        cout<<sum<<endl;
    }
}

Measured memory_bytes: 2136
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String pat = "AKIHABARA";
    int i = 0;
    int j = 0;

    int lengap = s.length() - pat.length();
    if ((lengap > 0) || (lengap < -4)) {
      System.out.println("NO");
      return;
    }

    while ((i < s.length()) && (j < pat.length())) {
      if (s.charAt(i) == pat.charAt(j)) {
        i++;
        j++;
      } else {
        if (pat.charAt(j) == 'A') {
          j++;
        } else {
          System.out.println("NO");
          return;
        }
      }
    }

    int fin = pat.length() - j;
    if (fin <= 1) {
      System.out.println("YES");
    } else {
      System.out.println("NO");
    }

  }
}

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

long long n, m;
long long Ans = 0;

void Init()
{
	scanf("%lld%lld", &n, &m);
	if (n > m) swap(n, m);
}

void Solve()
{
	if (n == 1) {
		if (m >= 2) {
			Ans = m - 2;
		}
		else {
			Ans = 1;
		}
	}
	else if (n == 2) {
		Ans = 0;
	}
	else {
		Ans = n * m - (n * 2 + m * 2 - 4);
	}
}

void Output()
{
	printf("%lld\n", Ans);
}

int main()
{
	Init();
	Solve();
	Output();
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int n;
    cin >> n;
    if(n%1000 == 0)cout << 0 << endl;
    else cout << 1000 - n%1000 << endl;
    
}

Measured memory_bytes: 3632
while True:
    h,w = map(int, input().split())
    if h == 0 and w == 0:
        break
    for i in range(h):
        if i == 0 or i == h - 1:
            print("#" * w)
        else:
            print("#" + ("." * (w - 2)) + "#")
    print("")


Measured memory_bytes: 5612
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
using namespace std;


int main(int argc, char* argv[])
{
    int a,b,c;
    scanf("%d%d%d", &a,&b,&c);

    printf("%d\n", MIN(a+b,MIN(b+c,c+a)));



    return 0;
}


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

int main() {
  string s;
  cin >> s;
  s = '0' + s;
  int ans = 0, c = 0;
  for (auto i = s.length(); i--;) {
    auto d = s[i] - '0' + c;
    c = (s[i - 1] - '0') + d * 10 >= 55;
    if (c)
      ans += 10 - d;
    else
      ans += d;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 2308
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
from collections import Counter
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

import sys
import itertools
# import numpy as np
import time
import math
from heapq import heappop, heappush
from collections import defaultdict
from collections import Counter
from collections import deque
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())
N, K = map(int, input().split())
A = list(sorted(map(int, input().split())))

def check(x):
    if A[x] >= K:
        return True
    dp = [False] * (K + 1)
    dp[0] = True
    for j, a in enumerate(A):
        if j == x:
            continue
        for i in range(K, 0, -1):
            if i >= a:
                dp[i] |= dp[i - a]
    for i in range(K - A[x], K):
        if dp[i]:
            return True
    return False
left = -1
right = N
while right - left > 1:
    mid = (left + right) // 2
    if check(mid):
        right = mid
    else:
        left = mid
print(right)

Measured memory_bytes: 74932
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
using namespace std;
typedef long long ll;
#define rep(i,a,n)	for(int i=a;i<n;i++)
#define rrep(i,a,n) for(int i=(a-1);i>=n;i--)
 
ll gcd(ll a,ll b){
	if(b==0)return a;
	return gcd(b,a%b);
}
ll lcm(ll a,ll b){
	ll g=gcd(a,b);
	return a/g*b;
}
 
ll digitsum(ll a){
	ll x=0;
	while(a>0){
		x+=a%10;
		a/=10;
	}
	return x;
}
int main(){
	ll n;
	cin>>n;
	ll a[110];
	rep(i,0,n){
		cin>>a[i];
	}
	ll ans=0;
	rep(i,1,n){
		if(a[i-1]!=0&&a[i-1]==a[i]){
			ans++;
			a[i]=0;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int S;
    cin >> S;
   if(S/1000==S/100-S/1000*10){
      cout << "Bad" << endl;}
           
           else if(S/100-S/1000*10==S/10-S/100*10){
            cout << "Bad" << endl;}
            
                else if(S/10-S/100*10==S-S/10*10){
                cout <<  "Bad"  << endl;}
                
                    else{cout << "Good"<< endl;}
}

Measured memory_bytes: 256
#pragma GCC optimize("O3", "unroll-loops")
//#pragma GCC target("avx2")
#pragma optimize("fast-math")

#include <bits/stdc++.h>
#include <stdio.h>

using namespace std;
#define endl '\n'
#define ull unsigned long long
#define si short int
#define ll long long
#define ld long double
#define pb push_back
#define pii pair<int, int>
#define pdd pair<double, double>
#define pil pair<int, ll>
#define pli pair<ll, int>
#define pll pair<ll, ll>
#define piii pair<pair<int, int>, int>
#define all(vec) (vec).begin(), (vec).end()
#define piiii pair<pair<int, int>, pair<int, int>>


ll gcd(ll a, ll b) {
    while (b) {
        a %= b;
        swap(a, b);
    }
    return a;
}

ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}

ll gcdex(ll a, ll b, ll &x, ll &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll xx, yy;
    ll gc = gcdex(b, a % b, yy, xx);
    x = xx;
    y = yy - (a / b) * xx;
    return gc;
}

ll dp[300][300];

void solve() {
    int k;
    cin>>k;
    ll ans=0;
    for(int i=1;i<250;i++){
        for(int j=1;j<250;j++){
            dp[i][j]=__gcd(i,j);
        }
    }
    for(int i=1;i<=k;i++){
        for (int j = 1; j <=k ; ++j) {
            for (int s = 1;  s<=k ; ++s) {
                ans+=dp[dp[i][j]][s];
            }
        }
    }
    cout<<ans;
}

void testcases(int n) {
    n = 1 - n;
    if (!n) cin >> n;
    for (int i = 0; i < n; i++) {
        solve();
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    //freopen("C:\\Users\\Maximus\\CLionProjects\\Codeforces\\BestTeam\\output.txt", "r", stdin);
    //f=fopen("C:\\Users\\Maximus\\CLionProjects\\Codeforces\\BestTeam\\output.txt", "w");
    //freopen("C:\\Users\\Maximus\\CLionProjects\\Codeforces\\BestTeam\\output.txt", "w", stdout);

    unsigned int beg_time = clock();
    testcases(0);
    // 0 - no t, 1 - with t

    unsigned int end_time = clock();
    //cout << endl << endl << end_time - beg_time;
    return 0;
}


Measured memory_bytes: 4240
// D - Bouquet
#include <bits/stdc++.h>

using namespace std;

const long long MOD = 1e9 + 7;

long long mpow(long long x, long long n)
{
	long long r = 1;
	for ( ; n > 0; x = x * x % MOD, n >>= 1) if (n & 1) r = r * x % MOD;
	return r;
}

int main(int argc, char *argv[])
{
	long long n, a, b;
	cin >> n >> a >> b;

	long long ans = (mpow(2, n) - 1 + MOD) % MOD;
	long long x = 1, y = 1;
	for (long long i = 0; i < a; i++) {
		x = x * (n - i) % MOD;
		y = y * (1 + i) % MOD;
	}
	ans = (ans - x * mpow(y, MOD - 2) % MOD + MOD) % MOD;
	x = y = 1;
	for (long long i = 0; i < b; i++) {
		x = x * (n - i) % MOD;
		y = y * (1 + i) % MOD;
	}
	ans = (ans - x * mpow(y, MOD - 2) % MOD + MOD) % MOD;

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
#define test int t;cin>>t;while(t--)
#define ll long long
#define ub upper_bound
#define lb lower_bound
#define cset(a) __builtin_popcountll(a)
#define tez ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int main()
{
    tez;
    int n;
    cin>>n;
    int ht[n];
    int dp[n];
    for(int i=0;i<n;i++)
    cin>>ht[i];
    dp[0]=0;
    dp[1]=abs(ht[1]-ht[0]);
    for(int i=2;i<n;i++)
    {
        dp[i]=min(dp[i-1]+abs(ht[i]-ht[i-1])  ,  dp[i-2]+abs(ht[i]-ht[i-2]));
        
    }
    cout<<dp[n-1]<<"  ";
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm> 
#include <cmath>
//#include <bitset>
//#include <deque>
#include <iterator>
#include <map> 
//#include <queue>
//#include <stack>
#include <string>
#include <vector>
#include <array>
//#include <tuple>
#include <unordered_map>
//#include <unordered_set>

using namespace std;

typedef long long ll;
struct __{__(){ios_base::Init i;ios_base::sync_with_stdio(0);cin.tie(0);}}__; 



int main() {
	ll n;
	cin >> n;
	//	int ans = 1e9 + 7;
	for (ll i = sqrt(n) + 1; i > 0; --i) {
		if (n % i == 0) {
			int p1 = 0;
			int p2 = 0;
			int a = i, b = n / i;
			while (a) {
				p1++;
				a /= 10;
			}
			while (b) {
				p2++;
				b /= 10;
			}
			cout << max(p1,p2);
			return 0;
		}
	}
} 
















Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define oo 0x3f3f3f3f

int main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n,x,t;
    cin>>n>>x>>t;
    cout<<(n+x-1)/x*t;
}


Measured memory_bytes: 3644