akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <iostream>

using namespace std;

int main() {
  int N;
  cin >> N;
  int a;
  int ans{10000};
  while(cin >> a) {
    int i{};
    while(a%2==0) {
      ++i;
      a /= 2;
    }
    ans = min(ans,i);
  }

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


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

int main() {
  int K,M;
  string S,H;
  cin >> K >> S;
  M=S.size();
  H="...";
  if (M<=K) {
    cout << S << endl;
  }
  if (M>K) {
    S=S.erase(K);
    cout << S+H << endl;
  }
}

Measured memory_bytes: 3644
N,D = map(int, input().split())

if D == 1:
  print(N * (N-1) // 2)
else:
  A = [0] * N
  count = 0
  sei = 0

  for i in range(0,N):
	  A[i] = list(map(int, input().split()))
    
  for p in range(0,N):
      for q in range(0,N):
          sum = 0
    
          for r in range(0,D):
              sum = sum + (A[p][r]-A[q][r]) ** 2
           
          sum = sum ** 0.5 
          sei = int(sum)
        
          if sum != 0 and sum == sei:
              count = count + 1
      
  print(count // 2)

Measured memory_bytes: 3064
#pragma GCC optimize ("O3")
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <stack>
#include <unordered_map>
#define lld long long int
#define dbg1(vari1) cerr<<#vari1<<" = "<<(vari1)<<endl;
#define dbg2(vari1,vari2) cerr<<#vari1<<" = "<<(vari1)<<" "<<#vari2<<" = "<<(vari2)<<endl;
#define dbg3(vari1,vari2,vari3) cerr<<#vari1<<" = "<<(vari1)<<" "<<#vari2<<" = "<<(vari2)<<" "<<#vari3<<" = "<<(vari3)<<endl;
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	lld a,b,k;
	cin >> a >> b >> k;
	if(k>=a)
	{
		k-=a;
		a=0;
		if(k>=b)
		{
			k-=b;
			b=0;
		}
		else
		{
			b-=k;
		}
	}
	else
	{
		a-=k;
	}
	cout << a << " " << b;

}

Measured memory_bytes: 256
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define reps(i,a,b) for(int i=a;i<b;++i)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T &a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U &u,const V... v){for(auto &e:u)fill_v<T>(e,v...);}

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

    string s;
    cin >> s;
    ll k;
    cin >> k;
    vector<pair<char, ll>> cnt;
    cnt.eb(s[0], 0);
    int n = sz(s);
    rep(i, n) {
        if (cnt.back().fi == s[i]) cnt.back().se++;
        else cnt.eb(s[i], 1);
    }
    if (sz(cnt) == 1) {
        cout << cnt[0].se * k / 2 << endl;
        return 0;
    }
    ll ans = 0;
    rep(i, sz(cnt)) {
        ans += cnt[i].se / 2;
    }
    ans *= k;
    if (cnt[0].fi == cnt.back().fi) {
        ans -= cnt[0].se / 2 * (k-1);
        ans -= cnt.back().se / 2 * (k-1);
        ans += (cnt[0].se + cnt.back().se) / 2 * (k-1);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3568
#include <bits/stdc++.h>
#include <sys/types.h>
#include <unistd.h>

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

using ll=long long;


const int limit = 100010;
ll L[limit], R[limit];
ll llpos[limit], lrpos[limit];
ll rlpos[limit], rrpos[limit];
ll lans[limit], rans[limit];

int main(void){
	int n;
	cin >> n;

	rep(i, n){
		cin >> L[i] >> R[i];
		R[i]++;
	}

	using seg = tuple<ll, ll>;
	vector<seg> ary;
	rep(i, n) ary.push_back(seg(R[i], L[i]));
	sort(begin(ary), end(ary));

	{
		ll lpos = -1LL, rpos = 1LL << 30;
		rep(i, n){
			ll r, l;
			tie(r, l) = ary[i];
			chmax(lpos, l);
			chmin(rpos, r);
			llpos[i] = lpos;
			lrpos[i] = rpos;
			lans[i] = max(0LL, rpos - lpos);
		}
	}

	{
		ll lpos = -1LL, rpos = 1LL << 30;
		rrep(i, n){
			ll r, l;
			tie(r, l) = ary[i];
			chmax(lpos, l);
			chmin(rpos, r);
			rlpos[i] = lpos;
			rrpos[i] = rpos;
			rans[i] = max(0LL, rpos - lpos);
		}
	}

	ll ans = 0LL;
	rep(i, n - 1) chmax(ans, lans[i] + rans[i + 1]);

	rep(i, n) {
		ll r, l;
		tie(r, l) = ary[i];
		
		ll lpos = -1LL, rpos = 1LL << 30;
		if(i - 1 >= 0){
			chmax(lpos, llpos[i - 1]);
			chmin(rpos, lrpos[i - 1]);
		}

		if(i + 1 < n){
			chmax(lpos, rlpos[i + 1]);
			chmin(rpos, rrpos[i + 1]);
		}

		const ll cur = max(r - l, 0LL) + max(rpos - lpos, 0LL);
		chmax(ans, cur);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 8176
import math
firstvar = input()
n = int(firstvar.split(" ")[0])
d = int(firstvar.split(" ")[1])
current = 0;
points = []
while current < n:
    points.append(input().split(" "))
    current = current + 1
current = 0
answer = 0
done = []
while current < n:
    current2 = 0
    while current2 < n:
        if current2 != current and not [current, current2] in done:
            total = 0
            current3 = 0
            while current3 < d:
                total = total + pow(int(points[current][current3]) - int(points[current2][current3]), 2)
                current3 = current3 + 1
            total = math.sqrt(total)
            if total == int(total):
                answer += 1
            done.append([current2, current])
        current2 = current2 + 1
    current = current + 1
print(answer)
        

Measured memory_bytes: 3064
#include<iostream> 
#include<stdio.h>
#include<string>
#include<iomanip> 
#include<vector> 
#include<map> 
#include<set> 
#include<algorithm> 
#include<numeric> 
#include<limits> 
#include<bitset> 
#include<functional> 
#include<type_traits> 
#include<queue> 
#include<stack> 
#include<array> 
#include<random> 
#include<utility> 
#include<cstdlib> 
#include<ctime>
//#define _LIBCPP_DEBUG 0
//#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define all(a) (a).begin(),(a),end()
#define rep(i,n) for (int i = 0; i < (n); ++i)	
//setprecision(16)

void outi(int x) { cout << x << endl; }
void outl(ll x) { cout << x << endl; }
void outs(string x) { cout << x << endl; }
ll max(ll a, ll b) {
	ll max;
	if (a > b) max = a;
	else max = b;
	return max;
}
ll min(ll a, ll b) {
	ll min;
	if (a < b) min = a;
	else min = b;
	return min;
}
int gcd(int x, int y) {
	/*最大公約数 O(log MAX_X)*/
	if (y == 0) return x;
	return gcd(y, x % y);
}
//---------------------------------------------------------------

int main() {
	string s, t;
	cin >> s >> t;

	int cnt = 0;

	rep(i, s.size()) {
		if (s[i] != t[i]) cnt++;
	}

	cout << cnt << endl;
	return 0;
}

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

struct node{
    int f = 0;
    vector<int> c;
};

node g[100001];

void mark(int a){
    g[a].f = 1;
    int i;
    for(i = 0; i < g[a].c.size(); i++){
        int b = g[a].c[i];
        if(g[b].f == 0){
            g[b].f = 1;
            mark(b);
        }
    }
}


int main(){
    int n, m, i;
    cin >> n >> m;
    for(i = 0; i < m; i++){
        int x, y, z;
        cin >> x >> y >> z;
        g[x].c.push_back(y);
        g[y].c.push_back(x);
    }
    int c = 0;
    for(i = 1; i <= n; i++){
        if(g[i].f == 0){
            c++;
            mark(i);
        }
    }
    cout << c << endl;
}

Measured memory_bytes: 9600
#include <stdio.h>
#define INF 100001

int main (void){
    int N;
    int a,b;
    int count[INF]={};//テゥツ?催・ツ按療」ツ?ョテヲツ閉ーテ・ツュツ療」ツ?ッテァツァツ?」ツ?凝」ツつ嘉ィツヲツ凝」ツ?淌・ツ渉凝ゥツ?氾」ツ?ョテゥツ?」テ」ツつ古」ツ?ヲティツ。ツ古」ツ?湘、ツコツコテヲツ閉ー
    int i,max=0;
    
    scanf("%d", &N);
    while(N){
        scanf("%d %d",&a ,&b);
        for(a--;a!=b;a++){
           // printf("%d %d\n", a, b);
            count[a]++;
        }
    
        N--;
    }
    for(i=0;i<INF;i++){
        if(count[i] > i)
            count[i] = i;
        if(count[i] < i)
            count[i] = 0;
    }
    
    
    max = count[0];
    for(i=1;i<INF;i++){
        //if(i<10) printf("%d",count[i]);
        if(count[i] > max){
            max = count[i];
        }
    }
    
    printf("%d\n",max);
    return 0;
}

Measured memory_bytes: 996
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<functional>
#include <random>
#include<iostream>
#include<iomanip>
using namespace std;
int N;
int a[200000], b[200000];
int color[200000];
vector<int> adj_nodes[200000];
queue<int> q;

int p[200000];
int qq[3];

int main() {
	cin >> N;
	for (int i = 0; i < N-1; i++) {
		cin >> a[i] >> b[i];
		a[i]--;
		b[i]--;
		adj_nodes[a[i]].push_back(b[i]);
		adj_nodes[b[i]].push_back(a[i]);
	}

	if (N == 2) {
		cout << "1 2\n";
		return 0;
	}

	for (int i = 0; i < N; i++) {
		color[i] = -1;
	}

	q.push(0);
	color[0] = 0;

	while (!q.empty()) {
		int v = q.front();
		q.pop();
		for (int i = 0; i < adj_nodes[v].size(); i++) {
			if (color[adj_nodes[v][i]] == -1) {
				q.push(adj_nodes[v][i]);
				color[adj_nodes[v][i]] = 1 - color[v];
			}
		}
	}

	/*colorのうち、少ない方を1にする*/
	int num[2];
	num[0] = 0;
	num[1] = 0;
	for (int i = 0; i < N; i++) {
		num[color[i]] += 1;
	}
	if (num[0] < num[1]) {
		for (int i = 0; i < N; i++) {
			color[i] = 1 - color[i];
		}
		int swap = num[0];
		num[0] = num[1];
		num[1] = swap;
	}
//	for (int i = 0; i < N; i++) {
//		cout << color[i] << " ";
//	}

	int mod[3];
	mod[0] = N / 3;
	mod[1] = N / 3;
	mod[2] = N / 3;
	if (N % 3 == 1) {
		mod[1] += 1;
	}else if (N % 3 == 2) {
		mod[1] += 1;
		mod[2] += 1;
	}

	qq[0] = 3;
	qq[1] = 1;
	qq[2] = 2;

	int ima_mod = 0;
	if (num[1] <= mod[0]) {
		/*colorが1のやつをすべて3の倍数にする*/
		for (int i = 0; i < N; i++) {
			if (color[i] == 1) {
				p[i] = qq[0];
				qq[0] += 3;
				if (qq[0] > N) {
					ima_mod = 1;
				}
			}
		}
		for (int i = 0; i < N; i++) {
			if (color[i] == 0) {
				if (ima_mod == 0) {
					p[i] = qq[0];
					qq[0] += 3;
					if (qq[0] > N) {
						ima_mod = 1;
					}
				}
				else if (ima_mod == 1) {
					p[i] = qq[1];
					qq[1] += 3;
					if (qq[1] > N) {
						ima_mod = 2;
					}
				}
				else {
					p[i] = qq[2];
					qq[2] += 3;
				}
			}
		}
	}
	else {
		/*colorが1のやつはmod3で1or0、1を優先的に使う*/
		ima_mod = 1;
		for (int i = 0; i < N; i++) {
			if (color[i] == 1) {
				if (ima_mod == 1) {
					p[i] = qq[1];
					qq[1] += 3;
					if (qq[1] > N) {
						ima_mod = 0;
					}
				}
				else {
					p[i] = qq[0];
					qq[0] += 3;
					if (qq[0] > N) {
						ima_mod = 2;
					}
				}
			}
		}
		for (int i = 0; i < N; i++) {
			if (color[i] == 0) {
				if (ima_mod == 0) {
					p[i] = qq[0];
					qq[0] += 3;
					if (qq[0] > N) {
						ima_mod = 2;
					}
				}
				else {
					p[i] = qq[2];
					qq[2] += 3;
				}
			}
		}
	}

	for (int i = 0; i < N; i++) {
		cout << p[i] << " ";
	}

}

Measured memory_bytes: 16884
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>

#define IN(x) scanf("%d",&(x));
#define IN2(x,y) IN((x));IN((y));
#define IN3(x,y,z) IN2((x),(y));IN((z);

#define OUT(x) printf("%d\n",x);
#define OUT2(x,y) printf("%d %d\n",x,y);
#define OUT3(x,y,z) printf("%d %d %d\n",x,y,z);

#define WAIT char bla;scanf("%c",&bla);

#define X first
#define Y second
#define MP make_pair
#define PB push_back

using namespace std;

typedef long long ll;
typedef pair < int, int> pii;
typedef vector < int > vi;
typedef pii pt;

const int N = 55;
const int M = 1e6 + 500;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const int LOG = 20;
const int OFF = (1 << LOG);
const double EPS = 1e-9;
const double PI = 3.1415926535;

int n,a[N],b[N],dis[N][N],can[N][N];

void compute(){
    for(int i = 0;i<N;i++){
        for(int j = 0;j<N;j++)
            dis[i][j] = INF;
        dis[i][i] = -1;
    }
    for(int i = 0;i<N;i++){
        for(int j = 1;j<N;j++){
            for(int k = 0;k<N;k++){
                if(i % j == k){
                    dis[i][k] = min(dis[i][k], j);
                    //printf("%d => %d , %d\n",i,k,j);
                }
            }
        }
    }
    for(int bla = 0;bla<N;bla++){
        for(int k = N-1;k>=1;k--)
            for(int i = 0;i<N;i++){
                for(int j = 0;j<N;j++){
                    dis[i][j] = min(dis[i][j],max(dis[i][k],dis[k][j]));
            }
        }
    }
}

ll sol = 0;



void solve(){   
    int cnt = 0;
    for(;;){
        cnt++;
        if(cnt > 200 ){
            printf("-1\n");
            exit(0);
        }
        int pot = -1;
        for(int i = 0;i<n;i++){
            int cur = INF;
            for(int j = 0;j<N;j++){
                if(can[i][j]) cur = min(cur, dis[j][b[i]]); 
            }
            //printf("C %d\n",cur);
            pot = max(pot, cur);
        }
        /*
        //WAIT;
        
        printf("POT %d\n",pot);
        for(int i = 0;i<n;i++){
            printf("I %d : \n",i);
            for(int j = 0;j<N;j++)
                if(can[i][j]) printf("%d ",j);
            printf("\n");
        }
        */
        if(pot == -1) break;
        sol += (1LL << pot);
        for(int i = 0;i<n;i++){
            for(int j = 0;j<N;j++){
                if(!can[i][j]) continue;
                can[i][j % pot] |= 1; 
            }
        }
   }
    
}


int main(){
    compute();
    IN(n);
    for(int i = 0;i<n;i++)
        IN(a[i]);
    for(int i = 0;i<n;i++)
        IN(b[i]);
    for(int i = 0;i<n;i++)
        can[i][a[i]] = 1;
    solve();
    printf("%lld\n",sol);
}


Measured memory_bytes: 128
n,m=map(int,input().split())
a=[list(map(int,input().split())) for a in range(n)]
c=[list(map(int,input().split())) for b in range(m)]
dist=0
minnum=0
for indi,i in enumerate(a):
    min=10**10
    minnum=0
    for indj,j in enumerate(c):
        dist=0 
        dist+=abs(i[0]-j[0])
        dist+=abs(i[1]-j[1])
        #print("dist={}".format(dist))
        if min>dist:
            min=dist
            minnum=indj
    print(minnum+1)

Measured memory_bytes: 3064
//package basics.AtCoders;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner s= new Scanner(System.in);
        String n=s.nextLine();
        int sum=0;
        for(int i=0;i<n.toString().length();i++){
            sum = sum + Integer.parseInt(String.valueOf(n.charAt(i)));;
        }
        System.out.println((sum%9==0)?"Yes":"No");
    }
}


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

#define pb push_back
#define F first
#define S second

#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define int long long
#define ll long long


	
void solve(){
	int n;
	cin >> n;
	int a[n + 1], dp[n + 1];
	for(int i =  1 ; i <= n ; i++){
		cin >> a[i];		
	}
	dp[1] = 0;	
	dp[2] = abs(a[2] - a[1]);
	for(int i = 3 ; i <= n ; i++){
		dp[i] = min(dp[i - 1] + abs(a[i] - a[i - 1]), dp[i - 2] + abs(a[i] - a[i - 2]));
	}
	cout << dp[n];
}

signed main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int t = 1;
	//cin >> t;
	while(t--)
		solve();
	return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<iomanip>
#include<string>
#include<set>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<functional>
using namespace std;
#define LL long long
#define MOD 100000
#define inf 1999999999


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

	return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'0'+=16;        で大文字に
//'大文字'+=32;    で小文字に
//s[i]-'0'でchar文字→int数に;
//string s = to_string(int数);
//int n = stoi(string文字列)
//cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる


int main() {
  ll n,a,b;
  cin >>n>>a>>b;
 
  if(a>b) {
  cout << 0 << endl;
  }
  
  else if(n==1 && a!=b) {
  cout << 0 << endl;
  }
  
  else if(n==1 && a==b) {
  cout << 1 << endl;
  }
  
  else {
  cout << b*(n-1)+a-b-a*(n-1)+1 << endl;
  }
  
}


Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}
import           Control.Exception           (assert)
import           Control.Monad
import           Control.Monad.Primitive
import qualified Control.Monad.ST            as ST
import qualified Data.Array.IO               as IO
import qualified Data.Array.ST               as ST
import qualified Data.Array.Unboxed          as A
import           Data.Bits
import qualified Data.ByteString.Char8       as BS
import           Data.Char
import           Data.Foldable
import           Data.List
import           Data.Maybe
import qualified Data.Sequence               as Seq
import qualified Data.Set                    as Set
import qualified Data.Vector.Unboxed         as V
import qualified Data.Vector.Unboxed.Mutable as VM
import           Debug.Trace

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine
getIntVec n = V.unfoldrN n (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine

readInteger = fst . fromJust . BS.readInteger
readIntegerList = map readInteger . BS.words
getInteger = readInteger <$> BS.getLine
getIntegerList = readIntegerList <$> BS.getLine

inf :: Int
inf = 10^18

main = do
  n <- getInt

  let getOne i set | i == n = return set
                   | otherwise = do
                       s <- BS.getLine
                       let set' = s `Set.insert` set
                       getOne (i+1) set'

  set <- getOne 0 Set.empty

  let ans = Set.size set

  print ans

Measured memory_bytes: 84120
import sys
import math
import heapq
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, m=DVSR): return pow(x, m - 2, m)
def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())
def FLIST(n):
    res = [1]
    for i in range(1, n+1): res.append(res[i-1]*i%DVSR)
    return res
def gcd(x, y):
    if x < y: x, y = y, x
    div = x % y
    while div != 0:
        x, y = y, div
        div = x % y
    return y


R=II()
COL=input()

if R >= 3200:
    print(COL)
else:
    print("red")

Measured memory_bytes: 3064
N,M = map(int, input().split())
a = list(map(int, input().split()))
K_past = a[0]
A_past = a[1:]
  

for n in range(1,N):
  a = list(map(int, input().split()))
  l = []
  K = a[0]
  A = a[1:]
  
  for i in range(K):
    if A[i] in A_past:
      l.append(A[i])
  A_past = l
    
print(len(A_past))

Measured memory_bytes: 3064
#include <iostream>
#include<algorithm>
int absyai(int a){return a>0?a:-a;}


using namespace std;
int main(void){
    int a[3];
    scanf("%d%d%d",&a[0],&a[1],&a[2]);
    int ans=0;
    sort(a,a+3);
    ans+=absyai(a[0]-a[1]);
    ans+=absyai(a[1]-a[2]);
    printf("%d\n",ans);
    return 0;
}


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

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

const long long INF = 1LL << 60;

int main(){
  int m;
  cin >> m;

  cout << 48-m << endl;

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define MAX 100
int main()
{
  int i,j;
  int x,y,count=0;
  int array[MAX];
  scanf("%d",&x);
  for(i=0;i<x;i++)
    {
      scanf("%d",&array[i]);
    }
  for(i=0;i<x;i++)
    {
      for(j=x-1;j>=1;j--)
	{
	  if(array[j] < array[j-1])
	    {
	      y = array[j-1];
	      array[j-1] = array[j];
	      array[j] = y;
	      count++;
	    }
	}
    }
  for(i=0;i<x;i++)
    {
      printf("%d",array[i]);
      if(i !=x-1)
	{
	  printf(" ");
	}
      else
	{
	  printf("\n");
	}
    }
  printf("%d\n",count);
  return 0;
}

Measured memory_bytes: 604
// Problem : A - Calc
// Contest : AtCoder - AtCoder Beginner Contest 172
// URL : https://atcoder.jp/contests/abc172/tasks/abc172_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define endl '\n'
#define pb push_back
#define mod 1000000007
ll power(ll x, ll y) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2); 
    p = (p * p) ; 
  
    return (y%2 == 0)? p : (x * p) ; 
} 
ll factorial[1000007];
void fact(ll n)
{
    memset(factorial,0,sizeof(factorial));
    factorial[0]=1;
factorial[1]=1;

    for(int i=1;i<n;i++)
    {
        factorial[i]=(factorial[i-1]*i)%mod;
    }
    
}
ll ncr(ll n,ll r)
{
    ll ans=1;
    ll i;
    ans=factorial[n];
    ll ans1=power(factorial[n-r],mod-2);
    ll ans2=power(factorial[r],mod-2);
    ans=((ans*ans1)%mod*ans2)%mod;
    return ans;
}
ll gcd(ll a, ll b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);  
      
} 

bool prime[100000006];
void sieve(ll n){
    memset(prime,true,sizeof(prime));
	prime[1]=false; 
    for (ll p=2;p*p<=n;p++){
        if (prime[p]){  
            for (ll i=p*p;i<=n;i+=p)
                prime[i]=false;
        }
    }
}
void bfs(vector<int> v[],int o,int n,int dp[]){
	queue<int> q;
	q.push(o);
	dp[o]=0;
	bool visited[n+1]={0};
	visited[o]=true;
	while(q.empty()==false){
		int a=q.front();
		q.pop();
		for(int i=0;i<v[a].size();i++){
			if(visited[v[a][i]]==false){
				visited[v[a][i]]=true;
				q.push(v[a][i]);
				dp[v[a][i]]=dp[a]+1;
			}
		}
	}
}
int nov[1000001];
bool visited[1000001];
int dp[1000001];
int dfs(vector<int> v[],int o)
{
    if(visited[o]==0)
    {
        visited[o]=1;
        for(int i=0;i<v[o].size();i++)
        {
            if(visited[v[o][i]]==0)
            {
            dp[v[o][i]]=dp[o]+1;
            nov[o]+=dfs(v,v[o][i]);
            }
        }
        return nov[o]+1;
    }
    else
    return 0;
}
// string s=bitset<64>(n).to_string();
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
	ll n;
	cin>>n;
	ll ans=n;
	ans+=power(n,2)+power(n,3);
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
#define ll long long int 
#define w(x) int x; cin>>x; while(x--)
#define pb push_back
#define mp make_pair
#define mod 1000000007
using namespace std;
int main(){
#ifndef ONLINE_JUDGE 
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ll n,x;
	cin>>n>>x;
	ll a[n];
	for(ll i=0; i<n; i++)
		cin>>a[i];
	ll ans=0,z;
	for(ll i=0; i<n-1; i++){
		if(a[i]+a[i+1]>x){
			if(a[i]+a[i+1]-x>=a[i+1]){
				ans+=a[i]+a[i+1]-x;
				a[i+1]=0;
			}
			else{
				ans+=a[i]+a[i+1]-x;
				z=a[i]+a[i+1]-x;
				a[i+1]-=z;
			}
		}
	}
	cout<<ans;

}

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

int main() {
  int N;
  vector<int> C(N),V(N);
  cin >> N;
  for(int i=0;i<N;i++)
  {
    cin >> V[i];
  }
    for(int i=0;i<N;i++)
  {
    cin >> C[i];
  }
  int total = 0;

  for(int i=0;i<N;i++)if(V[i]-C[i]>0)total += (V[i]-C[i]);

  cout << total << endl;
}

Measured memory_bytes: 512
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def main():
    ss=input().split()
    if ss[0][-1]==ss[1][0] and ss[1][-1]==ss[2][0]:print("YES")
    else:print("NO")
main()

Measured memory_bytes: 3064
import itertools

N = int(input())
x, y = [], []
for _ in range(N):
    _x, _y = map(int, input().split())
    x.append(_x)
    y.append(_y)

ans = 0
paths = list(itertools.permutations(range(N)))
for p in paths:
    for i in range(N-1):
        s = p[i]
        d = p[i+1]
        ans += ((x[s] - x[d]) ** 2 + (y[s] - y[d]) ** 2) ** 0.5
ans /= len(paths)
print(ans)

Measured memory_bytes: 8052
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
int n, r, l;
vector<int> g[100010];
int lc[100010];
int d[100010];
void dfs(int x, int p){
	if(g[x].size()==1) lc[x]=1;
	d[x]=1;
	for(auto y:g[x]){
		if(y==p) continue;
		dfs(y, x);
		lc[x]+=lc[y];
	}
	for(auto y:g[x]){
		if(y==p) continue;
		d[x]=max(d[x], max(1, lc[x]-lc[y])+d[y]);
	}
}
int ans;
void dfs2(int x, int p){
	vector<int> v;
	for(auto y:g[x]){
		if(y==p) continue;
		v.push_back(d[y]-lc[y]);
	}
	sort(v.begin(), v.end(), greater<int>());
	if(v.size()>=2) ans=max(ans, v[0]+v[1]+l);
	for(auto y:g[x]){
		if(y==p) continue;
		dfs2(y, x);
	}
}
int main()
{
	cin>>n;
	for(int i=0; i<n-1; i++){
		int a, b;
		cin>>a>>b;
		a--; b--;
		g[a].push_back(b);
		g[b].push_back(a);
	}
	if(n==2){
		cout<<2<<endl;
		return 0;
	}
	r=-1;
	for(int i=0; i<n; i++){
		if(g[i].size()==1) l++;
		else if(g[i].size()>2) r=i;
	}
	if(r==-1){
		cout<<n<<endl;
		return 0;
	}
	dfs(r, -1);
	dfs2(r, -1);
	cout<<ans<<endl;
	return 0;
}

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

int main(void){
    ll a, b, k;
    cin >> a >> b >> k;

    vector<ll> x;
    rep(i, k){
        x.push_back(i + a);
        x.push_back(b - i);
    }

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

    ll prev = 0;
    rep(i, x.size()){
        if(x[i] == prev || x[i] < a || x[i] > b) continue;
        cout << x[i] << endl;
        prev = x[i];
    }
}


Measured memory_bytes: 256
use std::io::Read;
fn main() {
    let buf = {
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    };
    let out = solve(buf);
    print!("{}", out);
}
fn solve(buf: String) -> String {
    let mut sc = io::Scanner::new(&buf);
    let n: usize = sc.read();
    let q: usize = sc.read();
    let queries: Vec<(usize, usize, usize)> =
        (0..q).map(|_| (sc.read(), sc.read(), sc.read())).collect();
    let mut uf = UnionFind::new(n);
    let mut res = String::new();
    for query in queries {
        if query.0 == 0 {
            uf.merge(query.1, query.2);
        } else {
            if uf.root(query.1) == uf.root(query.2) {
                res.push_str("1\n");
            } else {
                res.push_str("0\n");
            }
        }
    }
    res
}
pub mod io {
    use std::str::{FromStr, SplitWhitespace};
    pub struct Scanner<'a> {
        iter: SplitWhitespace<'a>,
    }
    impl<'a> Scanner<'a> {
        pub fn new(s: &'a str) -> Scanner<'a> {
            Scanner {
                iter: s.split_whitespace(),
            }
        }
        pub fn read<T: FromStr>(&mut self) -> T {
            self.iter
                .next()
                .unwrap()
                .parse()
                .ok()
                .expect("parsing failed")
        }
        pub fn read_vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
            (0..n).map(|_| self.read()).collect()
        }
    }
}

pub struct UnionFind {
    par: Vec<usize>,
    size: Vec<usize>,
}
impl UnionFind {
    pub fn new(n: usize) -> UnionFind {
        UnionFind {
            par: (0..n).collect(),
            size: vec![0; n],
        }
    }
    pub fn root(&mut self, x: usize) -> usize {
        if self.par[x] == x {
            x
        } else {
            let par = self.par[x];
            self.par[x] = self.root(par);
            self.par[x]
        }
    }
    pub fn merge(&mut self, x: usize, y: usize) -> bool {
        let x = self.root(x);
        let y = self.root(y);
        if x == y {
            return false;
        }
        if self.size[x] > self.size[y] {
            self.par[y] = x;
        } else {
            self.par[x] = y;
        }
        true
    }
}



Measured memory_bytes: 11060
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import bisect

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

def LI(): return list(map(int, sys.stdin.readline().split()))

N = int(input())
A = LI()

count_list = [0 for i in range(61)]
def counts(count_list, a):
    for i in range(61):
        if a <= 0:
            break
        count_list[i] += a % 2
        a = a // 2
    return count_list

A.reverse()
ans = 0
ans_list = [0 for i in range(61)]
for i in range(N-1):
    count_list = counts(count_list, A[i])
    hikaku = counts([0 for i in range(61)], A[i + 1])
    for j in range(61):
        if hikaku[j] == 1:
            ans_list[j] += i+1 - count_list[j]
        else:
            ans_list[j] += count_list[j]

for i in range(61):
    ans += ans_list[i] * (2 ** i % mod)
    ans = ans % mod
print(ans)


Measured memory_bytes: 119596
#include<cstdio>
#include<vector>

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

using namespace std;

typedef	vector<int>	vi;

int main(){
	const int Ne=1200;
	static bool er[Ne]; er[0]=er[1]=true;
	for(int i=2;i*i<Ne;i++) if(!er[i]) for(int j=i*i;j<Ne;j+=i) er[j]=true;
	vi p; rep(i,Ne) if(!er[i]) p.pb(i);

	static int cnt[15][1121];	cnt[0][0]=1;
	rep(i,p.size()){
		for(int k=min(i+1,14);k>=1;k--){
			for(int j=p[i];j<=1120;j++){
				if(cnt[k-1][j-p[i]]>0)	cnt[k][j]+=cnt[k-1][j-p[i]];
			}
		}
	}

	for(int n,k;scanf("%d%d",&n,&k),n;)	printf("%d\n",cnt[k][n]);

	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define ll int64_t
using namespace std;

int main(){
  int n;
  ll mod;
  cin>>n>>mod;
  ll vec[2*n];
  for(int i=0;i<2*n;i++){
    cin>>vec[i];
  }
  sort(vec,vec+2*n);
  ll ans;
  int ng=0,ok=n;
  for(int q=0;q<30;q++){
    int check=(ok+ng)/2;
    int flag=0;
    for(int i=check*2;i<2*n;i++){
      if(vec[i]+vec[2*(check+n)-1-i]<mod){
        flag++;
        break;
      }
    }
    if(flag==1){
      ng=check;
    }
    else{
      ok=check;
    }
  }
  ll p=0;
  for(int i=0;i<2*n;i++){
    if(i<2*ok){
      p=max(p,(vec[i]+vec[2*ok-i-1])%mod);
    }
    else{
      p=max(p,(vec[i]+vec[2*(ok+n)-1-i])%mod);
    }
  }
  cout<<p<<endl;
}

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

int main (){
    int A, B, C,X = 0;
    cin >> A >> B >> C >> X;
    int count = 0;
    for (int i = 0; i <= A; i++)
    {
        for (int j = 0; j <= B; j++)
        {
            for (int k = 0; k <= C;k++)
            {
                if (X == i * 500 + j * 100+ k *50)
                {
                    count++;
                }
            }
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 256
/*
START BY THE NAME OF ALMIGHTY ALLAH
THIS WONT BE ACCEPTED
STOP_GIVING_UP
*/
#include<bits/stdc++.h>
#define l(i,a,n)for(int i=a;i<n;i++)
#define PB push_back
#define IN insert
#define MP make_pair
#define LW(v) sort(v.begin(),v.end());
#define HI(v) sort(v.begin(),v.end(),greater<long long>());
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    long long t,r=1,r1=0,r2=0,k=0,a,b,c=1,m,d=0,n,e,f,x=0,g,p=0,q=0,y=0,z=0;
    vector<long long>v;
    vector<long long>u;
    set<long long>s;
    std::vector<int>::iterator it;
    string  s1,s2,s3,s4;
    cin>>s1>>s2;
    s3=s2.substr(0,s1.size());

    if(s3==s1)
    {cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
using pll = pair<long long, long long> ;
typedef long long ll;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

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

int n;
cin >> n;
vector<pll> v(n); // pairを要素にもつvector
rep(i,n){
    ll a ,l;
    cin >> a >> l;
    v[i] = {a-l,a+l};
}

sort(v.begin(), v.end(), [](pll a, pll b) { //『区間を右端の小さい順にsort』の実装方法
    return a.second < b.second;
});

int res = 0;
ll cur = -(1LL<<60); // cur := 現在選んでいる区間のうち、最も右にあるやつの右端()
rep(i,n){
    if (cur > v[i].first) continue; // 被るやつは飛ばす
    ++res;
    cur = v[i].second;
}

cout << res << endl;

return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define lint long long
#define ALL(x) (x).begin(),(x).end()
#define PB push_back
#define MP make_pair
using namespace std;

// cout << fixed << setprecision(12)

int main(){
  int A,B;
  cin >> A >> B;
  cout << A*B << endl;
}
 

Measured memory_bytes: 3636
#include<iostream>
#include<map>
#include<vector>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm> 
#include<climits>
#include<stack>
#include<queue>
#include<set>
#include<cctype>
#include<bitset> 
using namespace std;

# define REP(i,n) for (int i=0;i<(n);++i)
# define rep(i,a,b) for(int i=a;i<(b);++i)
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define all(v) v.begin(),v.end()
# define showVector(v) REP(i,v.size()){p(v[i]);p(" ")} pl("")
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;}
typedef pair<int,int> P_ii;
typedef pair<double,double> P_dd;
typedef long long int ll;

template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}

template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

const int MOD = 1000000007;
const ll INF = (ll)1e12;

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

void mulM(long long &a, long long b) {
    a = ((a%MOD)*(b%MOD))%MOD ;
}

bool compare_by_second(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

int main() {
    ll r,d,x ;cin >> r >> d >> x;

    REP(i,10){
        x = x*r - d;
        pl(x)
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std ;
#define ll long long int 
#define pb push_back 
#define mp make_pair 
#define pii pair <int , int > 
#define pll pair < ll , ll >
int main(){
	ios_base::sync_with_stdio(false) ;
	cin.tie(NULL) ;
	int a , b ;
  cin >> a >> b ;
  cout << max(a*b , max(a + b , a - b)) ; 
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
  int a[3];
  cin >> a[0] >> a[1] >> a[2];
  sort(a, a + 3);
  if (a[0] + a[1] == a[2]) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char s[10000];
int main(){
	int N;
  	cin >> N >> s;
  	for(int i = 0 ; i < strlen(s) ; i++)
    	s[i] = (s[i] - 'A' + N) % 26 + 'A';
  	cout << s << "\n";
  
  	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC target ("avx2")
#pragma GCC optimization ("Ofast")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
#define int long long
typedef pair<int,int>pi;
typedef vector<int>vi;

const int MAXN=15;
const int MOD=1000000007;

#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define DEC(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define mp make_pair
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
#define db(x) cerr<<#x<<" = "<<x<<"\n"
#define LOW(v,x) (lower_bound(all(v),(x))-(v).begin())
#define UP(v,x) (upper_bound(all(v),(x))-(v).begin())

int N,M,X;
int C[MAXN], A[MAXN][MAXN], B[MAXN];
main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin>>N>>M>>X;
	FOR(i,0,N-1){
		cin>>C[i];
		FOR(j,0,M-1){
			cin>>A[i][j];
		}
	}
	int cost = 1e18;
	FOR(bm,0,(1<<N)-1){
		memset(B,0,sizeof B);
		int c=0;
		FOR(i,0,N-1){
			if (bm & (1<<i)){
				c+=C[i];
				FOR(j,0,M-1) B[j]+=A[i][j];
			}
		}
		if (*min_element(B,B+M) >= X){
			cost = min(cost, c);
		}
	}
	if (cost==1e18) cout<<-1;
	else cout<<cost;
}


Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>
#include <memory.h>
#include <assert.h>
#include <iomanip>

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1e9 + 1;
const ll LLINF = 1e18 + 1;
const ll MOD = 1e9 + 7;

int main() {
    ll L, R;
    cin >> L >> R;
    if (L / 2019 < R / 2019) {
        cout << 0 << endl;
        return 0;
    }

    ll mi = INF;
    for(ll i = L; i <= R; i++) {
        for(ll j = i + 1; j <= R; j++) {
            mi = min(mi, (i * j) % 2019);
        }
    }

    cout << mi << endl;

    return 0;
}

Measured memory_bytes: 256
import scala.io.StdIn.readLine
import scala.io.StdIn.readInt

object Main extends App {
    val nk = readLine.split(" ").map(x => x.toInt);
    val n = nk(0)
    val k = nk(1)
    val count = Array.fill(n){0}
    for(i <- 1 to k) {
        val o = readLine
        val arr = readLine.split(" ").map(_.toInt)
        for(x <- arr) {
            count(x-1)=1
        }
    }
    val ans = n-count.sum
    print(ans)
}

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

using namespace std;
#define ll long long

const int N = 1e7 + 5;
vector< int> dp(N,1);

ll update( int n)
{
    for(int i=2;i<=n;i++)
    {
        for(int j =i; j<=n; j+=i)
        {
            dp[j]++;
        }
    }

    ll ans = 0;

    for(ll i=1; i<=n;i++)
        ans+= (i * dp[i]);
    return ans;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n = 0;
    cin>>n;

    ll ans = 0;
    ans = update(n);

    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 42188
/*
    AUTHOR:shivam51
    IIESTS
*/
#include <bits/stdc++.h> 
using namespace std;
//
#define add(x) accumulate(x)
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end() 
#define rep(i, a, b) for (int i=a; i<(b); i++)
#define hs ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<ll> vll;
typedef vector<pll> vpll;
const ll mod = 1000000007;
const ll INF = 1e18;
const ll MAX = 100001;
//
//
                void solve(){
                        string str;
                        ll k;
                        cin>>str>>k;
                        ll n=str.length();
                        if(str[0]!=str[n-1]){
                        	ll t=1,ans=0;
                        	rep(i,1,n)
                        		if(str[i]==str[i-1])
                        			++t;
                        		else{
                        			ans+=t/2;
                        			t=1;
                        		}
                        	ans+=t/2;
                        	cout<<ans*k;
                        	return ;
                        }
                        else{
                        	ll fst=1,snd=1,indx=0,lstindx=n-1,t=1,ans=0;
                        	rep(i,1,n)
                        		if(str[i]==str[i-1]){
                        			++fst;
                        			indx=i;
                        		}
                        		else
                        			break;
                        	if(indx==n-1){
                        		cout<<(fst*k)/2;
                        		return ;
                        	}
                        		// cout<<n;
                        	for(int i=n-2;i>=0;i--){
                        		if(str[i]!=str[i+1]){
                        		// cout<<snd;
                        			break;	
                        		}
                        		++snd;
                        		lstindx=i;
                        		// cout<<snd;
                        	}
                        	rep(i,indx+1,lstindx+1)
                        		if(str[i]==str[i-1])
                        			++t;
                        		else{
                        			ans+=t/2;
                        			t=1;
                        		}
                        	// cout<<fst;
                        			ans+=t/2;
                        	cout<<(fst/2+snd/2+((fst+snd)/2)*(k-1)+ans*k);
                        	return ;
                        }
                }

                int main(){ 
                        hs;
                        ll t;
                        t=1;
                        //cin>>t;
                        for (int i=1; i<=t; i++){
                                //printf("Case #%d: ", i);
                                solve();
                         }
        return 0; 
}         



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//型名省略
typedef long long ll;
typedef vector<long long> vl;
typedef vector<vector<long long>> vvl;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<string> vs;
//マクロ
#define rep(i,n) for(ll i = 0; i < (ll) n; i++)
#define rep2(i,x,n) for(ll i = (ll) x; i < (ll) n; i++)
#define all(A) A.begin(), A.end()
//正誤判定
void Yes(bool ans){cout << (ans? "Yes" : "No") << endl;}
void YES(bool ans){cout << (ans? "YES" : "NO") << endl;}


//main関数
int main() {
    ll n, m, sum = 0; cin >> n >> m;
    vl a(m);
    rep(i,m) {
        cin >> a[i];
        sum += a[i];
    }

    if(sum > n) cout << -1 << endl;
    else cout << n - sum << endl;

}

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

int main(){
    int h, m, s;
    
    cin >> s;
    
    h = s / 3600;
    m = s % 3600 / 60;
    s = s % 60;
    
    cout << h << ":" << m << ":" << s << endl;
    
    return 0;
}




Measured memory_bytes: 3128
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<functional>
using namespace std;
#define ll long long int
#define ld long double
using namespace __gnu_pbds;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,
tree_order_statistics_node_update> in_set;
#define rep(n) for(ll i=0;i<(n);i++)
#define jrep(n) for(ll j=0;j<(n);j++)
#define all(a) (a).begin(), (a).end()
#define dpp(a) cout<<(a).first<<" "<<(a).second<<endl;
#define append push_back
#define mod 1000000007
#define ff first
#define ss second
#define ffast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fast ios::sync_with_stdio(0);
ll pw(ll x,ll y,ll p=mod){ll r=1; x=x%p;while(y>0){ if(y&1)r=(r*x)%p;
y=y>>1;x=(x*x)%p;} return r; } vector<ll> uniq(vector<ll> arr)
{vector<ll>brr;sort(all(arr));brr.append(arr[0]);
for(auto i:arr)if(brr.back()!=i)brr.append(i);return brr;}

vector<pair<ll,ll>> arr;
ll memo[10010];
ll dp(ll i){
    if(i<=0) return 0;
    if(memo[i]==-1){
        ll mi = mod;
        for(auto p:arr){
            mi=min(mi,dp(i-p.ff)+p.ss);
        }
        memo[i]=mi;
    }
    return memo[i];
}

void solve(){
    rep(10010) memo[i]=-1;
    ll h,n; cin>>h>>n; arr.resize(n);
    rep(n) cin>>arr[i].ff>>arr[i].ss;
    cout<<dp(h)<<endl;
}
 
int main(){
    ffast
    ll t=1;
    //cin>>t;
    rep(t) solve();
}
 
 
// *p.find_by_order(n) : nth value (0 indexed)
// p.order_of_key(7): index of 7 (0 indexed)


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

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repr(i, n) for(int i = (n-1); i >= 0; --i)

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

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

const int MAX = 200005;
const int INF = 1001001001;
const int MOD = 1000000007;

int main(){
    int x;
    cin >> x;
    cout << 1 - x << endl;
}

Measured memory_bytes: 3616
#include<stdio.h>
int main()
{
  int N,K;
  long long int con;
  
  scanf("%d %d",&N,&K);
  con=K;
  
  for(int i=1;i<N;i++)
    con*=K-1;
  printf("%lld",con);
  
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=1e9;

int main(){
    int n,m;
    cin>>n>>m;
    pair<int,int> j[n];
    for(int i=0;i<n;i++){
        int a,b;
        cin>>a>>b;
        j[i]={a,b};
    }
    sort(j,j+n);
    int ans=0,t=0;
    priority_queue<pair<int,int>> pq;
    for(int i=1;i<=m;i++){
        while(t<n&&j[t].first==i){
            pq.push({j[t].second,j[t].first});
            ++t;
        }
        if(pq.size()){
            ans+=pq.top().first;
            pq.pop();
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 2168
import math

tr = []

def check(n, k, P):
    i = 0
    for j in range(k):
        s = 0
        while s + tr[i] <= P:
            s += tr[i]
            i += 1
            if i == n:
                return n
    return i

def solve(n, k):
    left = 0
    right = 100000 * 100000
    while right - left > 1:
        mid = math.floor((left+right) / 2)
        v = check(n, k, mid)
        if v >= n:
            right = mid
        else:
            left = mid
    return right

def main():
    input_line = input().split(" ")
    n = int(input_line[0])
    k = int(input_line[1])
    
    for _ in range(n):
        w = int(input())
        tr.append(w)

    ans = solve(n, k)
    
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 9640
#include<iostream>
using namespace std;
int main()
{
    int a,b,c;
 cin>>a>>b>>c;
 if(a!=b and a!=c and b!=c)
    cout<<3;
 else if((a==b and a!=c)or(a==c and a!=b)or(b==c and a!=c))
    cout<<2;
 else if((a==b and a!=c)or(a==c and a!=b)or(b==c and a!=c))
    cout<<2;
else if(a==b and b==c)
    cout<<1;
    return 0;
//NR
}

Measured memory_bytes: 256