akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
using namespace std;

int main(){
    int N;
    cin >> N;
    vector<long long> A(N), B(N), D(N);
    for(int i=0; i<N; i++) cin >> A[i];
    for(int i=0; i<N; i++) cin >> B[i];

    for(int i=0; i<N; i++)
        D[i] = A[i] - B[i];

    sort(D.begin(), D.end());

    long long ans = 0;
    long long sm = 0;
    for(int i=0; i<N; i++)
        if(D[i] < 0){
            ans++;
            sm += -D[i];
        }

    if(sm == 0){
        cout << 0 << endl;
        return 0;
    }

    for(int i=N-1; i>=0; i--){
        if(D[i] < 0){
            cout << -1 << endl;
            return 0;
        }
        if(D[i] >= sm){
            ans++;
            cout << ans << endl;
            return 0;
        }else{
            sm -= D[i];
            ans++;
        }
    }
    return 0;
}

Measured memory_bytes: 2560
/*
 * @Author: Kaizyn
 * @Date: 2020-08-22 19:58:44
 * @LastEditTime: 2020-08-22 21:11:30
 */
#include <bits/stdc++.h>

// #define DEBUG

using namespace std;

const double eps = 1e-7;
const double PI = acos(-1);
typedef pair<int, int> pii;
const int MOD = 998244353;
const int INF = 0x3f3f3f3f;
const int N = 2e3+7;

int n;
int a[N*3];
int dp[N][N], mv[N], curmv[N], curdp[N];

inline void update(int x, int y, int z) {
  if (x > y) swap(x, y);
  if (z <= dp[x][y]) return;
  dp[x][y] = z;
  mv[x] = max(mv[x], z);
  mv[y] = max(mv[y], z);
  #ifdef DEBUG
  // cout << x << " " << y << " " << z << endl;
  #endif
}

#ifdef DEBUG
void print() {
  cout << "***********\n";
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j)
      cout << dp[i][j] << " \n"[j==n];
  for (int i = 1; i <= n; ++i) cout << mv[i] << " \n"[i==n];
  cout << "***********" << endl;
}
#endif

inline void solve() {
  cin >> n;
  for (int i = 1; i <= 3*n; ++i) cin >> a[i];
  memset(dp, 0x9f, sizeof dp);
  memset(mv, 0x9f, sizeof mv);
  update(a[1], a[2], 0);
  int base = 0;
  for (int i = 3; i+2 <= 3*n; i += 3) {
    if (a[i] == a[i+1] && a[i] == a[i+2]) {
      ++base;
      continue;
    }
    int b[3], maxv = 0;
    sort(a+i, a+i+3);
    if (a[i+1] == a[i+2]) swap(a[i], a[i+2]); // fuck there
    for (int j = 1; j <= n; ++j) {
      curdp[j] = dp[min(a[i], j)][max(a[i], j)];
      curmv[j] = mv[j];
      maxv = max(maxv, mv[j]);
    }
    for (int j = 0; j < 3; ++j) b[j] = dp[a[i+j]][a[i+j]];
    // spj
    if (a[i] == a[i+1]) for (int j = 1; j <= n; ++j) { // fuck here
      update(a[i+2], j, curdp[j]+1); // dp[a[i]][j] -> dp[a[i+2]][j]
    }
    update(a[i+1], a[i+2], b[0]+1); // get three a[i]
    update(a[i], a[i+2], b[1]+1); // get three a[i+1]
    update(a[i], a[i+1], b[2]+1); // get three a[i+2]
    // two of three rest
    update(a[i+1], a[i+2], maxv);
    update(a[i], a[i+2], maxv);
    update(a[i], a[i+1], maxv);
    // one of three rest
    for (int j = 1; j <= n; ++j) {
      update(a[i], j, curmv[j]);
      update(a[i+1], j, curmv[j]);
      update(a[i+2], j, curmv[j]);
    }
#ifdef DEBUG
    cout << i << ":\n"; print();
#endif
  }
  int res = dp[a[3*n]][a[3*n]]+1;
  for (int i = 1; i <= n; ++i) res = max(res, mv[i]);
  cout << res+base << endl;
}

signed main() {
  ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
  int T = 1;
  // cin >> T;
  for (int t = 1; t <= T; ++t) {
    solve();
  }
  return 0;
}

Measured memory_bytes: 19396
#![allow(non_snake_case)]
#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;
use whiteread::parse_line;
use std::collections::*;
use num::*;

use itertools::Itertools;
use itertools_num::ItertoolsNum;

#[fastout]
fn main() {
    input!{
        S: Chars,
        T: Chars,
    }

    let mut ans = 0;

    for i in 0..S.len() {
        if S[i] != T[i] {
            ans += 1;
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 4032
#include<bits/stdc++.h>
using namespace std;
#define rep(i, c) for(int i = 0; i < (int)c; i++)
#define ll long long
const int inf = 1000000000; // 10^9

int main(){
    int k, n, cnt = 0, c = 0;
    cin >> k >> n;
    int a[210000];
    for(int i = 1; i < n + 1; i++) cin >> a[i];
    sort(a, a + n);
    for(int i = n; i > 0; i--) a[i + 1] -= a[i];

    for(int i = 1; i < n + 1; i++){
        cnt += a[i];
        if(i != 1 && c < a[i]) c = a[i];
    }
    cnt -= a[1];
    c = max(c, k - cnt);
    cout << k - c << endl;

    return 0;
}

Measured memory_bytes: 1024
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-7;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	int n;
	cin>>n;
	vi in(n),t;
	rep(i,n)cin>>in[i];
	t=in;
	int q;
	cin>>q;
	rep(i,q){
		int a,b,c;cin>>a>>b>>c;
		if(a==1){
			in[b-1]-=c;
			if(in[b-1]<0){
				cout<<b<<endl;
				return 0;
			}
		}else{
			in[b-1]+=c;
			if(in[b-1]>t[b-1]){
				cout<<b<<endl;
				return 0;
			}
		}
	}
	cout<<0<<endl;
}







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

int main()
{
	int n;
	cin>>n;
	string a,b;
	cin>>a>>b;
	
	string c= "";
	for(int i=0;i<n;i++)
	{
		c += a[i] ;
		c+= b[i];
	}
	cout<<c;
}

Measured memory_bytes: 256
from collections import Counter
import numpy as np

MOD = 10 ** 9 + 7

n = int(input())
a = list(map(int, input().split()))
count = Counter(a)
# 0の個数は、count[0]
num = len(a)
ans = 1


if (num % 2 == 0):
    # 偶数パターン
    temp = 1
    loop = int(num / 2)
    for i in range(loop):
        tar = count[temp]
        if (tar == 2):
            ans *= 2
            temp += 2
        else:
            print(0)
            exit()

else:

    tar0 = count[0]
    if (tar0 == 1):
        pass
    else:
        print(0)
        exit()

    temp = 2

    for i in range(num // 2):
        if (count[temp] == 2):
            ans *= 2
            temp += 2
        else:
            print(0)
            exit()

ans %= MOD
print(ans)


Measured memory_bytes: 23392
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
int c[200005];
ll dp[200005];
ll col[200005];

int main(void){
    scanf("%d",&n);
    int nn=0;
    int prev=-1;
    for(int i=0;i<n;i++){
        scanf("%d",&c[nn]);
        if(prev!=c[nn]){
            prev=c[nn];
            nn++;
        }

    }
    n=nn;
    dp[0]=1;
    for(int i=0;i<n;i++){
        dp[i+1]=dp[i];
        dp[i+1]+=col[c[i]];
        dp[i+1]%=MOD;
        col[c[i]]+=dp[i];
        col[c[i]]%=MOD;
    }
    printf("%lld\n",dp[n]);
    return 0;
}




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

int head;
int tail;

static const int Max = 100005;

struct queue {
	char name[20];
	int time;
};

queue line[Max];

void enqueue(queue x) {
	line[tail] = x;
	if (tail + 1 == Max) {
		tail = 0;
	}
	else {
		tail++;
	}
}

queue dequeue() {
	queue x = line[head];
	if (head + 1 == Max) {
		head = 0;
	}
	else {
		++head;
	}

	return x;
}

int min(int a, int b) { return a < b ? a : b; }

int main() {
	int n, q;
	int total = 0;

	head = 0;
	tail = 1;
	cin >> n >> q;

	for (int i = 0; i < n; ++i) {
		cin >> line[i].name >> line[i].time;
	}
	tail = n;

	while (head != tail) {
		if (line[head].time > q) {
			queue c = dequeue();
			c.time = c.time - q;
			total += q;
			enqueue(c);
		}
		else {
			queue c = dequeue();
			total += c.time;
			cout << c.name << ' ' << total << endl;
		}
	}

}


Measured memory_bytes: 5436
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

use std::cmp::{max, min};
use std::collections::HashMap;

fn main() {
  let x = read::<String>();
  let mut ans = String::from("");

  for (i, k) in x.chars().enumerate() {
    let nth = i + 1;
    if nth % 2 == 1 {
      ans.push_str(&k.to_string())
    }
  }

  println!("{}", ans);
}



Measured memory_bytes: 4352
from collections import defaultdict

n, k = map(int, input().strip().split())
as_ = map(int, input().strip().split())

dic = defaultdict(int)

for a in as_:
    dic[a] += 1

sorted_data = [(a, v) for a, v in dic.items()]
sorted_data = sorted(sorted_data, key=lambda d: d[1], reverse=True)

count = 0
while len(sorted_data) > k:
    count += sorted_data[-1][1]
    sorted_data.pop(-1)

print(count)


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

int main(int argc, char** argv) {
    int N = 0;
    scanf("%d",&N);    
    int arr[N];
    int counter, j, temp;
    int ppp = 0;
    for(counter=0;counter<N;counter++){
        scanf("%d",&arr[counter]);
    }
    for(counter=0;counter<N;counter++){
        for(j=N-1; j>counter; j--){
            if (arr[j]<arr[j-1]){
                temp = arr[j];
                arr[j]=arr[j-1];
                arr[j-1]=temp; 
                ppp = ppp+1;
            }
        } 
    }
    for(j=0; j<N; j++){
        printf("%d",arr[j]);
        if(j != N-1) printf(" ");
    }
    printf("\n%d\n",ppp);
    return 0;
}


Measured memory_bytes: 2124
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <sstream>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <queue>

using namespace std;

int gcd(int a, int b){
    while( b ){
        int m = a % b;
        a = b;
        b = m;
    }
    return a;
}

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

int isPrim(int a){
    if(a==1){
        return 0;
    }
    for(int i=2;i<=(a+1)/2;i++){
        if(a%i==0){
            return 0;
        }
    }
    return 1;
}

long long mod_pow(long long x, long long n, long long mod){
    //x???n???????¨????????????????n??????2?????¨?¨???????????¨????
    //x^22 = x^16 + x^4 + x^2
    long long ret=1;
    while(n>0){
        if(n%2==1){
            ret=(ret*x)%mod;//???????????????
        }
        x=(x*x)%mod;//2???
        n=n/2;
    }
    return ret;
}

struct VV{
    int x;
    int y;
    int w;
    int e;
    int ind;
};

class LessInt {
public:
    bool operator()(const VV& riLeft, const VV& riRight) const {
        if(riLeft.x == riRight.x){
            return riLeft.y > riRight.y;
        }
        return riLeft.x > riRight.x;
        
    }
};

class indInt {
public:
    bool operator()(const VV& riLeft, const VV& riRight) const {
        return riLeft.ind < riRight.ind;
        
    }
};



int main(int argc, const char * argv[])
{
    //std::ios::sync_with_stdio(false);
    //scanf("%s",S);
    //scanf("%d",&N);
    //getline(cin, target);
    //cin >> x >> y;
    //????????????
    
    int N,D;
    string X;
    
    cin >> N >> X >> D;
    
    string ans="";
    
    for(int i=0;i<N;i++){
        if(X[i]=='0' && D>0){
            ans=ans+"1";
            D--;
        }else{
            ans=ans+X.substr(i,1);
        }
    }
    
    if(D>0){
        int i=N-1;
        while(D>0){
            if(X[i]=='1'){
                ans=ans.replace(i,1,"0");
                D--;
            }
            i--;
        }
    }
    
    cout << ans << endl;
    
    //???????????§
    //cout << "ans" << endl;????????????
    //printf("%.0f\n",ans);//?°???°?????\?????¨?????????
    //printf("%.7f",p);
    //printf("%f\n",pow(2,ans.size()));
    
    return 0;
}

Measured memory_bytes: 1220
n = int(input())
h = list(map(int, input().split()))

dp = [0]*n
dp[0] = 0
dp[1] = abs(h[1]-h[0])
for i in range(2,n):
    dp[i] = min(dp[i-1] + abs(h[i-1] - h[i]), dp[i-2] + abs(h[i-2] - h[i]))
print(dp[-1])

Measured memory_bytes: 13980
#include <stdio.h>
#include <stdbool.h>
#define MAX_F 3001

bool x[MAX_F], y[MAX_F];

int main(void)
{
    int a, b, c, d, e, f;
    scanf("%d%d%d%d%d%d", &a, &b, &c, &d, &e, &f);
    for (int i = 0; a * i <= f / 100; i++)
        for (int j = 0; a * i + b * j <= f / 100; j++)
            x[a * i + b * j] = true;
    for (int i = 0; c * i <= f; i++)
        for (int j = 0; c * i + d * j <= f; j++)
            y[c * i + d * j] = true;
    double pct = -1.0;
    int finx, finy;
    for (int i = 1; i <= f / 100; i++) if (x[i]) {
            for (int j = 0; i * 100 + j <= f && j <= e * i; j++)
                if (y[j] && 100.0 * j / (i * 100.0 + j) > pct) {
                    pct = 100.0 * j / (i * 100.0 + j);
                    finx = i * 100;
                    finy = j;
                }
    }
    printf("%d %d\n", finx + finy, finy);
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cstring>
#include <string>    
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
string str;

int main(){
	cin >> str;
	
	char bw = str[0];
	ll ans = 0;
	for(ll i = 1; i < str.size(); i++){
		if(str[i] != bw){
			bw = str[i];
			ans++;
		}
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

#define mp make_pair
#define pb push_back
#define ll long long

#define maxN 111
#define H Hull

const double PI = acos(-1.00);

struct Point {
    ll x, y;
    int id;

    bool operator<(const Point & who)const {
        return mp(x, y) < mp(who.x, who.y);
    }
};

int n, i, limit;
Point P[maxN];
vector<Point> Hull;
pair<double, double> C;
double ans[maxN];

ll cross(Point A, Point B, Point C) {
    B.x -= A.x;
    B.y -= A.y;

    C.x -= A.x;
    C.y -= A.y;

    return B.x * C.y - B.y * C.x;
}

int main()
{
  //  freopen("test.in","r",stdin);

    cin >> n;
    for (i = 1; i <= n; i++) cin >> P[i].x >> P[i].y, P[i].id = i;

    if (n == 2) {
        cout << 0.5 << '\n' << 0.5 << '\n';
        return 0;
    }

    sort(P + 1, P + n + 1);

    Hull.pb(P[1]);
    for (i = 2; i <= n; i++) {
        while (Hull.size() >= 2) {
            if (cross(Hull[Hull.size() - 2], Hull.back(), P[i]) <= 0) break;
            Hull.pop_back();
        }
        Hull.pb(P[i]);
    }

    limit = Hull.size();
    for (i = n - 1; i >= 1; i--) {
        while (Hull.size() > limit) {
            if (cross(Hull[Hull.size() - 2], Hull.back(), P[i]) <= 0) break;
            Hull.pop_back();
        }
        Hull.pb(P[i]);
    }

    for (i = 0; i + 1 < Hull.size(); i++) {
        C.first += Hull[i].x;
        C.second += Hull[i].y;
    }

    C.first /= Hull.size() - 1;
    C.second /= Hull.size() - 1;
    Hull.pb(Hull[1]);

    double sum = 0.00;

    for (i = 1; i + 1 < Hull.size(); i++) {
        /*double ang1 = atan2(Hull[i - 1].y - C.second, Hull[i - 1].x - C.first);
        double ang2 = atan2(Hull[i + 1].y - C.second, Hull[i + 1].x - C.first);

        double ang = ang1 - ang2;
        if (ang < 0) ang += 2.00 * PI;*/

        double ang1 = atan2(H[i].y - H[i - 1].y, H[i].x - H[i - 1].x);
        double ang2 = atan2(H[i].y - H[i + 1].y, H[i].x - H[i + 1].x);
        double ang = ang1 - ang2;
        if (ang < 0) ang = -ang;
        if (ang > PI) ang = 2.00 * PI - ang;
        ang = PI - ang;

        ans[Hull[i].id] = ang / (2.00 * PI);
        sum += ang;

        cerr << ang << ' ';
    }

    cerr << sum << '\n';

    for (i = 1; i <= n; i++)
        printf("%.20lf\n", ans[i]);





    return 0;
}


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

using namespace std;

int main(){
        string s;
        cin>>s;
        char ss='a';
        int ans=0;
        for(int i=0;i<(int)s.length();i++){
                if(s[i]==ss+ans){
                        i=-1;
                        ans++;
                }
        }
        if('z'<ss+ans){
                cout<<"None"<<endl;
        }
        else{
                cout<<(char)(ss+ans)<<endl;
        }
        return 0;
}


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

typedef long long LL;
typedef unsigned long long ULL;

const int PI = 3.141592653589793;
const int inf = 1000111222;
const int mod = 2019;
const int N = 200007;

int main(){

        ios_base::sync_with_stdio(0);
        cin.tie(0); cout.tie(0);

        string s; cin >> s;
        int cnt[N], suffix[N], base = 1;
        LL ans = 0;
        memset(cnt, 0, sizeof cnt);
        memset(suffix, 0, sizeof suffix);
        vector <int> extra;
        for (int i = 0; i < (int)s.length(); i++)
                extra.push_back(s[i] - '0');
        reverse(extra.begin(), extra.end());
        for (int i = 0; i < (int)s.length(); i++) {
                suffix[i + 1] = (suffix[i] + extra[i] * base) % mod;
                base *= 10;
                base %= mod;
        }
        for (int i = 0; i - 1 < (int)s.length(); i++) {
                ans += cnt[suffix[i]];
                cnt[suffix[i]]++;
        }
        cout << ans << "\n";
        return 0;
}


Measured memory_bytes: 5964
#include <iostream>
#include <string>
#include <vector>
#include <set>

using namespace std;

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

int main(void)
{
    int ans = 0;
    int N;
    cin >> N;

    vector<string> S(N);
    rep(i, N){
        cin >> S[i];
    }

    set<string> strList;

    ans++;
    strList.insert(S[0]);

    rep(i, N){
        if(strList.find(S[i]) != strList.end()){
            continue;
        }

        ans++;
        strList.insert(S[i]);
//                cout << " add:" << strList[listcnt + 1] << endl;
    }

    cout << ans << endl;

    return 0;
}

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

#define SZ(x) (int)((x).size())
#define xx first
#define yy second
#define pii pair<int, int>



void solve() {
    int n, x, t;
    cin >> n >> x >> t;
    cout << (t * ((n + x - 1) / x)) << '\n';
}
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    // int _; cin >> _; while (_--)
    solve();
    return 0;
}


Measured memory_bytes: 3616
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <map>
#include <limits>
#include <queue>
#include <set>
using namespace std;
typedef long long int lld;
int T;
int main(void){
    double A, B;
    cin >> A >> B;
    double al = A, ar = A+1;
    double bl = B, br = B+1;
    al /= 0.08; ar /= 0.08;
    bl /= 0.1; br /= 0.1;

    al = max(al,bl);
    ar = min(ar,br);
    if(al < ar) cout << ceil(al);
    else cout << -1;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
    int a;
    cin>>a;
    if(a/1000 == (a%1000)/100 || (a%100)/10 == (a%1000)/100 || (a%100)/10 == (a%10)){
        cout<<"Bad"<<endl;
    }else{
        cout<<"Good"<<endl;
    }
}

Measured memory_bytes: 256
N, K = map(int,input().split())
P = list(map(int,input().split()))
P = [(p+1)/2 for p in P]
sm = sum(P[:K])  # 先頭のK個の和を計算
ans = sm  #  最大値（答え）を保存する
for i in range(N-K):
    sm = sm - P[i] + P[K+i]  # 窓をずらす
    ans = max(ans, sm)  # 最大値（答え）を更新
print (ans)

Measured memory_bytes: 24812
module WeightedDirectedGraph
  (Weight : sig
    type t
    val inf : t (* オーバーフローの恐れはないので，max_intとか突っ込んでも良い *)
    val zero : t
    val neg_inf : t (* オーバーフローの恐れはないので，min_intとか突っ込んでも良い *)
    val ( + ) : t -> t -> t
    val compare : t -> t -> int
  end) :
sig
  type 'a church_list = { fold : 'b. ('a -> 'b -> 'b) -> 'b -> 'b }

  (* あまり行儀が良くない関数達 *)

  (* 隣接行列を作る関数 *)
  val make_adjmatrix :
    (* 頂点の数n *)
    int ->
    (* 辺のリスト
       頂点は0からn-1までの整数でなくてはならない *)
    (int * int * Weight.t) church_list ->
    (* 隣接行列 *)
    Weight.t array array

  val raw_warshall_floyd :
    (* 頂点の数n *)
    int ->
    (* 隣接行列 *)
    Weight.t array array ->
    (* 隣接行列に上書きして，各頂点間の最短距離を格納する *)
    unit

  (* 行儀の良い関数 *)

  val warshall_floyd :
    (* 頂点の数n *)
    int ->
    (* 辺のリスト
       頂点は0からn-1までの整数でなくてはならない *)
    (int * int * Weight.t) church_list ->
    (* 辿り着けなければinf，負閉路を含む経路があればneg_infを返す関数 *)
    (int -> int -> Weight.t)
end =
struct
  type 'a church_list = { fold : 'b. ('a -> 'b -> 'b) -> 'b -> 'b }

  let make_adjmatrix n es =
    let d = Array.make_matrix n n Weight.inf in
    for v = 0 to n - 1 do
      d.(v).(v) <- Weight.zero
    done;
    es.fold (fun (u, v, c) () ->
      (* c < d.(u).(v) *)
      if 0 < Weight.compare d.(u).(v) c
      then d.(u).(v) <- c) (); d

  (* ワーシャルフロイド法の処理の本体 *)
  let raw_warshall_floyd n d =
    for i = 0 to n - 1 do
      for j = 0 to n - 1 do
        for k = 0 to n - 1 do
          let open Weight in
          if 
            (* 経路がない場合は更新しない *)
            0 < Weight.compare inf d.(j).(i)
            && 0 < Weight.compare inf d.(i).(k)
            (* d.(j).(i) + d.(i).(k) < d.(j).(k) *)
            && 0 < Weight.compare d.(j).(k) (d.(j).(i) + d.(i).(k))
          then d.(j).(k) <- d.(j).(i) + d.(i).(k)
        done
      done
    done

  let warshall_floyd n es =
    let d = make_adjmatrix n es in
    raw_warshall_floyd n d;
    fun u v -> try d.(u).(v) with _ -> Weight.inf
end

module G = WeightedDirectedGraph (struct
  type t = int
  let zero = 0
  let inf = max_int
  let neg_inf = min_int
  let ( + ) = ( + )
  let compare = compare
end)

let () = Scanf.scanf "%d %d %d\n" @@ fun n m l ->
  let es = Array.init m @@ fun _ -> Scanf.scanf "%d %d %d\n" @@ fun a b c -> a - 1, b - 1, c in
  let d = G.make_adjmatrix n { G.fold = fun f ->
    Array.fold_right (fun ((a, b, c) as e) acc -> f (b, a, c) @@ f e acc) es } in
  G.raw_warshall_floyd n d;
  for i = 0 to n - 1 do
    for j = 0 to n - 1 do
      d.(i).(j) <-
        if d.(i).(j) <= 0
        then 0
        else if d.(i).(j) <= l
        then 1
        else max_int
    done
  done;
  G.raw_warshall_floyd n d;
  Scanf.scanf "%d\n" @@ fun q ->
    for i = 1 to q do
      Scanf.scanf "%d %d\n" @@ fun s t ->
        Printf.printf "%d\n" @@
        if d.(s - 1).(t - 1) = max_int
        then -1
        else d.(s - 1).(t - 1) - 1
    done




Measured memory_bytes: 8660
#include <iostream>
#include <iomanip>
#include <bits/stdc++.h>
#include <vector>
#include <iterator>
#include <string>
#define pan(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define vi vector<int>
#define pb push_back
using namespace std;
 

int main(){
    string s;
    cin>>s;
    string days[7]={"SUN","MON","TUE","WED","THU","FRI","SAT"};
    int i=0;
    pan(j,7){
        if(s==days[j]){
            i=j;
            break;
        }
    }
    cout<<7-i;
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
    int n;
    scanf("%d", &n);

    int array[1000];
    int num;
    for (int i = 0; i < n; i++) {
        scanf("%d", &num);
        array[i] = num;
    }

    for (int i = (n - 1); i > 0; i--) {
        printf("%d ", array[i]);
    }
    printf("%d", array[0]);
    printf("\n");

    return 0;
}


Measured memory_bytes: 2044
#include <iostream>
#include<cmath>
#include<iomanip>
using namespace std;

int main() {
	double x1,y1,x2,y2;cin>>x1>>y1>>x2>>y2;
	cout<<fixed<<setprecision(8)<<sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1))<<endl;
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;

ll ans = 0;

void cnt(vector <int> a) {
    int cur = 0;
    for (int i = (int)a.size() - 1; i >= 0; --i) {
        if (a[i] == 1) ++cur;
        else ans += cur;
    }
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.setf(ios::fixed); cout.precision(20);
    #ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    string s;
    cin >> s;
    int n = s.size();   
    vector <int> a;
    for (int i = 0; i < (int)s.size(); ++i) {
        if (s[i] == 'A') a.push_back(0);
        else if (s[i] == 'B') {
            if (i + 1 <= (int)s.size() && s[i + 1] == 'C') {
                a.push_back(1);
                ++i;
            } else {
                if (a.empty() || a.back() != 2) a.push_back(2);
            }
        } else {
            if (a.empty() || a.back() != 2) a.push_back(2);
        }
    }
    a.push_back(2);
    vector <int> cur;
    for (int i = 0; i < (int)a.size(); ++i) {
        if (a[i] == 2) {
            cnt(cur);
            cur.clear();
        } else {
            cur.push_back(a[i]);
        }
    }
    cout << ans << '\n';
}

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

int main() {
  int N,A; cin >>N >>A;
  int check=N%500;
  if (check<=A) cout <<"Yes" <<endl;
  else cout <<"No" <<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int (i)=0;(i)<(n);i++)
using ll = long long;
const long long INF = 1LL << 60;
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(){

ll n;cin >> n;
ll a[n][3];
rep(i,n)rep(j,3)cin >> a[i][j];

long long dp[110000][3];
rep(j,3)rep(i,110000)dp[i][j]= 0;
rep(j,3)dp[0][j]=0;

for(int i = 0; i< n;i++){
    for(int j = 0 ; j<3;j++){
        for(int k = 0;k<3;k++){
            if(k!=j)chmax(dp[i+1][k],a[i][k]+dp[i][j]);
        }
    }
}

 long long res = 0;
    for (int j = 0; j < 3; ++j) chmax(res, dp[n][j]);
    cout << res << endl;
return 0;
}





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

int main() {
	int n;
	while(cin >> n, n) {
		int ans[8] = {0};
		for(int i = 0; i < n; i++) {
			int a;
			cin >> a;
			if(a > 60)
				a = 60;
			ans[a / 10]++;
		}
		for(int i = 0; i < 7; i++)
			cout << ans[i] << endl;
	}
}

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

using namespace std; 
 
#define int long long
#define M 1000000007
 
signed main(){
	
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
	
	int a,b,c,d;
	cin >> a >> b >> c >> d;
	cout << max(b*d,max(b*c,max(a*c,a*d))) << endl;
}


Measured memory_bytes: 3616
function main (s) {
    s=s.split(" ");
	var s2=new Set();
	for(var i=0;i<3;i++){
		s[i]=parseInt(s[i]);
		s2.add(s[i]);
	}
	console.log(s2.size);
}
 
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
#include<complex>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 998244353;
const ll MAX = 4000001;
const double eps = 1E-18;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

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

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};

class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% MOD + MOD) % MOD) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint& a) {
		if ((x += a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator-=(const mint& a) {
		if ((x += MOD - a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator*=(const  mint& a) {
		(x *= a.x) %= MOD;
		return *this;
	}
	mint operator+(const mint& a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint& a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint& a) const {
		mint res(*this);
		return res *= a;
	}

	mint operator^(const ll& t)const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}
	// for prime MOD
	mint inv() const {
		return pow(MOD - 2);
	}
	mint& operator/=(const mint& a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint& a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream& os, const mint& m) {
		os << m.x;
		return os;
	}
};

///////////////////////////


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

	vector<string> S(N);
	string T;

	cout << 0 << endl;
	cout << flush;
	cin >> T;
	if (T == "Vacant") { return 0; }
	S[0] = T;

	cout << N-1 << endl;
	cout << flush;
	cin >> T;
	if (T == "Vacant") { return 0; }
	S[N-1] = T;

	ll l = 0;
	ll r = N-1;
	while (r-l>1) {
		ll m = (l + r) / 2;
		cout << m << endl;
		cout << flush;
		cin >> T;
		if (T == "Vacant") { return 0; }
		S[m] = T;

		if (S[l] == S[m] && (m - l) % 2 == 1) { r = m; }
		else if (S[l] != S[m] && (m - l) % 2 == 0) { r = m; }
		else { l = m; }
	}


	
	
	system("PAUSE");
}


Measured memory_bytes: 1620
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i=a; i<n; i++)
#define RREP(i, a, n) for(ll i=n-1; i>=a; i--)
typedef long long ll;
const ll mod =1e9+7;
const ll inf =1e18;
using namespace std;

ll n;
ll ans;
map<ll, ll> mp;
int main(){
    cin>>n;
    REP(i, 0, n){
        ll aa, bb;
        cin>>aa>>bb;

        mp[aa]++;
        mp[bb+1]--;
    }

    ll cnt=0;
    for(auto itr:mp){
        cnt+=itr.second;
        ans=max(ans, cnt);
    }

    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 15608
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}

func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}

func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n := iScan()
	s := []rune(Scan())
	for _, v := range s {
		fmt.Print(string(rune((int(v)-65+n)%26 + 65)))
	}
	fmt.Println("")
}


Measured memory_bytes: 2068
#include<bits/stdc++.h>
using namespace std;
int n,ans=0,c[20][20];
int find_p(int x){
	int tmp=x;
	while(tmp>=10) 
		tmp/=10;
	return tmp;
}
int main(){
	memset(c,0,sizeof(c));
	cin>>n;
	for(int i=1;i<=n;i++){
		int j=find_p(i),k=i%10;
		c[j][k]++;
	}
	for(int i=0;i<=9;i++)
		for(int j=0;j<=9;++j)
			ans+=c[i][j]*c[j][i];
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long int lli;

int main(){
	int n,m;
	cin >> n >> m;
	int ans = 0;
	for(int i=0; i<n; i++){
		int sub = 0;
		for(int j=0; j<m; j++){
			int a;
			cin >> a;
			sub += a;
		}
		ans = max(ans, sub);
	}
	cout << ans << endl;
	return 0;
}



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

using namespace std ;


int n, y;
int main() {
    cin >> n >> y;
    if(y % 1000) {
        printf("-1 -1 -1\n");
        return 0;
    }
    int cnt = y / 1000;
    if(cnt < n) {
        printf("-1 -1 -1\n");
        return 0;
    }
    for(int i = 0; i <= y / 10000; i++) {
        for(int j = 0; j <= y / 5000; j++) {
            if(i + j > n) continue;
            if(i * 9 + j * 4 == cnt - n){
                printf("%d %d %d", i, j, n - i - j);
                return 0;
            }
        }
    }
    printf("-1 -1 -1\n");
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
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 INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	int n,k;
	int ans=0;
	cin >>n>>k;
	int h;
	rep(i,n){
		cin>>h;
		if(h >=k){
			ans++;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
int num[100005],bart[100005],kart[100005];
int main()
{
 //freopen("input.txt","r",stdin);
 // freopen("output.txt","w",stdout);
  ios_base:: sync_with_stdio(0);
    cin.tie(0);
    int a=0,b,c,n,i,j,k=0,l=0;
   cin>>a>>b;
   b=b*2;
   a=a-b;
   if(a<=0) cout<<"0";
   else cout<<a;
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define TEST int t = 1; while(t--) solve()

void solve(){
    
    int n,m,X;
    cin>>n>>m>>X;
    vector<vector<int> > v(n,vector<int>(m));
    vector<int> c(n);
    for(int i=0;i<n;i++)
    {
    	 cin>>c[i];
    	 for(int j=0;j<m;j++)
    	 {
    	 	 cin>>v[i][j];
    	 }
    }

    int mask=0;
    int xt=INT_MAX;

    for(int i=0;i<=pow(2,n)-1;i++)
    {    vector<int> tm(m,0);
    	  int cs=0;
    	 for(int j=0;j<n;j++)
    	 {      
               if((i&(1<<j))>0)
               {
               	    cs+=c[j];
               	    for(int k=0;k<m;k++)
               	    {
                         tm[k]+=v[j][k];
               	    }

               	                  }


    	 }
    	 bool flag=true;
    	 for(auto x:tm)
    	 {
    	 	if(x<X)
    	 	{
    	 	        	flag=false;
    	 	}
    	 }

    	 if(flag)
    	 {
    	 	 xt=min(xt,cs);
    	 }
    }

    if(xt==INT_MAX)
    {
    	 cout<<-1<<"\n";
    }
    else
    {
    	 cout<<xt<<"\n";
    }
}

signed main(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL); TEST; return 0;
}

Measured memory_bytes: 4096
#include<bits/stdc++.h>
using namespace std;
 
// data types
#define ll long long int
#define ld long double
 
//funtion macros
 
 
// stl
#define lp(var,start,end) for (ll var = start; var <end ; ++var)
#define ilp(var,start,end) for(ll var = start; var>=end ; var--)
#define pb push_back
#define mp make_pair
#define pf push_front
#define ff first
#define ss second
#define vll vector<ll>
#define vld vector<ld>
#define pll pair<ll,ll> 
#define pld pair<ld,ld> 
#define vpll vector<pll>
#define vpld vector<pld>
#define all(X) X.begin(),X.end()
#define sz(x) ((ll)((x).size()))
 
#define mod 1000000007
 
// utility functions
ll max(ll a, ll b)
{
    if(a>b)return a;
    return b;
}
 
ll min(ll a, ll b)
{
	if(a<b)return a;
    return b;
}
 
ll power(ll x, ll y, ll m=mod)
{
	if(y<0)
    {
		x = power(x,m-2);
		y = -y;
	}
	ll ans=1;
	x = x % m;
	while(y)
    {
		if(y&1) ans = (ans*x)%m;
		y=y/2;
		x=(x*x)%m;
	}
	return ans;
}
 
 
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	ll n,a,ans=1,i;
    ll p = 1e18;
    ll flag = 1;
    cin >> n;
    ll arr[n];
    for(i=0;i<n;i++)
    {
        cin >> arr[i];
        if(arr[i]==0)
        {
            flag = 0;
            ans = 0;
            cout << "0\n";
            return 0;
        }
    }
    lp(i,0,n)
    {
        
        if(arr[i]<=p/ans)
        {
            ans = ans*arr[i];
        }
        else
        {
            cout << "-1\n";
            return 0;
        }
        
    }
    cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 4424
#!/usr/bin/node
// Generated by CoffeeScript 1.3.1 (minified manually)
(function() {
  var a=[],ma,mi,n=0,s,stdin;
  stdin=process.openStdin();
  stdin.setEncoding('utf8');

  stdin.on('data', function(input) {
    var i=0,len,ref,x=[];
    ref=input.split("\n");
    for(len=ref.length;i<len;i++)x.push(parseInt(ref[i]));
    if(x.length>2||!isNaN(x[1]))a=x;
    else a.push(x[0]);
  });

  stdin.on('end', function(z) {
    var i,m;
    n=0;
    while(true){
      m=a[n];
      if(m==0)process.exit();
      s=0;ma=0;mi=1000;
      for(i=n+1;i<=n+m;i++){
        s=s+a[i];
        if(ma<a[i])ma=a[i];
        if(mi>a[i])mi=a[i];
      }
      console.log(Math.floor((s-ma-mi)/(m-2)));
      n=n+m+1;
    }
  });
}).call(this);

Measured memory_bytes: 7812
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std;

int main() {
  
  int a,b,c,d,x;
  long long la,lb;
  double da,db;
  string s,ss,sss;
  
  int ans = 0;
  string anss = "";
  
  cin >> a >> b;
  
  int ab [] = {0 , 1 , 3 , 1 , 2 , 1 , 2 , 1 , 1 , 2 , 1 , 2 , 1};
  int result3 = std::max({a, b, c});
//--------------------------------------------------------------------------------

  if(a > b*2) ans = a-b*2;
  else ans = 0;

  cout << ans << endl;

}

Measured memory_bytes: 256
G = [nil, nil, nil,
  %w(
    a..
    a..
    .bb
  ),
  %w(
    aabc
    ddbc
    efgg
    efhh
  ),
  %w(
    abbcc
    ad..e
    fd..e
    f.ggh
    iijjh
  ),
  %w(
    aabc..
    ddbc..
    ..eefg
    ..hhfg
    ij..kk
    ij..ll
  ),
  %w(
    aabbcc.
    ..de..f
    ..de..f
    gh....i
    gh....i
    jj..kkl
    ..mmnnl
  )
]

N = gets.to_i
A = N.times.map{?. * N}

def w x,j
  G[x].each do |g|
    s = ?. * N
    s[j,x] = g
    puts s
  end
end

if N == 2
  p -1
elsif N == 3
  w 3,0
else
  m = N%4+4
  w m,0
  (N/4-1).times do |j|
    w 4,m+j*4
  end
end


Measured memory_bytes: 4732
#include <bits/stdc++.h>
#define re return
#define ll long long
#define ull unsigned ll
#define ld long double
#define f first
#define s second
#define pi acos(-1)
#define oo (ll)1e9
#define OO (ll)1e18
#define EPS 1e-7
#define FX(n) fixed<<setprecision(n)
#define mm(o,k) memset(o,k,sizeof o)
#define IO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
const int maxn=200005;
ll lcm(ll x,ll y){
    re (x*y)/__gcd(x,y);
}
int main()
{
    IO;
    ll n;
    cin >> n;
    cout<<lcm(n,2ll)<<endl;
    re 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")

#include <bits/stdc++.h>

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define F first
#define S second
#define pii pair<int,int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<pii>
#define read(FILE)  freopen(FILE, "r", stdin);
#define out(FILE) freopen(FILE, "w", stdout);
#define clr(x, y) memset(x,y,sizeof(x));
#define IO ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define all(x) x.begin(),x.end()
#define rep(i, m, n) for(int i=m ; i<n ; i++)
#define forr(i, m, n) for(int i=m ; i<=n ; i++)
#define endl '\n'
#define pb push_back
#define re return
const int N = 1e5 + 5;
const ll OO = 1e9+7;
using namespace std;
int main() {
    IO;
    string s; cin>>s;
    if(s.find('7')!=-1)
        cout<<"Yes";
    else
        cout<<"No";

    


}

Measured memory_bytes: 3640
/*
    ThunderClap and Flash
    Raunaq Singh
*/
#include "bits/stdc++.h" 
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
#define ThunderClap ios::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL);
#define debugg(something)   cout<<#something<<" - "<<something<<"\n";
#define vi vector
#define umap unordered_map
#define uset unordered_set
#define mset multiset
#define LB lower_bound
#define UB upper_bound
#define mp make_pair
#define pb push_back
#define in insert
#define s second
#define f first
#define pQueue priority_queue
#define maxElement *max_element
#define minElement *min_element
#define MAX 100000LL
#define mod 1000000007LL
#define inf 1000000000000000000LL
#define mI2 500000004LL
inline ll add(ll a, ll b){ return ((a%mod) + (b%mod))%mod;}
inline ll mul(ll a, ll b){ return ((a%mod) * (b%mod))%mod;}
inline ll sub(ll a, ll b){ return ((a%mod) - (b%mod) + mod)%mod;}

void Flash(){
    string ss;
    cin>>ss;
    if (ss[ss.size() - 1] == 's') {
        ss.push_back('e');
    }
    ss.push_back('s');
    cout<<ss<<"\n";
}

int main(int argc, char const *argv[]){ 
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
    #endif
    ThunderClap;
    ll t = 1;
    //cin>>t;
    for(ll i = 1; i <= t; i++){
        //cout<<"Case #"<<i<<": ";
        Flash();
    }
    return 0;
}


Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pb push_back
#define ff first
#define ss second
#define rep(i,a,n) for(int i=a;i<n;i++)
#define M 1000000007
ll power(ll x, ll y, ll p)
{
    int res = 1;
    x = x % p;
    while (y > 0)
    {   if (y & 1)
        res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
int main()
{
	IOS;
	int n;
	cin>>n;
	string s;
	cin>>s;
	vector<int>v[3];
	for(int i=0;i<n;i++)
	{
		if(s[i]=='R')
		v[0].pb(i+1);
		else if(s[i]=='G')
		v[1].pb(i+1);
		else
		v[2].pb(i+1);
	}
	ll ans=0;
	for(int i=0;i<v[0].size();i++)
	{
		for(int j=0;j<v[1].size();j++)
		{
			 int p=min(v[0][i],v[1][j]),q=max(v[0][i],v[1][j]);
			 int  mid1=(2*q-p);
			 int mid3=(2*p-q);
			 int mid2=(p+q)/2;
			 if((p+q)%2==0)
			 {
			 	if(binary_search(v[2].begin(),v[2].end(), mid2))
			 	ans--;
			 }
			 if(binary_search(v[2].begin(),v[2].end(), mid1))
			 ans--;
			if(binary_search(v[2].begin(),v[2].end(), mid3))ans--;
			 ans+=v[2].size();
		}
	}
	cout<<ans;
	
}


Measured memory_bytes: 3612
#include<bits/stdc++.h>
#define F first
#define S second
#define endl '\n'
#define lcm( a, b ) ((a)/__gcd(a,b)*(b))
#define MP make_pair
#define pb push_back
#define all(x) (x).begin(),(x).end()

using namespace std;

typedef long long LL;
typedef pair<int, int> P;
typedef pair<int, P> i_P;
typedef pair< LL, LL > L_P;

const int INF = INT_MAX;
const int MIN = INT_MIN;
const LL LINF = LLONG_MAX;
const int MOD = 1000000000 + 7;
const int SIZE = 100005;

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

    vector< int > v;
    string s;
    cin >> s;
    for( int i = 0; i < s.size() - 1; ++i ) {
        if( s[i] == 'B' && s[i + 1] == 'C' ) {
            v.pb( 2 );
            ++i;

        } else if( s[i] == 'A' ) v.pb( 1 );
        else v.pb( 0 );

    }
    LL res = 0;
    LL bc_cnt = 0;
    for( int i = v.size() - 1; i >= 0; --i ) {
        if( v[i] == 1 ) {
            res += bc_cnt;

        } else if( v[i] == 2 ) {
            ++bc_cnt;

        } else {
            bc_cnt = 0;

        }
    }
    cout << res << endl;

    return 0;
}



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

int bl[2020], wh[2020], bit[4040], dp[2020][2020];

void bitAdd(int n, int a){
	for(int i=n; i<4040; i += i&(-i)){
		bit[i] += a;
	}
}

int bitSum(int n){
	int res=0;
	for(int i=n; i>0; i -= i&(-i)){
		res += bit[i];
	}
	return res;
}

int main() {
	int N;
	cin >> N;
	for(int i=1; i<=N*2; ++i){
		char c;
		int a;
		cin >> c >> a;
		if(c=='B') bl[a]=i;
		else wh[a]=i;
	}
	dp[0][0]=0;
	for(int i=1; i<=N; ++i){
		bitAdd(bl[i], 1);
		dp[i][0]=dp[i-1][0]+bl[i]-bitSum(bl[i]);
	}
	for(int i=1; i<=N; ++i){
		for(int j=1; j<=N; ++j) bitAdd(bl[j], -1);
		bitAdd(wh[i], 1);
		dp[0][i]=dp[0][i-1]+wh[i]-bitSum(wh[i]);
		for(int j=1; j<=N; ++j){
			bitAdd(bl[j], 1);
			dp[j][i]=dp[j-1][i]+bl[j]-bitSum(bl[j]);
			dp[j][i]=min(dp[j][i], dp[j][i-1]+wh[i]-bitSum(wh[i]));
		}
	}
	cout << dp[N][N] << endl;
	return 0;
}

Measured memory_bytes: 16128
#include <bits/stdc++.h>
#define reg register
#define MAXN 2505
#define MAXE 5005

using namespace std;

const int mod = 1e9 + 7;
int N, M, P;
int head[MAXN], to[MAXE], nex[MAXE], val[MAXE], tote;
int dist[MAXN], rec[MAXN];
bool vis[MAXN], able[MAXN];
struct edges {
	int u, v, c;
}e[MAXE];

inline int Rd() {
	int x = 0; char ch = getchar();
	while(ch < '0' || ch > '9') ch = getchar();
	while(ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
	return x;
}
inline void add_edge(int u, int v, int c) {
	nex[++tote] = head[u], to[tote] = v, val[tote] = c, head[u] = tote;
	return;
}

void dfs(int str) {
	able[str] = vis[str] = true;
	for(int i = head[str]; i; i = nex[i])
		if(!vis[to[i]])
			dfs(to[i]);
	return;
}
void clear() {
	tote = 0;
	memset(head, 0, sizeof head);
	memset(vis, 0, sizeof vis);
	memset(nex, 0, sizeof nex);
	memset(to, 0, sizeof to);
	return;
}

void SPFA() {
	queue<int> que; que.push(1);
	for(reg int i = 2; i <= N; ++i) dist[i] = -mod;
	while(!que.empty()) {
		int s = que.front(); que.pop(), vis[s] = false;
		if(!able[s]) continue;
		for(int i = head[s]; i; i = nex[i]) {
			if(dist[to[i]] < dist[s] + val[i]) {
				dist[to[i]] = dist[s] + val[i];
				if(!vis[to[i]]) {
					vis[to[i]] = true, ++rec[to[i]];
					if(rec[to[i]] >= N) {
						if(able[to[i]]) {
							puts("-1");
							exit(0);
						}
						continue;
					}
					que.push(to[i]);
				}
			}
		}
	}
	return;
}

int main() {
	N = Rd(), M = Rd(), P = Rd();
	for(reg int i = 1; i <= M; ++i) {
		e[i].u = Rd(), e[i].v = Rd(), e[i].c = Rd();
		add_edge(e[i].v, e[i].u, 0);
	}
	dfs(N);
	clear();
	for(reg int i = 1; i <= M; ++i)
		add_edge(e[i].u, e[i].v, e[i].c - P);
	SPFA();
	if(dist[N] < 0) dist[N] = 0;
	cout << dist[N] << endl;
	return 0;
}


Measured memory_bytes: 512
def prime_list(n)
  return [] if n < 2

  # seve 篩（ふるい）
  seve = Array.new(n + 1){true}
  primes = {}

  (2..n).each do |i|
    if seve[i] == true
      primes[i] = 1
      k = i * i
      while k <= n
        seve[k] = false
        k += i
      end
    end
  end
  primes
end

MAX = 10 ** 5

pl = prime_list(MAX)

Q = gets.strip.to_i
lr = Q.times.map { gets.strip.split.map(&:to_i) }

a = Array.new(MAX + 1) {0}

c = 0
(1..MAX).each do |i|
  unless pl[i].nil?
    c += 1 unless pl[(i + 1) / 2].nil?
  end
  a[i] = c
end

lr.each do |l, r|
  puts a[r] - a[l - 1] 
end


Measured memory_bytes: 12012
A,B,C=[int(s) for s in input().split(" ")]

A=[A]
B=[B]
C=[C]

Count=0
for i in range(1000000000):
    A.append(B[i]//2+C[i]//2)
    B.append(A[i]//2+C[i]//2)
    C.append(B[i]//2+A[i]//2)
    Count+=1
    if A[i+1]%2!=0 or B[i+1]%2!=0 or C[i+1]%2!=0:
        break
    if Count>=100000:
        Count=-1
        break
       
    
print(0 if A[0]%2!=0 or B[0]%2!=0 or C[0]%2!=0 else Count)

Measured memory_bytes: 15184