akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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 ll INF = 1e9+10;
const ll MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  
  ll x,y,a,b,c; cin>>x>>y>>a>>b>>c;
  priority_queue<ll> A,B,C;
  rep(i,a){
    ll t; cin>>t; A.emplace(t);
  }
  rep(i,b){
    ll t; cin>>t; B.emplace(t);
  }
  rep(i,c){
    ll t; cin>>t; C.emplace(t);
  }
  
  priority_queue<ll, vector<ll>, greater<ll>> AA, BB;
  
  while(x--){
    AA.emplace(A.top()); A.pop();
  }
  while(y--){
    BB.emplace(B.top()); B.pop();
  }
  
  while(!C.empty() && (C.top()>AA.top() || C.top()>BB.top())){
    if(AA.top()<BB.top()){
      AA.pop(); AA.emplace(C.top()); C.pop();
    }else{
      BB.pop(); BB.emplace(C.top()); C.pop();
    }
  }
  
  ll ans=0;
  while(!AA.empty()){
    ans+=AA.top(); AA.pop();
  }
  while(!BB.empty()){
    ans+=BB.top(); BB.pop();
  }
  
  
  cout<<ans<<endl;
  
}

Measured memory_bytes: 7952
#include <iostream>

#include <algorithm>

using std::cin;
using std::cout;
using std::endl;

using std::max;
using std::min;

static int
solve(int A, int B, int C, int D)
{
  int start = max(A, C);
  int stop = min(B, D);
  return (start < stop ? stop - start : 0);
}

int
main()
{
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  cout << solve(A, B, C, D) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...)
#endif

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
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; }
#define fls(x) (64 - __builtin_clzll(x))
#define pcnt(x) __builtin_popcountll(x)
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

void add (int dest, int s1, int s2) {
    printf("+ %d %d %d\n", s1, s2, dest);
}
void lt (int dest, int s1, int s2) {
    printf("< %d %d %d\n", s1, s2, dest);
}

void make_1 (int _0, int _1) {
    add(_1, 0, 1);
    lt(_1, _0, _1);
}

void int_to_bin (int a, int _0, int _1, int a1, int p31, int b31, int q31, int s31, int st31) {
    add(a1, a, _1);
    reprev (i, 32) {
        add(p31 + i, _1, _0);
        rep (_, i) add(p31 + i, p31 + i, p31 + i);
        add(st31 + i, (i == 31 ? _0 : s31 + i + 1), p31 + i);
        lt(b31 + i, st31 + i, a1);
        add(q31 + i, b31 + i, _0);
        rep (_, i) add(q31 + i, q31 + i, q31 + i);
        add(s31 + i, (i == 31 ? _0 : s31 + i + 1), q31 + i);
    }
}

void mul (int _0, int _1, int ba, int bb, int mu, int tmp) {
    reprev (i, 32) {
        reprev (j, 32) {
            add(tmp, ba + i, bb + j);
            lt(tmp, _1, tmp);
            add(mu + i + j, mu + i + j, tmp);
        }
    }
    reprev (i, 64) {
        rep (_, i) add(mu + i, mu + i, mu + i);
        add(2, 2, mu + i);
    }
}

int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a = 0, b = 1, a1 = 4, b1 = 5, _0 = 199998, _1 = 199999, ba = 100, bb = 350;
    printf("7460\n");
    make_1(_0, _1);
    int_to_bin(a, _0, _1, a1,  50, ba, 150, 200, 250);
    int_to_bin(b, _0, _1, b1, 300, bb, 400, 450, 500);
    mul(_0, _1, ba, bb, 600, 10);
    return 0;
}

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

#include <algorithm>
using namespace std;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} fast;

long long mod = 1000000007;

long long modpow(long long m, long long n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2);
        return (t * t) % mod;
    } else {
        return (modpow(m, n - 1) * m) % mod;
    }
}

void yes() {
    cout << "Yes" << endl;
    exit(0);
}
void no() {
    cout << "No" << endl;
    exit(0);
}
#define REP(i, n) for (long long i = 0; i < (n); i++)

signed main() {
    long long n, ans = 0;
    string s;
    cin >> n >> s;
    int sr = 0;
    int sg = 0;
    int sb = 0;
    REP(i, n) {
        if (s[i] == 'R') {
            sr++;
        }
        if (s[i] == 'G') {
            sg++;
        }
        if (s[i] == 'B') {
            sb++;
        }
    }
    REP(i, n) {
        int sr1 = 0;
        int sg1 = 0;
        int sb1 = 0;
        if (s[i] == 'R') {
            int ms = 0;
            for (int j = 0; j < i; j++) {
                if (s[j] == 'G') {
                    sg1++;
                }
                if (s[j] == 'B') {
                    sb1++;
                }
            }
            ans += sg1 * (sb - sb1);
            ans += sb1 * (sg - sg1);
            for (int j = 1; j <= i; j++) {
                if (i + j < n && (s[i + j] != s[i] && s[i - j] != s[i]) && (s[i + j] != s[i - j])) {
                    ms++;
                }
            }
            ans -= ms;
        }
        if (s[i] == 'G') {
            int ms = 0;
            for (int j = 0; j < i; j++) {
                if (s[j] == 'R') {
                    sr1++;
                }
                if (s[j] == 'B') {
                    sb1++;
                }
            }
            ans += sr1 * (sb - sb1);
            ans += sb1 * (sr - sr1);
            for (int j = 1; j <= i; j++) {
                if (i + j < n && (s[i + j] != s[i] && s[i - j] != s[i]) && (s[i + j] != s[i - j])) {
                    ms++;
                }
            }
            ans -= ms;
        }
        if (s[i] == 'B') {
            int ms = 0;
            for (int j = 0; j < i; j++) {
                if (s[j] == 'G') {
                    sg1++;
                }
                if (s[j] == 'R') {
                    sr1++;
                }
            }
            ans += sr1 * (sg - sg1);
            ans += sg1 * (sr - sr1);
            for (int j = 1; j <= i; j++) {
                if (i + j < n && (s[i + j] != s[i] && s[i - j] != s[i]) && (s[i + j] != s[i - j])) {
                    ms++;
                }
            }
            ans -= ms;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3664
#include<bits/stdc++.h>
#define FOR(i,s,e) for(int i=(s);i<=(e);i++)
#define FORD(i,s,e) for(int i=(s);i>=(e);i--)
#define eb emplace_back
#define MAXN 1000009
#define MOD 1000000007
#define mp(x, y) make_pair(x,y)
#define all(v) (v).begin(),(v).end()
#define pb(x) push_back(x)
#define tr(ii,c) for(__typeof((c).begin()) ii=(c).begin();ii!=(c).end();ii++)
#define ff first
#define ss second

using namespace std;

typedef unsigned long long LLU;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
const bool print=false;
typedef long long ll;

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

int n;

int main()
{
    scanf("%d", &n);int x;scanf("%d", &x);
    int a[n];
    for(int i=0;i<n;i++)
    	scanf("%d",a+i);
    sort(a,a+n);
	int i;
	ll sum=0;
	for(i=0;i<n;i++){
		if(a[i]+sum>x)
			break;
		sum+=a[i];
	}
	if(i==n){
		if(x-sum>0)
			i--;
	}
	umax(i,0);
	printf("%d\n",i);
}



Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int b1, b2, b3;
	
	scanf("%d %d %d", &b1, &b2, &b3);
	
	if ((b1 == 1) && (b2 == 1)){
		printf("Open\n");
	}
	else if (b3 == 1){
		printf("Open\n");
	}
	else {
		printf("Close\n");
	}
	
	return (0);
}

Measured memory_bytes: 584
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
vector<int>pat[100000];
vector<int>v1, v2;
bool flag[100000];
int main()
{
	int num, way;
	scanf("%d%d", &num, &way);
	for (int i = 0; i < way; i++)
	{
		int za, zb;
		scanf("%d%d", &za, &zb);
		za--, zb--;
		pat[za].push_back(zb);
		pat[zb].push_back(za);
	}
	int now = 0;
	flag[0] = true;
	for (;;)
	{
		bool f = false;
		for (int i = 0; i < pat[now].size(); i++)
		{
			if (!flag[pat[now][i]])now = pat[now][i], flag[now] = true, f = true, v1.push_back(now);
		}
		if (!f)break;
	}
	now = 0;
	for (;;)
	{
		bool f = false;
		for (int i = 0; i < pat[now].size(); i++)
		{
			if (!flag[pat[now][i]])now = pat[now][i], flag[now] = true, f = true, v2.push_back(now);
		}
		if (!f)break;
	}
	printf("%d\n", v1.size() + v2.size() + 1);
	for (int i = int(v2.size()) - 1; i >= 0; i--)printf("%d ", v2[i] + 1);
	printf("1");
	for (int i = 0; i < v1.size(); i++)printf(" %d", v1[i] + 1);
	printf("\n");

}

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

using namespace std;

typedef long long/*--------------------*/ll;
typedef long double/*------------------*/ld;
typedef unsigned long long/*-----------*/ull;
typedef pair<ll, ll >/*----------------*/pll;
typedef std::vector<pll >/*------------*/vpll;

#define rep(i,a)/*---------------------*/for(i = 0 ; i < a ; i++)
#define repr(i,a)/*--------------------*/for(i = a ; i >= 0 ; i--)
#define REP(i,a,b)/*-------------------*/for(i = a ; i <= b ; i++)
#define REPR(i,a,b)/*------------------*/for(i = a ; i >= b ; i--)

#define YES/*--------------------------*/cout << "YES" << endl
#define NO/*---------------------------*/cout << "NO" << endl

#define lb/*---------------------------*/lower_bound
#define ub/*---------------------------*/upper_bound
#define pb/*---------------------------*/push_back
#define popb/*-------------------------*/pop_back
#define mem(a,b)/*---------------------*/memset(a,b,sizeof(a))
#define sz/*---------------------------*/size()
#define mpp/*--------------------------*/make_pair
#define bs/*---------------------------*/binary_search
#define gcd(a, b)/*--------------------*/__gcd(a, b)
#define lcm(a, b)/*--------------------*/((a)*((b)/gcd(a,b)))
#define sqr(x)/*-----------------------*/(x)*(x)
#define all(a)/*-----------------------*/a.begin(),a.end()

#define ff/*---------------------------*/first
#define ss/*---------------------------*/second

#define endl/*-------------------------*/'\n'
#define inf/*--------------------------*/(ll)2e15
#define MOD/*--------------------------*/(ll)1000000007

void solve();
void boost()
{
	std::ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
}
int main()
{
	boost();
	ll t,i;
	t = 1;
    //cin >> t;
	REP(i,1,t)
	{
       //cout << "Case "<< i << ": ";
       solve();
	}
	return 0;
}

void solve()
{
    ll a,b,c;
    cin >> a >> b >> c;
    ll ans = a^b^c;
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < n; ++i)
typedef long long ll;
using namespace std;
const int INF = 1e9;

map<ll, int> prime_factor(ll n) {
    map<ll, int> ret;
    for (ll i = 2; i * i <= n; i++) {
        while (n % i == 0) {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1)
        ret[n] = 1;
    return ret;
}

int main() {
    ll n;
    cin >> n;
    map<ll, int> mp = prime_factor(n);

    vector<int> sum(50);
    int cnt = 0, now = 1;
    for (int i = 1; i < 50; ++i) {
        sum[i] = now;
        ++cnt;

        if (cnt - 1 == now) {
            ++now;
            cnt = 0;
        }
    }

    int ans = 0;
    for(auto &p:mp){
        ans += sum[p.second];
    }

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

Measured memory_bytes: 3628
# coding: utf-8
# hello worldと表示する
#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial,sqrt
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

def ceiler(a,b):
    return -((-a)//b)
n,k=MI()
costs=LI()
difs=LI()
costs.sort()
difs.sort(reverse=True)
lis=[0 for i in range(n)]
#print(costs)
#print(difs)
for i in range(n):
    lis[i]=costs[i]*difs[i]
#print(lis)
def judge(x):
    times=0
    for i in range(n):
        u=ceiler(lis[i]-x,difs[i])
        times+=max(0,u)
        #print(u)
    #print(x,times<=k)
    return times<=k
l,r=-1,10**13
while l+1<r:
    mid=(l+r)//2
    if judge(mid):
        r=mid
    else:
        l=mid
print(r)
    
    

    


    
 




Measured memory_bytes: 115804
#include <bits/stdc++.h>
using namespace std; typedef long double ld; typedef long long ll;
typedef unsigned long long ull;
#define endl "\n"
#define MP make_pair
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORR(x,arr) for(auto& x:arr)
#define VI vector<int>
#define PII pair<int, int>
#define FI first 
#define SE second
#define ALL(x) (x).begin(), (x).end()
const int INF=1<<30; const ll LINF=1LL<<60 ; const ll mod=1e9+7 ;
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; }
//-------------------
string s;
ll a[100000+5];
ll b[100000+5][13];

int main(){
	cin >> s;
	int n = s.size();
	a[0] = 1;
	FOR(i,1,100000){
		a[i] = (a[i-1] * 10) % 13;
	}
	
	FOR(i,0,n-1){
		int idx = n-1-i;
		ll c = int(s[idx]) - int('0');
		if(s[idx] != '?'){
			ll cur = (a[i] * c) % 13;
			if(i>=1){
				FOR(j,0,12){
					b[i][(cur+j)%13] = b[i-1][j];
				}
			}else{
				b[i][cur] = 1; 
			}
		}else{
			FOR(j,0,9){
				ll cur = (a[i] * j) % 13;
				if(i>=1){
					FOR(k,0,12){
						b[i][(cur+k)%13] += b[i-1][k];
						b[i][(cur+k)%13] %= mod;
					}
				}else{
						b[i][cur] += 1;
						b[i][cur] %= mod;

				}
			}
		}
		/* 
		FOR(j,0,12){
			cout << b[i][j] << ' ';
		}
		cout << endl;
		*/
	}
	cout << (b[n-1][5])%mod << endl;
	
    return 0;
}


Measured memory_bytes: 11392
#include<stdio.h>
int main()
{
    int i;

    char st[19];
    scanf("%s",st);
    for(i=0;i<19;i++)
    {
        if((97<=st[i]<=122)|| (st[i]==','))
            continue;
        else
            return 0;
    }
    st[5]=' ';
    st[13]=' ';
    printf("%s\n",st);
    return 0;
}


Measured memory_bytes: 128
from sys import stdin

def main():
    plus, minus = [], []
    readline = stdin.readline
    n = int(readline())
    for _ in range(n):
        s = readline().rstrip()
        if 2 * s.count('(') - len(s) > 0:
            plus.append(s)
        else:
            minus.append(s)
    plus.sort(key = lambda x: x.count(')'))
    minus.sort(key = lambda x: x.count('('), reverse = True)
    plus.extend(minus)

    sum = 0
    for v in ''.join(plus):
        sum = sum + (1 if v == '(' else -1)
        if sum < 0 : return print('No')
    if sum != 0:
        return print('No')

    return print('Yes')

if __name__ == '__main__':
    main()


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

int main() {
  int A,B,C;
  cin >> A >> B >> C;
  string output = "NO";
  
  if (A == 5 && B == 5 && C == 7) {
    output = "YES";
  } else if (A == 5 && B == 7 && C == 5) {
    output = "YES";
  } else if (A == 7 && B == 5 && C == 5) {
    output = "YES";
  }
  
  cout << output << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>  
using namespace std; 
class gfg 
{ 
 public : long long gcd(long long a, long long b){ 
    if (a == 0) 
        return b;  
    return gcd(b % a, a);  
 }  
  long long lcm(long long a, long long b)  
 {  
    return (a*b)/gcd(a, b);  
 }  
} ;   
int main()  
{  
    gfg g;
    long long a,b;
    cin>>a>>b;
    cout<<g.lcm(a, b);  
    return 0;  
}  

Measured memory_bytes: 256
//https://atcoder.jp/contests/abc116/tasks/abc116_c
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
#ifdef BTK
#define DEBUG if(1)
#else
#define CIN_ONLY if(1)
struct cww {cww() {CIN_ONLY{ios::sync_with_stdio(false); cin.tie(0);}}}star;
#define DEBUG if(0)
#endif
#define ALL(v) (v).begin(),(v).end()
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l, T r){bool a = l>r; if (a)l = r; return a;}
template <typename T>inline bool chmax(T &l, T r){bool a = l<r; if (a)l = r; return a;}
template <typename T>istream& operator>>(istream &is, vector<T> &v){for (auto &it : v)is >> it;return is;}
class reverse_range {private:struct I {int x;int operator*() {return x-1;}bool operator!=(I& lhs) {return x>lhs.x;}void operator++() {--x;}};I i, n;public:reverse_range(int n) :i({ 0 }), n({ n }){}reverse_range(int i, int n) :i({ i }), n({ n }){}I& begin() {return n;}I& end() {return i;}};
class range {private: struct I { int x; int operator*() { return x; }bool operator!=(I& lhs) { return x<lhs.x; }void operator++() { ++x; } }; I i, n;public:range(int n) :i({ 0 }), n({ n }) {}range(int i, int n) :i({ i }), n({ n }) {}I& begin() { return i; }I& end() { return n; }reverse_range operator!(){return reverse_range(*i,*n);}};


int main(){
    int ret=0;
    int N;
    cin>>N;
    int b=0;
    for(int i:range(N)){
        int a;
        cin>>a;
        ret+=a;
        ret-=min(a,b);
        b=a;
    }
    cout<<ret<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{int k ;
cin>>k;
    string s;
cin>>s;

for(int i = 0 ;i<min(k,int(s.length())) ; i++)
cout<<s[i];
if(s.length()>k)
cout<<"...";
cout<<endl;

}

Measured memory_bytes: 3636
#include <stdio.h>
int main(){
  int n, count, ac=0, wa=0, tle=0, re=0;
  char string[10];
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%s", &string);
    if (strcmp(string, "AC")==0) ac+=1;
    if (strcmp(string, "WA")==0) wa+=1;
    if (strcmp(string, "TLE")==0) tle+=1;
    if (strcmp(string, "RE")==0) re+=1;
  }
  printf("AC x %d\n", ac);
  printf("WA x %d\n", wa);
  printf("TLE x %d\n", tle);
  printf("RE x %d\n",re);
  return 0;
}


Measured memory_bytes: 1696
///Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>

#define                           int                         long long
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<int,int>
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);




using namespace std;

const int inf=1e18;
const int mod=998244353;
const int M=1000009;
inline int bigmod(int B,int P){int R=1;while(P>0){if(P&1){R=(R*B)%mod;}P>>=1;B=(B*B)%mod;}return R;}
inline int gun(int x,int y)
{
    int ret=(x*y)%mod;
    if(ret<0)ret+=mod,ret=ret%mod;
    return ret;
}
inline int ad(int x,int y)
{
    int ret=(x+y)%mod;
    if(ret<0)ret+=mod,ret=ret%mod;
    return ret;
}
inline int sub(int x,int y)
{
    int ret=(x-y+mod)%mod;
    if(ret<0)ret+=mod,ret=ret%mod;
    return ret;
}
int cnt[M+4];
int fd[M+4];
 main()

{
    fast
    int n,x;
    cin>>n;
    f(i,1,n)
    {
        cin>>x;
        cnt[x]++;
    }
    int ses=0;
    rf(d,M,1)
    {
        int s1=0,s2=0,gd=0;
        for(int kd=d;kd<=M;kd+=d)
        {
            s1=ad(s1,gun(cnt[kd],kd));
            s2=ad(s2,gun(cnt[kd],gun(kd,kd)));
            fd[d]=sub(fd[d],fd[kd]);
        }
        gd=gun(sub(gun(s1,s1),s2),bigmod(2LL,mod-2));
        fd[d]=ad(fd[d],gd);
        ses=ad(ses,gun(fd[d],bigmod(d,mod-2)));
    }
    cout<<ses<<endl;
    return 0;

}













Measured memory_bytes: 15872
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string N = Console.ReadLine();
            int f = 0;
            for(int i = 0; i < N.Length; i++)
            {
                f += int.Parse(N.Substring(i, 1));
            }
            if (int.Parse(N) % f == 0)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }

        }
    }
}
// 文字列の入力
//string s = Console.ReadLine();

// 整数の入力
//long n = long.Parse(Console.ReadLine());

// 文字列配列の入力
//string[] inputStrArray = Console.ReadLine().Split(' ');

// 整数配列の入力
//long[] inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();

//Console.WriteLine(ans);

Measured memory_bytes: 27556
#include<bits/stdc++.h>
#include<cxxabi.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define mp make_pair
#define fi first
#define se second
#define All(x) (x).begin(),(x).end()
#define TYPEVS(x) typeid(x).name()
#define TYPEGC(x) abi::__cxa_demangle(typeid(x).name(), 0, 0, 0)
#define Y1 "YES"
#define N1 "NO"
#define ENDL '\n'
#define count2(x) _builtin_popcount(x)
ll ans,sum;
ll nums[200001];
ll numans[200001];
int main(){
	ll n; 
	cin>>n;
	for(ll i=0;i<=n;++i){
		cin>>nums[i];
		sum+=nums[i];
	}
	ll lp=1;
	for(ll i=0;i<=n;++i){
		if(nums[i]>lp){
			cout<<-1;
			return 0;
		}
		numans[i]=lp;
		if(lp<=sum)
		lp=(lp-nums[i])*2;
	}
	for(ll i=n;i>=0;--i){
		nums[i]+=nums[i+1];
		if(nums[i]<numans[i])
		numans[i]=nums[i];
		ans+=numans[i];
	}
	cout<<ans;
}


Measured memory_bytes: 5172
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};

#[allow(unused_imports)]
use std::io::Write;

fn main() {
    input!{
      n: usize,
    }
    let mut tmp = n;
    let mut x = 0;
    while tmp > 0 {
        x += tmp%10;
        tmp /= 10;
    }
    if n%x == 0 {
        println!("{}", "Yes");
    } else {
        println!("{}", "No");
    }
}


Measured memory_bytes: 4352
#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, ll> 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 double pi = 3.14159265358979;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  double a, b;
  cin >> a >> b;

  double h, m;
  cin >> h >> m;

  double da, db;

  da = (2 * pi * 30 * h / 360.0) + (2 * pi * m / 720.0);
  db = 2 * pi * m / 60;

  if(da > db){
    swap(da, db);
  }

  double th = 0.0;
  if(db - da > pi){
    th = 2 * pi - (db - da);
  }else{
    th = db - da;
  }

  double ans;

  ans = sqrt(a*a + b*b - 2 * a * b * cos(th));

  cout << setprecision(16) << ans << endl;



  

  return 0;
}


Measured memory_bytes: 4240
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll MOD = 1000000007;

int main(){
    int N;
    cin >> N;
    int c = 0;
    vector<int> s(N);
    for(int i=0;i<N;i++){
        cin >> s[i];
        c += s[i];
    }
    sort(s.begin(), s.end());
    if(c % 10 == 0){
        bool ok = false;
        for(int i=0;i<N;i++){
            if(s[i] % 10 != 0){
                c -= s[i];
                ok = true;
                break;
            }
        }
        if(!ok){
            c = 0;
        }
    }
    cout << c << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int d = sc.nextInt();
		
		double[] x = new double[n];
		double[] y = new double[n];
		
		for(int i = 0; i < n; i++){
			x[i] = sc.nextDouble();
			y[i] = sc.nextDouble();
		}
		
		int count = 0;
		for(int i = 0; i < n; i++){
			if((Math.sqrt((x[i]*x[i]) + (y[i]*y[i]))) <= d){
				count++;
			}
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 67640
def eval(i, tmp, a)
  if tmp[i] == 1
    a[i].each do |aa|
      index = aa[0] - 1
      if tmp[index] == nil
        tmp[index] = aa[1]
        eval(index, tmp, a)
      elsif tmp[index] != aa[1]
        raise "mujun"
      end
    end
  end
end

n = gets.to_i

a = Array.new(n).map{|_| Array.new}

(0...n).each do |i|
  ai = gets.to_i
  (1..ai).each do |_|
    a[i] << gets.chomp.split.map(&:to_i)
  end
end

ans = 0
(0...n).each do |i|
  tmp = Array.new(n)
  tmp[i] = 1
  begin
    eval(i, tmp, a)
    while tmp.select{|j| j.nil?}.length > 0 do
      index = tmp.find_index{|j| j.nil?}
      tmptmp = tmp.clone
      begin
        tmptmp[index] = 1
        eval(index, tmptmp, a)
      rescue RuntimeError
        tmptmp = tmp.clone
        tmptmp[index] = 0
      end
      tmp = tmptmp
    end
    honests = tmp.select{|j| j == 1}.length
    ans = [ans, honests].max
  rescue RuntimeError
  end
end

p ans

Measured memory_bytes: 1788
import sys
N,M=map(int,input().split())
edge=[]
for i in range(M):
    a,b,c=map(int,input().split())
    edge.append([a-1,b-1,-c])
inf=10**30
dist=[inf]*N
dist[0]=0
for i in range(N):
    for x,y,z in edge:
        if dist[y]<= dist[x]+z:
            continue
        dist[y]=dist[x]+z
ans = dist[N-1]
visit=[False]*N
for i in range(N):
    for x,y,z in edge:
        if visit[x]:
            visit[y]=True
        if dist[y]<= dist[x]+z:
            continue
        visit[y]=True
        dist[y]=dist[x]+z
        
if visit[N-1]:
    print('inf')
else:
    print(-ans)

Measured memory_bytes: 47192
# coding: utf-8
# Your code here!
a,b=map(int,input().split())
S=[i for i in input()]
l=[]

#print(S[a])
cnt=0
if S[a]=='-':
    del S[a]
    for u in S:
        if u=='-':
            print('No')
            break
        else:
            cnt+=1
            if cnt==len(S):
                print('Yes')
else:
    print('No')

Measured memory_bytes: 38256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define f(i,a,n) for(ll i=a;i<n;i++)
#define w(_t) ll _t;cin>>_t;while(_t--)
ll md=1000000007;
ll dfs(vector<vector<ll>> &g,bool vis[],ll src){
    ll ct=1;
    vis[src]=true;
    for(ll v:g[src]){
        if(vis[v]==false){
            ct+=dfs(g,vis,v);
        }
    }
    return ct;
}

int main() {
    ios::sync_with_stdio(false);cin.tie(0);
    ll ans=0,n,m;cin>>n>>m;
    vector<vector<ll>> g(n);
    ll u,v;
    f(i,0,m){
        cin>>u>>v;
        g[u-1].push_back(v-1);
        g[v-1].push_back(u-1);
    }
    bool vis[n];
    f(i,0,n) vis[i]=false;
    f(i,0,n){
        if(vis[i]==false){
            ans=max(ans,dfs(g,vis,i));
        }
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 23760
#include<bits/stdc++.h>
using namespace std;
struct node
{
	string s;
	int t;
	node(string &ss,int tt=1)
	{
		s=ss;
		t=tt;
	}
	bool operator<(const node &p)const
	{
		if(t==p.t)return s<p.s;
		else return t>p.t;
	}
};
vector<node>v;
map<string,int>mp;
int main()
{
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	while(n--)
	{
		string s;
		cin>>s;
		if(!mp.count(s))
		{
			v.push_back(node(s));
			int id=mp.size();
			mp[s]=id;
		}
		else v[mp[s]].t++;
	}
	sort(v.begin(),v.end());
	for(int i=0;i<v.size();i++)
	{
		if(v[i].t==v[0].t)
		{
			cout<<v[i].s<<endl;
		}
	}
}

Measured memory_bytes: 27628
import sys
input = sys.stdin.readline

def main():
    n = int(input())
    alst = list(map(float, input().split()))
    dp = [[[0 for _ in range(n + 1)] for _ in range(n + 1)] for _ in range(n + 1)]
    one = alst.count(1)
    two = alst.count(2)
    three = alst.count(3)
    for k in range(three + 1):
        for j in range(two + three + 1):
            if k + j > n:
                continue
            for i in range(n + 1):
                if k + j + i > n:
                    continue
                ijk = i + j + k
                if ijk == 0:
                    continue
                tmp = n
                if i != 0:
                    tmp += dp[i - 1][j][k] * i
                if j != 0 and i != n:
                    tmp += dp[i + 1][j - 1][k] * j
                if k != 0 and j != n:
                    tmp += dp[i][j + 1][k - 1] * k
                dp[i][j][k] = tmp / ijk
    
    print(dp[one][two][three])


main()

Measured memory_bytes: 410380
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k;
    cin>>n>>k;
    vector<int> h(n);
    for(int i=0;i<n;i++) cin>>h[i];
    vector<int> dp(n);
    dp[0]=0;
     for(int i=1;i<n;i++){
            dp[i]=INT_MAX;
        for(int j=i-1;j>=max(0,i-k);j--){
            dp[i]=min(dp[i],dp[j]+abs(h[i]-h[j]));
        }
     }
     cout<<dp[n-1]<<"\n";
}


Measured memory_bytes: 4024
#include <bits/stdc++.h>
using namespace std;
 
#define N (int)1e3+5
#define f1 first
#define s2 second
#define INF 9999999
#define pb push_back
#define ll long long
#define mod (int)1e9+7
#define ull unsigned long long;
#define all(a) a.begin(),a.end()
#define fri(a) freopen(a,"r",stdin);
#define fro(a) freopen(a,"w",stdout);

ll n,m,ans[N][N];
char c;
bool flag1=1,flag2=1;

int main(){
	//fri("in.txt");
//	fro("out.txt");
	cin>>n>>m;
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			cin>>c;
			if((i==0 || j==0) && c=='.'){
				if(flag1==0 && i==0){
					ans[i][j]=-1;
				}
				else if(flag2==0 && j==0){
					ans[i][j]=-1;
				}
				else ans[i][j]=1;
			}
			else if(c=='#'){
				if(i==0){
					flag1=0;
				}
				if(j==0){
					flag2=0;
				}
				ans[i][j]=-1;
			}
		}
	}
	for(int i=1;i<n;i++){
		for(int j=1;j<m;j++){
			if((ans[i-1][j]==-1 && ans[i][j-1]==-1) || ans[i][j]==-1)ans[i][j]=0;
			else if(ans[i][j-1]==-1){
				ans[i][j]=ans[i-1][j];
			}
			else if(ans[i-1][j]==-1){
				ans[i][j]=ans[i][j-1];
			}
			else ans[i][j]=ans[i-1][j]+ans[i][j-1];
			ans[i][j]%=mod;
			//cout<<ans[i][j]<<" ";
		}
		//cout<<endl;
	}
	cout<<ans[n-1][m-1];

	return 0;
}

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

int main() {
  int n;
  int d[110];
  cin >> n;
  for(int i=0 ;i<n ;i++){
    cin >> d[i];
  }
  sort(d,d+n);
  cout << d[n-1] - d[0] << endl;
}

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

using namespace std;

#define st first
#define nd second
#define ALL(x) (x).begin(), (x).end()

template <class T>
void mini(T& l, T r) {
  l = min(l, r);
}
template <class T>
void maxi(T& l, T r) {
  l = max(l, r);
}

using LL = long long;
using LD = long double;
using ULL = unsigned long long;
const int dx[] = {0, -1, 1, 0, -1, -1, 1, 1},
          dy[] = {-1, 0, 0, 1, -1, 1, -1, 1};
const int INF = 1e9;
const LL MOD = 1e9 + 7;


int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, k;
  LL res = 1;
  vector<LL> pos, neg;
  LL x;
  cin >> n >> k;
  bool hasZero = false;
  for (int i = 0; i < n; i++) {
    cin >> x;
    if (x == 0) {
      hasZero = true;
    } else if (x > 0) {
      pos.emplace_back(x);
    } else {
      neg.emplace_back(x);
    }
  }
  int pi = 0, ni = 0;
  int pn = pos.size(), nn = neg.size();
  LL tp, tn;
  if (hasZero && (pn + nn < k)) {
    cout << 0 << '\n';
  } else {
    int r = k - pn;
    if (r > 0 && r & 1) r += 1;
    if ((pn == 0 && k & 1) || (r > 0 && r > nn)) {
      if (hasZero) {
        cout << 0 << '\n';
        return 0;
      }
      sort(ALL(pos));
      sort(ALL(neg), greater<LL>());
      if (k & 1) {
        res = neg[ni];
        ni += 1;
        k -= 1;
      }
      while (k > 0) {
        if (pi + 2 > pn && ni + 2 > nn) {
          tp = (pos[pi] * neg[ni]) % MOD;
          res = (res * tp) % MOD;
        } else if (pi + 2 > pn) {
          tn = (neg[ni] * neg[ni + 1]) % MOD;
          res = (res * tn) % MOD;
          ni += 2;
        } else if (ni + 2 > nn) {
          tp = (pos[pi] * pos[pi + 1]) % MOD;
          res = (res * tp) % MOD;
          pi += 2;
        } else {
          tp = (pos[pi] * pos[pi + 1]);
          tn = (neg[ni] * neg[ni + 1]);
          if (tp < tn) {
            tp %= MOD;
            res = (res * tp) % MOD;
            pi += 2;
          } else {
            tn %= MOD;
            res = (res * tn) % MOD;
            ni += 2;
          }
        }
        k -= 2;
      }
    } else {
      sort(ALL(pos), greater<LL>());
      sort(ALL(neg));
      if (k & 1) {
        res = pos[pi];
        pi += 1;
        k -= 1;
      }
      while (k > 0) {
        if (pi + 2 > pn && ni + 2 > nn) {
          tp = (pos[pi] * neg[ni]) % MOD;
          res = (res * tp) % MOD;
        } else if (pi + 2 > pn) {
          tn = (neg[ni] * neg[ni + 1]) % MOD;
          res = (res * tn) % MOD;
          ni += 2;
        } else if (ni + 2 > nn) {
          tp = (pos[pi] * pos[pi + 1]) % MOD;
          res = (res * tp) % MOD;
          pi += 2;
        } else {
          tp = (pos[pi] * pos[pi + 1]);
          tn = (neg[ni] * neg[ni + 1]);
          if (tp > tn) {
            tp %= MOD;
            res = (res * tp) % MOD;
            pi += 2;
          } else {
            tn %= MOD;
            res = (res * tn) % MOD;
            ni += 2;
          }
        }
        k -= 2;
      }
    }
    if (res < 0) res += MOD;
    cout << res << '\n';
  }
  return 0;
}

Measured memory_bytes: 5500
import sys
import collections


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    n = int(input().rstrip('\n'))
    a = list(map(int, input().rstrip('\n').split()))
    d = collections.defaultdict(int)
    d[-1] = 3
    cnt = 1
    for v in a:
        cnt *= d[v-1]
        d[v] += 1
        d[v-1] -= 1
        cnt %= mod
    print(cnt)


if __name__ == '__main__':
    solve()


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

int main() {
  int n;
  int m;
  cin >> n;
  
  m = (n % 10);
  
  if(m == 2 || m == 4 || m == 5 || m == 7 || m == 9){
    cout << "hon" << endl;
  }else if(m == 0 || m == 1 || m == 6 || m == 8 ){
    cout << "pon" << endl;
  }else{
    cout << "bon" << endl;
  }
 
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long n,p;
  string s;
  cin >> n;
  pair<pair<string, long long>, int> pa[n];
  for(int i=0;i<n;i++){
    cin >> s >> p;
    pa[i]=make_pair(make_pair(s, -p), i+1);
  }
  sort(pa, pa+n);
  for(int i=0;i<n;i++){
    cout << pa[i].second << endl;
  }
  return 0;
}


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

int main() {
	vector<int> v;
	int temp;
	while (1) {
		scanf("%d", &temp);
		if (temp == 0) break;
		v.push_back(temp);
	}

	for (int i = 0; i < v.size(); i++) {
		printf("Case %d: %d\n", i+1, v[i]);
	}

	return 0;
}

Measured memory_bytes: 3208
#!usr/bin/env python3
from collections import defaultdict
import math
def LI(): return list(map(int, input().split()))
def II(): return int(input())
def LS(): return input().split()
def S(): return input()
def IIR(n): return [II() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
mod = 1000000007

#A
t,x = LI()
print(t/x)
#B

#C

#D

#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T


Measured memory_bytes: 3828
#include<iostream>
using namespace std;
int main(){
	int t1=0,t2=0,t3=0,T=0;
	for(int i=0;i<10;i++){
		cin>>T;
		if(T>=t1){
			t3=t2;
			t2=t1;
			t1=T;
		}
		else if(T>=t2){
			t3=t2;
			t2=T;
		}
		else if(T>=t3){
			t3=T;
		}
	}
	cout<<t1<<endl<<t2<<endl<<t3<<endl;
	return 0;
}

Measured memory_bytes: 3044
using System;

namespace E
{
    class Program
    {
        static void Main(string[] args)
        {
            var NML = Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
            var N = NML[0]; var M = NML[1]; var L = NML[2];
            var fuel = new long[N + 1, N + 1];
            for (int i = 0; i < N + 1; i++) for (int j = 0; j < N + 1; j++) fuel[i, j] = i != j ? long.MaxValue : 0;
            for (int i = 0; i < M; i++)
            {
                var abc = Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
                fuel[abc[0], abc[1]] = abc[2];
                fuel[abc[1], abc[0]] = abc[2];
            }
            for (int via = 1; via < N + 1; via++)
            {
                for (int from = 1; from < N + 1; from++)
                {
                    for (int to = 1; to < N + 1; to++)
                    {
                        if (fuel[via, from] == long.MaxValue || fuel[to, via] == long.MaxValue) continue;
                        if (fuel[from, to] > fuel[from, via] + fuel[via, to])
                        {
                            fuel[from, to] = fuel[from, via] + fuel[via, to];
                        }
                    }
                }
            }

            var resuplly = new int[N + 1, N + 1];
            for (int i = 0; i < N + 1; i++)
            {
                for (int j = 0; j < N + 1; j++)
                {
                    resuplly[i, j] = fuel[i, j] <= L ? 0 : int.MaxValue;
                }
            }

            for (int via = 1; via < N + 1; via++)
            {
                for (int from = 1; from < N + 1; from++)
                {
                    for (int to = 1; to < N + 1; to++)
                    {
                        if (resuplly[from, via] == int.MaxValue || resuplly[via, to] == int.MaxValue) continue;
                        if (resuplly[from, to] > resuplly[from, via] + resuplly[via, to] + 1)
                        {
                            resuplly[from, to] = resuplly[from, via] + resuplly[via, to] + 1;
                        }
                    }
                }
            }

            var Q = int.Parse(Console.ReadLine());
            for (int i = 0; i < Q; i++)
            {
                var st = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
                Console.WriteLine(resuplly[st[0], st[1]] != int.MaxValue ? resuplly[st[0], st[1]] : -1);
            }

        }
    }
}

Measured memory_bytes: 18004
#include<bits/stdc++.h>
#define LL long long
using namespace std;
int main(){
	LL n,m;
	while(~scanf("%lld %lld",&n,&m)){
		LL x=m*1900+(n-m)*100;
		while(m--){
			x*=2;
		}
		printf("%lld\n",x);
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
    #define int long long
    using namespace std;
    int N,ans=1e18 ;
    int m[222222];
    int ABS(int x){return x>0?x:-x;}
    int diff(int a, int b, int c,int d){
        if(a&&b&&c&&d){
            int r=0;
            r = max(r, ABS(a-b));
            r = max(r, ABS(a-c));
            r = max(r, ABS(a-d));
            r = max(r, ABS(b-c));
            r = max(r, ABS(b-d));
            r = max(r, ABS(c-d));
            return r;
        }
        return 1e18;
    }
    signed main(){
        cin>>N;
        for(int i=1;i<=N;i++){
            int x;
            cin>>x;
            m[i]=m[i-1]+x;
        }
        for(int i=1;i<=N;i++){
            auto p = lower_bound(m+1, m+i+1, m[i]/2); 
            auto q = lower_bound(m+i+1, m+N+1, (m[N]+m[i])/2); 
            int a,b,c,d;
            a = *p;
            b = m[i] - *p;
            c = m[N] - *q;
            d = *q - m[i];
            ans=min(ans,diff(a,b,c,d));
            a = *(p-1);
            b = m[i] - *(p-1);
            c = m[N] - *q;
            d = *q - m[i];
            ans=min(ans,diff(a,b,c,d));
            a = *p;
            b = m[i] - *p;
            c = m[N] - *(q-1);
            d = *(q-1) - m[i];
            ans=min(ans,diff(a,b,c,d));
            a = *(p-1);
            b = m[i] - *(p-1);
            c = m[N] - *(q-1);
            d = *(q-1) - m[i];
            ans=min(ans,diff(a,b,c,d));
        }
        cout<<ans<<'\n';
    }

Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		sc.nextLine();

		String[] datastr = sc.nextLine().split(" ");
		int[] a = new int[n];
		for (int i=0; i < n; i++) {
			a[i] = Integer.parseInt(datastr[i]);
		}

		int count = 0;

		for (int i=0; i < n; i++) {
			for (int j = n-1; i+1 <= j; j--) {

				if (a[j-1] > a[j]) {
					int temp = a[j];
					a[j] = a[j-1];
					a[j-1] = temp;
					count++;
				}

			}
		}

		for (int i=0; i < n-1; i++) {
			System.out.print(a[i] + " ");
		}
		System.out.println(a[n-1]);
		System.out.println(count);

	}

}

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

using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;
#define DEBUG freopen("in.txt", "r", stdin);

struct fastio {
    fastio() {
        ios::sync_with_stdio(false);
        cout << setprecision(10) << fixed;
        cin.tie(0);
    }
};

fastio _fast_io;

const int N = 1e5 + 5;
int n, k, t;
unordered_set<int> st;
bool check(int x) {
    while (x) {
        int a = x % 10;
        if (st.count(a)) return false;
        x /= 10;
    }
    return true;
}

int main() {
    cin >> n >> k;
    for (int i = 0; i < k; ++i) {
        cin >> t;
        st.insert(t);
    }
    int i = n;
    while (1) {
        if (check(i)) {
            cout << i << endl;
            exit(0);
        }
        ++i;
    }

    return 0;
}


Measured memory_bytes: 3616
#include<iostream>
using namespace std;
 
int main(){
  int a,b,c;
  cin>>a>>b>>c;
  bool S=false;
  if(a==7 && b==5 && c==5) S=true;
  if(a==5 && b==7 && c==5) S=true;
  if(a==5 && b==5 && c==7) S=true;
  if(S) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

class Graph{
	private:
	int n;
	vvp g;
	public:
	int DIJ(int s,int t){
		priority_queue<P> q;
		vi d(n,inf);
		d[s]=0;
		q.push({0,s});
		while(!q.empty()){
			P p=q.top();
			q.pop();
			int v=p.second;
			if(d[v]<-p.first) continue;
			for(auto i:g[v]){
				int u=i.first,D=d[v]+i.second;
				if(d[u]>D){
					d[u]=D;
					q.push({-D,u});
				}
			}
		}
		return d[t];
	}
	Graph(int v){
		n=v;
		g=vvp(v);
	}
	void add_edge(int s,int t,int c){
		g[s].push_back({t,c});
	}
};

int n,m,t;

int main(){
	while(1){
		cin>>n>>m>>t;
		if(!n) break;
		t++;
		Graph g(n*t);
		for(int i=0;i<m;i++){
			int u,v,c,d;
			cin>>u>>v>>c>>d;
			u--;v--;
			for(int j=0;j<t;j++){
				g.add_edge(u*t+j,v*t+j,d);
				g.add_edge(v*t+j,u*t+j,d);
				if(j>=c){
					g.add_edge(u*t+j,v*t+j-c,0);
					g.add_edge(v*t+j,u*t+j-c,0);
				}
			}
		}
		for(int i=0;i<n;i++) for(int j=t-1;j>0;j--) g.add_edge(i*t+j,i*t+j-1,0);
		cout<<g.DIJ(t-1,n*t-t)<<endl;
	}
}


Measured memory_bytes: 8640