akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;

int n,a,b,c,d;
string s;
bool last=false,flag=false;

void solve(){
    cin >> n >> a >> b >> c >> d;
    cin >> s;
    if (c<d){
        Rep(i,b-1,d){
            if (last and s[i]=='#') {
                std::cout << "No" << endl;
                return;
            }
            if (s[i]=='#') last=true;
            else last=false;
        }
        Rep(i,a-1,c){
            if (last and s[i]=='#') {
                std::cout << "No" << endl;
                return;
            }
            if (s[i]=='#') last=true;
            else last=false;
        }
    }else{
        Rep(i,b-1,d){
            if (last and s[i]=='#') {
                std::cout << "No" << endl;
                return;
            }
            if (s[i]=='#') last=true;
            else last=false;
            if(s.substr(i-1,3)=="...") {
                flag=true;
            }
        }
        if (!flag) {
            std::cout << "No" << endl;
            return;
        }
        Rep(i,a-1,c){
            if (last and s[i]=='#') {
                std::cout << "No" << endl;
                return;
            }
            if (s[i]=='#') last=true;
            else last=false;
        }
    }
    std::cout << "Yes" << endl;
}

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

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

using namespace std;

int prz(int x) {
  if(x == 1) return 300000;
  else if(x == 2) return 200000;
  else if(x == 3) return 100000;
  else return 0;
}

int main() {
  int x, y, ans = 0;
  cin >> x >> y;
  ans += prz(x);
  ans += prz(y);
  if(x == 1 && y == 1) ans += 400000;
  cout << ans << '\n';;
}


Measured memory_bytes: 256
n,m=map(int,input().split())
table=[0]*(n+2)
for i in range(m):
    l,r=map(int,input().split())
    table[l]+=1
    table[r+1]-=1
from itertools import accumulate
from collections import Counter as co
var=co((accumulate(table)))

if m not in var:print(0)
else:print(var[m])




Measured memory_bytes: 15472
#include <iostream>
using namespace std;
int main(void)
{
    int x,y;
    
    for(int i = 0;i < 3000;i++)
    {
        cin >> x >> y;
        
        if(x == 0 && y == 0)break;
        
        if(x > y)swap(x,y);
        
        cout << x << " " << y <<endl;
    }
}



Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>

using namespace std;

typedef long long ll;

#define cerr if (false) cerr

const int MAXN = 1e5 + 239;
const ll INF = 1e10 + 239;

int prime[MAXN];
vector<int> primes;

void init() {
    fill(prime, prime + MAXN, 1);
    for (int i = 2; i < MAXN; i++) {
        if (prime[i]) {
            for (int j = 2 * i; j < MAXN; j += i) {
                prime[j] = 0;
            }
            primes.push_back(i);
        }
    }
}

ll no_cubic(ll x) {
    for (ll i = 2; i * i * i <= x; i++) {
        while (x % (i * i * i) == 0) {
            x /= (i * i * i);
        }
    }
    return x;
}

ll get_pair(ll x) {
    ll sq = 1;
    ll tx = x;
    for (int t = 2; (ll)t * t * t <= tx; t++) {
        if (tx % ((ll)t * t) == 0) {
            sq *= t;
            tx /= t;
            tx /= t;
        } 
        if (tx % t == 0) {
            tx /= t;
        }
    }
    {
        ll uu = sqrt(tx);
        if (uu * uu == tx) {
            sq *= uu;
        }
    }
    ll sl = x / (sq * sq);
    ll ans = sq * sl;
    if (ans > INF / sl) {
        return -1;
    } else {
        return ans * sl;
    }
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    init();

    int n;
    cin >> n;
    map<ll, int> cnt;
    for (int i = 0; i < n; i++) {
        ll x;
        cin >> x;
        x = no_cubic(x);
        cnt[x]++;
    }
    auto get_cnt = [&](ll x) {
        if (cnt.count(x)) {
            return cnt[x];
        } else {
            return (int)0;
        }
    };
    int ans = 0;
    if (cnt.count(1)) {
        ans++;
        cnt.erase(1);
    }
    set<pair<ll, ll>> seen;
    for (auto uu : cnt) {
        ll f, no_need;
        tie(f, no_need) = uu;
        ll pr = get_pair(f);
        if (pr == -1) {
            ans += cnt[f];
            continue;
        }
        ll a = pr;
        ll b = f;
        if (a > b) {
            swap(a, b);
        }
        if (!seen.count({a, b})) {
            ans += max(get_cnt(a), get_cnt(b));
            seen.insert({a, b});
        }
    } 
    cout << ans << endl;
}

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

using namespace std;
int main(int argc, char const *argv[])
{
    string s;
    cin>>s;
    int cnt=0;
    for (int i = 0; i < s.length(); i++)
    {
        if(s[i]=='x'){
            cnt++;
        }
    }
    if(cnt>7)cout<<"NO"<<endl;
    else
    cout<<"YES"<<endl;
    
    


    return 0;
}


Measured memory_bytes: 256
# https://atcoder.jp/contests/abc050/tasks/arc066_a
# 並び方がありうるかの判別は簡単で、Nが偶数なら、Aがすべて奇数かつすべての数が2回ずつ出現する
# 奇数なら、Aが全て偶数で、0だけ1回出現しほかは2回ずつ出現する。

# ありえるならば、N&1→ 2**(N//2)が答え
# N&1 =0→ 2**(N//2)が答え
# どちらも同じ式でOK
import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


N = read_a_int()
A = read_ints()

from collections import Counter
A_cnt = Counter(A)


def end():
    print(0)
    exit()


if N & 1:
    if A_cnt[0] != 1:
        end()
    for i in range(2, N, 2):
        if A_cnt[i] != 2:
            end()
else:
    for i in range(1, N, 2):
        if A_cnt[i] != 2:
            end()

print(pow(2, N // 2, 10**9 + 7))


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

# 1 "<stdin>"
# 1 "<built-in>"
# 1 "<command-line>"
# 31 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 32 "<command-line>" 2
# 1 "<stdin>"

using namespace std;

# 1 "../Algo/NumberTheory/modulo.h" 1
class ModuloOps {
public:
    ModuloOps(long long mod): MOD(mod) {
    }

    long long binPow(long long a, long long b) {
        if (b < 0) {
            throw "invalid op";
        }
        if (b == 0) {
            return 1;
        }
        auto prev = binPow(a, b/2);
        return mul(mul(prev, prev), b % 2 == 1 ? normalize(a) : 1);
    }

    long long inv(long long a) {
        return binPow(a, MOD - 2);
    }

    inline long long add(long long a, long long b) {
        return normalize(a + b);
    }

    inline long long sub(long long a, long long b) {
        return normalize(a - b);
    }

    inline void inc(long long &a, long long b) {
        a = add(a, b);
    }

    inline long long mul(long long a, long long b) {
        return normalize(normalize(a) * normalize(b));
    }

    inline long long div(long long a, long long b) {
        return mul(a, inv(b));
    }

private:
    long long MOD;

    inline long long normalize(long long a) {
        return (a%MOD + MOD) % MOD;
    }
};
# 5 "<stdin>" 2

ModuloOps MOD(998244353);

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n, s;
    cin >> n >> s;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    vector<long long> pw2(n+1, 1);
    for (int i = 1; i <= n; i++) {
        pw2[i] = MOD.mul(pw2[i-1], 2);
    }
    auto inv2 = MOD.inv(2);

    function<long long(int, int)> dp;
    vector<vector<long long>> mem(n, vector<long long>(s+1, -1));
    dp = [&] (int i, int tot) -> long long {
        if (i < 0) {
            return tot == 0 ? pw2[n] : 0ll;
        }
        if (tot < 0) {
            return 0ll;
        }
        if (mem[i][tot] == -1) {
            long long ans = MOD.add(dp(i-1, tot), MOD.mul(inv2, dp(i-1, tot - a[i])));
            mem[i][tot] = ans;
        }
        return mem[i][tot];
    };
    cout << dp(n-1, s) << endl;
}


Measured memory_bytes: 73952
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

ll dp[100001];
int w[200000],v[200000];
int main(){
	int n,W;scanf("%d%d",&n,&W);
	rep(i,n){
		scanf("%d%d",&w[i],&v[i]);
	}
	rep(i,n){
		for(int j=W;j>=0;j--){
			if(j>=w[i])dp[j]=max(dp[j],dp[j-w[i]]+v[i]);
		}
	}
	cout<<dp[W]<<endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
int main() {
  int h,w,k;
  cin>>h>>w>>k;
  vector<vector<char>>c(h,vector<char>(w));
  rep(i,h){
    rep(j,w){
      cin>>c[i][j];
    }
  }
  int ans=0;
  for(int t=0;t<(1<<6);t++){
    for(int m=0;m<(1<<6);m++){
      bitset<6>s(t);
      bitset<6>ss(m);
      int now=0;
      rep(i,h){
        rep(j,w){
          if(s.test(i) && ss.test(j)){
            if(c[i][j]=='#') now++;
          }
        }
      }
      if(now==k){
        if(pow(2,h)>t && pow(2,w)>m) ans++;
      }
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 4000
#include <iostream>
#include <string>
#include <vector>

int main() {
    int N, Q;
    std::string S;
    std::cin >> N >> Q >> S;

    std::vector<int> cnt(N + 1, 0);
    for (int i = 2; i <= N; ++i) {
        cnt[i] = cnt[i - 1];
        if (S.substr(i - 2, 2) == "AC") ++cnt[i];
    }

    for (int q = 0; q < Q; ++q) {
        int l, r;
        std::cin >> l >> r;
        std::cout << cnt[r] - cnt[l] << std::endl;
    }
    return 0;
}


Measured memory_bytes: 1408
n = int(input())
l = [0] * n
for i in range(n):
    l[i] = list(map(str, input().split()))
    l[i][1] = int(l[i][1])
l_sorted = sorted(l, key=lambda l: l[1], reverse=True)
l_sorted = sorted(l_sorted, key=lambda l: l[0])

for i in range(len(l)):
    print(l.index(l_sorted[i]) + 1)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int INF = 1000000000;
#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define rep(i,n) REP(i, 0, n)
typedef pair<int, int> pint;//first : MP, second : Damage
void set_cost(vector<int>& cost, const vector<pint>& attack){
    cost[0] = 0;
    REP(i, 1, cost.size()){
        for(pint k : attack){
            int temp = k.first;
            if(i - k.second >= 0) temp += cost[i - k.second];
            cost[i] = min(cost[i], temp);
        }
    }
    return;
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    while(cin >> N && N){
        int HP_MAX = -INF;
        vector<int> HP(N);
        rep(i, N){
            cin >> HP[i];
            HP_MAX = max(HP_MAX, HP[i]);
        }
        int M; cin >> M;
        vector<pint> single, all;
        rep(i, M){
            string a, b;
            int c, d;
            cin >> a >> c >> b >> d;
            if(b == "All")
              all.push_back(pint(c, d));
            else
              single.push_back(pint(c, d));
        }
        vector<int> scost(HP_MAX + 1, INF), acost(HP_MAX + 1, INF);
        set_cost(scost, single);
        set_cost(acost, all);
        ll ans = INF;
        rep(d, HP_MAX + 1){
            ll sum = acost[d];
            for(int k : HP){
                int need = max(0, k - d);
                sum += scost[need];
            }
            ans = min(sum, ans);
        }
        /*
        while(true){
            int hit = INF, enemies = 0;
            for(int k : HP)
              if(k > 0) {
                  enemies++;
                  hit = min(k, hit);
              }
            if(enemies == 0) break;
            int cost, damage;
            if(acost[hit] > scost[hit] * enemies){
                cost = scost[hit];
                REP(i, hit, HP_MAX + 1) if(scost[i] != cost){ damage = i - 1; break;}
                cost *= enemies;
            }else{
                cost = acost[hit];
                REP(i, hit, HP_MAX + 1) if(acost[i] != cost){ damage = i - 1; break;}
            }
            for(int& k : HP) k -= damage;
            ans += cost;
        }*/
        
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 3628
fun main(args: Array<String>) {
    var (n, m) = readLine()!!.split(" ").map{it.toInt()}
    var a = readLine()!!.split(" ").map(String::toInt)
    var ans = n - a.sum()
    if (ans < 0) {
        println(-1)
    } else {
        println(ans)
    }
}


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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl




typedef long long ll;
const ll mod = 1e9+7;
const int maxn = 1e6 + 5;













struct node {
    node *ch[2];
    node() {
	ch[0]=ch[1]=NULL;
    }
};






ll n, l;
node *trie;


void add(string s) {
    node *cur = trie;
    for (char c: s) {
	if (cur->ch[c-'0'] == NULL) cur->ch[c-'0'] = new node();
	cur = cur->ch[c-'0'];
    }
}

ll G;

void dfs(node *at, int len=0) {
    if (len == l) return;
    int count = 0;
    if (at->ch[0] == NULL) count++;
    if (at->ch[1] == NULL) count++;

    if (count == 1) {

	//largest pw2 that divides height of subtree
        ll cur = l-len;
	ll res = 1;
	while (cur%2 == 0) {
	    res=res*2;
	    cur=cur/2;
	}
	G = G ^ res;
    }

    for (int i=0; i<2; i++) {
	if (at->ch[i] != NULL) {
	    dfs(at->ch[i], len+1);
	}
    }
}


int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
    trie=new node();
    cin>>n>>l;
    for (int i=0; i<n; i++) {
	string s; cin>>s;
	add(s);
    }

    dfs(trie);



    if (G==0) out("Bob");
    out("Alice");

    

    return 0;
}


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

def intSqrt(n):
    M = int(n**0.5)

    while (M + 1)**2 <= n:
        M += 1

    for _ in range(300):
        n *= 100
        M *= 10
        for add in range(0, 10)[:: -1]:
            if (M + add)**2 <= n:
                M += add
                break

    return M

A, B, C = intSqrt(A), intSqrt(B), intSqrt(C)

if abs(A + B - C) < 10 or A + B >= C:
    print('No')
else:
    print('Yes')


Measured memory_bytes: 3064
N,K=map(int,input().split())
XY=[list(map(int,input().split())) for i in range(N)]
XY=sorted(XY,key=lambda x:x[0])
Mlst=[]

if N>=2:
    for s1 in range(N-1):
        for s2 in range(s1+1,N):
            x1,y1=XY[s1]
            x2,y2=XY[s2]
            y1,y2=min(y1,y2),max(y1,y2)
            count=2
            for i in range(s1+1,s2):
                count+=y1<=XY[i][1]<=y2
            if count>=K:
                Mlst.append((y2-y1)*(x2-x1))
if N>=3:
    for s1 in range(N-2):
        for s2 in range(s1+1,N-1):
            for s3 in range(s2+1,N):
                x1,y1=XY[s1]
                x2,y2=XY[s2]
                x3,y3=XY[s3]
                x1,x2=x1,x3
                y1,y2=min(y1,y2,y3),max(y1,y2,y3)
                count=2
                for i in range(s1+1,s3):
                    count+=y1<=XY[i][1]<=y2
                if count>=K:
                    Mlst.append((y2-y1)*(x2-x1))
if N>=4:
    for s1 in range(N-3):
        for s2 in range(s1+1,N-2):
            for s3 in range(s2+1,N-1):
                for s4 in range(s3+1,N):
                    x1,y1=XY[s1]
                    x2,y2=XY[s2]
                    x3,y3=XY[s3]
                    x4,y4=XY[s4]
                    x1,x2=x1,x4
                    y1,y2=min(y1,y2,y3,y4),max(y1,y2,y3,y4)
                    count=2
                    for i in range(s1+1,s4):
                        count+=y1<=XY[i][1]<=y2
                    if count>=K:
                        Mlst.append((y2-y1)*(x2-x1))
print(min(Mlst))


Measured memory_bytes: 83036
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    double a = Double.parseDouble(sc.next());
    double b = Double.parseDouble(sc.next());
    double tmp = (a + b) / 2.0 + 0.5;
    int ans = (int) tmp;
    System.out.println(ans);
  }
}

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

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

ans = min(a) + min(b)

for i in range(M):
  x, y, c = map(int, input().split())
  exp = a[x-1] + b[y-1] - c
  if ans > exp:
    ans = exp
    
print(ans)

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

int main() {
    int n,m;
    ll x;
    cin>>n>>m>>x;
    vector<ll> c(n);
    vector<vector<ll>> a(n,vector<ll>(m));
    vector<ll> sums(m);
    ll sum_b=0;
    ll ans=INF;
    bool flag=true;
    rep(i,n){
        cin>>c[i];
        rep(j,m)cin>>a[i][j];
    }
    for(int bit=0;bit<(1<<n);bit++){
        flag=true;
        for(int i=0;i<n;i++){
        if(bit&(1<<i)){
            rep(k,m)sums[k]+=a[i][k];
            sum_b+=c[i];
        }
        }
        rep(d,m){
            if(sums[d]<x){
                flag=false;
                break;
            }
            }
        if(flag){
        ans=min(ans,sum_b);
        }
        rep(y,m)sums[y]=0;
        sum_b=0;
    }
    if(ans==INF){
        cout<<-1<<endl;
    }
    else{
    cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 3632
/****************************************************
*   Template for coding contests                    *
*   Author    :    Sanjeev Sharma                   *
*   Email     :    thedevelopersanjeev@gmail.com    *
*****************************************************/

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

using namespace __gnu_pbds;
using namespace std;

#define deb(x) cout << #x << " is " << x << "\n";
#define int long long
#define mod 1000000007

const double PI = 2 * acos(0.0);
const long long INF = 1e18L + 5;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int32_t main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	long double r;
	cin >> r;
	cout << fixed << setprecision(20) << 2 * PI * r << "\n";
	return 0;
}


Measured memory_bytes: 3804
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
const double EPS = 1e-9;
typedef pair<int, int> P;
typedef unsigned int ui;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
int n; int k; string m[1000];
vector<int> G[1000]; int cnt = -1;
void solve(int x) {
	cnt++;
	rep(i, cnt) {
		cout << ".";
	}
	cout << m[x] << endl;
	int len = G[x].size();
	rep(i, len) {
		solve(G[x][i]);
	}
	cnt--;
	return;
}
int main() {
	cin >> n;
	rep(i, n) {
		cin >> k >> m[i];
		k--;
		if (k >= 0) {
			G[k].push_back(i);
		}
	}
	solve(0);
	return 0;
}


Measured memory_bytes: 3376
import math
def LI():return list(map(int,input().split()))

a,b,n=LI()

def f(x):
    ret=math.floor(a*x/b)-a*math.floor(x/b)
    return ret

if n<b:
    ans=f(n)
else:
    ans=f(b-1)
    
print(ans)

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

int main() {
    string S, T; cin >> S >> T;
    int cnt = 0;
    for (int i = 0; i < S.size(); i++) {
        if (S.at(i) != T.at(i)) cnt++;
    }
    cout << cnt << endl;
}

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

typedef long long ll;
#define pb push_back

int main(){
    int n, w;
    cin >> n >> w;
    int W[110], V[110];
 
    for(int i=0; i<n; i++){
        cin >> W[i] >> V[i];
    }
 
    vector<ll> itm[5];
    ll w1 = W[0];
 
    for(int i=0; i<n; i++){
        itm[W[i]-w1].pb(V[i]);
    }
 
    for(int i=0; i<5; i++) sort(itm[i].begin(), itm[i].end());
 
    for(int i=0; i<5; i++){
        itm[i].pb(0);
        reverse(itm[i].begin(), itm[i].end());
    }
 
    ll cost_max = -1LL;
    for(int i = 0; i < 4; i++) {
    	for(int j = 1; j < itm[i].size(); j++) itm[i][j] += itm[i][j-1];
    }
 
    // unsigned int で0-1はUNSINGED_INTMAX-1になるのでやばい
    for(int i=0; i<itm[0].size(); i++){
        //if(i+1 != itm[0].size()) itm[0][i+1] += itm[0][i];
        for(int j=0; j<itm[1].size(); j++){
            //if(j+1 != itm[1].size()) itm[1][j+1] += itm[1][j];
            for(int k=0; k<itm[2].size(); k++){
                //if(k+1 != itm[2].size()) itm[2][k+1] += itm[2][k];
                for(int l=0; l<itm[3].size(); l++){
                    //if(l+1 != itm[3].size()) itm[3][l+1] += itm[3][l];
                    ll val_sum = itm[0][i] + itm[1][j] + itm[2][k] + itm[3][l];
                    ll sum_W = w1*i + (w1+1)*j + (w1+2)*k + (w1+3)*l;
                    if(sum_W <= w && cost_max < val_sum) cost_max = val_sum;
                }
            }
        }
    }
 
    cout << cost_max << endl;

}


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

long long digit(long long u) {
  long long t = 0;
  while(u != 0) {
    t += u % 10;
    u /= 10;
  }
  return t;
}

int main(){
  int k; cin >> k;
  long long ans = 1; long long r = 1;
  for (int i = 0; i < k; i++) {
    cout << ans << endl;
    if ((ans + 1) % (r * 10) == 0 && digit(ans+r)*r <= (ans+r)) r *= 10;
    ans += r;
  }
  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 X = sc.nextInt();
        int Y = sc.nextInt();
        sc.close();

        if (Y % 2 == 1) {
            System.out.println("No");
            return;
        }

        double ans = Y / 2 - X;

        if (ans < 0 || ans > X || ans % 1 != 0) {
            System.out.println("No");
        } else {
            System.out.println("Yes");
        }
    }
}


Measured memory_bytes: 35900
#include <iostream>
#include <iomanip>
#include <vector>
typedef long long ll;
using namespace std;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
#define repi(i, n, init) for (ll i = init; i < (n); i++)

int main()
{
    int n;
    cin >> n;
    vector<int> a(n + 1, 0), b(n, 0);
    repi(i, n + 1, 0)
    {
        cin >> a[i];
    }
    repi(i, n, 0)
    {
        cin >> b[i];
    }
    ll sum = 0;
    repi(i, n, 0)
    {
        if (a[i] > 0)
        {
            sum += min(a[i], b[i]);
            b[i] -= a[i];
        }
        if (b[i] > 0)
        {
            sum += min(a[i + 1], b[i]);
            a[i + 1] -= b[i];
        }
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>

int main(){
	
	int n, k;
	
	scanf("%d %d", &n, &k);
	
	char s[n + 1];
	
	scanf("%s", &s);
	
	s[k - 1] = s[k - 1] + 32;
	
	printf("%s", s);
	
	return 0;
}

Measured memory_bytes: 128
# include <bits/stdc++.h>
 
using namespace std;
 
int MinCostBottomUpDP(int source, int destination, int * height);
 
 
int main() {
  int n;
  cin >> n;
  int height[n];
  for (int i = 0; i < n; i++) {
    cin >> height[i];
  }
  cout << MinCostBottomUpDP(0, n - 1, height) << endl;
  return 0;
}
 
 
int MinCostBottomUpDP(int source, int destination, int * height) {
  vector<int> Cache(destination + 1);
  Cache[destination] = 0;
  Cache[destination - 1] = abs(height[destination - 1] - height[destination]);
  for (int i = destination - 2; i >= source; i--) {
    int route1_min_value = Cache[i + 1] + abs(height[i] - height[i + 1]);
    int route2_min_value = Cache[i + 2] + abs(height[i] - height[i + 2]);
    Cache[i] = min(route1_min_value, route2_min_value);
  }
  return Cache[source];
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, M;
  cin >> N >> M;
  vector<int> arr(2 * M);
  
  for (int i = 0; i < 2 * M; i++) cin >> arr.at(i);
  
  for (int i = 0; i < N; i++){
    int k = 0;
    for (int j = 0; j < 2 * M; j++){
      if (arr.at(j) == i + 1) k++;
    }
    cout << k << endl;
  }
}

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

import sys
input = sys.stdin.readline

def io_generator():
	return input()

#+++++++++++++++++++

def main(io):
	n=int(io())
	v = list(map(int, io().split()))
	c = list(map(int, io().split()))
	t=[vi-ci for vi,ci in zip(v,c) if vi-ci>0]
	ret = sum(t)
	return ret

#++++++++++++++++++++

if __name__ == "__main__":
	io= lambda : io_generator()
	print (main(io))

Measured memory_bytes: 3064
import collections
import sys
import numpy as np
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
MOD = 10**9+7
import itertools
import math

a,b,c = map(int,input().split())
max_block = a*b*c
max_edge = max(a,b,c)
min_edge = min(a,b,c)
middle_edge = (a+b+c) - max_edge - min_edge
choku1 = (max_edge//2)*min_edge*middle_edge
choku2 = (max_edge//2+1) * min_edge * middle_edge
if max_edge%2 == 0:
    print("0")
else:
    print(abs(choku1-choku2))

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

int count = 0;

void selectionSort(int A[], int n){
    for(int i = 0; i < (n - 1); i++){
        int minj = i;
        for(int j = i + 1; j < n; j++){
            if(A[minj] > A[j]) minj = j;
        }
        if(minj != i){
            swap(A[minj], A[i]);
            count++;
        }
    }
}


int main(void){
    int n;
    cin >> n;
    int A[n];
    for(int i = 0; i < n; i++) cin >> A[i];
    
    selectionSort(A, n);
    
    for(int i = 0; i < n; i++){
        if(i) cout << " ";
        cout << A[i];
    }
    cout << endl;
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3076
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <unordered_map>
#include <climits>
#include <set>
#include <unordered_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 <queue>
#include <random>
#include <complex>
#include <regex>

using namespace std;

#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}

int main() {

    int N;
    cin >> N;

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

    int ans = INT_MIN;
    for (int i = 0; i < N; i++) {
        int sum = accumulate(A[0].begin(), A[0].begin() + i + 1, 0);
        sum += accumulate(A[1].begin() + i, A[1].end(), 0);
        ans = max(ans, sum);
    }

    cout << ans << endl;

}














































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

int bubbleSort(int A[], int N) {
  int count = 0;
  bool flag = 1;
  for (int i = 1; flag; i++) {
    flag = 0;
    for (int j = N - 1; j >= i; j--) {
      if (A[j] < A[j - 1]) {
        swap(A[j], A[j - 1]);
        flag = 1;
        count++;
      }
    }
  }
  return count;
}

int main() {
  int N;
  cin >> N;
  int A[N];
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  int count = bubbleSort(A, N);
  for (int i = 0; i < N; i++) {
    cout << A[i];
    if (i != N - 1) cout << " ";
  }
  cout << endl;
  cout << count << endl;
  return 0;
}


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

public class Main {
  public static void main(String[] args) throws IOException {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int n = Integer.parseInt(br.readLine());
      int[] arrayS = new int[n];
      int i=0;
      for (String val : br.readLine().split(" ")) {
        arrayS[i++] = Integer.parseInt(val);
      }

      MergeSort merge = new MergeSort(arrayS);
      long cnt = merge.mergeSort(0, n);

      System.out.println(cnt);
    }
  }
}

class MergeSort {

  static private final int SENTINEL = Integer.MAX_VALUE;

  private int[] target;
  private int[] bufL;
  private int[] bufR;

  public MergeSort(int[] target) {
    this.target = target;
    bufL = new int[target.length/2+2];
    bufR = new int[target.length/2+2];

  }

  public long mergeSort(int left, int right) {
    long cnt =0;

    if(left+1 < right){
      int mid = (left + right) / 2;
      cnt += mergeSort(left, mid);
      cnt += mergeSort(mid, right);
      cnt += merge(left, mid, right);
    }

    return cnt;
  }

  private long merge(int left, int mid, int right) {
    long cnt = 0;
    int n1 = mid - left;
    int n2 = right - mid;
    
    for(int i=0; i<n1; i++)
      bufL[i] = target[left+i];
    bufL[n1] = MergeSort.SENTINEL;

    for(int i=0; i<n2; i++)
      bufR[i] = target[mid+i];
    bufR[n2] = MergeSort.SENTINEL;

    for(int i=0,j=0,k=left; k<right; k++) {
      if(bufL[i] <= bufR[j]) {
        target[k] = bufL[i++];
          cnt += j;
      }
      else {
        target[k] = bufR[j++];
      }
    }

    return cnt;
  }

  public int[] getArray() {
    return target;
  }

  public void dispIntArray() {
    StringBuilder s = new StringBuilder();

    for (int i : target) { s.append(i).append(" "); }
    s.setLength(s.length()-1);

    System.out.println(s);
  }
}


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

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << endl;
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (int i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int D;
vi c(26);
vector<vector<ll>> S(365, vector<ll>(26));
vi ans(365);

ll eval() {
    vi last(26, 0);

    ll score = 0;
    REP(i, D) {
        int t = ans[i];

        score += S[i][t];
        last[t] = i + 1;

        REP(j, 26) {
            score -= c[j] * (i + 1 - last[j]);
        }
    }

    return score;
}

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    cin >> D;

    REP(i, 26) cin >> c[i];

    vi last(26, 0);
    REP(i, D) {
        vll s(26);
        REP(j, 26) {
            cin >> s[j];
            S[i][j] = s[j];
        }

        vll p(26);
        ll p_all = 0;
        REP(j, 26) {
            p[j] = c[j] * (i + 1 - last[j]);
            p_all += p[j];
        }

        REP(j, 26) {
            s[j] -= p_all - p[j];
        }

        int idx = max_element(ALL(s)) - s.begin();

        last[idx] = i + 1;
        ans[i] = idx;
    }

    ll score = eval();

    std::random_device rd;
    std::mt19937 mt(rd());
    std::uniform_int_distribution<int> d_rng(0, D-1);
    std::uniform_int_distribution<int> t_rng(0, 25);

    REP(i, 1e5) {
        int d = d_rng(mt), t = t_rng(mt);
        if (ans[d] == t) {
            --i;
            continue;
        }

        int old = ans[d];

        ans[d] = t;
        ll new_score = eval();
        if (score < new_score) {
            score = new_score;
        } else {
            ans[d] = old;
        }
    }

    REP(i, D) {
        print(ans[i] + 1);
    }

}


Measured memory_bytes: 3752
import java.util.*;
import java.io.PrintWriter;
public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int k=sc.nextInt();
		long ans=0;
		for(int i=1; i<=k; i++){
			for(int j=1; j<=k; j++){
				for(int t=1; t<=k; t++){
					ans+=gcd(gcd(i,j),t);
				}
			}
		}
		System.out.println(ans);
	}
	private static long gcd(long m, long n) {
    if(m < n) return gcd(n, m);
		while(n!=0){
			long tmp=m;
			m=n;
			n=tmp%n;
		}
    return m;
}
}


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

int main(){
  int n;
  cin >> n;
  int o, t, f;
  o = 0; t = 0; f = 0;
  for (int i = 0; i < n; i++) {
    int k;
    cin >> k;
    if (k % 4 == 0) f++;
    else {
      if (k % 2 == 0) t++;
      else o++;
    }
  }
  int u, v;
  if (f > 0) u = 2 * f + 1;
  else u = 0;
  if (t > 0) {
    v = t;
    u = max(0, u-1);
  }
  else v = 0;

  if (u + v >= n) printf("Yes\n");
  else printf("No\n");

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()

vector<int> Zalgo(const string &S) {
    int N = (int)S.size();
    vector<int> res(N);
    res[0] = N;
    int i = 1, j = 0;
    while (i < N) {
        while (i+j < N && S[j] == S[i+j]) ++j;
        res[i] = j;
        if (j == 0) {++i; continue;}
        int k = 1;
        while (i+k < N && k+res[k] < j) res[i+k] = res[k], ++k;
        i += k, j -= k;
    }
    return res;
}

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

    int res = 0;
    for (int i = 0; i < N; ++i) {
        string T = S.substr(i);
        auto lcp = Zalgo(T);

        for (int j = 0; j < T.size(); ++j) {
            int l = min(lcp[j], j);
            res = max(res, l);
        }
    }

    cout << res << endl;
}


Measured memory_bytes: 256
#include<stdio.h>

#define Max 200000
#define Sen 1000000000

typedef long long llong;

int count;
int l[Max / 2 + 2], r[Max / 2 + 2];

llong merge(int a[], int n, int left, int mid, int right){
  int n1, n2, i, j, k;
  llong count = 0;
  
  n1 = mid - left;
  n2 = right - mid;

  for(i = 0 ; i < n1 ; i++) l[i] = a[left + i];
  for(i = 0 ; i < n2 ; i++) r[i] = a[mid + i];
  l[n1] = r[n2] = Sen;

  i = j = 0;
  for(k = left ; k < right ; k++){
    if(l[i] <= r[j]){
      a[k] = l[i++];
    }
    else{
      a[k] = r[j++];
      count += n1- i;
    }
  }
  return count;
}


llong mergeSort(int a[], int n, int left, int right){
  int mid;
  llong v1, v2, v3;
  
  if(left + 1 < right){

    mid = (left + right) / 2;
    v1 = mergeSort(a, n, left, mid);
    v2 = mergeSort(a, n, mid, right);
    v3 = merge(a, n, left, mid, right);
    return v1 + v2 + v3;
  }
  else return 0;
}


int main(){
  int a[Max], n, i;
  count = 0;

  scanf("%d", &n);
  for(i = 0 ; i < n ; i++) scanf("%d", &a[i]);

  llong ans = mergeSort(a, n, 0 , n);

  printf("%lld\n", ans);

  return 0;
}


Measured memory_bytes: 3284
/*                        ______
 _______   /\     |``\   |        |  /
    |     /  \    |__/   |____    |/
    |    / _ _\   |  \   |        |\
    |   /      \  |   \  |______  |  \

            Dept. of CSE
        Comilla  University

*/
#include<bits/stdc++.h>
#define pi 2*acos(0.0)
#define ll long long
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Node struct node
#define spc " "
#define  E  2.71828182845904523536
#define pb push_back
#define pp pop_back
#define valid(nx,ny) nx>=0 && nx<n && ny>=0 && ny<m
#define ee endl
#define pii pair<int,int>
#define infinity 10000000000000000
#define mod 1000000007
int fx[]={0,0,+1,-1};
int fy[]={+1,-1,0,0};

using namespace std;
///check n=1;
///check corner case;
const int maX=1e5+1;
vector<ll>Graph[maX],cost[maX];
ll visit[maX];
ll x[10];
ll y[10];

int main()
{
    ll i,j,cc=0;
    string s,t;
    cin>>s>>t;
    int a[26]={0};
    int b[26]={0};
    for(i=0;i<s.size();i++){
        a[s[i]-'a']++;
        b[t[i]-'a']++;
    }
    sort(a,a+26);
    sort(b,b+26);
    for(i=0;i<26;i++){
        if(a[i] != b[i]){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
return 0;
}


Measured memory_bytes: 5512
#include <cstdio>
#include <iostream>
#include <queue>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>

typedef long long int ll;

using namespace std;
int main(){
    ll l,r;
    ll min_ans=2019;
    ll min_pre;
    cin >> l>>r;
    if(r-l>=2019){
        cout<<0<<endl;
    }else{
        l=l%2019;
        r=r%2019;
        if(l>r){
            cout<<0<<endl;
        }else{

            for(ll i=l;i<=r;i++){
                for(ll j=i+1;j<=r;j++){
                    min_pre=(i*j)%2019;
                    if(min_pre<min_ans){
                        min_ans=min_pre;
                    }
                }
            }
            cout<<min_ans<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <cmath>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>

typedef  long long ll;
#define mop 1000000007
using namespace std;

int main() {
    


    ll ans = 0;
    ll n,l;
    cin >> n >> l;
    for (ll i=l;i<n+l;i++){
        ans += i;
    }
    if(l*(l+n-1) < 0){
        ;
    }else if(l < 0){
        ans -= n+l-1;
    }else{
        ans -= l;
    }
    cout << ans << endl;

}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<iomanip>

#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

using namespace std;

#define debug(x) cout<<(#x)<<"="<<(x)<<", ";
#define debug1(x) debug(x) cout<<'\n';
#define debug2(x1, x2) debug(x1) debug(x2) cout<<'\n';
#define debug3(x1, x2, x3) debug(x1) debug(x2) debug(x3) cout<<'\n';
#define debug4(x1, x2, x3, x4) debug(x1) debug(x2) debug(x3) debug(x4) cout<<'\n';
#define debug5(x1, x2, x3, x4, x5) debug(x1) debug(x2) debug(x3) debug(x4) debug(x5) cout<<'\n';

#define fcout cout<<fixed<<setprecision(15)
#define repp(i,j,k) for(int i=j; i<k; ++i)
#define rep(i,j) repp(i,0,j)
#define rrep(i,j,k) for(int i=j; i>=k; --i)
#define all(x) (x).begin(), (x).end()
#define sort(x) sort(x.begin(), x.end())
#define lb(x,val) lower_bound(x.begin(), x.end(), val)
#define ub(x,val) upper_bound(x.begin(), x.end(), val)
#define pb(x) emplace_back(x);

typedef long long int lli;
typedef pair<int,int> pii;
typedef pair<lli,lli> pll;
typedef vector<int> vi;
typedef vector<lli> vl;
typedef tuple<int, int, lli> tiil;

//const lli M=998244353ll;
const lli M=1000000007ll;
const double D=1.0;

int main(){
	fast_io 
	int n; cin>>n;
	fcout;
	int k=0;
	repp(i,1,n+1){
		if(i&1) k++;
	}
	cout<<(k*D/n);
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
//#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define co(a) cout<<a<<endl
#define sz size()
#define bgn begin()
#define en end()
#define pb(a) push_back(a)
#define pop pop_back
#define V vector
#define P pair
#define V2(a,b,c) V<V<int>> a(b,V<int>(c))
#define V2a(a,b,c,d) V<V<int>> a(b,V<int>(c,d))
#define incin(a) int a; cin>>a
//#define min min<int>
//#define max max<int>
template<class T>
 void cou(vector<vector<T>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}
/*template<>
 void cou(vector<vector<char>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}*/
 int wari(int a,int b) {
   if(a%b==0)
     return a/b;
   else
     return a/b+1;
 }
 int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
 int souwa(int a){
  return a*(a+1)/2;
 }
 int lcm(int a,int b){
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }
 bool prime(int a){
   if(a<2)
     return false;
   else if(a==2)
     return true;
   else if(a%2==0)
     return false;
   double b=sqrt(a);
    for(int i=3;i<=b;i+=2){
      if(a%i==0){
        return false;
      }
    }
   return true;
 }
struct Union{
  vector<int> par;
  Union(int n){
	par= vector<int>(n, -1);
  }
  int find(int x){
    if(par[x]<0)
      return x;
    else
      return par[x]=find(par[x]);
  }
  bool same(int a,int b){
    return find(a)==find(b);
  }
  int Size(int a){
    return -par[find(a)];
  }
  void unite(int a,int b){
    a=find(a);
    b=find(b);
    if(a==b)
      return;
    if(Size(b)>Size(a))
      swap<int>(a,b);
    par[a]+=par[b];
    par[b]=a;
  }
};
int ketas(int a){
  string b=to_string(a);
  int c=0;
  fo(i,keta(a)){
    c+=b[i]-'0';
  }
  return c;
}
/*struct aa{
	vector<int> gt;
  aa(int n){
	gt= vector<int>(n, 1);
  }
	void c(V<int> d,int b){
	if(d[b]==0){
		gt[d[b]-1]++;
		gt[gt.sz-1]++;
	}
	else{
		gt[d[b]-1]++;
		c(d,d[d[b]]-1);
	}
}
void cok(int a){
	cout<<gt[a-1]<<endl;
	fo(i,a-1)
	cout<<gt[i]<<endl;
}
};
*/
signed main(){
	int a;
	cin>>a;
	cout<<lcm(a,2)<<endl;
}

Measured memory_bytes: 256
n = gets.chomp.to_i
h = gets.chomp.split(' ').map(&:to_i)
max = 0
current = -1
memo = 0

h.each do |nxt|
  if (current >= nxt)
    memo += 1
    max = memo if (memo > max)
  else
    max = memo if (memo > max)
    memo = 0
  end
  current = nxt
end

puts max

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

long double lim(long double a, long double b, long double deg) {
  long double rad = deg * M_PI / 180;
  if (atan(b / a) >= rad) return a * a * (b - a * tan(rad) / 2);
  else return a * b * (b / tan(rad)) / 2;
}

int main() {
  long double a, b, x;
  cin >> a >> b >> x;
  long double deg = 0;
  for (int i = 0; i <= 9; i++) {
    if (lim(a, b, i * 10) <= x) {
      deg += (i - 1) * 10;
      break;
    }
  }
  for (int j = 0; j < 10; j++) {
    for (int i = 0; i <= 10; i++) {
      if (lim(a, b, deg + i * pow(10, -j)) <= x) {
        deg += (i - 1) * pow(10, -j);
        break;
      }
    }
  }
  cout << fixed << setprecision(10) << deg << endl;
}

Measured memory_bytes: 512
//
//  main.cpp
//  ABC165
//
//  Created by 安藤光希 on 2020/05/02.
//  Copyright © 2020 安藤光希. All rights reserved.
//

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


int main() {
    ll K;
    cin >> K;
    ll N = 100;
    
    int cnt = 0;
    for (ll i = 0; i < 1000000000000; i++){
        N *= 1.01;
        cnt++;
        if (N >= K) break;
        else continue;
    }
    
    cout << cnt << endl;
    
}

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


int main() {
	long n,m,i,j,k,t,ans,cur,res;
	cin >> n >> m;
	vector<long> h(n);
	for(i=0; i<n; i++){
		cin >> h[i];
	}
	
	vector<vector<long>> nex(n,vector<long>(0));
	for(t=0; t<m; t++){
		cin >> i >> j;
		i--; j--;
		nex[i].push_back(j);
		nex[j].push_back(i);
	}
	ans=0; cur=0;
	for(i=0; i<n; i++){
		cur=0;
		for(j=0; j<nex[i].size(); j++){
			if(h[i]<=h[nex[i][j]]){
				cur=1;
			}
		}
		if(cur==0){
			ans++;
		}
			
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 9860
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		long ans=0;
		int[] a=new int[n];
		for(int i=0; i<n; i++){
			a[i]=sc.nextInt();
		}
		ans+=a[0]-1;
		int k=2;
		for(int i=1; i<n; i++){
			if(a[i]==k){
				k++;
				continue;
			}
			ans+=(a[i]-1)/k;
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 51660
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

bool calc(int y, int x, vs &v){
    int cnt=0;
    rep(i,4){
        int nx=dx[i]+x;
        int ny=dy[i]+y;
        if(nx<0||ny<0||nx>=v[0].size()||ny>=v.size())continue;
        if(v[ny][nx]=='#')cnt++;
    }
    // if(cnt==0){
    //     cout<<y<<" "<<x<<endl;
    // }
    return cnt;
}

int main() {
    
    int n,m;
    cin>>n>>m;
    vs v(n);
    rep(i,n)cin>>v[i];
    bool ch=true;
    rep(i,n){
        rep(j,m){
            if(v[i][j]=='#')ch &= calc(i,j,v);
        }
    }
    if(ch)fin("Yes");
    else fin("No");

}

Measured memory_bytes: 256