akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <tuple>

using Person = std::tuple<int, int, std::string>;

void solve() {
    int n;
    std::cin >> n;

    int t = 0;

    std::map<std::string, Person> status;
    std::set<Person> bad, good;

    // 移動した人を返す 居なければ空文字列
    auto move = [&]() -> std::string {
        std::string ret = "";
        int sz = bad.size() + good.size();

        int gsz = sz / 5;
        while ((int)good.size() < gsz) {
            auto it = --bad.end();
            good.insert(*it);
            ret = std::get<2>(*it);
            bad.erase(it);
        }

        while ((int)good.size() > gsz) {
            auto it = good.begin();
            bad.insert(*it);
            ret = std::get<2>(*it);
            good.erase(it);
        }

        return ret;
    };

    while (n--) {
        std::string s;
        int a;
        std::cin >> s >> a;

        Person p(a, t++, s);
        status[s] = p;
        bad.insert(p);
    }
    move();

    int m;
    std::cin >> m;

    while (m--) {
        char c;
        std::string s;
        int a;
        std::cin >> c >> s;
        if (c == '+') std::cin >> a;

        std::vector<std::string> moved;

        if (c == '+') {
            Person p(a, t++, s);
            status[s] = p;

            if (*bad.rbegin() >= p) {
                bad.insert(p);
            } else {
                good.insert(p);
            }
            moved.push_back(s);

        } else {
            auto p = status[s];

            if (good.count(p)) {
                good.erase(p);
            } else {
                bad.erase(p);
            }

            status.erase(s);
        }

        moved.push_back(move());
        if (moved.size() == 2 && moved.front() == moved.back()) {
            moved.pop_back();
        }

        for (auto u : moved) {
            if (u.empty()) continue;

            if (good.count(status[u])) {
                std::cout << u << " is working hard now.\n";
            } else {
                std::cout << u << " is not working now.\n";
            }
        }
    }
}

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

    solve();

    return 0;
}



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

int main() {
  int n, k;
  cin >> n;
  cin >> k;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    ans += 2*min(abs(x), abs(x - k));
  }
  cout << ans << endl;
  return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<ll> cnt(n+1);
  for(int i = 1; i <= n; i++) {
    int j = 1;
    while(i*j <= n) {
      cnt[i*j]++;
      j++;
    }
  }
  ll ans = 0;
  for(int i = 1; i <= n; i++) {
    ans += cnt[i] * i;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 81408
// #include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;
typedef long long ll;

#define all(x) begin(x), end(x)
#define rep(i,n) for(int i=0; i<n; i++)

const ll INF = 1001001001;

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

    int s[h][w];
    char c;
    int white = 0;
    rep(i, h) {
        rep(j, w) {
            cin >> c;
            if (c == '#') s[i][j] = 0;
            else {
                s[i][j] = 1;
                white++;
            }
        }
    }

    bool used[h][w] = {};
    used[0][0] = 1;

    queue<pair<int, int>> q;
    q.push(make_pair(0, 0));

    vector<vector<int>> dist(h, vector<int>(w, INF));
    dist[0][0] = 0;

    bool flag = 0;

    while (q.size()) {
        int cur_H = q.front().first;
        int cur_W = q.front().second;
        q.pop();

        if (cur_H==h-1 && cur_W==w-1) {
            flag = 1;
            break;
        }

        if ((cur_H != 0) && (!used[cur_H-1][cur_W]) && s[cur_H-1][cur_W]) {
            dist[cur_H-1][cur_W] = dist[cur_H][cur_W] + 1;
            used[cur_H-1][cur_W] = 1;
            q.push(make_pair(cur_H-1, cur_W));      // 左
        }
        if ((cur_H != h-1) && (!used[cur_H+1][cur_W]) && s[cur_H+1][cur_W]) {
            dist[cur_H+1][cur_W] = dist[cur_H][cur_W] + 1;
            used[cur_H+1][cur_W] = 1;
            q.push(make_pair(cur_H+1, cur_W));      // 右
        }
        if ((cur_W != 0) && (!used[cur_H][cur_W-1]) && s[cur_H][cur_W-1]) {
            dist[cur_H][cur_W-1] = dist[cur_H][cur_W] + 1;
            used[cur_H][cur_W-1] = 1;
            q.push(make_pair(cur_H, cur_W-1));      // 上
        }
        if ((cur_W != w-1) && (!used[cur_H][cur_W+1]) && s[cur_H][cur_W+1]) {
            dist[cur_H][cur_W+1] = dist[cur_H][cur_W] + 1;
            used[cur_H][cur_W+1] = 1;
            q.push(make_pair(cur_H, cur_W+1));      // 下
        }
    }

    if (flag) cout << white - (dist[h-1][w-1] + 1) << endl;
    else cout << -1 << endl;

    return 0;
}

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

int main() {
  int i;
  string str1, str2;
  cin >> str1 >> str2;
  
  for(i=0 ; i<str2.size() ; i++)
    cout << str1[i] << str2[i];
  
  if(i!=str1.size())
    cout << str1[i] << endl;
  else
    cout << endl;
}

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

using namespace std;


int main(){
    int len_array;
    scanf("%d",&len_array);
    vector<pair<int,int> > pair_array(len_array);
    for(int i = 0;i < len_array;i++){
        scanf("%d %d",&(pair_array[i].first),&(pair_array[i].second));
    }
    sort(pair_array.begin(),pair_array.end());

    for(int i = 0;i < len_array;i++){
        printf("%d %d\n",pair_array[i].first,pair_array[i].second);
    }
    

    return 0;   
}


Measured memory_bytes: 3624
/* " A computer would deserve to be called intelligent if it
could deceive a human into believing that it was human. "
                                            - Alan Turing */
#include<bits/stdc++.h>
using namespace std;
#define D               double
#define LL              long long
#define ULL             unsigned long long
#define SF              scanf
#define PF              printf
#define FOR(i, a, b)    for(int i = a; i < b; i++)
#define REV(i, a, b)    for(int i = a - 1; i >= b; i--)
#define SET(a, v)       memset(a, v, sizeof a)
#define VI              vector<int>
#define PB              push_back
#define ALL(v)          v.begin(), v.end()
#define MII             map<int, int>
#define MSI             map<string, int>
#define PII             pair<int, int>
#define MP              make_pair
#define X               first
#define Y               second
// return the index     (match ? first match : immediate greater)
#define lbA(a, n, x)    lower_bound(a, a + n, x) - a
#define lbV(v, x)       lower_bound(ALL(v), x) - v.begin()
// return the index     (match ? last match + 1 : immediate greater)
#define ubA(a, n, x)    upper_bound(a, a + n, x) - a
#define ubV(v, x)       upper_bound(ALL(v), x) - v.begin()
template <class T> inline T bigmod(T b, T p, T M) {
    LL ret = 1;
    for(; p > 0; p >>= 1) {
        if(p & 1) ret = (ret * b) % M;
        b = (b * b) % M;
    }
    return (T) ret;
}
template <class T> inline T __lcm(T a, T b) {
    return (a * b) / __gcd(a, b);
}
int dx4[] = {1, 0, -1, 0}; // 4 directions
int dy4[] = {0, 1, 0, -1};
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1}; // 8 directions
int dy8[] = {1, -1, -1, 0, 1, -1, 0, 1};
int kx8[] = {1, 1, 2, 2, -1, -1, -2, -2}; // Knight Moves
int ky8[] = {2, -2, 1, -1, 2, -2, 1, -1};
//freopen("in.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
// int tc;SF("%d",&tc);FOR(cs,1,tc+1){}
const LL                LINF = 1e18;
const int               INF = 1e9, NIL = -1;
const int               N = 200 + 5, M = 1e9 + 7;

int n, m, vis[N][N];
string s[N];

void bfs(int x, int y) {
    vis[x][y] = 1;
    queue<PII>q;
    q.push(MP(x, y));
    while(!q.empty()) {
        PII p = q.front();
        q.pop();
        FOR(i, 0, 4) {
            int u = p.X + dx4[i], v = p.Y + dy4[i];
            if(u < 0 || u >= n || v < 0 || v >= m || s[u][v] == '#' || vis[u][v])
                continue;
            vis[u][v] = vis[p.X][p.Y] + 1;
            q.push(MP(u, v));
        }
    }
}

int main() {
    cin >> n >> m;
    FOR(i, 0, n) cin >> s[i];
    FOR(i, 0, n) {
        FOR(j, 0, m) {
            if(s[i][j] == '%') bfs(i, j);
        }
    }
    int pr = M, so = M;
    FOR(i, 0, n) {
        FOR(j, 0, m) {
//            cout << i << " " << j << " " << vis[i][j] << endl;
            if(s[i][j] == '@') pr = min(pr, vis[i][j]);
            if(s[i][j] == '$') so = min(so, vis[i][j]);
        }
    }
//    cout << pr << " " << so << endl;
    if(pr < so) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3368
/*
    ٭٭UWW٭٭OWO٭٭
    Auto-generated by VS Code's Code Snippet
    «I'm just a starter-coder»
    ▶zyck2002◀
    ٭٭UWW٭٭OWO٭٭
*/

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

#define fup(i,l,h) for (int i = l; i < h; i++)

// Debug tool, f = open input file, D = debug mode
// #define f
// #define debug

// Main function
int main()
{
    #ifdef f
    freopen("b.inp","r",stdin);
    #endif
    int r, d, x0; cin >> r >> d >> x0;
    //printf("%d %d %d", r, d, x0);
    // cout << x0 << "\n";
    fup(i,0,10) {
        x0 = r * x0 - d;
        cout << x0 << "\n";
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<numeric>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

using ll = long long;

class Stream{
public:
    Stream(){

    }
    //配列以外の入力を受け取る
    void read(){

    }
    template<typename First, typename... Rest>
    void read(First& first, Rest&... rest){
        cin >> first;
        read(rest...);
    }
    //配列を区切って出力する
    template<typename T>
    void write_vec(vector<T>& v, char divider){
        for(size_t i = 0; i < v.size(); i++){
            cout << v[i] << divider;
        }
    }
}; 

int main(){
    Stream io;
    
    int a, b;
    io.read(a, b);
    int x = stoi(to_string(a) + to_string(b));
    string ans = "No";
    for(int i = 1; i <= 10000; i++){
        if(i * i == x) ans = "Yes";
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define RFOR(i,a,b) for(int i=(a);i>=(b);--i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define RREP(i,n) for(int i=(n);i>0;--i)
#define CI cin>>
#define CO cout<<
#define EN <<endl
#define all(x) (x).begin(),(x).end()
using namespace std;
 
template <typename T>
istream& operator >> (istream& is, vector<T>& vec) {
	for (T& x : vec) is >> x;
	return is;
}
 
using ll = long long;
 
 
int main() {
	int a, b; CI a >> b;
 
	if (a <= 8 && b <= 8) {
		CO "Yay!" EN;
	}
	else CO ":(" EN;
	return 0;
}

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

signed main(){
	char c;
	scanf("%c", &c);
	if(c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o'){
		printf("vowel\n");
	}
	else{
		printf("consonant\n");
	}
	return 0;
}

Measured memory_bytes: 3752
#include<stdio.h>
#include<stdlib.h>

#define N 100,000

int partition(int *, int, int);

int main(){

  int i;
  int n, q;
  int *a;

  scanf("%d", &n);

  a = (int *)malloc(sizeof(int) * n);

  for(i = 0; i < n; i++){
    scanf("%d", &a[i]);
  }

  q = partition(a, 0, n - 1);


  for( i = 0; i < n; i++){
    if(q == i) printf("[");
    printf("%d", a[i]);
    if(q == i) printf("]");
    if(i != n - 1) printf(" ");
  }
	   
  printf("\n");

  return 0;
}

int partition(int *a, int p, int r){

  int i, j, x;
  int tmp;

  x = a[r];

  i = p - 1;

  for(j = p; j < r; j ++){
    if(a[j] <= x){
      i = i + 1;
      tmp = a[i];
      a[i] = a[j];
      a[j] = tmp;
    }
  }

  tmp = a[i + 1];
  a[i + 1] = a[r];
  a[r] = tmp;

  return i + 1;
}

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

int main(){
	/*input*/
	int n;	cin >> n;
	double* x = new double[n];
	char** u = new char*[n];
	for(int i = 0; i < n; i++){
		u[i] = new char [3];
	}
	for(int i = 0; i < n; i++){
		cin >> x[i] >> u[i];
	}
	/*calculation*/
	double o = 0.0;
	for(int i = 0; i < n; i++){
		if(/*u[i] == "JPY"*/u[i][0] == 'J'){
			o+=x[i];
		}else if(/*u[i] == "BTC"*/u[i][0] == 'B'){
			o+=x[i] * 380000.0;
		}
	}

	/*output*/
	cout << o << endl;
	delete[] x;
	for(int i = 0; i < n; i++){
		delete[] u[i];
	}
	delete[] u; 
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n,m) for(int i=n;i<(int)(m);i++)
#define rrep(i,n,m) for(int i=((int)(n)-1);i>=m;i--)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const int MOD=1000000007;
using namespace std;
int main(){
    int n,x;
    cin>>n>>x;
    vector<int> a(n);
    rep(i,0,n) cin>>a[i];
    
    ll ans=0;
    rep(i,0,n-1){
        ans+=max(0,a[i]+a[i+1]-x);
        a[i+1]=max(0,a[i+1]-max(0,(a[i]+a[i+1]-x)));
    }
    
    cout<<ans<<endl;
    
}


Measured memory_bytes: 640
import qualified Data.Array.ST as A
import qualified Control.Monad.ST as A
import Control.Monad
import Data.Maybe

main :: IO ()
main = do
    n <- read <$> getLine :: IO Int
    print $ foldr (\a b -> a |* b) 1 [1 + sum [powerInv i p|i<-[1..n]]|p<-primeNumbers n]

powerInv :: Int -> Int -> Int
powerInv n m
    | mod n m == 0 = 1 + powerInv (div n m) m
    | otherwise    = 0

fact :: Int -> Int
fact 0 = 1
fact n = n |* fact (n|-1)

modN :: Int
modN = 10^9+7
 
(|+) :: Int -> Int -> Int
(|+) n m = (`mod` modN) $ n + m 

(|-) :: Int -> Int -> Int
(|-) n m = (`mod` modN) $ n - m 

(|*) :: Int -> Int -> Int
(|*) n m = (`mod` modN) $ (n `mod` modN) * (m `mod` modN) 

(|^) :: Int -> Int -> Int
(|^) x n
  | n == 0    = 1
  | even n    = mod (x*x) modN |^ div n 2
  | otherwise = (`mod` modN) $ (x |^ (n - 1)) * x

(|/) :: Int -> Int -> Int
(|/) n m = n |* (m |^ (modN - 2))

primeNumbers :: Int -> [Int]
primeNumbers n = A.runST (do
    ns <- A.newArray_ (2, n) :: A.ST s (A.STUArray s Int Bool)
    forM_ [2..n] $ \i -> A.writeArray ns i True
    forM_ [2..n] $ \i -> do
        b <- A.readArray ns i
        when b . forM_ [l|l<-[2..n], l*i<=n] $ 
            \l -> A.writeArray ns (i*l) False
    catMaybes <$> (forM [2..n] $ \i -> do
        b <- A.readArray ns i
        return $ if b then Just i else Nothing))

Measured memory_bytes: 892
#include<stdio.h>
#include<stdlib.h>
#include<malloc.h>
#include<string.h>


typedef struct node {
	int key;
	struct node *next, *prev;
} Node;

Node *nil;

Node* listSearch(int key) {
	Node *cur = nil->next;
	while (cur != nil && cur->key != key) {
		cur = cur->next;
	}
	return cur;
}

void init() {
	nil = (Node *)malloc(sizeof(Node));
	nil->next = nil;
	nil->prev = nil;
}

void printList() {
	Node *cur = nil->next;
	int isf = 0;
	while (1) {
		if (cur == nil)break;
		if (isf++ > 0)printf(" ");
		printf("%d", cur->key);
		cur = cur->next;
	}
	printf("\n");
}

void deleteNode(Node *t) {
	if (t == nil)return;
	t->prev->next = t->next;
	t->next->prev = t->prev;
	free(t);
}

void deleteFirst() {
	deleteNode(nil->next);
}

void deleteLast() {
	deleteNode(nil->prev);
}

void deleteKey(int key) {
	deleteNode(listSearch(key));
}

void insert(int key) {
	Node *x = (Node *)malloc(sizeof(Node));
	x->key = key;
	x->next = nil->next;
	nil->next->prev = x;
	nil->next = x;
	x->prev = nil;
}

int main() {
	int key, n, i;
	int size = 0;
	char com[20];
	int np = 0, nd = 0;
	scanf("%d", &n);
	init();
	for (i = 0; i < n; i++) {
		scanf("%s%d", com, &key);
		if (com[0] == 'i') {
			insert(key);
			np++;
			nd++;
		} else if (com[0] == 'd') {
			if (strlen(com) > 6) {
				if (com[6] == 'F')deleteFirst();
				else if (com[6] == 'L')deleteLast();
			} else {
				deleteKey(key); nd++;
			}
			size--;
		}
	}
	printList();

	return 0;
}

Measured memory_bytes: 31784
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;

int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	int a; cin >> a;
	cout << a + a*a + a*a*a << '\n';
}

Measured memory_bytes: 3604
// AtCoder165 C

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>
#include <assert.h>
#include <string.h>
#include <memory.h>
#include <malloc.h>
#include <stdlib.h>

// qsortで用いる比較用関数．*a<*bならaが先になる．
int compare(const void* a, const void* b) {
    return *(int*)a - *(int*)b;
}

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


int main() {
    int i,j;
    int n;
    int a,b,c;
    int half_a,half_b,half_c;
    int cnt=0;

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

    if(a%2==0 && b==a&&c==b){
        printf("-1");
        return 0;
    }

    while(a%2==0&&b%2==0&&c%2==0){
        half_a = a/2;
        half_b = b/2;
        half_c = c/2;

        a = half_b + half_c;
        b = half_c + half_a;
        c = half_a + half_b;

        cnt++;
    }

    printf("%d", cnt);
    return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <algorithm>
#include <vector>
#include <math.h>
#define INF 1000000007
using namespace std;

int main(void){
	int n;
	cin >> n;
	vector<long long> x(n),y(n),h(n);
	for(int i=0; i<n; i++)cin >> x[i] >> y[i] >> h[i];
	for(long long i=0; i<=100; i++){
		for(long long j=0; j<=100; j++){
			long long temph=0,k;
			for(k=0; k<n; k++){
				if(temph<=0 && h[k]>0)temph=h[k]+abs(x[k]-i)+abs(y[k]-j);
			}
			int flag=1;
			for(k=0; k<n; k++){
				if(max((long long)0,temph-abs(x[k]-i)-abs(y[k]-j))!=h[k]){
					flag=0;
					break;
				}
			}
			if(flag){
				cout << i << " " << j << " " << temph << endl;
				return 0;
			}
		}
	}
	return 0;
}	

Measured memory_bytes: 256
import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
def celi(a,b):
    return -(-a//b)
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

x=int(input())
print(1-x)

Measured memory_bytes: 68304
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define LB(a,x) lb(all(a),x)-a.begin()
#define UB(a,x) ub(all(a),x)-a.begin()
#define mod 1000000007
#define FS fixed<<setprecision(15)
using namespace std;
typedef long long ll;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
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; }

const ll INF=1e18;
const double pi=2*acos(0.0);
//abc169c

ll f(ll n){
    ll m=1;
    rep(i,n) m*=10;
    return m;
}

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    /*long double a,b;
    cin>>a>>b;
    ll ans=(ll)a*b;
    cout<<ans<<endl;*/
    ll a;
    cin>>a;
    string s;
    cin>>s;
    ll b=0;
    ll k=0;
    reverse(all(s));
    rep(i,s.size()){
        if(s[i]=='.') continue;
        b+=(s[i]-'0')*f(k);
        k++;
    }
    cout<<(a*b)/100<<endl;
}
//ペナルティ出しても焦らない　ACできると信じろ！！！
//どうしてもわからないときはサンプルで実験　何か見えてくるかも
//頭で考えてダメなら紙におこせ！！
/*
V,P(大文字)使用不可
乗算などの際にオーバーフローに注意せよ！
(適切にmodをとれ　にぶたんで途中で切り上げろ)
制約をよく読め！
{
    ・全探索できるなら全探索しろ
    ・異常な制約ならそこに注目
}
stringの計算量(扱い)注意
コーナー注意！(特に数値が小さいものについては要検証)
N行出力のときは'¥n'
グリッド上では行先が範囲内におさまるかif文で確認(RE注意)
if文ではちゃんと比較演算子==を使え('='でもエラー出ない)
配列(vector)の大きさが0か1以上かで場合分けせよ(RE注意)
(vector<int> a(m)でm==0というものはできない)
modはなるべく最後に取れ！
doubleを扱うときには(abs)ではなく'fabs'!!!
*/

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


int main(){
    int R;
    double cir;
    cin >> R;
    cir = 2*R*M_PI;
    printf("%.8f\n", cir);
}

Measured memory_bytes: 3764
// Why I am so dumb? :c
#include <bits/stdc++.h>

#define pb push_back
#define mp make_pair

#define all(x) (x).begin(), (x).end()

#define fi first
#define se second

using namespace std;

typedef long long ll;

const int MAXN = (int)3e5 + 5;                                           

map<string, int> cnt[20];

string s1[MAXN], t1[MAXN];

string s2[MAXN], t2[MAXN];

char s[55];

int pw[20];

ll ans;

int n;

void pre() {
    pw[0] = 1;

    for (int i = 1; i < 20; ++i) {
        pw[i] = (pw[i - 1] << 1);
    }
}

bool bit(int x, int p) {
    return x & pw[p];
}

void solve() {                   
    scanf("%d %s", &n, s);

    for (int m = 0; m < pw[n]; ++m) {
        for (int i = 0; i < n; ++i) {
            if (bit(m, i)) {
                s1[m].pb(s[i]);
                s2[m].pb(s[i + n]);
            }
            else {
                t1[m].pb(s[i]);
                t2[m].pb(s[i + n]);
            }
        }

        reverse(all(t1[m]));
        reverse(all(t2[m]));
    }    

    for (int m = 0; m < pw[n]; ++m) {
        ++cnt[s2[m].size()][t2[m] + s2[m]];        
    }

    for (int m1 = 0; m1 < pw[n]; ++m1) {
        string P = s1[m1] + t1[m1];
        ans += cnt[t1[m1].size()][P];        
    }    
         
    printf("%lld\n", ans);
}

int main() {    
    int tt = 1;

    pre();

    while (tt--) {
        solve();
    }

    return 0;
}

Measured memory_bytes: 136448
#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<vector>
#include<string>
#include<queue>
#include<set>
#include<map>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll, int> plli;
typedef pair<int, pii> pipii;
typedef vector<vector<int> > mati;
typedef vector<vector<double> > matd;

#define rep(i,x,y) for(int i=(x); i<(y); ++i)
const int INF = (1<<30);
const ll INFLL = 1LL<<62;
const long double EPS = 1e-12;

template <typename T>
void vec_print(vector<T> VEC){
  rep(i, 0, VEC.size()){
    cout << VEC[i] << " ";
  }
  cout << "\n";
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  rep(i, 0, MAT.size()){
    rep(j, 0, MAT[i].size()){
      cout << MAT[i][j] << " ";
    }
    cout << "\n";
  }
};

class HOGE{
  public:
    ll index;
    ll value;
    HOGE(ll index, ll value){
      this->index = index;
      this->value = value;
    };
    ~HOGE(void){
      return;
    };

    void print(void){
      cout << "index : " << index << ", value : " << value << "\n";
      return;
    };
    
    bool operator==(const HOGE &obj){
      return (this->value == obj.value);
    };
    bool operator<(const HOGE &obj){
      return (this->value < obj.value);
    };
    bool operator>(const HOGE &obj){
      return (this->value > obj.value);
    };
};

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  ll N;
  cin >> N;
  vector<ll> A(N+2);
  ll L_max = 0;
  A[0] = 0;
  rep(i, 0, N){
    cin >> A[i+1];
    L_max += abs(A[i+1]-A[i]);
  }
  A[N+1] = 0;
  L_max += abs(A[N]);

  rep(i, 1, N+1){
    if(A[i-1] <= A[i] && A[i] <= A[i+1]){
      cout << L_max << "\n";
    }else if(A[i-1] >= A[i] && A[i] >= A[i+1]){
      cout << L_max << "\n";
    }else if(A[i] < A[i-1]){
      cout << (L_max - 2*(min(A[i-1], A[i+1]) - A[i])) << "\n";
    }else{
      cout << (L_max - 2*(A[i] - max(A[i-1], A[i+1]))) << "\n";
    }
  }

  return 0;
}


Measured memory_bytes: 2048
#include<bits/stdc++.h>
#include<bitset>
#include<random>
#include<time.h>

using namespace std;

#define M 1000000007
#define pb push_back
#define f first
#define s second
#define rep(i, st, ed) for(int i=st; i<ed; i++)
#define repn(i, st, ed) for(int i=st; i<=ed; i++)
#define repb(i, ed, st) for(int i=ed; i>=st; i--)

typedef long long ll;
typedef unsigned long long int llt;
typedef long double ld;

const long double PI  =3.141592653589793238463;
const int N = 5e5 + 10;
const ll INF = 1LL << 60;

template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}



// Main Code

int main()
{
  int n;
  cin>>n;
  int x, y;
  y= INT_MAX;
  rep(i, 0, n)
  {
    int a, b;
    cin>>a>>b;
    if(y > b)
      y = b, x = a;
  }
  cout<<(x + y)<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int a,b,y,z;
    scanf("%d %d",&a,&b);
    y=a*b;
    z=a+b;
    if(y==15){
        printf("*");
    }
    else if(z==15){
        printf("+");
    }
    else
        printf("x");

     return 0;


    }


Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a);i<(b);++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+(b),(a).begin()+(c) // [b,c) イテレータ
#define INF 1000000000000000
#define MOD 1000000007
using PII = pair<int64_t, int64_t>;
using VI = vector<int64_t>;
using VVI = vector<VI>;
using VS = vector<string>;
using VP = vector<PII>;
using i64 = int64_t;
template<typename T> void invec(vector<T> &A){for(T& a:A) cin >> a;}


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

i64 N, K; cin >> N >> K;
VI A(N); invec(A);

if (K <= pow(10, 7)) {
    int a = 1;
    rep(i, 0, K) a = A[a-1];
    cout << a << "\n";
    return 0;
}

vector<bool> seen(N, false);
int a = A[0];
seen[0] = true;
while (!seen[a-1]) {
    seen[a-1] = true;
    a = A[a-1];
}

seen.assign(N, false);
VI B;
while (!seen[a-1]) {
    seen[a-1] = true;
    B.push_back(a);
    a = A[a-1];
}

VI C;
int c = 1;
while (c != a) {
    C.push_back(c);
    c = A[c-1];
}

if (K <= C.size()) cout << C[K-1] << "\n";
else cout << B[(K - C.size()) % B.size()] << "\n";

return 0;
}
// コンテスト前はtemplate振り返り。
// 書いて考える．場合分け．情報整理．
// 問題文から考える。自分ができることから考える。
// 単純に分かる量から．愚直解を実装して研究．
// 境界，出力文字列 チェック．行末にスペース入れない．
// 可読性優先．高速化次点．
// まずは全探索，分割，次にDP(小さい問題から大きな問題)
// 制限を見る．境界に注意．求めたい量の変域．動かせる量．
// 偶奇，逆から，ソート，出現回数，出現位置，DP， 余事象，包除
// データ構造． 問題の特徴量．単調性→二分探索。逆から考える。
// 存在判定：構成方法，入力の特徴
// 構築問題。極端解を試す。
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 代数的処理．前処理によるクエリ高速化．
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
// 自明な例から処理，除外．
// 小数のときは，精度の設定する．doubel 変数に数値を入力するときは 123. とする．
// コーナーケース。境界値。数表出力プログラム作る
// 実行エラー：vector添え字超え．0割り．



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

    class Program
    {
        static void Main(string[] args)
    {
            double[] a = Console.ReadLine().Split(' ').Select(double.Parse).ToArray();
        string b = Console.ReadLine();

        double count = b.Length;

        if (a[0] < count)
        {
                int c = (int)count;
                string d = b.Remove((int)a[0]);
                

                d += "...";
                Console.WriteLine(d);

            }
            else
            {
                Console.WriteLine(b);
            }
        

    }
    }

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

using namespace std;

int n, cnt[200005][2];
char s[200005];

int main() {
	scanf("%d", &n);
	scanf("%s", s + 1);
	
	for (int i = 1; i <= n; i++) {
		if (s[i] == '#') cnt[i][0]++;
		else cnt[i][1]++;
		
		cnt[i][0] += cnt[i - 1][0];
		cnt[i][1] += cnt[i - 1][1];
	}
	
	int res = 1e9;
	
	for (int i = 0; i <= n; i++) {
		int black = cnt[i][0];
		int white = cnt[n][1] - cnt[i][1];
		res = min(res, black + white);
	}
	
	printf("%d\n", res);
}


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

using namespace std;

#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<(n);++i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(int)(n);i>=0;--i)
#define RFOR(i, a, b) for(int i=(int)(a);i>=(int)(b);--i)
#define ALL(a) (a).begin(),(a).end()
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;

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

const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;

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

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

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

template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  REP(i, SZ(v)) {
    if(i) os << " ";
    os << v[i];
  }
  return os;
}

vi all, odd;
vi dpall, dpodd;

void init() {
  int n = 1000000;
  int sz = SZ(all);
  dpall.resize(1000001, INF);
  dpall[0] = 0;
  REP(i, sz) {
    if(all[i] > n) break;
    REP(j, n+1) {
      if(j + all[i] <= n) {
        chmin(dpall[j+all[i]], dpall[j] + 1);
      }
    }
  }

  sz = SZ(odd);
  dpodd.resize(1000001, INF);
  dpodd[0] = 0;
  REP(i, sz) {
    if(odd[i] > n) break;
    REP(j, n+1) {
      if(j + odd[i] <= n) {
        chmin(dpodd[j+odd[i]], dpodd[j] + 1);
      }
    }
  }

}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  REP(i, 1000) {
    int tmp = i * (i + 1) * (i + 2) / 6;
    if(tmp > 1000000) break;
    all.push_back(tmp);
    if(tmp&1) odd.push_back(tmp);
  }

  init();

  while(1) {
    int n; cin >> n;
    if(n == 0) break;
    cout << dpall[n] << " " << dpodd[n] << endl;
  }

}

























Measured memory_bytes: 10648
using System;
using System.Linq;
using System.Collections.Generic;

namespace ConsoleApp1 {
    public class Class {
        static void Main(string[] args) {
            var N = long.Parse(Console.ReadLine());
            var A = RL<long>();
            long X = 0;
            foreach (var a in A) {
                X ^= a;
            }
            foreach(var a in A) {
                Console.Write("{0} ", X ^ a);
            }
        }

        static T[] RL<T>() where T : IComparable {
            if (typeof(T) == typeof(int)) {
                return (T[])(object)Console.ReadLine().Trim().Split().Select(int.Parse).ToArray();
            }
            if (typeof(T) == typeof(long)) {
                return (T[])(object)Console.ReadLine().Trim().Split().Select(long.Parse).ToArray();
            }
            if (typeof(T) == typeof(double)) {
                return (T[])(object)Console.ReadLine().Trim().Split().Select(double.Parse).ToArray();
            }
            if (typeof(T) == typeof(decimal)) {
                return (T[])(object)Console.ReadLine().Trim().Split().Select(decimal.Parse).ToArray();
            }
            return (T[])(object)Console.ReadLine().Trim().Split().ToArray();
        }
    }
}

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

namespace ConsoleApp7
{
	class Program
	{
		static void Main(string[] args)
		{
			while (true)
			{
				int n = int.Parse(Console.ReadLine());

				if (n == 0)
					break;

				var s = Console.ReadLine().Split(' ');
				double m = 0;
				double a2 = 0;

				for(int n_i = 0; n_i < n; n_i++)
				{
					int sn = int.Parse(s[n_i]);
					m += sn;

					if(n_i == n -1)
					{
						m = m / n; //平均値が出せる
					}
				}

				for(int n_i = 0; n_i < n; n_i++)
				{
					int sn = int.Parse(s[n_i]);
					a2 += (sn - m) * (sn - m);

					if(n_i == n - 1)
					{
						a2 = a2 / n;
					}
				}

				var a = Math.Sqrt(a2);
				Console.WriteLine(a);
			}
		}
	}
}



Measured memory_bytes: 15896
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    int a, b, c;
    int pa, pb, pc;
    int aa, ab, ac;
    for(int i = 0;i < n;++i){
        cin >> a >> b >> c;
        if(i == 0){
            aa = a, ab = b, ac = c;
        }
        else{
            pa = aa; pb = ab; pc = ac;
            aa = max(pb, pc) + a;
            ab = max(pa, pc) + b;
            ac = max(pa, pb) + c;
        }
    }
    cout << max(aa, max(ab, ac)) << endl;
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	b += MOD;
	a += b;
	a %= MOD;
}

ll dp[110][100100],w[110];
int v[110];

int main(void){
	int n,i,j,ans;
	ll wmax;
	fill(dp[0],dp[110],INFLL);
	dp[0][0] = 0ll;
	cin >> n >> wmax;
	for(i=0; i<n; ++i){
		cin >> w[i] >> v[i];
	}
	for(i=0; i<n; ++i){
		for(j=0; j<=100000; ++j){
			dp[i+1][j] = min(dp[i+1][j],dp[i][j]);
			if(j-v[i]>=0){
				dp[i+1][j] = min(dp[i+1][j],dp[i][j-v[i]]+w[i]);
			}
		}
	}
	ans = 100000;
	while(dp[n][ans]>wmax){
		--ans;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 86272
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
		int n = int.Parse(Console.ReadLine());
		long[] nums = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);
    long[] sums = new long[2];
    long answer = long.MaxValue;
    sums[0] = nums[0];

    for(int i = 1; i < n; i++)
    {
      sums[1] += nums[i];
    }
    answer = Math.Min(answer,Math.Abs(sums[0]-sums[1]));

    for(int i = 0; i < n-1; i++)
    {
      sums[0] += nums[i+1];
      sums[1] -= nums[i+1];
      answer = Math.Min(answer,Math.Abs(sums[0]-sums[1]));
    }

		Console.WriteLine(answer);
	}
}

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

using namespace std;

typedef long long ll;

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

	int n, m, x;
	cin >> n >> m >> x;

	vector<bool> topay(n+1, false);
	rep(i, m){
		int a;
		cin >> a;
		topay[a] = true;
	}

	int l = 0;
	for(int i = x - 1; i >= 0; i--){
		if(topay[i]) l++;
	}

	int r = 0;
	for(int i = x + 1; i <= n; i++){
		if(topay[i]) r++;
	}

	cout << min(l, r) << endl;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Diagnostics;

class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }

    Scanner cin;


    void calc()
    {
        cin = new Scanner();
        int N = cin.nextInt();
        
        List<string> S = new List<string>();

        int[] cnt = new int[N];

        int T = N;
        if (N % 2 == 0) T += 1;

        for (int i = 0; i < N; i++)
        {
            for (int j = i + 1; j < N; j++)
            {
                if ((i + 1) + (j + 1) == T) continue;
                S.Add(String.Format($"{i + 1} {j + 1}"));

                cnt[i] += j + 1;
                cnt[j] += i + 1;
            }
        }
        Console.WriteLine(S.Count);
        foreach (var s in S)
        {
            Console.WriteLine(s);
        }

        for (int i = 0; i < N; i++)
        {
            if (cnt[0] != cnt[i]) Console.WriteLine("!? " + i);
        }

    }


}



class Scanner
{
    string[] s;
    int i;

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

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


Measured memory_bytes: 13252
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
using Graph = vector<vector<pii>>;
const int MOD = 1e9 + 7;

ll powmod(ll a, ll b) {
    ll res = 1;
    while (b) {
        if (b & 1)
            (res *= a) %= MOD;
        (a *= a) %= MOD;
        b >>= 1;
    }
    return res;
}

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

    int n, a, b;
    cin >> n >> a >> b;

    int siz = max(a, b) + 1;
    vector<ll> inv(siz), finv(siz);
    inv[1] = 1;
    finv[0] = finv[1] = 1;
    for (int i = 2; i < siz; ++i) {
        inv[i] = MOD - (MOD / i) * inv[MOD % i] % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }

    ll tmp1 = finv[a], tmp2 = finv[b];
    for (int i = 0; i < a; ++i)
        (tmp1 *= (n - i)) %= MOD;
    for (int i = 0; i < b; ++i)
        (tmp2 *= (n - i)) %= MOD;

    ll ans = (powmod(2, n) - tmp1 - tmp2 - 1) % MOD;
    cout << (ans < 0 ? ans + MOD : ans) << endl;

    return 0;
}


Measured memory_bytes: 3328
local mce, mfl, msq, mmi, mma, mab = math.ceil, math.floor, math.sqrt, math.min, math.max, math.abs

local function getprimes(x)
  local primes = {}
  local allnums = {}
  for i = 1, x do allnums[i] = true end
  for i = 2, x do
    if allnums[i] then
      table.insert(primes, i)
      local lim = x // i
      for j = 2, lim do
        allnums[j * i] = false
      end
    end
  end
  return primes
end

local function getdivisorparts(x, primes)
  local prime_num = #primes
  local tmp = {}
  local lim = mce(msq(x))
  local primepos = 1
  local dv = primes[primepos]
  while primepos <= prime_num and dv <= lim do
    if x % dv == 0 then
      local t = {}
      t.p = dv
      t.cnt = 1
      x = x // dv
      while x % dv == 0 do
        x = x // dv
        t.cnt = t.cnt + 1
      end
      table.insert(tmp, t)
      lim = mce(msq(x))
    end
    if primepos == prime_num then break end
    primepos = primepos + 1
    dv = primes[primepos]
  end
  if x ~= 1 then
    local t = {}
    t.p, t.cnt = x, 1
    table.insert(tmp, t)
  end
  return tmp
end
local n = io.read("*n")
local primes = getprimes(mce(msq(n)))
local dvp = getdivisorparts(n, primes)
local ret = 0
for i = 1, #dvp do
  local cnt = dvp[i].cnt
  local cur = 1
  while cur <= cnt do
    ret = ret + 1
    cnt = cnt - cur
    cur = cur + 1
  end
end
print(ret)


Measured memory_bytes: 20708
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>

using namespace std;

long long int N,H;
vector<long long int> a,b;

int Calc(int d) {
    long long int damage = 0;
    sort(b.begin(),b.end(),greater<long long int>());

    vector<long long int>::iterator it;
    it = max_element(a.begin(),a.end());
    
    for(int i = 0;i < b.size() && b[i] >= *it && H > 0;i++)
    {
        damage++;
        H -= b[i];
    }

    if(H > 0 && H%(*it) != 0)
        damage++;

    if(H > 0)
    damage += H/(*it);
    
    return damage;
}

int main(void) {
    cin>>N>>H;

    for(int i = 0;i < N;i++) {
        int temp1,temp2;
        cin>>temp1>>temp2;
              
        a.push_back(temp1);
        b.push_back(temp2);
    }

    cout<<Calc(H)<<endl;

    return 0;
}


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

int main(){
    string s;
    string a = "aaaaa";
    cin >> s;
    int countchar = 0;
    int countnum = 0;
    for(int j = 0;j < 4;j++){
       if(s.at(0) == s.at(j)){
           countnum++;
       }else if(a.size() == 5){
           a = s.at(j);
       }
    }
    for(int k = 0;k < 4;k++){
        if(a.at(0) == s.at(k)){
            countchar++;
        }
    }
    if(countchar == 2 && countnum == 2){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
}

Measured memory_bytes: 256
#include <map>
#include <set>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
#include <iostream>



using namespace std;

int p[51];

int fxr[51];

int finds(int x)
{
        if(p[x]==x)return x;
        else return p[x] = finds(p[x]);
}

bool same(int x, int y)
{
        return (finds(x) == finds(y));
}

void unions (int x,int y)
{
        x = finds(x);
        y = finds(y);
        if(x == y)return;
        else if(fxr[x] > fxr[y])
        {
                p[y] = x;
        }
        else
        {
                if(fxr[x] == fxr[y])
                fxr[y]++;
                p[x] = y;
        }
}

int main(){
        int N,M,cnt,ans=0;
        cin >> N >> M;
        int t[M],k[M];
        for(int i=0;i<M;i++)
        {
                cin >> t[i] >> k[i];
        }
        for(int i=0;i<M;i++)
        {
                cnt = 0;
                for(int j=0;j<=N;j++)
                {
                        p[j] = j;
                        fxr[j] = 0;
                }
                for(int j=0;j<M;j++)
                {
                        if(i != j)
                        unions(t[j],k[j]);
                }
                cnt = 0;
                for(int j=1;j<=N;j++)
                {
                if(same(1,j) == true)
                cnt++;
                }
                if(cnt!=N)
                ans++;
        }
        cout << ans << endl;
        return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define elif else if
using namespace std;
int a=0,b=0,c=0;
string s;
signed main(){
	cin>>a>>s;
	rep(i,a){
		if(s[i]=='I'){
			b++;
		}else{
			b--;
		}
		if(b>c){
			c=b;
		}
	}
	cout<<c;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <bitset>
#include <stack>
#include <deque>
#include <set>
#include <unordered_set>
#include <list>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <climits>
#include <ctime>
#include <random>
#define speed ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define eps 1e-9
#define inf 0x3f3f3f3f
#define mod 1000000007
using namespace std;

int main() {
	speed;
	int n, k;
	cin >> n >> k;
	vector<int>v(n);
	for (int i = 0; i < n; ++i)
		cin >> v[i];
	sort(v.begin(), v.end());
	int ans = 0;
	for (int i = 0; i < k; ++i)
		ans += v[i];
	cout << ans;
}

Measured memory_bytes: 3144
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include<math.h>
#include<map>
#include<set>
using namespace std;
#define INF 11000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;

int num[110000];

int main(){
  int A,B,C;
  cin>>A>>B>>C;

  if(A==B) cout<<C<<endl;
  else if(B==C) cout<<A<<endl;
  else cout<<B<<endl;
}


Measured memory_bytes: 504
// E - Gluttony

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

int N;
ll K;
ll A[1000000];
ll F[1000000];

bool is_ok(ll k) {
	ll need = 0;
	for (int i=0; i<N; i++) {
		need += max(0LL, A[i] - k / F[i]);
	}
	//cout << "k=" << k << " need=" << need << endl; // **** debug ****
	return need <= K;
}

ll find_min_ok(ll lower, ll upper) {
	if (!is_ok(upper - 1)) return -1; // 存在しない

	ll ok = upper - 1;
	ll ng = lower - 1;

	while(ok - ng > 1) {
		ll trying = (ng + ok) / 2;

		if (is_ok(trying)) {
			ok = trying;
		} else {
			ng = trying;
		}
	}

	return ok;
}

int main() {
	cin >> N >> K;

	for (int i=0; i<N; i++) {
		cin >> A[i];
	}

	for (int i=0; i<N; i++) {
		cin >> F[i];
	}

	sort(A, A+N);
	sort(F, F+N, greater<ll>());

	ll ans = find_min_ok(0, 10000000000000LL);

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 6016
n = int(input())
a = []
b = []
for i in range(n):
    A, B = map(int, input().split())
    a.append(A)
    b.append(B)
ans = 0
a = a[::-1]
b = b[::-1]
for i in range(n):
    a[i] += ans
    if a[i] % b[i] == 0:
        continue
    ans += (a[i] // b[i] + 1) * b[i] - a[i]
print(ans)

Measured memory_bytes: 14900
import java.util.*;

class Main{
  public static void main(String args[]){
    Scanner inputs = new Scanner(System.in);
    int a = inputs.nextInt();
    int b = inputs.nextInt();
    String ope = "";
    if (a < b) {
      ope = " < ";
    } else if (a > b) {
      ope = " > ";
    } else {
      ope = " == ";
    }
    System.out.println("a" + ope + "b");

  }
}

Measured memory_bytes: 17160
n = int(input())
d = dict()
for i in range(n):
    s = input()
    if not s in d:
        d[s] = 1
    else:
        d[s] += 1

ans = []
c = max(d.values())
for k, v in d.items():
    if v == c:
        ans += [k]
for x in sorted(ans):
    print(x)

Measured memory_bytes: 32988
import numpy as np
from collections import Counter
mo = 1000000007
r = range
 
n = int(input())
a = np.array(list(map(int, input().split())))
 
c = Counter(a.tolist())
 
if n % 2 == 1 and (0 not in c or c[0] != 1): print(0); exit();
 
for i in r(n//2):
    x = i * 2 + (1 if n % 2 == 0 else 2)
    if x not in c or c[x] != 2: print(0); exit();
 
print(2 ** (n//2) % mo)


Measured memory_bytes: 23392
#include <iostream>
#include <cmath>
#include <string>
#include <numeric>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <vector>
using namespace std;
#define INF 1000000007
#define ll long long
#define rep(i_, __start, __end) for(ll i_=(ll)__start; i_<(ll)__end; i_++)
#define print(_a) cout << _a << endl;
#define printarray(a, len) rep(ii,0,len) cout << a[ii] << " ";
#define printarray2(aa, len) rep(ij,0,len) printarray(aa[ij], aa[ij].size()); print("");


int main(){
    ll n, a, b;
    cin >> n >> a >> b;
    print(min(a*n, b));
   
  return 0;
}

Measured memory_bytes: 256