akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<(n);i++)
#define loop(i,a,n) for(i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;

void compress(vi &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

int idx(int i,vector<int> &c){
    return lower_bound(all(c),i)-c.begin();
}

int main(void) {
    int i,j;
    int n;
    while(cin >> n, n){
        int m = n + 4;
        vi xx(m), yy(m);
        vi x(n+1),y(n+1);
        rep(i,n) cin >> x[i] >> y[i], xx[i] = x[i], yy[i] = y[i];
        vi rx(4),ry(4);
        rep(i,4) cin >> rx[i] >> ry[i], xx[n+i] = rx[i], yy[n+i] = ry[i];

        xx.push_back(INF);xx.push_back(-INF);
        yy.push_back(INF);yy.push_back(-INF);
        compress(xx);compress(yy);

        x[n] = x[0], y[n] = y[0];
        int a[200][200]={};

        int ax = -INF, ay = -INF;
        int ix = INF, iy = INF;

        rep(i,4){
            ax = max(ax, rx[i]);
            ay = max(ay, ry[i]);
            ix = min(ix, rx[i]);
            iy = min(iy, ry[i]);
        }

//cout << ax << " " << ay << " " << ix << " " << iy << endl;
        rep(i,n){
            if(x[i] < x[i+1]){
                loop(j,idx(x[i],xx),idx(x[i+1],xx)){
                    a[j][idx(y[i],yy)]--;
                }
            }
            if(x[i] > x[i+1]){
                loop(j,idx(x[i+1],xx),idx(x[i],xx)){
                    a[j][idx(y[i],yy)]++;
                }
            }
        }

        int ans = 0;

        rep(i,199){
            rep(j,199){
                a[i][j+1] += a[i][j];
                if(a[i][j]){
                    //cout << xx[i+1] <<" " << xx[i] << " " << yy[j+1] <<" " << yy[j] << endl;
                    if(iy <= yy[j] && yy[j+1] <= ay && ix <= xx[i] && xx[i+1] <= ax) continue;

                    ans += (xx[i+1] - xx[i])*(yy[j+1] - yy[j]);
                }
            }
        }

        cout << ans << endl;
    }
}



Measured memory_bytes: 3272
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int value = N;
		int sum=0;
		for(int i=0;i<9;i++){
			sum +=  (value % 10);
			value /= 10;
			if(value == 0)break;
		}
		if(N%sum == 0) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
}


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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (ll i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define FORI(i,v) for (auto i = v.begin(); i != v.end(); i++)
#define ALL(v) v.begin(), v.end()
#define CHMIN(x,y) x = min(x, y)
#define CHMAX(x,y) x = max(x, y)
#define YES(b) cout << ((b) ? "YES" : "NO") << endl
#define Yes(b) cout << ((b) ? "Yes" : "No") << endl
#define DOUBLE(d) cout << fixed << setprecision(15) << (d) << endl

const int MAX = 15;
const int INF = 1e9;

int N, M, X;
int C[MAX], A[MAX][MAX];

int sub(int state) {
    int ret = 0;
    vi check(M);
    REP (i, N) if ((state>>i)&1) {
        ret += C[i];
        REP (j, M) check[j] += A[i][j];
    }
    REP (j, M) if (check[j] < X) return INF;
    return ret;
}

int solve() {
    int ret = INF;
    REP (i, 1<<N) CHMIN(ret, sub(i));
    if (ret == INF) return -1;
    return ret;
}

int main() {
    cin >> N >> M >> X;
    REP (i, N) {
        cin >> C[i];
        REP (j, M) cin >> A[i][j];
    }
    cout << solve() << endl;
}

Measured memory_bytes: 3608
package main

import (
	"fmt"
	"strconv"
)

func main() {
	var N int
	fmt.Scan(&N)

	//fmt.Println(solve3(N))
	fmt.Println(answer(N))
}

func answer(N int) int {
	ans := 0
	for i := 1; i <= N; i++ {
		if len(strconv.Itoa(i))%2 == 1 {
			ans++
		}
	}
	return ans
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n",(x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define isYes(x) printf("%s\n",(x) ? "Yes" : "No")
#define isIn(x,y,h,w) (x >= 0 && x < h && y >= 0 && y < w)

#define int long long
//using ll = long long;
using P = pair<int,int>;

ostream &operator<<(ostream &os,const P &p){ return os << "(" << p.first << "," << p.second << ")"; }
template<class T>
ostream &operator<<(ostream &os,const vector<T> &v){
	for(int i = 0;i < v.size();i++) os << (i ? "," : "[") << v[i];
	os << "]";
	return os;
}

template<class T> T &chmin(T &a,const T &b){ return a = min(a,b); }
template<class T> T &chmax(T &a,const T &b){ return a = max(a,b); }

const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

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

signed main(){
	int h,w;
	cin >> h >> w;
	if(h == 1 || w == 1) cout << 1 << endl;
	else cout << (h * w + 1) / 2 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N, sum=0, ans;
    cin >> N;
    string Num = to_string(N);

    for(int i=0; i<Num.size(); i++){
	sum += Num[i] - '0';
    }

    ans = (N%sum==0 ? 1: 0);
    cout << (ans? "Yes": "No") << endl;
}



Measured memory_bytes: 256
N,Q=map(int,input().split())
S=input()
count=[0]*N
for i in range(1,N):
    count[i]+=count[i-1]
    if S[i-1:i+1]=="AC":count[i]+=1
for i in range(Q):
    l,r=map(int,input().split())
    print(count[r-1]-count[l-1])

Measured memory_bytes: 9108
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
using Graph = vector<vector<int>>;
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;

int main(){
    int n, h, w;
    cin >> n >> h >> w;
    cout << (n-h+1) * (n-w+1) << endl;
    return 0;
}

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

int main()
{
    
    int w,h,x,y;
    cin>>w>>h>>x>>y;

    if(2*x==w&&2*y==h)
        cout << fixed << setprecision(15) << (double)w*(double)h/2.0 <<' '<<1<< endl;
    else
        cout << fixed << setprecision(15) << (double)w*(double)h/2.0 <<' '<<0<< endl;

    return 0;
}

Measured memory_bytes: 256
D, G = map(int, input().split(" "))
PC = [list(map(int, input().split(" "))) for _ in range(D)]

min_count = 10**18
for i in range(1<<D):
    # print(bin(i)[2:])
    count = 0
    point = 0
    top_zero = None
    for j, (p, c) in enumerate(PC):
        if (i>>j)%2:
            count += p
            point += 100*(j+1)*p + c
        else:
            top_zero = j
    if top_zero != None:
        for j in range(PC[top_zero][0]-1):
            # print(j, top_zero, point)
            if point >= G:
                break
            point += 100*(top_zero+1)
            count += 1
    # print("count:", count)
    if point >= G:
        min_count = min(min_count, count)

print(min_count)

Measured memory_bytes: 3064
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    N = int(readline())
    seq = []

    for _ in range(N):
        a = int(readline())
        a -= 1
        seq.append(a)

    cur = 0

    for i in range(1, 10 ** 6):
        cur = seq[cur]
        if cur == 1:
            return print(i)

    print(-1)


if __name__ == '__main__':
    main()


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

const long long INF = 1e7 + 1;
const long long MOD = 1000000007;
const long double PI = 3.1415926;

#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); ++i)
#define RFOR(i,r,n) for(ll i = (ll)(n-1); i >= r; --i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()

using ll = long long int;
using ull = unsigned long long int;
using vi = vector<ll>;
using vp = vector<pair<ll, ll>>;
using vs = vector<string>;
using vc = vector<char>;
using lst = list<ll>;

ll n, m, k, ans = 0, sum = 0, cnt = 0;
string s;
char c;

/*--------------------template--------------------*/

int main() {
    cin >> n;
    pair<pair<string,ll>,int> res[n]; 
    REP(i,n) { 
        cin >> s >> m; 
        res[i] = make_pair(make_pair(s,-m),i+1);
    }
	sort(res,res+n);
    /*sort(res, res+n,
         [](const pair<pair<string,ll>,int>&& x, 
            const pair<pair<string,ll>,int>&& y)
         {return x.first.second > y.first.second;});
    sort(res, res+n, 
         [](const pair<pair<string,ll>,int>& x, 
            const pair<pair<string,ll>,int>& y)
         {return x.first.first < y.first.first;});*/
    //REP(i,n) cout << res.at(i).first << res.at(i).second << endl;
    for(auto&&e:res) {
        cout << e.second << endl;
    }
}


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

using namespace std;

int insertSort(int a[], int n, int g)
{
	int cnt = 0;
	for (int i = g; i < n; ++i)
	{
		int v = a[i];
		int j = i - g;
		while (j >=0 && a[j] > v) 
		{
			a[j + g] = a[j];
			j -= g;
			cnt++;		
		}
		a[j + g] = v;
	}
	return cnt;
}

int shellSort(int a[], int n, vector<int> g)
{	
	int cnt = 0;
	for (int i = g.size() - 1; i >= 0; --i)
	{
		cnt += insertSort(a, n, g[i]);
	}
	return cnt;
}

int main(int argc, char const *argv[])
{
	ios::sync_with_stdio(false);
	int n = 0;
	cin >> n;
	int a[n];
	for (int i = 0; i < n; ++i)
	{
		cin >> a[i];
	}

	vector<int> g;
	int i = 1;
	while(i <= n)
	{
		g.push_back(i);
		i = i * 3 + 1;
	}

	cout << g.size() << endl;
	for (i = g.size() - 1; i >= 0; --i)
	{
		cout << g[i];
		if( i > 0) {
			cout << " ";
		}
	}
	cout << endl << shellSort(a, n, g) << endl;
	for (i = 0; i < n; ++i)
	{
		cout << a[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 5132
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
  int a,b;
  int count = 0;
  cin >> a >> b;
  for (int i = a; i < b+1; i++) {
    string str = to_string(i);
    string str2 = to_string(i);
    reverse(str.begin(),str.end());
    if (str == str2) {
      count += 1;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
  int n, m;
  cin >> n >> m;
  m /= 100;
  vector<int> a(n), b(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i] >> b[i];
    b[i] /= 100;
  }
  int ret = INF;
  for (int k = 0; k < (1 << n); ++k) {
    int score = 0, cnt = 0;
    for (int i = 0; i < n; ++i) {
      if (k & (1 << i)) {
        score += (i + 1) * a[i] + b[i];
        cnt += a[i];
      }
    }
    for (int i = n - 1; i >= 0 && score < m; --i) {
      if (k & (1 << i)) continue;
      int cur = min((m - score + i) / (i + 1), a[i]);
      cnt += cur;
      score += (i + 1) * cur;
    }
    if (score >= m) {
      ret = min(ret, cnt);
    }
  }
  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){

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

    if(a>b){
      printf("a > b\n");
    }else if(a<b){
      printf("a < b\n");
    }else{printf("a == b\n");}
    
    return 0;
}

Measured memory_bytes: 580
from collections import Counter

N, K = map(int, input().split())

has_sweet = [False] * N

for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for a in A:
        has_sweet[a-1] = True

c = Counter(has_sweet)
print(c[False])


Measured memory_bytes: 67940
#include<stdio.h>

int main(){
	int N;
	scanf("%d",&N);
	
	int a = N%10;
	
	if(a==2||a==4||a==5||a==7||a==9)
		printf("hon\n");
	else if(a == 0 || a==1||a==6||a==8)
		printf("pon\n");
	else
		printf("bon\n");
		
	return 0;
} 

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

int main() {
  int n;
  cin >> n;
  vector<int64_t> h(n);
  for (int i = 0; i < n; i++) {
    cin >> h.at(i);
  }
  
  int count = 0;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (i == n - 1) {
      ans = max(ans, count);
    }
    else {
      if (h.at(i) >= h.at(i + 1)) {
        count++;
      }
      else {
        ans = max(ans, count);
        count = 0;
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int main(){
    int n,x=0,a[4][13]={0};
    char ch;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>ch>>x;
        if(ch=='S'){a[0][x-1]=1;}
        if(ch=='H'){a[1][x-1]=2;}
        if(ch=='C'){a[2][x-1]=3;}
        if(ch=='D'){a[3][x-1]=4;}   
    }
    for(int s=0;s<4;s++){
        for(int k=1;k<14;k++){
 
            if(a[s][k-1]==0&&s==0){cout<<"S "<<k<<endl;}
            if(a[s][k-1]==0&&s==1){cout<<"H "<<k<<endl;}
            if(a[s][k-1]==0&&s==2){cout<<"C "<<k<<endl;}
            if(a[s][k-1]==0&&s==3){cout<<"D "<<k<<endl;}
 
 
 
        }}
 
 
    return 0;
}


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

enum m = 1_000_000_007;

struct C {
  int a, b, c, v;
}

int add (int x, int y) {
  x += y;
  if (x >= m) x -= m;
  return x;
}

void main() {
  immutable hb = 1L << 32;
  int n;
  readf (" %d", &n);
  auto a = new int[n];
  foreach (i; 0 .. n) {
    readf (" %d", &a[i]);
  }
  int[long] q;
  q[0] = 1;
  foreach (i; 0 .. n) {
    immutable t = a[i];
    int[long] w;
    foreach (x, val; q) {
      int a = (x & 0x7fffffff).to!int; 
      int b = (x >> 32).to!int;
      int c = i - (a + b);
      if (t == a) {
        w[x+1] = add (w.get (x + 1, 0), val);
      }
      if (t == b) {
        w[x+hb] = add (w.get (x + hb, 0), val);
      }
      if (t == c) {
        w[x] = add (w.get (x, 0), val);
      }
    }
    q = w;
  }
  int res = 0;
  foreach (x, val; q) {
    res = add (res, val);
  }
  writeln (res);
}



Measured memory_bytes: 3452
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string S;
	cin >> S;
	int N = S.size();
	int a = 0;
	int res = 0;
	for (int i = 0; i < N; i++) {
		if (S[i] == 'B') {
			a++;
		}
		else {
			res += a;
		}
	}
	cout << res << endl;
}

Measured memory_bytes: 720
def main():
    
    #input
    N,K = map(int, input().split())
    A = list(map(int, input().split()))
    
    #judge
    if (N-1)%(K-1) == 0:
        ans = (N-1)//(K-1)
    else:
        ans = (N-1)//(K-1) + 1
        
    print(ans)



if __name__ == "__main__":
    main()

Measured memory_bytes: 13880
#!/usr/bin/env python3

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()

X = [[] for _ in range(K)]

for i in range(N):
    X[i % K].append(T[i])

pt = {'r': P, 's': R, 'p': S}

score = 0
for k in range(K):
    last = None
    for st in X[k]:
        if st != last:
            score += pt[st]
            last = st
        else:
            last = None

print(score)



Measured memory_bytes: 17900
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    ll N, K;
    cin >> N >> K;
    if (N >= K) {
        ll mod = N % K;
        ll mod1 = K - mod;
        cout << min(mod, mod1) << endl;
    } else {
        int steps = 100000; 
        ll ans = LONG_MAX;
        while (steps--) {
            ans = min(ans, abs(N - K));
            N = abs(N - K);
        }
        cout << ans << 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 a =sc.nextInt();
		int b =sc.nextInt();
		int c =sc.nextInt();
		if(a-b>=c){
			System.out.println(0);
		}else{
			System.out.println(c-a+b);
		}
	}
}


Measured memory_bytes: 21844
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <iterator>
//#include <cmath>
#include <set>
#include <deque> 
#include <string>


using namespace std;

long long n, k;

int main()
{
	scanf("%lld%lld", &n, &k);
	
	long long r1 = n % k;
	long long r2 = k - r1;
	long long min = n;
	if (r1 < min)
		min = r1;
	if (r2 < min)
		min = r2;
	
	printf("%lld\n", min);
	
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
#include <sstream>
#include<map>

#include<queue>

using namespace std;

struct NODE
{

};

int main() {

	int N = 0;
	cin >> N;

	struct VERTEX
	{
		int m_ToVertex;
		int m_ToCost;
		VERTEX(int to, int cost)
		{
			m_ToVertex = to;
			m_ToCost = cost;
		}
	};

	vector< vector<VERTEX> > lineInfo(N);
	for (int i = 0; i < N-1; i++)
	{
		int u, v, w;
		cin >> u >> v >> w;
		--u;
		--v;
		lineInfo[u].push_back(VERTEX(v, w));
		lineInfo[v].push_back(VERTEX(u, w));
	}


	vector<int> result(N, -1);
	queue<int> confirm;

	result[0] = 0;
	confirm.push(0);

	while (confirm.empty() == false)
	{
		int v = confirm.front();
		confirm.pop();
		for (int i = 0; i < lineInfo[v].size(); i++)
		{
			int toLength = lineInfo[v][i].m_ToCost;
			int toVertex = lineInfo[v][i].m_ToVertex;

			if (result[toVertex] != -1)
			{
				continue;
			}

			// 色決定
			result[toVertex] = (result[v] + toLength) % 2;
			confirm.push(toVertex);
		}
	}

	for (int i = 0; i < result.size(); i++)
	{
		cout << result[i] << endl;
	}

	return 0;
}




Measured memory_bytes: 6784
import java.util.Scanner;

public class Main {

    public static void main(String args []) {

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        int[] line = new int[n];
        long sum= 0;

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

            line[i] = sc.nextInt();
        }

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

            if (line[i] > line[i+1]) {
                int a = line[i] - line[i+1];
                line[i + 1] = line[i];
                sum += a;
            }
        }

        System.out.println(sum);
    }
}


Measured memory_bytes: 59636
n = int(input())
A = list(map(int, input().split(" ")))
q = int(input())
M = list(map(int, input().split(" ")))
results = []

for i in range(2**n):
    sum = 0
    for keta in range(n):
        # i >> 2 で10進数表記のnを2進数変換して2けたぶん右にシフトしてくれる。
        # 結果2け為の1, 0 がわかる
        if (i >> keta) & 1:
            sum += A[keta]
    results.append(sum)

results = set(results)
for target in M:
    print('yes') if target in results else print('no')


Measured memory_bytes: 43076
#include <iostream>
#include <iomanip>
#include <cmath>
#include <functional>
#include <algorithm>
#include <numeric>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <boost/range/irange.hpp>
#include <boost/container/static_vector.hpp>
#include <boost/utility/string_ref.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/math/common_factor_rt.hpp>

class input
{
public:
    input()
    {
        std::cin.tie(nullptr);
        std::ios::sync_with_stdio(false);
    }

    template <class T>
    inline input& operator>>(T& var) { return std::cin >> var, *this; }
    template <class T>
    inline input& operator,(T& var) { return *this >> var; }

    template <class T>
    inline T read()
    {
        T var;
        std::cin >> var;
        return var;
    }

    template <class InputIterator>
    inline void read(InputIterator head, std::size_t n)
    {
        for (std::size_t i = 0; i < n; ++i) {
            std::cin >> *head;
            ++head;
        }
    }

    template <class T>
    inline std::vector<T> read(std::size_t n)
    {
        std::vector<T> res;
        res.reserve(n);

        for (std::size_t i = 0; i < n; ++i) {
            T tmp;
            std::cin >> tmp;
            res.emplace_back(tmp);
        }
        return res;
    }

    template <class T, class F>
    inline void online(std::size_t n, F&& f)
    {
        T var;
        for (std::size_t i = 0; i < n; ++i) {
            std::cin >> var;
            f(var);
        }
    }
};
template <class T, std::size_t n>
std::istream& operator>>(std::istream& in, std::array<T, n>& var)
{
    for (std::size_t i = 0; i < n; ++i) {
        in >> var[i];
    }
    return in;
}

class output
{
    std::ostream& cout;

    template <class T, class... Args>
    void impl(T&& v, Args&&... args)
    {
        cout << std::forward<T>(v) << ' ';
        impl(std::forward<Args>(args)...);
    }
    template <class T>
    void impl(T&& v)
    {
        cout << std::forward<T>(v);
    }

public:
    output() : cout(std::cout)
    {
        cout << std::fixed << std::setprecision(15);
    }

    template <class... Args>
    void operator()(Args&&... args)
    {
        impl(std::forward<Args>(args)...);
        cout << '\n';
    }
    template <class... Args>
    void noreturn(Args&&... args)
    {
        impl(std::forward<Args>(args)...);
    }

    template <class T>
    void print(const T& container)
    {
        bool first = true;
        for (auto&& x : container) {
            if (!first) {
                cout << ' ';
            }
            cout << x;
            first = false;
        }
        cout << '\n';
    }
};

void prog()
{
    input in;
    output out;
    int a, b, t;
    in >> a, b, t;
    out((t / a) * b);
}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
map<long long, int> cnt;
int n;
long long a[100005], b[100005];
int pp[2201], p[350], tot;
long long sqr(long long x) {return x * x;}
int main() {
	for (int i = 2; i <= 2200; i++) if (!pp[i]) {
		p[++tot] = i;
		for (int j = i + i; j <= 2200; j += i)
			pp[j] = 1;
	}
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		long long x;
		scanf("%lld", &x);
		for (int j = 1; j <= tot && 1ll * p[j] * p[j] * p[j] <= x; j++)
			while (x % (1ll * p[j] * p[j] * p[j]) == 0)
				x /= (1ll * p[j] * p[j] * p[j]);
		b[i] = 1;
		cnt[x]++;
		a[i] = x;
		for (int j = 1; j <= tot && 1ll * p[j] * p[j] * p[j] <= x; j++) if (x % p[j] == 0) {
			b[i] *= (x % (1ll * p[j] * p[j]) == 0 ? p[j] : 1ll * p[j] * p[j]);
			while (x % p[j] == 0) x /= p[j];
		}
		if (sqr((long long)(sqrt(x) + 0.5)) == x) b[i] *= (long long)(sqrt(x) + 0.5);
		else b[i] *= x * x;
	}
	int ans = 0;
	if (cnt[1]) ans++, cnt[1] = 0;
	for (int i = 1; i <= n; i++)
		ans += max(cnt[a[i]], cnt[b[i]]), cnt[a[i]] = cnt[b[i]] = 0;
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 14336
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m,l,r,mx=-1,mn=2000000,i,a=0;
    cin>>n>>m;
    for(i=0;i<m;i++)
    {
        cin>>l>>r;
        mx=max(mx,l);
        mn=min(mn,r);
    }
    cout<<(mn<mx?a:mn-mx+1)<<endl;
}


Measured memory_bytes: 3616
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
#define pb push_back

const long long MOD = 1000000007;
//const long long MOD = 998244353;
const long long INF = 1LL << 60;


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;
}
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a * g / b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}




const long double PI = 3.14159265359;
const int MAX_N = 100010;



signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n; cin >> n;
	vector<P>r(n), b(n); rep(i, n)cin >> r[i].first >> r[i].second;
	rep(i, n)cin >> b[i].first >> b[i].second;
	sort(ALL(b));
	int now = -1;
	int ans = 0;
	rep(i, n) {
		now = -1;
		int idx = -1;
		rep(j, r.size()) {
			if (r[j].second < b[i].second&&r[j].first < b[i].first) {
				if (r[j].second > now) {
					now = r[j].second; idx = j; 
				}
			}
		}
		if (idx >= 0) {
			ans++; r.erase(r.begin() + idx);
		}
	}
	cout << ans << endl;
	return 0;
}

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

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

  bool flag = true;
  vector<string> w(n);
  set<string> s;

  for (int i = 0; i < n; i++) {
    cin >> w[i];
    s.insert(w[i]);
  }

  if (s.size() < n) {
    flag = false;
  }

  for (int i = 1; i < n; i++) {
    if (w[i].front() != w[i-1].back()) {
      flag = false;
      break;
    }
  }

  if (flag) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }


}


Measured memory_bytes: 256
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using System.Collections;
public class Remainder
{

  static long div = 1000000007;

    static public void Main()
    {
        var S = Console.ReadLine();
        var N = S.Length;
        var sum = 0;
        var pa  = 0;
        for(int i = 0; i < N ;i++){
          if(S[i] == 'g'){
            if(pa > 0){
              sum++;
              pa--;
            }else{
              pa++;
            }
          }else{
            if(pa > 0){
              pa--;
            }else{
              sum--;
              pa++;
            }
          }
        }
      
      Console.WriteLine(sum);

    }

}


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

  long long n,a[100];

  cin>>n;
  a[0]=2;
  a[1]=1;
  for(int i=2;i<87;i++) a[i]=a[i-1]+a[i-2];
  cout<<a[n]<<endl;
  return 0;

}




Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <set>
#include <vector>
#include <queue>

using namespace std;

#define ll long long

void preambule() {
  cin.tie(0);
  cout.precision(16);
  cout << fixed;
}

int a;
int b;
int t;

void input() {
  cin >> a >> b >> t;
}

void solve1() {
  cout << (t / a) * b;
}

int main() {
#ifdef _DEBUG
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif

  preambule();
  input();
  solve1();
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define pb push_back
#define F first
#define S second
//#define biGinf 9e+18
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define inpv(v) for(auto &x:v) cin>>x
#define otpv(v) for(auto &x:v) cout<<x<<nwl
#define otpv2(v) for(auto &x:v) cout<<x<<" "
#define CASES int tt;cin>>tt; while(tt--)
#define for0(i,n) for(int i=0; i<n; i++)
#define for1(i,n) for(int i=1; i<=n; i++)
#define sz(v) (int)(v).size()
#define vec(x) vector < x >
using vi = vector < int >;
using vvi = vector < vi >;
using pii = pair < int , int >;
using vpii = vector < pii >;
using int64 = long long;
//const int64 biGinf = 9e+18;
//const string yo = "YES", no = "NO";
const int inf = 2e9 + 7;
const char nwl = '\n';

int main() {
// #ifndef ONLINE_JUDGE
// 	if (fopen("input.txt", "r")) {
// 		freopen("input.txt", "r", stdin);
// 		freopen("output.txt", "w", stdout);
// 	}
// #endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	//ur code
	int n;
	cin >> n;
	vi v(n);
	inpv(v);
	int x = 0;
	for (int y : v) {
		x ^= y;
	}
	for (int y : v) {
		x ^= y;
		cout << x << nwl;
		x ^= y;
	}


	return 0;
}

Measured memory_bytes: 3984
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,l[200];
    cin>>n;
    for(int i=0;i<2*n;i++)cin>>l[i];
    sort(l,l+2*n);
    int ans=0;
    for(int i=0;i<2*n;i++) if(i%2==0)ans+=l[i];
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF (1<<29)

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; }

ll N,C,ans=0;

int main(){
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    cin>>N>>C;
    ll x[N+1],v[N+1],fa[N+1],fb[N+1],ga[N+1],gb[N+1];
    x[0]=v[0]=0;
    repi(i,1,N+1)cin>>x[i]>>v[i];
    fa[0]=ga[0]=0;
    fb[N]=gb[N]=v[N]-(C-x[N]);
    rep(i,N){
        fa[i+1]=fa[i]+x[i]+v[i+1]-x[i+1];
        ga[i+1]=max(ga[i],fa[i+1]);
    }
    for(int i=N;i>0;i--){
        fb[i-1]=fb[i]-x[i]+x[i-1]+v[i-1];
        gb[i-1]=max(gb[i],fb[i-1]);
    }
    for(int i=N;i>=0;i--){
        if(i)ans=max(ans,fb[i]+ga[i-1]-(C-x[i]));
        else ans=max(ans,ga[N]);
    }
    rep(i,N+1){
        if(i!=N)ans=max(ans,fa[i]+gb[i+1]-x[i]);
        else ans=max(ans,gb[0]);
    }
    // rep(i,N+1)out(g[i].first);
    // for(int i=N;i>=0;i--)out(fb[i]);
    out(ans);


}


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



// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    int n;
    cin >> n;
    ll ary[n+1];
    rep(i,n+1) cin >> ary[i];

    ll down[n+1], up[n+1];
    rep(i,n+1)
    {
        down[i] = 0;
        up[i] = 0;
    }

    down[n] = ary[n];
    up[n] = ary[n];


    for (int i=n-1;i>=0;i--)
    {

        down[i] = down[i+1] / 2 + down[i+1] % 2;
        up[i] = up[i+1];

        down[i] += ary[i];
        up[i] += ary[i];
    }

    // rep(i,n) cout << down[i] << " " << up[i] << endl;
    if (down[0] <= 1 && 1 <= up[0])
    {
        ll ans = 1;
        ll prev = 1;
        REP(i,1,n+1)
        {
            prev = min((prev-ary[i-1]) * 2, up[i]);
            ans += prev;
        }
        cout << ans << endl;
    }
    else
    {
        cout << -1 << endl;
    }
    
}

Measured memory_bytes: 5980
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

int main(){
    ll A,B,N;
    cin >> A >> B >> N;
    ll ans = 0;
    if (N < B){
        ans = (A * N) / B - A * (N / B);
    }
    else{
        if (A < B){
            ans = A - 1;
        }
        else{
            rep(i,B){
                ll ans_sub = (A * i) / B - A * (i / B);
                ans = max(ans, ans_sub);
            }
        }
    }
    cout << ans << endl;
}



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

int dp[1005][1005];
const int mod = 1e9+7;

int main(){
	int h, w;
	cin >> h >> w;
	for(int i = 1; i <= h; i++){
		for(int j = 1; j <= w; j++){
			char c;
			cin >> c;
			if(c == '#') dp[i][j] = -1;
		}
	}
	
	int x = 1,y = 1;
	while(dp[x][1] != -1 && x <= h){
		dp[x][1] = 1; 
		x++;
	}
	
	while(dp[1][y] != -1 && y <= w){
		dp[1][y] = 1;
		y++;
	}
	
	for(int i = 2; i <= h; i++){
		for(int j = 2; j <= w; j++){
			if(dp[i][j] == -1) {
				continue;
			}
			
			if(dp[i-1][j] == -1 && dp[i][j-1] == -1){
				dp[i][j] = 0;
			}else if(dp[i-1][j] == -1){
				dp[i][j] = dp[i][j-1];				
			}else if(dp[i][j-1] == -1){
				dp[i][j] = dp[i-1][j];
			}else{
				dp[i][j] = (dp[i-1][j] + dp[i][j-1]) % mod;			
			}
		}
	}
	
	cout << dp[h][w] << endl;
	
}

Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
 
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
 
const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);
//const ll mod = 1000000007;
int H, W, K;
string field[10];
 
int main() {
    cin >> H >> W >> K;
    for(int h = 0; h < H; h++) cin >> field[h];
    int ans = 1e9;
    for(int bits = 0; bits < (1 << (H-1)); bits++) {
        vector<vector<int>> v;
        v.push_back({0});
        for(int i = 1; i < H; i++) {
            if(!(bits & (1 << (i-1)))) v.back().push_back(i);
            else v.push_back({i});
        }
        int n = v.size();
        int val = __builtin_popcount(bits);
        vector<int> num(n);
   
        for(int w = 0; w < W; w++) {
            vector<int> now(n);
            for(int i = 0; i < v.size(); i++) {
                for(auto tmp : v[i]) {
                    if(field[tmp][w] == '1') now[i]++;
                }
                if(now[i] > K) {
                    w = W;
                    val = 1e9;
                    break;
                }
            }
            bool cut = false;
            if(val == 1e9) break;
            for(int i = 0; i < n; i++) {
                num[i] += now[i];
   
                if(num[i] > K) cut = true;
            }
            if(cut) {
       
                val++;
                for(int i = 0; i < n; i++) {
                    num[i] = 0;
                }
                w--;
            }
        }
       
        chmin(ans, val);
    }
    cout << ans << endl;
    return 0;
}

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

typedef struct {
	int number;
	int maisuu;
} card_t;

int card_num;
card_t cards[7];

int memo[7][1001];

int tansaku(int now_pos,int nokori);

int main(void) {
	int i;
	int game_num;
	int now_game;
	while(1) {
		scanf("%d",&card_num);
		if(card_num==0)break;
		for(i=0;i<card_num;i++) {
			scanf("%d%d",&cards[i].number,&cards[i].maisuu);
		}
		scanf("%d",&game_num);
		for(i=0;i<game_num;i++) {
			scanf("%d",&now_game);
			memset(memo,0,sizeof(memo));//reset memo
			printf("%d\n",tansaku(0,now_game));
		}
	}
	return 0;
}

int tansaku(int now_pos,int nokori) {
	int i;
	int result;
	if(now_pos>=card_num) {
		if(nokori==0)return 1; else return 0;
	}
	if(memo[now_pos][nokori]>0)return memo[now_pos][nokori]-1;
	result=0;
	for(i=0;i<=cards[now_pos].maisuu;i++) {
		result+=tansaku(now_pos+1,nokori-cards[now_pos].number*i);
	}
	memo[now_pos][nokori]=result+1;
	return result;
}

Measured memory_bytes: 0
nu1,nu2 = gets.chomp.split(" ").map(&:to_i)
array = gets.chomp.split(" ").map(&:to_i)
store = Array.new(200001, 0)
for i in 0..nu1 - 1
  store[array[i]] += 1
end
result = store.sort
ans = nu1
for i in 1..nu2
  ans -= result[-i]
end

puts ans


Measured memory_bytes: 23192
#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 160090;

int par[MAX_N], Rank[MAX_N], size[MAX_N];
const int dx[] = {0, 0, -1, 1};
const int dy[] = {-1, 1, 0, 0};
void init(int n)
{
    for (int i = 0; i < n; i++)
    {
        par[i] = i;
        Rank[i] = 0;
        size[i] = 1;
    }
}
int find(int x)
{
    if (par[x] == x)
    {
        return x;
    }
    else
    {
        return par[x] = find(par[x]);
    }
}
void unite(int x, int y)
{
    x = find(x);
    y = find(y);
    if (x == y)
        return;
    if (Rank[x] < Rank[y])
    {
        par[x] = y;
        size[y] += size[x];
    }
    else
    {
        par[y] = x;
        size[x] += size[y];
        if (Rank[x] == Rank[y])
            Rank[x]++;
    }
}

bool same(int x, int y)
{
    return find(x) == find(y);
}
int main()
{
    int H, W;
    cin >> H >> W;
    string S[H];
    init(MAX_N);
    for (int i = 0; i < H; i++)
    {
        cin >> S[i];
    }
    for (int i = 0; i < H; i++)
    {
        for (int j = 0; j < W; j++)
        {
            for (int k = 0; k < 4; k++)
            {
                int nx = i + dx[k];
                int ny = j + dy[k];
                if (0 <= nx && nx < H && 0 <= ny && ny < W)
                {
                    if (S[i][j] != S[nx][ny])
                    {
                        unite(i * W + j, nx * W + ny);
                    }
                }
            }
        }
    }
    map<int, int> white;
    map<int, int> black;
    for (int i = 0; i < H; i++)
    {
        for (int j = 0; j < W; j++)
        {
            if (S[i][j] == '#')
            {
                white[find(i * W + j)]++;
            }
            else
            {
                black[find(i * W + j)]++;
            }
        }
    }
    long long sum = 0;
    for (int i = 0; i < H; i++)
    {
        for (int j = 0; j < W; j++)
        {
            sum += (long long)white[i * W + j] * black[i * W + j];
        }
    }
    cout << sum << endl;
}


Measured memory_bytes: 17408
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    vector<pair<string,pair<int,int>>> psi;
    int n;
    cin>>n;
    rep(i,n){
        string s;
        cin>>s;
        int p;
        cin>>p;
        p*=-1;
        psi.push_back(make_pair(s,make_pair(p,i+1)));
    }
    sort(psi.begin(),psi.end());
    for(auto u : psi){
        cout<<u.second.second<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
a,b = map(int,input().split())
#０が含まれていたら0.あとは負の数で場合分け
if a<=0 and 0<=b:
  print("Zero")
  
elif a>0 and b>0:
  print("Positive")

elif a<0 and b<0:
  number = abs(a-b)+1
  if number%2 == 0:
    print("Positive")
  else:
    print("Negative")

Measured memory_bytes: 3064
#include<stdio.h>


#define limit 1 << 12



int main()
{
	double shousuu ;
	int seisuu ;


	int i ;
	while( 1 )
	{
		scanf( "%lf" ,&shousuu ) ;


		if( shousuu < 0 )
		{
			return 0 ;
		}


		shousuu *= 16 ;

		seisuu = ( int )shousuu ;


		if( shousuu >= limit || shousuu - seisuu != 0 )
		{
			puts( "NA" ) ;
		}


		else
		{
			i = 12 ;
			while( i-- )
			{
				if( i == 3 )
				{
					printf( "." ) ;
				}

				printf( "%d" ,( seisuu >> 11 ) & 1 ) ;


				seisuu <<= 1 ;
			}

			puts( "" ) ;
		}
	}
}

Measured memory_bytes: 2560
#include<iostream>
#include<algorithm>
#include<functional>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<tuple>
#include<stack>
#include<queue>
#include<deque>
#include<sstream>
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<bitset>
#include<time.h>
#include<cstdlib>
#include<cassert>
#define ll long long
#define fi first
#define se second
using namespace std;

int n;
int a[200001];
                   
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout<<fixed;
#ifdef LOCAL_DEFINE
    freopen("in", "r", stdin); 
    freopen("out","w",stdout);
#endif
  cin>>n;
  ll sum=0;
  for(int i=0;i<n;i++){
    cin>>a[i];
    sum+=a[i];
  }
  ll su=a[0];
  ll ar=sum-su;
  ll ans=abs(su-ar);
  for(int i=1;i<n-1;i++){
    su+=a[i];
    ar-=a[i];
    ans=min(ans,abs(su-ar));
  }
  cout<<ans<<"\n";
#ifdef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
  return 0;
}

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

using namespace std;

#define loop(n) for(int lp=0; lp<(n); lp++)
#define ascent(i, a, b)  for(int (i)=(a); (i)<(b); (i)++)
#define descent(i, a, b) for(int (i)=(a); (i)<(b); (i)--)

int main() {
  int n, _p;
  while(cin >> n >> _p, n) {
    int m[60];
    memset(m, 0, sizeof(m));

    int i = 0;
    int p = _p;
    while(true) {
      //cout << " " << p << endl;
      if(p > 0) {
	m[i%n] ++;
	p --;

	if(m[i%n] == _p) break;
      }
      else if(p == 0) {
	p = m[i%n];
	m[i%n] = 0;
      }
      i ++;
    }
    
    cout << i%n << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<cstdio>
#include <stdio.h>
#include<algorithm>
#include<cstring>
#include <string>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<map>
#include<vector>
#include<bits/stdc++.h>
#include <set>
#define ll   long long
#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0)
#define inf 0x3f3f3f3f3f3f3f3f
#define pi 3.1415926535898
#define mod 998244353
#define N 200010
using namespace std;
int a[N];
ll dp[N];
ll pre[N];

int main()
{
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    pre[1]=a[1];
    for(int i=3;i<=n;i++)
    {
        pre[i]=pre[i-2]+a[i];
    }
    for(int i=2;i<=n;i++)
    {
        if(i&1)
        {
            dp[i] = max(dp[i - 1], dp[i - 2] + a[i]);
        }
        else
        {
            dp[i] = max(pre[i - 1], dp[i - 2] + a[i]);
        }
    }
    cout<<dp[n]<<endl;
    return 0;
}


Measured memory_bytes: 7504
#include <stdio.h>
#include <stdlib.h>
#define MAX 1000

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

int main(void) {
  int n, i, ans;
  int l[MAX];
  scanf("%d", &n);
  for (i = 0; i < 2 * n; i++) {
    scanf("%d", l + i);
  }
  qsort(l, 2 * n, sizeof(int), comp);
  ans = 0;
  for (i = 0; i < 2 * n; i += 2) {
    ans += l[i];
  }
  printf("%d\n", ans);
  return 0;
}


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

int main()
{
  long double L;
  cin >> L;
  long double ans = ((L)*(L)*(L))/27;
  
  printf("%.12Lf\n", ans);
}

Measured memory_bytes: 256
X = int(input()) - 1

prime = False
while not prime:
    prime = True
    X += 1
    m = X
    i = 2
    while i <= m:
        if X % i == 0 and not X == i:
            prime = False
            break
        else:
            m = X // i
            i += 1
print(X)

Measured memory_bytes: 2940
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int bucket[] = new int[15];
		for(int i = 0; i < 3; i ++) {
			bucket[sc.nextInt()] ++;
		}
		System.out.println(bucket[5] == 2 && bucket[7] == 1 ? "YES" : "NO");
	}
}

Measured memory_bytes: 20564
#include<bits/stdc++.h>
using namespace std;
int main(){
  int d;
  cin>>d;
  vector<int> c(26);
  for(int i=0;i<26;i++)
    cin>>c.at(i);
  vector<vector<int>> s(d,vector<int>(26));
  for(int i=0;i<d;i++)
    for(int j=0;j<26;j++)
      cin>>s.at(i).at(j);
  vector<set<int>> l(26);
  for(int i=0;i<26;i++)
    l.at(i).insert(0);
  vector<int> t(d);
  int64_t p;
  for(int i=1;i<=d;i++){
    vector<int> x(26,0);
    int m=0;
    for(int j=0;j<26;j++){
      int64_t pi=s.at(i-1).at(j);
      for(int k=0;k<26;k++)
        pi-=c.at(k)*(k==j?0:i-*rbegin(l.at(k)));
      x.at(j)=pi;
      if(x.at(j)>x.at(m))
        m=j;
    }
    t.at(i-1)=m;
    p=x.at(m);
    l.at(m).insert(i);
  }
  for(int i=0;i<26;i++)
    l.at(i).insert(d+1);
  for(int i=0;i<100000;i++){
    int pn=p;
    int di=rand()%d+1;
    int qn=rand()%26;
    int qo=t.at(di-1);
    l.at(qo).erase(di);
    auto io=lower_bound(l.at(qo).begin(),l.at(qo).end(),di);
    auto in=lower_bound(l.at(qn).begin(),l.at(qn).end(),di);
    pn+=s.at(di-1).at(qn)-s.at(di-1).at(qo);
    pn+=(di-*prev(in,1))*(*in-di)*c.at(qn)-(di-*prev(io,1))*(*io-di)*c.at(qo);
    if(pn>p){
      l.at(qn).insert(di);
      t.at(di-1)=qn;
    }else
      l.at(qo).insert(di);
  }
  for(int i=0;i<d;i++)
    cout<<t.at(i)+1<<endl;
}

Measured memory_bytes: 3716