akhauriyash/Code-Regression huggingface dataset:
//CODEFORCES:-
//coded by AMAN BHARTI NIT PATNA
//ALL RIGHTS RESERVED
//ECE 2K18

#include<bits/stdc++.h>
using namespace std;

//#define home
#define TASK "soln"
#define eprintf(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
#define pb push_back
#define ll long long int
#define br cout<<endl;
#define fo for(int i=0;i<n;i++)
#define foo for(int i=1;i<=n;i++)
#define mod 1000000007


void solve(){
    int n;
    cin>>n;
    int a[n];
    fo{cin>>a[i];}
    sort(a,a+n);

    int cnt=0;

    map<int,int> m;

    for(int i=0;i<n;i++){
        if(m.count(a[i])){m[a[i]]++;}
        else m[a[i]]=1;
    }

    //for(auto p1=m.begin();p1!=m.end();p1++){cout<<(p1->second)<<" ";}


    for(auto p1=m.begin();p1!=m.end();p1++){
        for(auto p2= next(p1,1);p2!=m.end();p2++){
            for(auto p3 = next(p2,1);p3!=m.end();p3++){
                if(p3->first<p1->first+p2->first)cnt+=p1->second*p2->second*p3->second;
            }
        }
    }

    cout<<cnt<<endl;

}

int main(){
	#ifdef home
        assert(freopen(TASK".in","r",stdin));
        assert(freopen(TASK".out","w",stdout));
    #endif

    ios::sync_with_stdio(false);
    cin.tie(NULL);

    // int t;
    // cin>>t;
    // while(t-->0)
    solve();

    #ifdef home
        eprintf("Time: %d ms\n", (int)(clock() * 1000. / CLOCKS_PER_SEC));
    #endif

    return 0;
}

Measured memory_bytes: 3656
//AUTHOR: RAVAN_2070
//PUNE INSTITUTE OF COMPUTER TECHNOLOGY
/*
        PEOPLE'S LIVES DON'T END WHEN THEY DIE.
        IT ENDS WHEN THEY LOSE FAITH
                                     -ITACHI UCHIHA
        EXPLAINATION BELOW->
*/
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<pair<ll,ll>> vii;
typedef pair<ll,ll> pii;
typedef map<ll,ll> mii;
#define MOD7 1000000007
#define MOD9 1000000009
#define pi 3.1415926535
#define Test_cases ll TC;cin>>TC;while(TC--)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(), x.rend()
#define sp(x) fixed<<setprecision(x)
#define sz(x) (ll)(x.size())
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
ll gcd(ll a,ll b);
ll lcm(ll a,ll b);
ll modularExponentiation(ll x,ll n,ll M);
ll binpow(ll x,ll n);
void dsp(vector<ll> &V);
void dsp2(vector<pair<ll,ll>>&V);
void dsp3(map<ll,ll>&M);
double fact(double n);
ll nPr(ll n,ll r);
ll nCr(ll n,ll r);
void solve()
{
    ll n,k;cin>>n>>k;
    cout<<min(n%k,abs(k-n%k))<<"\n";
}
int main()
{

   fastio
   //Test_cases
   solve();
  return 0;
}
ll gcd(ll a,ll b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);  
          
} 
ll lcm(ll a,ll b)  
{  
    return (a*b)/gcd(a, b);  
}  
ll modularExponentiation(ll x,ll n,ll M)
{   
    ll result=1;
    while(n>0)
    {
        if(n % 2 ==1)
        result=(result * x)%M;
        x=(x*x)%M;
        n=n/2;
    }
        return result;
}
ll binpow(ll x,ll n)
{
    ll res=1;
    while(n>0)
    {
        if(n&1)res=res*x;
         x=x*x;
         n>>=1;
    }
    return res;
}
void dsp(vector<ll> &V)
{
    ull j;
    for(j=0;j<V.size();j++)
    {
        cout<<V[j]<<" ";
    }
    cout<<endl;
}
void dsp2(vector<pair<ll,ll>>&V)
{
    ull j;
    for(j=0;j<V.size();j++)
    {
        cout<<V[j].first<<" "<<V[j].second<<" ";
    }
    cout<<endl;
}
void dsp3(map<ll,ll>&M)
{
      map<ll,ll>::iterator it=M.begin();
      while(it!=M.end())
      {
        cout<<it->first<<" "<<it->second<<endl;
        it++;
      }
}
double fact(double n)
{
    double i=1;
    double res=1;
    
    if(n==0)
        return 1.00;
    
    while(i<=n)
    {
        res*=i;
        i++;
    }
    
    return res;
}
ll nPr(ll n,ll r)
{
    return (fact(n)/fact(n-r));
}
ll nCr(ll n,ll r)
{
    return (fact(n)/(fact(r)*fact(n-r)));
}
//map<ll,ll,greater<int>> to sort in descending order ,in iterator declaration no greater<int>

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
  
int main() {
  int H,W;
  cin >> H >> W;
  v(string) G(H);
  rep(i,H) {
    cin >> G[i];
  }
  vv(bool) ok(H,v(bool)(W,true));
  rep(i,H) {
    bool a = true;
    rep(j,W) {
      if(G[i][j] == '#') a = false;
    }
    if(a) {
      rep(j,W) {
        ok[i][j] = false;
      }
    }
  }
  rep(j,W) {
    bool a = true;
    rep(i,H) {
      if(G[i][j] == '#') a = false;
    }
    if(a) {
      rep(i,H) {
        ok[i][j] = false;
      }
    }
  }
  rep(i,H) {
    bool h = false;
    rep(j,W) {
      if(ok[i][j]) {
        h = true;
        cout << G[i][j];
      }
    }
    if(h) cout << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<math.h>
using namespace std;
int main()
{
    int a,b,c,d;
    scanf("%d %d %d %d",&a,&b,&c,&d);
    int mint,minb,all;
    if(a>=b)
    {
        mint=b;
    }
    else
        mint=a;
    if(c>=d)
        minb=d;
    else
        minb=c;
    all=mint+minb;
    printf("%d\n",all);
    return 0;
}

Measured memory_bytes: 256
//
//AtCoder Beginner Contest 122
//C
//https://atcoder.jp/contests/abc122/tasks/abc122_c
//

#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <functional>
#include <cassert>
#include <bitset>
#include <numeric>

using namespace std;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define SIZE(x) (int)(x).size()
#define SIZEL(x) (ll)(x).size()
#define MSG(a) cout << #a << " " << a << endl;

using ll = long long;
using ld = long double;
using Graph = vector<vector<int>>;

const double PI = 3.14159265358979323846;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }            //最小公倍数

int main()
{
    int n, q;
    cin >> n >> q;

    string s;
    cin >> s;

    vector<pair<int,int>> lr(n);
    REP(i, q) {
        cin >> lr[i].first >> lr[i].second;
        lr[i].first--;
        lr[i].second--;
    }
    vector<int> sAC(n+1, 0);
    int acCnt=0;
    REP(i,n){
        if ((s[i]=='A') && (s[i+1]=='C')) acCnt++;
        sAC[i+1]=acCnt;
    }
    REP(i,q){
        int ans = sAC[lr[i].second] - sAC[lr[i].first];
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 4584
#include <bits/stdc++.h>
using ll = long long;
using itn = int;
using namespace std;
int GCD(int a, int b){
    return b ? GCD(b, a%b) : a;
}
int main(){
    ll n,a,b,c,d;
    string s;
    cin >> n >> a >> b >> c >> d >> s;
    for(int i=a-1; i<d; i++){
        if(s[i]=='#' && s[i+1]=='#'){
            puts("No");
            return 0;
        }
    }
    bool change=false;
    if(c<d){
        puts("Yes");
    }else{
        if(s[d-2]=='.' && s[d]=='.') puts("Yes");
        else{
            for(ll i=b-2; i<d-2; i++){
                if(s[i]=='.' && s[i+1]=='.' && s[i+2]=='.'){
                    change=true;
                }
            }
            if(change) puts("Yes");
            else puts("No");
        }
    }
    return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<cmath>

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

using namespace std;

int main()
{
	int n,p;
	while(cin>>n>>p && n && p)
	{
		int hand[100000]={};
		int i=0,number=0;
		int hako=p;
		
		while(1)
		{
			number=i%n;
			
			if(hand[number]==p)break;
			
			if(hako!=0)
			{
				hako--;
				hand[number]++;
			}
			else
			{
				hako=hand[number];
				hand[number]=0;
			}
			i++;
		}
		cout<<number<<endl;
	}
	return 0;
}

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


void solve(long long N, long long K, long long S){
    for(int i=1;i<=K;++i)cout<<S<<" ";
    int left;
    if(S==1000000000)
        left = 1;
    else
        left = 1000000000;
    for(int i=K+1;i<=N;++i)cout<<left<<" ";
    cout<<endl;
}
int main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    long long S;
    scanf("%lld",&S);
    solve(N, K, S);
    return 0;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

ll a[200010];

int main() {
    ios_base::sync_with_stdio(0);
    int n; cin >> n;
    for (int i=0;i<n;i++) cin >> a[i];

    ll sum = 0, ans = 0;
    for (int i=0;i<n;i++) {
        ans += sum*a[i]%1000000007;
        ans %= 1000000007;
        sum += a[i];
        sum %= 1000000007;
    }
    cout << ans << endl;
}


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

public class Main {

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

      int n = Integer.parseInt( br.readLine() );
      String[] line = br.readLine().split(" ");

      int[] a = new int[n];
      for (int i = 0; i < n; i++) {
        a[i] = Integer.parseInt(line[i]);
      }

      insertionSort(a, n);
    }
  }

  public static void insertionSort(int a[], int max) {
    for (int i=0,j=0,v=0; i < max; i++) {
      for( j = i-1, v = a[i]; j>=0 && a[j]>v; j-- ) {
        a[j+1] = a[j];
      }
      a[j+1] = v;
      dispIntArray(a);
    }
  }
  public static void dispIntArray(int a[]) {
    StringBuilder line = new StringBuilder(a.length*2);
    for (int i=0, max = a.length-1; i < max; i++) {
     line.append(a[i] + " ");
    }
    System.out.println( line.append(a[a.length-1]) );
  }
}


Measured memory_bytes: 28348
#include<bits/stdc++.h>
#define ll long long
const ll mod=998244353;
const ll N=2e5+5;
using namespace std;
ll gcd(ll a,ll b) {return b==0?a:gcd(b,a%b);}
ll lcm(ll a,ll b) { return a*b/gcd(a,b);    }
ll qp(ll a,ll b, ll p){ll ans = 1;while(b){if(b&1){ans = (ans*a)%p;--b;}a = (a*a)%p;b >>= 1;}return ans%p;}
ll Inv(ll x){ return qp(x,mod-2,mod);}
ll C(ll n,ll m){if (m>n) return 0;ll ans = 1;for (int i = 1; i <= m; ++i) ans=ans*Inv(i)%mod*(n-i+1)%mod;return ans%mod;}
char a[105];
int main()
{
    scanf("%s",a);
    int len=strlen(a);
    for(int i=0;i<len;i++) cout<<"x";
    cout<<endl;
    return 0;
}


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

mt19937 mt(time(nullptr));
// uniform_int_distribution< int > rand_int(0, 10) // rand[0, 10] inclusive

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed;
  int n;
  cin >> n;
  if (n==2) {
    int a1, a2;
    cin >> a1 >> a2;
    if (a1-a2>a2-a1) {
      cout << a1-a2 << endl;
      cout << a1 << " " << a2 << endl;
    } else {
      cout << a2-a1 << endl;
      cout << a2 << " " << a1 << endl;
    }
    return 0;
  }
  vector< int > ap, am;
  for (int i=0; i<n; ++i) {
    int ai;
    cin >> ai;
    if (ai<0) am.push_back(ai);
    else ap.push_back(ai);
  }
  sort(ap.begin(), ap.end());
  sort(am.begin(), am.end(), greater< int >());
  if (ap.size() == 0) {
    vector< int > ans_s;
    ans_s.push_back(am[0]);
    ans_s.push_back(am[n-1]);
    int ans = am[0]-am[n-1];
    for (int i=1; i<n-1; ++i) {
      ans_s.push_back(ans);
      ans_s.push_back(am[i]);
      ans = ans-am[i];
    }
    cout << ans << endl;
    for (int i=0; i<ans_s.size(); i+=2) cout << ans_s[i] << " " << ans_s[i+1] << endl;
    return 0;
  }
  if (am.size() == 0) {
    vector< int > ans_s;
    int ans = 0;
    for (int i=0; i<n-2; ++i) {
      if (i==0) {
        ans_s.push_back(ap[0]);
        ans_s.push_back(ap[n-2]);
        ans = ap[0]-ap[n-2];
      } else {
        ans_s.push_back(ans);
        ans_s.push_back(ap[i]);
        ans -= ap[i];
      }
    }
    ans_s.push_back(ap[n-1]);
    ans_s.push_back(ans);
    ans = ap[n-1]-ans;
    cout << ans << endl;
    for (int i=0; i<ans_s.size(); i+=2) cout << ans_s[i] << " " << ans_s[i+1] << endl;
    return 0;
  }
  vector< int > ans_s;
  int ans = 0;
  for (int i=0; i<ap.size()-1; ++i) {
    if (i==0) {
      ans_s.push_back(am[0]);
      ans_s.push_back(ap[0]);
      ans = am[0]-ap[0];
    } else {
      ans_s.push_back(ans);
      ans_s.push_back(ap[i]);
      ans -= ap[i];
    }
  }
  if (ap.size() == 1) {
    ans_s.push_back(ap[0]);
    ans_s.push_back(am[0]);
    ans = ap[0]-am[0];
  } else {
    ans_s.push_back(ap[ap.size()-1]);
    ans_s.push_back(ans);
    ans = ap[ap.size()-1]-ans;
  }
  for (int i=1; i<am.size(); ++i) {
    ans_s.push_back(ans);
    ans_s.push_back(am[i]);
    ans -= am[i];
  }
  cout << ans << endl;
  for (int i=0; i<ans_s.size(); i+=2) cout << ans_s[i] << " " << ans_s[i+1] << endl;
  return 0;
}


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

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int MOD2 = 1007681537;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
inline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
template<class T> inline int chkmin(T& a, const T& val) {return val < a ? a = val, 1 : 0;}
template<class T> inline int chkmax(T& a, const T& val) {return a < val ? a = val, 1 : 0;}
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}
inline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}
inline int mult(int a, int b, int p = MOD) {return (ll) a * b % p;}
inline int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}
inline int sign(ld x) {return x < -EPS ? -1 : x > +EPS;}
inline int sign(ld x, ld y) {return sign(x - y);}
#define db(x) cerr << #x << " = " << (x) << " ";
#define endln cerr << "\n";

const int maxn = 2e5 + 5;
int n;
int a[maxn];

void solve() {
    cin >> n;
    FOR(i, 0, n) cin >> a[i];
    long long suma = 0, sumb = accumulate(a, a + n, 0LL);
    long long ans = LINF;
    FOR(i, 0, n - 1) {
        suma += a[i];
        sumb -= a[i];
        chkmin(ans, abs(suma - sumb));
    }
    cout << ans << "\n";
}

int main() {
    int JUDGE_ONLINE = 1;
    if (fopen("in.txt", "r")) {
        JUDGE_ONLINE = 0;
        assert(freopen("in.txt", "r", stdin));
        //assert(freopen("out.txt", "w", stdout));
    }
    else {
        ios_base::sync_with_stdio(0), cin.tie(0);
    }
    solve();
    if (!JUDGE_ONLINE) {
        //cout << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    }
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include <bits/stdc++.h>
#include <utility>
#include <iomanip>

#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a); (b) <= i; i--)
#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = n; n <= i; i--)
#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))
#define elif else if
#define MOD 1000000007
#define INF (1<<30)

using namespace std;

#define ld long double
#define ll long long

map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  ll ans=0;
  ll x,y;
  cin >> x >> y;
  if(x>y){
    ans+=x;
    x--;
  }else{
    ans+=y;
    y--;
  }
  if(x>y){
    ans+=x;
    x--;
  }else{
    ans+=y;
    y--;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 768
#pragma GCC optimize("-Ofast","-funroll-all-loops")
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=1e5+10;
int l=1,r=1e9,n,a[N],A,B;
inline int check(int mid){
	int res=0;
	for(int i=1;i<=n;i++)	if(a[i]>mid*B){
		res+=(a[i]-mid*B+A-B-1)/(A-B);
	}
	return res<=mid;
}
signed main(){
	cin>>n>>A>>B;
	for(int i=1;i<=n;i++)	cin>>a[i];
	while(l<r){
		int mid=l+r>>1;
		if(check(mid))	r=mid;
		else l=mid+1;
	}
	cout<<l;
	return 0;
}


Measured memory_bytes: 4368
N,M=map(int,input().split())
A=[input() for i in range(N)]
B=[input() for i in range(M)]
for i in range(N-M+1):
    for j in range(N-M+1):
        t=True
        for x in range(M):
            if A[i+x][j:j+M]!=B[x]:
                t=False
                break
        if t:
            print("Yes")
            quit()
print("No")


Measured memory_bytes: 3060
"use strict";
function I(s,f){this._s=s.split("\n");this._c=0;this._l=0;this._f=f||Number}I.prototype.a=function(){var l=this._s[this._l];if(!l)return;var t=l.trim().split(" ");var a=t[this._c];this._c++;if(t.length===this._c){this._c=0;this._l++}return this._f(a)};I.prototype.l=function(){var l=this._s[this._l];if(!l)return;this._c=0;this._l++;return l.split(" ").map(this._f)};

function main(input) {
  const o = new I(input);

  var x = o.a();
  var y = o.a();
  var z = o.a();
  var k = o.a();

  var a = o.l();
  var b = o.l();
  var c = o.l();

  a.sort((a,b) => b-a);
  b.sort((a,b) => b-a);
  c.sort((a,b) => b-a);

  var results = [];
  for(var ak = 0; ak < x; ak++){
    for(var bk = 0; bk < y; bk++){
      for(var ck = 0; ck < z; ck++){
        if ( (ak + 1) * (bk + 1) * (ck + 1) <= k) {
          results.push(a[ak] + b[bk] + c[ck]);
        } else {
          break;
        }
      }
    }
  }

  results.sort((a,b)=> b - a);
  for(let i=0; i < k; i++) {
    console.log(results[i])
  }
}


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


Measured memory_bytes: 29872
#include <bits/stdc++.h>
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long ll ; 
typedef long double ld ;
typedef pair<ll , ll> pll ;

const ll N = 2e5 + 30 , Mod = 1e9 + 7 ;
const ll SQ = 330 ;

int main () {
    ios::sync_with_stdio(0), cin.tie(0) ;
    ll n;
    cin >> n;
    if (n & 1) return cout << 0, 0;
    ll k = n >> 1;
    ll ans = 0;
    ll res = 5;
    while (res <= k) {
    	ans += (k / res);
    	res *= 5;
	}
	cout << min(ans, k);
    
    return (0) ;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define Rep(i,x) for(int i=head[x];i+1;i=nxt[i])
#define rep2(i,a,b) for(int i=(a);i<(b);i++)
#define ff first
#define ss second
using namespace std;
const int N=200005;
const int inf=1e9+7;
typedef long long ll;
inline void read(int &x){x=0; char ch=getchar();while(ch<'0') ch=getchar();while(ch>='0'){x=x*10+ch-48; ch=getchar();}}
//------------------------------------------head---------------------------------------------------//
ll M=1e9+7;
int main()
{
	int n,m;scanf("%d%d",&n,&m);
	if(n>m) swap(n,m);
	if(m-n>1){puts("0");return 0;}
	ll ans=1;
	if(n==m)ans*=2;
	rep(i,1,n)ans=ans*(ll)i%M;
	rep(i,1,m)ans=ans*(ll)i%M;
	printf("%d\n",(int)ans);
	return 0;
}

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

int main(){
    string s;
    cin >> s;
    if(s=="ABC"){
        cout << "ARC";
    }else{
        cout << "ABC";
    }
    return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> lp;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int d4x[4] = {0, 1, 0, -1};
int d4y[4] = {1, 0, -1, 0};

int H, W;
char nap[410][410];
int divided[410][410];

void dfs(int i, int j){
	rep(k,4){
		int dy = i + d4y[k];
		int dx = j + d4x[k];
		if(dy < 1 || dx < 1 || dy > H || dx > W)continue;
		if(nap[dy][dx] != nap[i][j]	&& divided[dy][dx] == -1){
			divided[dy][dx] = divided[i][j];
			dfs(dy, dx);
		}
	}
}

int main(){
	cin >> H >> W;
	REP(i,H){
		REP(j,W){
			cin >> nap[i][j];
			divided[i][j] = -1;
		}
	}
	int cnt = 0;
	REP(i,H){
		REP(j,W){
			if(divided[i][j] == -1){
				divided[i][j] = cnt;
				dfs(i,j);
				++cnt;
			}
		}
	}
	vector<lp> bwcount(cnt);
	rep(i,cnt){ bwcount[i].first = 0; bwcount[i].second = 0;}
	REP(i,H){
		REP(j,W){
			if(nap[i][j] == '.'){
				++bwcount[divided[i][j]].first;
			}else{
				++bwcount[divided[i][j]].second;
			}
		}
	}
	ll ans = 0;
	rep(i,cnt){
		ans += bwcount[i].first * bwcount[i].second;
	}
	cout << ans << endl;
	return 0;
}

//struct state{
//	int y;
//	int x;
//	vector<vector<bool>> alvis;
//};
//
//int d4x[4] = {0, 1, 0, -1};
//int d4y[4] = {1, 0, -1, 0};
//
//int main(){
//	int H,W;
//	char nap[410][410];
//	cin >> H >> W;
//	REP(i,H){
//		REP(j,W){
//			cin >> nap[i][j];
//		}
//	}
//	int ans = 0;
//	queue<state> Q;
//	REP(i,H){
//		REP(j,W){
//			set<P> cnt;
//			state sp;
//			vector<vector<bool>> crt(410, vector<bool>(410,false));
//			sp.alvis = crt;
//			sp.y = i; sp.x = j;
//			sp.alvis[i][j] = true;
//			Q.push(sp);
//			while(!Q.empty()){
//				state now = Q.front();
//				Q.pop();
//				rep(k,4){
//					int dy = now.y + d4y[k];
//					int dx = now.x + d4x[k];
//					if(now.alvis[dy][dx] == true)continue;
//					if(dx < 1 || dx > W || dy < 1 || dy > H)continue;
//					if(nap[now.y][now.x] != nap[dy][dx]){
//						if(nap[i][j] != nap[dy][dx])cnt.insert(make_pair(dy,dx));
//						vector<vector<bool>> now_vis = now.alvis;
//						now_vis[dy][dx] = true;
//						state to;
//						
//						to.y = dy; to.x = dx; to.alvis = now_vis;
//						Q.push(to);
//					}
//				}
//			}
//			ans += cnt.size();
//			//cout << line << endl;
//			//for(auto x: cnt)printf("[dy,dx]->[%d,%d]\n", x.first, x.second);
//		}
//	}
//	cout << ans/2 <<endl;
//	return 0;
//}


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

using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

typedef long long ll;
typedef pair<ll, int> P;
const ll INF = 1LL<<60;

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

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

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

const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};

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

  int h, w, k;
  cin >> h >> w >> k;
  int sx, sy, gx, gy;
  cin >> sx >> sy >> gx >> gy;
  sx--;
  sy--;
  gx--;
  gy--;

  vector<string> c(h);
  rep(i, h) cin >> c[i];

  vector<ll> d(h*w*4, INF);

  auto getID = [&](int i, int j, int v){
    return 4*(w*i+j) + v;
  };

  priority_queue<P, vector<P>, greater<P>> q;

  auto push = [&](int i, int j, int v, ll x){
    int id = getID(i, j, v);
    if(d[id] <= x) return;
    d[id] = x;
    q.push(make_pair(x, getID(i, j, v)));
  };

  auto ceil_k = [&](ll x){
    return (x + k - 1)/k * k;
  };

  rep(i, 4){
    push(sx, sy, i, 0);
  }

  while(!q.empty()){

    auto p = q.top();
    q.pop();

    int ci = p.second / w / 4;
    int cj = p.second / 4 % w;
    int cv = p.second % 4;

    rep(v, 4){
      
      if(v == cv){
        int ni = ci + dx[v];
        int nj = cj + dy[v];

        if(0 <= ni && ni < h && 0 <= nj && nj < w ){
          if(c[ni][nj] == '.'){
            push(ni, nj, cv, d[getID(ci, cj, v)] + 1);
          }
        }
      }else{
        push(ci, cj, v, ceil_k(d[getID(ci, cj, cv)]));
      }
    }
  }

  ll ans = INF;
  rep(i, 4){
    chmin(ans, d[getID(gx, gy, i)]);
  }

  if(ans == INF){
    cout << -1 << endl;
  }else{
    cout << (ans + k - 1) / k  << endl;
  }

  return 0;
}


Measured memory_bytes: 44048
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>

const char *anss(bool b)
{
	return b ? "Yes" : "No";
}

const char *ansp(bool b)
{
	return b ? "APPROVED" : "DENIED";
}

bool f(const std::vector<int> &A, int N)
{
	for (int i = 0; i < N; i++)
	{
		if (A[i] % 2 == 0 && A[i] % 3 != 0 && A[i] % 5 != 0)
		{
			return false;
		}
	}
	return true;
}

int main()
{
	int N;
	std::cin >> N;
	std::vector<int> A(N);
	for (int i = 0; i < N; i++)
	{
		std::cin >> A[i];
	}

	bool ans = f(A, N);
	std::cout << ansp(ans);
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <utility>
using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll, ll> pll;

const int mx = 1e6, len = 1e6+5;
const ll inf = 1e13;
pll tree[4*len];
ll dp[len];
int arr[len];

ll fun(pll line, ll x){
    return line.fi*x+line.se;
}

void update(int p, int l, int r, pll cur){
    int mid = (l+r)/2;
    if (fun(cur, mid) < fun(tree[p], mid))
        swap(cur, tree[p]);

    if (l == r)
        return;

    if (fun(cur, l) < fun(tree[p], l))
        update(2*p, l, mid, cur);
    else
        update(2*p+1, mid+1, r, cur);
}

ll query(int p, int l, int r, int x){
    if (l == r)
        return fun(tree[p], x);

    int mid = (l+r)/2;
    if (x <= mid)
        return min(fun(tree[p], x), query(2*p, l, mid, x));
    return min(fun(tree[p], x), query(2*p+1, mid+1, r, x));
}

int main(){
    int n;
    ll c;
    scanf("%d %lld", &n, &c);
    for (int i = 1; i <= n; i++)
        scanf("%d", &arr[i]);

    for (int i = 1; i < 4*mx; i++)
        tree[i] = mp(0, inf);

    update(1, 1, mx, mp(-2*arr[n], dp[n]+arr[n]*1LL*arr[n]));
    for (int i = n-1; i >= 1; i--){
        dp[i] = query(1, 1, mx, arr[i]);
        dp[i] += arr[i]*1LL*arr[i]+c;

        update(1, 1, mx, mp(-2*arr[i], dp[i]+arr[i]*1LL*arr[i]));
    }

    printf("%lld\n", dp[1]);
    return 0;
}


Measured memory_bytes: 68992
from heapq import*
(n,m),*t=[map(int,s.split())for s in open(0)]
q=[0]*7**6
v=[[]for _ in q]
z=0
for a,b in t:v[a-1]+=[b]
for i in v[:m]:
  for j in i:heappush(q,-j)
  z-=heappop(q)
print(z)

Measured memory_bytes: 91472
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
#include <random>
#include <cassert>
using namespace std;

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<int, ll> i_ll;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
typedef vector<int> vi;
struct edge { int v; ll w; };

const int MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;
ll INF = INT_MAX;

struct binary_heap {
	int N;
	vector<int> a;
	binary_heap() : N(0), a(2000000) {}
	void push(int x) {
		a[N++] = x;
		for (int i = N - 1; i;) {
			int _i = (i - 1) / 2;
			if (a[_i] >= a[i]) break;
			swap(a[i], a[_i]);
			i = _i;
		}
	}
	int pop() {
		int x = a[0];
		swap(a[0], a[N - 1]);
		N--;
		for (int i = 0; i * 2 + 1 < N;) {
			int _i = i * 2 + 1;
			if (_i + 1 < N && a[_i] < a[_i + 1]) _i++;
			if (a[_i] <= a[i]) break;
			swap(a[i], a[_i]);
			i = _i;
		}
		return x;
	}
};

int main() {
	binary_heap pq;
	for (;;) {
		char s[10]; scanf("%s", s);
		if (s[2] == 's') {
			int x; scanf("%d", &x);
			pq.push(x);
		}
		if (s[2] == 't') {
			int x = pq.pop();
			printf("%d\n", x);
		}
		if (s[2] == 'd') break;
	}
}

Measured memory_bytes: 10552
//clear adj and visited vector declared globally after each test case
//check for long long overflow
//while adding and subs check if mod becomes -ve
//while using an integer directly in a builtin function add ll
//Mod wale question mein last mein if dalo ie. Ans<0 then ans+=mod;
//Dont keep array name as size or any other key word

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define int long long
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);cout.precision(dbl::max_digits10);
#define pb push_back
#define mod 1000000007 //998244353
#define lld long double
#define mii map<int, int>
#define mci map<char, int>
#define msi map<string, int>
#define pii pair<int, int>
#define ff first
#define ss second 
#define all(x) (x).begin(), (x).end()
#define rep(i,x,y) for(int i=x; i<y; i++)
#define fill(a,b) memset(a, b, sizeof(a))
#define vi vector<int>
#define setbits(x) __builtin_popcountll(x)
#define print2d(dp,n,m) for(int i=0;i<=n;i++){for(int j=0;j<=m;j++)cout<<dp[i][j]<<" ";cout<<"\n";}
typedef std::numeric_limits< double > dbl;
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
const long long N=500005, INF=2000000000;
lld pi=3.1415926535897932;
int lcm(int a, int b)
{
    int g=__gcd(a, b);
    return a/g*b;
}

int power(int a, int b, int p)
    {
        if(a==0)
        return 0;
        int res=1;
        a%=p;
        while(b>0)
        {
            if(b&1)
            res=(res*a)%p;
            b>>=1;
            a=(a*a)%p;
        }
        return res;
    }

int32_t main()
{
    IOS;
    int n;
    cin>>n;
    if(n%2==0||n%5==0)
    {
        cout<<-1;
        return 0;
    }
    int x=7%n;
    for(int i=0;;i++)
    {
        if(x==0)
        {
            cout<<i+1;
            return 0;
        }
        x=(x*10)%n;
        x=(x+7)%n;
    }
}

Measured memory_bytes: 3656
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    x, y = map(int, input().split())

    if y / x > 4:
        print('No')
    elif y % 2 != 0:
        print('No')
    elif y / x < 2:
        print('No')
    else:
        print('Yes')

if __name__ == '__main__':
    main()


Measured memory_bytes: 9168
from operator import itemgetter
N=int(input())
s= [[0]*3 for _ in range(N)]
for x in range(N):
    a,b=map(str,input().split())
    s[x][0]=a
    s[x][1]=100-int(b)
    s[x][2]=x+1
s.sort(key=itemgetter(0,1))
for un in range(N):
    print(s[un][2])


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stdlib.h>
#include <map>
#define MOD_P 1000000007
#define ll long long
using namespace std;



int main()
{
	int n, d;
	cin >> n >> d;
	int see = d * 2 + 1;

	if (n % see) {
		printf("%d", n / see + 1);
	} else {
		printf("%d", n / see);
	}


	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vvl = vector<vl>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using vb = vector<bool>;
using vs = vector<string>;
const ll oo = 0x3f3f3f3f3f3f3f3fLL;
const ld eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define FOR(i,a,b) for (ll i=(a); i<(b); i++)
#define FORD(i,a,b) for(ll i=ll(b)-1; i>=(a); i--)
#define TR(X) ({if(1) cerr << "TR: " << (#X) << " = " << (X) << endl;})

int main(){
	cin.sync_with_stdio(0);

	double d;
	double t;
	double s;
	cin >> d >> t >> s;
	if((d / t) <= s){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
}


Measured memory_bytes: 3732
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <cstdlib>
#include <cmath>
#include <functional>
#include <queue>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define fst first
#define snd second
const ll mod = 1000000007;
const ll INF = mod * mod;

ll modinv[1010];
ll fact[1010];

ll mpow(ll x, ll r) {
	if (r == 0)return 1LL;
	if (r == 1LL)return x;
	ll temp = mpow(x, r / 2LL);
	temp = temp * temp%mod;
	temp=temp*((r % 2LL) ? x : 1LL) % mod;
	return temp;
}
void get_modinv() {
	ll t = 1LL;
	fact[0] = 1;
	for (ll i = 1LL; i <= 1000LL; i++) {
		t = t*i%mod;
		fact[i] = t;
	}
	modinv[1000] = mpow(t, mod - 2);
	for (ll i = 1LL; i <= 1000LL; i++) {
		modinv[1000 - i] = modinv[1000 - i + 1] * (1000 - i + 1) % mod;
	}
}

int main() {
	int n, sizel, sizer, numl, numr;
	cin >> n >> sizel >> sizer >> numl >> numr;

	/* get mod inverse */
	get_modinv();

	ll dp[1010] = {};
	ll invp[1010][1010] = {};
	dp[0] = 1;
	for (ll i = sizel; i <= sizer; i++) {
		invp[i][numl] = mpow(modinv[i], numl);
		for (int r = numl + 1; r <= numr; r++) {
			invp[i][r] = invp[i][r - 1] * modinv[i] % mod;
		}
		for (ll j = n; j >= 0; j--) {
			for (ll k = numl; k <= numr; k++) {
				if (i*k > j)break;
				if (dp[j - k * i] == 0)continue;
				dp[j] += dp[j - k * i] *fact[n-j+k*i]%mod*modinv[n-j]%mod*modinv[k]%mod*invp[i][k]%mod;
				dp[j] %= mod;
			}
		}
	}
	cout << dp[n] << endl;

	return 0;
}


Measured memory_bytes: 8192
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <functional>
#include <array>
#include <queue>

using namespace std;

using P = pair<double, int>;
struct Edge {
    int to;
    double cost;
};

int V = 100;
constexpr int MAX_V = 1001000;
constexpr double INF = 1e17;
vector<Edge> G[MAX_V];
double d[MAX_V];

void dijkstra(int s){
    priority_queue<P, vector<P>, greater<P>> que;
    fill(d, d + V, INF);
    d[s] = 0;
    que.push(P(0, s));

    while(!que.empty()){
        P p = que.top();
        que.pop();
        int v = p.second;
        if(d[v] < p.first) continue;
        for(const auto& e : G[v]){
            if(d[e.to] > d[v] + e.cost){
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}

double dis(double x1, double y1, double x2, double y2){
    const double dx = x1 - x2;
    const double dy = y1 - y2;
    return sqrt(dx * dx + dy * dy);
}

int main(){
    double xs, ys;
    cin >> xs >> ys;

    double xt, yt;
    cin >> xt >> yt;

    int N;
    cin >> N;
    V = N + 2;

    vector<double> x(N), y(N), r(N);
    for(int i = 0; i < N; ++i){
        cin >> x[i] >> y[i] >> r[i];
    }

    for(int i = 0; i < N; ++i){
        const double d1 = dis(xs, ys, x[i], y[i]) - r[i];
        G[0].push_back(Edge{i+1, max<double>(0, d1)});
        const double d2 = dis(xt, yt, x[i], y[i]) - r[i];
        G[N+1].push_back(Edge{i+1, max<double>(0, d2)});
    }

    const double dst = dis(xs, ys, xt, yt);
    G[0].push_back(Edge{N+1, max<double>(0, dst)});
    G[N+1].push_back(Edge{0, max<double>(0, dst)});

    for(int i = 0; i < N; ++i){
        const double d1 = dis(xs, ys, x[i], y[i]) - r[i];
        G[i+1].push_back(Edge{0, max<double>(0, d1)});
        const double d2 = dis(xt, yt, x[i], y[i]) - r[i];
        G[i+1].push_back(Edge{N+1, max<double>(0, d2)});
        for(int j = 0; j < N; ++j){
            if(i == j) continue;
            const double d0 = dis(x[i], y[i], x[j], y[j]) - r[i] - r[j];
            G[i+1].push_back(Edge{j+1, max<double>(0, d0)});
        }
    }

    dijkstra(0);
    printf("%.10lf\n", d[N+1]);
}

Measured memory_bytes: 47344
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll mod=1e9+7;
int dy[]={1,-1,0,0};
int dx[]={0,0,1,-1};

int main(){
  int L,R;
  cin>>L>>R;

  if(R-L>=2019){
    cout<<0<<endl;
    return 0;
  }

  int modR=R%2019;
  int modL=L%2019;
  
  if(modR<modL){
    cout<<0<<endl;
    return 0;
  }
  int ans=2020;
  for(int i=modL;i<modR;i++){
    for(int j=i+1;j<=modR;j++){
      ans=min(ans,(i*j)%2019);
    }
  }
  cout<<ans<<endl;
  return 0;
}



Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <string.h>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <queue>
#include <math.h>
#include <assert.h>
#define ff first
#define ss second
#define ll long long
#define mod 998244353
using namespace std;
string s;
int main () {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin>>s;
    if(s == "ABC")
        cout<<"ARC";
    else
        cout<<"ABC";
}
/*
 2
 1 1
 1 0
 1 1
 1 1
 */


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

int main(void)
{
  unsigned long long a, b, c;
  cin >> a >> b >> c;

  if (a%2 != 0 || b%2 != 0 || c%2 != 0) {
    cout << 0 << endl;
    return 0;
  }

  unsigned long long A, B;
  if (a<b && a<c) {
    A = b-a;
    B = c-a;
  } else if (b<c) {
    A = a-b;
    B = c-b;
  } else {
    A = a-c;
    B = b-c;
  }

  unsigned long long a2=0, b2=0;
  if (A == 0 && B == 0) {
    cout << -1 << endl;
    return 0;
  }
  while (A%2 == 0 && A != 0) {
    a2++;
    A = A/2;
  }
  while (B%2 == 0 && B != 0) {
    b2++;
    B = B/2;
  }

  cout << (a2<b2 ? a2 : b2) << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll M =1000000007;
//MOD??
long long mod(long long val, long long m) {
  long long res = val % m;
  if (res < 0) res += m;
  return res;
}
ll mpow(ll x, ll n){ //x^n(mod M) ????pow(x,n)?????????????mod??
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % M;
        x = x*x % M;
        n = n >> 1;
    }
    return ans;
}
int main (){
 int i,n,m;
 cin>>n>>m;
 vector<int> h(n);
 for(i=0;i<n;i++){
   cin>>h[i];
 }
 int a,b;
 vector<int> gp(n,1);
 for(i=0;i<m;i++){
   cin>>a>>b;
   if(h[a-1]>h[b-1]){
     gp[b-1]=0;
   }
   else if(h[a-1]<h[b-1]){
     gp[a-1]=0;
   }
   else {
     gp[a-1]=0;
     gp[b-1]=0;
   }
 }
 int cnt=0;
 for(i=0;i<n;i++){
   if(gp[i]==1)
   cnt++;
 }
 cout<<cnt<<endl;
  return 0;
}


Measured memory_bytes: 4000
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<ll, ll>
using namespace std;
 
 
int main(){
    int n,x; cin >> n >> x;
    vector<int> l(n+1);
    l[0]=0;
    rep(i,n){
        cin >> l[i+1];
        l[i+1]+=l[i];
    }
    int ans=0;
    rep(i,n+1){
        if(l[i]>x) break;
        ans++;
    }
    cout << ans << endl;
return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main ( )
{
int a,b,perimeter,area;
    scanf("%d %d", &a,&b);
if (a>=1 && b<=100)
    {
    area=a*b;
    perimeter=2*(a+b);

    printf("%d %d\n",area,perimeter);
    }

return 0;
}







Measured memory_bytes: 2728
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

public class Hello{
    public static void Main(){
        string[] input = ReadLine().Split(' ');
        long n = long.Parse(input[0]);
        long m = long.Parse(input[1]);

//        int kazu = int.Parse(ReadLine());
//        string[,] map = new string[kazu,kazu];
        if(n<9 && m < 9){
            WriteLine("Yay!");
        }else{
            WriteLine(":(");
        }

    }
}

Measured memory_bytes: 11092
#include <iostream>
#include <queue>
#include <functional>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;
using vl = vector<ll>;
#define rep(i, n) for (int i = 0; i < (n); ++i)

int main() {
  int n; cin >> n;
  vl a(3 * n);
  rep(i, 3 * n) cin >> a[i];
  priority_queue<ll, vl, greater<ll> > pq_asc;
  priority_queue<ll, vl, less<ll> > pq_dsc;
  ll asc_sum = 0;
  ll dsc_sum = 0;
  vl asc_sums, dsc_sums;
  rep(i, n) {
    pq_asc.push(a[i]);
    asc_sum += a[i];
  }
  for (int i = 2 * n; i < 3 * n; ++i) {
    pq_dsc.push(a[i]);
    dsc_sum += a[i];
  }
  asc_sums.push_back(asc_sum);
  dsc_sums.push_back(dsc_sum);
  for (int i = n; i < 2 * n; ++i) {
    asc_sum += a[i];
    pq_asc.push(a[i]);
    asc_sum -= pq_asc.top();
    pq_asc.pop();
    asc_sums.push_back(asc_sum);
  }
  for (int i = 2 * n - 1; i >= n; --i) {
    dsc_sum += a[i];
    pq_dsc.push(a[i]);
    dsc_sum -= pq_dsc.top();
    pq_dsc.pop();
    dsc_sums.push_back(dsc_sum);
  }
  ll ans = -100000000000000;
  rep(i, n + 1) {
    ans = max(ans, asc_sums[i] - dsc_sums[n - i]);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 6516
package main

import "fmt"

func main() {
	var n int
	var a []int
	var ans int
	fmt.Scanf("%d", &n)
	for i := 0; i < n; i++ {
		tmp := 0
		fmt.Scanf("%d", &tmp)
		a = append(a, tmp)
	}
	jj := 0
	for i := n - 2; i >= 0; i-- {
		jj = (jj + a[i+1]) % 1000000007
		ans = (ans + (jj*a[i])%1000000007) % 1000000007
	}
	fmt.Println(ans)
}


Measured memory_bytes: 10244
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <set>
#include <iomanip>
#include <stdio.h>
#include <sstream>
#include <string>
using namespace std;
int main(void){
    vector<int> a(9);
    for(int i=0; i<9; i++){
        cin>>a.at(i);
    }
    int n;
    cin>>n;
    vector<int> b(n);
    for(int i=0; i<n; i++){
        cin>>b.at(i);
    }
    
    for(int i=0; i<n; i++){
        for(int j=0; j<9; j++){
            if(a.at(j)==b.at(i)){
                a.at(j)=-1;
            }
        }
    }
    
    if(a.at(0)==-1&&a.at(1)==-1&&a.at(2)==-1) {
        cout<<"Yes"<<endl;
    }else if(a.at(3)==-1&&a.at(4)==-1&&a.at(5)==-1) {
        cout<<"Yes"<<endl;
    }else if(a.at(6)==-1&&a.at(7)==-1&&a.at(8)==-1) {
        cout<<"Yes"<<endl;
    }else if(a.at(0)==-1&&a.at(3)==-1&&a.at(6)==-1) {
        cout<<"Yes"<<endl;
    }else if(a.at(1)==-1&&a.at(4)==-1&&a.at(7)==-1) {
        cout<<"Yes"<<endl;
    }else if(a.at(2)==-1&&a.at(5)==-1&&a.at(8)==-1) {
        cout<<"Yes"<<endl;
    }else if(a.at(0)==-1&&a.at(4)==-1&&a.at(8)==-1) {
        cout<<"Yes"<<endl;
    }else if(a.at(2)==-1&&a.at(4)==-1&&a.at(6)==-1) {
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const long long INF = 1e18;
# define len(x) ((int)(x).size())
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define foreps(i, m, n) for(int i = m;i < n;i++)
# define ALL(x) (x).begin(), (x).end()
# define rall(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; }

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

    ll zero = 0, one = 0;
    rep(i, len(S)) {
        if (S[i] == '0') zero++;
        else one++;
    }
    if (zero < one) cout << (zero + one) - (one - zero) << endl;
    else if (one < zero) cout << (zero + one) - (zero - one) << endl;
    else cout << zero + one << endl;
}

Measured memory_bytes: 3772
import itertools

N=int(input())
*L,=map(int,input().split())

def triang(a,b,c):
  f0 = not ( (a==b) or (b==c) or (c==a) )
  f1 = (a+b>c) and (b+c>a) and (c+a>b)
  return f0 and f1

count=0
for t in itertools.combinations(L,3):
   if triang(*t):
      count+=1

print(count)

Measured memory_bytes: 9072
def main():
  N,M = map(int,input().split())
  ships = [list(map(int,input().split())) for i in range(M)]
  start, goal = set(), set()
  for i in range(M):
    if ships[i][0] == 1:
      start.add(ships[i][1])
    if ships[i][1] == N:
      goal.add(ships[i][0])
  flg = start & goal
  print("POSSIBLE" if flg else "IMPOSSIBLE")
 
main()

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

int main() {
  int64_t N,K=0;
  cin>>N;
  string S;
  while(N>0){
    char Q='a';
    if(N%26!=0){
      Q+=(N%26-1);
    }
    else{
      Q='z';
      N--;
    }
    S.push_back(Q);
    N/=26;
    K++;
  }
  reverse(S.begin(),S.end());
  cout<<S<<endl;
    
}


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

int N;
long long X;
long long num[51], pat[51];

long long rec(int k, long long x) {
    if (x <= 0) return 0;
    if (k == 0) return (x == 1) ? 1 : 0;
    if (num[k] == x) return pat[k];

    long long ret = 0;
    if (x > 1) {
        ret += rec(k-1, min(x-1, num[k-1]));
    }
    if (num[k-1]+2 <= x) {
        ret += 1 + rec(k-1, min(x-num[k-1]-2, num[k-1]));
    }
    return ret;
}

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

    num[0] = 1;
    pat[0] = 1;
    for (int i=1; i<=50; ++i) {
        num[i] = num[i-1] * 2 + 3;
        pat[i] = pat[i-1] * 2 + 1;
    }

    cin >> N >> X;

    cout << rec(N, X) << endl;

    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++)

int main(){
  int n;
  uint64_t k;
  cin >> n >> k;
  vector<int> a(n);
  REP(i, n){
    int x;
    cin >> x;
    --x;
    a[i] = x;
  }
  vector<int> v(n, -1);
  int p = 0;
  int s = 0;
  v[0] = 0;
  while(k > 0){
    --k;
    ++s;
    p = a[p];
    if(v[p] >= 0){
      k %= s - v[p];
    }
    v[p] = s;
  }
  cout << p + 1 << endl;
  return 0;
}

Measured memory_bytes: 4840
s = input()

for i in range((len(s)-1)//2):
  if s[i] != s[-1-i]:
    print('No')
    exit()
    
for j in range((len(s)-3)//2):
  if s[j] != s[(len(s)-3)//2 - j]:
    print('No')
    exit()
    
print('Yes')

Measured memory_bytes: 3060