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

typedef long long ll;
const ll INF = 1LL  << 50;
int main() {
  int n, m;
  cin >> n >> m;
  int nmax = 1000, mmax = 2000;
  vector<ll> a(m), b(m), c(m);
  for(int i=0;i<m;i++) {
    cin >> a[i] >> b[i] >> c[i];
    c[i] = -c[i];
  }
  vector<ll> dist(n);

  for(int i=0;i<n;i++) {
    dist[i] = INF;
  }
  dist[0] = 0;
  for(int loop=0;loop<n-1;loop++) {
    for(int i=0;i<m;i++) {
      if(dist[a[i]-1] == INF) continue;

      if(dist[b[i]-1] > dist[a[i]-1] + c[i])
        dist[b[i]-1] = dist[a[i]-1] + c[i];
    }
  }

  ll ans = dist[n-1];

  vector<bool> negative(n, false);
  for(int loop=0;loop<n-1;loop++) {
    for(int i=0;i<m;i++) {
      if(dist[a[i]-1] == INF) continue;
      if(dist[b[i]-1] > dist[a[i]-1]+c[i]) {
        dist[b[i]-1] = dist[a[i]-1] + c[i];
        negative[b[i]-1] = true;
      }

      if(negative[a[i]-1])
        negative[b[i]-1] = true;
    }
  }

  if(negative[n-1])
    cout << "inf" << endl;
  else
    cout << -dist[n-1] << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct point{double x;double y;};
int i,j,k,count1=0,count2=0;

int main(void){
    int n;
    cin>>n;
    vector<int> vec(n);
    for(i=0;i<n;i++){
        cin>>vec[i];
    }
    for(i=0;i<n;i++){
        if(i==(vec[vec[i]-1]-1)){
            count1++;
        }
    }
    cout<<count1/2<<endl;
}

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

int main() {
    string s;
    cin >> s;
    int mes1 = (int) (s[6] - '0');
    int mes2 = (int) (s[5] - '0');
    if (mes1 > 4 || mes2) cout << "TBD" << '\n';
    else cout << "Heisei" << '\n';
    return 0;
}

Measured memory_bytes: 3600
def resolve():
    N = int(input())
    XY = []
    for _ in range(N):
        XY.append(list(map(int, input().split())))
    import itertools
    import math
    total = 0
    for order in itertools.permutations(list(range(N))):
        posx, posy = XY[order[0]]
        dist = 0
        for i in range(1, N):
            nxtx, nxty = XY[order[i]]
            dist += math.sqrt((nxtx-posx)**2+(nxty-posy)**2)
            posx, posy = nxtx, nxty
        total += dist
    print(total/math.factorial(N))
    

    
if '__main__' == __name__:
    resolve()

Measured memory_bytes: 74032
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i < n + 1; i++)
#define PI 3.14159265359
#define EPS 0.0000000001
#define MOD 1000000007
//cout << std::fixed << std::setprecision(15) << y << endl;


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

    ll l[M + 1];
    REP(i, M){
        l[i] = 0;
    }

    ll K;
    ll A;
    rep(i, N){
        cin >> K;
        rep(j, K){
            cin >> A;
            l[A]++;
        }
    }

    ll ans = 0;
    REP(i, M){
        if(l[i] == N){
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3620
//#include <bits/stdc++.h>
//#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>


#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LLINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979
#define MAXI 7500000

using namespace std;
typedef long long int ll;
typedef pair< long long int, long long  int> P;
typedef string::const_iterator State;

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


int main(void) {

	double n, m, d;

	cin >> n >> m >> d;

	if (d == 0) {
		printf("%.10lf\n", (m - 1) / n );
	}
	else {
		printf("%.10lf\n", 2 * (n - d)*(m - 1) / n / n);
	}

	return 0;
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

using ll = long long;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using P = pair<int, int>;

void Main(){
    int n, k; string s; cin >> n >> k >> s;
    s[k-1] -= int('A' - 'a');
    cout << s << endl;
	return;
}

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


Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define rev(i,n,a) for(ll i=n-1;i>=a;i--)
#define f first
#define s second
#define vll vector<ll>
#define vvll vector<vector<ll>>
#define vpii vector<pair<int,int>>
#define vpll vector<pll>
#define pll pair<ll,ll>
#define secreterror() ios_base::sync_with_stdio(false);cin.tie(NULL);

void solve(){

    ll n;
    cin>>n;

    vector<ll>arr(n);

    map<ll,ll>mp;
    ll sum=0;
    rep(i,0,n){
        cin>>arr[i];
        mp[arr[i]]++;
        sum+=arr[i];
    }
    ll q;
    cin>>q;

    while(q--){
        ll a,b;
        cin>>a>>b;

        if(mp.find(a)!=mp.end()){
            sum-=mp[a]*a;
            sum+=mp[a]*b;

            if(mp.find(b)==mp.end()){
                mp[b]=mp[a];
            }
            else
            {
                mp[b]+=mp[a];
            }

            mp.erase(a);
            

        }
        cout<<sum<<endl;
    }
    
}


int main()
{
    secreterror()
    // ll t;
    // cin>>t;
    //while(t--){
        solve();
        
    //}

}

Measured memory_bytes: 7888
while True:
    try:
        s=input()
    except:
        break
    (a,b)=(0,0)
    for i in range(len(s)-2):
        if (s[i],s[i+1],s[i+2])==("J","O","I"):
            a+=1
        if (s[i],s[i+1],s[i+2])==("I","O","I"):
            b+=1
    print(a)
    print(b)


Measured memory_bytes: 5568
# from functools import lru_cache

n = int(input())


# @lru_cache(maxsize=None)
# def dp(num, typ, mod=10 ** 9 + 7):
#     print(num, typ)
#     if num == 1:
#         if typ == 1:  # contain 0 not 9
#             return 1
#         elif typ == 2:  # contain 9 not 0
#             return 1
#         elif typ == 3:  # not contain
#             return 8
#         elif typ == 0:
#             return 0

#     if typ == 0:
#         return (dp(num - 1, 1) + dp(num - 1, 2) + dp(num - 1, 0) * 10) % mod
#     elif typ == 1:  # contain 0 not 9
#         return (dp(num - 1, 1) * 9 + dp(num - 1, 3)) % mod
#     elif typ == 2:  # contain 9 not 0
#         return (dp(num - 1, 2) * 9 + dp(num - 1, 3)) % mod
#     elif typ == 3:  # not contain
#         return (dp(num - 1, 3) * 8) % mod


# print(dp(n, 0))

dp = [[0 for j in range(4)] for i in range(n + 1)]

mod = 10 ** 9 + 7
for i in range(1, n + 1):
    for j in range(4):
        if j == 0:
            dp[i][j] = (dp[i - 1][0] * 10 + dp[i - 1][1] + dp[i - 1][2]) % mod
            if i == 1:
                dp[i][j] = 0
        elif j == 1:
            dp[i][j] = (dp[i - 1][1] * 9 + dp[i - 1][3]) % mod
            if i == 1:
                dp[i][j] = 1
        elif j == 2:
            dp[i][j] = (dp[i - 1][2] * 9 + dp[i - 1][3]) % mod
            if i == 1:
                dp[i][j] = 1
        elif j == 3:
            dp[i][j] = (dp[i - 1][3] * 8) % mod
            if i == 1:
                dp[i][j] = 8

print(dp[n][0])



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

int main()
{
    int n, m;
    cin >> n >> m;
    string s[102];
    for(int i = 0; i < n; i++) cin >> s[i];
    for(int i = 0; i < n; i++) cout << s[i] << endl << s[i] << endl;
}


Measured memory_bytes: 3600
#include<cstdio>
#include<iostream>
#include<queue>
#include<vector>
#include<functional>
#include<map>
using namespace std;

int main(){
  int n;
  cin >> n;
  int x, l;
  
  priority_queue<int, vector<vector<int>>, function<bool(vector<int>,vector<int>)>>q(  
    [](vector<int> a,vector<int> b){return a[1] > b[1];}
  );
  
  for(int i=0;i<n;++i){
    cin >> x >> l;
    q.push({x-l,x+l});
  }
  
  int num=0;
  int last = -15e8;
  while(q.empty()==false){
    //cout << last << " " << q.size() << endl;
    while(q.top()[0] < last){
      q.pop();
      if(q.empty()) break;
    }
    if(q.empty()) break;
    num++;
    last = q.top()[1];
    q.pop();
  }

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

Measured memory_bytes: 6836
#include <stdio.h>
#include <string.h>

int main(void)
{
    int W, H;
    char buf[16], row[301];
    memset(row, '#', 300);
    row[300] = 0;

    while (1)
    {
        fgets(buf, 16, stdin);
        sscanf(buf, "%d %d", &H, &W);
        if (!(W | H)) break;
        row[W] = 0;
        while (H)
        {
            printf("%s\n", row);
            --H;
        }
        row[W] = '#';
        printf("\n");
    }
    return 0;
}



Measured memory_bytes: 2028
//
// Write a program which prints multiplication tables in the following format:
//
#include <iostream>
using namespace std;

static const int EndRecursion = 9;

void inner(int left_side, int right_side)
{
    if (EndRecursion < right_side)
        return;

    cout << left_side << "x" << right_side << "=" << (left_side * right_side) << endl;
    inner(left_side, right_side + 1);
}

void outer(int left_side)
{
    if (EndRecursion < left_side)
        return;

    inner(left_side, 1);
    outer(left_side + 1);
}

void run()
{
    outer(1);
}

int main()
{
    // Start QQ
    run();
}

Measured memory_bytes: 3052
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {
	int n, a, b; cin >> n >> a >> b;

	int ans = min(n*a, b);
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define ss second
#define ff first
#define INF 30000000000001
#define ll_max 9000000000000000001
#define mod 1000000007
#define PI 3.14159265358979323846L
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
typedef vector<pair<ll,ll> > vll;
typedef vector<pair<int,int> > vii ;
typedef pair<ll,ll> pll;
const ll N = 100001;
const ll M = 1;

int main()
{
    fast;
    int _ = 1;
    //cin >> _;
    while(_--)
    {
        ll n, m = 0, x = 0, y = 0, ans = 0;
        cin >> x >> n;
        ll a[n], b[n];
        ll p[x + 1];
        for(int i = 0; i < x; i++) p[i] = INF;
        p[x] = 0;
        for(int i = 0; i < n; i++)
        {
            cin >> a[i] >> b[i];
        }
        for(int i = x; i > -1; i--)
        {
            for(int j = 0; j < n; j++)
            {
                y = max(0ll, i - a[j]);
                p[y] = min(p[i] + b[j], p[y]);
            }
        }
        ans = p[0];
        cout << ans << "\n";
    }
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define lli long long int
#define tc int t;cin>>t;while(t--)
#define all(x) x.begin(),x.end()
#define f first
#define s second
#define pb push_back
#define vi vector<int>
#define vll vector<lli>
#define maxn 1771562
#define mod 1000000007
#define inf 10000000



int main()
{
    fastio;
    int n;
    cin>>n;
    string s;
    cin>>s;
    int fr=0,fw=0;
    for(int i=0;i<n;i++){
        if(s[i]=='R') fr++;
        else fw++;
    }
    int c1=0,c2=0;
    for(int i=0;i<fr;i++)
    {
        if(s[i]=='W') c1++;
    }
    for(int i=fr;i<n;i++){
        if(s[i]=='R') c2++;
    }
    cout<<min(c1,c2)<<"\n";
    return 0;
}


Measured memory_bytes: 3756
#include<iostream>
#define REP1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define REPN(i, n, m) for (int i = (int)(n); i <= (int)(m); ++i)

using namespace std;

int main() {
  int n, x;
  while (cin >> n >> x) {
    if (n == 0 && x == 0) break;
    int ans = 0;
    REP1(i, n) {
      REPN(j, i + 1, n) {
        REPN(k, j + 1, n) {
          if (i + j + k == x) ++ans;
        }
      }
    }
    cout << ans << endl;
  }
}


Measured memory_bytes: 3080
def makelist(n, m):
    return [[0 for _ in range(m)] for _ in range(n)]

# n
# a, b = 
# s = input()


N = int(input())
H = [0] + list(map(int, input().split()))

t = H[1] - 1
ans = "Yes"
for i in range(2, N+1):
    now = H[i]
    if t > now:
        ans = "No"
        break
    else:
        t = max(t, now-1)
print(ans)



Measured memory_bytes: 14396
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

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

typedef long long ll;

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

    return 0;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define NMAX 100005

using namespace std;
typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    ll cnt=0,n,x,y;
    cin>>n;
    while(n--){
        cin>>x>>y;
        if(x==y){
            cnt++;
            if(cnt==3){
                cout<<"Yes";
                return 0;
            }
        }
        else cnt=0;
    }
    cout<<"No";
    return 0;
}


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

const long long INF = 1LL << 60;

int N,W;
int N_MAX = 100, W_MAX = 1000000000, V_SUM_MAX = 100000;
vector<int> w(N_MAX), v(N_MAX);
vector<vector<long long>> dp(N_MAX + 1,vector<long long>(V_SUM_MAX + 1,INF));
 
int main(){
    cin >> N >> W;
    for(int i = 0;i < N;i++) cin >> w[i] >> v[i];

    dp[0][0] = 0;
    for(int i = 0;i < N;i++){
        for(int j = 0;j <= V_SUM_MAX;j++){
            if(j < v[i])
                dp[i+1][j] = dp[i][j];
            else
                dp[i+1][j] = min(dp[i][j],dp[i][j-v[i]] + w[i]);
        }
    }
    int ans = V_SUM_MAX;
    while(dp[N][ans] > W) ans--;
    cout << ans << endl; 
}


Measured memory_bytes: 80256
import java.util.Scanner;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		while(true){
			int t = sc.nextInt();
			if(t == 0)break;
			int n = sc.nextInt();
			for(int i = 0; i < n; i++)
				t = t + sc.nextInt() - sc.nextInt();
			
			if(t <= 0)System.out.println("OK");
			else System.out.println(t);
		}sc.close();
		}
}

Measured memory_bytes: 23568
#include<stdio.h>:
int main()
{
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    int temp=a;
    a=c;
    c=b;
    b=temp;
    printf("%d %d %d\n",a,b,c);
    return 0;

}


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

using namespace std;

long long int dp[100005][105];

pair<int,int>jinis[105];

void init(){
 memset(dp,-1,sizeof(dp));
}

long long solve(int wleft, int cur, int n){
 if(cur==n){
  	return 0;
 }
 if(dp[wleft][cur]!=-1)return dp[wleft][cur];
 long long ret1 = 0, ret2 = 0;
  if(jinis[cur].first<=wleft){
   	ret1 = (long long)jinis[cur].second + solve(wleft-jinis[cur].first,cur+1,n);
  }
  ret2 = solve(wleft, cur+1, n);
  return dp[wleft][cur] = max(ret1,ret2);
}

int main(){
  int n,w;
  cin>>n>>w;
  for(int i = 0; i<n; ++i){
   cin>>jinis[i].first>>jinis[i].second;
  }
  init();
  cout<<solve(w,0,n)<<"\n";
  return 0;
}

Measured memory_bytes: 82304
/*
given H and A

find if can use all A once to reduce health to zero

10 3
4 5 6

Yes



*/

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

using ll = long long; 

const int mod = 1e9+7;

int add(int a, int b) {
    int c = a + b;
    if (c >= mod) {
        c -= mod;
    }
    return c;
}


int main() {
    int H, N;
    scanf("%d%d", &H, &N);
    int S = 0;
    for (int i = 0; i < N; i++) {
        int num;
        scanf("%d", &num);
        S += num;
    }
    if (S >= H) {
        printf("Yes");
    }
    else {
        printf("No");
    }
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n, k, a[1000000], pos, ans = 0;

int main(){
    cin >> n >> k;
    for (int i = 1; i <= n; i++){
        cin >> a[i];
        if (a[i] == 1) pos = i;
    }
    if ((n-1)%(k-1) == 0) cout << (n-1)/(k-1);
  	else cout << (n-1)/(k-1)+1;
}

Measured memory_bytes: 640
import java.util.*;
import java.lang.*;
import java.util.stream.*;

public class Main {
    public static void main(String[] args) {
        //コード
        Scanner scanner = new Scanner(System.in);
        Integer kuchi = Integer.parseInt(scanner.next());
        Integer mishiyou_kuchi = Integer.parseInt(scanner.next());

        Integer i = 0;
        for(;;) {
            Integer total = kuchi * i;
            if ( i >  1) total = (kuchi * i) - (i - 1);

            if (1 == mishiyou_kuchi) {
                System.out.println(0);
                break;
            }else if (kuchi > mishiyou_kuchi) {
                System.out.println(1);
                break;
            }else if(total >= mishiyou_kuchi) {
                System.out.println(i);
                break;
            }
            i++;
        }
    }
}

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

void solve(std::istream &in, std::ostream &out);

int main() {
#ifdef LOCAL
  freopen("../IO/f.in", "r", stdin);
//  freopen("../IO/f.out", "w", stdout);
#else
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  std::cout.tie(nullptr);
#endif
  solve(std::cin, std::cout);
  return 0;
}

struct point_t {
  int x, y;
  point_t() = default;
  point_t(int x, int y) : x(x), y(y) {}
  int quad() const {
    return y > 0 || (y >= 0 && x >= 0);
  }
  int64_t abs2() const {
    return (int64_t) x * x + (int64_t) y * y;
  }
  int64_t dot(point_t rhs) const {
    return (int64_t) x * rhs.x + (int64_t) y * rhs.y;
  }
  int64_t det(point_t rhs) const {
    return (int64_t) x * rhs.y - (int64_t) y * rhs.x;
  }
};

struct PolarAngleComparator {
  bool operator()(point_t a, point_t b) const {
    int c1 = a.quad(), c2 = b.quad();
    if (c1 != c2) {
      return c1 > c2;
    }
    auto orientation = a.det(b);
    if (orientation == 0) {
      return a.abs2() < b.abs2();
    } else {
      return orientation > 0;
    }
  }
};

void solve(std::istream &in, std::ostream &out) {
  int n;
  in >> n;
  vector<point_t> points(n);
  for (point_t &point : points) {
    in >> point.x >> point.y;
  }
  sort(points.begin(), points.end(), PolarAngleComparator());
  for (int i = 0; i < n; ++i) {
    points.push_back(points[i]);
  }
  int64_t result = 0;
  int64_t sx = 0, sy = 0;
  for (int r = 0, l = 0; l < 2 * n; ++l) {
    if (points[l%n].x==0&&points[l%n].y==0)continue;
    while (r - l < n && (points[l % n].det(points[r % n]) > 0 ||
                         (points[l % n].det(points[r % n]) == 0 && points[l % n].dot(points[r % n]) >= 0))) {
      sx += points[r % n].x;
      sy += points[r % n].y;
      ++r;
      result = max(result, sx * sx + sy * sy);
    }
    sx -= points[l % n].x;
    sy -= points[l % n].y;
    result = max(result, sx * sx + sy * sy);
  }
  out << fixed << setprecision(12) << sqrt(result) << '\n';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fname "C"
#define ll long long
#define ui unsigned int
#define ull unsigned long long
#define bug(x) cerr << (#x) << " = " << (x) << '\n'
#define REP0(i, n) for(int i = 0, _n = (n); i < _n; ++i)
#define REP1(i, n) for(int i = 1, _n = (n); i <= _n; ++i)
#define REPB0(i, n) for(int i = (n) - 1; i >= 0; --i)
#define REPB1(i, n) for(int i = (n); i > 0; --i)
#define FOR(i, a, b) for(int i = (a), _b = (b); i <= _b; ++i)
#define FORB(i, a, b) for(int i = (a), _b = (b); i >= _b; --i)
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define X first
#define Y second

using namespace std;
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
typedef pair<float, float> ff;
typedef pair<double, double> dd;
int n, bin[20];
ll ans = 0;
string s;
void gen(int i = 0)
{
	if (i == n - 1) {
		ll sum = 0;
		string a;
		REP0(i, n - 1) {
			a.pb(s[i]);
			if (bin[i] == 1) {
				sum += stoll(a);
				a.clear();
			}
		}
		a.pb(s[n - 1]);
		ans += sum + stoll(a);
	}
	else {
		bin[i] = 0;
		gen(i + 1);
		bin[i] = 1;
		gen(i + 1);
	}
}

int main()
{
	if (fopen(fname".INP", "r")) {
		freopen(fname".INP", "r", stdin);
		freopen(fname".OUT", "w", stdout);
	}
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> s;
	n = s.size();
	gen();
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
from itertools import product
from collections import Counter, defaultdict
#input = sys.stdin.readline
def inpl(): return list(map(int, input().split()))

X, Y = inpl()
s = defaultdict(int)
s[1] = 300000
s[2] = 200000
s[3] = 100000
print(s[X] + s[Y] + 400000*(X==Y==1))

Measured memory_bytes: 38472
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

bool is_kaibun(string s){
    bool res = true;
    for(int i=0; i < s.size() / 2; i++){
        if(s[i] != s[s.size() - 1 - i]) res = false;
    }
    return res;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b;
    cin >> a >> b;
    int ans = 0;
    rep(i, a, b + 1){
        string s = to_string(i);
        if(is_kaibun(s))
            ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7 # 998244353
input=lambda:sys.stdin.readline().rstrip()
def resolve():
    a, b, n = map(int,input().split())
    def f(x):
        return (a * x) // b - a * (x // b)

    if n < b:
        print(max(f(x) for x in range(max(0, n - 3), n + 1)))
    else:
        print(max(f(x) for x in range(max(0, b - 3), b + 1)))
resolve()

Measured memory_bytes: 61784
use std::io;
use std::cmp;

// read a line(without line feed)
fn read_line() -> String {
    let mut in_str = String::new();
    io::stdin().read_line(&mut in_str).unwrap();
    return in_str.trim().to_string();
}

// read wods on a line
pub fn read_words_in_line() -> Vec<String> {
    let s = read_line();
    return s.split_whitespace().map(|x| x.to_string()).collect::<Vec<String>>()
}

// read type t on a line
pub fn read_t_in_line<T : std::str::FromStr>() -> Vec<T> {
    let mut v : Vec<T> = Vec::new();
    for e in read_words_in_line().iter().map(|x| x.parse::<T>()) {
        if let Ok(r) = e {
            v.push(r);
        }
        else{
            return Vec::new();
        }
    }
    return v;
}

// sort slice
pub fn sort<T : std::cmp::Ord>(slice : &mut [T]) {
    slice.sort();
}
// sort slice by reverse order
pub fn sort_rev<T : std::cmp::Ord>(slice : &mut [T]) {
    slice.sort_by(|x, y| y.cmp(x));
}

pub fn min<T : std::cmp::Ord>(a : T, b : T) -> T{
    return cmp::min(a, b);
}

pub fn max<T : std::cmp::Ord>(a : T, b : T) -> T{
    return cmp::max(a, b);
}

fn main() {
    let l = read_t_in_line::<usize>();
    let (h, w) = (l[0], l[1]);
    let a : Vec<Vec<i32>> = (0..h).map(|_| read_t_in_line::<i32>()).collect();
    let mut ans = vec![];
    let mut end = vec![];
    for r in 0..h {
        let mut m = vec![];
        for c in 0..w {
            if a[r][c] % 2 == 1 {
                m.push(c);
            }
        }
        // indexを+2ずつ増やしていく
        // もし要素が最後に残ったら、その要素は
        let mut i = 0;
        while i + 1 < m.len() {
            let from_r = m[i + 0];
            let to_r   = m[i + 1];
            for j in from_r..to_r {
                ans.push((j, r, j + 1, r));
            }
            i += 2;
        }
        if m.len() % 2 == 1 {
            let last = *m.last().unwrap();
            for j in last..(w-1) {
                ans.push((j, r, j + 1, r));
            }
            end.push(r);
        }
    }

    let mut i = 0;
    while i + 1 < end.len() {
        let from_c = end[i + 0];
        let to_c   = end[i + 1];
        for j in from_c..to_c {
            ans.push((w - 1, j, w - 1, j + 1));
        }
        i += 2;
    }

    println!("{}", ans.len());
    for (x1, y1, x2, y2) in ans {
        println!("{} {} {} {}", y1 + 1, x1 + 1, y2 + 1, x2 + 1);
    }

}


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

using namespace std;

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

    string s,t;
    cin>>s>>t;

    int ans=0;

    for(int i=0;i<t.length();i++){
        if(s[i]!=t[i]) ans++;
    }
    cout<<ans;

    return 0;
}


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


int main()
{
    string s,t;
    cin>>s>>t;
    while(t.size()>=s.size())
    {
        if(s==t)
        {
            cout<<"Yes"<<endl;
            return 0;
        }
        t.pop_back();
    }
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
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 INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	string s;
	pair<int,int> ans=mp(-1,-1);
	cin >>s;
	pair<char,int> last1=mp('=',-1),last2=mp('=',-1);
	rep(i,s.size()){
		if(last1.F == s[i] ){
			ans=mp(last1.S,i+1);
			break;
		}else if(last2.F == s[i]){
			ans=mp(last2.S,i+1);
			break;
		}else{
			last1=last2;
			last2=mp(s[i],i+1);
		}
	}
	cout<<ans.F <<" "<<ans.S<<endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define incl(v,x) find(rng(v),x)!=v.end()
#define incls(s,c) s.find(c)!=string::npos
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bit(n,k) ((n>>k)&1) // nのk bit目
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
using vt = vector<T>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
//const ll INF = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
//inline int in() { int x; scanf("%d",&x); return x;}
template<class T = int> inline T in() { T x; cin >> x; return (x);}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main () {
  int n;
  string s;
  cin >> n >> s;
  ll ans = 0;
  for (int i = 0; i <= 999; ++i) {
    string t = to_string(i);
    if (t.size() != 3) t = string(3-t.size(), '0') + t;
    auto it0 = find(rng(s),t[0]);
    auto it1 = find(it0+1,s.end(),t[1]);
    auto it2 = find(it1+1,s.end(),t[2]);
    //show3(it0-s.begin(),it1-s.begin(),it2-s.begin());
    if (it2 != s.end()) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 384
#include<iomanip>
#include <string>
#include<iostream>
#include<vector>
#include <bits/stdc++.h>
#include <stdio.h>
#include <numeric>
#include<math.h>
#include <ctype.h>
#include <algorithm> // sort
#include <map> // pair
using namespace std;
#define nin(n) int n; cin >> n;
#define kin(k) int k; cin >> k;
const int INF = 1001001001;
int main(){
 int n; cin >> n;
  long long sum=0;
  vector<long long> a(n);
  vector<long long> b(n);
  for(int i=0;i<n;i++){
    cin >> a.at(i);
    sum+=a.at(i);
  }
  long long even=0;
  for(int i=1;i<=n-1;i+=2){
    sum=sum-a.at(i)*2;
  }
  b.at(0)=sum;
  for(int i=1;i<n;i++){
    b.at(i)=2*a.at(i-1)-b.at(i-1);
  }
  for(int i=0;i<n;i++){
    cout << b.at(i) << " ";
  }
}
  
    

Measured memory_bytes: 2816
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

k, x = MAP()

l = []


# l.append(x+1)
# l.append(x)
# l.append(x-1)
# for j in range(x):
for i in range(k):
    # print(x-i)
    # print(x+i)
    l.append(x-i)
    l.append(x+i)
    # l.append(x-i)
l.sort()
s = set(l)
l = list(s)
# print(l)
l.sort()
# print(l)
# s = ",".join(l)
# print(s)
s_l = []

for i in l:
    s_l.append(str(i))
    s_l.append(" ")
print("".join(s_l))

# for i in l:
#     print(i)
# s = "".join(l)
# print()
# print(l.join(","))
# for i in range(l)
# print(l)

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

int main() {
	int n, h, w;
	cin >> n >> h >> w;
	vector<int> hh(n);
	vector<int> ww(n);

	for (int i = 0; i < n; i++) {
		cin >> hh.at(i);
		cin >> ww.at(i);
	}

	int count;

	for (int i = 0; i < n; i++) {
		if (h <= hh.at(i) && w <= ww.at(i)) {
			count++;
		}
	}

	cout << count << endl;
}


Measured memory_bytes: 256
#include<stdio.h>

int main()
{
	int x,y;
	int box1,box2;
	int amari=0;
	int ans;


	scanf("%d",&x);
	scanf("%d",&y);

	if(x<=y)
	{
		box1=x;
		x=y;
		y=box1;
	}

    while(1)
    {
	   	amari=x%y;
	    x=y;
	    y=amari;
	       	if(amari==0)
	    		break;
    }

printf("%d\n",x);

}


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

typedef long long ll;
using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int a[n], b[n], c[n-1];
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        a[i]--;
    }
    for (int i = 0; i < n; i++) cin >> b[i];
    for (int i = 0; i < n-1; i++) cin >> c[i];
    int ans = 0;
    int prev = -1;
    for (auto& aa: a) {
        ans += b[aa];
        if (prev >= 0 && prev + 1 == aa) {
            ans += c[prev];
        }
        prev = aa;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>
#include <climits>
#include <iterator>
#include <iomanip>
#include <stack>
#include <set>
#include <cstdio>
#include <bitset>
#include <functional>
#include <tuple>
#include <list>
#include <deque>
#include <sstream>
using namespace std;
typedef pair<int, int> P;

#define FOR(i, a, n) for (ll i = (ll)a; i<(ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)

typedef long long ll;
typedef vector<int> VI;
int GCD(int a, int b){
    if(b==0) return a;
    return GCD(b, a%b);
}
int H, W;
int main() {
    while(cin>>H>>W, H||W){
        vector<string> field;
        bool check[H][W];
        for(int i=0; i<H; ++i){
            for(int j=0; j<W; ++j){
                check[i][j]=false;
            }
        }
        cin.ignore();
        for(int i=0; i<H; ++i){
            string str; getline(cin, str);
            field.push_back(str);
        }
        int x=0, y=0;
        while(1){
            check[y][x]=true;
            
            if(field[y][x]=='.'){
                cout << x << " " << y << endl;
                break;
            }
            if(field[y][x]=='>') {
                if(check[y][x+1]) {
                    cout << "LOOP" << endl;
                    break;
                }
                x++; continue;
            }
            if(field[y][x]=='v'){
                if(check[y+1][x]) {
                    cout << "LOOP" << endl;
                    break;
                }
                y++; continue;
            }
            if(field[y][x]=='^'){
                if(check[y-1][x]) {
                    cout << "LOOP" << endl;
                    break;
                }
                y--; continue;
            }
            if(field[y][x]=='<'){
                if(check[y][x-1]) {
                    cout << "LOOP" << endl;
                    break;
                }
                x--; continue;
            }
        }
        
    }
	return 0;
}


Measured memory_bytes: 3176
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>
#include<map>

using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
using P=pair<int,int>;
using lint=long long;
using ll=long long;
const lint inf=1e18+7;
const int MOD=1000000007;

signed main(){
  int h,w,k;cin>>h>>w>>k;
  vector<int> x(2);
  vector<int> y(2);
  rep(i,2){
    cin>>y[i]>>x[i];
  }
  vector<string> c(h);
  rep(i,h)cin>>c[i];
  vector<vector<int>> memo(h+2,vector<int>(w+2,inf));
  memo[y[0]][x[0]]=0;
  queue<P> que;
  que.push({y[0],x[0]});
  while(!que.empty()){
    P buf=que.front();que.pop();
    for(int i=1;i<=k;++i){
      if(i+buf.second>w)break;
      int nxt=buf.second+i;
      if(c[buf.first-1][nxt-1]=='@')break;
      if(memo[buf.first][nxt]>memo[buf.first][buf.second]+1){
        memo[buf.first][nxt]=memo[buf.first][buf.second]+1;
        que.push({buf.first,nxt});
      }
      else if(memo[buf.first][nxt]<=memo[buf.first][buf.second])break;
    }
    for(int i=1;i<=k;++i){
      if(buf.second-i<1)break;
      int nxt=buf.second-i;
      if(c[buf.first-1][nxt-1]=='@')break;
      if(memo[buf.first][nxt]>memo[buf.first][buf.second]+1){
        memo[buf.first][nxt]=memo[buf.first][buf.second]+1;
        que.push({buf.first,nxt});
      }
      else if(memo[buf.first][nxt]<=memo[buf.first][buf.second])break;
    }
    for(int i=1;i<=k;++i){
      if(buf.first-i<1)break;
      int nxt=buf.first-i;
      if(c[nxt-1][buf.second-1]=='@')break;
      if(memo[nxt][buf.second]>memo[buf.first][buf.second]+1){
        memo[nxt][buf.second]=memo[buf.first][buf.second]+1;
        que.push({nxt,buf.second});
      }
      else if(memo[nxt][buf.second]<=memo[buf.first][buf.second])break;
    }
    for(int i=1;i<=k;++i){
      if(buf.first+i>h)break;
      int nxt=buf.first+i;
      if(c[nxt-1][buf.second-1]=='@')break;
      if(memo[nxt][buf.second]>memo[buf.first][buf.second]+1){
        memo[nxt][buf.second]=memo[buf.first][buf.second]+1;
        que.push({nxt,buf.second});
      }
      else if(memo[nxt][buf.second]<=memo[buf.first][buf.second])break;
    }
  }
  int res=memo[y[1]][x[1]];
  if(res==inf)res=-1;
  cout<<res<<"\n";
  return 0;
}

Measured memory_bytes: 35652
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vs = vector<string>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vvp = vector<vector<pair<int,int>>>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;
template<typename T> bool chmax(T &a, T b) {if(a < b) {a = b;return 1;}return 0;}
template<typename T> bool chmin(T &a, T b) {if(a > b) {a = b;return 1;}return 0;}




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

    
    int a,b;
    cin >> a >> b;
    cout << a*b << endl;
    
    

    return 0;
}


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

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

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//infinity
#define INTINF 2000000000
#define LONGINF 2000000000

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main(){
	long long N;
	cin >> N;
	long long t = N;
	long long s = 0;
	while(t != 0){
		s += t%10;
		t /= 10;
	}
	if(N%s == 0){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
r, c = map(int, input().split())

a, btm = [], []

for i in range(r):
    a.append(list(map(int, input().split())))
    a[i].append(sum(a[i]))
    print(*a[i])

rotate = list(zip(*a))
for i in range(len(rotate)):
    btm.append(sum(rotate[i]))

print(*btm)



Measured memory_bytes: 5812
#include <bits/stdc++.h>
#define BIT(n) (1LL << (n))
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPB(i, n) for (int i = 0; i < BIT(n); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORA(i, n) for (auto &&i : n)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define DEBUG(x) cerr << #x << ": " << x << "\n"
#define ALL(v) v.begin(), v.end()
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define epb emplace_back
#define int long long
using namespace std;
template < class T > using vec = std::vector< T >;
template < class T > void print(T &x) { cout << x << "\n"; }
typedef long long ll;
const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI = acos(-1.0);
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
  cin.tie(0), ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  int N, M, Q;
  cin >> N >> M >> Q;
  vec< vec< int > > G(N + 1, vec< int >(N + 1, 0));
  vec< vec< int > > sumG(N + 1, vec< int >(N + 1, 0));
  REP(i, M) {
    int p, q;
    cin >> p >> q;
    G[p][q]++;
  }
  REPS(i, N) {
    REPS(j, N) {
      sumG[i][j] =
          sumG[i][j - 1] + sumG[i - 1][j] - sumG[i - 1][j - 1] + G[i][j];
    }
  }
  /*REP(i, N + 1) {
    REP(j, N + 1) { cout << sumG[i][j] << " "; }
    cout << "\n";
  }*/
  REP(i, Q) {
    int p, q;
    cin >> p >> q;
    int ans = sumG[q][q] - sumG[p - 1][q] - sumG[q][p - 1] + sumG[p - 1][p - 1];
    print(ans);
  }
  // print();
}

Measured memory_bytes: 4864
from bisect import bisect_right

N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

A.sort()
B.sort()
C.sort()

Bcnt = [0]*(N+1)
idx = N
for i in range(N-1,-1,-1):
    idx = bisect_right(C,B[i],hi=idx)
    Bcnt[i] = N-idx+Bcnt[i+1]

ans = 0
idx = 0
for i in range(N):
    idx = bisect_right(B,A[i],lo=idx)
    ans += Bcnt[idx]

print(ans)

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

const int INF = 1e9+7; 

int main(){
    int n,k;cin>>n>>k;
    vector<int> nums(n);
    for(int i=0;i<n;i++) cin>>nums[i];
    vector<int> dp(n,INF);
    dp[0] = 0;
    for(int i=1;i<dp.size();i++){
    	for(int j=1;j<=k;j++){
    		if(i-j>=0) dp[i] = min(dp[i],abs(nums[i]-nums[i-j])+dp[i-j]);
    	}
    }
    cout<<dp[n-1]<<endl;
}

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

int main() {
    int A[200000] = {};
    int N;
    cin >> N;
    std::set<int> st;
    for(int i = 1; i < N; i++){
        int t;
        cin >> t;
        A[t-1]++;
    }
    for(int i = 0; i < N; i++){
        cout << A[i] << endl;
    }
}


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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()
#define endl "\n"

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

  int N,K;
  cin>>N>>K;
  vector<ll>sum(N+1,0);
  for(int i=1;i<=N;i++)sum[i]+=(i+sum[i-1])%MOD;
  ll ans=0;
  for(int i=K-1;i<=N;i++){
    if(i==N)ans++;
    else ans=((ans+sum[N]-sum[N-i-1]-sum[i]+1)%MOD+MOD)%MOD;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 4768
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
#include <iomanip>
#include <numeric>
#include <functional>
#include <queue>
#include <tuple>
#include <map>

using namespace std;

using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using ll = long long;
using vll = vector<ll>;
using pii = pair<int, int>;
using vb = vector<char>;
using vvb = vector<vb>;

#define REP(i, a, b) for (int i = a; i < (int)(b); i++)
#define RREP(i, a, b) for (int i = (int)(b) - 1; i >= a; i--)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) RREP(i, 0, n)
#define all(x) (x).begin(),(x).end()
#define iter(c) __typeof((c).begin())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define mp(a, b) make_pair(a,b)

#define fi first
#define sn second
#define decpii(p) p.fi--,p.sn--;


#ifdef LOCAL
#define dump(c) cerr << "> " << #c << " = " << (c) << endl;
#define dumpn(c) cerr << "> " << #c << " = " << (c) << ", ";
#else
#define dump(c) ;
#define dumpn(c) ;
#endif


template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
    return os << '(' << p.first << ',' << p.second << ')';
}

template<typename T>
ostream &operator<<(ostream &os, const vector<T> &a) {
    os << '[';
    rep(i, (int) a.size())os << (i ? " " : "") << a[i];
    return os << ']';
}

const int INF = 1 << 29;

int dxf[] = {1, 0, -1, 0};
int dyf[] = {0, -1, 0, 1};

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

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

inline vi uni(vi &vec) {
    sort(vec.begin(), vec.end());
    vec.erase(std::unique(vec.begin(), vec.end()), vec.end());
    return vec;
}

struct ____ {
    ____() {
        cin.tie(0);
        ios::sync_with_stdio(0);
        cout << fixed << setprecision(20);
    };
} ________;


ll solve() {
    ll X, Y;
    cin >> X >> Y;

    int res = 0;
    for(; X <= Y; res++,X*=2) ;

    return res;
}

int main() {
//    cout << (solve() ? "Yes" : "No") << endl;
    cout << solve() << endl;
//    solve();
    return 0;
}


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

int main() {
    int n;
    string s;
    cin>>s;
    n = s.size();
    string ans = s;
    if(s[n-1]=='s') {
        ans+="es";
    }
    else  {
        ans+="s";
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3632