akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define int long long
using namespace std;
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 (a>b) { a=b; return 1; } return 0; }

template<int mod> class modint
{   
private:
    int val;
public:
    int value(){ return val; }
    modint(int x=0){ val=x%mod; }
    modint pow(int n){
        modint res(1),x(val);
        while(n>0){ if(n&1) res*=x; x*=x; n>>=1; }
        return res;
    }
    modint inv(){ return pow(mod-2); }
    modint& operator+=(modint rhs){ val+=rhs.val; if(val>=mod) val-=mod; return *this; }
    modint& operator-=(modint rhs){ val+=mod-rhs.val; if(val>=mod) val-=mod; return *this; }
    modint& operator*=(modint rhs){ val=val*rhs.val%mod; return *this; }
    modint& operator/=(modint rhs){ *this*=rhs.inv(); return *this; }
    modint operator+(modint rhs){ return modint(val)+=rhs; }
    modint operator-(modint rhs){ return modint(val)-=rhs; }
    modint operator*(modint rhs){ return modint(val)*=rhs; }
    modint operator/(modint rhs){ return modint(val)/=rhs; }
};

using mint=modint<1000000007>;
mint dp[100010][2][100];

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

    string s; cin>>s;
    int D; cin>>D;
    int N=s.size();

    dp[0][0][0]=1;
    for(int i=0;i<N;i++) for(int j=0;j<2;j++) for(int k=0;k<D;k++){
        if(j==0){
            for(int d=0;d<=s[i]-'0';d++){
                dp[i+1][d<(s[i]-'0')][(k+d)%D]+=dp[i][j][k];
            }
        }else{
            for(int d=0;d<=9;d++){
                dp[i+1][j][(k+d)%D]+=dp[i][j][k];
            }
        }
    }
    mint ans=dp[N][0][0]+dp[N][1][0]-1;
    cout<<ans.value()<<endl;
    return 0;
}

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

int main(void){
    int n;
    std::string taro,hanako;
    int p_taro=0,p_hanako=0;
    std::cin>>n;
    while(n-->0){
        std::cin>>taro>>hanako;
        if(taro>hanako) p_taro+=3;
        else if(taro<hanako) p_hanako+=3;
        else{
            p_taro++;
            p_hanako++;
        }
    }
    std::cout<<p_taro<<" "<<p_hanako<<std::endl;
    return 0;
}


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

typedef long long LL;
#define MAXN 1001
#define _MOD 1000000009

int A[MAXN];

int main() {
#ifdef OJ
    freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "wt", stdout);
#endif
    std::ios_base::sync_with_stdio(false);

    int X;
    cin >> X;
    int N = 0;
    int ans = 1;
    for (int i = 2; i <= (int)sqrt(1000); i++) {
        for (int x = i*i; x <= 1000; x *= i)
            if (x > ans && x <= X)
                ans = x;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import sys

a, b, c, x, y = map(int, sys.stdin.readline().split())
if x > y:
    a, b = b, a
    x, y = y, x

def main():
    res = min(c * 2, a + b) * x + min(c * 2, b) * (y - x)
    print(res)

if __name__ ==  '__main__':
    main()

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define int long long
#define f first
#define s second
using namespace std;
const int N=2e5+9,mod=1e9+7;
int n,sz[N],fac[N],ifac[N],f[N],h[N];
vector <int> g[N];
int pw(int a,int t=mod-2){
    int x=1;
    while(t>0){
        if(t&1)x=x*a%mod;
        a=a*a%mod,t/=2;
    }
    return x;
}
void dfs(int v,int p){
    f[v]=1;
    for(auto u:g[v]){
        if(u==p)continue;
        dfs(u,v);
        f[v]=f[v]*f[u]%mod;
        f[v]=f[v]*ifac[sz[u]]%mod;
        sz[v]+=sz[u];
    }
    f[v]=f[v]*fac[sz[v]]%mod;
    sz[v]++;
}
void dfs2(int v,int p){
    h[v]=f[p]*pw(f[v])%mod*fac[sz[v]]%mod;
    h[v]=h[v]*ifac[sz[p]-1]%mod*fac[n-sz[v]-1]%mod;
    h[v]=h[v]*h[p]%mod*ifac[n-sz[p]]%mod;
    if(v==1)h[v]=1;
    for(auto u:g[v]){
        if(u==p)continue;
        dfs2(u,v);
    }
}
int32_t main(){
    if(fopen("input.txt", "r"))
    freopen("input.txt", "r", stdin),
    freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(0),cin.tie(0);
    fac[0]=ifac[0]=1;
    for(int i=1;i<N;i++){
        fac[i]=i*fac[i-1]%mod;
        ifac[i]=pw(fac[i]);
    }
    cin >> n;
    for(int i=1;i<n;i++){
        int u,v;
        cin >> u >> v;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    dfs(1,0);
    sz[0]=sz[1];
    f[0]=f[1];
    h[0]=1;
    dfs2(1,0);
    for(int i=1;i<=n;i++){
        int x=fac[n-1]*f[i]%mod*h[i]%mod;
        x=x*ifac[sz[i]-1]%mod*ifac[n-sz[i]]%mod;
        cout << x << '\n';
    }
}

Measured memory_bytes: 22512
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>

int main()
{
	int n, k;
	std::cin >> n >> k;
	std::vector<int> p(n), c(n);
	for (auto &e : p) {
		std::cin >> e;
		e--;
	}
	for (auto &e : c) std::cin >> e;
	
	std::vector<long long> baseScore(n, 0);
	std::vector<int> ks(n, k);
	int i;
	int cnt;
	long long loopScore;
	for (int j = 0; j < n; j++) {
		loopScore = 0;
		i = j;
		cnt = 0;
		do {
			cnt++;
			i = p[i];
			loopScore += c[i];
		} while (i != j);
		if (cnt < k - cnt) {
			if (loopScore > 0) {
				baseScore[j] += (k / cnt - 1) * loopScore;
			}
			ks[j] %= cnt;
			ks[j] += cnt;
		}
	}
	long long score;
	long long max = INT64_MIN;
	for (int j = 0; j < n; j++) {
		score = baseScore[j];
		i = j;
		if (ks[j] != k) {
			max = std::max(max, score);
		}
		for (int h = 0; h < ks[j]; h++) {
			i = p[i];
			score += c[i];
			max = std::max(max, score);
		}
	}
	
	std::cout << max << std::endl;
	
	return 0;
}


Measured memory_bytes: 3280
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cfloat>
#include <complex>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define ll long long
using namespace std;



int main(){

    int a,b;
    cin >> a >> b;

    if(a > b){

        for(int i = 0;i < a;i ++){

            cout << b;
        }
    }else if(a < b){

        for(int i = 0;i < b;i ++){

            cout << a;
        }
    }else {

         for(int i = 0;i < a;i ++){

            cout << b;
         }
    }
    

    cout << endl;
    return 0;
}






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

#define N 15

struct P
{
  int x1;
  int y1;
  int x2;
  int y2;
  P ( void ) { }
  P ( int x1, int y1, int x2, int y2 )
    { this->x1 = x1; this->y1 = y1; this->x2 = x2; this->y2 = y2; }
  bool operator< ( const P &p )
    const { return ( x1 < p.x1 || x1 == p.x1
                  && ( y1 < p.y1 || y1 == p.y1
                    && ( x2 < p.x2 || x2 == p.x2
                      && ( y2 < p.y2 ) ) ) ); }
};

static int n;
static int p;
static int gx;
static int gy;
static set<P> d;
static int k_operafan[ N + 1 ][ N + 1 ];

int
main (
  int   argc,
  char *argv[ ]
  )
{
  int i, j;

  scanf ( "%d", &n );
  while ( n-- )
  {
    scanf ( "%d%d%d", &gx, &gy, &p );
    d.clear ( );
    for ( i = 0; i < p; ++i )
    {
      P p;

      scanf ( "%d%d%d%d", &p.x1, &p.y1, &p.x2, &p.y2 );
      if ( p.x1 > p.x2 || p.y1 > p.y2 )
      {
        swap ( p.x1, p.x2 );
        swap ( p.y1, p.y2 );
      }
      d.insert ( p );
    }

    for ( i = 0; i <= gx; ++i )
    for ( j = 0; j <= gy; ++j )
    {
      if ( i == 0 && j == 0 )
      {
        k_operafan[ i ][ j ] = 1;
        continue ;
      }

      k_operafan[ i ][ j ] = 0;
      if ( i > 0 && d.find ( P ( i - 1, j, i, j ) ) == d.end ( ) )
        k_operafan[ i ][ j ] += k_operafan[ i - 1 ][ j ];
      if ( j > 0 && d.find ( P ( i, j - 1, i, j ) ) == d.end ( ) )
        k_operafan[ i ][ j ] += k_operafan[ i ][ j - 1 ];
    }
    if ( k_operafan[ gx ][ gy ] )
      printf ( "%d\n", k_operafan[ gx ][ gy ] );
    else
      puts ( "Miserable Hokusai!" );
  }

  return ( EXIT_SUCCESS );
}

Measured memory_bytes: 1052
#include <iostream>
#include <vector>
#include <algorithm>

int N;
std::vector<std::vector<int>> Child;

int Height(int n) {
    int len = Child[n].size();
    if (len == 0)return 0;

    std::vector<int> ar;
    ar.resize(len);
    for (int i = 0; i < len; ++i) {
        ar[i] = Height(Child[n][i]);
    }

    std::sort(ar.begin(), ar.end());

    int result = -1;

    for (int j = 0; j < len; ++j) {
        result = std::max(result, ar[j] + len - j);
    }

    return result;
}

int main() {
    std::cin >> N;
    Child.resize(N);
    for (int i = 1; i < N; ++i) {
        int a;
        std::cin >> a;
        Child[a - 1].push_back(i);
    }
    std::cout << Height(0) << std::endl;
}

Measured memory_bytes: 16640
#include <iostream>
#define ll long long
using namespace std;

int main() {
	ll n;
	cin>>n;
	ll a[n];
	ll ans=0;
	for(int i=0;i<n;i++)
	{
	    cin>>a[i];
	}
	for(int i=0;i<n;i++)
	{
	    for(int j=i+1;j<n;j++)
	    {
	        ans+=(a[i]*a[j]);
	    }
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define rep(i,m,n) for(int i=(int)(m);i<(int)(n);++i)
#define rREP(i,m,n) for(int (i)=(n)-1; (i)>=(m);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 1000000001;
constexpr ll mod = 1000000007;
constexpr double PI = 3.1415926535897932;

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;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

int main() {
	init();

	int N, M; cin >> N >> M;
	priority_queue<ll, vector<ll>, greater<ll>>que;
	rep(i, 0, N) {
		ll a; cin >> a;
		que.push(a);
	}
	vector<pair<ll, int>>vec(M);
	rep(i, 0, M) {
		int b; cin >> b;
		ll a; cin >> a;
		vec[i] = make_pair(a, b);
	}

	sort(all(vec), greater<pair<ll, int>>());
    rep(i, 0, M) {
		int num = que.top();
        if (num < vec[i].first) {
            rep(j, 0, vec[i].second) {
				num = que.top();
                if (num < vec[i].first) {
					que.push(vec[i].first);
					que.pop();
                }
                else {
                    goto e;
                }
            }
        }
    }e:
    ll ans = 0;
	rep(i, 0, N) {
		ans += que.top();
		que.pop();
	}
    cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 2676
#include "bits/stdc++.h"

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>istream &operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
//template <typename T, typename S>ostream &operator<<(ostream &os, pair<T, S> &p) {os << p.first << " " << p.second;return os;}

template <typename T> void printvv(const vector<vector<T>> &v) {
	cerr << endl;
	rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
		if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
			cerr << "INF";
		}
		else
			cerr << v[i][j];
		cerr << (j == v[i].size() - 1 ? '\n' : ' ');
	}
	cerr << endl;
}

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T, class U>bool chmin(T& a, U b) { if (a > b) { a = b; return true; }return false; }
template <class T, class U>bool chmax(T& a, U b) { if (a < b) { a = b; return true; }return false; }

signed main(signed argc, char *argv[]) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(12);

	string S; cin >> S;
	int ans = 1;
	string buf = S.substr(0, 1);
	string t;

	rep(i, 1, S.size()) {
		t.push_back(S[i]);
		if (buf != t) {
			buf = t;
			ans++;
			t = "";
		}
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 720
using System;

namespace ABC059_B_Comparison
{
	internal class Program
	{
		public static void Main(string[] args)
		{
			string a = Console.ReadLine();
			string b = Console.ReadLine();

			if (a.Length > b.Length)
			{
				Console.WriteLine("GREATER");
				return;
			}
			else if(a.Length < b.Length)
			{
				Console.WriteLine("LESS");
				return;
			}

			for (int i = 0; i < a.Length; i++)
			{
				int aNumOne = int.Parse(a.Substring(i, 1));
				int bNumOne = int.Parse(b.Substring(i, 1));

				if (aNumOne > bNumOne)
				{
					Console.WriteLine("GREATER");
					return;
				}else if (aNumOne < bNumOne)
				{
					Console.WriteLine("LESS");
					return;
				}
			}
			
			Console.WriteLine("EQUAL");
		}
	}
}

Measured memory_bytes: 13140
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        int h=0,w=0,n=0;
        if(scan.hasNext())
            h=scan.nextInt();
        if(scan.hasNext())
            w=scan.nextInt();
        if(scan.hasNext())
            n=scan.nextInt();
        int max=Math.max(h,w);
        double d=n/((double)max);
        if(d==(int)d){
            System.out.println((int)d);
        }else{
            System.out.println((int)d + 1);
        }
    }
}


Measured memory_bytes: 20948
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author mikit
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BPalindromicNumbers solver = new BPalindromicNumbers();
        solver.solve(1, in, out);
        out.close();
    }

    static class BPalindromicNumbers {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int a = in.nextInt(), b = in.nextInt();
            int ans = 0;
            for (int i = a; i <= b; i++) {
                if (i / 10000 == i % 10 && i / 1000 % 10 == i % 100 / 10) {
                    ans++;
                }
            }
            out.println(ans);
        }

    }
}



Measured memory_bytes: 21844
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <deque>
using namespace std;
int main(){
    int x,a,b;
    string ans;
    cin >> x >> a >> b;
    if(a>=b){
        ans = "delicious";
    }else if(b-a<=x){
        ans ="safe";
    }else{
        ans ="dangerous";
    }
    cout << ans << endl;
}

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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(int x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { int d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }

struct rectangle { int h; int w; };

int main() {
  int H, W; cin >> H >> W;
  string S[H]; rep(i,H) cin >> S[i];
  bool ok[H-1][W-1];
  rep(i,H-1) rep(j,W-1) {
    int c = 0;
    if (S[i][j]=='#') c++;
    if (S[i+1][j]=='#') c++;
    if (S[i][j+1]=='#') c++;
    if (S[i+1][j+1]=='#') c++;
    ok[i][j] = c%2==0;
  }
  // rep(i,H-1) debug(ok[i],ok[i]+W-1);

  int count[H-1][W-1] = {};
  per(j,W-1) {
    int tmp = 2;
    per(i,H-1) {
      if (ok[i][j]) { count[i][j] = tmp; tmp++; }
      else tmp = 2;
    }
  }
  // rep(i,H-1) debug(count[i],count[i]+W-1);

  int result = max(H,W);
  rep(i,H-1) {
    stack<rectangle> r;
    rep(j,W-1) {
      if (!r.size()||r.top().h<count[i][j]) r.push({count[i][j],j});
      else if (r.top().h==count[i][j]) continue;
      else {
        rectangle now;
        while(r.size()&&r.top().h>count[i][j]) {
          now = r.top(); r.pop();
          result = max(result, now.h*(j-now.w+1));
        }
        if (!r.size()) r.push({count[i][j],0});
        else if (r.top().h!=count[i][j]) r.push({count[i][j],now.w});
      }
    }
    while (r.size()) { result = max(result, r.top().h*((W-1)-r.top().w+1)); r.pop(); }
    per(j,W-1) {
      if (!r.size()||r.top().h<count[i][j]) r.push({count[i][j],j});
      else if (r.top().h==count[i][j]) continue;
      else {
        rectangle now;
        while(r.size()&&r.top().h>count[i][j]) {
          now = r.top(); r.pop();
          result = max(result, now.h*(now.w-j+1));
        }
        if (!r.size()) r.push({count[i][j],0});
        else if (r.top().h!=count[i][j]) r.push({count[i][j],now.w});
      }
    }
    while (r.size()) { result = max(result, r.top().h*(r.top().w+1)); r.pop(); }
  }
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 23808
using System;

namespace ABC166D
{
    class Program
    {
        static void Main(string[] args)
        {

            var X = int.Parse(Console.ReadLine());

            int max = 1000;
            long[] fives = new long[2 * max + 1];

            for (int i = -max; i <= max; i++)
            {
                int index = i + max;
                fives[index] = (long)Math.Pow(i, 5);
            }

            int ansa = 0;
            int ansb = 0;
            for (int i = 0; i < fives.Length; i++)
            {
                for (int j = 0; j < fives.Length; j++)
                {
                    if (i == j) continue;
                    long a = fives[i];
                    long b = fives[j];
                    if (a - b == X)
                    {
                        ansa = i - max;
                        ansb = j - max;
                    }
                }
            }

            Console.WriteLine(ansa + " " + ansb);
            Console.ReadKey();
        }



    }
}


Measured memory_bytes: 17912
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.StringTokenizer;
public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static int MOD = 1000000007;
	static int[] mh4 = { 0, -1, 1, 0 };
	static int[] mw4 = { -1, 0, 0, 1 };
	static int[] mh8 = { -1, -1, -1, 0, 0, 1, 1, 1 };
	static int[] mw8 = { -1, 0, 1, -1, 1, -1, 0, 1 };

	static class TaskX {
		public void solve(int testNumber, InputReader in, PrintWriter out) {

			int n = in.nextInt();
			long ans = INF;
			for (int i = 1; i < n; i++) {

				long wa = 0;
				int a = i;
				int b = n-a;
				while (a > 0) {
					wa += a%10;
					a /= 10;
				}
				while (b > 0) {
					wa += b%10;
					b /= 10;
				}
				ans = Math.min(ans, wa);
			}
			out.println(ans);
		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public double nextDouble() {
			return Double.parseDouble(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}
	}
}

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

const long long INF = 1LL<<61;
long long N, K;
vector<long long> A;

long long solve() {
    sort(A.begin(), A.end());
    long long left = -INF, right = INF;
    while (right - left > 1) {
        long long x = (left + right) / 2;
        long long S = 0, T = 0;
        for (int i = 0; i < N; ++i) {
            if (A[i] > 0) {
                int l2 = -1, r2 = N;
                while (r2 - l2 > 1) {
                    int m = (l2 + r2) / 2;
                    if (A[i] * A[m] <= x) l2 = m;
                    else r2 = m;
                }
                S += r2;
            }
            else if (A[i] < 0) {
                int l2 = -1, r2 = N;
                while (r2 - l2 > 1) {
                    int m = (l2 + r2) / 2;
                    if (A[i] * A[m] <= x) r2 = m;
                    else l2 = m;
                }
                S += N - r2;
            }
            else if (x >= 0) S += N;
            if (A[i] * A[i] <= x) ++T;
        }
        long long num = (S - T) / 2;
        if (num >= K) right = x;
        else left = x;
    }
    return right;
}

int main() {
    cin >> N >> K;
    A.resize(N);
    for (int i = 0; i < N; ++i) cin >> A[i];
    cout << solve() << endl;
}

Measured memory_bytes: 4772
N = int(input())
A = list(map(int, input().split()))

# X1の拘束条件
# A1 * 2 && last

ansx1 = 0
is_m = False
for a in reversed(A):
    if is_m:
        ansx1 -= a
    else:
        ansx1 += a
    is_m = not is_m


ans = []
ans.append(ansx1)
prev = ansx1
for index in range(len(A)-1):
    d = 2 * (A[index] - int(prev //2))
    ans.append(d)
    prev = d

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



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

int main() {

	string o, e; cin >> o >> e;
	string ans = "";
	int o_index = 0;
	int e_index = 0;
	for (int i = 0; i < o.size() + e.size(); i++) {
		if (i % 2 == 0) {
			ans += o[o_index];
			o_index++;
		}
		else {
			ans += e[e_index];
			e_index++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define mset(a, b) memset(a, b, sizeof(a))
#define mcpy(a, b) memcpy(a, b, sizeof(a))
#define rg register
using namespace std;
typedef long long LL;
const int MAXN = 1000006;
const int MOD = 1e9 + 7;

template <typename T> inline void read(T &AKNOI) {
    T x = 0, flag = 1;
    char ch = getchar();
    while (!isdigit(ch)) {
        if (ch == '-') flag = -1;
        ch = getchar();
    }
    while (isdigit(ch)) {
        x = x * 10 + ch - '0';
        ch = getchar();
    }
    AKNOI = flag * x;
}

namespace ModCalculator {
	inline void Inc(int &x, int y) {
		x += y; if (x >= MOD) x -= MOD;
	}
	inline void Dec(int &x, int y) {
		x -= y; if (x < 0) x += MOD;
	}
	inline int Add(int x, int y) {
		Inc(x, y); return x;
	}
	inline int Sub(int x, int y) {
		Dec(x, y); return x;
	}
	inline int Mul(int x, int y) {
		return 1LL * x * y % MOD;
	}
}
using namespace ModCalculator;

inline int ksm(int x, int k) {
	int ret = 1;
	while (k) {
		if (k & 1) ret = Mul(ret, x);
		x = Mul(x, x);
		k >>= 1;
	}
	return ret;
}

void solve() {
	int n, ans = 0;
	read(n);
	for (int i = 1, pw = n * 3; i <= n; ++i, pw = Mul(pw, 3)) {
		int tmp = Mul(pw, n - i + 1);
		Inc(ans, ksm(tmp, MOD - 2));
	}
	printf("%d\n", ans);
}

int main() {
	solve();
	return 0;
}


Measured memory_bytes: 256
N,A = map(int,input().split())
X = [int(e)-A for e in input().split()]
# dp[i][s]: i番目まで見て部分和がsとなるような場合の数
# 初期条件: dp[0][0] = 1
# 遷移: dp[i][s] += dp[i-1][s-X[i]] + dp[i-1][s]
# 答え: dp[N][0]
s_max = 5001
dp = [[0]*(s_max+1) for i in range(N+1)]
dp[0][2500] = 1
for i in range(1,N+1):
    for s in range(s_max+1):
        if 0 <= s-X[i-1] <= s_max:
            dp[i][s] += dp[i-1][s-X[i-1]]
        dp[i][s] += dp[i-1][s]
# 全てを選ばなかった1通りは除外
ans = dp[N][2500] - 1
print(ans)

Measured memory_bytes: 5620
#include <bits/stdc++.h>
#define mp make_pair
#define eb emplace_back
#define fi first
#define se second
#define int long long
using namespace std;
using cd = complex <double>;
 
typedef pair <int, int> pii;
const int N = 3e3 + 5;
const long long INF = 1e18;
const int mod = 1e9 + 7;//786433;//998244353;
const double Pi = acos(-1);
const int p = 510200;
 
void Fastio()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
}

int n, k;
int dp[100005], h[100005];

signed main()
{
	Fastio();
	cin >> n >> k;
	for(int i = 1; i <= n; i++)
	{
		cin >> h[i];
	}
	dp[1] = 0;
	for(int i = 2; i <= k; i++)
	{
		dp[i] = abs(h[i] - h[1]);
	}
	for(int i = k + 1; i <= n; i++)
	{
		dp[i] = dp[i - 1] + abs(h[i] - h[i - 1]);
		for(int j = 2; j <= k; j++)
		{
			dp[i] = min(dp[i], dp[i - j] + abs(h[i] - h[i - j]));
		}
	}
	cout << dp[n];
}

Measured memory_bytes: 1792
n, m = map(int, input().split())
l, r = 1, 10**5
for _ in range(m):
    l_cur, r_cur = map(int, input().split())
    l = max(l_cur, l)
    r = min(r_cur, r)
    if r < l:
        break

print(max(r-l+1, 0))


Measured memory_bytes: 3060
//code by lynmisakura.wish to be accepted!
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;

int main(void){
  int a,n;scanf("%d %d",&n,&a);
  n %= 500;
  if(n <= a){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

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

int main(){
    string str;
    string newstr;
    while(cin >> str){
        for(int i = 0; i < (int)str.size(); i++){
            newstr.push_back(str[(int)str.size()-i-1]);
        }
        cout << newstr << endl;
        newstr = "";
    }
}

Measured memory_bytes: 3088
#include <iostream>
#include<algorithm>
#include<string>
#include<cmath>
using namespace std;

int main()
{
	int A, B;


	cin >> A >> B;


	if (A <= 5) {
		cout << 0;
	}
	else if (6 <= A && A <= 12) {
		cout << B / 2;
	}
	else {
		cout << B;
	}

	return 0;


}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <bitset>
#include <cstring>
#include <string.h>
#include <cmath>
#include <queue>
#include <string>
#include <stack>
#include <utility>
#include <queue>
#include <cmath>
#define mp make_pair
#define pii pair<int,int> 
#define ff first
#define ss second
#define ll long long 
#define vi vector<int>

using namespace std;

int D,a,b,c,p,q,r,s,g1,g2;

bool cek;

int main()
{
	while(scanf("%d%d%d", &a,&b,&c),(a||b||c))
	{
		cek=true;
		D=b*b-(4*a*c);
		if(a==0&&b==0&&c==0)break;
		for(int z=0;z*z<=D;z++)
		{
			if(z*z==D) 
			{
				//printf("tes\n");
				cek=false;
				break;
			}
		}
		if(D<0||cek)
		{
			printf("Impossible\n");
			continue;
		}
		//printf("%d\n",D);
		else
		{
			p=2*a;
			q=-(-b+sqrt(D));
			r=2*a;
			s=-(-b-sqrt(D));
			g1=__gcd(p,q);
			g2=__gcd(r,s);
			p/=g1;
			q/=g1;
			r/=g2;
			s/=g2;
			if(p<0)
			{
				p*=-1;
				q*=-1;
			}
			if(r<0)
			{
				r*=-1;
				s*=-1;
			}
			if(p<r||(p==r&&q<s))
			{
				swap(p,r);
				swap(q,s);
				//swap(g1,g2);
			}
			printf("%d %d %d %d\n",p,q,r,s);
		}
	}
	return 0;
}

Measured memory_bytes: 1196
#include<iostream>
#include<map>
#include<string>
using namespace std;
int main()
{
  int q,n,order;
  string s;
  cin>>q;
  map<string,int>m;
  while(q--){

    cin>>order;
    switch(order){

    case 0:
                cin>>s>>n;
                m[s]=n;
                break;
    case 1:
                cin>>s;
                cout<<m[s]<<endl;
                break;
    case 2:
                cin>>s;
                m.erase(s);
                break;

    }
  }
  return 0;
}


Measured memory_bytes: 27820
#include<bits/stdc++.h>
typedef  long long int ll;
typedef  long double ld;
#define sync ios_base::sync_with_stdio(false); cin.tie(NULL) 
#define input(arr,n) for(ll i1=0;i1<n;i1++ )cin>>arr[i1]
#define mod 1000000007
#define F first
#define S second 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
//recursions\
#pragma comment(linker, "/stack:200000000")
//loops\
#pragma GCC optimize("unroll-loops")
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,greater_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>//s.order_of_key(val) *s.find_by_order(ind)
using namespace std;
int main()
{
	sync;
	ll n;
	string s;
	cin>>n>>s;
	ll ans=1;
	for(ll i=1;i<n;i++)
	if(s[i]!=s[i-1])
	ans++;
	cout<<ans;
}

Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<cctype>
#define ld long double
#define ll long long int
#define ull unsigned long long int
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const long long INF=1LL<<60;
//set<set>::iterator it;

int main(void){
	ios::sync_with_stdio(false); cin.tie(0);
	
	int a,b,x,y;
	cin>>a>>b;
	x=b;
	y=0;
	while(x>0){
		x/=10;
		y++;
	}
	a=a*pow(10,y)+b;
//	cout<<sqrt(a)<<endl;
	if(int(sqrt(a))*int(sqrt(a))==a)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	
	return 0;
}

Measured memory_bytes: 384
# import time


def mixing_experiment(N: int, Ma: int, Mb: int, drags: list)->int:
    INF = float('inf')

    max_A = min(100, N * max(a for a, _, _ in drags))
    max_B = min(100, N * max(b for _, b, _ in drags))

    dp = [[INF] * (max_B+1) for _ in range(max_A+1)]
    dp[0][0] = 0

    # print(max_A, max_B)
    # t1 = time.time()

    # op = 0
    for (a, b, c) in drags:
        for ca in range(max_A-a, -1, -1):
            for cb in range(max_B-b, -1, -1):
                dp[ca+a][cb+b] = \
                    min(dp[ca+a][cb+b], dp[ca][cb] + c)
                # dp[ca+a][cb+b] = 0
                # op += 1
        dp[a][b] = min(dp[a][b], c)

    # t2 = time.time()
    # print('dp: {} [s]'.format(t2 - t1))

    ans = INF
    for ca in range(1, max_A+1):
        for cb in range(1, max_B+1):
            if ca * Mb != cb * Ma:
                continue
            ans = min(ans, dp[ca][cb])

    # t3 = time.time()
    # print('min: {} [s]'.format(t3 - t2))

    return ans if 0 < ans and ans < INF else -1


if __name__ == "__main__":
    N = 0
    N, Ma, Mb = map(int, input().split())
    drags = [tuple(int(s) for s in input().split()) for _ in range(N)]
    ans = mixing_experiment(N, Ma, Mb, drags)
    print(ans)


Measured memory_bytes: 3188
#include<cmath>
#include<cstdio>
#include<vector>

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

using namespace std;

const double EPS=1e-8;

template<class T>
struct point{
	T x,y;
	point operator+(const point &a)const{ return (point){x+a.x,y+a.y}; }
	point operator-(const point &a)const{ return (point){x-a.x,y-a.y}; }
};

template<class T>
point<T> operator*(T c,const point<T> &a){ return (point<T>){c*a.x,c*a.y}; }

template<class T>
point<double> operator/(const point<T> &a,double c){
	return (point<double>){a.x/c,a.y/c};
}

template<class T>
struct polygon:vector< point<T> >{};

template<class T>
struct circle{
	point<T> c;
	T r;
};

template<class T>
double abs(const point<T> &a){ return sqrt(a.x*a.x+a.y*a.y); }

template<class T>
double dist(const point<T> &a,const point<T> &b){
	return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}

vector< circle<double> > kirito(const point<double> &p,const point<double> &q,double r){
	double d=abs(q-p)/2;
	vector< circle<double> > res;
	if(r-EPS<d && d<r+EPS){
		res.push_back((circle<double>){(p+q)/2,r});
	}
	else if(EPS<d && d<r){
		point<double> a=(q-p)/2;
		point<double> b=sqrt(r*r-d*d)/d*a;
		res.push_back((circle<double>){p+a+(point<double>){b.y,-b.x},r});
		res.push_back((circle<double>){p+a-(point<double>){b.y,-b.x},r});
	}
	return res;
}

bool cover(const circle<double> &C,const point<double> &p){
	return dist(C.c,p)<C.r+EPS;
}

bool cover(const circle<double> &C,const polygon<double> &G){
	int n=G.size();
	rep(i,n) if(!cover(C,G[i])) return false;
	return true;
}

bool can_though(polygon<double> F,double r){
	int n=F.size();
	rep(i,n) rep(j,i) {
		vector< circle<double> > C=kirito(F[i],F[j],r);
		rep(k,C.size()){
			if(cover(C[k],F)) return true;
		}
	}
	return false;
}

const int V_MAX=100;

bool augment(int u,bool *vis,int match[2][V_MAX],const vector<int> *G){
	if(u==-1) return true;

	rep(i,G[u].size()){
		int v=G[u][i];
		if(!vis[v]){
			vis[v]=true;
			if(augment(match[1][v],vis,match,G)){
				match[0][u]=v;
				match[1][v]=u;
				return true;
			}
		}
	}
	return false;
}

int match[2][V_MAX];
int asuna(int L,int R,const vector<int> *G){
	rep(u,L) match[0][u]=-1;
	rep(v,R) match[1][v]=-1;

	int res=0;
	static bool vis[V_MAX];
	rep(u,L){
		rep(v,R) vis[v]=false;
		if(augment(u,vis,match,G)) res++;
	}
	return res;
}

int main(){
	int n,m; scanf("%d%d",&n,&m);
	int r[100];
	rep(i,n) scanf("%d",r+i);

	polygon<double> man[100];
	rep(i,m){
		int k; scanf("%d",&k);
		man[i].resize(k);
		rep(j,k) scanf("%lf%lf",&man[i][j].x,&man[i][j].y);
	}

	bool adj[V_MAX][V_MAX]; // 隣接行列
	rep(u,m) rep(v,n) adj[u][v]=can_though(man[u],r[v]);

	vector<int> G[V_MAX];
	rep(u,m) rep(v,n) if(adj[u][v]) G[u].push_back(v);

	if(asuna(m,n,G)<m){ puts("NG"); return 0; }

	int ans[100];
	bool matched[100]={};
	rep(u0,m){
		rep(v0,n) if(adj[u0][v0] && !matched[v0]) {
			matched[v0]=true;

			rep(u,m) G[u].clear();
			for(int u=u0+1;u<m;u++) rep(v,n) if(adj[u][v] && !matched[v]) G[u].push_back(v);

			if(asuna(m,n,G)==m-u0-1){
				ans[u0]=v0;
				break;
			}

			matched[v0]=false;
		}
	}
	rep(u,m) printf("%d\n",ans[u]+1);

	return 0;
}

Measured memory_bytes: 1232
S = input()
s = list(S)
o = [ord(x) for x in S]
alphabets = set([chr(i+97) for i in range(26)])
if len(S) < 26:
    used = set(s)
    unused = alphabets - used
    unusedo = [ord(x) for x in unused]
    print(''.join(S)+chr(min(unusedo)))
else:
    if S == 'zyxwvutsrqponmlkjihgfedcba':
        print('-1')
    else:
        diff = [ord(s[i+1]) - ord(s[i]) for i in range(25)]
        for i in range(1,26):
            if diff[-i] > 0:
                removed = S[:-i-1]
                current = S[-i-1]
                break
        usedr = set(list(removed)) | set(current)
        unusedr = alphabets - usedr
        unusedro = [ord(x) for x in unusedr if ord(x) > ord(current)]
        print(removed+chr(min(unusedro)))

Measured memory_bytes: 3188
package main

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

// SeeAlso: https://atcoder.jp/contests/abc157/submissions/10471039
func solution(n, m, k int, ab, cd [][2]int) []int {
        friends := make([]int, n)
        uf := newUnionFind(n)
        for i := 0; i < m; i++ {
                a := ab[i][0] - 1
                b := ab[i][1] - 1
                friends[a]++
                friends[b]++
                uf.unite(a, b)
        }
        blocks := make([]int, n)
        for i := 0; i < k; i++ {
                c := cd[i][0] - 1
                d := cd[i][1] - 1
                if uf.same(c, d) {
                        blocks[c]++
                        blocks[d]++
                }
        }
        out := make([]int, n)
        for i := 0; i < n; i++ {
                out[i] = uf.size(i) - friends[i] - blocks[i] - 1
        }
        return out
}

func main() {
        r := bufio.NewReader(os.Stdin)
        var n, m, k int
        fmt.Fscan(r, &n, &m, &k)
        ab := make([][2]int, m)
        for i := range ab {
                fmt.Fscan(r, &ab[i][0], &ab[i][1])
        }
        cd := make([][2]int, k)
        for i := range cd {
                fmt.Fscan(r, &cd[i][0], &cd[i][1])
        }
        for _, t := range solution(n, m, k, ab, cd) {
                fmt.Printf("%v ", t)
        }
}

type unionFind struct {
        d []int
}

func newUnionFind(n int) unionFind {
        d := make([]int, n)
        for i := 0; i < n; i++ {
                d[i] = -1
        }
        return unionFind{d: d}
}

func (uf unionFind) find(x int) int {
        if uf.d[x] < 0 {
                return x
        }
        uf.d[x] = uf.find(uf.d[x])
        return uf.d[x]
}

func (uf unionFind) unite(x, y int) bool {
        x, y = uf.find(x), uf.find(y)
        if x == y {
                return false
        }
        if uf.d[x] > uf.d[y] {
                x, y = y, x
        }
        uf.d[x] += uf.d[y]
        uf.d[y] = x
        return true
}

func (uf unionFind) same(x, y int) bool {
        return uf.find(x) == uf.find(y)
}

func (uf unionFind) size(x int) int {
        return -uf.d[uf.find(x)]
}

Measured memory_bytes: 9196
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define FOR0(i,n) for(int i=0, _##i=(n); i<_##i; ++i)
#define FOR(i,l,r) for(int i=(l), _##i=(r); i<_##i; ++i)
#define FORD(i,l,r) for(int i=(r), _##i=(l); --i>=_##i; )
#define repi(i,a) for(__typeof((a).begin()) i=(a).begin(), _##i=(a).end(); i!=_##i; ++i)
#define dwni(i,a) for(__typeof((a).rbegin()) i=(a).rbegin(), _##i=(a).rend(); i!=_##i; ++i)
#define SZ(a) ((int)((a).size()))
#define printCase() "Case #" << caseNum << ": "
#define pb push_back
#define mp make_pair
#define INF ((int)1e9)
#define SYNC std::ios::sync_with_stdio(false);  cin.tie(NULL);
#define ff first
#define ss second
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define N 200005
int main() {
    SYNC
    int n, m, a, b;
    bitset<N> r1, r2;
    cin >> n >> m;
    while(m --) {
        cin >> a >> b;
        if(a == 1 || b == 1) r1[max(a, b)] = 1;
        else if(a == n || b == n) r2[min(a, b)] = 1;
    }
    FOR(i,2,n) if(r1[i] && r2[i]) {
        cout << "POSSIBLE";
        return 0;
    }
    cout << "IMPOSSIBLE";
}

Measured memory_bytes: 256
def solve():
    N, Ma, Mb = map(int, input().split())
    a, b, c = [], [], []

    for i in range(N):
        ai, bi, ci = map(int, input().split())
        a.append(ai)
        b.append(bi)
        c.append(ci)

    alim = sum(a)
    blim = sum(b)
    inf = 40 * 100 + 1

    dp = [[inf]*(blim + 1) for i in range(alim + 1)]
    dp[0][0] = 0

    for i in range(N):
        for u in range(alim, a[i] - 1, -1):
            for v in range(blim, b[i] - 1, -1):
                dp[u][v] = min(dp[u][v], dp[u - a[i]][v - b[i]] + c[i])

    ans = inf

    for u in range(1, alim + 1):
        for v in range(1, blim + 1):
            if u * Mb == v * Ma:
                ans = min(ans, dp[u][v])

    if ans < inf:
        print(ans)
    else:
        print(-1)

if __name__ == '__main__':
    solve()

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

int INF = 1e9;
int main() {
    int n, m;
    cin >> n >> m;
    vector<vector<int>> dist(n, vector<int>(n, INF));
    vector<int> a(m), b(m), c(m);
    for (int i = 0; i < m; i++) {
        cin >> a[i] >> b[i] >> c[i];
        a[i]--;
        b[i]--;
        dist[a[i]][b[i]] = dist[b[i]][a[i]] = c[i];
    }
    for (int i = 0; i < n; i++) dist[i][i] = 0;
    for (int k = 0; k < n; k++) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
            }
        }
    }
    int sum = m;
    for (int i = 0; i < m; i++) {
        bool ok = false;
        for (int j = 0; j < n; j++) {
            if (dist[j][a[i]] + c[i] == dist[j][b[i]]) ok = true;
        }
        if (ok) sum--;
    }
    cout << sum << endl;
    return 0;
}


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

using namespace std;



int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		double ax,ay,ar,bx,by,br;
		cin >> ax >> ay >> ar >> bx >> by >> br;
		double dd = (ax-bx)*(ax-bx) + (ay-by)*(ay-by);
		double rsum = (ar+br)*(ar+br);
		double rdiff = (ar-br)*(ar-br);
		if (dd > rsum)
			cout << 0 << endl;
		else if (dd < rsum && dd > rdiff)
			cout << 1 << endl;
		else if (dd < rdiff)
			cout << (ar > br ? 2 : -2) << endl;
		else
			cout << 1 << endl;
	}
	return 0;
}

Measured memory_bytes: 0
N,K=map(int,input().split())
A=list(map(int,input().split()))

keta=len(bin(max(K,max(A)))[2:])

cnt1=[0]*keta
cnt0=[0]*keta

for i in range(len(A)):
  for j in range(keta):
    if (A[i]>>j)&1:
      cnt1[keta-1-j]+=1
    else:
      cnt0[keta-1-j]+=1

Ks=bin(K)[2:].zfill(keta)
dp=[[[0 for i in range(2)] for j in range(2)] for k in range(len(Ks))]
def calc(di,v):
  unit=2**(keta-1-di)
  if v==0:
    return cnt1[di]*unit
  else:
    return cnt0[di]*unit

x0=int(Ks[0])
dp[0][0][0]=(0 if x0==1 else calc(0,0))
dp[0][0][1]=(0 if x0==0 else calc(0,1))
dp[0][1][0]=(0 if x0==0 else calc(0,0))
dp[0][1][1]=0

for i in range(1,len(dp)):
  x=int(Ks[i])
  if x==0:
    dp[i][0][0]=dp[i-1][0][0]+dp[i-1][0][1]+calc(i,0)
    dp[i][0][1]=0
  else:
    dp[i][0][0]=0
    dp[i][0][1]=dp[i-1][0][0]+dp[i-1][0][1]+calc(i,1)
  dp[i][1][0]=max(dp[i-1][0][0]*(x==1),dp[i-1][0][1]*(x==1),dp[i-1][1][0],dp[i-1][1][1])+calc(i,0)
  dp[i][1][1]=max(dp[i-1][1][0],dp[i-1][1][1])+calc(i,1)

ans=0
for i in range(2):
  for j in range(2):
    if ans<dp[len(dp)-1][i][j]:
      ans=dp[len(dp)-1][i][j]
print(ans)


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

using namespace std;

#define int long long

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

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int a, b;
    cin >> a >> b;
    cout << a * b / gcd(a, b) << endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
li = [1]*(10**6+5)
a.sort()
ans = 1
 
for i in range(a[0], len(li), a[0]):
  li[i] = [0]
 
flag = False
flag2 = True
for i in range(1, len(a)):
  if a[i-1] == a[i]:
    flag = True
    continue
  else:
    if flag and flag2:
      ans -= 1
    flag = False
  if li[a[i]] == 1:
    flag2 = True
    ans += 1
    for j in range(a[i], len(li), a[i]):
      li[j] = 0
  else:
    flag2 = False
if flag and flag2:
  ans -= 1
print(ans)

Measured memory_bytes: 104496
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rep2(i,n) for(int i = 1; i <= (n); ++i)
#define rrep2(i,n) for(int i = (n); i > 0; --i)
#define srep(i,s,n) for(int i = s; i < (n); ++i)
#define rsrep(i,s,n) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { int n = (__VA_ARGS__).size(); rep(i, n) printf("%d%s", (__VA_ARGS__)[i], i != n-1 ? " " : "\n"); }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;


vll divisor(ll n) {
    vll ans;
    for (ll i = 1; i*i <= n; ++i) {
        if (n%i == 0) {
            ans.push_back(i);
            if (i*i != n) ans.push_back(n/i);
        }
    }
    sort(all(ans));
    return ans;
}

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

    auto div = divisor(n);

    ll ans = LINF;
    for (ll d : div) {
        ans = min(ans, d+(n/d)-2);
    }

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

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define eb emplace_back
#define f first
#define s second
#define ll long long int
#define ull unsigned long long int
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define mod 1000000007
const int INF=1e5+5;int ar[1004][1004] , dp[1004][1004];
int main()
{
    fast;
    int h,w;
    cin>>h>>w;
    
    for(int i=1;i<=h;i++)
    {
        // string ch;
        // cin>>ch;
        for(int j=1;j<=w;j++)
        {
            char ch;cin>>ch;
            if(ch=='.')ar[i][j]=1;
        }
    }
    for(int i=1;i<=h;i++)for(int j=1;j<=w;j++)dp[i][j]=0;
    for(int i=1;i<=w;i++)
    {
        if(ar[1][i]==0)break;
        dp[1][i]=1;
    }
    for(int i=1;i<=h;i++)
    {
        if(ar[i][1]==0)break;
        dp[i][1]=1;
    }
    for(int i=2;i<=h;i++)
    {
        for(int j=2;j<=w;j++)
        {
            if(ar[i][j])
            {                            
                dp[i][j]=(dp[i][j-1]+dp[i-1][j])%mod;
            }
        }
    }
    
    cout<<dp[h][w]<<"\n";
return 0;
}

Measured memory_bytes: 8192
s = gets.chomp
v = [0] * 26

s.split('').each do |c|
  v[c.ord - 'a'.ord] += 1
end

flag = true
26.times do |i|
  if v[i] > 1 then
    flag = false
  end
end

puts (flag ? 'yes' : 'no')

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

using namespace std;

typedef long long ll;
typedef long double ld;

const int N=100000+5;

int n;
ll dp[3][N];
ll a[3][N];

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        for(int j=0;j<3;j++)
        {
            cin>>a[j][i];
            dp[j][i]=-(1LL<<60);
        }
    }
    for(int j=0;j<3;j++)
    {
        dp[j][1]=a[j][1];
    }
    for(int i=2;i<=n;i++)
    {
        for(int now=0;now<3;now++)
        {
            for(int ant=0;ant<3;ant++)
            {
                if(now==ant) continue;
                dp[now][i]=max(dp[now][i],dp[ant][i-1]+a[now][i]);
            }
        }
    }
    ll ans=0;
    ans=max(ans,dp[0][n]);
    ans=max(ans,dp[1][n]);
    ans=max(ans,dp[2][n]);
    cout<<ans<<"\n";
    return 0;
}
/**

**/


Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
#define int long long int
int ar[55];
int32_t main(){
	int n,m,t1,t2;cin>>n>>m;
	for(int i=1;i<=m;i++){
		cin>>t1>>t2;ar[t1]++;ar[t2]++;
	}
	for(int i=1;i<=n;i++) cout<<ar[i]<<"\n";
}


Measured memory_bytes: 256