akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <climits>
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define srep(i, begin, end) for (__typeof(end) i = begin; i != end; i++)
#define si(x) int x = scanInt();
#define sll(x) LL x = scanLong();
#define sci(x) int x; scanf("%d", &x);
#define scll(x) LL x; scanf("%lld", &x);
#define pi(x) printf("%d ", x)
#define pll(x) printf("%lld ", x)
#define nl printf("\n")
#define clr(a) memset(a, 0, sizeof(a))
#define PB push_back
#define MP make_pair
using namespace std;
typedef unsigned int UI; // 32 bit integer
typedef long int LI; // 32 bit integer
typedef unsigned long int ULI; // 32 bit unsigned integer
typedef long long int LL; // 64 bit integer
typedef unsigned long long int ULL; // 64 bit unsigned integer
typedef long double LD;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef deque<int> DI;
typedef deque<LL> DLL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
const LL MOD = 1e9+7;

/* Fast I/O */
inline int scanInt() {
	int n = 0;
	char ch = getchar();
	int sign = 1;
	while(ch < '0' || ch > '9') {
		if(ch == '-')	sign = -1;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9') {
		n = (n<<1)+(n<<3)+(int)(ch-'0');
		ch = getchar();
	}
	return n*sign;
}

inline LL scanLong() {
	LL n = 0;
	char ch = getchar();
	LL sign = 1;
	while(ch < '0' || ch > '9') {
		if(ch == '-')	sign = -1;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9') {
		n = (n<<1)+(n<<3)+(LL)(ch-'0');
		ch = getchar();
	}
	return n*sign;
}

int main() {
	sll(n);
	pll(n*n*n); nl;
}


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

const string JpyStr = "JPY";
const int BtcJpyRate = 380000;

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

    double sum = 0;

    for (int i = 0; i < n; ++i)
    {
        double input;
        cin >> input;

        string unit;
        cin >> unit;

        sum += (unit == JpyStr ? input : input * BtcJpyRate);
    }

    cout << setprecision(12) << fixed;
    cout << sum << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <map>
#include <string>
#include <algorithm>

using namespace std;

struct smap {
    int number;
    double time;
};typedef struct smap Smap;

//プロトタイプ宣言
bool tfsort (const Smap &a, const Smap &b);

//main関数
int main(){
    int i, idx = 0;
    Smap rec[50];
    
    //入力
    for(i = 0;i < 24; i++){
        scanf("%d %lf", &rec[i].number, &rec[i].time);
    }
    
    
    
    //3組ごとのソート
    for(i = 0; i < 17; i += 8){
        sort(rec + i, rec + i + 8, tfsort);
    }
    //上位二組出力
    for(i = 0; i < 3; i++){
        printf("%d %0.2f\n", rec[idx].number, rec[idx].time);
        printf("%d %0.2f\n", rec[idx + 1].number, rec[idx + 1].time);
        rec[idx].time = -1.0;
        rec[idx + 1].time = -1.0;
        idx += 8;
    }
    
    //全てのチームをソート
    sort(rec, rec + 24, tfsort);
    
    //3位以下の上位二人を出力
    for(i = 6; i < 8; i++){
        printf("%d %0.2f\n", rec[i].number, rec[i].time);
    }
    
    return 0;
}

bool tfsort (const Smap &a, const Smap &b){
    if(a.time < b.time) return true;
    return false;
}

Measured memory_bytes: 1076
/// kazuki08
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
//#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
    return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
    o<<"{";
    for(const T& v:vc) o<<v<<",";
    o<<"}";
    return o;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int h,w,H,W;

signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
        
    cin >> H >> W;
    cin >> h >> w;
    cout << H*W - h*W - H*w + h*w << endl;

return 0;
}
///....


Measured memory_bytes: 256
#include <iostream>
#include <string>
 
using namespace std;
 
int main(){

    string s;
    cin >> s;

    if ((s[0] == s[1]) && (s[1] == s[2])) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mk make_pair
#define x first
#define y second
using namespace std;
typedef long long ll;
typedef pair <int,int> PAIR;
const int N = 1e5+5;
const ll M = 11092019;

ll c[15],p[15][15],temp[15];

inline bool check(int m,ll x){
	for(int i = 1;i <= m;++i){
		if(temp[i] < x) return 0;
	}
	return 1;
}

int main() {
	int n,m,x;
	scanf("%d%d%d",&n,&m,&x);
	
	for(int i = 0;i < n;++i){
		scanf("%lld",&c[i]);
		for(int j = 1;j <= m;++j)
			scanf("%lld",&p[i][j]);
	}
	
	ll ans = 2e18;
	for(int base = 0;base < (1 << n);++base){
		ll cnt = 0;
		memset(temp,0,sizeof(temp));
		for(int i = 0;i < n;++i){
			if((1 << i) & base){
				cnt += c[i];
				for(int j = 1;j <= m;++j)
					temp[j] += p[i][j];
			}
		}
		//printf("%d %lld\n",base,cnt);
		if(check(m,x)) ans = min(ans,cnt);
	}
	
	if(ans == 2e18) printf("-1\n");
	else printf("%lld\n",ans);
	return 0;
}


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

using namespace std;
using ll =long long;

#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }
void coY() {cout <<"Yes"<<endl;}
void coN(){cout <<"No"<<endl;}

const ll INF = 1LL << 60;

//Write From this Line

const ll mod = 1e9+7;
int main()
{
	int n , k; 
	cin >> n >> k; 
	vector<vector<ll>> dp(2020,vector<ll>(2020 , 0));
	dp[0][0] = 1; 
	dp[1][0] = 1 ;
	dp[1][1] = 1 ; 
	for(int i = 2  ; i < 2010 ; i ++){
		for(int j = 0 ; j < 2010 ; j++){
			if(j == 0 || j == i ) {
				dp[i][j] = 1 ;
				continue; 
			}
			dp[i][j] = (dp[i-1][j-1] + dp[i-1][j]) % mod ;

		}
	}
	for(int i = 1 ; i <= k ; i ++) {
		ll ans = (dp[n-k+1][i] % mod) *( dp[k-1][i-1] % mod);
		ans %= mod;
		cout << ans << endl;
	}
}


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

#define f(i,a,b) for( ll i = a; i < b ; i++ )
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ones(x) (ll) __builtin_popcount(x)
#define fs first
#define sc second
#define pb push_back
#define po pop_back
#define mp make_pair  
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ller ios::sync_with_stdio(false);cin.tsie(nullptr);cout.tie(nullptr)
#define watch(x) cout << (#x) << " is " << (x) <<"#" <<endl
#define PI 3.1415926535
using namespace std;
typedef long long ll;
typedef long double ld; 
typedef pair<ll,ll> ii ;
typedef vector<ll>  vi ;
typedef vector<ii> vii ;
const ll mod = 998244353;
const ll MAX = 3e3+23;
const ll inf = 1e18+7;


int main(){
  fastio;
  ll n,a,b;
  cin>>n>>a>>b;
  ll lad = n/(a+b);
  ll ans = min(a,n-lad*(a+b));
  ans += a*lad;
  cout<<ans<<"\n";
  return 0; 
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const ll INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

template<typename T> T chmax(T& a, const T& b){return a = (a > b ? a : b);}
template<typename T> T chmin(T& a, const T& b){return a = (a < b ? a : b);}

int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    set<string> st;
    for(auto&& c : s) {
        set<string> tmp;
        for(auto&& t : st) {
            if(t.size() == 3) continue;
            tmp.insert(t+c);
        }
        st.insert(string(1, c));
        st.insert(tmp.begin(), tmp.end());
    }
    ll ans = 0;
    for(auto&& s : st) if(s.size() == 3) ++ans;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int n,k,ans=0;
bool vis[1010]={};

int main(){
	cin>>n>>k;
	int i,j,q,x;
	for(i=1;i<=k;++i){
		cin>>q;
		while(q--){
			cin>>x;
			vis[x]=1;
		}
	}
	for(i=1;i<=n;++i)
		if(!vis[i])
			++ans;
	cout<<ans;
	
	
	return 0;
}

Measured memory_bytes: 3632
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

void main() {
    auto s = read!string;
    writeln(s.count('1'));
}


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

#define F first
#define S second
#define pb push_back
#define ll long long
#define int long long

using namespace std ;

const int MAXN = 2001 * 1001 , MOD = 989749 ; 


int32_t main()
{
	ios::sync_with_stdio(0) ; cin.tie(0) ; 
	int n , m ; 
	cin >> n >> m ; 
	int l = min(n,m/2) , r = m + 1  ; 
	while(r-l>1)
	{
		int mid = (r+l) / 2 ; 
		if(n+(m-2*mid)/2>=mid&&m>=2*mid)
			l = mid ; 
		else
			r = mid ; 
	}
	cout << l << endl ; 
}

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

using namespace std;

int main( ) {
    ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t,a,b;
	t = 1;
	while(t--) {
	 cin >> a >> b;
	 if(a + b < 10)
	  cout << a + b << endl;
	 else
	  cout << "error" << endl;
	}
	return 0;
}



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

int main(void){
    int k, x;

    cin >> k >> x;
    
    rep(i, 2*k-1){
        cout << x-k+i+1;
        if(i != 2*k-2) cout << " ";
        else cout << endl;
    }

    return 0;
}

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

using namespace std;

int k;
string s, s2;

int main() {
  cin >> s >> k;
  bool all_equal = true;
  for (int i = 1; i < s.size() && all_equal; i++) {
    if (s[i] != s[0])
      all_equal = false;
  }
  if (all_equal) {
    cout << ((long long) s.size() * (long long) k / 2) << endl;
  } else {
    s2 = "" + s;
    long long res = 0;
    char last_char = '0';
    for (int i = 0; i < s.size(); i++) {
      if (s[i] == last_char) {
        s[i] = '0';
        res++;
      }
      last_char = s[i];
    }
    s2 = last_char + s2;
    long long res2 = 0;
    last_char = '1';
    for (int i = 0; i < s2.size(); i++) {
      if (s2[i] == last_char) {
        s2[i] = '0';
        res2++;
      }
      last_char = s2[i];
    }
    res += res2 * (k - 1);
    cout << res << endl;
  }
  return 0;
}

Measured memory_bytes: 256
N,W=[int(x) for x in raw_input().split()]
A=[]
maxval=0
for i in range(N):
    w,v=[int(x) for x in raw_input().split()]
    A.append([w,v])
    maxval+=v
B=[[ 1e10  for i in range(maxval+1)] for j in range(N)]
B[0][A[0][1]]=A[0][0]
for x in range(N):
    B[x][0]=0

for i in range(1,N):
    w,v=A[i]
    for j in range(1, maxval+1):
        if (j>=v and B[i-1][j-v]+w <=W):
            B[i][j]=min(B[i-1][j-v]+w, B[i-1][j])
        else:
            B[i][j]=B[i-1][j]
for j in range(maxval,-1,-1):
    if B[-1][j]!=1e10:
        print j
        break


Measured memory_bytes: 140676
#include <bits/stdc++.h>
using namespace std;
#define all(v) (v).begin(), (v).end()
#define P pair<int,int>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define endl '\n'
#define ll long long

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

    if(m == 0){
        if(n == 1) cout << 0 << endl;
        else if(n == 2) cout << 10 << endl;
        else if(n == 3) cout << 100 << endl;
        return 0;
    }
    vector<int> s(m),c(m);
    rep(i,m) {
        cin >> s[i] >> c[i];
        s[i]--;
    }

    int ans = -1;
    for(int i = 0; i <= 999; i++){
        string x = to_string(i);
        int N = (int)x.size();
        bool flag = true;
        for(int j = 0; j < m; j++){
            if(N != n) {
                flag = false;
                break;
            }
            if((x[s[j]] - '0') != c[j]) {
                flag = false;
            }
        }
        if(flag){
            ans = i;
            break;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
n=int(input())
ar=[int(i) for i in input().strip().split(" ")]
from collections import defaultdict
ev=defaultdict(int)
od=defaultdict(int)

def g(i):
    return (i[1],i[0])

for i in range(0,n,2):
    od[ar[i]]+=1

for i in range(1,n,2):
    ev[ar[i]]+=1

odd=list(od.items())
even=list(ev.items())
odd.append((0,0))
even.append((0,0))
odd.sort(key=g)
even.sort(key=g)

o1=odd[-1]
o2=odd[-2]
e1=even[-1]
e2=even[-2]
if o1[0]!=e1[0]:
    print(n-o1[1]-e1[1])
else:
    a1=(n-o1[1]-e2[1])
    a2=(n-o2[1]-e1[1])
    print(min(a1,a2))



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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll MOD = 1e9+7;

int main(){
    string S;
    cin >> S;
    int N = S.length();

    string buf;
    ll ans = 0;
    REP(i,N){
        char c = S[i];
        int size = buf.size();
        if(size == 0){
            buf += c;
        }
        else if(c == 'A'){
            if(buf[size-1] == 'B' || buf[size-1] == 'C'){
                buf.clear();
                buf += c;
            }
            else{
                buf += c;
            }
        }
        else if(c == 'B'){
            if(buf[size-1] == 'A'){
                buf += c;
            }
            else{
                buf.clear();
            }
        }
        else if(c == 'C'){
            if(buf[size-1] == 'B'){
                ans += size-1;
                buf.pop_back();
            }
            else{
                buf.clear();
            }
        }
    }

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


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

int k, n;
bool disliked[125];
 
bool cek(int x) {
    while(x > 0) {
        int now = x % 10;
        if(disliked[now]) return false;
        x /= 10;
    }
	return true;
}
 
int main() {
	scanf("%d %d", &n, &k);
	for(int i = 0 ; i < 123 ; i++) disliked[i] = false;
    for(int i = 0 ; i  < k ; i++ ) {
        int qwe;
        scanf("%d", &qwe);
        disliked[qwe] = true;
    }
 
	for(int i = n ; i < INT_MAX-1 ; i++) {
		if(cek(i)) {
			printf("%d\n", i);
			return 0;
		}
	}
 
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int num,num1;
    scanf("%d %d",&num,&num1);
    int cal,check;    
    int sum=1;
    for(;;){
    cal=num/num1;
    //printf("%d",cal);
    if(cal==0){break;}
    num=cal;
    sum+=1;
    }
  printf("%d",sum);
return 0;
}

Measured memory_bytes: 128
#include <vector>
#include <stdio.h>

using namespace std;

int main()
{
    vector<int> h;
    int n, k, tmp;
    scanf("%d%d", &n, &k);
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &tmp);
        h.push_back(tmp);
    }
    int sum = 0;
    for (auto guy : h)
    {
        if (guy >= k) sum += 1;
    }
    printf("%d", sum);
    return 0;
}

Measured memory_bytes: 892
maxs=[0]
num=0
for i in range(1,11):
    sum=0
    for j in range(i):
        sum+=(10-j-1)*(i-j)
    maxs.append(sum)


def solve(used,rest,sum,memo):
    
    if rest==0:
        return sum==0
    else:
        num=0
        for i in range(10):
            num*=2
            if used[i]:num+=1

        if (num,rest,sum) in memo:
            return memo[(num,rest,sum)]
        if sum<0:return 0
        if sum>maxs[rest]:return 0
        ans=0
        for i in range(10):
            if not used[i]:
                used[i]=True
                ans+=solve(used,rest-1,sum-(i)*rest,memo)
                used[i]=False
        memo[(num,rest,sum)]=ans
        return memo[(num,rest,sum)]

memo={}
while True:
    try:
        n,s=map(int,input().split())
        used=[False for i in range(10)]
        ans=solve(used,n,s,memo)
        print(ans)
    except:
        break

Measured memory_bytes: 16800
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>
#include <deque>
#include <iomanip>
#include <cstdio>
#include <stack>
#include <numeric>

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf 1000000007
#define mod 998244353
#define rep(i,n) for(int i=0;i<(int)(n);++i)
set<string> st;int n;
char ch[]={'a','b','c'};
void dfs(string s){
    rep(i,n-1){
        if(s[i]!=s[i+1]){
            int c;
            rep(k,3){
                if(s[i]!=ch[k]&&s[i+1]!=ch[k]){
                    c = k;
                }
            }
            string t = s;
            t[i] = ch[c];
            t[i+1] = ch[c];
            if(st.count(t)==0){
                st.insert(t);
                dfs(t);
            }
        }
    }


}
ll dp[200010][3][3][2];
int main(){
    string s;
    cin >> s;
    n = s.size();
    if(n<=5){
        st.insert(s);
        dfs(s);
        for(auto x:st){
            cerr << x << endl;
        }
        cout << st.size() << endl;
        return 0;
    }
    set<char>ttt;
    int c = 0;
    bool flag = 1;
    rep(i,n-1){
        if(s[i]==s[i+1])flag = 0;
    }
    rep(i,n){
        ttt.insert(s[i]);
        c += s[i]-'a';
        c %= 3;
    }
    if(ttt.size()==1){
        cout << 1 << endl;
        return 0;
    }
    rep(i,n){
        if(i==0){
            dp[0][0][0][0] = 1;
            dp[0][1][1][0] = 1;
            dp[0][2][2][0] = 1;
        }else{
            rep(l,3){
                rep(k,3){
                    rep(j,3){
                        if(l!=k)dp[i][(j+k)%3][k][0] += dp[i-1][j][l][0];
                        else dp[i][(j+k)%3][k][1] += dp[i-1][j][l][0];
                        dp[i][(j+k)%3][k][1] += dp[i-1][j][l][1];
                        dp[i][(j+k)%3][k][0] %= mod;
                        dp[i][(j+k)%3][k][1] %= mod;

                    }
                }
            }
        }
    }
    ll ans = (dp[n-1][c][0][1]+dp[n-1][c][1][1]+dp[n-1][c][2][1])%mod;
    if(flag)ans++;
    ans %= mod;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 28668
# -*- coding: utf-8 -*-
import bisect

# input
N = int(input())
L = list(map(int, input().split()))

# solve
ans = 0
L.sort()
for i in range(N):
    for j in range(i + 1, N):
        r = bisect.bisect_left(L, L[i] + L[j])
        l = j + 1
        ans += max(0, r - l)

# output
print(ans)


Measured memory_bytes: 3188
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int descending_compare(const void *a, const void *b){
    if (*(int*)a > *(int*)b){
        return -1;
    }else if (*(int*)a == *(int*)b){
        return 0;
    }else{
        return 1;
    }
}

int ascending_compare(const void *a, const void *b){
    if (*(int*)a < *(int*)b){
        return -1;
    }else if (*(int*)a == *(int*)b){
        return 0;
    }else{
        return 1;
    }
}


int lower_bound(int *a, int n, int key){
    int left, mid, right;
    left = 0, right = n;
    mid = (left + right)/2;
    while ((left+1 != mid || mid+1 != right) && mid != left){
        if (key > a[mid]){
            left = mid;
        }else{
            right = mid+1;
        }
        mid = (left + right)/2;
    }
    if (a[left] >= key)return left;
    if (a[mid] >= key)return mid;
    if (a[right] >= key)return right;
    return n;
}


int main(void){
    int n, k;
    int i;
    int dp[11];
    scanf("%d %d", &n, &k);
    dp[0] = 1;

    for (i = 1; i <= n; i++){
        if (dp[i-1]*2 > dp[i-1] + k){
            dp[i] = dp[i-1] + k;
        }else{
            dp[i] = dp[i-1] * 2;
        }
    }

    printf("%d\n", dp[n]);
    

    return 0;
    
}


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

int suma,sumb;

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

    int n;
    cin>>n;

    vector<int> a(n);

    for(int i=0;i<n;i++)cin>>a[i];

    sort(a.begin(),a.end(),greater<int>());

    for(int i=0;i<n;i++)
    {
        if(i%2)sumb+=a[i];
        else suma+=a[i];
    }

    cout<<suma-sumb<<"\n";

    return 0;
}


Measured memory_bytes: 3568
n = int(input())
s = []
for i in range(n):
    s.append(input())
m = int(input())
t = []
for i in range(m):
    t.append(input())
ans = 0
for i in range(n):
    tmp = s[i]
    cnt = 0
    for j in range(n):
        if tmp == s[j]:
            cnt += 1
    for k in range(m):
        if tmp == t[k]:
            cnt -= 1
    ans = max(ans,cnt)
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>

#define CH(N,A,B) (A<=N&&N<B)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define RREP(i,a,b) for(int i=(b-1);a<=i;i--)
#define F first
#define S second
#define ll long long;

const int INF = 1e9;
const long long  LLINF = 1e15;

using namespace std;

int main() {
  long long  N, A, B;
  cin>>N>>A>>B;
  if(A > B || (N < 2 && A!=B)){
    cout<<0<<endl;
    return 0;
  }
  cout<<((N-1)*B+A) - ((N-1)*A+B) +1<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<queue>
using namespace std;
inline int read()
{
	int x;char c;
	while((c=getchar())<'0'||c>'9');
	for(x=c-'0';(c=getchar())>='0'&&c<='9';)x=x*10+c-'0';
	return x;
}
#define N 262144
#define INF 0x3FFFFFFF
#define mp make_pair
#define tp pq.top()
#define F first
#define S second
int t[N*2+5],t1[N*2+5],t2[N*2+5],p[N];
priority_queue<pair<pair<int,int>,pair<int,int> > > pq;
void build(int*t){for(int i=N;--i;)t[i]=min(t[i<<1],t[i<<1|1]);}
int query(int*t,int l,int r)
{
	int res=INF;
	for(l+=N-1,r+=N+1;l^r^1;l>>=1,r>>=1)
	{
		if(~l&1)res=min(res,t[l+1]);
		if( r&1)res=min(res,t[r-1]);
	}
	return res;
}
void push(int l,int r)
{
	if(l>r)return;
	int x=query(l&1?t1:t2,l,r);
	pq.push(mp(mp(-x,query(l&1?t2:t1,p[x]+1,r)),mp(l,r)));
}
int main()
{
	int n=read(),i,x,y,l,r;
	for(i=1;i<=n;++i)p[x=read()]=i,t[i+N]=x,t1[i+N]=i&1?x:INF,t2[i+N]=i&1?INF:x;
	build(t);build(t1);build(t2);
	for(push(1,n);!pq.empty();)
	{
		x=-tp.F.F;y=tp.F.S;l=tp.S.F;r=tp.S.S;
		printf("%d %d ",x,y);pq.pop();
		push(l,p[x]-1);push(p[x]+1,p[y]-1);push(p[y]+1,r);
	}
}

Measured memory_bytes: 8948
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<numeric>
using namespace std;
int main(){
    int N,M;
    cin>>N>>M;
    vector<int>cnt(M,0);//M個0を入れる
    for(int i=0;i<N;i++){
        int k;
        cin>>k;
        for(int j=0;j<k;j++){
            int a;
            cin>>a;//横にk列とる
            --a;//配列の番兵にするために-1する
            ++cnt[a];
        }
    }
    int ans=0;
    for(int i=0;i<M;i++){
        if(cnt[i]==N){
            ans++;
        }
    }
    cout<<ans<<endl;

}

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

typedef pair<int, int> p;

bool comp(p& f, p& s) {
    return f.second < s.second;
}

int main() {
    int N, M, a, b;
    cin >> N >> M;
    vector<p> v;
    for (int i = 0; i < M; ++i) {
        cin >> a >> b;
        v.push_back(p(a, b));
    }
    sort(v.begin(), v.end(), comp);
    int res = 0;
    for (int i = 0; i < M; ++i) {
        ++res;
        int j;
        for (j = i + 1; j < M; ++j) {
            if (v[i].second <= v[j].first) break;
        }
        i = j - 1;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 1400
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
#include <bitset>
using namespace std;
typedef long long ll;
int main(){
  ll n = 0;
  cin >> n;
  vector<vector<ll>> bit(n,vector<ll>(20));
  for(int i = 0;i < n;i++){
    ll in = 0;
    cin >> in;
    for(int j = 19;j >= 0;j--){
      bit[i][j] = in / pow(2,j);
      in -= bit[i][j] * pow(2,j);
    }
  }
  ll l = 0;
  ll res = 0;
  ll r = 1;
  vector<ll> now(20);
  for(int i = 0;i < 20;i++)now[i] = bit[0][i];
  //cout << "a" << endl;
  for(int i = 0;i < n - 1;i++){
    while(1){
      if(r >= n)break;
      bool ok = true;
      for(int j = 0;j < 20;j++){
        if(now[j] + bit[r][j] > 1)ok = false;
      }
      //cout << i << " b" << endl;
      if(!ok)break;
      for(int j = 0;j < 20;j++)now[j] += bit[r][j];
      r++;
    }
    //cout << i << " " << r << endl;
    res += r - i;
    for(int j = 0;j < 20;j++)now[j] -= bit[i][j];
  }
  res++;
  cout << res << endl;
}

Measured memory_bytes: 39296
#include <iostream>
#include <vector>
#include <iomanip>
#include <stack>
#include <array>
#include <deque>
#include <forward_list>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iterator>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <time.h>
#include <complex>
#include <cmath>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rrep(i,n) for(int i=n;i>0;i--)
#define arep(a,i,n) for(int (i)=a;(i)<n;(i)++)
#define SORT(v) sort((v).begin(),(v).end())
#define TEMP(type,x,y) do {temp temp=x,x=y,y=temp}while(0)
const ll INF = (1LL << 50);

int main() {

	int Q; cin >> Q;

	int MAX = 1000005;

	vector<int> is_prime(MAX, 1);//1(素数である)で初期化
	is_prime[0] = 0;
	is_prime[1] = 0;

	/* エラトステネスの篩 */
	arep(2, i, MAX) {
		if (!is_prime[i]) continue;
		for (int j = i * 2; j < MAX; j += i) {//iが素数ならば、その2, 3, ...倍の数は素数ではない
			is_prime[j] = 0;
		}
	}

	vector<int> a(MAX, 0);

	/* 2017likeの数を探索 */
	rep(i, MAX) {
		if (i % 2 == 0) continue;
		if (is_prime[i] && is_prime[(i + 1) / 2]) a[i] = 1;
	}

	//累積和
	vector<int>s(MAX + 1, 0);
	rep(i, MAX) s[i + 1] = s[i] + a[i];//s[0]=0, s[1]=a[0], s[2]=a[0]+a[1], ..., s[11]=a[12]+a[11]+ … +a[0]

	for (int i = 0; i < Q; i++) {
		int l, r;
		cin >> l >> r;
		++r;//累積和に対応させる, 2~10における2017like数の合計はs[11]-s[2] = a[12]+a[11]+ … +a[2]

		cout << s[r] - s[l] << endl;
	}

	return 0;

}

Measured memory_bytes: 12416
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <algorithm>
#include <set>
#include <string>
#include <queue>

using namespace std;

#define rep(i, N) for(int (i) = 0; (i) < (N); (i) ++)
typedef long long ll;

int main(){
    ll N;
    cin >> N;
    vector<ll> as(N, 0);
    vector<ll> bs(N, 0);
    vector<ll> sums;
    rep(i, N){
        cin >> as[i];
    }
    rep(i, N){
        cin >> bs[i];
    }
    ll minus = 0;
    rep(i, N){
        ll tmp = as[i] - bs[i];
        if(tmp < 0){
            minus += tmp * -1;
        }else{
            sums.push_back(tmp);
        }
    }
    if(minus == 0){
        cout << 0 << endl;
        return 0;
    }
    sort(sums.begin(), sums.end(), greater<ll>());

    for(int i = 1; i < sums.size(); i ++){
        sums[i] += sums[i - 1];
    }
    auto iter = lower_bound(sums.begin(), sums.end(), minus);

    if(iter == sums.end()){
        cout << "-1" << endl;
    }else{
        ll ans = N - sums.size();
        ans += iter - sums.begin() + 1;
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 2936
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = s; i < (int)(n); i++)
#define out(x) cout << x << endl;
#define INF 1ll<<60;
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; }

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

int main(){
    int x; cin >> x;
    if(x>=30){
        out("Yes");
    }
    else{
        out("No");
    }

}

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

#define rep(i, n) for(long long i=0;i<(long long)(n);i++)
#define rep2(i, s, n) for(long long i=(s);i<(long long)(n);i++)
#define repi(i, n) for(int i=0;i<(int)(n);i++)
#define rep2i(i, s, n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define chmax(s, t) s=max(s,t);
#define chmin(s, t) s=min(s,t); 

#define deg2rad(deg) (((deg)/360)*2*M_PI)
#define rad2deg(rad) (((rad)/2/M_PI)*360)

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

const ll INF = (1LL<<60);
const int INFi = (1<<29);

/*素数判定*/
bool is_prime(ll n){
    if(n==1) return false;
    for(ll i=2;i*i<=n;i++){
        if(n%i==0) return false;
    }
    return true;
}

/*約数列挙*/
vll enum_divisors(ll n){
    vll l;
    for(ll i=1;i*i<=n;i++){
        if(n%i==0){
            l.push_back(i);
            if(n/i != i) l.push_back(n/i);
        }
    }
   sort(all(l));
   return l;
}

/*素因数分解*/
vector<P> prime_factorize(ll n){
    vector<P> l;
    for(ll i=2;i*i<=n;i++){
        if(n%i!=0) continue;
        ll e = 0;
        while(n%i==0){
            e++;
            n /= i;
        }
        l.push_back({i, e});
    }
    if(n!=1) l.push_back({n, 1});
    return l;
}

/*最小公倍数*/
ll lcm(ll a, ll b){
    return a*b/__gcd(a,b);
}

/*最大公約数*/
ll gcd(ll a, ll b){
    return __gcd(a,b);
}

/*組み合わせ(Combination)*/
const ll CMAX = 1010000;
const ll CMOD = 1e9+7;
ll fac[CMAX], finv[CMAX], inv[CMAX];
// テーブルを作る前処理
void combinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (ll i = 2; i < CMAX; i++) {
		fac[i] = fac[i - 1] * i % CMOD;
		inv[i] = CMOD - inv[CMOD%i] * (CMOD / i) % CMOD;
		finv[i] = finv[i - 1] * inv[i] % CMOD;
	}
}
// 二項係数計算
ll comb(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % CMOD) % CMOD;
}

/*階乗*/
ll factorial(ll n){
    const ll FMOD = 1e9+7;
    ll ret = n;
    for(ll i=n-1;i>0;i--){
        ret*=i;
        ret%=FMOD;
    }
    return (ret?ret:1);
}


int main(){

    ll n; cin >> n;

    ll ans = 0;
    rep(i, n) ans += i+1;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
int main(){
  int x,y; cin>>x>>y;
  int swp;
  if( x < y){
    swp = x; x = y; y =swp;
  }
  while( x%y != 0){
    x = x % y;
    if( x < y){
      swp = x; x = y; y =swp;
    }
  }
  cout << y << endl;
  return 0;
}


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


void init(){
    cin.tie(0);
    cin.sync_with_stdio(0);
}

#define ll long long
#define ld long double
#define ull unsigned long long
#define ull unsigned long long
#define mod 1000000007
#define pi (3.1415926)

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))

#define scd(a)  scanf("%lld",&a)
#define scdd(a,b)	scanf("%lld%lld",&a,&b)
#define scddd(a,b,c)	scanf("%lld%lld%lld",&a,&b,&c)
#define ptab(a)	printf("%lld ",a)
#define pdn(a)	printf("%lld\n",a)
#define pddn(a,b)	printf("%lld %lld\n",a,b)
#define pdddn(a,b,c)	printf("%lld %lld %lld\n",a,b,c)

#define forr(n) for(ll i=0;i<n;i++)
#define rev(n) for(ll i=n-1;i>=0;i--)
#define forp(x, y) for(ll i=x;i<y;i++)
#define loop( j, k, in) for (ll i=j ; i<k ; i+=in)

#define in  cin>>
#define out cout<<
#define en "\n"
#define sp " "

ll sum (int n ){return ((n*(n+1)) / 2) ;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int main()
{
    init();
    //cout << fixed << setprecision(20);
    ld a,b,c; in a>>b>>c; ld eps = 1.0E-14;
    if (sqrt(a) + sqrt(b) +eps < sqrt(c)) cout << "Yes";
    else cout << "No";

}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    int n,k,x[114];
    cin >> n >>k ;
    for(int i=0;i<n;i++){
        cin >> x[i];
    }
    int sum = 0;
    for(int i=0;i<n;i++){
        if((k/2)>=x[i]){
            sum = sum+x[i];
        }
        else{sum = sum + (k - x[i]);}
    }
    cout << 2*sum <<endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;

namespace ABC128 {
	class Program {
		struct Restaurant : IComparable<Restaurant> {
			public String city;
			public int point;
			public int index;
			public Restaurant(String i_city, int i_point, int i_index) {
				city = i_city;
				point = i_point;
				index = i_index;
			}
			public int CompareTo(Restaurant otherobj) {
				int cityCompare = this.city.CompareTo(otherobj.city);
				if (cityCompare != 0) {
					return cityCompare;
				}
				int pointCompare = this.point.CompareTo(otherobj.point);
				if (pointCompare != 0) {
					// 値が大きい順になるよう逆にする
					return -pointCompare;
				}
				return this.index.CompareTo(otherobj.index);
			}
		}
		static void Main(string[] args) {
			// 入力
			int N = int.Parse(Console.ReadLine());
			List<Restaurant> restaurantList = new List<Restaurant>(N);
			for (int i = 0; i < N; i++) {
				String[] array = Console.ReadLine().Split(' ');
				restaurantList.Add(new Restaurant(array[0], int.Parse(array[1]), i + 1));
			}
			// 処理・出力
			// ソートする
			restaurantList.Sort();
			// 出力
			for (int i = 0; i < N; i++) {
				Console.WriteLine(restaurantList[i].index);
			}
		}
	}
}

Measured memory_bytes: 13664
#pragma warning(disable:4996)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <float.h>

#pragma region 定義
typedef long long  ll;
typedef unsigned long long  ull;


#define _itoa(A,N) sprintf(A, "%d", N);

int i_dsort(const void* a, const void* b);
int i_asort(const void* a, const void* b);

int  _gcd(int a, int b);
int  _swp(int* a, int* b);
int _cknum(char* a, int n);
int _atoi(char* s, int len);

int s_asort(const void* a, const void* b);
int s_dsort(const void* a, const void* b);

//昇順
int s_asort(const void* a, const void* b) {
	return(strcmp((char*)a, (char*)b));
}
int s_dsort(const void* a, const void* b) {
	return(strcmp((char*)b, (char*)a));
}

int i_dsort(const void* a, const void* b) {
	return(*(int*)b - *(int*)a);
}
int i_asort(const void* a, const void* b) {
	return(*(int*)a - *(int*)b);
}


int i_gcd(int a, int b);
int i_gcd(int a, int b) {
	if (!b)return a;
	return i_gcd(b, a % b);
}
int i_lcm(int a, int b);
int i_lcm(int a, int b) {
	return (a * b) / i_gcd(a, b);
}
int ll_gcd(ll a, ll b);
int ll_gcd(ll a, ll b) {
	if (!b)return a;
	return ll_gcd(b, a % b);
}
int ll_lcm(ll a, ll b);
int ll_lcm(ll a, ll b) {
	return (a * b) / ll_gcd(a, b);
}

// puts("Yes\n") puts("No\n")
// scanf("%d.%d") 浮動小数点入力を整数２つで得る


//#define pai  3.1415926535 
//#define  _USE_MATH_DEFINES でM_PIが使える

#define deg_rad(X)  (X*(M_PI/180))


int _swp(int* a, int* b)
{
	int tmp;
	tmp = *b; *b = *a; *a = tmp;
	return 0;
}
#define _abs(x) ((x)>0?(x):-(x))
#define _min(x,y) ((x)<(y)?(x):(y))
#define _max(x,y) ((x)<(y)?(y):(x))

int _cknum(char* a, int n) {
	int i;
	char t = '0';

	for (i = 0; i < n; i++) {
		if (a[i] < '0' || a[i]>'9') return 1;
	}
	return 0;
}


int _atoi(char* s, int len) {
	char tmp[20];
	memcpy(tmp, s, len);
	tmp[len] = 0x00;
	return (atoi(tmp));
}

//素因数分解　pf素数が入る　pc 素数の数
//ll _pfact(ll a);
//static ll pf[100000000];
//static ll pc;
//
//ll _pfact(ll a) {
//	long i, r;
//	if (a % 2 == 0) {
//		pf[pc] = 2; pc++;
//		return(_pfact(a / 2));
//	}
//	r = sqrt(a);
//	for (i = 3; i <= r; i += 2) {
//		if (a % i == 0) {
//			pf[pc] = i; pc++;
//			return(_pfact(a / i));
//		}
//	}
//	if (a != 1) {
//		pf[pc] = a; pc++;
//	}
//	return 0;
//
//}

//同じものの最初の文字をNULLにして降順
int _sort(const void* a, const void* b);
int _sort(const void* a, const void* b) {
	char rc;

	rc = strcmp((char*)b, (char*)a);
	if (rc == 0) {
		*(char*)a = 0x00;
		return(1);
	}
	return(rc);
}

#pragma endregion



//ABC 126 B - YYMM or MMYY
int main(void) {

	int i,n,c,v[51],ans=0;

	scanf("%d",&n);
	for (i = 0; i < n; i++) {
		scanf("%d", &v[i]);
	}
	for (i = 0; i < n; i++) {
		scanf("%d", &c);
		ans += (v[i] < c ) ? 0 : v[i] - c;
	}
	
	printf("%d\n", ans);
	return 0;
}




Measured memory_bytes: 1732
n=int(input())
work=[]
total = 0
cnt = 0
for i in range(n):
    tmp=list(map(int,input().split()))
    work.append(tmp)
work.sort(key=lambda x:x[1])

for i in range(n):
    if total+work[i][0] > work[i][1]:
        cnt += 1
        break
    else:
        total += work[i][0]

if cnt==0:
    print("Yes")
else:
    print("No")

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

int main() {
  int a, b;
  cin >> a >> b;
  int wa = (a + b);
  //cout << a << endl;
  //割られる数をa、 割る数をbとした時、
  //(a + (b-1)) / b
  int h = (wa + (2 - 1)) / 2;
  cout << h << endl;
  
  return 0;
}


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

//g++ -g -o yourexe yourfile.cpp
//./yourexe < yourinput.in > youroutput.out

#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

#define M 1000000007

#define ll long long
#define ld long double
#define vi vector<ll>
#define pi pair<ll, ll>
#define vii vector<pi>
#define vvi vector<vi>
#define pb push_back
#define endl "\n"
#define fi first
#define se second

#define REP(i, s, e) for (ll i = s; i < e; i++)
#define RREP(i, s, e) for (ll i = s; i > e; i--)

#define all(v) v.begin(), v.end()
#define part(v, s, e) v.begin() + s, v.begin() + e
#define print(v) for (auto i: v) cout << i << " ";

struct point {
    ll x, y, q;
};

int main() {
    fast
    ll n;
    cin >> n;
    vector<point> pnt(n);
    REP(i, 0, n) {
        cin >> pnt[i].x >> pnt[i].y;
        if (pnt[i].x >= 0 && pnt[i].y >= 0)
            pnt[i].q = 1;
        else if (pnt[i].x < 0 && pnt[i].y >= 0)
            pnt[i].q = 2;
        else if (pnt[i].x < 0 && pnt[i].y < 0)
            pnt[i].q = 3;
        else
            pnt[i].q = 4;
    }
    sort(all(pnt), [](point a, point b) {
        if (a.q != b.q)
            return a.q < b.q;
        return a.y*b.x < b.y*a.x;
    });
    ll ans = 0, xs = 0, ys = 0, r;
    REP(i, 0, n) {
        xs = 0, ys = 0;
        r = i;
        REP(j, 0, n) {
            xs += pnt[r].x;
            ys += pnt[r].y;
            r = (r+1)%n;
            ans = max(ans, xs*xs + ys*ys);
        }
    }
    cout << fixed << setprecision(32) << sqrt((ld)ans) << endl;
    return 0;
}


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


int a(int n, int x, int t) {
  int ans = (n / x) * t;
  if(n % x == 0) {
    return ans;
  }
  return ans + t;
}

int main() {
  int n, x, t;
  cin >> n >> x >> t;
  cout << a(n, x, t);
}

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

int main() {
	int i, j, ctr1 = 0, ctr2 = 0;
	string s, ans;
	vector<string> ANS;
	bool B[8][8];

	while (1) {
		while (cin >> s) {
			for (i = 0; i < 8; i++) {
				B[ctr1][i] = stoi(s.substr(i, 1));
			}
			ctr1++; ctr2++;  if (ctr1 == 8)break;
		}

		for (i = 0; i < 7; i++) {//A
			for (j = 0; j < 7; j++) {
				if (B[i][j] == 1 && B[i][j + 1] == 1 && B[i + 1][j] == 1 && B[i + 1][j + 1] == 1)ans = 'A';
			}
		}

		for (i = 0; i < 5; i++) {//B
			for (j = 0; j < 7; j++) {
				if (B[i][j] == 1 && B[i + 1][j] == 1 && B[i + 2][j] == 1 && B[i + 3][j] == 1)ans = 'B';
			}
		}

		for (i = 0; i < 7; i++) {//C
			for (j = 0; j < 5; j++) {
				if (B[i][j] == 1 && B[i][j + 1] == 1 && B[i][j + 2] == 1 && B[i][j + 3] == 1)ans = 'C';
			}
		}

		for (i = 0; i < 6; i++) {//D
			for (j = 1; j < 8; j++) {
				if (B[i][j] == 1 && B[i + 1][j - 1] == 1 && B[i + 1][j] == 1 && B[i + 2][j - 1] == 1)ans = 'D';
			}
		}

		for (i = 0; i < 7; i++) {//E
			for (j = 0; j < 6; j++) {
				if (B[i][j] == 1 && B[i][j + 1] == 1 && B[i + 1][j + 1] == 1 && B[i + 1][j + 2] == 1)ans = 'E';
			}
		}

		for (i = 0; i < 6; i++) {//F
			for (j = 0; j < 7; j++) {
				if (B[i][j] == 1 && B[i + 1][j] == 1 && B[i + 1][j + 1] == 1 && B[i + 2][j + 1] == 1)ans = 'F';
			}
		}

		for (i = 0; i < 7; i++) {//G
			for (j = 1; j < 7; j++) {
				if (B[i][j] == 1 && B[i][j + 1] == 1 && B[i + 1][j - 1] == 1 && B[i + 1][j] == 1)ans = 'G';
			}
		}
		if (ctr2 == 0)break; ctr1 = 0;
		ANS.push_back(ans); ctr2 = 0;
	}
	for (i = 0; i < ANS.size(); i++)cout << ANS[i] << endl;
	return 0;
}

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

int main()
{
  ll N; cin >> N;
  ll K; cin >> K;
  vector<ll> a(N);
  for (int i=0; i<N; i++){
    cin >> a[i];
  }

  vector<bool> dp(K+1, false);
  for (int i=1; i<=K; i++) {
    for (int j=0; j<N; j++) {
      if (i >= a[j]) {
        dp[i] = (dp[i] | !dp[i-a[j]]);
      }
    }
  }

  if (dp[K]) cout << "First" << endl;
  else cout << "Second" << endl;

  return 0;
}


Measured memory_bytes: 384
char = ["",".,!? ","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"]
n = int(input())

for _ in range(n):
    s = input()
    ans = ""
    flag = True
    prev = 0
    cnt = 0
    for i in s:
        if i != '0':
            prev = int(i)
            cnt += 1
        elif cnt != 0:
            ans += char[prev][(cnt - 1) % len(char[prev])]
            cnt = 0
    print(ans)

Measured memory_bytes: 7552
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b;
    cin>>a>>b;
    int ans = 0;
    if(a>b&&((a>0&&b>0)||a<0&&b<0))
        ans=abs(abs(a)-abs(b))+2;
    else if(a<0&&b>0||a>0&&b<0)
        ans=abs(abs(a)-abs(b))+1;
    else{
        ans = abs(abs(a)-abs(b));
    }
    if(a<b&&(b-a)<ans)
        ans = b-a;
    if(a>b&&a==0)
        ans = abs(b)+1;
    if(a<b&&a==0)
        ans = b;
    if(a>b&&b==0)
        ans = a+1;
    if(a<b&&b==0)
        ans = -a;

    cout<<ans;


}


Measured memory_bytes: 384
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC178D
{
    class Program
    {
        static void Main(string[] args)
        {
            int S = int.Parse(Console.ReadLine());
            long[] ans = new long[2001];
            long mod = (long)Math.Pow(10, 9) + 7;
            ans[0] = 1;
            ans[1] = 0;
            ans[2] = 0;
            for(int i = 1; i <= 2000; i++)
            {
                for (int j = 0; j <= i-3; j++)
                {
                    ans[i] += ans[j];
                    ans[i] %= mod;
                }
            }
            Console.WriteLine(ans[S]);
        }
    }
}


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

using namespace std;

int main() {
  int n;
  cin >> n;
  string str;
  cin >> str;
  string str1, str2;
  str1 = str.substr(0, n / 2);
  str2 = str.substr(n / 2, n / 2);
  if (n % 2 == 0 && str1 == str2)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  int N, M;
  cin >> N >> M;
  int A[M];
  for (int i = 0; i < M; i++) {
    cin >> A[i];
  }
  int p[N]{};
  for (int i = 0; i < M; i++) {
    for (int j = 0; j < N; j++) {
      int b;
      cin >> b;
      if (A[i] == b) {
        p[j]++;
      } else {
        p[A[i] - 1]++;
      }
    }
  }
  for (int i : p) {
    cout << i << "\n";
  }
  return 0;
}


Measured memory_bytes: 3100
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <iomanip>
#include <set>
#include <map>
#include <climits>
#include <utility>
#include <deque>
#include <list>
#include <stdexcept>
using namespace std;

#define ll long long
#define VEC2(type, name, dim0, dim1, init_val) vector<vector<type>> name(dim0, vector<type>(dim1, init_val))
#define IN(type, name) type name; cin >> name
#define IN_V(type, name, size) vector<type> name(size); for(auto& x: name) cin >> x
#define IN_VPair(type1, type2, name, size) vector<pair<type1, type2>> name(size); for(auto& x: name) cin >> x.first >> x.second
#define IN_VW(type, name, size) vector<type> name(size); for(auto& x: name)

#define REP(name, start, end) for(ll name = (start); (name) < (end); ++(name))
#define REPR(name, end, start) for(ll name = (start - 1); (name) >= (end); --(name))
#define ALL(iterable) (iterable).begin(), (iterable).end()

int main()
{
	cout << fixed << setprecision(6);
	IN(ll, n);
	IN(ll, w);
	IN_VPair(ll, ll, wvls, n);
	ll v = 1000;
	VEC2(ll, cost_dp, n, n * v + 1, LLONG_MAX / 2);
	//vector<ll> cost_dp(n);
	
	REP(j, 0, n * v + 1) {
		if (j <= wvls[0].second)cost_dp[0][j] = wvls[0].first;
	}
	REP(i, 1, n) {
		REPR(j, 0, n * v + 1) {
			cost_dp[i][j] = min(
				{
				cost_dp[i - 1][j],	// no need to take
				(j < n * v ? cost_dp[i][j + 1] : LLONG_MAX / 2),	// already taken
				(j - wvls[i].second > 0 ? cost_dp[i - 1][j - wvls[i].second] + wvls[i].first
										 : wvls[i].first),	// need to take
				}
			);
		}
	}

	cout << count_if(ALL(cost_dp[n - 1]), [&](auto w_) {return w_ <= w; }) - 1 << endl;
	return 0;
}

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

int main(void){
    int N, x, i;
    char S[100005];
    scanf("%d%s", &N, S);
    x=1;
    for (i=0; i<=N-2; i++) if (S[i]!=S[i+1]) x++;
    printf("%d", x);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mp(a,b) make_pair(a,b)
using namespace std;
typedef pair<int,int> pii;
const int MAXN = 1e5 + 5;
pii a[MAXN];
int ans,n,L,R;
bool cmp(pii x,pii y)
{
	return (x.first < y.first ||x.first == y.first&&x.second > y.second);
}

int main()
{
	scanf("%d",&n);
 	for (int i = 0;i < n; ++i)
 		scanf("%d %d",&a[i].first,&a[i].second);
 	L = 1; R = 1e9; ans = 0;
 	for (int i = 0;i < n; ++i)
 	{
	 	L = max(L,a[i].first);
		R = min(R,a[i].second);
		ans = max(ans,a[i].second - a[i].first + 1);
	}
	if (L <= R) ans += R - L + 1;
	for (int i = 0;i < n; ++i)
	{
		a[i].first = max(0,R - a[i].first + 1);
		a[i].second = max(0,a[i].second - L + 1);
	}
	sort(a,a + n,cmp);
	int mini = a[0].second;
	for (int i = 1;i < n; ++i)
	{
		ans = max(ans,a[i].first + mini);
		mini = min(mini,a[i].second);
	}
	cout<<ans;
 } 

Measured memory_bytes: 1024
/*                    */
#include <bits/stdc++.h>
using namespace std;
using lint = int64_t;
namespace my {
char itoc(int i) { return i + '0'; }
int ctoi(char c) { return c - '0'; }
lint gcd(lint a, lint b) {
  a = abs(a);
  b = abs(b);
  if (a < b) swap(a, b);
  while (b != 0) {
    a %= b;
    swap(a, b);
  }
  return a;
}
lint lcm(lint a, lint b) { return a * b / my::gcd(a, b); }
}  // namespace my
/*                    */

int main() {
  int s, w;
  cin >> s >> w;
  if (w >= s)
    cout << "unsafe" << endl;
  else
    cout << "safe" << endl;
}

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

int main() {
  
  int n, m;
  cin >> n >> m; 
  
  vector<int> vec(n,0);
  for(int i=0; i<m; i++){
    int a, b;
    cin >> a >> b;
    vec.at(a-1)++;
    vec.at(b-1)++;
  }
  
  for(int i=0; i<n; i++){
    cout << vec.at(i) << endl;
  } 
  
}

Measured memory_bytes: 256
n, h = map(int, input().split())
a, b = [], []
for _ in range(n):
    x, y = map(int, input().split())
    a.append(x)
    b.append(y)
max_a = max(a)
b.sort(reverse=True)
cnt = 0
for i in range(n):
    if b[i] < max_a:
        break
    h -= b[i]
    cnt += 1
    if h <= 0:
        break
if h > 0:
    cnt += (h - 1) // max_a + 1
print(cnt)

Measured memory_bytes: 16940