akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
ll par[100010];
ll pa(ll x){
    if(par[x]==x)
        return x;
    return par[x]=pa(par[x]);
}
ll sm[100010];
void join(ll x, ll y){
    ll tmp=sm[pa(x)]+sm[pa(y)];
    par[pa(x)]=pa(y);
    sm[pa(x)]=tmp;
}
vector < pair<ll, ll> > v;
ll x[100010], y[100010], z[100010];
vector <ll> a[100010], b[100010], c[100010];
bool vis[100010], l[100010];
void dfs(ll x, ll tmp){
    if(vis[x])
        return;
    vis[x]=1;
    for(ll i=0; i<a[x].size(); ++i){
        if(b[x][i]<=tmp){
            l[c[x][i]]=1;
            dfs(a[x][i], tmp);
        }
    }
}
ll f[100010], smm[100010];
int main(){
    ll n, m;
    while(cin>>n>>m){
        ll ans=0;
        for(ll i=1; i<=n; ++i){
            scanf("%lld",f+i);
        }
        for(ll i=1; i<=n; ++i){
            par[i]=i;
            sm[i]=f[i];
        }
        for(ll i=0; i<m; ++i){
            scanf("%lld%lld%lld",&x[i],&y[i],&z[i]);
            v.push_back(mk(z[i],i));
            a[x[i]].push_back(y[i]);
            b[x[i]].push_back(z[i]);
            c[x[i]].push_back(i);
            a[y[i]].push_back(x[i]);
            b[y[i]].push_back(z[i]);
            c[y[i]].push_back(i);
        }
        sort(v.begin(), v.end());
        ll tmp1, tmp2;
        for(ll i=0; i<v.size(); ++i){
            tmp1=v[i].fs;
            tmp2=v[i].sc;
            if(pa(x[tmp2])!=pa(y[tmp2])){
                join(x[tmp2], y[tmp2]);
            }
            smm[tmp2]=sm[pa(x[tmp2])];
//            cout<<tmp2<<" "<<smm[tmp2]<<endl;
        }
        reverse(v.begin(), v.end());
        for(ll i=0; i<v.size(); ++i){
            tmp1=v[i].fs;
            tmp2=v[i].sc;
            if(l[tmp2]){
                continue;
            }
            if(tmp1<=smm[tmp2]){
                dfs(x[tmp2],tmp1);
            }
            else{
                ++ans;
            }
        }
        cout<<ans<<endl;
    }
  return 0;
}




Measured memory_bytes: 28528
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair <int,int> PAIR;
const int N = 1e5+5;
const ll M = (1ll << 63)-1;
const int INF = 0x3f3f3f3f;

inline ll cal(ll x){
	return x*x*x*x*x;
}

int main() {
	ll x;
	scanf("%lld",&x);
	
	for(ll i = 0;i <= 6208;++i){
		for(ll j = 0;j <= 6208;++j){
			if(cal(i) - cal(j) == x){
				printf("%lld %lld\n",i,j);
				return 0;
			}
			if(x - cal(j) == cal(i)){
				printf("%lld %lld\n",i,-j);
				return 0;
			}
		}
	}
    return 0;
}


Measured memory_bytes: 3760
def main():
    n, m, *a = map(int, open(0).read().split())
    t = {1: 2, 2: 5, 3: 5, 4: 4, 5: 5, 6: 6, 7: 3, 8: 7, 9: 6}
    a.sort(reverse=True)

    dp = [-float('Inf')] * (n + 10)
    dp[0] = 0
    for i in range(2, n + 1):
        for j in a:
            dp[i] = max(dp[i], dp[i - t[j]] + 1)

    nums = []
    for i in range(dp[n], 0, -1):
        for x in a:
            if dp[n - t[x]] == i - 1:
                nums.append(x)
                n -= t[x]
                break

    ans = ''.join(map(str, nums))
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3692
#include<iostream>
#include<cstdio> 
using namespace std;
int a,b,c,k;
void dfs(int dep,int x,int y,int z) {
    if(dep==k+1) {
        if(y>x&&z>y) {
            puts("Yes");
            exit(0);
        }
        return;
    }
    dfs(dep+1,x*2,y,z);
    dfs(dep+1,x,y*2,z);
    dfs(dep+1,x,y,z*2);
}
int main() {
    scanf("%d %d %d %d",&a,&b,&c,&k);
    dfs(1,a,b,c);
    puts("No");
    return 0;
}

Measured memory_bytes: 3136
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include "bits/stdc++.h"

using namespace std;

typedef unsigned long long ll;
typedef int                     integer;
#define int                     long long
#define ii                      pair<int,int>
#define vii                     vector<pair<int,int>>
#define vi                      vector<int>
#define vvi                     vector<vector<int>>
#define f(a,b,c)                for(int a=b;a<c;a++)
#define s(x)                    in>>x
#define s2(x,y)                 in>>x>>y
#define s3(x,y,z)               in>>x>>y>>z
#define s4(x,y,z,w)             in>>x>>y>>z>>w
#define p(x)                    out<<x<<endl
#define p2(x,y)                 out<<x<<" "<<y<<endl
#define pl(x)                   out<<x
#define p2l(x,y)                out<<x<<" "<<y
#define p1d(a,n)                for(int ix=0;ix<n;ix++) out<<a[ix]<<" "; out<<endl
#define p2d(a,n,m)              for(int ix=0;ix<n;ix++){ for(int jx=0;jx<m;jx++) out<<a[ix][jx]<<" "; out<<endl;}
#define range(v)                v.begin(),v.end()
#define w(x)                    while(x--)
#define rst(x)                  memset(x, -1, sizeof(x))
#define UNVISITED               -1
#define VISITED                 0
#define EXPLORED                2

void ssolve(std::istream& in, std::ostream& out){
    int n;
    s(n);
    int ans = (1000 - (n % 1000)) % 1000;
    p(ans);
    return;
}

class APayment {
public:
void solve(std::istream& in, std::ostream& out) {
    ios_base::sync_with_stdio(false);
    in.tie(0);out.tie(0);
    int t;
    int READ = 0;
    if(READ) s(t);
    else t = 1;
    while(t--){
        ssolve(in, out);
    }
}
};

integer main() {
    APayment solver;
    std::istream& in(std::cin);
     std::ostream& out(std::cout);
     solver.solve(in, out);
}

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

const int N = 1e5 + 5;

vector<int> g[N];
bool f[N], ok[N];

deque<int> dq;
int n, m, a, b;

int check(int u) {
	for (auto v: g[u]) if (!f[v])
		return v; 
	return 0; }

int main() {
#ifdef HOME
	freopen("agc13b.in", "r", stdin);
	freopen("agc13b.out", "w", stdout);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);

	int t;

	cin >> n >> m;
	for (int i = 0; i < m; ++i) {
		cin >> a >> b;
		g[a].push_back(b);
		g[b].push_back(a); }

	a = 1, b = g[1][0];

	dq.push_back(a);
	dq.push_front(b);

	do {
		f[a] = f[b] = true;
		if (ok[a] || !(t = check(a)))
			ok[a] = true;
		else {
			a = t, f[a] = true;
			dq.push_back(a); }

		if (ok[b] || !(t = check(b)))
			ok[b] = true;
		else {
			b = t, f[b] = true;
			dq.push_front(b); } }
	while (!(ok[a] && ok[b]));

	cout << dq.size() << '\n';
	for (auto i: dq)
		cout << i << ' ';
	cout << endl;

	return 0; }


Measured memory_bytes: 6784
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define mod 1000000007
typedef long long ll;
using namespace std;

int main(){
  int N,M;
  cin >> N >> M;;
  vector<vector<int>> p(101000);
  int a,b;
  rep(i,N){
    cin >> a >> b;
    p[a].pb(b);
  }
  rep(i,101000){
    sort(p[i].begin(), p[i].end(), greater<int>());
  }
  int ans=0;
  priority_queue<int> q;
  for(int i=1;i<=M;i++){
    for(int j=0;j<(int)p[i].size();j++){
      q.push(p[i][j]);
    }
    if(!q.empty()){
      ans += q.top();
      q.pop();
    }
  }

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


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

int main() {
    string s;
    cin >> s;
    
    rep(i,s.size())
        if(!(i%2))
            cout << s.at(i);
    cout << endl;
}

Measured memory_bytes: 512
#include<iostream>
#include<complex>
#include<math.h>
#include<algorithm>
using namespace std;
int n,i,j;
double x[100],y[100],a[101],Ans[100];
complex<double>z[100];
int main()
{
  cin >> n;
  for(i=0;i<n;i++){
    cin >> x[i] >> y[i];
    z[i]=complex<double>(x[i],y[i]);
  }
    for(i=0;i<n;i++){
      for(j=0;j<n;j++){
        a[j]=fmod(arg(z[j]-z[i])+2*M_PI,2*M_PI);
      }
      sort(a,a+n);
      a[n]=a[1]+2*M_PI;
      for(j=1;j<n;j++){
        if(a[j+1]-a[j]>=M_PI){Ans[i]=(a[j+1]-a[j]-M_PI)/2/M_PI;
                             }
      }
    }
  for(i=0;i<n;i++){
  cout << Ans[i] << endl;
  }
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize("-Ofast")
#include <bits/stdc++.h>
using namespace std;

typedef int in;
#define int long long
#define pb push_back
#define f first
#define s second
#define double long double
#define p push
const int MAX=2e5+5;
const int MAX2=2e6+4;
const int MAAX=2e18;
const int MOD=1e9+7;

in main()
{
 int a,b,c;
 cin>>a>>b>>c;
 swap(a,b);
 swap(a,c);
 cout<<a<<" "<<b<<" "<<c<<endl;
    return 0;
}



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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using ll = long long;
using Graph = vector<vector<int>>;

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

    bool judge = true;
    int length = N / 2;
    if(N % 2 != 0) judge = false;
    for(int i = 0; i < length; i++)
    {
        if(S[i] != S[length + i])
        {
            judge = false;
            break;
        }
    }
    cout << (judge ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    string O;
    cin>>O;
    
    string E;
    cin>>E;
    
    for(int i=0;i<E.length();i++){
        cout<<O[i]<<E[i];
    }
    
    if(O.length()-E.length()>0){
        cout<<O[O.length()-1]<<endl;
    }
}


Measured memory_bytes: 256
// ====================================
//   author: M_sea
//   website: https://m-sea-blog.com/
// ====================================
#include <bits/stdc++.h>
#define file(x) freopen(#x".in","r",stdin); freopen(#x".out","w",stdout)
using namespace std;
typedef long long ll;

int read() {
	int X=0,w=1; char c=getchar();
	while (c<'0'||c>'9') { if (c=='-') w=-1; c=getchar(); }
	while (c>='0'&&c<='9') X=X*10+c-'0',c=getchar();
	return X*w;
}

const int N=100000+10;

int n,m,a[N],b[N],c[N],p[N],rk[N];
vector<int> G[N],E[N];
bool cmp(int x,int y) { return c[x]<c[y]; }

int f[N];
int find(int x) { return x==f[x]?x:f[x]=find(f[x]); }

ll dp[N],sum[N];
void dfs(int u) {
	sum[u]=b[u],dp[u]=1e18;
	if (E[u].empty()) { dp[u]=max(a[u],b[u]); return; }
	for (int v:E[u]) dfs(v),sum[u]+=sum[v];
	for (int v:E[u])	
		dp[u]=min(dp[u],sum[u]-sum[v]+max(1ll*c[u],dp[v]));
}

int main() {
	n=read(),m=read();
	for (int i=1;i<=n;++i) a[i]=read(),b[i]=read();
	for (int i=1;i<=m;++i) {
		int u=read(),v=read();
		G[u].emplace_back(v),G[v].emplace_back(u);
	}
	for (int i=1;i<=n;++i) c[i]=max(0,a[i]-b[i]),p[i]=i;
	sort(p+1,p+n+1,cmp);
	for (int i=1;i<=n;++i) rk[p[i]]=f[i]=i;
	for (int i=1;i<=n;++i)
		for (int v:G[p[i]])
			if (find(v)!=p[i]&&rk[v]<i)
				E[p[i]].emplace_back(find(v)),f[find(v)]=p[i];
	dfs(p[n]); printf("%lld\n",dp[p[n]]);
	return 0;
}
// /cy/cy/cy

Measured memory_bytes: 23116
def main():
    L,R = [int(x) for x in input().split()]
    ans = 2019
    for i in range(L,min(R,L+2018)+1):
        for j in range(i+1,min(R,L+2018)+1):
            tmp = (i*j) % 2019
            if tmp < ans:
                ans = tmp
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 64580
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

using System.Collections;

class Program
{
    static void Main()
    {
        int N = int.Parse(Console.ReadLine());
                
        var lineList = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToList();

        var longestLineLen = lineList.Max<int>();
        var longestLineIndex = lineList.IndexOf(longestLineLen);

        lineList.Remove(longestLineLen);
        if (longestLineLen < lineList.Sum())
        {
            Console.WriteLine("Yes");
        }
        else
        {
            Console.WriteLine("No");
        }
    }
    
}

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

int main(void){
    int k = 0;
    char s[101];

    scanf("%d", &k);
    scanf("%s", s);

    if(strlen(s) <= k){
        printf("%s\n", s);
    }else{
        for(int i = 0; i < k; i++){
            printf("%c", s[i]);
        }
        printf("...\n");
    }

    return 0;

} 


Measured memory_bytes: 3688
from sys import stdin


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    N = int(_in[0])  # type:int
    a_arr = [None]
    for i in range(N):
        _ = int(_in[i+1])  # type:int
        a_arr.append(_)
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    memo = []
    now = 1
    for i in range(N):
        _ = a_arr[now]
        if _ == 2:
            cnt = i+1
            break
        else:
            now = _
    else:
        cnt = -1
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(cnt)


Measured memory_bytes: 62940
#include <cstdio>

using namespace std;

const int MAX_N = 100;
int A[MAX_N];
int N;

int selectionSort(int *a, int n);

void show(int *a, int n) {
	for (int i = 0; i < n; i++) {
		printf("%d", A[i]);
		if (i != n - 1) {
			printf(" ");
		}
	}
	printf("\n");
}

void solve() {
	int num;

	scanf("%d", &N);
	for (int i = 0; i < N; i++) {
		scanf("%d", A + i);
	}

	num = selectionSort(A, N);
	show(A, N);
	printf("%d\n", num);
}

int main() {
	solve();
}

int selectionSort(int *a, int n) {
	int minj, temp;
	int num = 0;

	for (int i = 0; i < n; i++) {
		minj = i;
		for (int j = i; j < n; j++) {
			if (a[j] < a[minj]) {
				minj = j;
			}
		}
		if (minj != i) {
			temp = a[i];
			a[i] = a[minj];
			a[minj] = temp;
			num++;
		}
	}
	return num;
}

Measured memory_bytes: 2744
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(int i=0;i<(int)(n);i++)
#define N 1000010


int main() {
	char a[N];
	int b[N];
	f(i, N)a[i] = 0;
	int n, k;
	int x, y, z;
	int s, ans;
	bool v = true;
	ans = 0;
	scanf("%d", &n);
	scanf("%s", a);
	n--;
	f(i, n) {
		b[i] = a[i + 1] - a[i];
		b[i] = abs(b[i]);
		if (b[i] == 1)v = false;
	}
	if (v) {
		f(i, n)b[i] /= 2;
		x = 0;
		k = n - 1;
		f(i, n) {
			if ((i | k) == k)x += b[i];
		}
		if (x % 2 == 1)ans = 2;
		else ans = 0;
	}
	else {
		x = 0;
		k = n - 1;
		f(i, n) {
			if ((i | k) == k)x += b[i];
		}
		if (x % 2 == 1)ans = 1;
		else ans = 0;
	}
	printf("%d\n", ans);


	return 0;
}

Measured memory_bytes: 5060
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > >
#define pq_pair_ts priority_queue <pair<ll,ll> > //第二成分の大きさが関係ない
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}

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

    for(ll i = N, j = M/N ; i <= M ; i++, j--){
        if(M%i == 0){
            cout << M/i << endl;
            return 0;
        }
        if(M%j == 0){
            cout << j << endl;
            return 0;
        }
    }



    return 0;
}

/*
/^[\w!\x22\#$%&@\'() * +,-.\/;:]+$/
*/


Measured memory_bytes: 256
n=int(input())
d=list(map(int,input().split()))
maxd=max(d)
import collections
counter=collections.Counter(d)
if d[0]!=0 or counter[0]!=1:
  print(0)
else:
  a=1
  ans=1
  for i in range(1,maxd+1):
    if i not in counter:
      print(0)
      break
    else:
      b=counter[i]
      ans*=(a**b)
      a=b
  else:
    print(ans%998244353)


Measured memory_bytes: 18936
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

enum inf3 = 1_001_001_001;
enum inf6 = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;


void main() {
    int n;
    scan(n);
    auto a = readln.split.to!(long[]);

    auto asum = a.sum();
    auto tn = 1L * n * (n + 1) / 2;

    if (asum % tn) {
        writeln("NO");
        return;
    }

    auto K = asum / tn;

    auto d = new long[](n);
    foreach (i ; 0 .. n) {
        d[i] = a[(i + 1) % n] - a[i];
    }

    d[] -= K;

    debug {
        writeln(d);
    }

    long cnt;

    foreach (i ; 0 .. n) {
        if (d[i] > 0 && d[i] % n) {
            writeln("NO");
            return;
        }
        cnt += abs(d[i]) / n;
    }

    writeln(cnt == K ? "YES" : "NO");
}






void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}


Measured memory_bytes: 6476
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


template<typename T> 
map<T, Int> factorize(T x){
  map<T, Int> res;
  for(Int i=2;i*i<=x;i++){
    while(x%i==0){
      x/=i;
      res[i]++;
    }
  }
  if(x!=1) res[x]++;
  return res;
}

//INSERT ABOVE HERE
signed main(){
  Int n,p;
  cin>>n>>p;

  auto m=factorize(p);
  Int ans=1;
  for(auto x:m){
    Int k=x.second/n;
    for(Int i=0;i<k;i++) ans*=x.first;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,n) for (int i = a; i < n; i++)
#define per(i,n,a) for (int i = n - 1; i >= a; i--)
using namespace std;

int N, C, s, t, c, a[33][100009], x[100009];
int main() {
    cin >> N >> C;
    for (int i = 0; i < N; i++) {
        cin >> s >> t >> c;
        c--;
        for (int j = s; j < t; j++) a[c][j] = 1;
    }
    for (int i = 0; i < C; i++) {
        for (int j = 0; j <= 100000; j++) {
            if (a[i][j + 1]) a[i][j] = 1;
            x[j] += a[i][j];
        }
    }
    cout << *max_element(x, x + 100001) << endl;
    return 0;
}

Measured memory_bytes: 12544
#include <bits/stdc++.h>
#ifdef LOCAL_DEBUG
#define DEBUG 1
#define CERR if(DEBUG) cerr
#define MACRO(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,NAME,...) NAME
#define pr(...) CERR<<MACRO(__VA_ARGS__,pr10,pr9,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__)<<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define pr9(a,b,c,d,e,f,g,h,i) pr1(a)<<pr8(b,c,d,e,f,g,h,i)
#define pr10(a,b,c,d,e,f,g,h,i,j) pr1(a)<<pr9(b,c,d,e,f,g,h,i,j)
#define prArr(a){CERR<<(#a)<<"={";int i=0;for(auto t:(a))CERR<<(i++?", ":"")<<t;CERR<<"}"<<endl;}
#else
#define DEBUG 0
#define pr(...)
#define prArr(a)
#endif
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
//INSERT ABOVE HERE


signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  Int N;
  cin>>N;
  for(Int i=0;i<=1000000;i++){
    if((Int)(i * 1.08) == N){
      cout<<i<<endl;
      exit(0);
    }
  }

  cout<<":("<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

signed main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int x[5];
  REP(i, 5) cin >> x[i];
  REP(i, 5) if(x[i] != i + 1) cout << i + 1 << endl;
}

Measured memory_bytes: 3528
#include <stdio.h>
#include <algorithm>
#include <map>
using namespace std;

int N; long long S[200200];
map<long long, int> cnt;

int main()
{
	scanf("%d", &N);
	cnt[0]++;
	long long ans = 0;
	for (int i = 1; i <= N; i++) {
		int x; scanf("%d", &x);
		S[i] = S[i - 1] + x;
		ans += cnt[S[i]]++;
	}
	printf("%lld\n", ans);

	return 0;
}

Measured memory_bytes: 14336
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <numeric>
#define rep(i, m, n) for(int i = m;i < n;i++)
#define repr(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define INF 999999999
using namespace std;

int main(){
    double a, b; cin >> a >> b;
    double ave = (a + b) / 2 + 0.5;
    int ans = ave;

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


Measured memory_bytes: 256
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i=(n); i>=0; --i)
#define FOR(i, n, m) for(int i=(m), i##_len=(n); i<i##_len; ++i)
#define EACH(i, v) for(const auto& i : v)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
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; }
template<class Value>using vec = vector< Value >;
using ll = long long;
using P = pair< long long, long long >;
#define fi first
#define se second
#define el endl
#pragma endregion

void Main();

int main(){
    std::cin.tie(nullptr);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}

void Main(){
    string A, B;
    cin >> A >> B;
    if(A.length()==B.length()){
        REP(i, A.length()){
            if(A[i]>B[i]){
                cout << "GREATER\n";return;
            }else if(B[i]>A[i]){
                cout << "LESS\n";return;
            }
        }
        cout << "EQUAL\n";
    }else if(A.length()>B.length()){
        cout << "GREATER\n";return;
    }else{
        cout << "LESS\n";return;
    }
}



Measured memory_bytes: 256
#include <iostream>
#include <set>

using namespace std;

#define MAX_N 200005
int A[MAX_N];
multiset<int> inverted;

int invert(int x) {
    int inv{1};
    while (inv <= x) inv <<= 1;
    return inv - x;
}

int main() {
    int N; scanf("%d", &N);
    for (int i{}; i < N; ++i) scanf("%d", &A[i]);
    sort(A, A + N);

    int count{};
    for (int i{N-1}; i >= 0; --i) {
        const auto& found = inverted.find(A[i]);
        if (found != inverted.end()) {
            inverted.erase(found);
            ++count;
        } else {
            inverted.insert(invert(A[i]));
        }
    }

    printf("%d\n", count);
    return 0;
}


Measured memory_bytes: 10368
function Main(input) {
    input = input.trim().split("\n").map(function(x) { return x.split(" ")});
    let N = parseInt(input[0][0], 10);
    let arr_abc = [];
    for (let i = 0; i < N; i++){
        arr_abc.push(input[i + 1].map(e => parseInt(e, 10)));
    }

    let DP = [arr_abc[0]];

    for (let i = 1; i < N; i++){
        DP.push([]);
        DP[i][0] = Math.max(DP[i - 1][1], DP[i - 1][2]) + arr_abc[i][0];
        DP[i][1] = Math.max(DP[i - 1][0], DP[i - 1][2]) + arr_abc[i][1];
        DP[i][2] = Math.max(DP[i - 1][0], DP[i - 1][1]) + arr_abc[i][2];
    }

    console.log(Math.max(DP[N - 1][0], DP[N - 1][1], DP[N - 1][2]));

}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

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

	if (s == "Sunny") {
		cout << "Cloudy" << endl;
	}

	else if (s == "Cloudy") {
		cout << "Rainy" << endl;
	}

	else if (s == "Rainy") {
		cout << "Sunny" << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>

bool appeared[26];
int main() {
  char ch;
  while (std::cin >> ch) {
    appeared[ch - 'a'] = true;
  }
  for (int i = 0; i < 26; i++) {
    if (appeared[i] == false) {
      std::cout << static_cast<char>(i + 'a') << std::endl;
      return 0;
    }
  }
  std::cout << "None" << std::endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int INF=1000010000;
typedef long long ll;
const int mod=1000000007;
ll dp[110][100100];
int main() {
  int n,W;cin >> n >> W;
  vector<ll> w(n),v(n);
  for(int i=0; i<n; i++) cin >> w[i] >> v[i];
  for(int i=0; i<110; i++){
    for(int j=0; j<100100; j++){
      dp[i][j]=INF;
    }
  }
  dp[0][0]=0;
  for(int i=0; i<n; i++){
    for(int j=0; j<100100; j++){
      if(j-v[i]>=0) dp[i+1][j]=min(dp[i][j],dp[i][j-v[i]]+w[i]);
      else dp[i+1][j]=dp[i][j];
    }
  }
  ll ans=0;
  for(int i=0; i<=n*1000; i++){
    if(dp[n][i]<=W) ans=i;
  }
  cout << ans << endl;
}

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

using namespace std;

typedef long long int Int;

Int func(Int n,Int x)
{
    if(n == -1)
	return 0;

    return n/x+1;
}

int main(void)
{
    Int a,b,x;

    cin>>a>>b>>x;

    cout<<func(b,x)-func(a-1,x)<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define pb push_back
#define MAX 1000000007
using namespace std;
int main()
{
 	speed_up
    ll a;cin>>a;
    string s;cin>>s;
    if(a>=3200) cout<<s;
    else cout<<"red";
	
    
	
	
	
 return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define N 100005
ll inf = 1e14;
int mod = 998244353;
char en = '\n';

ll abs1(ll x) {
  if (x < 0)
    return -x;
  return x;
}
ll power(ll x, ll n, ll mod) {
  ll res = 1;
  while (n) {
    if (n & 1)
      res = (res * x) % mod;
    x = (x * x) % mod;
    n >>= 1;
  }
  return res;
}

ll dp[N][3];
ll arr[N][3];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  memset(dp, 0, sizeof(dp));

  ll n;
  cin >> n;
  for (ll i = 1; i <= n; i++)
    cin >> arr[i][0] >> arr[i][1] >> arr[i][2];

  for (ll i = 1; i <= n; i++) {
    for (ll j = 0; j < 3; j++) {
      for (ll k = 0; k < 3; k++) {
        if (k == j)
          continue;

        dp[i][j] = max(dp[i][j], dp[i - 1][k] + arr[i][j]);
      }
    }
  }

  cout << (*max_element(dp[n], dp[n] + 3)) << en;

  return 0;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007
ll a[200010];
int main() {
	ll n,m;
	cin>>n>>m;
	ll ch1=-1,ch2=INF;
	for(int i=0;i<m;i++){
		ll x,y;
		cin>>x>>y;
		if(x==1){
			a[y]++;
		}
		if(y==n){
			a[x]++;
		}
	}
	for(int i=0;i<n;i++){
		if(a[i]==2){
			cout << "POSSIBLE";
			return 0;
		}
	}
	cout << "IMPOSSIBLE";
	// your code goes here
	return 0;
}

Measured memory_bytes: 1792
# import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product

def resolve():
    A=sorted(list(map(int,input().split())), reverse=True)
    k=int(input())

    for i in range(1,k+1):
        A[0]*=2



    print(sum(A))




resolve()

Measured memory_bytes: 2940
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <tuple>

#define rep(i,n) for(ll i=0;i<n;i++)
#define dup(x,y) (((x)+(y)-1)/(y)) // dup * y >= x なる最小のdup.
using namespace std;
typedef long long ll;
using Graph = vector<vector<ll>>;
//	std::cout<<std::fixed<<std::setprecision(10);

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

	rep(i, N) {
		cout << S[i] << T[i];
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner s = new Scanner(System.in);
		String str=s.next();
		s.close();
		String[] ss=str.split("/");
		int year=Integer.parseInt(ss[0]);
		if(ss[1].startsWith("0"))ss[1]=ss[1].substring(1, 2);
		int month=Integer.parseInt(ss[1]);
		if(ss[2].startsWith("0"))ss[1]=ss[2].substring(1, 2);
		int date=Integer.parseInt(ss[2]);
		if(year<=2019&&month<=4&&date<=30){
			System.out.println("Heisei");
		}else{
			System.out.println("TBD");
		}
	}
}

Measured memory_bytes: 23252
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
typedef vector<vb> vvb;
typedef vector<vpii> vvpii;
const int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
const int MOD = 1000000007;
const double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
bool odd(const int &n) { return n & 1; }
bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

typedef tuple<int, int, string> era;

void solve() {
  int n, q;
  while (cin >> n >> q, n) {
    vector<era> v;
    while (n--) {
      string name;
      int baseY, westY;
      cin >> name >> baseY >> westY;
      v.emplace_back(westY - baseY + 1, westY, name);
    }
    while (q--) {
      int y;
      cin >> y;
      rep(i, v.size()) {
        string name;
        int s, e;
        tie(s, e, name) = v[i];
        if (s <= y && y <= e) {
          cout << name << ' ' << y - s + 1 << endl;
          goto next;
        }
      }
      cout << "Unknown" << endl;
    next:;
    }
  }
}

Measured memory_bytes: 3136
import java.util.Scanner;

public class Main {
	public static void main(String ar[])
	{
		Scanner sc = new Scanner(System.in);

		long s = sc.nextLong();

		long i = s / 11 * 2;
		s %= 11;

		if (s == 0) { System.out.println(i); return; }
		if ( s <= 6) { System.out.println(i + 1); }
		else { System.out.println(i + 2); }
	}
}


Measured memory_bytes: 23892
#include <iostream>
#include <stdexcept>
#include <cassert>
#include <vector>
using namespace std;


const int N = 26;


int decide(int d, int D, vector<vector<int>>& s, vector<int>& c, vector<int>& last) {
  int ans = 0;
  int tmpV, maxV = -10000000;
  for (int t = 0; t < N; t++) {
    tmpV = s[d][t];
    for (int i = 0; i < N; i++) {
      if (i == t) {
        tmpV -= c[i] * N * (N-1) / 2;
      } else {
        tmpV -= c[i] * N * (d + N/2 - last[i]);
      }
    }
    if (tmpV > maxV) {
      maxV = tmpV;
      ans = t;
    }
  }
  return ans;
}


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

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

  vector<vector<int>> s(D, vector<int> (N, 0));
  for (int d = 0; d < D; d++) {
    for (int i = 0; i < N; i++) {
      cin >> s[d][i];
    }
  }

  vector<int> t(D, 0);
  // Choose t[] greedily ans calc score
  vector<int> last(N, -1);
  vector<int> v(D, 0);
  for (int d = 0; d < D; d++) {
    t[d] = decide(d, D, s, c, last);
    last[t[d]] = d;
  }

  for (int x : t) cout << x + 1 << endl;

  return 0;
}

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

int main()
{
    string S;
    cin >> S;
    int ct_letter[26] = {0};
    REP(i, S.size()) ct_letter[S[i] - 'a']++;
    int ct_good_letters = count_if(&ct_letter[0], &ct_letter[26], [](int i) { return i < 2; });
    ct_good_letters == 26 ? cout << "yes" : cout << "no";

    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
 
   int N = sc.nextInt();
   int K = sc.nextInt();
   int S = sc.nextInt();
   
   for(int i=0;i<K;i++)
   {
     System.out.print(S+ " ");
   }
   int pr = S-1;
   if(S==1) pr =2; 
   for(int i=K;i<N-1;i++)
   {
     System.out.print(pr + " ");
   }
   if(N!=K) System.out.println(pr);
   else System.out.println();
 }
}

Measured memory_bytes: 41448
N = int(input())

res = []
for i in range(N+1):
    tmp = 0
    if i == 0:
        res.append(2)
    elif i == 1:
        res.append(1)
    else:
        tmp = res[i-1] + res[i-2]
        res.append(tmp)
print(res[-1])

Measured memory_bytes: 3060
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
    sc.Split(bufio.ScanWords)
    N := nextInt()
    Q := nextInt()

    trees := make([][]int, N)
    for i := 0; i < N-1; i++ {
        a := nextInt()
        b := nextInt()
        trees[a-1] = append(trees[a-1], b-1)
        trees[b-1] = append(trees[b-1], a-1)
    }

    ans := make([]int, N)
    for i := 0; i < Q; i++ {
        p := nextInt()
        x := nextInt()
        ans[p-1] += x
    }

    ans = updateAns(trees, -1, 0, ans)

    for i := 0; i < N-1; i++ {
        fmt.Printf("%d ", ans[i])
    }
    fmt.Println(ans[N-1])
}

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

func nextInt() int{
    a, _ := strconv.Atoi(next())
    return a
}

func updateAns(trees [][]int, org int, parent int, ans[]int) []int {
    var child int
    for i := 0; i < len(trees[parent]); i++ {
        child = trees[parent][i]
        if child == org {
            continue
        }
        ans[child] += ans[parent]
        updateAns(trees, parent, child, ans)
    }
    return ans
}

Measured memory_bytes: 73856
n = int(input())
l = list(map(int, input().split()))
ans = 0

for i in range(n-2):
  for j in range(i+1, n-1):
    for k in range(j+1, n):
      if l[i] == l[j] or l[j] == l[k] or l[k] == l[i]:
        continue
      if l[i]+l[j]>l[k] and l[j]+l[k]>l[i] and l[k]+l[i]>l[j]:
        ans = ans + 1
print(ans)

Measured memory_bytes: 9204
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int w = sc.nextInt();
        int h = sc.nextInt();
        int n = sc.nextInt();
        sc.nextLine();
        int[] xx = new int[w];
        int[] yy = new int[h];
        Arrays.fill(xx, 1);
        Arrays.fill(yy, 1);

        int x = 0;
        int y = 0;
        for(int i = 0;i<n;i++){
            x = sc.nextInt();
            y = sc.nextInt();
            int a = sc.nextInt();
            sc.nextLine();
            if(a == 1){
                for(int j = x-1;j>=0;j--){
                    xx[j] = 0;
                }
            }else if(a == 2){
                for(int j = x;j<w;j++){
                    xx[j] = 0;
                }
            }else if(a == 3){
                for(int j = y-1;j>=0;j--){
                    yy[j] = 0;
                }
            }else if(a == 4){
                for(int j = y;j<h;j++){
                    yy[j] = 0;
                }
            }
        }
        x = 0;
        y = 0;

        for(int i = 0;i<w;i++){
            x += xx[i];
        }
        for(int i = 0;i<h;i++){
            y += yy[i];
        }
        System.out.println(x*y);
    }
}

Measured memory_bytes: 23764
#include <stdio.h>
#include <math.h>
#define PI 3.14159265359

int main(){
   int  a,b,h,m;
   double ra,rb;

   scanf("%d %d %d %d",&a,&b,&h,&m);
   ra=(h*60.0+m)/2;
   rb=m*6;
   if (ra>rb) ra-=rb;
   else       ra=rb-ra;
   if (ra>180) ra=360-ra;
   if (ra>90)
      printf("%.9Lf\n",sqrtl(1.0*a*a+1.0*b*b+2.0*a*b*cosl((180-ra)*PI/180)));
   else
      printf("%.9Lf\n",sqrtl(1.0*a*a+1.0*b*b-2.0*a*b*cosl(ra*PI/180)));
   return 0;
}


Measured memory_bytes: 2580
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) (a).begin(),(a).end()
#define print(A,x,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i]x;}cout<<endl;
#define pprint(A,y,m,n) rep(j,0,m){print(A[j],y,n);}
const long mod=1e9+7;
const int siz=2e5+1;
const long inf=1e9;
int main(){
	int N; cin>>N;
	pair<int,int> v[N];
	int dir[N];
	map<int,set<pair<int,int>>> sp1[4],sp2[4];
	set<pair<int,int>> X[2][siz],Y[2][siz];
	rep(i,0,N){
		int x,y; char u;
		cin>>x>>y>>u;
		int d;
		if(u == 'U'){
			d = 0;
			X[0][x].insert({x, y});
		}else if(u == 'R'){
			d = 1;
			Y[0][y].insert({x, y});
		}else if(u == 'D'){
			d = 2;
			X[1][x].insert({x, y});
		}else{
			d = 3;
			Y[1][y].insert({x, y});
		}
		v[i] = {x, y};
		dir[i] = d;
		sp1[d][x + y].insert({x, y});
		sp2[d][x - y].insert({x, y});
	}
	int ans = inf;
	rep(i,0,N){
		int x = v[i].first;
		int y = v[i].second;
		int a,b;
		if(dir[i] == 0){
			a = 1; b = 3;
			auto it = X[1][x].upper_bound({x, y});
			if(it != X[1][x].end()) ans = min(ans, 5 * (it->second - y));
		}else if(dir[i] == 1){
			a = 0; b = 2;
			auto it = Y[1][y].upper_bound({x, y});
			if(it != Y[1][y].end()) ans = min(ans, 5 * (it->first - x));
		}else if(dir[i] == 2){
			a = 3; b = 1;
			auto it = X[0][x].upper_bound({x, y});
			if(it != X[0][x].begin()){
				it--;
				ans = min(ans, 5 * (y - it->second));
			}
		}else{
			a = 2; b = 0;
			auto it = Y[0][y].upper_bound({x, y});
			if(it != Y[0][y].begin()){
				it--;
				ans = min(ans, 5 * (x - it->first));
			}
		}
        bool flag1 = true, flag2 = true;
		auto it1 = sp1[a][x+y].upper_bound({x, y});
		auto it2 = sp2[b][x-y].upper_bound({x, y});
        if(dir[i] == 0 || dir[i] == 3){
            if(it1 == sp1[a][x+y].begin()) flag1 = false;
            else it1--;
        }if(dir[i] == 2 || dir[i] == 3){
            if(it2 == sp2[b][x-y].begin()) flag2 = false;
            else it2--;
        }
		if(flag1 && it1 != sp1[a][x+y].end()) ans = min(ans, 10 * abs(it1->first - x));
        if(flag2 && it2 != sp2[b][x-y].end()) ans = min(ans, 10 * abs(it2->first - x));
	}
	if(ans == inf) cout<<"SAFE"<<endl;
	else cout<<ans<<endl;
}

Measured memory_bytes: 145384
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cctype>
#define len length()
#define sz size()
#define rng(i, a, b) for(int i = a; i < b; i++)
#define rep(i, n) rng(i, 0, n)
#define srt(v) sort(v.begin(), v.end())
#define rev(s) reverse(s.begin(), s.end())
#define vi(a, n) vector<int> a(n)
#define vs(a, n) vector<string> a(n)
#define vc(a, n) vector<char> a(n)
#define psb(a) push_back(a)
#define ppb pop_back()
#define erc(S, i) S.erase(S.begin() + i)
#define ers(S, i, j) S.erase(S.begin() + i, S.begin() + j)
#define sp(n) cout << setprecision(n) << fixed
#define fst(s) s.at(0)
#define lst(s) s.at(s.len - 1)
typedef long long ll;
using namespace std;
int mod = 1000000007;

int main(){
    int n, r;
    cin >> n >> r;
    if(n>9) cout << r << endl;
    else{
        cout << r + (100*(10-n)) << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >>s;
  bool ok=false;
  for(int i=1;i<s.size();i++){
    if(s[i-1]=='A' && s[i]=='C')ok=true;
  }
  if(ok)cout<<"Yes"<<endl;
  else cout <<"No"<<endl;
}

Measured memory_bytes: 256
N,K,S = map(int,input().split())

ans = [0]*N

if S == 1e9:
    for i in range(K):
        ans[i] = S
    for i in range(K,N):
        ans[i] = 1 
else:
    for i in range(K):
        ans[i] = S
    for i in range(K,N):
        ans[i] = S+1
    

print(*ans)


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

int main() {
  int a[3], five = 0, seven = 0;

  cin >> a[0] >> a[1] >> a[2];

  for (int i = 0; i < 3; i++) {
    if (a[i] == 5) five++;
    if (a[i] == 7) seven++;
  }

  if (five == 2 && seven == 1) {
    cout << "YES";
  } else {
    cout << "NO";
  }

  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int a, b;
    int k;
    
    cin >> k;
    cin >> a >> b;
    
    bool res = false;
    
    for(int i = a; i <= b; i++) {
        res |= i % k == 0;
    }
    
    if(res)
        cout << "OK" << endl;
    else
        cout << "NG" << endl;

    return 0;
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
#include<boost/variant.hpp>
using namespace std;
typedef long long ll;
typedef vector<boost::variant<bool, ll, int, string, double, char*, const char*>> anys;
template<typename T> inline void pr(const vector<T> &xs){
	for(int i=0; i<xs.size()-1; i++) cout<<xs[i]<<" ";
	(xs.empty()?cout:(cout<<xs[xs.size()-1]))<<endl;
}
#ifdef DEBUG
#define debug(...) pr(anys{__VA_ARGS__})
#define debugv(x) pr((x))
#else
#define debug(...)
#define debugv(x)
#endif

ll gcd(ll x, ll y){
	if(y==0) return x;
	return gcd(y, x%y);
}

int main(){
	int N;
	ll X, D;
	cin >> N >> X >> D;

	if(D==0){
		if(X==0){
			cout << 1 << endl;
		} else {
			cout << N+1 << endl;
		}
		return 0;
	}

	ll g = gcd(abs(X), abs(D));
	X /= D / abs(D) * g;
	D /= D / abs(D) * g;

	debug(X, D);
	vector<ll> L(N+1), R(N+1);
	for(ll m=0; m<=N; m++){
		ll k = (m - m%D)/D;
		L[m] = m*(m-1)/2 + k*X;
		R[m] = m*(2*N-m-1)/2 + k*X+1;
		debug(m, L[m], R[m]);
	}

	ll ans = 0;
	for(int k=0; k<=min((ll)N, D-1); k++){
		vector<pair<ll, int>> vs;
		for(int i=k; i<=N; i+=D) {
			vs.push_back({L[i], i});
			vs.push_back({R[i], i+N+1});
		}
		sort(vs.begin(), vs.end());
		ll start = 1e18;
		int l = 0;
		for(auto p: vs){
			if(p.second<N+1){
				start = min(start, p.first);
				l++;
			} else {
				l--;
				if(l==0) {
					ans += p.first-start;
					start = 1e18;
				}
			}
			debug(p.first, p.second, l, start);
		}
	}

	cout << ans << endl;

	return 0;
}


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

#include <atcoder/all>

#ifdef LOCAL
#include <debug.hpp>
#else
#define debug(...) void()
#endif

using namespace std;
using namespace atcoder;

const int cm = 1 << 17;
char cn[cm], *ci = cn + cm, ct;

inline char getcha() {
  if (ci - cn == cm) {
    fread(cn, 1, cm, stdin);
    ci = cn;
  }
  return *ci++;
}

inline int getint() {
  int A = 0;
  if (ci - cn + 16 > cm) {
    while ((ct = getcha()) >= '0') {
      A = A * 10 + ct - '0';
    }
  } else {
    while ((ct = *ci++) >= '0') {
      A = A * 10 + ct - '0';
    }
  }
  return A;
}

int main() {
  // ios::sync_with_stdio(false);
  // cin.tie(0);
  int tt = getint();
  while (tt--) {
    int n = getint(), m = getint(), a = getint(), b = getint();
    cout << floor_sum(n, m, a, b) << '\n';
  }
  return 0;
}

Measured memory_bytes: 3772
#include <stdio.h>

int main(void) {
	long n;
	long a;//blue
	long b;//red
	long sum;
	long shou = 0;
	long amari = 0;
	//printf("n:");
	scanf("%ld", &n);
	//printf("a:");
	scanf("%ld", &a);
	//printf("b:");
	scanf("%ld", &b);
	sum = a + b;
	
	if(n >= sum) {
		shou = n / sum;
		amari = n - shou*sum;
	}
	else {
	if(n < a)
		amari = n;
	else
		amari = a;
	}
	if(amari >= a) {
		printf("%ld\n", shou * a + a);
		return 0;
	}
	else {
		printf("%ld\n", shou * a + amari);
		return 0;
	}
	return 0;
}

Measured memory_bytes: 128
S=list(input())

for i,j in enumerate(S):
    if i%2==0:
        
        if j=="R"or j=="U"or j=="D":
            
            continue
        else:
            print("No")
            break
    else:
        if j=="L"or j=="U"or j=="D":
            continue
        else:
            print("No")
            break
else:
    print("Yes")
        

Measured memory_bytes: 2940
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

using i64 = int64_t;

const int MOD = 1000000007;

int N;
string s[2];

int main() {
    cin >> N;
    for (int j = 0; j < 2; ++j) {
        cin >> s[j];
    }

    int prev_type = -1;

    i64 ans = 1;
    for (int j = 0; j < N; ++j) {
        if (s[0][j] == s[1][j]) {
            if (prev_type == -1) { ans *= 3; }
            if (prev_type == 0) { ans *= 2; }
            if (prev_type == 1) { ans *= 1; }
            prev_type = 0;
        } else {
            if (prev_type == -1) { ans *= 6; }
            if (prev_type == 0) { ans *= 2; }
            if (prev_type == 1) { ans *= 3; }
            ++j;
            prev_type = 1;
        }
        ans %= MOD;
    }

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


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

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

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF INT_MAX/3

ll n,k;
ll a[201010];
map<ll,ll> cnt;

int main(){
	cin>>n>>k;
  rep(i,n)cin>>a[i];
  rep(i,n)cnt[a[i]]++;
  vector<ll> t;
  for(auto p : cnt){
    t.push_back(p.se);
  }
  sort(all(t));
  ll res=0;
  rep(i,t.size()-k)res+=t[i];
  cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 16500
#include <algorithm>
#include <array>
#include <vector>
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <functional>
#include <queue>

//AtCoderC++.cpp

using namespace std;

void Show(vector<vector<int>> Ns) {
	for (int i = 0; i < Ns.size(); i++) {
		for (int j = 0; j < Ns[i].size(); j++) {
			if (j == Ns[i].size() - 1) {
				cout << Ns[i][j] << endl;
			} else {
				cout << Ns[i][j] << ",";
			}
		}
	}
}

void Show(vector<int> N) {
	for (int i = 0; i < N.size(); i++) {
		cout << N[i];
		if (i != N.size() - 1) {
			cout << " ";
		} else {
			cout << endl;
		}
	}
}


int main() {
	int x, y;
	cin >> x >> y;
	cout << x + y / 2 << endl;
}


Measured memory_bytes: 256