akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = int(A); I < int(B); ++I)
#define FORR(I,A,B) for(ll I = int((B)-1); I >= int(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e18+7;
const ll MOD=1e9+7;

class Seg_Tree{
public:
	vector<int> dat;
	int n;
	void initsize(int n0){
		int k=1;
		while(1){
			if(n0<=k){
				n=k;
				dat.resize(2*n-1);
				for(int i=0;i<2*n-1;i++)dat[i]=1;
				break;
			}
			k*=2;
		}
	}

	//i banme wo x nisuru
	void update(int i,int x){
		i += n-1;
		dat[i] = x;
		while(i>0){
			i = (i-1) / 2;
			dat[i] = gcd(dat[i*2+1],dat[i*2+2]);
		}
	}

	//[a,b)
	int query0(int a,int b,int k,int l,int r){
		if(r<=a || b<=l)return dat[a+n-1];
		if(a<=l && r<=b)return dat[k];
		else{
			int vl = query0(a,b,k*2+1,l,(l+r)/2);
			int vr = query0(a,b,k*2+2,(l+r)/2,r);
			return gcd(vl,vr);
		}
	}

	//return min [a,b)
	int query(int a,int b){
		return query0(a,b,0,0,n);
	}
};

int main(){
	int N;
	cin >> N;
	Seg_Tree sg;
	sg.initsize(N);
	FOR(i,0,N){
		ll k;
		cin >> k;
		sg.update(i,k);
	}

	int ans = max(sg.query(1,N),sg.query(0,N-1));
	FOR(i,1,N-1){
		int p = gcd(sg.query(0,i),sg.query(i+1,N));
		ans = max(ans,p);
	}

	cout << ans << endl;
}


Measured memory_bytes: 1280
#include <iostream>
#include <vector>
#define REP(i, n) for (int i = 0; i < n; i++)
const int INF32 = 2147483647;
using namespace std;

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

    int N, K;
    cin >> N >> K;
    vector<int> X(N);
    REP(i, N) cin >> X[i];

    int ans = INF32;

    REP(start, N) {
        int end = start + K - 1;
        if (end >= N)
            continue;

        int l = abs(X[end]) + abs(X[end] - X[start]);
        int r = abs(X[start]) + abs(X[end] - X[start]);
        ans  = min(ans, min(l, r));
    }

    cout << ans << endl;
    return 0;
}

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

#define ll long long

using namespace std;

int n;
int m;

int s1[105]={};
int s2[105]={};


int main(){
    while(1){
        int sum1=0;
        int sum2=0;
        scanf("%d %d",&n,&m);
        if(n == 0 && m == 0) break;
        for(int i=0;i<n;i++){
            scanf("%d",&s1[i]);
            sum1 += s1[i];
        }
        for(int i=0;i<m;i++){
            scanf("%d",&s2[i]);
            sum2 += s2[i];
        }
        int d = sum2-sum1;
        if(abs(d%2) == 1){
            cout << "-1" << endl;
        }else{
            sort(s1,s1+n);
            sort(s2,s2+m);

            int judge = 0;
            int a,b;

            for(int i=0;i<n;i++){
                a = s1[i];
                b = a + d/2;
                if(b < 0 || 100 < b) continue;
                for(int j=0;j<m;j++){
                    if(b == s2[j]){
                        judge = 1;
                        break;
                    }
                    if(b < s2[j]) break;
                }
                if(judge) break;
            }
            if(judge) cout << a << " " << b << endl;
            else cout << "-1" << endl;
        }
        
    }
}


Measured memory_bytes: 3156
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x)+modulo)%modulo)
#define Inf 1000000000


int main(){
	
	long long X;
	cin>>X;
	
	long long ans = 0;
	
	ans += 1000*(X/500);
	X%=500;
	ans += 5*(X/5);
	
	cout<<ans<<endl;
	
    return 0;
}


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

string S;

bool check(string s) {
	long long n = s.size();
	for(long long i = 0; i < n; i++) {
		if(s[i] != s[n-1-i]) {
			return false;
		}
	}
	return true;
}

int main(){
	cin >> S;
	long long N = S.size();

	if(!check(S)) {
		cout << "No" << endl;
		return 0;
	}

	if(!check(S.substr(0, (N-1)/2))) {
		cout << "No" << endl;
		return 0;
	}

	if(!check(S.substr((N+3)/2-1, N))) {
		cout << "No" << endl;
		return 0;
	}

	cout << "Yes" << endl;
}


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

using namespace std;

#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"
#define Printv(v)                                                              \
    FOREACH(x, v) { cout << x << " "; }                                        \
    cout << "\n";

typedef long long ll;
typedef unsigned long long ul;
typedef vector<int> V;
typedef vector<ll> VL;
typedef pair<ll, ll> PL;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll, V, greater<ll>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18;
const ll dx[] = {1, -1, 0, 0};
const ll dy[] = {0, 0, 1, -1};

ll N;
ll c[3][3];
ll a[3],b[3];

int main() {
    REP(i,3)REP(j,3) cin >> c[i][j];
    REP(i,3) b[i]=c[0][i];
    REP(i,3) a[i]=c[i][0]-b[0];
    REP(i,3)REP(j,3){
        if(a[i]+b[j]!=c[i][j]){
            cout << "No" << "\n";
            return 0;
        }
    }
    cout << "Yes" <<"\n";
    return 0;
}

Measured memory_bytes: 256
#104b
s=input()
s_l=s.lower()
sa=s[:2]
sc=s[2:-1]
flag=False

if s[0]=='A' and sc.count('C')==1 :
    sc=sc.replace('C','c')
    sa=sa.replace('A','a')
    if s_l==sa+sc+s[-1]:
        flag=True

print('AC' if flag==True else 'WA' )
    

Measured memory_bytes: 3060
from sys import stdin
input = stdin.readline

MOD = 1000000007
H, W = map(int, input().split())
grid = stdin.read().splitlines()
dp = [[1] * W for _ in range(H)]

for h in range(H):
    for w in range(W):
        if grid[h][w] == '#':
            dp[h][w] = 0
            continue
        if h != 0 and w != 0:
            dp[h][w] = (dp[h - 1][w] + dp[h][w - 1]) % MOD
            # if dp[h][w] >= MOD:
            #     dp[h][w] -= MOD
        if h == 0 and w != 0:
            dp[h][w] = dp[h][w - 1]
        if h != 0 and w == 0:
            dp[h][w] = dp[h - 1][w]

print(dp[H - 1][W - 1])


Measured memory_bytes: 68640
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long int64;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long  INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;
const int MAX_NUM = 999999999;
void solve() {
	int k; cin >> k;
	string s; cin >> s;
	string ans;
	if (s.size() > k) {
		ans = s.substr(0, k);
		ans += "...";
	} else {
		ans = s;
	}
	cout << ans << endl;
	return;
}
int main() {
	solve();
	return 0;
}

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

vector<vector<int64_t>> divisor(int64_t N){
  vector<vector<int64_t>> res;
  for(int64_t i=1; i*i<=N; i++){
    if(N%i==0){
      res.push_back({i,N/i});
    }
  }
  return res;
}

int64_t f(vector<int64_t> vec){
  return vec.at(0)+vec.at(1)-2;
}

int main(){
  int64_t N;
  cin >> N;
  vector<vector<int64_t>> res = divisor(N);
  int64_t ans = N-1;
  for(int i=0; i<res.size(); i++){
    ans = min(ans,f(res.at(i)));
  }
  cout << ans << endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>
#include <numeric>
#include <string.h>


#define fs first
#define sc second

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;


int main(){
    ll N;
    cin >> N;
    ll res = LONG_LONG_MAX;
    for(ll i = 1; i * i <= N; i++){
        if(N % i == 0){
            res = min(res, (i-1) + N / i-1);
        }
    }
    cout << res << endl;


    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <deque>
#include <utility>

using namespace std;
using ll = long long;

ll max(ll x, ll y) {
	if (x < y) {
		return y;
	} else {
		return x;
	}
}

int main(void) {
	ll ans = 0;
	deque<pair<char, ll>> v = {make_pair(getchar(), 1)};
	int d;
	while ((d = getchar()) != EOF) {
		if (d == '\n') {
			continue;
		}
		if (d != v.back().first) {
			v.push_back(make_pair(d, 0));
		}
		v.back().second++;
	}
	if (v.front().first == '>') {
		ans += (v.front().second + 1) * v.front().second / 2;
		v.pop_front();
	}
	if (v.back().first == '<') {
		ans += (v.back().second + 1) * v.back().second / 2;
		v.pop_back();
	}
	while (!v.empty()) {
		ll open, close;
		open = v.front().second;
		v.pop_front();
		close = v.front().second;
		v.pop_front();
		ans += (open - 1) * open / 2
					 + (close - 1) * close / 2
					 + max(open, close);
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 4352
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};

fn main() {
  let x = read::<i64>();
  let y = read::<i64>();
  let z = read::<i64>();
  let k = read::<i64>();
  let mut a_vec = vec![];
  let mut b_vec = vec![];
  let mut c_vec = vec![];
  let mut anss = vec![];

  for _ in 0..x {
    a_vec.push(read::<i64>())
  }

  for _ in 0..y {
    b_vec.push(read::<i64>())
  }

  for _ in 0..z {
    c_vec.push(read::<i64>())
  }

  // x*yで計算して上位kだけ取り出す
  let mut ab_vec = vec![];
  for b in b_vec {
    for a in &a_vec {
      ab_vec.push(a + b)
    }
  }

  ab_vec.sort();
  ab_vec.reverse();
  if k < ab_vec.len() as i64 {
    ab_vec.split_off(k as usize);
  }

  // zを加えて計算して上位kだけ取り出す
  for i in ab_vec {
    for c in &c_vec {
      anss.push(i + c);
    }
  }

  anss.sort();
  anss.reverse();

  if k < anss.len() as i64 {
    anss.split_off(k as usize);
  }


  for i in anss {
    println!("{}", i);
  }
}



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

int main() {

  string input;

  while(true) {
  if ( cin.eof() ) break;

  getline( cin, input );

  char c;
  for ( int i = 0; i < 26; i++ ) {

    string ans = "";
    for ( int j = 0; j < input.size(); j++ ) {

      c = input[j];
      if ( c >= 'a' && c <= 'z' ) {
	c = 'a' + ( c - 'a' + i )%26 ;
      }
      ans += c;

    }

    if ( ans.find( "the", 0 ) == string::npos && ans.find( "this", 0 ) == string::npos && ans.find( "that", 0 ) == string::npos ) continue;

    cout << ans << endl;

    break;

  }

  }

  return 0;

}

Measured memory_bytes: 1192
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import numpy as np

H, W, K = map(int, input().split())

c = np.zeros((H, W))
result = 0
for i in range(H):
    word = input()
    for j in range(W):
        if word[j] == '.':
            c[i][j] = 0
        elif word[j] == '#':
            c[i][j] = 1

for mask_h in range(2**H):
    bin_mask_h = format(mask_h,  '0' + str(H) + 'b')
    for mask_w in range(2**W):
        bin_mask_w = format(mask_w, '0' + str(W) + 'b')
        black_num = 0
        for i in range(H):
            if bin_mask_h[i] == '0':
                continue
            for j in range(W):
                if bin_mask_w[j] == '0':
                    continue
                if c[i][j] == 1:
                    black_num += 1
        # print(str(bin_mask_h) + ' ' + str(bin_mask_w) + ' ' + str(black_num))
        if black_num == K:
            result += 1

print(result)


Measured memory_bytes: 27096
N,K=map(int,input().split())
P=list(map(int,input().split()))
L=[]
M=[0]
c=0
m=0
x=0
for i in range(200100):
    c+=i
    L.append(c)
for i in P:
    m+=L[i]/i
    M.append(m)
if N!=K:
    for i in range(N-K+1):
        x=max(M[K+i]-M[i],x)
else:
    x=M[K]-M[0]
print(x)

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

#define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define I insert
#define endl '\n'
#define all(x) x.begin(), x.end()

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
using vvll = vector< vector<ll> >;
using vll = vector<ll> ;
using vb = vector<bool> ;
using pll = pair<ll, ll> ;

const ll maxs = 1e6+5;
const ll lmaxs = 20;
ll mod = 1e9+7;
ll oo = 1e15;

ll fast(ll x,ll y){
    ll res=1;
    while(y){
        if(y&1)
            res = (res*x)%mod;
        x = (x*x)%mod;
        y >>= 1;
    }
    return res;
}

ll inv(ll n){
    return fast(n,mod-2);
}


void pre(){



}


void solve(){

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


}

int main(){
    // #ifndef ONLINE_JUDGE
    // freopen("input00.txt","r",stdin);
    // #endif
    IOS;
    pre();
    ll T = 1;
    //cin>>T;
    while(T--){
        solve();   
    }
    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 100000
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define OUT(a) cout<<(a)<<endl
#define VECIN(type, c, n) vector<type> c(n);for(auto& i:c) cin>>i;
#define MOD 1000000007

int main(){
	string s;
	cin>>s;
	int n=SZ(s);
	int dp[N+5][2]={0};
	dp[0][0]=1;
	REP(i,n){
		{//a+b=0;
			if(s.at(i)=='0'){
				dp[i+1][0]+=dp[i][0];
				dp[i+1][1]+=dp[i][1];
				dp[i+1][0]%=MOD;
				dp[i+1][1]%=MOD;
			}else{
				dp[i+1][1]+=(dp[i][0]+dp[i][1])%MOD;
			}
		}
		{//a+b=1;
			if(s.at(i)=='0'){
				dp[i+1][1]+=2*dp[i][1]%MOD;
				dp[i+1][1]%=MOD;
			}else{
				dp[i+1][0]+=(dp[i][0]*2%MOD);
				dp[i+1][1]+=dp[i][1]*2%MOD;
				dp[i+1][0]%=MOD;
				dp[i+1][1]%=MOD;
			}
		}
		
	}
	
	int ans=(dp[n][0]+dp[n][1])%MOD;
		OUT(ans);
	
	return 0;
}


Measured memory_bytes: 1280
import numpy as np
N, K = [int(_) for _ in input().split()]
A = np.array([0] + [int(_) for _ in input().split()])
C = np.cumsum(A)
X = np.zeros(N * (N + 1) // 2, dtype=int)
il = 0
for l in range(N):
    X[il:il + N - l] = C[l + 1:N + 1] - C[l]
    il += N - l
ans = 0
for i in range(40, -1, -1):
    Y = (X // (2**i) & 1)
    I = Y == 1
    if I.sum() >= K:
        X = X[I]
        ans += 2**i
print(ans)


Measured memory_bytes: 39796
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main(){
    int N, D;
    cin >> N >> D;
    vector<vector<int>> X(N, vector<int>(D));
    for(int i = 0; i < N; ++i){
        for(int j = 0; j < D; ++j){
            cin >> X[i][j];
        }
    }
    
    int cnt = 0;
    vector<double> dist(N);
    for(int i = 0; i < N; ++i){
        for(int j = i + 1; j < N; ++j){
            int temp = 0;
            for(int k = 0; k < D; ++k){
                temp += (X[i][k] - X[j][k]) * (X[i][k] - X[j][k]);
            }
            
            double sq = sqrt(temp);
            int sq_i = sq;
            if(sq - sq_i == 0)      cnt++;
        }
    }
    
    cout << cnt << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iomanip>
#include <float.h>
#include <math.h>
using namespace std;
using ll = long long;


unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

int main() {
    for (int i = 0; i < 5; i++) {
        ll a;
        cin >> a;
        if (a == 0) {
            cout << i + 1 << endl;
            break;
        }
    }
}

Measured memory_bytes: 3632
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <bitset>
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<string> vs;
typedef vector<pair<int,int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
#define rep(i,n) for(int i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define P 1000000007
#define STI(s) atoi(s.c_str())//string to int
#define mp(p,q) make_pair(p,q)
#define Sort(a) sort(a.begin(),a.end())
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 int INF = INT_MAX;
const long long LLINF = 1LL<<60;
//g++ -std=c++1z temp.cpp
//./a.exe
    
int main(void){ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////////////
    
int n,x,k,y;
cin >> n >> k >> x >> y;
if (n<=k)
{
    cout << n*x << endl;
}else
{
    cout << k*x+(n-k)*y << endl;
}








//////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 256
from math import gcd

def lcm(a, b):
    return a*b//gcd(a,b)
def main():
    N = int(input())
    A = list(map(int, input().split()))
    mod = 10**9 + 7
    LCM = 1
    for a in A:
        LCM = lcm(LCM, a)
    ans = 0
    for a in A:
        ans += (LCM//a)
        

    print(ans % mod)
main()


Measured memory_bytes: 69944
#include <bits/stdc++.h>
using namespace std;
#define INF 1e9
 
int main() {
  long long int L, R;
  cin >> L >> R;
  
  R = min(R, L+672);
  
  long long int result = INF;
  for (long long int i=L; i<R; i++) {
    for (long long int j=i+1; j<=R; j++) {
      result = min((i * j) % 2019, result);
    }
  }
  
  cout << result << endl;
  
  return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
LR = sorted([list(map(int, input().split())) for i in range(M)], key=lambda x: (x[0], -x[1]))

minv = 0
maxv = N
for l, r in LR:
    if maxv < l:
        print(0)
        exit()
    minv = max(minv, l)
    maxv = min(maxv, r)

print(maxv-minv+1)

Measured memory_bytes: 66904
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
typedef long long ll;
int max(int a, int b) {
	if (a > b)
		return a;
	else
		return b;
}
int main()
{
	int A, B, C, K;
	scanf("%d%d%d%d", &A, &B, &C, &K);
	int max_v = max(A, B);
	max_v = max(max_v, C);
	int ans = A + B + C + max_v * ((1 << K) - 1);
	
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
long long n,a[200001],i,ans=0;
int main(void)
{
	scanf("%lld",&n);
	for(i=0;i<n;i++){
		scanf("%lld",&a[i]);
		if(i!=0&&a[i]<a[i-1]){
			ans+=a[i-1]-a[i];
			a[i]=a[i-1];
		}
	}
	printf("%lld\n",ans);
	return 0;
}

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

#include <atcoder/all>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using namespace atcoder;
using ll = long long;
using P = pair<int, int>;

int op(int a, int b) { return max(a, b); }

int e() { return -1; }

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  vector<int> dp(n);
  segtree<int, op, e> seg(300001);
  dp[0] = 1;
  seg.set(a[0], 1);
  for (int i = 1; i < n; i++) {
    int max_dp = seg.prod(max(0, a[i] - k), min(300001, a[i] + k + 1));
    if (max_dp == -1) {
      dp[i] = 1;
    } else {
      dp[i] = max_dp + 1;
    }
    if (seg.get(a[i]) < dp[i]) seg.set(a[i], dp[i]);
  }
  cout << seg.all_prod() << endl;

  return 0;
}

Measured memory_bytes: 10868
#include <iostream>
        #include <bits/stdc++.h>
        #include <cstring>
        #include <cstdlib>
        #include <vector>
        #include <algorithm>
        #include <math.h>
        using namespace std;
        int main() {
                int a,b,c,k,sum=0;
                cin >> a >> b >> c >> k;
                if(k>a){
                sum=sum+a;
                k=k-a;
                }
                else{
                sum=sum+k;
                k=0;
                }
                if(k>b)
                    k=k-b;
                else
                    k=0;
                if(k>c){
                    sum=sum-c;
                    k=k-b;
                }
                else
                {
                    sum=sum-k;
                    k=0;
                }
                printf("%d\n",sum);
        return 0;
        }

Measured memory_bytes: 3744
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;

int main() {

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int n, k;
	cin >> n >> k;
	vector<int> a(n, 0);
	int count = n;
	for (int i = 0; i < k; i++)
	{
		int d;
		cin >> d;
		for (int j = 0; j < d; j++)
		{
			int A;
			cin >> A;
			if (a[A - 1] == 0)
			{
				count--;
				a[A - 1] = 1;
			}
		}

	}
	cout << count;
	return 0;

}

Measured memory_bytes: 3616
str = input()
maxans = []
ans = []

for j in range(0,len(str)):
  for i in range(j,len(str)):
    if str[i] == 'A' or str[i] == 'C' or str[i] == 'G' or str[i] == 'T':
      ans.append(str[i])
    else:
      break
  if len(ans) >= len(maxans):
    maxans = ans
  ans = []
      
print(len(maxans))

Measured memory_bytes: 3060
n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]

knock_down = [0] * (n + 1)

for i in range(n):
    power = b[i]

    # まずはi番目の街のモンスターをできる限り倒す
    if(power >= a[i] - knock_down[i]):
        power -= (a[i] - knock_down[i])
        knock_down[i] = a[i]
    else:
        knock_down[i] += power
        continue

    if(power == 0):
        continue

    # 次に、残った力でi+1番目のモンスターをできる限り倒す
    if(power >= a[i+1]):
        knock_down[i+1] = a[i+1]
    else:
        knock_down[i+1] = power

print(sum(knock_down))

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

typedef struct point{
  double x;
  double y;
}Point ;

void kock(int,Point *,Point *);

int n;//深さを記録する外部変数

int main(){
  Point p1, p2;

  p1.x = 0;
  p1.y = 0;
  p2.x = 100;
  p2.y = 0;

  scanf("%d", &n);
  printf("%f %f\n", p1.x,p1.y);
  kock(n,&p1,&p2);
  printf("%f %f\n", p2.x,p2.y);  

  return 0;
}

void kock(int n,Point *p1,Point *p2){
  double rad = 60 * M_PI / 180.0;
  Point s, t, u;

  if(n == 0){
    return ;
  }

  s.x = (2*p1->x + 1*p2->x)/3;
  s.y = (2*p1->y + 1*p2->y)/3;
  t.x = (1*p1->x + 2*p2->x)/3;
  t.y = (1*p1->y + 2*p2->y)/3;
  u.x=(t.x-s.x)*cos(rad)-(t.y-s.y)*sin(rad)+s.x;
  u.y=(t.x-s.x)*sin(rad)+(t.y-s.y)*cos(rad)+s.y;
  
  kock(n-1, p1, &s);
  printf("%f %f\n", s.x, s.y);
  kock(n-1, &s, &u);
  printf("%f %f\n", u.x, u.y);
  kock(n-1, &u, &t);
  printf("%f %f\n", t.x, t.y);
  kock(n-1, &t, p2);
}



Measured memory_bytes: 2116
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.StringTokenizer;

import static java.lang.Integer.parseInt;

/**
 * Maximization of Relational Expression
 */
public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;
		String[] words;

		int N = parseInt(br.readLine());
		int[] a = new int[N];

		StringTokenizer st = new StringTokenizer(br.readLine());
		for (int i = 0; i < N; i++) a[i] = parseInt(st.nextToken());
		Arrays.sort(a);

		double max = 0.0;
		BigDecimal AB, CD;

		for (int i = 0; i < N - 3; i++) {
			AB = BigDecimal.valueOf(a[N - 1] + a[N - 2]);
			CD = BigDecimal.valueOf(a[i + 1] - a[i]);
			max = Math.max(max, AB.divide(CD, 7, BigDecimal.ROUND_HALF_UP).doubleValue());
		}

		AB = BigDecimal.valueOf(a[N - 1] + a[N - 4]);
		CD = BigDecimal.valueOf(a[N - 2] - a[N - 3]);
		max = Math.max(max, AB.divide(CD, 7, BigDecimal.ROUND_HALF_UP).doubleValue());


		AB = BigDecimal.valueOf(a[N - 3] + a[N - 4]);
		CD = BigDecimal.valueOf(a[N - 1] - a[N - 2]);
		max = Math.max(max, AB.divide(CD, 7, BigDecimal.ROUND_HALF_UP).doubleValue());

		System.out.format("%.6f%n", max);
	}
}

Measured memory_bytes: 26260
// inputに入力データ全体が入る
function Main(input) {
    input = input.split("\n");
    tmp = input[0].split(" ");
    const a = parseInt(tmp[0], 10);
    const b = parseInt(tmp[1], 10);
    const c = parseInt(tmp[2], 10);
    
    //console.log(a,b,c);
    function divisor(num){
    var results = [];
   for(var i=1; i<=num; i++) {
        if( (num%i == 0) ) {
            results.push(i);
        }
    }
    return results;

    }
// テスト
p = divisor(a);
//console.log(p);
  q = divisor(b);
//console.log(q);
p1=p.length;q1=q.length;
//console.log(p1,q1);
var cnt =0;

ppp = [];qqq=[];
  if (p1 >= q1){
     for(i = 0;i<q1;i++){
      for (l=i;l<p1;l++){ if(q[i]==p[l]){ppp[cnt] = p[l];
                                     cnt =cnt +1;
                                   //  console.log(ppp);
                                     break; }
                                       
                        }
                       }
                   }
  else   
    { for(i = 0;i<p1;i++){
      for (l=i;l<q1;l++){ if(p[i]==q[l]){ppp[cnt] = q[l];
                                     cnt =cnt +1;
                                  //   console.log(ppp);
                                     break; }
                         }
                         } 
                        }
                
    t =ppp.length; 
//  console.log(t-c);
    var t=t-c;
    console.log(ppp[t]);     
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
n = int(input())
data = [list(map(int, input().split())) for _ in range(n-1)]

if n == 1:
    print(0)
    exit()

for i in range(n-1):
    time = data[i][1]
    for j in range(i, n-1):
        if time < data[j][1]:
            time = data[j][1]
        if time % data[j][2] != 0:
            time += data[j][2] - (time % data[j][2])
        time += data[j][0]
    print(time)

print(0)


Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define jizz ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define pb push_back
#define ET cout << "\n"
#define MEM(i,j) memset(i,j,sizeof i)
#define F first
#define S second
#define MP make_pair
#define ALL(v) v.begin(),v.end()
#define DB(a,s,e) {for(int i=s;i<e;++i) cout << a[i] << " ";ET;}
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

pll dots[55];
bitset<55> vis;

int main()
{jizz
	int n,ans;
	cin >> n,ans=n;
	for(int i=0;i<n;++i)
		cin >> dots[i].F >> dots[i].S;
	sort(dots,dots+n);
	for(int i=0;i<n;++i)
		for(int j=i+1;j<n;++j)
		{
			pll vec=MP(dots[j].F-dots[i].F,dots[j].S-dots[i].S),nw;
			int tmp=0;
			vis.reset();
			for(int k=0;k<n;++k)
				if(!vis[k])
				{
					vis[k]=1,++tmp,nw.F=dots[k].F+vec.F,nw.S=dots[k].S+vec.S;
					for(int p=k+1;p<n;++p)
						if(dots[p]==nw)
							vis[p]=1,nw.F+=vec.F,nw.S+=vec.S;
				}
			ans=min(ans,tmp);
		}
	cout << ans << "\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
int to[7][2] = {
  {1, 2},
  {6, 3},
  {1, 6},
  {4, 5},
  {5, 2},
  {2, 1},
  {6, 6}};

int main(){
  string s;
  while(cin>>s && s != "#"){
    int u = 0;
    REP(i, s.size()){
      u = to[u][s[i] - '0'];
    }
    if(u == 5) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }
  return 0;
}

Measured memory_bytes: 1184
#include<bits/stdc++.h>
using namespace std;
const int N=1000100;
int n,m,p;
int x[N],y[N],a[N],b[N],c,ans=1e9;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	cin>>n>>m>>p;
	for(int i=0;i<n;i++)
		cin>>x[i];
	for(int i=0;i<m;i++)
		cin>>y[i];
	for(int i=0;i<p;i++)
	{
		cin>>a[i]>>b[i]>>c;
		a[i]--,b[i]--;
		ans=min(ans,x[a[i]]+y[b[i]]-c);
	}
	sort(x,x+n);
	sort(y,y+m);
	ans=min(ans,x[0]+y[0]);
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 10880
import java.util.Scanner;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int K = sc.nextInt();
		int count =0;
		for(int i=100;i>=1;i--) {
			if (A%i==0&&B%i==0) {
				count ++;
				if (count ==K) {
					System.out.println(i);
					return ;
				}
			}
		}
	}
}

Measured memory_bytes: 22996
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;
inline int getInt() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;



int main() {
  int n;
  scanf("%d",&n);
  string s;
  cin>>s;
  bool one = false;
  vi a(n);
  rep(i,n) {
    a[i] = s[i]-'1';
    if (a[i] == 1) one = true;
  }
  if (!one) rep(i,n) a[i] /= 2;
  int ans = 0;
  rep(i,n) {
    if (((n-1)&i) != i) continue;
    ans ^= a[i]%2;
  }
  if (!one) ans *= 2;
  cout<<ans<<endl;
  return 0;
}






















Measured memory_bytes: 5252
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
ll mod = 1000000007;
#define SIZE 100000
ll inv[SIZE + 1];
ll kai[SIZE + 1];
ll invkai[SIZE + 1];
void invinit()
{
	inv[1] = 1;
	for (int i = 2; i <= SIZE; i++)
	{
		inv[i] = mod - (mod / i)*inv[mod%i] % mod;
	}
	kai[0] = invkai[0] = 1;
	for (int i = 1; i <= SIZE; i++)
	{
		kai[i] = kai[i - 1] * i%mod;
		invkai[i] = invkai[i - 1] * inv[i] % mod;
	}
}
ll com(ll a, ll b)
{
	if (b < 0 || a < b)return 0;
	return (invkai[b] * invkai[a - b]) % mod*kai[a] % mod;
}
int dp[555][555][555];
int cnt[555];
ll po[555][555];
int main()
{
	int num, len;
	scanf("%d%d", &num, &len);
	invinit();
	for (int i = 0; i < num; i++)
	{
		int z;
		scanf("%d", &z);
		cnt[z]++;
	}
	for (int i = 0; i <= len + 10; i++)
	{
		po[i][0] = 1;
		for (int j = 0; j <= len + 10; j++)po[i][j + 1] = po[i][j] * i%mod;
	}
	dp[0][len][0] = 1;
	for (int i = 0; i <= len; i++)
	{
		for (int j = len; j >= 1; j--)
		{
			for (int k = 0; k <= len; k++)
			{
				if (dp[i][j][k] == 0)continue;
				ll t = dp[i][j][k];
				for (int l = 0; k + l*j <= len && i + l <= len; l++)dp[i + l][j - 1][k + l*j] = (dp[i + l][j - 1][k + l*j] + t*com(i + l, l) % mod*po[k + l - i*(j - 1)][cnt[j]]) % mod;
			}
		}
	}
	ll ans = 0;
	for (int i = 0; i <= len; i++)
	{
		for (int k = 0; k <= len; k++)
		{
			ll t = dp[i][0][k];
			ll r = t*com(i + (len - k - (i - 1)), i) % mod;
			if ((len - k) % 2 == 0)ans = (ans + r) % mod;
			else ans = (ans + mod - r) % mod;
			//printf("%d %lld   ", dp[i][0][k], r);
		}
		//printf("\n");
	}
	printf("%lld\n", ans);
}

Measured memory_bytes: 605056
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;

int main(){
    int K;
    string S;
    cin >> K >> S;
    int size = S.length();
    if (K >= size) cout << S << endl;
    else {
        for (int i = 0; i < K; i++) cout << S.at(i);
        cout << "..." << endl;
    }
    return 0;
}


Measured memory_bytes: 3632
#include<stdio.h>

int main(void){
int n,i;
scanf("%d",&n);
int a[n];

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

for(i=n;i>1;i--){
printf("%d ",a[i]);
}

printf("%d\n",a[1]);


return 0;
}


Measured memory_bytes: 2756
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE BangPatterns #-}

import Control.Applicative
import Control.Monad
import Control.Arrow
import Data.List
import Data.Maybe
import Data.Char
import qualified Data.ByteString.Char8 as B
import Text.Printf

readInt = ( readLn :: IO Int )
readInts = map ( read :: String -> Int ) . words <$> getLine

getList = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

main = do
	[ a, b, c ] <- readInts
	putStrLn $ which "Yes" "No" $ a <= c && c <= b


Measured memory_bytes: 508
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include<cmath>
#include<limits>
#define ll long long
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define int_INF 2147483647
#define pint_INF 2000000000
#define ll_INF 	9223372036854775807
#define MOD 1000000007
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvll vector<vector<long long>>
#define vvc vector<vector<char>>
#define vll vector<long long>
#define pii pair<int,int>
#define vpii vector<pair<int,int>>
#define sysp system("PAUSE")
#define pno cout << "no" << endl
#define pyes cout << "yes" << endl
#define pYes cout << "Yes" << endl
#define pNo cout << "No" << endl
using namespace std;

int main() {
	int K, T; cin >> K >> T;
	priority_queue<int> pq;
	for (int i = 0; i < T; i++) {
		int x; cin >> x;
		pq.push(x);
	}

	while (pq.size() > 1) {
		int u = pq.top(); pq.pop();
		int v = pq.top(); pq.pop();
		pq.push(u - v);
	}

	cout << max(pq.top() - 1, 0) << endl;
}

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

int main()
{
    int n, k; cin >> n >> k;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    
    cout << (n + k - 3) / (k - 1) << endl;
    return 0;
}

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

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

const int MOD = 1000000007;

int H,W;
vector<string> land;
int dp[1100][1100] = {0};

void add(int& a,int b){
    a += b;
    if(a>=MOD) a -= MOD;
}


int main(){
    cin >> H >> W;
    land.resize(H);
    for(int i=0;i<H;++i) cin >> land[i];

    dp[0][0] = 1;

    for(int i=0;i<H;++i){
        for(int j=0;j<W;++j){
            if(i+1 < H && land[i+1][j]=='.') add(dp[i+1][j],dp[i][j]);
            if(j+1 < W && land[i][j+1]=='.') add(dp[i][j+1],dp[i][j]);
        }
    }

    cout << dp[H-1][W-1] << endl;

}



Measured memory_bytes: 5632
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define ll long long
#define ld long double
#define mp make_pair
#define pb push_back
#define fo(i,n) for(ll i=0;i<n;i++)
#define fo1(i,n) for(ll i=1;i<=n;i++)
#define loop(i,a,b)for(ll i=a;i<=b;i++)
#define loopr(i,a,b)for(ll i=b;i>=a;i--)
#define vll vector<ll> 
#define vvl vector<vll>
#define pii pair<ll,ll>
#define F first
#define S second

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll h1,m1,h2,m2,k;
	cin>>h1>>m1>>h2>>m2>>k;
	ll ans=h2*60+m2-h1*60-m1-k;
	if(ans<0)
	cout<<0;
	else
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define lf long double
typedef vector <ll> vi;
typedef pair <ll,ll> ii;
typedef vector <pair <int,int> >vii;
typedef vector <vector <ll> > vv;
typedef vector <string> vs;
ll mod=1000000007;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n;
    cin>>n;
    vi a(n+1);
    for(ll i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    vi b(n+1,0);
    for(ll i=n;i>=1;i--)
    {
        ll sum=0;
        ll num=i;
        while(num<=n)
        {
            sum+=b[num];
            num+=i;
        }
        if(a[i]%2==1)
        {
            if(sum%2==0)
            {
                b[i]=1;
            }
            else
                b[i]=0;
        }
        else if(a[i]==0)
        {
            if(sum%2==1)
                b[i]=1;
            else
                b[i]=0;
        }
    }
    vi o;
    for(ll i=0;i<=n;i++)
    {
        if(b[i])
        {
            o.pb(i);
        }
    }
    cout<<o.size()<<endl;
    for(ll i=0;i<o.size();i++)
    {
        cout<<o[i]<<" ";
    }
    if(o.size())
        cout<<endl;
} 


Measured memory_bytes: 5108
#include "bits/stdc++.h"
using namespace std;

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < n; i++)
#define Rep(i, n) for(int i = 1; i < n; i++)

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vii = vector<pair<int, int>>;

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

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); }
int round_int(int a, int b) { return (a + (b - 1)) / b; }

// 素因数分解; 返り値は(素数, 乗数)のvector配列
vector<pair<ll, int>> factorize(ll n) {
	vector<pair<ll, int>> res;
	for (ll i = 2; i * i <= n; ++i) {
		if (n % i) continue;
		res.emplace_back(i, 0);
		while (n % i == 0) {
			n /= i;
			res.back().second++;
		}
	}
	if (n != 1) res.emplace_back(n, 1);
	return res;
}

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };
constexpr auto MAX = 100010;

// ──────────────────────────────────────────────────────────────────────────────

int main() {
	double a, b, x;
	cin >> a >> b >> x;
	double s = x / a;
	double rad;
	if (s >= a * b / 2) {
		double h = (a * b - s) * 2 / a;
		rad = atan2(h, a);
	}
	else {
		double w = s * 2 / b;
		rad = atan2(b, w);
	}
	double PI = acos(-1);
	double deg = rad / (2 * PI) * 360;
	printf("%.10f\n", deg);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <string>
#include <map>

using namespace std;
int main(int argc, const char * argv[]) {
    
    int n, m;
    cin >> n >> m;
    int mi = 0, mx = 1000000;
    for (int i=0; i< n; i++) {
        int l, r;
        cin >> l >> r;
        mi = max(mi, l);
        mx = min(mx, r);
    }

    cout << max(mx - mi + 1, 0) << endl;
    return 0;
}

Measured memory_bytes: 256
N = STDIN.gets.to_i
K = STDIN.gets.to_i
X = STDIN.gets.to_i
Y = STDIN.gets.to_i
loopcnt=1
sum=0

while loopcnt<=N do
     if loopcnt > K then
          sum = sum+Y
          else
               sum=sum+X
     end
     loopcnt=loopcnt+1
end
puts(sum)

Measured memory_bytes: 1788
#include<iostream>
#include<cstdio>
#include<queue>
#include<string>
using namespace std;

int main()
{
	priority_queue<int> Q;
	string s;
	int num;
	while (cin >> s) {
		if (s == "end")break;
		scanf("%d", &num);
		if (s[0] == 'i')Q.push(num);
		if (s[0] == 'e') {
			printf("%d\n", Q.top());
			Q.pop();
		}
	}
	return 0;
}

Measured memory_bytes: 7028
#include<bits/stdc++.h>
 
using namespace std;
 
#define int long long
#define ALL(x) (x).begin(),(x).end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
 
typedef pair<int,int> PI;
typedef pair<int,pair<int,int>> PII;
static const int INF=1010000000000000017LL;
static const double eps=1e-12;
static const double pi=3.14159265358979323846;
static const int dx[4]={1,-1,0,0};
static const int dy[4]={0,0,1,-1};
static const int ddx[8]={1,-1,0,0,1,1,-1,-1};
static const int ddy[8]={0,0,1,-1,1,-1,1,-1};
 
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 N,K;
int A[100005];
int bit[100];

int ipow(int x,int n){
    int ret=1;
    for(int i=0;i<n;++i)ret*=x;
    return ret;
}

signed main(){
    cin>>N>>K;
    for(int i=0;i<N;++i){
        cin>>A[i];
        for(int j=0;j<=60;++j){
            if((A[i]>>j)&1)bit[j]++;
        }
    }
    int x=0;
    int ans=0;;
    for(int i=60;i>=0;--i){
        int nx=x+ipow(2,i);
        if(nx>K||2*bit[i]>N)continue;
        else x=nx;
    }
    for(int i=0;i<N;++i){
        ans+=(x^A[i]);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 4356
#include <stdio.h>
    int main(void){
    int S,h,m,s;
    scanf("%d",&S);
    h=S/3600;
    m=(S-(h*3600))/60;
    s=S-(h*3600)-(m*60);
    printf("%d:%d:%d\n",h,m,s);
    return 0;
 }


Measured memory_bytes: 2740
#include <stdio.h>

int main(void)
{
	int N, M, i, j, temp, K, count = 0;
	int num[31] = { 0 };
	scanf("%d %d", &N, &M);
	for (i = 0; i < N; i++) {
		scanf("%d", &K);
		for (j = 1; j <= K; j++) {
			scanf("%d", &temp);
			num[temp]++;
		}
	}

	for (i = 1; i <= M; i++) {
		if (num[i] == N) {
			count++;
		}
	}

	printf("%d", count);

	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
//debug
#define vecprint(v) rep(i,v.size())cout << v[i] << " ";cout << endl;
#define setprint(s) for(auto i=s.begin();i!=s.end();i++)cout << *i << " ";cout << endl;
#define mappairprint(s) for(auto i=s.begin();i!=s.end();i++)cout << i->first << " " << i->second << endl;
//reader
#define r1(a) cin>>(a)
#define r2(a,b) cin>>(a)>>(b)
#define r3(a,b,c) cin>>(a)>>(b)>>(c)
//writer
#define wtr(a) cout<<(a)<<" "
//#define wtr(a,b) cout<<(a)<<" "<<(b)<<" "
//#define wtr(a,b,c) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "
#define wtrl(a) cout<<(a)<<endl
//#define wtrl(a,b) cout<<(a)<<" "<<(b)<<endl
//#define wtrl(a,b,c) cout<<(a)<<" "<<(b)<<" "<<(c)<<endl
//variable definition
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
//roop
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(c) c.begin(),c.end()
//term
#define elif else if
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
using namespace std;
using ll = long long;
//const
constexpr double PI = 3.141592653589793238462643383279;
vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};


int main() {
  //input
  int n,m;
  cin >> n >> m;
  
  int h[n] = {0};
  rep(i,n) cin >> h[i];
  
  pair<int,int> path[m];
  rep(i,m) {
    int a,b;
    cin >> a >> b;;
    path[i] = make_pair(a-1,b-1);
  }
  
  
  int node[n];
  rep(i,n) node[i] = 1;
  
  rep(i,m) {
    if(h[path[i].first] > h[path[i].second]) {
      node[path[i].second] = 0;
    } else if(h[path[i].first] < h[path[i].second]) {
      node[path[i].first] = 0;
    } else if(h[path[i].first] == h[path[i].second]) {
      node[path[i].first] = 0;
      node[path[i].second] = 0;
    }
  }
  
  int ans = 0;
  rep(i,n) ans += node[i];
  cout << ans << endl;
  
}

Measured memory_bytes: 5164