akhauriyash/Code-Regression huggingface dataset:
package main

import (
	"fmt"
	"strings"
)

func main() {
	var s string
	fmt.Scanf("%s", &s)
	stations := strings.Split(s, "")
	

	if (stations[0] == stations[1] && stations[0] == stations[2]) {
		fmt.Printf("No\n")
	} else {
		fmt.Printf("Yes\n")
	}
}

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

const int MX = 1e5 + 5;

int main() {
	int N;
	cin >> N;
	bool ok = false;
	for(int i = 1; i <= 9; i++) {
		if(N % i == 0) {
			int M = N/i;
			if(M >= 1 && M <= 9) {
				ok = true;
				break;
			}
		}
	}

	ok ? cout << "Yes" << endl : cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
    cin >> n;
    int count; 
    count = 0;
 for (int i = 0; i < n; i++)
 {
   string word;
    cin >> word;
    if (word == "Y") {
      cout << "Four";
                   count++;
                 break;
                 }
 }
  if (count == 0) 
  {
    cout << "Three";
  }
}

Measured memory_bytes: 256
/** MIT License Copyright (c) 2018 Vasilyev Daniil **/
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
template<typename T> using v=vector<T>;
#define int long long
typedef string str;
typedef vector<int> vint;
#define rep(a,l,r) for(int a=(l);a<(r);a++)
#define pb push_back
#define sz(a) ((int)(a).size())
const long long inf=4611686018427387903;//2^62-1
#if 0 //FileIO
ifstream fin ("input.txt" );
ofstream fout("output.txt");
#define get fin>>
#define put fout<<
#else
#define get cin>>
#define put cout<<
#endif
#define eol put endl
void read(){}             template<typename Arg,typename... Args> void read (Arg& arg,Args&... args){get   (arg)     ;read(args...) ;}
void print(){}            template<typename Arg,typename... Args> void print(Arg  arg,Args...  args){put   (arg)<<" ";print(args...);}
void debug(){cerr<<endl;} template<typename Arg,typename... Args> void debug(Arg  arg,Args...  args){cerr<<(arg)<<" ";debug(args...);}
int getInt(){int a; get a; return a;}
//code goes here
void run(){int ans=0;
    int n;get n;
    int a[n];rep(i,0,n)get a[i];
    int nxtNot0[n];rep(i,0,n)nxtNot0[i]=-1;
    vint pos;
    rep(i,0,n){
        if(a[i]!=0){
            for(int j:pos)nxtNot0[j]=i;
            pos.clear();
        }
        pos.pb(i);
    }
    rep(i,0,n){
        int cur=0,ind=i;
        while(ind!=-1){
            //debug(i,ind);
            if((cur^a[ind])!=cur+a[ind])break;
            cur+=a[ind];
            ind=nxtNot0[ind];
        }
        if(ind==-1)ind=n;
        ans+=max(ind-1,i)-i+1;
    }
    put ans;eol;
}
int32_t main() {ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);run();return 0;}


Measured memory_bytes: 5620
import java.util.*;

class Main{
    public static void main(String args[]){
        Scanner sc=new Scanner(System.in);
        while(true){
            int n=sc.nextInt();
            if(n==0){
                break;
            }
            int cnt=0;
	        int c=0;
            while(n!=6174){
                cnt++;
                String str[]=new String[4];
                int k=1000;
                for(int i=0;i<4;i++){
                    str[i]=String.valueOf(n/k);
                    n=n%k;
                    k/=10;
                }
		        if(str[0].equals(str[1])&&str[0].equals(str[2])&&str[0].equals(str[3])){
		            System.out.println("NA");
		            c++;
		            break;
	       	    }
                Arrays.sort(str,Collections.reverseOrder());
                int L=Integer.parseInt(str[0]+str[1]+str[2]+str[3]);
                int S=Integer.parseInt(str[3]+str[2]+str[1]+str[0]);
                n=L-S;
            }
	        if(c==0){
	    	    System.out.println(cnt);
	        }
        }
    }
}


Measured memory_bytes: 68940
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

class MainClass
{
    static void Main()
    {
        int N = int.Parse(ReadLine());
        var ans = new List<int>();
        int sum = 0;
        int num = 1;
        while (sum < N)
        {
            ans.Add(num);
            sum += num;
            num++;
        }

        if (sum > N)
        {
            ans.Remove( sum-N);
        }

        foreach (var i in ans)
        {
            WriteLine(i);
        }
    }
}


Measured memory_bytes: 27928
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>

using namespace std;

int main(){
	int a,p;cin>>a>>p;
	cout<<((a*3+p)/2)<<endl;
	return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  if(N == 4 || N == 7 || N == 11 || N == 12 || N == 14 || N == 15 || N == 16 || N >= 18 || N == 8){
    cout << "Yes" << endl;
  }
  else{cout << "No" << endl;}
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define REP2(i,x,n) for (int i = x; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);

int pcnt(int x){
  return __builtin_popcount(x);
  //２進数にしたときにbitが立っているところの数を返す
  //long long のときは
  // __builtin_popcountll(x)
}

int f(int x){
  if(x == 0) return 0;
  return f(x%pcnt(x))+1;
}

int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<int> x(n);//桁ごとのintのvectorに直しておく．
  REP(i,n) x[i] = s[i] - '0'; //char >> int;

  int pc = 0; //もとの数字のpopcount (bitが立っている数)
  REP(i,n) pc += x[i];  //popcountの数え上げ

  vector<int> ans(n);
  REP(b,2) {
    int npc = pc;
    if(b == 0) ++npc;
    else --npc;

    //npc = 0 のときの例外処理
    if(npc <= 0) continue;

    //
    int r0 = 0;   //もとの数字の割ったあまり
    //2進数を１０進数に変換し，npcで割っている．割り算のあまりはいつ計算しても一緒
    REP(i,n){
      r0 = (r0*2)%npc;
      r0 += x[i];
    }

    int k = 1;
    //ループを下から回す
    for (int i = n-1; i >= 0; --i){

      //r : フリップさせた数をpopcount でわったあまり
      if(x[i] == b){
        int r = r0;
        if(b == 0) r = (r+k)%npc;
        else r = (r-k+npc)%npc; //(r-k) < 0 を防ぐために，r-k+npc;
        ans[i] = f(r) + 1;
      }

      k = (k*2)%npc;  //2^n
    }

  }

  REP(i,n) cout << ans[i] << endl;
  return 0;
}


Measured memory_bytes: 5224
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<deque>
#include<math.h>
using namespace std;
#define ll long long
int main(){
    ll A,B,C,D,E,F;
    cin >> A >> B >> C >> D >> E >> F;
    ll i=0,j=0,k=0,l=0;
    double mx=0,tmp;
    ll ans1=100*A,ans2=0;
    while(100*A*i<=F){
        j=0;
        while(100*(A*i+B*j)<=F){
            k=0;
            while(100*(A*i+B*j)+C*k<=F){
                l=0;
                while(100*(A*i+B*j)+C*k+D*l<=F){
                    if(i+j!=0){
                        tmp=(double)(100*(C*k+D*l))/(double)(100*(A*i+B*j)+C*k+D*l);
                        if((A*i+B*j)*E>=C*k+D*l&&tmp>=mx){
                            mx=tmp;
                            ans1=100*(A*i+B*j)+C*k+D*l;
                            ans2=C*k+D*l;
                        }
                    }
                    l++;
                }
                k++;
            }
            j++;
        }
        i++;
    }
    cout << ans1 <<" "<<ans2 << endl;
    return 0;
}


Measured memory_bytes: 256
import math
a,b,c = map(float,input().split())
C_rad = math.pi*c/180
print(math.sin(C_rad)*a*b/2)
print(a+b+math.sqrt(a**2+b**2-2*a*b*math.cos(C_rad)))
print(b*math.sin(C_rad))


Measured memory_bytes: 5688
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

ll f(ll hp) {
  if(hp == 1) return 1;
  return f(hp / 2) * 2 + 1;
}

int main() {
  ll h;
  cin >> h;
  cout << f(h) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define dbg(x) #x "=" << x << " "
#define fore(i,a,b) for(int i=a,gon=b;i<gon;++i)
#define pb push_back
#define F first
#define S second
typedef double lf;
typedef long long ll;
typedef pair<int, int> pii;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    #ifdef LOCAL
        freopen("in.txt", "r", stdin);
        //freopen("out.txt", "w", stdout);
    #else
        #define endl '\n'
    #endif
    string s[3];
    fore(i,0,3) {
        cin >> s[i];
        reverse(s[i].begin(), s[i].end());
    }
    int i = 0;
    while (s[i].size()) {
        char c = s[i].back();
        s[i].pop_back();
        i = c-'a';
    }
    string ans = "ABC";
    cout << ans[i] << '\n';
}


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

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a.at(i);

    int all_times = 1;
    int odd_times = 1;

    rep(i, n)
    {
        if (a.at(i) == 1)
        {
            all_times *= 3;
        }
        else if (a.at(i) % 2 == 1)
        {
            all_times *= 3;
        }
        else if (a.at(i) % 2 == 0)
        {
            all_times *= 3;
            odd_times *= 2;
        }
    }
    int answer = all_times - odd_times;

    cout << answer << endl;
}

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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var inpputs = Console.ReadLine().Split(' ');
            Console.WriteLine(inpputs.ElementAt(1) == "+"
                ? int.Parse(inpputs.ElementAt(0)) + int.Parse(inpputs.ElementAt(2))
                : int.Parse(inpputs.ElementAt(0)) - int.Parse(inpputs.ElementAt(2)));
        }
    }
}

Measured memory_bytes: 11220
from math import sqrt
from decimal import Decimal
# map(int,input().split())
a,b,c = map(str,input().split())

a_sq = Decimal(a).sqrt()
b_sq = Decimal(b).sqrt()
c_sq = Decimal(c).sqrt()

if a_sq + b_sq < c_sq:
  print("Yes")
else:
  print("No")


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

int main() {
  int N;
  cin >> N;
  vector<int> V(N);
  for (int i = 0; i < N; i++) cin >> V.at(i);

  int ans = 0;

  vector<int> C(N);
  for (int i = 0; i < N; i++) {
    cin >> C.at(i);
    if (V.at(i) > C.at(i)) ans += V.at(i) - C.at(i);
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

int n,m,o,r,c,size,angle;
int a[20][20],b[20][20];
const int dy[] = {-1,0,1,0}, dx[] = {0,1,0,-1};

void rot(int y1, int x1, int y2, int x2){
  for(int i=0;i<y2-y1;i++){
    for(int j=0;j<x2-x1;j++){
      b[j][i] = a[y2-1-i][x1+j];
    }
  }

  for(int i=0;i<y2-y1;i++){
    for(int j=0;j<x2-x1;j++){
      a[y1+i][x1+j] = b[i][j];
    }
  }
}

void dfs(int y,int x,int col){
  if(a[y][x] != col)return;
  a[y][x] = 1-col;

  rep(i,4){
    int ny = y+dy[i], nx = x+dx[i];
    if(ny<0 || nx<0 || ny>=n || nx>=n)continue;
    dfs(ny,nx,col);
  }
}

int main(){
  cin >> n >> m;
  rep(i,n)rep(j,n)cin >> a[i][j];

  rep(i,m){
    cin >> o;
    if(o == 0){
      cin >> r >> c >> size >> angle; r--; c--;
      rep(i,angle/90)rot(r,c,r+size,c+size);
    }
    if(o == 1){
      cin >> r >> c >> size; r--; c--;
      rep(i,size){
	rep(j,size){
	  a[r+i][c+j] = 1-a[r+i][c+j];
	}
      }
    }
    if(o == 2){
      cin >> r; r--;
      int tmp = a[r][0];
      rep(i,n-1){
	a[r][i] = a[r][i+1];
      }
      a[r][n-1] = tmp;
    }
    if(o == 3){
      cin >> r; r--;
      int tmp = a[r][n-1];
      rep(i,n-1){
	a[r][n-1-i] = a[r][n-2-i];
      }
      a[r][0] = tmp;
    }
    if(o == 4){
      cin >> r >> c; r--; c--;
      dfs(r,c,a[r][c]);
    }
  }
  rep(i,n){
    rep(j,n)cout << a[i][j] << ((j==n-1)?"\n":" ");
  }
}
  

Measured memory_bytes: 1172
#include <stdio.h>

int main(void)
{
  int a,b,c;
  int cnt = 0;
  int i;

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

  for(i=a;i<b+1;i++)
    {
      if (c%i == 0)cnt++;
    }

  printf("%d\n",cnt);


  return 0;
}

Measured memory_bytes: 596
#include <iostream>
using namespace std;
int main(void){
    int a,b,k,i,cnt=0;
    cin >> a >> b >> k;
    int ans = min(a,b);
    for(i=min(a,b);i>0;i--){
        if(cnt==k) break;
        if(a%i==0 and b%i==0){
            cnt++;
            ans = i;
        }
    }
    cout << ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <math.h>
#include <cstdio>
using namespace std;
typedef long long ll;

int main() {
	ll w,z,n,a[2010],b[2010];
	cin>>n>>z>>w;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	z=abs(z-a[n-1]);
	w=abs(w-a[n-1]);
	for(int i=0;i<n;i++)
	{
		b[i]=abs(a[n-i-1]-a[n-1]);
	}
	ll w1[2010];
	ll w2[2010];
	b[n]=w;
	w1[1]=b[1];
	w2[1]=b[1];
	for(int i=2;i<=n;i++){
		ll min=w1[1],max=w2[1]; 
		for(int j=1;j<i;j++){
			if(w1[j]<min)
				min=w1[j];
		}
		if(min>b[i])
			min=b[i];
		for(int j=1;j<i;j++){
			if(w2[j]>max)
				max=w2[j];
		}
		if(max<b[i])
			max=b[i];	
		w1[i]=max;
		w2[i]=min;
	//	cout<<w1[i]<<" "<<w2[i]<<endl;
		}
	cout<<w1[n];
	return 0;
}

Measured memory_bytes: 256
// ######      ###      #######    #######    ##     #     #####        ###     ##### //
// #     #    #   #          #        #       # #    #    #     #      #   #     ###  //
// #     #   #     #        #         #       #  #   #   #       #    #     #    ###  //
// ######   #########      #          #       #   #  #   #           #########    #   //
// #     #  #       #     #           #       #    # #   #    ####   #       #    #   //
// #     #  #       #    #            #       #     ##   #    #  #   #       #        //
// ######   #       #   #######    #######    #      #    #####  #   #       #    #   //

// #pragma GCC optimize(2)
// #pragma GCC optimize(3)
// #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
// #pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double lld;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> ppl;
#define ain(a,n) for(ll i=0;i<(n);++i)  cin>>(a)[i];
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define loop(i,n) for(ll i=0;i<(n);++i)
#define FOR(i,a,b) for(ll i=(a);i<=(b);++i)
#define FORD(i,a,b) for(ll i=(a);i>=(b);--i)
#define cases ll T=0;cin>>T;while(T--)
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define END "\n"
#define pb push_back
#define mp make_pair
#define go(c,itr) for(auto itr=(c).begin(); itr!=(c).end(); ++itr)
// #define back(c,itr) for(auto itr=(c).rbegin(); itr!=(c).rend(); ++itr)
#define PI 3.14159265359
#define inf 9e18
#define MOD 1000000007
#define MODU 998244353
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define MAXN 1000005
#define BLOCK 555
const string alpha = "abcdefghijklmnopqrstuvwxyz";
const ll N = 200005;
const long double epsilon = 1e-9;
ll binexp(ll a, ll b, ll m) {
    a %= m;
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
ll modinvfermat(ll a, ll m)
{
    return binexp(a, m - 2, m);
}
void task(bool flag)
{
    if (flag)
        cout << "YES\n";
    else
        cout << "NO\n";
}
ll lcm(ll a, ll b)
{
    return ((1LL * a * b) / (__gcd(a, b)));
}

signed main() {
// #ifndef ONLINE_JUDGE
//     freopen("input.txt", "r", stdin);
//     freopen("output.txt", "w", stdout);
// #endif
    fast
    ll d, t, s;
    cin >> d >> t >> s;
    if (t * s >= d)
        cout << "Yes" << END;
    else
        cout << "No" << END;





// #ifndef ONLINE_JUDGE
//     cout << "\nTime Elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " sec\n";
// #endif
    return 0;
}

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

#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,n) for(int i = 1; i < n; i++)
#define per(i,n) for(int i = n-1; i >= 0; i--)
#define PER(i,n) for(int i = n; i >= 1; i--)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
using vb = vector<bool>;
using vc = vector<char>;
using vcc = vector<vc>;
using vP = vector<P>;
using vPl = vector<Pl>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }



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

  int n, k;
  cin >> n >> k;
  vi h(n);
  rep(i,n) cin >> h[i];
  sort(all(h));
  int ans = inf;
  for(int i = 0; i <= n-k; i++) {
    ans = min(ans, h[i+k-1] - h[i]);
  }
  cout << ans << endl;
}

Measured memory_bytes: 640
# coding:utf-8

INF = float('inf')


def inpl(): return list(map(int, input().split()))


dx = (1, 0, -1, 0)
dy = (0, 1, 0, -1)

H, W = inpl()
mass = []
coin = 0
for i in range(H):
    tmp = inpl()
    coin += sum(tmp)
    mass.append(tmp)

odd = []
for h in range(H):
    for w in range(W):
        if mass[h][w] % 2 == 1:
            odd.append([h, w])

count = 0
ans = []
odd.sort()
for i in range(H):
    for j in range(W):
        if mass[i][j] & 1:
            if j < W - 1:
                count += 1
                ans.append([i + 1, j + 1, i + 1, j + 2])
                mass[i][j] -= 1
                mass[i][j + 1] += 1
            elif i < H - 1:
                count += 1
                ans.append([i + 1, j + 1, i + 2, j + 1])
                mass[i][j] -= 1
                mass[i + 1][j] += 1

print(count)
for a in ans:
    print(' '.join(map(str, a)))


Measured memory_bytes: 59204
def gcd(a,b):
	a,b=max(a,b),min(a,b)	
	while b!=0:
		a,b=b,a%b
	return a

def lcm(a,b):
	return a*b//gcd(a,b)


while True:
	try:
		x,y=map(int,input().split())
		print(gcd(x,y),lcm(x,y))

	except EOFError:
		break

Measured memory_bytes: 7620
#include <stdio.h>
#include <stdlib.h>


int *BOX;


void Init(int n)
{
	int i;

	for(i = 0; i < n; i++)
		BOX[i] = i;
}


int Find(int x)
{
	if(BOX[x] == x)
		return x;
	else{
		BOX[x] = Find(BOX[x]);
		return BOX[x];
	}
}


int Same(int x, int y)
{
	if(Find(x) == Find(y))
		return 1;

	return 0;
}


void Unite(int x, int y)
{
	x = Find(x);
	y = Find(y);

	if(x == y)
		return;

	BOX[x] = y;
}


int main()
{
	int n, q;
	int com, x, y;
	int i;

	scanf("%d %d", &n, &q);

	BOX = (int *)malloc(sizeof(int) * n);

	Init(n);

	for(i = 0; i < q; i++){
		scanf("%d", &com);

		if(com){
		// Same
			scanf("%d %d", &x, &y);
			if(Same(x, y))
				printf("1\n");
			else
				printf("0\n");
		}else{
		// Unite
			scanf("%d %d", &x, &y);
			Unite(x, y);
		}
	}

	return 0;
}


Measured memory_bytes: 2140
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
using namespace std;
int main() {
	int a, b;
	cin >> a >> b;
	if(b==100){
		if (a == 1)cout << 10100 << endl;
		else if (a == 2)cout << 1010000 << endl;
		else if (a == 0)cout << 101 << endl;
	}
	else {
		if (a == 1)cout << 100*b << endl;
		else if (a == 2)cout << 10000*b << endl;
		else if (a == 0)cout << b << endl;
	}
	return 0;
}

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

using namespace std;
using P = pair<long, long>;

typedef long long int ll;

#define EPS (1e-7)
#define INF (1e18)
#define PI (acos(-1))

#define fillInt(xs)        \
  for (int i = 0; i < (xs).size(); i++) \
    scanf("%d", &xs[i]);
#define fillLong(xs)       \
  for (int i = 0; i < (xs).size(); i++) \
    scanf("%ld", &xs[i]);
#define fillDouble(xs)       \
  for (int i = 0; i < (xs).size(); i++) \
    scanf("%lf", &xs[i]);
#define fillString(xs)       \
  for (int i = 0; i < (xs).size(); i++) \
    cin >> xs[i];
#define sortv(xs) sort(xs.begin(), xs.end())
#define sortvinv(xs) sort(xs.begin(), xs.end(), greater<long>())
#define lbv(xs, x) lower_bound(xs.begin(), xs.end(), x) - xs.begin()
#define ubv(xs, x) upper_bound(xs.begin(), xs.end(), x) - xs.begin()
#define bs(xs, x) binary_search(xs.begin(), xs.end(), x)
#define index_of(as, x) \
  distance(as.begin(), lower_bound(as.begin(), as.end(), x))
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define concat(xs, ys) (xs).insert((xs).end(), (ys).begin(), (ys).end())

long res[500005];

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

  string s;
  cin >> s;

  int i = 0;

  while(i < s.size()) {
    long now = 0;
    while(i < s.size() && s[i] == '<') {
      now += 1;
      res[i+1] = now;
      i++;
    }
    int sakai = i;
    if (i >= s.size()) break;
    while(i < s.size() && s[i] == '>') i++;
    int sakai2 = i;
    now = 0;
    res[i] = 0;
    i--;
    while(i > sakai) {
      now += 1;
      res[i] = now;
      i--;
    }
    if (res[sakai] < now+1) res[sakai] = now+1;
    i = sakai2;
  }

  long ress = 0;
  rep(i, s.size()+1) {
    ress += res[i];
  }
  cout << ress << endl;
}


Measured memory_bytes: 4764
#include <iostream>
#include <stack>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <functional>
#include <string>
#include <cstdlib>
#include <numeric>
#include <cstdbool>
#include <cstring>
#include <map> 
#include <set>
#include <queue>
#include <iomanip>

typedef long long ll;

#define rep(i,n) for(ll i=0;i<n;i++)
using namespace std;

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

const long long INF = 1000000000000000;
const ll inf = -1e18;
typedef pair<ll, ll> P;
ll ma = 1000000000 + 7;
ll mx = 1000003;
ll h,n, w,m,t; string s;
ll R, C;
ll sy, sx, gy, gx;
char maze[510][510];
ll dis[20][20];
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };
ll gcd(ll x, ll y) {
	if (x % y == 0) return y;
	return gcd(y, x % y);
}
ll lcm(ll a,ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
void comb(vector<vector <ll> >& v) {
	for (ll i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (ll k = 1; k < v.size(); k++) {
		for (int j = 1; j < k; j++) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j])%ma;
		}
	}
}

ll GetDigit(ll num) {
	return log10(num) + 1;
}
ll Combination(int n, int r)
{
	if (n - r < r) r = n - r;
	if (r == 0) return 1;
	if (r == 1) return n;

	vector<ll> numerator(r);
	vector<ll> denominator(r);

	for (int k = 0; k < r; k++)
	{
		numerator[k] = n - r + k + 1;
		denominator[k] = k + 1;
	}

	for (int p = 2; p <= r; p++)
	{
		int pivot = denominator[p - 1];
		if (pivot > 1)
		{
			int offset = (n - r) % p;
			for (int k = p - 1; k < r; k += p)
			{
				numerator[k - offset] /= pivot;
				denominator[k] /= pivot;
			}
		}
	}

	ll result = 1;
	for (int k = 0; k < r; k++)
	{
		if (numerator[k] > 1) result *= numerator[k];
		result %= ma;
	}

	return result;
}

ll bfs() {
	queue<P> que;
	for (int i = 0; i < R; i++) {
		for (int j = 0; j < C; j++) dis[i][j] = INF;
	}
	que.push(P(sy - 1, sx - 1));
	dis[sy - 1][sx - 1] = 0;

	while (que.size() > 0) {
		P p = que.front();
		que.pop();
		if (p.first == gy - 1 && p.second == gx - 1) break;
		for (ll i = 0; i < 4; i++) {
			ll ny = p.first + dy[i];
			ll nx = p.second + dx[i];
			if (0 <= ny && ny < R && 0 <= nx && nx < C && maze[ny][nx] == '.' && dis[ny][nx] == INF) {
				que.push(P(ny, nx));
				dis[ny][nx] = dis[p.first][p.second] + 1;
			}
		}
	}
	return dis[gy - 1][gx - 1];
}


int main() {
	cin >> n;
	vector<P> a(n + 1);
	for (ll i = 1; i <= n; i++) {
		cin >> a[i].first;
	}
	sort(a.begin(), a.end());
	a[1].second = a[1].first;
	for (ll i = 2; i <= n; i++) {
		a[i].second += a[i - 1].second + a[i].first;
	}
	ll p = 0;
	for (ll i = 1; i < n; i++) {
		if (2 * a[i].second < a[i + 1].first) {
			p = i;
		}
	}
	cout << n-p << endl;
}

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

int main() {
  string x, y, z;
  bool s = false;
  bool t = false;
  cin >> x >> y >> z;
  if(x[x.size()-1] == y[0]){s = true;}
  if(y[y.size()-1] == z[0]){t = true;}
  if(s*t == 1){cout << "YES" << endl;}
  else{cout << "NO" << endl;}
}

Measured memory_bytes: 3600
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <bits/stdc++.h>
#include<queue>
#include <numeric>
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define fore(i,a) for(auto &i:a)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
 

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



int main(){
    string S;
    cin >> S;
    long long ans=0;
    int L=S.length();
    int pos=L-1;
    long long count=0;
    for(int i=0;i<L;++i){
        if(S[i]=='B'){
            ++count;
        }
        else{
            ans+=count;
        }
    }
    cout << ans;
}

Measured memory_bytes: 640
#include"bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;
 
#define int long long int
#define pb push_back
#define mp make_pair
#define loop(i,x,n) for(int i=x;i<=n;i++)
#define rloop(i,x,n) for(int i=x;i>=n;i--)
#define ff first
#define ss second
#define N4RUTO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
 
typedef tree<int, null_type, less<int>, rb_tree_tag,  
// typedef tree<int, null_type, less_equal<int>, rb_tree_tag,  
tree_order_statistics_node_update>
ordered_set;
 
int32_t main(){
    N4RUTO;
    int t;
    t=1;
    // cin>>t;
    while(t--){
        string s,t;
        cin>>s>>t;
        loop(i,0,s.length()-1){
            if(s[i]!=t[i]){
                cout<<"No\n";
                return 0;
            }
        }
        cout<<"Yes\n";
    }
    return 0;
}

Measured memory_bytes: 3652
#include<stdio.h>
#include<string.h>
#include<time.h>
#include<math.h>
#include<stdlib.h>
#include<iostream>
#include<iomanip>
#include<utility>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#define ll long long
#define fi first
#define sec second
#define pb push_back
#define mp make_pair
#define rep(a,b,c) for(ll a=1;a<=b;a+=c)
#define repp(a,b,c,d) for(ll a=b;a<=c;a+=d)

const double PI=acos(-1);
const long double EPS=1e-12;
const ll MOD=1e9+7;
const int INF=1<<30;


using namespace std;


int main(){
	ll a,b,x;
	cin>>a>>b;
	if(a%b==0)cout<<-1<<endl;
	else{
		cout<<a<<endl;
	}
}

Measured memory_bytes: 256
N = int(raw_input())
D, X = map(int, raw_input().split())

ary_A=[]

for i in range(N):
    ary_A.append(int(raw_input()))

#print ary_A

eaten=[]

for i in range(N):
    eaten.append(0)
    day=1
    while(1):
        if day <= D:
            eaten[i] += 1
            day += ary_A[i]
            continue
        else:
            break

#print eaten
print sum(eaten) + X


Measured memory_bytes: 2568
#include <algorithm>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

#define ll long long
#define forn(i, n) for (ll i = 0; i < (ll) n; ++i)
#define sz(a) static_cast<int>(a.size())

char buff[(int) 2e6 + 17];
const ll inf = (ll) 1e9 + 7ll;

const int maxn = (int) 2e5 + 17;

struct pt {
    ll x, y;
    pt() { }
};

int n, k;
pt p[maxn];

bool read() {
    if (scanf("%d %d", &n, &k) != 2)
        return false;

    forn (i, n) {
        scanf("%lld %lld", &p[i].x, &p[i].y);
    }

    return true;
}

void solve() {
    vector<ll> xs, ys;

    for (int i = 0; i < n; ++i) {
        xs.push_back(p[i].x);
        ys.push_back(p[i].y);
    }

    sort(xs.begin(), xs.end());
    xs.resize(unique(xs.begin(), xs.end()) - xs.begin());
    sort(ys.begin(), ys.end());
    ys.resize(unique(ys.begin(), ys.end()) - ys.begin());
    ll ans = 9 * inf * inf;

    for (int ix = 0; ix < sz(xs); ++ix)
        for (int jx = ix; jx < sz(xs); ++jx)
            for (int iy = 0; iy < sz(ys); ++iy)
                for (int jy = 0; jy < sz(ys); ++jy) {
                    auto xl = xs[ix];
                    auto xr = xs[jx];
                    auto yl = ys[iy];
                    auto yr = ys[jy];
                    int res = 0;

                    for (int i = 0; i < n; ++i)
                        if (xl <= p[i].x && p[i].x <= xr && yl <= p[i].y && p[i].y <= yr)
                            ++res;

                    if (res >= k)
                        ans = min(ans, (xr - xl) * (yr - yl));
                }

    cout << ans << endl;
}

int main() {
#if SEREZHKA
    freopen("file.in", "r", stdin);
#endif

    while (read())
        solve();

    return 0;
}

Measured memory_bytes: 2304
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

vector<int> mochi;
int N;

int main() {
	cin >> N;
	for (int i = 0; i < N; i++) {
		int a;
		cin >> a;
		mochi.push_back(a);
	}

	sort(mochi.begin(), mochi.end());
	mochi.erase(unique(mochi.begin(), mochi.end()), mochi.end());

	cout << mochi.size() << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		if (a < b) {
			if (b < c) {
				System.out.printf("%d %d %d\n", a, b, c);
			} else if (a < c) {
				System.out.printf("%d %d %d\n", a, c, b);
			} else {
				System.out.printf("%d %d %d\n", c, a, b);
			}
		} else {
			if (a < c) {
				System.out.printf("%d %d %d\n", b, a, c);
			} else if (b < c) {
				System.out.printf("%d %d %d\n", b, c, a);
			} else {
				System.out.printf("%d %d %d\n", c, b, a);
			}
		}
	}
}

Measured memory_bytes: 26220
#include<stdio.h>

int main(void)
{
    int N,D;
    scanf("%d %d",&N,&D);

    if(N%(2*D+1)!=0)
    {
        printf("%d",N/(2*D+1)+1);
    }
    else
    {
        printf("%d",N/(2*D+1));
    }
    return 0;
}

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

int main(int argc, char const *argv[])
{
	int n,w,h;
	cin>>n>>w>>h;
	int a[100005]={},b[100005]={};
	for (int i = 0; i < n; ++i)
	{
		int x,y,z;
		cin>>x>>y>>z;
		if(x-z>=0) ++a[x-z];
		else ++a[0];
		if(x+z<=w) --a[x+z];
		else --a[w];;
		if(y-z>=0) ++b[y-z];
		else ++b[0];
		if(y+z<=h) --b[y+z];
		else --b[h];
	}
	bool f1=1,f2=1;
	int now=0;
	for (int i = 0; i < w; ++i)
	{
		now+=a[i];
		if(now<=0) f1=0;
	}
	now=0;
	for (int i = 0; i < h; ++i)
	{
		now+=b[i];
		if(now<=0) f2=0;
	}
	cout<<((f1||f2)?"Yes\n":"No\n");
	return 0;
}



Measured memory_bytes: 3876
#include <stdio.h>
#define INFTY 2000000000
#define MAX 500000

int cnt;
int L[MAX/2+2];
int R[MAX/2+2];
void mergesort(int A[],int n, int left,int right);
void merge(int A[],int n, int left,int mid,int right);

int main(void){
	int A[MAX];
	cnt=0;
	int n,i;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&A[i]);
	}
	mergesort(A,n,0,n);
	
	for(i=0;i<n;i++){
	if(i>0) printf(" ");
	printf("%d",A[i]);
	}
	printf("\n");
	printf("%d\n",cnt);
	return 0;
}

void merge(int A[],int n, int left,int mid,int right){
	int n1=mid-left;
	int n2=right-mid;
	for(int i=0;i<n1;i++){
		L[i]=A[left+i];
	}
	for(int i=0;i<n2;i++){
	
		R[i]=A[mid+i];
	}
	
	L[n1]=R[n2]=INFTY;
	int i=0,j=0;
	
	for(int k=left;k<right;k++){
		cnt++;
		if(L[i]<=R[j]){
			A[k]=L[i++];
		}
		else{
			A[k]=R[j++];
		}
	}
}

void mergesort(int A[],int n,int left,int right){
	if(left+1<right){
		int mid=(left+right)/2;
		mergesort(A,n,left,mid);
		mergesort(A,n,mid,right);
		merge(A,n,left,mid,right);
	}
}




Measured memory_bytes: 5624
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

l = LIST()
s = Counter(l)
# print(s)
# print(Counter(l))
print(len(s))


Measured memory_bytes: 5144
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
bool cmp(int a, int b) { return a > b; }
int cnt[200010];
int main() {
    int n, k, x;
    scanf("%d%d", &n, &k);
    for (int i = 0; i < n; ++i) scanf("%d", &x), ++cnt[x];
    sort(cnt,cnt+n, cmp);
    int sum=0;
    for (int i = 0; i < k; ++i) sum += cnt[i];
    printf("%d\n", n-sum);
    return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define rep(i,n) for(int i=0;i<n;i++)
int gcd(int a, int b){
    int r=1;
    while(r!=0){
        r=a%b;
        a=b;
        b=r;
    }
    return a;
}
typedef long long ll;
void revStr(char* str){
    int size = strlen(str);
    int i,j;
    char tmp = {0};
    for(i = 0, j = size - 1; i < size / 2; i++, j--){
        tmp = str[i];
        str[i] = str[j];
        str[j] = tmp;
    }return;
}
typedef struct{
    int a,b;
}data;

//昇順
int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}
//構造体降順
int comp( const void *c1, const void *c2 )
{
  data test1 = *(data *)c1;
  data test2 = *(data *)c2;
  int tmp1 = test1.b;   /* b を基準とする */
  int tmp2 = test2.b;
  return tmp2 - tmp1;
}


int kai(int n){
    if(n==0){
        return 1;
    }
    int sum=1;
    for(int i=1;i<=n;i++){
        sum*=i;
    }
    return sum;
}

int main(){
    int a,b;
    scanf("%d%d",&a,&b);
    char moji[a][101];
    rep(i,a){
        scanf("%s",moji[i]);
    }
    rep(i,a+2){
        rep(j,b+2){
            if(i>=1 && i<=a && j>=1 && j<=b){
                printf("%c",moji[i-1][j-1]);
            }else{
                printf("#");
            }
        }
        putchar('\n');
    }
}


Measured memory_bytes: 1668
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include<time.h>
using namespace std;
typedef long long int llint;
typedef pair<int, int> pint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<llint, llint>> vpllint;
#define rep(i,n) for(int i=0;i<n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;
#define POSSIBLE(ans) if(ans)cout<<"POSSIBLE"<<endl;else cout<<"IMPOSSIBLE"<<endl;

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;

	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}

	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい
	}

	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}

		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);

		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;

		return true;
	}
};

//aとbの最大公約数を求めるよ
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
long long extGCD(long long a, long long b, long long& x, long long& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}

bool check(int a, int b) {
	return a > b;
}

// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//aCbを1000000007で割った余りを求める
llint convination(llint a, llint b) {
	llint ans = 1;
	for (llint i = 0; i < b; i++) {
		ans *= a - i;
		ans %= 1000000007;
	}
	for (llint i = 1; i <= b; i++) {
		ans *= modinv(i, 1000000007);
		ans %= 1000000007;
	}
	return ans;
}

int main() {
	int v, e, r;
	cin >> v >> e >> r;
	vector<vector<int>>nodes(e, vector<int>(3));
	rep(i, e) {
		rep(j, 3) {
			cin >> nodes[i][j];
		}
	}
	vint cost(v, 1100000000);
	cost[r] = 0;
	rep(i, v - 1) {
		rep(j, e) {
			if (cost[nodes[j][0]] != 1100000000) {
				cost[nodes[j][1]] = min(cost[nodes[j][1]], cost[nodes[j][0]] + nodes[j][2]);
			}
		}
	}
	rep(i, e) {
		if (cost[nodes[i][0]] != 1100000000) {
			if (cost[nodes[i][1]] > cost[nodes[i][0]] + nodes[i][2]) {
				cout << "NEGATIVE CYCLE" << endl;
				return 0;
			}
		}
	}
	rep(i, v) {
		if (cost[i] == 1100000000) {
			cout << "INF" << endl;
			continue;
		}
		cout << cost[i] << endl;
	}
	return 0;
}



Measured memory_bytes: 3224
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)

using namespace std;

namespace mp = boost::multiprecision;
using Bint = mp::cpp_int;

using ll = long long;
ll mod = pow(10, 9) + 7;

template <typename T> void output(T, ll);
ll gcd(ll, ll);
ll lcm(ll, ll);
Bint comb(Bint, Bint);
void prime_map(map<ll, ll> &, ll);

int main() {
    // source
    ll n, m;
    cin >> n >> m;
    ll x = 1800 * m + 100 * n;
    ll co = 1 << m;
    cout << x * co << endl;
    return 0;
}

Bint comb(Bint a, Bint b) {
    Bint ans = 1;

    if (a < b) {
        return 0;
    }

    rep(i, b) {
        ans *= a - i;
        ans /= i + 1;
    }

    return ans;
}

template <typename T> void output(T a, int precision) {
    if (precision > 0) {
        cout << setprecision(precision) << a << "\n";
    } else {
        cout << a << "\n";
    }
}

template <typename T> T min(T a, T b) {

    if (a < b) {
        return a;
    } else {
        return b;
    }
}

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

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

void prime_map(map<ll, ll> &m, ll num) {

    if (num == 1) {
        return;
    }
    ll cache = num;
    repd(i, 2, sqrt(num) + 2) {
        if (num % i == 0) {
            if (m[i] == 0) {
                m[i] = 1;
            } else {
                m[i]++;
            }

            num /= i;
            break;
        }
    }
    if (cache == num) {
        if (m[num] == 0) {
            m[num] = 1;
        } else {
            m[num]++;
        }

        return;
    }
    prime_map(m, num);
    return;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
 
using namespace std;
int main(){
	
  	int h, a;
  	cin>>h>>a;
  	vector<int> v(a);
  
  	for(int i=0;i<a;i++) {
    	cin>>v[i];
      	h -= v[i];
    }
      
  	cout<<(h<=0?"Yes\n":"No\n");
	return 0;
}


Measured memory_bytes: 768
def main():
    N, M = map(int, input().split())

    def factorization(n):
        arr = []
        temp = n
        for i in range(2, int(-(-n**0.5//1))+1):
            if temp % i == 0:
                cnt = 0
                while temp % i == 0:
                    cnt += 1
                    temp //= i
                arr.append([i, cnt])
        if temp != 1:
            arr.append([temp, 1])

        if arr == [] and n != 1:
            arr.append([n, 1])

        return arr

    mod = 10**9 + 7

    def cmb(n, r, mod):
        if (r < 0 or r > n):
            return 0
        r = min(r, n-r)
        return g1[n] * g2[r] * g2[n-r] % mod

    g1 = [1, 1]
    g2 = [1, 1]
    inverse = [0, 1]
    for i in range(2, N+100 + 1):
        g1.append((g1[-1] * i) % mod)
        inverse.append((-inverse[mod % i] * (mod//i)) % mod)
        g2.append((g2[-1] * inverse[-1]) % mod)

    primes = factorization(M)
    # 何箇所に分けるか（cnt以下）,その中でどう分けるか（しきりをどこにおくか（振り分けられないものが出ると選べれないのとおなじになるので、cnt - 選んだ数））

    ans = 1

    for p, cnt in primes:
        tmp = cmb(N+cnt-1, N-1, mod)
        ans *= tmp
        ans %= mod

    print(ans)


main()


Measured memory_bytes: 20876
#include<stdio.h>
int main(void){
  int A,B;
  scanf("%d %d %d",&A,&B);
  if(A%3==0 || B%3==0 || (A+B)%3==0){
    printf("Possible\n");
  }else{
    printf("Impossible\n");
  }
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep1(n) rep2(i,n)
#define rep2(i,n) rep3(i,0,n)
#define rep3(i,a,b) for(ll i=a;i<b;++i)
ll zyo(ll a,ll b){
    if(b==0)return 1;
    else{
    a=a*zyo(a,b-1);
    return a;
    }
}
int main(){
    ll n,p,q;
    cin>>n>>p;
    q=p;
    ll memo;
    ll ans=1;
    if(n==1)cout <<p<<endl;
    else {
    while(p%2==0){
        p/=2;
        memo++;
    }
    if(memo>=n)ans=ans*zyo(2,memo/n);
    memo=0;
    for(ll i=3;i*i<=p;i+=2){
        while(p%i==0){
            memo++;
            p/=i;
        }

        if(memo>=n)ans=ans*zyo(i,memo/n);
        memo=0;
    }
    cout<<ans<<endl;
    }

}

Measured memory_bytes: 256
import math
N, M = map(int, input().split())
ma = max(N,M)
mi = min(N,M)

ans = 0
if (ma - mi == 1):
  ans = math.factorial(ma) * math.factorial(mi)
elif (ma - mi == 0):
  ans = math.factorial(ma) * math.factorial(mi) * 2
print(ans % (10 ** 9 + 7))
  

Measured memory_bytes: 55152
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<algorithm>
#include<math.h>
#include<iostream>
#include<queue>
using namespace std;
#define ll long long
#define re register
inline int gi(){
	int sum=0,f=1;char ch=getchar();
	while(ch>'9' || ch<'0'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0' && ch<='9'){sum=(sum<<3)+(sum<<1)+ch-'0';ch=getchar();}
	return sum*f;
}
inline ll gl(){
	ll sum=0,f=1;char ch=getchar();
	while(ch>'9' || ch<'0'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0' && ch<='9'){sum=(sum<<3)+(sum<<1)+ch-'0';ch=getchar();}
	return sum*f;
}
const int N=200010;
int n=gi(),a=gi(),b=gi(),c=gi(),d=gi();
char s[N];
void naive(){
	puts("No");
	exit(0);	
}
int main(){
	scanf("%s",s+1);
	if(c<d)
	{
		for(int i=a;i<c;i++)
			if(s[i]=='#' && s[i+1]=='#')naive();
		for(int i=b;i<d;i++)
			if(s[i]=='#' && s[i+1]=='#')naive();
	}
	else{
		for(int i=a;i<c;i++)
			if(s[i]=='#' && s[i+1]=='#')naive();
		for(int i=b;i<d;i++)
			if(s[i]=='#' && s[i+1]=='#')naive();int flag=0;
		for(int i=b;i<=d;i++)
			if(s[i-1]=='.' && s[i+1]=='.' && s[i]=='.')flag=1;
		if(!flag)naive();
	}
	puts("Yes");
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
 
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pii;
typedef tuple<ll, ll, ll> ti;
ll mod=1E9+7;
 
#define REP(a,b,c) for(ll a=b;a<(c);a++)
#define PER(a,b,c) for(ll a=b;a>=(c);a--)

ll ii(){ ll x; cin >> x; return x; }
string is(){ string x; cin >> x; return x; }
ld id(){ ld x; cin >> x; return x; }
void oi(ll x){ cout << x; }
void od(ld x){ cout << fixed << setprecision(10) << x; }
void os(string x){ cout << x; }
void oe(){ cout << endl; }
void oie(ll x){ oi(x); oe(); }
void ode(ld x){ od(x); oe(); }
void ose(string x){ os(x); oe(); }

int main(){
    ld a=id(),b=id();
    oie((ll)(a*b));
    return 0;
}

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


int main(){
    int n, d;
	cin >> n >> d;
	d = d*2 + 1;
	int ans = 0;
	while(n > 0){
        n -= d;
        ans++;
	}
    cout << ans << "\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=1;i<=n;++i)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
using namespace std;

int main(){
  int a,b;
  cin >> a >> b;
  if (a==b) cout << "Draw" << endl;
  else if (a==1) cout << "Alice" << endl;
  else if(b==1) cout << "Bob" << endl;
  else cout << ((a>b)?"Alice":"Bob") << endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define MOD 1000000007
#define INF 1e9
#define PIE 3.14159265358979323

template <class T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
T GCD(T a, T b) {
    if (b == 0)
        return a;
    else
        return GCD(b, a % b);
}
template <class T>
inline T LCM(T a, T b) {
    return (a * b) / GCD(a, b);
}

signed main() {
    int n;
    string s;
    cin >> n >> s;
    int m = 0;
    for (int i = 1; i < n; i++) {
        set<char> a;
        set<char> b;
        for (int j = 0; j < i; j++)
            a.insert(s[j]);
        for (int j = i; j < n; j++)
            b.insert(s[j]);
        int c = 0;
        for (auto it = a.begin(); it != a.end(); it++) {
            if (b.find(*it) != b.end())
                c++;
        }
        chmax(m, c);
    }
    cout << m << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<stack>
#include<map>
#include<iostream>
#include<algorithm>
#define m(a,b) memset(a,b,sizeof(a));
using namespace std;
typedef long long LL;
typedef pair<int,int>PII;
const int inf = 1 << 30;
const int maxn = 1e5;
map<int,int>mp;
map<int,int>::iterator it;
LL ans = 0;
int main(){
	LL n,m;
	cin >> n >> m;
	if(n>1&&m>1)
		ans = n*m - 2*m - 2*(n-2);
	if(n==1)
		ans = m-2;
	if(m==1) ans = n - 2;
	if(n==1&&m==1) ans = 1;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256