akhauriyash/Code-Regression huggingface dataset:
n = gets.to_i
arr = Array.new
n.times do
   arr << [gets.to_i, gets.to_i]
end

arr.each do |i|
   sum = i[0] + i[1]
   if sum.to_s.split("").length > 80
      puts "overflow"
   else
      puts sum
   end
end

Measured memory_bytes: 6144
S = input()
if S == 'SUN':
  print('7')
elif S == 'MON':
  print('6')
elif S == 'TUE':
  print('5')
elif S == 'WED':
  print('4')
elif S == 'THU':
  print('3')
elif S == 'FRI':
  print('2')
elif S == 'SAT':
  print('1')
else :
  pass

Measured memory_bytes: 2940
from heapq import heappush, heappop

n, m = map(int, input().split())
jobs = []
for i in range(n):
    a, b = map(int, input().split())
    jobs.append([a, b])

jobs = sorted(jobs, key=lambda x:x[0])

hq = []
res, j = 0, 0
for i in range(1, m + 1):
    while j < n and jobs[j][0] <= i:
        heappush(hq, -jobs[j][1])
        j += 1
    if len(hq) > 0:
        res += -heappop(hq)
print(res)

Measured memory_bytes: 84056
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
using namespace std;
typedef long long ll;
typedef pair<int, int> P; 
const int inf = 1<<21;
const ll INF = 1LL << 60;
const ll mod = 1e9+7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<string> s(n);
    rep(i, n) cin >> s[i];
    map<string, int> mp;
    rep(i, n){
        mp[s[i]]++;
    }
    int maxcnt = 0;
    for(const auto& i : mp){
        chmax(maxcnt, i.second);
    }

    for(const auto& i: mp){
        if(i.second == maxcnt){
            cout << i.first << endl;
        }
    }
    
    return 0;
}

Measured memory_bytes: 25472
#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define MOD 1000000007
#define MAX 510000
#define rrep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define dcout cout<<fixed<<setprecision(15);

using namespace std;
typedef long long int  ll;
typedef pair<int, int> P;


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

//a^n mod p//
ll modpow(ll a, ll n, ll p) {
  if (n == 1) return a % p;
  if (n % 2 == 1) return (a * modpow(a, n - 1, p)) % p;
  ll t = modpow(a, n / 2, p);
  return (t * t) % p;
}

//inversemod//
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//Cmonp//
ll fac[MAX], finv[MAX], inv[MAX];
// 
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 
ll COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

//LARGE n
ll com(ll n,ll m){
    if(n<m || n<=0 ||m<0){
		return 0;
	}
	if( m==0 || n==m){
		return 1;
	}
	ll k=1;
	for(ll i=1;i<=m;i++){
       k*=(n-i+1); 
	   k%=MOD;
	   k*=modinv(i,MOD);
	   k%=MOD;
	}
	return k;
}

//radP
ll rad(ll u, ll p){
ll cnt=0;
	while(u%p==0){
		u/=p;
		cnt++;
	}
	return cnt;
}


////////////////////////////////////////////////////////////////////

int main() {
ll n;
cin>>n;
ll t[n+1];
ll a[n+1];
rep(i, n){
cin>>t[i];
a[i]=t[i];
}
t[0]=0;
a[0]=0;

ll dp[n+1];
ll dpwa[200005];
rep(i, n){
	dp[i]=0;
	if(i>=2){
		if(t[i]==t[i-1]){
			a[i]=-1;
		}
	}
}
rep(i,200004){
dpwa[i]=0;
}
dp[0]=1;


rep(i, n){
if(i==1){dp[1]=1; dpwa[a[i]]=1; continue;}

	dp[i]=dp[i-1];
	if(a[i]!=-1 && dpwa[t[i]]==0){
		dpwa[a[i]]=i;
		continue;
	}

if(dpwa[a[i]]>0 && a[i]!=-1){
	dp[i]=dp[i-1]+dp[dpwa[a[i]]];
dpwa[t[i]]=i;
}

dp[i]%=MOD;

}

cout<<dp[n]<<endl;



return 0;
}




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

using namespace std;

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

int N = 100000;
bool is_prime[100000];
void set_prime() {
    memset(is_prime, true, N);
    is_prime[0] = is_prime[1] = false;
    REP(i, 2, sqrt(N)) {
        if(is_prime[i]) {
            for(int j=0; i*(j+2)<N; j++) {
                is_prime[i*(j+2)] = false;
            }
        }
    }
}

int main() {
    int m, a, b;
    set_prime();
    while(cin>>m>>a>>b, m+a+b) {
        int c = 0, p, q, pp, qq;
        for(p=2; p<m; p++) {
            if(!is_prime[p] || m/p<2) continue;
            for(q = m/p; q>=p; q--) {
                if(!is_prime[q] || a*q>b*p) continue;
                if(p*q > c) {c = p*q; pp = p; qq = q;};
            }
            if((double)p/q<(double)a/b) continue;
        }
        cout << pp << " " << qq << endl;
    }
}


Measured memory_bytes: 3084
#include <stdio.h>

int main(void)
{
	int a, b, c;
	int i, total;

	scanf("%d %d %d", &a, &b, &c);

	total = 0;

	for (i = a; i <= b; i++){
		if (c % i == 0){
			total = total + 1;
		}
	}
	printf("%d\n", total);

	return (0);
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, M;//展望台、道
  cin >> N >> M;
  vector<long long> H(N);
  for (int i = 0; i < N; i++) {
    cin >> H.at(i);
  }
  vector<vector<long long>> miti(N);// N×0の二次元配列
  for (int i = 0; i < M; i++) {
    int a,b;
    cin >> a >> b;
    miti.at(a-1).push_back(H.at(b-1));
    miti.at(b-1).push_back(H.at(a-1));
  }
  int result = 0;
  for (int i = 0; i < N; i++) {
    int l = 0;
    l = miti.at(i).size();
    //cout << l << endl;
    if (l == 0) {
      result += 1;
      continue;
    }
    int j = 0;
    while(true) {
      if (H.at(i) <= miti.at(i).at(j)) {
        break;
      }
      if (j == l-1) {
        result += 1;
        break;
      }
      j += 1;
    }
  }
  cout << result << endl;
}

Measured memory_bytes: 9848
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<ll, ll>;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio;
#ifdef DEBUG
#include "../program_contest_library/memo/dump.hpp"
#else
#define dump(...)
#endif
const ll INF = 1LL<<60;

int main(void) {
    ll n;
    cin >> n;
    vector<vector<ll>> g(n);
    REP(i, n-1) {
        ll a;
        cin >> a;
        a--;
        g[i+1].push_back(a);
        g[a].push_back(i+1);
    }

    auto dfs = [&](auto &&self, ll v, ll p) -> ll {
        vector<ll> ch;
        for(auto to: g[v]) if(to != p) {
            ll t = self(self, to, v);
            ch.push_back(t);
        }
        sort(ALL(ch));
        ll now = 0;
        for(auto i: ch) now = max(now+1, i+1);
        return now;
    };
    cout << dfs(dfs, 0, -1) << endl;

    return 0;
}

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

int main() {
    int m,n;cin>>n>>m;
    long a[n],b[n],c[m],d[m];
    for(int i=0;i<n;++i){
        cin>>a[i]>>b[i];
    }
    for(int i=0;i<m;++i){
        cin>>c[i]>>d[i];
    }

    for(int i=0;i<n;++i){
        long tmp=5000000000;
        long dist;
        int ans=0;
        
        for(int j=0;j<m;++j){
            dist = abs(a[i]-c[j])+abs(b[i]-d[j]);
            if(dist<tmp){
                tmp=dist;
                ans=j+1;
            }
        }
        cout<<ans<<endl;
    }

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		int tmp = b -a -1;
		int ans = 0;
		
		for(int i = tmp;tmp > 0;tmp--)
			ans += tmp;
		
		System.out.println(ans - a);
	}

}


Measured memory_bytes: 21844
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define rep(i,n) for(int i=0;i<n;i++)
int gcd(int a, int b){
    int r=1;
    while(r!=0){
        r=a%b;
        a=b;
        b=r;
    }
    return a;
}
void revStr(char* str){
    int size = strlen(str);
    int i,j;
    char tmp = {0};
    for(i = 0, j = size - 1; i < size / 2; i++, j--){
        tmp = str[i];
        str[i] = str[j];
        str[j] = tmp;
    }return;
}
struct data{
    int a,b,c;
};

//降順
int compare_int(const void *a, const void *b)
{
    return *(int*)b - *(int*)a;
}
#define MAXSIZE 200000
int list[MAXSIZE];
int tail;

void Init(void){
    tail=0;
}
int Top(void){
    return 0;
}

int Next(int pos){
    if(pos<tail-1){
        return pos+1;
    }else{
        return -1;
    }
}
int Count(void){
    return tail;
}

int Item(int pos){
    if((pos>=0)&&(pos<tail)){
        return list[pos];
    }else{
        return 0;
    }
}
void Add(int value){
    if(tail<MAXSIZE){
        list[tail]=value;
        tail++;
    }
}
void Delete(int pos){
    if((pos>=0)&&(pos<tail)){
        int i;
        for(i=pos;i<tail-1;i++){
            list[i]=list[i+1];
        }
        tail--;
    }
}

int main(){
    int N;
    scanf("%d",&N);
    int max=0;
    int j=1;
    int num=0;
    for(int i=1;i<=N;i++){
        int cnt=0;
        j=i;
        while(j%2!=1){
            j/=2;
            cnt++;
        }
        if(max<=cnt){
            max=cnt;
            num=i;
        }
    }
    printf("%d",num);
}


Measured memory_bytes: 1704
#include <iostream>
#include <algorithm>
#include <string>
#include <typeinfo>
#include <cmath>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define ii pair<int,int>
#define MAX 1000000007
using namespace std;

int main(void){
	int n,t;
	cin>>n>>t;
	pair<int,int > work[n];

	rep(i,n)cin>>work[i].first>>work[i].second;
	sort(work,work+n);

	bool flag=true;
	rep(i,n){
		if(work[i].second<=t){
			cout<<work[i].first<<endl;
			flag=false;
			break;
		}
	}
	if(flag)cout<<"TLE"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long int h,w;
    cin>>h>>w;
    long int a=h*w;
    if(h>1 && w>1)
    {
      if(a%2!=0)
      {
         a=a/2;
          a++;
          cout<<a;
      }
      else
      {
          a=a/2;
          cout<<a;
      }
    }
    else
    {
      cout<<"1";
    }
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; i++) {
    cin >> a.at(i);
  }

  int counter = 0;
  int button = 0;
  for (int i = 0; i < N; i++) {
    if (button == 1) {
      printf("%d\n", counter);
      break;
    }
    if (i == N - 1) {
      printf("-1\n");
    }
    counter++;
    button = a.at(button) - 1;
  }

  return 0;
}


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

int main() {
    int r, d, x2000, x[50];
    cin >> r >> d >> x2000;
    for(int i=1; i<=10; i++) {
        x[i] = r*x2000-d;
        x2000 = x[i];
        cout << x[i] << endl;
    }
    return 0;
}


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

using ll = long long;

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

    int res[100100] = {};
    int i = 0;
    while(i < s.size())
    {
        int countR = 0;
        int j = i;
        while(s[j] == 'R') {
            j++;
            countR++;
        }
        int countL = 0;
        while (s[j] == 'L' && j < s.size())
        {
            j++;
            countL++;
        }
        
        for (int k = 0; k < countR - 1; k++)
        {
            res[k+i] = 0;
        }
        res[i+countR-1] = countR - countR/2 + countL/2;
        for (int k = 1; k < countL - 1; k++)
        {
            res[i+countR+k] = 0;
        }
        res[i+countR] = countL - countL/2 + countR/2;
        i = j;
        
    }
    
    for (int j = 0; j < s.size(); j++)
    {
        cout << res[j] << " ";
    }
    cout << "\n";
    
}

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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

int main(){
    int k,x;
    cin>>k>>x;
    for(int i=x-k+1;i<x+k;++i)cout<<i<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using P = pair<string,int>;
const double PI = acos(-1);
ll gcd(int x, int y){
  int r;
  while(true){
    r = x%y;
    if(r == 0){
      return y;
    }
    x = y;
    y = r;
  }
}
int main() {
  ll a,b;
  cin >> a >> b;
  ll c = gcd(a,b);
  ll ans = a*b/c;
  cout<< ans << endl;
}

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

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main(){
  ll n;
  cin >> n;
  n %= 10;
  if(n==3){
    cout << "bon" << endl;
  }else if(n==0||n==1||n==6||n==8){
    cout << "pon" << endl;
  }else{
    cout << "hon" << endl;
  }


  return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end() 
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000
using namespace std;
typedef long long ll;

int main() {
    int N, C, K;
    cin >> N >> C >> K;
    vector<int> T(N);
    REP(i, N){
        cin >> T[i];
    }
    
    sort(T.begin(), T.end());

    int ans = 1;
    int num = 1;
    int starttime = T[0];
    
    for (int i = 1; i < N; i++){
        if (T[i] <= K + starttime){
            if (num < C){
                num++;
            }
            else {
                num = 1;
                ans++;
                starttime = T[i];
            }            
        }
        else{
            ans++;
            num = 1;
            starttime = T[i];
        }
    }

    cout << ans << endl;
}

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

#define INF 2147483647
#define LINF 9223372036854775807
#define MOD 1000000007
#define MOD2 998244353

template<class T,class U>bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U>bool chmin(T &a, const U &b){if(b<a){a=b;return 1;}return 0;}

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rep1(i,a,b) for(int a_=(a),b_=(b),i=a_;i<b_;++i)
#define repr(i,n) for(int _i=(n),i=_i;i>0;--i)

#define db(x) cerr<<#x<<" = "<<x<<" ";
#define db2(x,y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<") ";
#define db3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<") ";
#define ln cout<<endl;

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define se second
#define fi first

typedef long long ll;
typedef long double ld;

typedef pair<int,int> P;
typedef pair<int,P> iP;
typedef pair<P,P> PP;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}

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





int main(){

    bool flag=false;
    ll ans=0,sum=0;
    int n;
    cin>>n;

    int cnt=0;
    rep(i,n){
        int ai;
        cin>>ai;
        if(ai%2 == 1)cnt++;
    }

    //cout <<fixed<<setprecision(16)<< << endl;
    
    if(cnt%2==0)cout << "YES" <<endl;
    else cout << "NO" <<endl;

    return 0;
}


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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef double ld;
#define int ll
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<vvc> vvvc;
typedef pair<int, int> pii;
typedef pair<pii, pii> piii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector< vi > vvi;
typedef vector< vvi > vvvi;
typedef vector<short> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<ld> vld;
typedef vector<vld> vvld;
typedef vector<vvld> vvvld;
typedef vector<string> vst;
typedef vector<vst> vvst;
typedef pair<ld, ld> pld;

#define inmin(a, b) a = min(a, (b))
#define inmax(a, b) a = max(a, (b))
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define sqr(x) ((x) * (x))
#define fori(i, n) for(int i = 0; i < int(n); ++i)
#define SZ(a) ((int)((a).size()))
#define triple(T) tuple<T, T, T>
#define quad(T) tuple<T, T, T, T>
#define watch(x) cerr << (#x) << " = " << (x) << endl;

#ifdef RUS_HOME
#define cerr cout
#else
#define cerr if (false) cerr
#endif

const double PI = 2 * acos(0.0);
#define rand shittttty_shit
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng_64(chrono::steady_clock::now().time_since_epoch().count());

const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";


template <class T0, class T1>
inline ostream & operator << (ostream &out, pair<T0, T1> &a) {
    return out << "{" << a.first << ", " << a.second << "}";
}

template <class T0, class T1>
inline istream & operator >> (istream &in, pair<T0, T1> &a) {
    return in >> a.first >> a.second;
}

template <class T0, class T1, class T2>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << "}";
}

template <class T0, class T1, class T2, class T3>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2, T3> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << ", " <<  get<3>(a) << "}";
}

template<class T>
inline ostream & operator << (ostream &out, vector<T> &a) {
    out << "[";
    fori (i, a.size())
        out << a[i] << vector<string>{", ", "]  "}[i + 1 == a.size()];
    return out;
}


void smain();



signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
#ifdef RUS_HOME
    freopen("input", "r", stdin);
    clock_t start = clock();
#endif
    cout << setprecision(4) << fixed;
    smain();
#ifdef RUS_HOME
    cout << "\n\n\n\nTOTAL EXECUTION TIME: " << float( clock () - start ) /  CLOCKS_PER_SEC << endl;
#endif
    return 0;
}


void smain(){


    int n,m;
    cin>>n>>m;
    cout<<n*(n-1)/2+m*(m-1)/2;


}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<queue>
#include<algorithm>
#include<map>
#include<vector>
#include<cstring>
#include<cmath>
inline int Input(){
	int ret=0;bool isN=0;char c=getchar();
	while(c<'0' || c>'9'){
		if(c=='-') isN=1;
		c=getchar();
	}
	while(c>='0' && c<='9'){
		ret=ret*10+c-'0';
		c=getchar();
	}
	return isN?-ret:ret;
}

inline void Output(long long x){
    if(x<0){
        putchar('-');x=-x;
    }
    int len=0,data[20];
    while(x){
        data[len++]=x%10;x/=10;
    }
    if(!len)    data[len++]=0;
    while(len--)
        putchar(data[len]+48);
    putchar('\n');
}
#pragma comment(linker,"/STACK:124000000,124000000")
#include<map>
#include<vector>
#include<queue>
#define eps 1e-10
#define INF 2000000009
#define maxn 150050
#define maxm 2500010
#define mod 1000000
#define llINF 1LL<<60
using namespace std;


int a[100005];
int sum[100005];
map<int,int>mp;
int main()
{
    int n,s,w,q;
    while(scanf("%d%d%d%d",&n,&s,&w,&q)&&n)
    {
        mp.clear();
        memset(sum,0,sizeof(sum));
        for(int i=0;i<n;i++)
        {
            a[i]=(s/7)%10;
            if(s&1){
                s=(s/2)^w;
            }
            else{
                s=s/2;
            }
        }
//        for(int i=0;i<n;i++)
//            printf("%d",a[i]);
//        printf("\n");
        int i=0;
        int ans=0;
        while(a[i]==0&&i<n)
            i++;
        if(q==2||q==5){
            int t=i;
            for(i;i<n;i++)
            {
                if(a[i]%q==0){
                    ans+=i+1-t;
                    if(a[i]==0) ans--;
                }
                if(a[i]==0) t++;
            }
        }
        else{
            int cnt=2;
            int t=i;
            int ttt=0;
            int ten=1;
            mp[0]=1;
            sum[1]=1;
            for(i=n-1;i>=t;i--)
            {
                ttt=(a[i]*ten%q+ttt)%q;
                ten=ten*10%q;
                if(a[i]==0){
                    ans-=sum[mp[ttt]];
                }
                if(mp[ttt]==0){
                    mp[ttt]=cnt++;
                    sum[cnt-1]=1;
                }
                else{
                    sum[mp[ttt]]++;
                }

            }
            for(int i=0;i<cnt;i++)
            {
                long long tmp=sum[i];
                //printf("%d %I64d\n",i,tmp);
                tmp=tmp*(tmp-1)/2;
                ans+=tmp;
            }
        }
        printf("%d\n",ans);
    }
    return 0;
}

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

int can_make(const vector<int>& A, int i, int m, vector<vector<int> >& memo){
    if (m == 0) return 1;
    if (m < 0 || i >= A.size()) return 0;
    if (memo[i][m] != -1) return memo[i][m];
    return memo[i][m] = (can_make(A, i + 1, m, memo) || can_make(A, i + 1, m - A[i], memo));
}

int main(){
    int n;
    cin >> n;
    vector<int> A(n);
    for (auto& a : A) cin >> a;
    int q;
    cin >> q;
    vector<vector<int> > memo(A.size(), vector<int>(2000, -1));
    for (int i = 0; i < q; i++) {
        int m;
        cin >> m;
        cout << (can_make(A, 0, m, memo) ? "yes" : "no") << endl;
    }
    return 0;
}

Measured memory_bytes: 3280
//! ----------------------------------------------
//! Framework <https://github.com/vain0x/procon>
//!
//! See the bottom of file for solution.
//! ----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

/// Print values to standard error if debug mode.
#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

/// Read from standard input and parse each word.
/// - `read!(T, U, ..)` parses a line as a tuple of words.
/// - `read![[T]]` parses a line as an array of words.
/// - `read![..; N]` parses `N` lines, using `read!(..)` repeatedly.
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

/// Read a line from standard input.
#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();

    #[allow(deprecated)]
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn main() {
    let (A, B, C) = read!(i64, i64, i64);
    println!("{}", if A == B && B == C { "Yes" } else { "No" })
}


Measured memory_bytes: 4352
#include <vector>
#include <utility>
#include <cmath>
#include <algorithm>
#include "limits.h"
#define f first
#define s second
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> ii;

ll Multiply(ll a,ll b,ll m){
    if(((a%=m)<INT_MAX && (b%=m)<INT_MAX)||a<100||b<100)
        return a*b%m;
    ll sa=a/10,r=a%10,sb=b/10,k=b%10;
    return (100*Multiply(sa,sb,m)+10*k*sa+10*r*sb+r*k)%m;
}

ll PowerUnderMod(ll base,ll power,ll mod){
    if(!power)
        return 1;
    ll stay=PowerUnderMod(base, power/2, mod);
    return Multiply(Multiply(stay, stay, mod),power%2?base:1,mod);
}

ii Exd_gcd(ll a,ll b){
    if(!(a%b))
        return ii(0,1);
    ii stay=Exd_gcd(b, a%b);
    return ii(stay.s,stay.f-a/b*stay.s);
}

inline ll GCDNum(ll a,ll b){
    ii gcdnumber = Exd_gcd(a, b);
    return gcdnumber.f*a+gcdnumber.s*b;
}

inline ll Inverse(ll b,ll prime){
    return (Exd_gcd(b,prime).f+prime)%prime;
}
int A[100010]={0};
int main(){
    int n;scanf("%d",&n);
    int a;
    for(int i=0;i<n;++i){scanf("%d",&a);A[a]++;}
    bool ok=1;
    if(n%2){
        if(A[0]!=1)ok=0;
        for(int i=1;i<n/2+1;++i){
            if(A[2*i]!=2)ok=0;
        }
    }
    else{
        for(int i=0;i<n/2;++i){
            if(A[2*i+1]!=2)ok=0;
        }
    }
    const ll P=1e9+7;
    if(ok)printf("%lld\n",PowerUnderMod(2, n/2, P));
    else printf("0");
}
/*#include <iostream>
#include <cstdio>
#include <string.h>
#include <sstream>
#include <deque>
#include <cmath>
#include <algorithm>
#define MAXL 1<<20
#define FL(i,j,k) for(int i=j;i<k;++i)
typedef long long int ll;
using namespace std;
int main(){
    int t=0,s,x1,x2,t1,t2,p,d,RR;cin>>s>>x1>>x2;
    cin>>t1>>t2;
    cin>>p>>d;
    ///by tain
    
    ll passbytrain=0;
    if(x1>x2){
        if((d==1)^(p<x1)){//同向
            RR=(x1-p)*t1;
        }else{
            if(d==1){
                RR=t1*(2*(s-p)+(p-x1));
            }else{
                RR=t1*(2*p+x1-p);
            }
        }
        if(d==1){
            
        }
    }else{
        if(d==-1){
            RR=p*t1;
        }else{
            RR=s*t1+(s-p)*t1;
        }
        while (RR<(x1)*t2) {
            RR+=t1*s*2;
        }
        passbytrain+=RR;
        passbytrain+=t1*s;
        passbytrain+=t2*(s-x2);
    }
    cout<<min(passbytrain,(ll)abs(x1-x2)*t2);
    
    //
    
    
    
}*/

Measured memory_bytes: 512
import math
A, B = [int(x) for x in input().split()]

xa = math.ceil(A / 0.08)
xb = math.ceil(B / 0.1)

x = max(xa, xb)
if math.floor(x * 0.08) == A and math.floor(x * 0.1) == B:
    print(x)
else:
    print(-1)


Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<cstdio>
#define x first.first
#define y first.second
#define r second.first
#define color second.second

using namespace std;

typedef pair<double,double> P;
typedef pair<P,P> C;

bool check(C a,C b){
  return a.r+b.r>sqrt(pow(a.x-b.x,2)+pow(a.y-b.y,2));
}
 
int count(int bits){
  bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
  bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
  bits =(((bits >> 4) + bits) & 0x0f0f0f0f);
  bits += bits >> 8;
  return (bits + (bits >> 16)) & 0xff;
}
 
bool dp[(1<<25)];
 
int main(void){
 
	int n;
	while(cin >> n,n){
		C c[25];
		for(int i=0;i<n;i++)
			scanf("%lf %lf %lf %lf",&c[i].x,&c[i].y,&c[i].r,&c[i].color);
		
		fill(dp,dp+(1<<n),false);
		dp[(1<<n)-1]=true;
		int ans=0;
		
		for(int S=(1<<n)-1;S>=0;S--){
			if(!dp[S])continue;
			for(int i=0;i<n;i++){
				for(int j=i+1;j<n;j++){
					
					int nx=S;
					nx&=~(1<<i);
					nx&=~(1<<j);
					if(dp[nx])continue;
					
					if(!(S>>i&1) || !(S>>j&1))continue;
					if(c[i].color!=c[j].color)continue;
					
					bool fg=false;
					for(int k=0;k<n;k++){
						if(!(S>>k&1))continue;
						fg|= k<i && check(c[i],c[k]);
						fg|= k<j && check(c[j],c[k]);
						if(fg)break;
					}
					
					if(!fg)dp[nx]|=dp[S];
				}
			}
			if(dp[S])ans=max(ans,n-count(S));
		}
		cout << ans << endl;
	}
   
  return 0;
}

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

int main()
{
  string w; cin >> w;
  bool beauty = true;
  
  for (int i=0; i<w.size(); i++) {
    int cnt = 0;
	for (int j=0; j<w.size(); j++) {
      if (w.at(i) == w.at(j)) cnt++;
    }
    if (cnt%2 != 0) {
      beauty = false;
      break;
    }
  }
  if (beauty) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

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


int a[110][110];

int main() {
    int r, c;
    cin >> r >> c;
    rep(i, r) {
        rep(j, c) {
            cin >> a[i][j];
        }
    }
    rep(i, r) {
        int sum = 0;
        rep(j, c) {
            sum += a[i][j];
            cout << a[i][j] << ' ';
        }
        cout << sum <<endl;
        a[i][c] = sum;
    }

    int tot = 0;
    rep(i, c) {
        int sum = 0;
        rep(j, r) {
            sum += a[j][i];
        }
        cout << sum << ' ';
        tot += sum;
        a[r][i] = sum;
    }

    cout << tot << endl;
}


Measured memory_bytes: 3172
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0; i<n; ++i)
#define rep1(i,n) for(ll i=1; i<=n; ++i)
#define revrep(i,n) for(ll i=n-1; n>=0; --i)
inline constexpr ll Inf = (1ULL << 62) -1;
#define fastio cin.tie(nullptr); ios_base::sync_with_stdio(false);
#define endl '\n'
template <class T> bool updmax(T& a, T b) { if (b > a) { a = b; return true;} return false;}
template <class T> bool updmin(T& a, T b) { if (b < a) { a = b; return true;} return false;}

int main() {
    fastio;
    ll ans=0;
    ll N;
    cin >> N;
    ll ux = 0;
    ll lx = 1e9;
    ll uy = 0;
    ll ly = 1e9;
    vector<pair<int,int>> v(N);
    rep(i,N) {
        ll x,y;
        cin >> x >> y;
        updmax(ux, x);
        updmin(lx, x);
        updmax(uy, y);
        updmin(ly, y);
        v[i] = {x,y};
    }
    sort(begin(v), end(v), [&](auto& p, auto& q) {
        return (p.first - lx + p.second - ly) < (q.first - lx + q.second - ly);
        });
    ans = abs(v.front().first - v.back().first) + abs(v.front().second- v.back().second);
    sort(begin(v), end(v), [&](auto& p, auto& q) {
        return (ux - p.first + p.second - ly) < (ux - q.first + q.second - ly);
        });
    ll t = abs(v.front().first - v.back().first) + abs(v.front().second- v.back().second);
    updmax(ans, t);
    cout << ans << endl;
}


Measured memory_bytes: 4752
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll ZERO = 0;
const int Inf = 1000000000;
const ll INF= 1e18;
const ll MOD = 1000000007;
const double PI = 3.1415926535897;
typedef pair<ll,ll> P;

int main() {
    string S;
    cin >> S;
    vector<bool> vec(26);
    for(int i = 0;i < S.size();i++) {
        vec.at(S.at(i) - 'a') = true;
    }
    if(S == "zyxwvutsrqponmlkjihgfedcba") {
        cout << -1 << endl;
        return 0;
    }
    else if(S.size() < 26) {
        cout << S;
        for(int i = 0;i < 26;i++) {
            if(vec.at(i) == false) {
                char a = 'a' + i;
                cout << a << endl;
                break;
            }
        }
    }
    else {
        for(int i = S.size() - 1;i >= 0;i--) {
            for(int j = S.at(i) - 'a' + 1;j < 26;j++) {
                if(vec.at(j) == false) {
                    for(int k = 0;k < i;k++) {
                        cout << S.at(k);
                    }
                    char a = 'a' + j;
                    cout << a << endl;
                    return 0;
                }
            }
            vec.at(S.at(i) - 'a') = false;
        }
    }
}

Measured memory_bytes: 256
def ave_temp(temp, height):
	return temp - (height * 0.006)

N = int(input())
T, A = map(int, input().split(' '))
H = list(map(int, input().split(' ')))

ans = []
A_raw = []
built = []
for i in range(0, N):
	ans.append(ave_temp(T, H[i]))
	A_raw.append(A)
	built.append(abs(ans[i] - A_raw[i]))
#print(ans)
#print(A_raw)
#print(built)
index = 0

a = min(built)

for k in range(0, N):
	if a == built[k]:
		built_num = k
	

print(str(built_num + 1))


Measured memory_bytes: 3064
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

import copy

h,w,k = mi()
masu = [[] for i in range(h)]

class masusu:
    def __init__(self,w,h,masu):
        self.w = w
        self.h = h
        self.masu = masu

    def calcBlack(self,hpat,wpat):
        masuc = copy.deepcopy( self.masu)
        for i in range(h):
            if (hpat >> i) & 1:
                masuc[i] = [0]*w
            for j in range(w):
                if (wpat >> j) & 1:
                    for l in range(h):
                        masuc[l][j] = 0
        
        sumtmp = 0
        for i in range(h):
            sumtmp += sum(masuc[i])
        return sumtmp


for i in range(h):
    c = input()
    for j in range(w):
        if c[j] == '.':
            masu[i].append(0)
        else:
            masu[i].append(1)

m = masusu(w,h,masu)

ans = 0
for hpat in range((2**h)-1):
    for wpat in range((2**w)-1):
        sumBlack = m.calcBlack(hpat,wpat)

        if sumBlack == k:
            ans +=1

print(ans)


Measured memory_bytes: 79348
#include<bits/stdc++.h>
#define tujare ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
int main()
{
    tujare;
    string a,b;
    cin>>a>>b;
    long i;
    for(i=0;i<a.size();i++)
    {
        if(a[i]!=b[i])
        {
            cout<<"No";
            return 0;
        }
    }
    cout<<"Yes";
    return 0;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
#define PRINT(v) for (auto x : (v)) cout <<x <<" " ; cout <<endl;
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using mat = vector<vector<ll>>;
const ll MOD = 1000000007;
const ll INF = 10000000000000000;
vector<int> x4 = {0, 1, 0, -1}, x8 = {0, 1, 1, 1, 0, -1, -1, -1};
vector<int> y4 = {1, 0, -1, 0}, y8 = {1, 1, 0, -1, -1, -1, 0, 1};
template<class T> struct edge { int from, to; T cost;};
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;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }
template<class T> inline T power(T a,T b,T m){ if (b==0) return 1;
  T tmp = power(a,b/2,m); if (b%2==0) return tmp*tmp%m; else return tmp*tmp%m*a%m; }
template<class T> inline T gcd(T a, T b){if (b==0) return a; return gcd(b, a%b);}
template<class T> inline T lcm(T a, T b){return a / gcd(a,b) * b;}
// ax+by=gcd(a,b)を解く
template<class T> inline T extgcd(T a,T b,T &x,T &y){if (b==0){x=1; y=0; return a;} T d=extgcd(b,a%b,y,x); y -= a/b*x; return d;}
void hey(){ cout <<"hey" <<endl; }


int main() {
  string s; cin >>s;
  string t; cin >>t;
  t.pop_back();
  if (s == t) cout <<"Yes" <<endl;
  else cout <<"No" <<endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using ld = long double;
#define ALL(x) x.begin(),x.end()
#define P pair<int,int>
#define MOD 1000000007

int main()
{
  int n, c;
  int ans = 0;
  cin >> n;
  vector<int> v(n);
  rep(i, n) {
    cin >> v[i];
  }
  rep(i, n) {
    cin >> c;
    if (v[i] > c) ans += v[i] - c;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3580
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())
#define VI(a,n) vi a(n); rep(i,n)cin>>a[i]
#define sq(n) (n)*(n)

using namespace std;

const int mod=1e9+7;

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    int n,a,b;
    cin>>n>>a>>b;
    VI(p,n);
    int q=0,w=0,e=0;
    rep(i,n){
        if(p[i]<=a)q++;
        else if(p[i]<=b)w++;
        else e++;
    }
    cout<<min({q,w,e})<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		//????????£????????????????????°?????????????????£?¨?
		Scanner sc = new Scanner(System.in);
		//?????°
		int intCount =0;
		//????????£????????????a????????£?????\???
		int a = sc.nextInt();
		//????????£???????????????????????£?????\???
		int b = sc.nextInt();
		//????????£???????????????????????£?????\???
		int c = sc.nextInt();
		//a??????????????????????????????
		for(int i =a; i<=b; i++){
			//????????°???c????????????????????????
			if(c % i ==0){
				intCount++;
			}else{

			}
		}
		System.out.println(intCount);
	}
}

Measured memory_bytes: 26340
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
      	String a = sc.next();
        char A = a.charAt(0);
      	String b = sc.next();
        char B = b.charAt(0);
      
        if(A < B){
      	System.out.println("<");
        }else if(A > B){
      	System.out.println(">");
        }else if(A == B){
      	System.out.println("=");
        }
      
    }
}

Measured memory_bytes: 35768
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;


class Program {


	static long mod = 1000000007;
	//static long mod =998244353; 
	static void Main(string[] args) {

		char[] cs = new char[] { ' ' };
		//char[] cs = new char[] { ' ', ',' };

		//int n = int.Parse(Console.ReadLine());
		//int val = int.Parse(Console.ReadLine());
		//int[] vals = parseAry(Console.ReadLine().Split(cs));
		//string str = Console.ReadLine();
		//string[] strs = Console.ReadLine().Split(cs);

		//string res = "";
		long res = 0;

		long n = long.Parse(Console.ReadLine());
		long[] vals = parseAryL(Console.ReadLine().Split(cs));


		long[] d = new long[n];
		d[0] = vals[0];
		for(int i=1;i<n;i++){
			d[i] = d[i - 1] + vals[i];		
		}

		long sa = long.MaxValue;
		for ( int i = 0; i < n-1; i++ ) {
			long z =Math.Abs( d[i] - ( d[n - 1] - d[i] ));
			sa = Math.Min(sa,z);
			
		}





			Console.WriteLine(sa);

		return;

	}


	//	int配列をスペース区切りの文字列に変換
	static string stringBuilderArrayInt(int[] a) {
		StringBuilder sb = new StringBuilder();

		for ( int i = 0; i < a.Length; i++ ) {
			sb.Append(a[i] + " "); 
		}
		if ( sb.Length > 1 ) {
			sb = sb.Remove(sb.Length - 1, 1);
		}
		return sb.ToString(); ;
	}


	//	文字列strをindex番目からdで上書き
	static string strOverWrite(string str, int i, string s) {
		return str.Remove(i, s.Length).Insert(i, s);
	}

	//　String[]  ----->  int[]
	static int[] parseAry(string[] str) {
		int[] nums = new int[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { nums[i] = int.Parse(str[i]); }
		return nums;
	}
	//　String[]  ----->  long[]
	static long[] parseAryL(string[] str) {
		long[] nums = new long[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { nums[i] = long.Parse(str[i]); }
		return nums;
	}

	//文字列を1文字ずつString[]に入れる
	static string[] strAry(String str) {
		string[] re = new string[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { re[i] = str[i].ToString(); }
		return re;
	}



}

Measured memory_bytes: 36944
#include <iostream>
#include <stdio.h>
#include <queue>
#include <vector>
#include <algorithm>
using namespace std;
#define MAX_V 100010
#define INFA (long long)1000000000000000000
#define rep(i,q) for(int i = 0; (q) > i; i++)
struct edge { int to, cost; };
typedef pair<int,int> P;

int V;
vector<edge> G[MAX_V];
long long d[MAX_V];

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

  while(!que.empty()){
    P p = que.top(); que.pop();
    int v =  p.second;
    if(d[v] < p.first)continue;
    for(int i = 0; i < G[v].size(); i++){
      edge e = G[v][i];
      if(d[e.to] > d[v] + e.cost){
        d[e.to] = d[v]+e.cost;
        que.push(P(d[e.to],e.to));
      }
    }
  }
}
int main(){
  cin>>V;
  for(int i = 0; V-1 > i; i++){
    int a,b,c;
    scanf("%d %d %d", &a,&b,&c);
    G[a].push_back({b,c});
    G[b].push_back({a,c});
  }
  
  int q,k;cin>>q>>k;
  dijkstra(k);
  for(int i = 0; q > i; i++){
    long long x,y;
    cin>>x>>y;
    cout << d[x]+d[y] << endl;
  }
}

Measured memory_bytes: 8820
#include <iostream>
#include <stdio.h>
using namespace std;

int main(void) {
	double r;
	
	cin >> r;
	double pi = 3.141592653589;
	double s = r*r*pi;
	double l = 2*r*pi;
	
	printf("%.6f %.6f",s,l);
	return 0;
}


Measured memory_bytes: 3196
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;

#define FOR(i,n) for(int i=0;i<n;i++)
#define PRINT(a) cout<<a<<"\n"
#define QUO(x,y) (x-x%y)/y
 
int main(){

	int n;
	cin>>n;

	PRINT(800*n-QUO(n,15)*200);

	
	

	return 0;
}

Measured memory_bytes: 256
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
from bisect import bisect_left, bisect_right
import random
from itertools import permutations, accumulate, combinations
import sys
import string



INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() 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)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7


def warshall_floyd(graph):
    #d[i][j]: iからjへの最短距離
    for k in range(n):
        for i in range(n):
            for j in range(n):
                graph[i][j] = min(graph[i][j],graph[i][k] + graph[k][j])
    return graph



n, m, l = LI()
graph = [[INF] * n for _ in range(n)]
#d[u][v] : 辺uvのコスト(存在しないときはinf)
for i in range(m):
    a, b, c = LI()
    graph[a - 1][b - 1] = c
    graph[b - 1][a - 1] = c
for i in range(n):
    graph[i][i] = 0


supply_num_graph = [[INF] * n for _ in range(n)]
min_dist = warshall_floyd(graph)
for j in range(n):
    for k in range(j + 1, n):
        if min_dist[j][k] <= l:
            supply_num_graph[j][k] = 1
            supply_num_graph[k][j] = 1

supply_num_graph = warshall_floyd(supply_num_graph)
q = I()
for i in range(q):
    s, t = LI()
    if supply_num_graph[s - 1][t - 1] == INF:
        print(-1)
    else:
        print(supply_num_graph[s - 1][t - 1] - 1)




Measured memory_bytes: 126556
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <stack>
#include <queue>
#define llong long long
#define INF (__INT32_MAX__ / 2)

using namespace std;
typedef pair<int, int> ipair;

int main(int argc, char **argv) {
    int N, K;
    string S;
    cin >> N >> S >> K;

    for(int i = 0; i < N; ++i)
        if(S[i] != S[K - 1])
            S[i] = '*';
    
    cout << S << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<queue>
#include<set>
#include<map>
using namespace std;

const int maxn = 1000;
const int INF = 1e9+10;

int a[maxn];

bool dfs(int cur, int l, int r)
{
    if(cur == 10) return true;
    if (a[cur] > l) if(dfs(cur+1,a[cur],r)) return true;
    if (a[cur] > r) if(dfs(cur+1,l,a[cur])) return true;
    return false;
}

int main()
{
    int t;
    scanf("%d",&t);
    while(t--){
        for(int i = 0; i < 10; i++) scanf("%d",&a[i]);
        if(dfs(0,0,0)) printf("YES\n");
        else printf("NO\n");
    }
}

Measured memory_bytes: 1168
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define test() ull t;cin>>t;while(t--)
#define pb push_back
#define mkp make_pair
#define nl cout<<endl
#define MOD 1000000007
#define loop(i,start,end) for(int i=start;i<end;i++)
#define N 100001
#define oa(a,n) for(int i=0;i<n;i++)cout<<a[i]<<" ";nl;
#define ov(a) for(int i=0;i<a.size();i++)cout<<a[i]<<endl;
#define pi M_PI
int main()
{
	fastio();
	int n;cin>>n;
	int a[n];
	loop(i,0,n)
	{
		cin>>a[i];
	}
	int flag2=0;
	loop(i,0,n)
	{
		if(a[i]!=i+1)
			flag2=1;
	}
	int flag1=0,flag=0;
	loop(i,0,n)
	{
		if(flag1==1)
			break;
		loop(j,0,n)
		{
			if(i!=j)
			{
				swap(a[i],a[j]);
				flag=0;
				loop(k,0,n-1)
				{
					if(a[k+1]<=a[k])
					{
						flag=1;
						break;
					}
				}
				swap(a[i],a[j]);
				if(flag==0)
				{
					flag1=1;
					// cout<<i<<" "<<j;
					break;
				}
			}
		}
	}
	if(flag1==1 || flag2==0)
		cout<<"YES"<<endl;
	else
		cout<<"NO";


	return 0;
}	

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

int main()
{
    int N;
    int Sn = 0;
    cin >> N;
    int Origin = N;
    while(1) {
        if( N < 1) {
            break;
        }
        Sn += (N % 10);
        N = (N / 10);
    }
    if((Origin % Sn) == 0) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}


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

using namespace std;

int p[11], c[11], s[11];

int main() {
	int d, g;
	scanf("%d %d", &d, &g);
	g /= 100;
	for (int i = 0; i < d; i++) {
		scanf("%d %d", &p[i], &c[i]);
		c[i] /= 100;
		s[i] = p[i] * (i + 1) + c[i];
	}
	int ans = d * 100;
	for (int i = 0; i < 1 << d; i++) {
		int sco = 0, cnt = 0;
		for (int j = 0; j < d; j++) {
			if (i & (1 << j)) {
				sco += s[j];
				cnt += p[j];
			}
		}
		if (sco >= g) {
			ans = min(ans, cnt);
			continue;
		}
		for (int j = 0; j < d; j++) {
			if (!(i & (1 << j))) {
				int t = (g - sco + j) / (j + 1);
				if (t < p[j]) {
					ans = min(ans, cnt + t);
				}
			}
		}
	}
	printf("%d\n", ans);
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<int,int> Pair;

const int Nmax = 2e5 + 5;
const ll inf = 3e18;

int main()
{
 //   freopen("input", "r", stdin);
  //  freopen("output", "w", stdout);
    cin.sync_with_stdio(false);

    int A, B, C;
    ll K, x, y;
    cin >> A >> B >> C >> K;

    if(A == B)
    {
        cout << "0\n";
        return 0;
    }

    if(K&1) cout << B-A << '\n';
        else cout << A-B << '\n';

    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;



class Main{

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] input = br.readLine().split(" ");
		int r = Integer.parseInt(input[0]);
		int g = Integer.parseInt(input[1]);
		int b = Integer.parseInt(input[2]);
		int a = r * 100 + g * 10 + b;
		if(a % 4 == 0){
			System.out.println("YES");
		}else{
			System.out.println("NO");
		}
	}

}

Measured memory_bytes: 21204