akhauriyash/Code-Regression huggingface dataset:
// includes
#include <cstdio>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <climits>
#include <bitset>
#include <list>
#include <random>

// macros
#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for(int i=((int)(n)-1);i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())

using namespace std;

//  types
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
 
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;
const int mod = 1e9 + 7;

// solve
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(a > b){a = b; return 1;} return 0;}


int main(int argc, char const* argv[])
{
  string s;
  cin >> s;
  for(int i = 0; i < sz(s); i++){
    for(int j = i; j < sz(s); j++){
      string tmp = s.substr(0, i) + s.substr(j, sz(s) - j);
      if(tmp == "keyence"){
        cout << "YES" << endl;
        return 0;
      }
    }
  }
  cout << "NO" << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1000000007;
const LL LINF=1ll<<60;
const int INF=1<<30;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};



int main(){
    int h,w,n;cin >> w >> h >> n;
    vector<vector<int>> a(h);
    for (int i = 0; i < n; i++) {
        int x,y;cin >> x >> y;
        x--,y--;
        a[y].pb(x);
    }
    int ans = w;
    int x = 0;
    for (int i = 0; i < h; i++) {
        if(x>=w) break;
        if(a[i].size()){
            sort(ALL(a[i]));
            int t = 0;
            while(t<a[i].size()&&a[i][t]<x){
                t++;
            }
            if(t < a[i].size()) ans = min(ans,a[i][t]);
        }
        if(i+1<h&&a[i+1].size()){
            int t = 0;
            x++;
            sort(ALL(a[i+1]));
            while(t<a[i+1].size()&&a[i+1][t]<x){
                t++;
            }
            if(t<a[i+1].size()){
                if(a[i+1][t]==x){
                    while(t<a[i+1].size()&&a[i+1][t]==x){
                        t++;
                        x++;
                    }
                }
            }
        }
        else{
            x++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 8704
#include<stdio.h>
#include<assert.h>
#include<stdbool.h>
#include<string.h>
#include<math.h>
#include<float.h>
#define ERROR -1
#define MAX 1000000
typedef struct
{
  double x,y,z;
} Coordinates;

Coordinates Tree[MAX];//binary heap 
int Index;            //the size of a heap

int getParent(int i){ return i/2; }

int getLeft(int i)  { return 2*i; }

int getRight(int i) { return 2*i+1; }

void setValue(Coordinates *coor, double x, double y, double z)
{
  coor->x = x;
  coor->y = y;
  coor->z = z;
}

void swap(Coordinates *a,Coordinates *b)
{
  Coordinates h = *a;
  *a = *b;
  *b = h;
}

// a > b
bool Compare(const Coordinates a,const Coordinates b)
{
  //?????????????????????????即????
  return a.x > b.x;
}


void maxHeapify(int i)
{
  int Left = getLeft(i);
  int Right = getRight(i);
  int largest;
 
  if(Left <= Index && Compare(Tree[Left],Tree[i]) ) largest = Left;
  else                                              largest = i;

  if(Right <= Index && Compare(Tree[Right],Tree[largest]) ) largest = Right;

  if(largest != i)
    {
      swap(&Tree[i],&Tree[largest]);
      maxHeapify(largest);
    }
}

int heapIncreaseKey(int i,Coordinates key)
{
  if(Compare(Tree[i],key))return ERROR;
  Tree[i] = key;
  while(i > 1 && Compare(Tree[i],Tree[getParent(i)]))
    {
      swap(&Tree[i],&Tree[getParent(i)]);
      i = getParent(i);
    }
}

Coordinates heapExtractMax()
{
  assert(Index >= 1);//heap underflow
  Coordinates Max = Tree[1];
  Tree[1] = Tree[Index];
  Index--;
  maxHeapify(1);
  return Max;
}

void add_node(Coordinates value)
{
  Coordinates dummy;
  setValue(&dummy,DBL_MIN,DBL_MIN,DBL_MIN);
  Tree[++Index] = dummy;
  heapIncreaseKey(Index,value);
}


int main()
{
  char op[1000];
  double x,y,z;
  
  while(1){
    scanf("%s",op);
    if(strcmp(op,"insert") == 0){
      scanf("%lf",&x);
      Coordinates input;
      setValue(&input,x,DBL_MIN,DBL_MIN);
      add_node(input);
    }
    else if(strcmp(op,"extract") == 0){
      Coordinates output = heapExtractMax();
      printf("%d\n",(int)output.x);
      //printf("%ld\n",heapExtractMax());
    }
    else if(strcmp(op,"end") == 0)break;
  }
 
  return 0;
}

Measured memory_bytes: 24064
function main(input){
    let lines = input.split("\n");
    let aArgs = lines.shift().split(" ").map(x => parseInt(x));
    let n = aArgs[0];
    let m = aArgs[1];
    let aLines = lines.slice(0,n);
    let bLines = lines.slice(n).map(x=>parseInt(x));
    
    for(let i=0;i<n;i++){
        let elm = 0;
        let aLine = aLines[i].split(" ");
        for(let j=0;j<m;j++){
            elm += bLines[j]*parseInt(aLine[j]);
        }
        console.log(elm);
    }


}



main(require("fs").readFileSync("/dev/stdin","utf-8"));


Measured memory_bytes: 18196
data = {}
total = 0
N = int(input())

for a in input().split():
    a = int(a)
    data[a] = data.get(a, 0) + 1
    total += a

Q = int(input())

for _ in range(Q):
    b, c = map(int, input().split())
    diff = c - b
    count = data.get(b)
    if count:
        data[c] = data.get(c, 0) + data.pop(b)
        total += diff * count
    print(total)

Measured memory_bytes: 21900
import java.util.Scanner;

public class Main {

    static final long mod = 1000000007;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }

        // counter
        int[] c = new int[3];
        long ans = 1;

        for (int i = 0; i < n; i++) {
            int num = 0;
            boolean countUp = false;
            for (int j = 0; j < 3; j++) {
                if (a[i] == c[j]) {
                    num++;
                    if (!countUp) {
                        c[j]++;
                        countUp = true;
                    }
                }
            }
            ans = (ans * num) % mod;
        }

        System.out.println(ans);

        sc.close();
    }

}


Measured memory_bytes: 50004
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush, nlargest, nsmallest
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
# sys.setrecursionlimit(pow(10, 6))
# sys.stdin = open("input.txt", "r")
# sys.stdout = open("output.txt", "w")
mod = pow(10, 9) + 7
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(" ".join(map(str, var))+end)
def l(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]


s = data()
t = data()
if t[:len(t)-1] == s:
    out("Yes")
    exit()
out("No")


Measured memory_bytes: 72824
#include <stdio.h>

int p,q,r,s;

int solve(int a,int b,int c){
	int from,to;

	if(b == 0 && c == 0){
		p = a;
		q = s = 0;
		r = 1;
		return 1;
	}

	if(c == 0){
		p = a;
		q = b;
		r = 1;
		s = 0;

		if(p == r && q < s){
			q ^= s;
			s ^= q;
			q ^= s;
		}
		return 1;
	}

	from = -abs(c);
	to = abs(c);

	for(p=1;p<=a;p++){
		if(a % p != 0) continue;
		r = a / p;
		if(p < r) continue;

		for(q=from;q<=to;q++){
			if(q == 0) continue;
			if(c % q != 0) continue;
			s = c / q;
			if(p == r && q < s) continue;

			if(p * s + q * r == b) return 1;
		}
	}

	return 0;;
}

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

	while(scanf("%d%d%d",&a,&b,&c) && (a||b||c)){
		if(solve(a,b,c)){
			printf("%d %d %d %d\n",p,q,r,s);
		}
		else{
			printf("Impossible\n");
		}
	}

	return 0;
}

Measured memory_bytes: 416
import sys
sys.setrecursionlimit(10**6)
def input():
	return sys.stdin.readline()[:-1]

n = int(input())
b = list(map(int, input().split()))
adj = [[] for _ in range(n)]
for _ in range(n-1):
	u, v = map(int, input().split())
	adj[u-1].append(v-1)
	adj[v-1].append(u-1)

def dfs(x, p):
	s = set()
	for v in adj[x]:
		if v != p and b[v] < b[x]:
			s.add(dfs(v, x))
	res = 0
	while res in s:
		res += 1
	return res

ans = []
for i in range(n):
	if dfs(i, -1) != 0:
		ans.append(i+1)
print(*ans)

Measured memory_bytes: 4084
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>

using namespace std;

int main()
{
    pair<string, int> data[100];
    int i = 0;
    while (cin >> data[i].first >> data[i].second) {i++;}
    sort(data, data+i);
    cout << data[0].first << '\n' << data[0].second;
    for (int j = 1; j < i; j++) {
        if (data[j-1].first != data[j].first) {
            cout << '\n' << data[j].first << '\n' << data[j].second;
        } else {
            cout << " " << data[j].second;
        }
    }
    cout << endl;
    return 0;
}

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

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;
typedef tuple<ll, ll, ll, ll, ll> t5;

#define rep(a,n) for(ll a = 0;a < n;a++)
#define repi(a,b,n) for(ll a = b;a < n;a++)

using namespace std;

static const ll INF = 1e15;

template<typename T>
static inline void chmin(T & ref, const T  value) {
    if (ref > value) ref = value;
}

template<typename T>
static inline void chmax(T & ref, const T value) {
    if (ref < value) ref = value;
}

constexpr ll mod = 1000000007;

int main() {
    ll r, c, k;
    cin >> r >> c >> k;
    vector<vector<ll>> items(r, vector<ll>(c, 0));
    rep(i, k) {
        ll r, c, v;
        cin >> r >> c >> v;
        r--; c--;
        items[r][c] = v;
    }
    vector<vector<vector<ll>>> dp(r, vector<vector<ll>>(c, vector<ll>(4, 0)));
    if (items[0][0] != 0) {
        dp[0][0][0] = 0;
        dp[0][0][1] = items[0][0];
    }
    rep(y, r) {
        rep(x, c) {
            if (y != 0) {
                ll mm = 0;
                rep(i, 4) {
                    chmax(mm, dp[y - 1][x][i]);
                }
                dp[y][x][0] = mm;
                dp[y][x][1] = mm + items[y][x];
            }
        }
        rep(x, c) {
            if (x != 0) {
                rep(i, 4) {
                    chmax(dp[y][x][i], dp[y][x - 1][i]);
                }
                rep(i, 3) {
                    chmax(dp[y][x][i + 1], dp[y][x - 1][i] + items[y][x]);
                }
            }
        }
    }
    ll u = 0;
    rep(i ,4){
        chmax(u, dp[r - 1][c - 1][i]);
    }
    cout << u << endl;
    return 0;
}



Measured memory_bytes: 705916
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!(
        n: usize,
        v: [isize; n],
        c: [isize; n],
    );
    let mut sum = 0;
    for i in 0..n {
        let dif = v[i] - c[i];
        if dif > 0 {
            sum += dif;
        }
    }
    println!("{}", sum);
}


Measured memory_bytes: 4352
#include<iostream>
#include <climits>
#include<vector>
#include<list>
#include<numeric>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;



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

	int D, G;
	cin >> D >> G;
	vector<int> p(D), c(D);
	REP(i, D) cin >> p[i] >> c[i];
	int res = 1000;
	for (int bit = 0;bit < (1 << D);bit++) {
		int sum = 0;
		int tmp = 0;
		for (int i = 0;i < D;i++) {
			if (bit&(1 << i)) {
				sum += p[i] * 100 * (i + 1) + c[i];
				tmp += p[i];
			}
		}
		if (sum < G) {
			int j = D - 1;
			while (j >= 0 && (bit&(1 << j) || p[j] == 1)) j--;
			if (j < 0) continue;
			int tmp2 = (G - sum) / (100 * (j + 1)) + (int)((G - sum) % (100 * (j + 1)) != 0);
			if (tmp2 > p[j] - 1) continue;
			tmp += tmp2;
		}
		res = min(res, tmp);
	}
	cout << res << "\n";

	return 0;
}

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

int main() {
  long long N, A, B;
  cin >> N >> A >> B;
  long long num_blue = N / (A + B) * A;
  long long rest = N % (A + B);
  num_blue += min(rest, A);
  cout << num_blue << endl;
  return 0;
}

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

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

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef long double ld;
#define mp make_pair
#define pb push_back

#define rep(i, N) for(ll i = 0; i < N; i++)
#define repa(i, a, N) for(ll i = a; i < N; i++)
#define repr(i, N) for(ll i = N-1; i >= 0; i--)

#define drep(i, N, j, M) rep(i, N) rep(j, M)
#define trep(i, N, j, M, k, L) rep(i, N) rep(j, M) rep(k, L)

const ll mod = 1e9 + 7;
// const ll mod = 998244353;

const ll LLMAX = numeric_limits<long long>::max();

void No() {
	cout << "No" << endl;
}

void Yes() {
	cout << "Yes" << endl;
}


int main() {
	ll N;
	cin >> N;
	ll ans = N * (N - 1) / 2;

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

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

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

// Self settings
// clang-format off
#define MAX_N 10000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
// clang-format on

int X, A;

int main(void)
{
  cin >> X >> A;
  if (X < A)
    cout << 0 << endl;
  else
    cout << 10 << endl;
  return 0;
}


Measured memory_bytes: 888
import numpy

n,k = map(int,input().split(" "))
d = []
a = []
tmp = numpy.zeros(n)
for i in range(k):
    d.append(int(input()))
    a.append([int(e) for e in input().split(" ")])

for i,dd in enumerate(d):
    for j in range(dd):
        tmp[a[i][j]-1] += 1

print(sum(tmp==0))

Measured memory_bytes: 27328
import heapq

def readinput():
    n,m=list(map(int,input().split()))
    a=list(map(int,input().split()))
    return n,m,a

def main(n,m,a):
    #print(a)
    hq=[]
    for i in a:
        heapq.heappush(hq,-i)
    #print(hq)
    for i in range(m):
        a=(-heapq.heappop(hq))//2
        heapq.heappush(hq,-a)
        #print(hq)

    sum=0
    for i in hq:
        sum+=i
    
    return -sum

if __name__=='__main__':
    n,m,a=readinput()
    ans=main(n,m,a)
    print(ans)


Measured memory_bytes: 20396
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main(void)
{
    int a[5];
    int i;
    for (i = 0; i < 5; i++)
    {
        scanf("%d", &a[i]);
        if (a[i] == 0)
            break;
    }
    printf("%d\n", i + 1);
    return 0;
}

Measured memory_bytes: 1728
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;

signed main(){
    int h,w,d;
    cin >> h >> w >> d;
    int n = h * w;
    vector<P> vec(n + 1);
    int a[h][w];
    REP(i,h){
        REP(j,w){
            cin >> a[i][j];
            vec[a[i][j]].first = i;
            vec[a[i][j]].second = j;
        }
    }
    int q;
    cin >> q;
    int l[q],r[q];
    REP(i,q){
        cin >> l[i] >> r[i];
    }
    int dist[n + 1];
    for(int i = d + 1; i <= n; i++){
        dist[i] = abs(vec[i].first - vec[i - d].first) + abs(vec[i].second - vec[i - d].second);
    }
    int sum[n + 1];
    for(int i = 1; i <= d; i++){
        sum[i] = 0;
        for(int j = i + d; j <= n; j += d){
            sum[j] = sum[j - d] + dist[j];
        }
    }
    REP(i,q){
        cout << sum[r[i]] - sum[l[i]] << endl;
    }
    return 0;
}

Measured memory_bytes: 3712
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define FORR(i, a, b) for (int i = b - 1; i >= a; --i)
#define SORT(v) sort(v.begin(), v.end())
#define SORTR(v) sort(v.rbegin(), v.rend())
#define REV(v) reverse(v.begin(), v.end())
#define ITER(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define LB(v, x) (lower_bound(v.begin(), v.end(), x) - v.begin())
#define UB(v, x) (upper_bound(v.begin(), v.end(), x) - v.begin())
#define SZ(v) (int)v.size()
using namespace std;
using ll = long long;
using P = pair<int, int>;

vector<P> prime_fact(int n) {
    if (n == 1) return vector<P>(1, {1, 0});
    vector<P> res;
    for (ll i = 2; i * i <= n; ++i) {
        if (n % i) continue;
        res.emplace_back(i, 0);
        while (n % i == 0) {
            res.rbegin()->second++;
            n /= i;
        }
    }
    if (n > 1) res.emplace_back(n, 1);
    return res;
}

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

    int n;
    cin >> n;
    vector<P> pf = prime_fact(n);
    cout << n << ":";
    for (auto &p : pf) {
        REP(i, p.second) {
            cout << " " << p.first;
        }
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 3212
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#define N 100
void BubbleSortUp(int B[],int min,int max);
void BubbleSortDown(int B[],int min,int max);
int main(void){
	int n,i,j,B[N],C[N],sum,num;
	char s[N],str[N],*line,A[N];

	fgets(s,sizeof(s),stdin);
	sscanf(s,"%d",&n);
	for(j=0;j<n;j++){
	fgets(str,sizeof(str),stdin);
		sscanf(str,"%c%c%c%c%c%c%c%c",&A[0],&A[1],&A[2],&A[3],&A[4],&A[5],&A[6],&A[7]);
	sum=0; num=1;
	for(i=0;i<8;i++){
		B[i]=(A[i]-'\0')%48;
		C[i]=B[i];
	}
	BubbleSortUp(B,0,7);
	BubbleSortDown(C,0,7);
	for(i=0;i<8;i++){
		if(i!=0)
			num*=10;
		sum+=B[i]*num;
		sum-=C[i]*num;
	}
	printf("%d\n",sum);
	}
	return 0;
}

void BubbleSortUp(int B[],int min,int max){
	int i,j,tmp;
	for(i=min;i<=max;i++){
		for(j=max;j>i;j--){	
			if(B[j] < B[j-1]){
				tmp = B[j-1];
				B[j-1] = B[j];
				B[j] = tmp;
			}
		}
	}
}
void BubbleSortDown(int B[],int min,int max){
	int i,j,tmp;
	for(i=min;i<=max;i++){
		for(j=max;j>i;j--){	
			if(B[j] > B[j-1]){
				tmp = B[j-1];
				B[j-1] = B[j];
				B[j] = tmp;
			}
		}
	}
}

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

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rep2(i,s,n) for(int i = (s); i < (n); ++i)
#define ll long long
#define ld long double
#define P pair<ll,ll>
#define all(v) v.begin(),v.end()

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);

int main(void)
{
    ll a,b,k; cin>>a>>b>>k;
    map<ll,ll> mp;
    for(int i=a;i<a+k;i++) mp[i]++;
    for(int i=b;i+k>b;i--) mp[i]++;
    for(auto x:mp){
        if(x.second){
            if(a<=x.first && x.first<=b) cout<<x.first<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3580
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
#define int long long
#define double long double
#define endn "\n"
typedef pair<int,int> P;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const int MOD = 1000000007;
//const int MOD = 998244353;
template<class T> inline int add(T& a, T b, T M = MOD){a=(a+M)%M;b=(b+M)%M;a=(a+b)%M;return a;};
template<class T> inline int mul(T& a, T b, T M = MOD){if(a>=M)a%=M;if(b>=M)b%=M;a*=b;if(a>=M)a%=M;return a;};
const ll INF = 1e16;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
const string abc="abcdefghijklmnopqrstuvwxyz";
const string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

////////////////////////////////////////////////////////////////////
///////////////////////___modpow___////////////////////
ll modpow(ll a,  ll n, const ll &MOD = MOD){
  ll ret = n == 0 ? 1 : modpow(a, n/2, MOD);
  (ret *= ret) %= MOD;
  if(n%2)((ret *= a) %= MOD);
  return ret;
}
///////////////////////___modinv___////////////////////
ll modinv(ll d, const ll &MOD = MOD){
  return modpow(d, MOD-2, MOD);
}
////////////////////////////////////////////////////////////////////

int n,k,dp[110000];
signed main(){
  cin>>n>>k;
  dp[k] = 1;
  for(int i = k-1;i >= 1;i--){
    dp[i] = modpow(k/i, n);
    for(int j = 2;i*j <= k;j++)add(dp[i], -dp[i*j]);
  }
  int ans = 0;
  repd(i,1,k+1){
    add(ans, dp[i]*i);
  }
  cout << ans << endl;
}


Measured memory_bytes: 4416
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const auto INF = (ll)1e9;
using v = vector<ll>;
using p = pair<ll,ll>;
using m = map<ll,ll>;
using vv = vector<v>;
int gcd(int a,int b){
    return a==0? b :gcd(a,a%b);
}


int main(){
    ll n;
    cin >> n;
    auto c = vector<v>(n,v('z'-'a'+1,0));
    for (int i = 0; i < n; i++)
    {
        string s;
        cin >> s;
        for (int j = 0; j < s.size(); j++)
        {
            c[i][s[j]-'a']++;
        }
    }
    
    string s;
    for (int i = 0; i < 'z'-'a'+1; i++)
    {
        bool f=true;
        ll _min = INF;
        for (int j = 0; j < n; j++)
        {
            _min = min(_min,c[j][i]);
        }
      
        for (int j = 0; j < _min; j++)
        {
            s.push_back('a'+i);
        }
    }
    cout << s;
}  


Measured memory_bytes: 256
N, M, Q = map(int, input().split())
s = list(list(map(int, input().split())) for _ in range(Q))

mx = 0
a = [1]*10

for s1 in range(1, M+1):
    a[0] = s1
    for s2 in range(s1, M+1):
        a[1] = s2
        for s3 in range(s2, M+1):
            a[2] = s3
            for s4 in range(s3, M+1):
                a[3] = s4
                for s5 in range(s4, M+1):
                    a[4] = s5
                    for s6 in range(s5, M+1):
                        a[5] = s6
                        for s7 in range(s6, M+1):
                            a[6] = s7
                            for s8 in range(s7, M+1):
                                a[7] = s8
                                for s9 in range(s8, M+1):
                                    a[8] = s9
                                    for s10 in range(s9, M+1):
                                        a[9] = s10
                                        
                                        cnt = 0
                                        for i in range(Q):
                                            si = s[i]
                                            if a[si[1]-1] - a[si[0]-1] == si[2]:
                                                cnt += si[3]
                                            mx = max(mx, cnt)
                                            
print(mx)

Measured memory_bytes: 77428
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel.Design;
using System.Globalization;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Xml.Schema;
using static System.Console;

namespace ConsoleApp2
{
    class Program
    {
        static public int[] Sarray() { return ReadLine().Split().Select(int.Parse).ToArray(); }
        static public List<int> Slist() {
            var t = ReadLine();
            if (t.Trim().Length == 0) return new List<int>();
            return new List<int>(t.Split().Select(int.Parse)); }
        static void Main(string[] args)
        {
            var N = Sarray()[0];
            var Ln = Sarray();
            long ans = 0;
            for(var i=0;i<N;i++)
            {
                for(var j=i+1;j<N;j++)
                {
                    for(var k=j+1;k<N;k++)
                    {
                        if (Ln[i] != +Ln[j] && Ln[j] != +Ln[k] && Ln[k] != +Ln[i]
                            &&
                            Ln[i]+ Ln[j]> Ln[k] && Ln[j] + Ln[k] > Ln[i] && Ln[k] + Ln[i] > Ln[j]) ans++;
                    }
                }
            }
            WriteLine(ans);

        }
    }
}


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

int main()
{
  // 200以下の奇数で約数が8個あるもの
  vector<int> A = {105, 135, 165, 189, 195};
  int N;
  cin >> N;
  int cnt = 0;
  // O(1)のアルゴリズム
  for (int i = 0; i < 5; i++)
  {
    if (A.at(i) > N)
    {
      break;
    }
    cnt++;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
/* AOJ 0063
 *
 * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0063
 *
 */

#include <stdio.h>
#include <string.h>

#define DEBUG 0
#define true 1
#define false 0


int palindrome(char* buf, int len){
    if(DEBUG)
        printf("%d %s\n",len, buf);

    if(len == 0)
        return true;
    if(len == 1)
        return true;

    if(*buf == *(buf+len-1)){
        return palindrome(buf+1, len-2);
    }else{
        return false;
    }
}



int main(){
    char buf[101];
    int len;
    int count;

    count = 0;

    while(scanf("%s", buf)==1){
        len = strlen(buf);
        if(palindrome(buf, len)){
            count ++;
        }
    }
    printf("%d\n", count);

    return 0;
}

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

int main() {
    int h, w;
    cin>>h>>w;
    string a[h];
    for(int i = 0;i < h;i++){
        cin>>a[i];
    }
    int ans = 0;
    for(int i = 0;i < h;i++){
        for(int j = 0;j < w;j++){
            if(a[i][j] == '#'){
                ans += 1;
            }
        }
    }
    if(ans == h+w-1){
        cout<<"Possible"<<endl;
    } else {
        cout<<"Impossible"<<endl;
    }
}


Measured memory_bytes: 256
S = input()
K = int(input())
num = 0

for i in range(len(S)):
    num = int(S[i])
    if (num != 1):
        num = i
        break

if (S[0] == '1' and K - 1 < num):
    ans = 1
elif (S[0] == '1'):
    ans = S[num]
else:
    ans = S[0]

print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define VS vector<string>
#define ll long long int
#define debug(x) cout << x << " :" <<#x << endl  
int main(void) {
     int a,b,c;
     cin >> a >> b >> c;
     if(a<=c && c <= b) cout << "Yes" << endl;
     else cout << "No" << endl;                                                                                                          
}     

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

#ifdef DEBUG
#define debug(x) cout << #x << ": " << x << endl
#else
#define debug(x)
#endif

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REPS(i, n) for(int i = 1; i <= (n); i++)
#define ALL(v) (v).begin(), (v).end()

#define pb push_back
#define mp make_pair
#define mt make_tuple

using namespace std;

using ll = long long;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;

const ll INF = 1e18;
const ll MOD = 1e9+7;

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


signed main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    int N, K; cin >> N >> K;
    vi sunuke(N);
    REP(i, K)
    {
        int d; cin >> d;
        REP(j, d)
        {
            int A; cin >> A;
            A--;
            sunuke[A]++;
        }
    }
    int ans = 0;
    REP(i, N) if(sunuke[i] == 0) ans++;
    cout << ans << endl;
}

Measured memory_bytes: 3620
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <cassert>
#include <cmath>
#include <sstream>
#include <complex>
//#include <unordered_map>
using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef pair<unsigned, unsigned> uu;
typedef pair<ll, ll> l4;


#define pb push_back
#define mp make_pair

const int maxn = 2e5+1;
char a[maxn+26];
int nxt[maxn+26];
int b[26];
int c[maxn+26];
int main()
{
    scanf("%s", a);
    int len = strlen(a);
    for (int i = 0; i < 26; ++i)
        a[i+len] = 'a'+i, c[i+len] = 1, nxt[i+len] = len+26, b[i] = i+len;
    len += 26;
    a[len] = 0;
    
    for (int i = len-26-1; i >= 0; --i)
    {
        c[i] = 1+c[b[0]];
        nxt[i] = b[0];
        for (int j = 0; j < 26; ++j)
        {
            if (1+c[b[j]] < c[i])
            {
                nxt[i] = b[j];
                c[i] = 1+c[b[j]];
            }
        }
        b[a[i]-'a'] = i;
    }
    int cur = 0;
    for (int i = 0; i < 26; ++i)
        if (c[b[i]] < c[b[cur]])
            cur = i;
    cur = b[cur];
    while (cur != len)
    {
        putchar(a[cur]);
        cur = nxt[cur];
    }
    puts("");
    
}


Measured memory_bytes: 2048
N = int(input())
A = list(map(int, input().split()))
A.sort()
used = [0 for _ in range(int(1e6+1))]

ans = 0
for i in A:
    if used[i] > 0:
        used[i] += 1
        continue
    for j in range(i, len(used), i):
        used[j] += 1
for a in A:
    if used[a] == 1:
        ans += 1
print(ans)


Measured memory_bytes: 32232
#include<bits/stdc++.h>
#define test int t; cin>>t; while(t--)
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef long long ll;
using namespace std;

int main()
{
  long long n; cin>>n; cout<<n*n<<endl;
}

Measured memory_bytes: 3596
#!/usr/bin/env python3
import sys


def solve(S: str):
    listS = list(S)
    print('x'*len(S))
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()


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

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

    string s;
    cin >> s;
    ll k;
    cin >> k;

    int n = s.size();
    int ans = 1;
    if (n >= k) {
        REP(i, k) {
            if (s[i] != '1') {
                ans = s[i] - '0';
                break ;
            }
        }
    } else {
        REP(i, n) {
            if (s[i] != '1') {
                ans = s[i] - '0';
                break ;
            }
        }
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long       ll;
#define PI                acos(-1)
#define pb                push_back
#define mp                make_pair
#define all(a)            (a).begin(), (a).end()
#define clr(a,h)          memset(a, (h), sizeof(a))
#define F first
#define S second
#define fore(i,b,e)		  for(int i=(int)b;i<(int)e;++i)
#define forr(i,b,e)		  for(int i=(int)b;i<(int)e;++i)
#define deb(x)			  cerr << "# " << (#x) << " = " << (x) << endl;
int faster_in(){int r=0,c;for(c=getchar();c<=32;c=getchar());if(c=='-') return -faster_in();for(;c>32;r=(r<<1)+(r<<3)+c-'0',c=getchar());return r;}

using namespace std;

typedef pair<int, int>  ii;
typedef vector<int>     vi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
const int INF = 1234567890;

ll modPow(ll b, ll e, ll mod) {
	if (mod == 0) return 0;
	if (e == 0) return 1;
	ll res = modPow(b, e>>1, mod);
	res = res * res % mod;
	if (e&1)
		res = b * res % mod;
	return res;
}

int steps(int n) {
	if (n == 0) return 0;
	return 1 + steps(n % __builtin_popcount(n));
}

int main()
{
    std::ios::sync_with_stdio(false); cin.tie(0);
    //freopen("","r",stdin);
    //freopen("","w",stdout);
    int n;
    cin >> n;
    string s;
    cin >> s;
    int ones = 0;
    for(char c : s) {
    	ones += (c == '1');
    }
    int mod = 0, modUp = 0, modDown = 0;
    reverse(all(s));
    fore(i, 0, n) {
    	if (s[i] == '1') {
    		mod += modPow(2, i, ones);
    		modUp += modPow(2, i, ones+1);
    		modDown += modPow(2, i, ones-1);
    		if (ones > 0) mod %= ones;
    		modUp %= (ones+1);
    		if (ones > 1) modDown %= (ones-1);
    	}
    }
    vi ans;
    fore(i, 0, n) {
    	int pc = ones;
    	if (s[i] == '1') {
    		pc--;
    		if (pc == 0) {
    			ans.pb(0);
    			continue;
    		}
    		ll val = (modDown - modPow(2, i, pc) + pc) % pc;
    		ans.pb( 1 + steps(val) );
    	}
    	else {
    		pc++;
    		ll val = (modUp + modPow(2, i, pc) + pc) % pc;
    		ans.pb( 1 + steps(val) );
    	}
    }
    reverse(all(ans));
    for (int x : ans) {
    	cout << x << '\n';
    }
    return 0;
}
// Dinosaurs are cool

Measured memory_bytes: 4432
#include<bits/stdc++.h>
using namespace std;
int n,m;
int l=0;
float total=0;
int main()
{
	cin>>n>>m;
	if(m==0)cout<<"Yes";
	int a[n+1];
	
	for(int i=1;i<=n;i++){
		cin>>a[i];
		total+=a[i];
	}
	
	total=total/(4*m);
	for(int i=1;i<=n;i++){
		if(a[i]>=total)
		l++;
	}
	if(l>=m)cout<<"Yes";
	else cout<<"No";
	
	return 0;
}

Measured memory_bytes: 256
import math
(n, k) = map(int, input().split())

a = math.fsum([(1/n) * ((1/2)**math.ceil(math.log(k/i, 2))) for i in range(1, min(k, n+1))])

if n >= k:
    print(a + (n+1-k)/n)
else:
    print(a)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<(int)(n);i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

int main(){
    ll n,m; cin >> n >> m;
    vector<pair<ll,ll>> ab(n);
    rep(i,n){
        cin >> ab[i].first >> ab[i].second;
    }
    sort(all(ab));
    ll ans = 0;
    for(int i=0;i<n;i++){
        ll cnt = min(m,ab[i].second);
        ans += cnt * ab[i].first;
        m -= cnt;
        if(m == 0) break;
    }
    cout << ans << endl;
}


Measured memory_bytes: 1792
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int acs(const void *a, const void *b) { 
  return *(int*)a - *(int*)b;
} /* 1,2,3,4.. */
int des(const void *a, const void *b) {
  return *(int*)b - *(int*)a;
} /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b) { 
  return *(char*)a - *(char*)b;
} /* a,b,c,d.. */
int cmp_str(const void *a, const void *b) {
  return strcmp(*(const char **)a, *(const char **)b);
} /* aaa,aab.. */
#define min(a,b) (a < b ? a : b)
#define max(a,b) (a > b ? a : b)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define MAX 100001
#define MOD 1000000007
#define INF 1000000009
typedef long long int lli;

int main(void) {
  char s[11];
  scanf("%s", s);
  int len = strlen(s);

  int ok = 1;
  for (int i = 0; i < len; i += 2) {
    if (s[i] == 'h' && s[i+1] == 'i') continue;
    ok = 0;
    break;
  }
  printf(ok ? "Yes\n" : "No\n");
  return 0;
}


Measured memory_bytes: 128
#include <iostream>

using namespace std;

int main(int argc, char const *argv[])
{
    int N;
    cin >> N;
    int a;
    int cnt = 0;
    for (int i = 0; i < N; i++)
    {
        cin >> a;
        while (a % 2 == 0)
        {
            a /= 2;
            cnt++;
        }

    }

    cout << cnt << endl;
    
    return 0;
}

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

int main() {
  string S, T;
  cin >> S >> T;
  bool ok = false;
  for(int i = 0; i< S.size(); i++){
    char c = S.back();
    S.erase(S.end() - 1);
    S = c + S;
    if(S == T){
      ok = true;
      break;
    }
  }
  if(ok){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
using vl = vector<ll>;
using vvl = vector<vl>;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    int N;
    ll H, W;
    cin >> N >> H >> W;
    vector<ll> A(N), B(N);
    REP(i, N) { cin >> A[i] >> B[i]; }
    ll ans = 0;
    REP(i, N) { ans += min(A[i] / H, B[i] / W); }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
int main(void){
  int n,i;
  ll a[200010],k;
  cin >> n >> k;
  for (i=0;i<n;i++) cin >> a[i];
  sort(a,a+n);
  
  ll l,r,mid,trg,s;
  ll *p;
  l=-1e18;
  r=1e18;
  while (r-l>1){
    mid=(l+r)/2;
    s=0;
    for (i=0;i<n;i++){
      if (a[i]==0){
        if (mid>=0) s+=n-1;
      }else if (a[i]>0){
        if (mid<0) trg=(mid-a[i]+1)/a[i];
        else trg=mid/a[i];
        p=upper_bound(a,a+n,trg);
        if (p>a+i) p--;
        s+=p-a;
      }else{
        if (mid<0) trg=(-mid-a[i]-1)/(-a[i]);
        else trg=-(mid/(-a[i]));
        p=lower_bound(a,a+n,trg);
        if (p<=a+i) p++;
        s+=a+n-p;
      }
    }
    s/=2;
    if (s>=k) r=mid;
    else l=mid;
  }
  
  cout << r << endl;
  
  return 0;
}

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

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

    int count = 0;
    while(true) {
        if(x < 500) break;
        x -= 500;
        count += 1000;
    }

    while(true) {
        if(x < 5) break;
        x -= 5;
        count += 5;
    }

    cout << count << endl;

    return 0;
}

Measured memory_bytes: 3624
program abc119b
  integer n, i
  real x, total
  character(3) s
  total = 0
  read *, n
  do i = 1, n
     read *, x, s
     total = total + merge(x, x * 380000.0, s == 'JPY')
  end do
  print *, total
end program abc119b


Measured memory_bytes: 512
#include<stdio.h>
#include<stdlib.h>
  
typedef struct{
  int parent;
  int left;
  int right;
}node;
  
int degree(node*,int,int);
int depth(node*,int,int);
int height(node*,int,int);
void print_type(node*,int);
#define NIL -1
  
int main(){
  int n,id,frag,count;
  int i,j,k;
  int dep;
  
  node D[25];
  scanf("%d",&n);
    
  for(i=0;i<n;i++){
    D[i].parent=-1;
    D[i].left=-1;
    D[i].right=-1;
  }
  
  for(i=0;i<n;i++){
    scanf("%d",&id);
    scanf("%d%d",&D[id].left,&D[id].right);
  }
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      if(i==D[j].left){
    D[i].parent=j;
      }
      if(i==D[j].right){
    D[i].parent=j;
      }
    }
  }
    
  for(i=0;i<n;i++){
    printf("node %d: parent = %d, ",i,D[i].parent);
    for(j=0,frag=0;j<n;j++){
      if(i==j) continue;
      if(D[i].parent==D[j].parent){
    printf("sibling = %d, ",j);
    ++frag;
    break;
      }
    }
    if(frag==0) printf("sibling = -1, ");
    printf("degree = %d, ",degree(D,n,i));
    printf("depth = %d, ",depth(D,n,i));
    printf("height = %d, ",height(D,n,i));
    print_type(D,i);
  }
  
  return 0;
}
  
int degree(node *D,int n,int i){
  int count=0;
  int j;
  for(j=n-1;j>=0;j--){
    if(i==j) continue;
    if(i==D[j].parent){
      count++;
    }
  }
  return count;
}
  
int depth(node *D,int n,int i){
  int count=0;
  int j;
  for(j=0;j<n;j++){
      if(D[i].parent==j){
    count++;
    i=j;
    j=-1;
      }
  }
    
    
  return count;
}
  
int height(node *D,int n,int i){
  int count=0;
  int h1=0,h2=0;
    
  if(D[i].left!=-1) h1=height(D,n,D[i].left)+1;
  if(D[i].right!=-1) h2=height(D,n,D[i].right)+1;
  if(h1<h2) return h2;
  else return h1;
    
}
  
void print_type(node *D,int i){
    if(D[i].parent==NIL) printf("root\n");
    else if(D[i].left==NIL && D[i].right==NIL) printf("leaf\n");
    else printf("internal node\n");
}

Measured memory_bytes: 612
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define REPvec(itr, mp) for (auto itr = mp.begin(); itr != mp.end(); itr++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007  // 1e9+7
using namespace std;
typedef long long int ll;
typedef vector<int> vecint;
typedef vector<ll> vecll;
typedef vector<double> vecd;
typedef vector<string> vecstr;
typedef vector<char> vecchar;
typedef vector<bool> vecbool;
typedef vector<vector<bool>> vec2bool;
typedef vector<vector<int>> vec2int;
typedef vector<vector<double>> vec2d;
typedef pair<int, int> P;
////////////////////////////////////////////////
void init() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}
////////////////////////////////////////////////
int main() {
  init();
  int n, m, r;
  cin >> n >> m >> r;
  vecint tr(r);
  vec2int d(n, vecint(n, 1e9));
  for (auto& e : tr) {
    cin >> e;
    e--;
  }
  sort(all(tr));
  REP(i, m) {
    int a, b, c;
    cin >> a >> b >> c;
    a--;
    b--;
    d[a][b] = d[b][a] = c;
  }
  /////washall-froyd
  REP(k, n) {
    REP(i, n) {
      REP(j, n) {
        d[i][j] = min(d[i][k] + d[k][j], d[i][j]);
        d[j][i] = d[i][j];
      }
    }
  }
  /////washall-froyd
  int ans = 1e9;
  do {
    int tmp = 0;
    REP(i, r - 1) { tmp += d[tr[i]][tr[i + 1]]; }
    ans = min(ans, tmp);
  } while (next_permutation(all(tr)));
  cout << ans << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
struct ios_accelerate { ios_accelerate() { ios::sync_with_stdio(false); cin.tie(nullptr); } } CALL;

#define REP(i, n) for(auto (i) = (n)*0; (i) < (n); (i)++)
#define RNG(i, a, b) for(auto (i) = (a); (i) < (b); (i)++)
#define RBF(i, v) for(auto& (i) : (v))
#define ALL(x) (x).begin(), (x).end()

using LL = long long;
using UL = unsigned long;
using ULL = unsigned long long;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
template<typename T> using P = pair<T, T>;

const double PI = 3.141592653589793;
const int MOD = 1000000007;
const LL INF64 = static_cast<LL>(1e18) + 2;
const int INF = static_cast<int>(1e9) + 2;

template<typename T> inline void upsort(vector<T>& x) { sort(x.begin(), x.end()); }
template<typename T> inline void downsort(vector<T>& x) { sort(x.begin(), x.end(), greater<T>()); }
template<typename T> inline void col(T x) { cout << x << '\n'; }
template<> inline void col(double x) { cout << fixed << setprecision(12) << x << '\n'; }

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

	map<string, int> day{ {"SUN",7},{"MON", 6}, {"TUE", 5},{"WED",4}, {"THU", 3},{"FRI",2},{"SAT",1} };
	col(day[s]);

	return 0;
}

Measured memory_bytes: 3600
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
	int r; cin>>r;
    cout<<r*r<<endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;


int main()
{
    int num = 0;
    int cnt = 0;
    
    while (cin >> num)
    {
        cnt = 0;
        for (int i = 0; i < 10; i++)
        {
            for (int j = 0; j < 10; j++)
            {
                for (int k = 0; k < 10; k++)
                {
                    for (int m = 0; m < 10; m++)
                    {
                        if (num == (i + j + k +m))
                        {
                            cnt++;
                        }
                    }
                }
            }
        }
        
        cout << cnt << endl;
    }
    
    return 0;
}



Measured memory_bytes: 2996