akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define INF 1e9
typedef long long ll;
using namespace std;

int main() {
    int s; cin >> s;
    int maxint = 0;
    if(s==1) cout << 1 << endl;
    else{
        for(int i = 2; i <= sqrt(s); i++){
            REP(j,1,10){
                if(pow(i,j)<=s){
                    maxint = max(maxint,(int)pow(i,j));
                }
            }
        }cout << maxint << endl;
    }

    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define SP << " " 
#define LLi long long int

using namespace std;

int imax=2147483647;
long long int llimax=9223372036854775807;

//int型vectorを出力
void PV(vector<int> pvv) {
	rep(i, pvv.size()) cout << pvv[i] SP;
	cout << endl;
}

//LLi型vectorを出力
void PVL(vector<LLi> pvv) {
	rep(i, pvv.size()) cout << pvv[i] SP;
	cout << endl;
}

int main(){

	int d/*, ans=0*/;
	vector<int> c, t, ld, at;
	vector< vector<int> >s;

	cin>> d;

	c.resize(26);
	rep(i, 26) cin>> c[i];
	s.resize(d);
	rep(i, d){
		s[i].resize(26);
		rep(j, 26) cin>> s[i][j];
	}
	t.resize(d);
	at.resize(d);
	rep(i, d){
		int tmp=1, ma=-1;
		rep(j, 26){
			if(ma<s[i][j]){
				tmp=j;
				ma=s[i][j];
			}
		}
		t[i]=tmp+1;
	}

	rep(i, 364){
		cout<< t[i] <<endl;
	}
	cout<< t[364];

	return 0;
}

Measured memory_bytes: 3636
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#include <vector>
#include <set>
#include <algorithm>
#include <iostream>
using namespace std;

typedef double LD;
typedef long long LL;
typedef pair<int, int> PII;
#define MP make_pair
#define PB push_back
#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define RFOR(i,b,a) for(int i = (b) - 1; i >= (a); --i)
#define REP(i, t) FOR(i,0,t)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())

const int MOD = 1000000007;
const int INF = 1000007;
const LL LINF = 1LL * INF * INF;
const int MAXN = 100007;
const LD EPS = 1e-12;

bool used[MAXN], ok = true;
int X[MAXN], mn, mx;
vector <PII> g[MAXN];

void dfs(int v)
{
	used[v] = true;
	mn = min(mn, X[v]);
	mx = max(mx, X[v]);
	REP(i, SZ(g[v]))
	{
		int to = g[v][i].first, d = g[v][i].second;
		if (used[to])
		{
			if (X[to] != X[v] + d)
				ok = false;
		}
		else
		{
			X[to] = X[v] + d;
			dfs(to);
		}
	}
}

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//freopen("In.txt", "r", stdin);
	int n, m;
	cin >> n >> m;
	REP(i, m)
	{
		int l, r, d;
		cin >> l >> r >> d;
		g[l].push_back(MP(r, -d));
		g[r].push_back(MP(l, d));
	}
	FOR(i, 1, n + 1)
	{
		if (!used[i])
		{
			mn = mx = X[i] = 0;
			dfs(i);
			if (mx - mn > 1000000000)
				ok = false;
		}
	}
	cout << (ok ? "Yes" : "No");
	//cout << endl; system("pause");
	return 0;
}

Measured memory_bytes: 11264
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
#from decimal import *

A, B, C = MAP()

if any(x%2 != 0 for x in [A, B, C]):
	print(0)
	exit()

l = [(A, B, C)]

flg = True
cnt = 0
while 1:
	a = (B+C)/2
	b = (A+C)/2
	c = (A+B)/2
	if any(x%1 != 0 for x in [a, b, c]):
		print(cnt)
		exit()
	elif (a, b, c) in l:
		print(-1)
		exit()
	else:
		A, B, C = a, b, c
		l.append((A, B, C))
		cnt += 1


Measured memory_bytes: 5472
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	for(int i=n;i<=10000000;i++)
	{
		int b=i;
		int f=0;
		for(int j=2;j<=int(sqrt(b));j++)
		{
			if(b%j==0)
			{
				f=1;
				break;
			}
		}
		if(f==0)
		{
			cout<<i;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define fto(i, s, e) for(int i = s; i <= e; ++i)
#define fto1(i, s, e) for(int i = s; i < e; ++i)
#define fdto(i, s, e) for(int i = s; i >= e; --i)
#define fit(var, it) for(auto it = var.begin(); it != var.end(); ++it)
#define frit(var, it) for(auto it = var.rbegin(); it != var.rend(); ++it)

#define newl '\n'
#define bug1(x, i) cout << #x << '[' << i << "] = " << x[i] << newl
#define bug2(x, i, j) cout << #x << '[' << i << "][" << j << "] = " << x[i][j] << newl
#define bug3(x, i, j, k) cout << #x << '[' << i << "][" << j << "][" << k << "] = " << x[i][j][k] << newl

#define pc __builtin_popcountll

#define ll long long
#define ii pair<int, int>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define sz(v) int((v).size())

template<class T1, class T2> ostream& operator<< (ostream &os, pair<T1, T2> const &v) {
	return os << '(' << v.first << ", " << v.second << ')';
}

template<class T, class Cmp = less<T>> using oss = tree<T, null_type, Cmp, rb_tree_tag, tree_order_statistics_node_update>;

double const pi = acos(-1);
#define oo 1000000007
#define OO 1000000000000000003LL
#define maxn 200003



int main() {
	#ifdef KITTENS
		freopen("main.inp", "r", stdin);
		freopen("main.out", "w", stdout);
	#endif
	ios_base::sync_with_stdio(0); cin.tie(nullptr);
	
	int x, a;
	cin >> x >> a;

	cout << (x < a ? 0 : 10) << newl;

	cerr << 0.001*clock() << newl; return 0;
}

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

int main(){

	for(int n = 1; n < 10; n++)
	{
		for(int k = 1; k < 10; k++)
		{
			int nk = n*k;
			cout << n << "x" << k << "=" << nk << endl;
		}
	}

    return 0;
}

Measured memory_bytes: 1116
n,m = map(int,input().split())
#10進数でちょうどn桁
defs = [tuple(map(int,input().split())) for _ in range(m)]

is_empty = False
jouken = {}

for i in range(n):
    #i桁目で条件に重複がないか見る
    dd = list(set([d[1] for d in defs if d[0]-1 == i]))
    if len(dd) > 1:
        is_empty = True
        break
    elif len(dd) == 1:
        jouken[i] = dd[0] #i桁目の数が決まる

num = [0]*n

if n == 1:
    if 0 in jouken:
        num[0] = jouken[0]
    else:
        num[0] = 0
else:
    if 0 in jouken:
        if jouken[0] == 0:
            is_empty = True
        else:
            num[0] = jouken[0]
    else:
        num[0] = 1
    for i in range(1,n):
        if i in jouken:
            num[i] = jouken[i]
        else:
            num[i] = 0

num = [str(i) for i in num]

if is_empty:
    print(-1)
else:
    print(''.join(num))

Measured memory_bytes: 3064
n, d = map(int, input().split())

ans = 0
zahyou = []
for i in range(n):
    zahyou.append(list(map(int, input().split())))
for i in range(n):
    sum = 0
    temp0 = zahyou[i]
    for j in range(n):
        if i <=  j:
            break
        temp1 = zahyou[j]
        sum = 0
        for k in range(d):
            sum = sum + (temp0[k] - temp1[k])**2
        a =  sum**(1/2)
        if a.is_integer():
            ans += 1

print(ans)

Measured memory_bytes: 3188
main(a,b,c,p,q,r,s,i){for(;scanf("%d%d%d",&a,&b,&c),a;){
	if(!c){
		if(a==1&&b<0)printf("1 0 %d %d\n",a,b);
		else printf("%d %d 1 0\n",a,b);
		continue;
	}
	for(r=1;r*r<=a;r++)if(a%r==0)
		for(p=a/r,s=1;s<=abs(c);s++)if(c%s==0)
			for(i=0;i<2;i++,s=-s)if(q=c/s,p*s+q*r==b){
				if(p==r&&q<s)printf("%d %d %d %d\n",r,s,p,q);
				else printf("%d %d %d %d\n",p,q,r,s);
				goto next;
			}
	puts("Impossible");
next:;}exit(0);}

Measured memory_bytes: 612
#include <bits/stdc++.h>
#include<math.h>
#define rep(i,n) for (int i = 0; i < (n) ; ++i)
using namespace std;
using ll = long long ;
using P = pair<int, int> ;
#define PI 3.14159265358979323846264338327950
#define INF 1e18 

int main (){
    int V, E ;
    cin >> V >> E ;
    vector<vector<ll>> cost (V, vector<ll> (V)) ;
    rep(i, V){
        rep(j, V){
            if(i == j){
                cost[i][j] = 0;
            }
            else {
                cost[i][j] = INF ;
            }
        }
    }
    rep(i, E){
        ll s, t, d ;
        cin >> s >> t >> d ;
        cost[s][t] = d ;
    }
    rep(k, V){
        rep(i, V){
            rep(j, V){
                cost[i][j] = min (cost[i][j], cost[i][k] + cost[k][j]) ;
            }
        }
    }
    bool neg = false ;
    rep(i, V){
        if(cost[i][i] < 0){
            neg = true ;
        }
    }
    if(neg){
        cout << "NEGATIVE CYCLE" << endl ;
    }
    else {
        rep(i, V){
            rep(j, V){
                if(j) cout << " " ;
                if(cost[i][j] > 1000000000000){
                    cout << "INF" ;
                }
                else {
                    cout << cost[i][j] ;
                }
            }
            cout << endl ;

        }
    }
}


Measured memory_bytes: 3244
#include<iostream>
using namespace std;
int main(){
    string s , t;
    cin >> s >> t;
    
    int ans = 0;
    for( int i = 0 ; i< s.size() ; i++){
        if(s[i] != t[i] ){
            ans++;
        }
    }
    
    cout<<ans;
}

Measured memory_bytes: 3828
# ABC129D - Lamp
import sys
input = sys.stdin.readline

def check_light(A):
    X, Y = [[0] * W for _ in range(H)], [[0] * W for _ in range(H)]
    for i in range(H):
        for j in range(W):
            if A[i][j] == "#":
                X[i][j] == 0
                Y[i][j] == 0
            else:
                if i == 0:
                    X[i][j] = 1
                else:
                    X[i][j] = X[i - 1][j] + 1
                if j == 0:
                    Y[i][j] = 1
                else:
                    Y[i][j] = Y[i][j - 1] + 1
    return X, Y

def main():
    global H, W
    H, W = tuple(map(int, input().split()))
    S = tuple(input().rstrip() for _ in range(H))
    RS = [s[::-1] for s in S[::-1]]  # reversed S
    U, L = check_light(S)
    D, R = check_light(RS)
    D, R = [d[::-1] for d in D[::-1]], [r[::-1] for r in R[::-1]]
    ans = max(
        L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3 for i in range(H) for j in range(W)
    )
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 253960
// Template Headers {{{
#include <bits/stdc++.h>
using namespace std;

using pii = pair<int, int>; using vpii = vector<pii>;
using vi = vector<int>; using vvi = vector<vi>;
using ll = long long;
using pll = pair<ll, ll>; using vpll = vector<pll>;
using vll = vector<long long>; using vvll = vector<vll>;
template <class T> using min_queue = priority_queue<T, vector<T>, greater<T>>;
template <class T> istream &operator>>(istream &, vector<T> &);
template <class T> ostream &operator<<(ostream &, const vector<T> &);
template <class T, class U> istream &operator>>(istream &, pair<T, U> &);
template <class T, class U> ostream &operator<<(ostream &, const pair<T, U> &);
template <class T> struct Inf { static constexpr T inf() { return std::numeric_limits<T>::has_infinity ? std::numeric_limits<T>::infinity() : std::numeric_limits<T>::max(); } };
template <> struct Inf<int> { static constexpr int inf() { return 0x3f3f3f3f; } };
template <> struct Inf<long long> { static constexpr long long inf() { return 0x3f3f3f3f3f3f3f3fLL; } };
constexpr int INF = Inf<int>::inf(); constexpr ll BINF = Inf<ll>::inf();
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// }}}
// Preprocessing & "Global" variables {{{
struct Solver {
	Solver() {}
	int solve();
};
// }}}


int Solver::solve() {
	int n, m; cin >> n >> m;
	if (n > m) swap(n, m);
	if (n == 1 && m == 1) {
		cout << 1 << endl;
	} else if (n == 1) {
		cout << m - 2 << endl;
	} else {
		cout << 1LL * (n - 2) * (m - 2) << endl;
	}
	return 0;
}

// Template Main {{{
int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	Solver solver;
	#ifdef JUDGE_MULTI_CASE
		int t; cin >> t; for (int i = 1; i <= t; i++)
	#endif
	solver.solve();
	// cout << "Case #" << i << ": ", solver.solve();
	return 0;
}

template <class T> istream &operator>>(istream &is, vector<T> &v) {
	for (auto it=v.begin();it!=v.end();++it) is >> *it;
	return is;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
	for (auto it=v.begin();it!=v.end();) os << *it, os << " \n"[++it==v.end()];
	return os;
}

template <class T, class U> istream &operator>>(istream &is, pair<T, U> &p) {
	return is >> p.first >> p.second;
}

template <class T, class U> ostream &operator<<(ostream &os, const pair<T, U> &p) {
	return os << p.first << ' ' << p.second;
}
// }}}

// vim: fdm=marker


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

int main(){
    long long int K,N;
    cin >> N >> K;
    long long int p[N];
    for (int i=0;i<N;i++){
        cin >> p[i];
    }
    sort(p,p+N);
    long long int sum=0;
    for(int i=0;i<K;i++){
        sum += p[i];
    }
    cout << sum;
}


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

using namespace std;

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

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

int gcd(int a, int b) {
    if (b == 0) {
        return a;
    } else {
        return gcd(b, a % b);
    }
}

int lcm(int a, int b) {
    return a * b / gcd(a, b);
}

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int k, s;  cin >> k >> s;
    int cnt = 0;
    rep (i, k + 1) {
      rep (j, k + 1) {
        int z = s - i - j;
        if (z >= 0 && z <= k) cnt++;
      }
    }
    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let v = read_vec::<usize>();
    let (n, m) = (v[0], v[1]);
    let mut uft = UnionFindTree::new(n);
    for i in 0..m {
        let v = read_vec::<usize>();
        let (a, b) = (v[0] - 1, v[1] - 1);
        uft.unite(a, b);
    }

    let ans = (0..n).map(|x| uft.get_size(x)).max().unwrap();
    println!("{}", ans);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

#[derive(Debug, Clone)]
struct UnionFindTree {
    parent: Vec<isize>,
    size: Vec<usize>,
    height: Vec<u64>,
}

impl UnionFindTree {
    fn new(n: usize) -> UnionFindTree {
        UnionFindTree {
            parent: vec![-1; n],
            size: vec![1usize; n],
            height: vec![0u64; n],
        }
    }

    fn find(&mut self, index: usize) -> usize {
        if self.parent[index] == -1 {
            return index;
        }
        let idx = self.parent[index] as usize;
        let ret = self.find(idx);
        self.parent[index] = ret as isize;
        ret
    }

    fn same(&mut self, x: usize, y: usize) -> bool {
        self.find(x) == self.find(y)
    }

    fn get_size(&mut self, x: usize) -> usize {
        let idx = self.find(x);
        self.size[idx]
    }

    fn unite(&mut self, index0: usize, index1: usize) -> bool {
        let a = self.find(index0);
        let b = self.find(index1);
        if a == b {
            false
        } else {
            if self.height[a] > self.height[b] {
                self.parent[b] = a as isize;
                self.size[a] += self.size[b];
            } else if self.height[a] < self.height[b] {
                self.parent[a] = b as isize;
                self.size[b] += self.size[a];
            } else {
                self.parent[b] = a as isize;
                self.size[a] += self.size[b];
                self.height[a] += 1;
            }
            true
        }
    }
}


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

using namespace std;

void rwFile() {
    freopen("INP.inp", "r", stdin);
    freopen("OUT.out", "w", stdout);
}

void solveA() {
    long long n, a, b;
    cin >> n >> a >> b;
    if (a % 2 == b % 2) cout << abs(a - b) / 2;
    else {
        if (max(a, b) - 1 < n - min(a, b)) {
            long long res = min(a, b);
            res += (abs(a - b) - 1) / 2;
            cout << res;
        }
        else {
            long long res = n - max(a, b) + 1;
            res += (abs(a - b) - 1) / 2;
            cout << res;
        }
    }
}

int main()
{
    //rwFile();
    solveA();
}


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

using namespace std;

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

	int count = 0;
	for (int i = 0; i < N.length(); i++) {
		if (N[i] == '2') {
			count++;
		}
	}

	cout << count << endl;
	
	
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()
ll d1[4] = {1, -1, 0, 0};
ll d2[4] = {0, 0, 1, -1};

int main(){
    string s, t;
    cin >> s >> t;
    ll ns = s.size();
    ll nt = t.size();
    ll ans = 1e18;
    rep(i, 0, ns) {
        ll tmp = 0;
        if(i + nt - 1 >= ns) break;
        rep(j, 0, nt) {
            if(s[i+j] != t[j]) tmp++;
        }
        ans = min(ans, tmp);
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
	int R, G, B, N;

	cin >> R >> G >> B >> N;

	int ans = 0;
	for( int r = 0; r <= N; r++ ) {
		for( int g = 0; g <= N; g++ ) {
			int b = N - R * r - G * g;
			if( b >= 0 && b % B == 0 ) {
				ans++;
			}
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
#define LL long long
#define pii pair<LL,LL>
using namespace std;

pii ans[300005];
int k,x,y,cnt;

pii calc(int x,int y)
{
	if(x>y) {
		pii t=calc(y,x);
		return {t.se,t.fi};
	}
	if(x<0) {
		pii t=calc(-x,y);
		return {-t.fi,t.se};
	}
	if(x+y>=2*k) {
		return {x,y-k};
	}
	if(x+y==k) return (pii) {0,0};
	return {-k+(x+y)/2,x+y-(x+y)/2};
}

int main()
{
	cin>>k>>x>>y;
	if(!(k&1)&&(x+y)&1) {
		puts("-1");
		return 0;
	}
	ans[0]={x,y};
	for(;ans[cnt].fi||ans[cnt].se;cnt++) ans[cnt+1]=calc(ans[cnt].fi,ans[cnt].se);
	cout<<cnt<<endl;
	for(;cnt--;) cout<<ans[cnt].fi<<" "<<ans[cnt].se<<endl;
}

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

using namespace std;

typedef long long ll;
const ll N = 1e5;

int a, b;
int k;

void doit (int &a, int &b)
{
    if (a&1)
    {
        a--;
    }

    a >>= 1;
    b += a;
}

int main()
{
    std::ios::sync_with_stdio(false);
    while ( cin >> a >> b >> k )
    {
        bool flaga = true;
        while (k)
        {
            k--;
            if (flaga)
            {
                doit(a, b);
            }
            else
            {
                doit(b, a);
            }
            flaga = !flaga;
            //cout << a << " " << b << endl;
        }

        cout << a << " " << b << endl;
    }




    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    for (int i = 0; i < (1 << S.length() - 1); i++) {
      int total = 0;
      StringBuilder A = new StringBuilder();
      A.append(S.charAt(0));
      for (int j = 0; j < S.length() - 1; j++) {
        if ((1 & (i >> j)) == 1) {
          int X = Character.getNumericValue(S.charAt(j + 1));
          total += X;
          A.append("+");
        } else {
          int X = Character.getNumericValue(S.charAt(j + 1));
          total -= X;
          A.append("-");
        }
        A.append(S.charAt(j + 1));
      }
      // System.out.println(A);
      int Y = Character.getNumericValue(S.charAt(0));
      //System.out.println(total + Y);
      if (total + Y == 7) {
        System.out.println(A + "=7");
        break;
      }
    }
  }
}


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

int main(){   
   int n,ans=0;
   cin >> n;
   vector<int> a(2*n);
   for(int i=0;i<2*n;i++){
       cin >> a.at(i);
   }
   sort(a.begin(),a.end());
   for(int i=0;i<2*n;i++){
       if(i%2==0){
           ans+=a.at(i);
       }
   }
   cout << ans <<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
//	int a,b,c,d,e,limit;
//	int i,j,k,l,total;
//	double temp=-1;
//	int temptt=0;
//	int tempyy=0;

	int N;
	int M;
	int K;	
//	string str;
	int i,j;
//	cin>>a>>b>>c>>d>>e>>limit;

    int flag=0;
	while(cin>>N>>M>>K){
		
		for(i=0;i<=N;i++){
				for(j=0;j<=M;j++)
				{
					if(i*M+j*N-2*i*j==K){
						flag=1;		
					}
				}
		}
		
		if(flag)
			cout<<"Yes"<<endl;
		else
			cout<<"No"<<endl;
			
		flag=0;
	}

	return 0;
	}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int c,f;
int main()
{
	string s;
	cin>>s;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]=='C')
		{
			for(int j=i;j<=s.size();j++)
			{
				if(s[j]=='F')
				{
					cout<<"Yes"<<"\n";
					return 0;
				}
			}
		}
	}
	cout<<"No"<<"\n";
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int a,b,c,k;
    int i;
    int co = 0;
    scanf("%d", &a);
    scanf("%d", &b);
    scanf("%d", &c);
    scanf("%d", &k);
    for(i = k;i > 0;i --){
        if(a > 0){
            co ++;
            a --;
        }else if(b > 0){
            b --;
        }else{
            co --;
            c --;
        }
    }
    printf("%d\n", co);
    return 0;
}

Measured memory_bytes: 1724
def main():
    n = int(input())
    array = [int(x) for x in input().split()]

    count = 0
    for i in range(1,n-1):
        if (array[i-1]<array[i] and array[i]<array[i+1]) or (array[i-1]>array[i] and array[i]>array[i+1]):
            count += 1
    print(count)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
    int n;
    cin >> n;
    vector<int> va(n),vl(n+1),vr(n+1);
    vl[0] = 0;
    for (int i=0; i<n; i++) {
        cin >> va[i];
        vl[i+1] = max(vl[i],va[i]);
    }
    vr[n] = 0;
    for(int i=n-1; i>=0; i--) {
        vr[i] = max(vr[i+1],va[i]);
    }
    for (int i=0; i<n; i++) cout << max(vl[i],vr[i+1]) << "\n";
}

Measured memory_bytes: 3968
#include<cstring>
#include<cstdio>
#include<iostream>
#include<queue>
#include<vector>
#include<map>
#include<algorithm>
#include<cmath>
using namespace std;
typedef long long ll;
const double PI=acos(-1.0);
const double eps=1e-6;
const int inf=2147483647;
const int maxn=10000;
const int mod=1e9+7;
ll n,p;
ll yin[5000005],ge[50000005],cnt;
inline void init(){
	for(ll i=2;i*i<=p;i++){
		if(p%i==0){
			yin[++cnt]=i;
		}
		while(p%i==0){
			ge[cnt]++;
			p/=i;
		}
	}
	if(p!=1) yin[++cnt]=p,ge[cnt]++;
}

int main() {
    scanf("%lld%lld",&n,&p);
    init();
//    for(int i=1;i<=cnt;i++){
//    	printf("yin%lld:%lld ci:%lld\n",i,yin[i],ge[i]);
//	}
    ll ans=1;
    for(ll i=1;i<=cnt;i++){
    	if(ge[i]>=n){
    		for(ll j=1;j<=ge[i]/n;j++)
				ans*=yin[i];
		}
	}
	printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 2304
import sys
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()

N,P = map(int,S().split())
S = LI2()

if P == 2 or P == 5:  #10と素でない場合一番右の桁で決まる
    ans = 0
    for i in range(N):
        if S[i] % P == 0:
            ans += i+1
    print(ans)
    exit()

A = [0]  #A[i] = 下i桁をPで割った余り
for i in range(1,N+1):
    A.append((A[i-1]+pow(10,i,P)*S[N-i]) % P)

from collections import Counter

c = Counter(A)
B = c.values()

ans = 0

for i in B:
    ans += (i*(i-1)//2)

print(ans)

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

int main()
{
    int n, d[51], i, j, s=0;
    cin>>n;
    for(i=1; i<=n; i++)
        cin>>d[i];
    for(i=1; i<n; i++)
        for(j=i+1; j<=n; j++)
            s+=d[i]*d[j];
    cout<<s;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define endl "\n"
using namespace std;

int main()
{
  int n;
  cin>>n;
  int ans=0;
  while(n)
  {
    if(n>=500)
    {
      n-=500;
      ans+=1000;
    }
    else if(n>=5)
    {
      n-=5;
      ans+=5;
    }
    else
      break;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std;
int n,a,b;
long long a1[10001002],y[10000010],num;
int main()
{
	scanf("%d%d%d",&n,&a,&b);
	for(int i=1;i<=n;i++)
		{
		cin>>a1[i];
		a1[0]=0;
		}
	for(int i=1;i<=n-1;i++)
		y[i]=a1[i+1]-a1[i];
	for(int i=1;i<=n-1;i++)
	{
		if(y[i]*a>b)
		num+=b;
		else num+=y[i]*a;
	}
	cout<<num;
	return 0;
}

Measured memory_bytes: 3072
#include <iomanip>
#include <string>
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;
int main()
{
	string s;
	cin >> s;
	if (s[0] == s[1]&&s[1] == s[2] || s[3] == s[1] &&s[1]== s[2]) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}	

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


int main()
{
	int n;
	cin >> n;
	for (int i = 1; i <= 9; i++) {
		if (n%i==0&&n/i<=9) {
			cout << "Yes\n"; break;
		}
		if (i == 9)
			cout << "No\n";
	}
	return 0;
}

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

int main(){
  int N;
  cin >> N;
  vector<int> a(N);
  for(int i=0;i<N;i++){
    cin >> a.at(i);
  }
  int min=0;
  int max=0;
  set<int> s;
  int x=0;
  for(int i=0;i<N;i++){
    int count=0;
    if(a.at(i)>=3200){
      x++;
      continue;
    }
    count=a.at(i)/400;
    s.insert(count);
  }
  if(s.size()>0){
      min=s.size();
      max=min+x;
  }else{
    min=1;
    max=x;
  }

  cout << min << " " << max << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int N,M;
  	cin >> N >> M;
  	int num[M][2];
  	for(int i=0;i<M;i++){
      for(int j=0;j<2;j++){
        cin >> num[i][j];
      }
    }
  for(int k=1;k<N+1;k++){
    int count=0;
    for(int i=0;i<M;i++){
      for(int j=0;j<2;j++){
		if(num[i][j] == k){
          count++;
        }
      }
    }
    cout << count << endl;
  }
}
  

Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>


using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define loop(n) FOR(i,0,n)
#define rrep(i,a,b) for(int i=(a);i>=(b);--i)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int n, m;
vector<vector<int>> e;
vector<int> v;
int main() {
	
	cin >> n >> m;
	e.resize(n);
	for (int i = 0; i < n; i++) {
		e[i].resize(n);
	}

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			e[i][j] = -1;
		}
	}

	for (int i = 0; i < m; i++) {
		int a, b; cin >> a >> b;
		a--; b--;

		e[a][b] = 1;
		e[b][a] = 1;
		
	}

	v.resize(n);
	for (int i = 0; i < n; i++) {
		v[i] = i;
	}
	
	int ans = 0;
	do {
		if (v[0] != 0)continue;
		for (int i = 0; i < n - 1; i++) {
			if (e[v[i]][v[i + 1]] == -1)break;
			if (i == n - 2)ans++;
		}
	} while (next_permutation(v.begin(), v.end()));

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

template<typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
    os << "{ ";
    REP(i, vec.size()) {
        os << vec[i] << " ";
    }
    os << "}";

    return os;
}

ll pow_mod(ll a, ll p) {
    ll res = 1;
    while(p) {
        if (p & 1) res = (res * a) % MOD;
        a = (a * a) % MOD;
        p >>= 1;
    }

    return res;
}


ll mod_inv(ll a, ll m) {
    ll b = m, u = 0, v = 1;
    while(a) {
        ll t = b / a;
        swap(b -= t * a, a);
        swap(u -= t * v, v);
    }

    return (u % m + m) % m;
}

ll gcd(ll a, ll b) {
    if(b == 0) return a;
    return gcd(b, a%b);
}

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}


#ifdef LOCAL
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif


int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    
    string S;
    cin >> S;

    S.erase(S.begin()+4);
    S.erase(S.begin()+6);

    int s = stoi(S);

    if (s > 20190430) {
        cout << "TBD" << endl;
    } else {
        cout << "Heisei" << endl;
    }

    cout << fixed << setprecision(20);

}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(100000)
input = sys.stdin.readline

N, M = map(int, input().split())
X = []
for _ in range(M):
    a, b = map(int, input().split())
    X.append((a-1, b-1))
X = X[::-1]
    
P = [-1] * N
CT = [1] * N
def pr(i):
    if P[i] < 0:
        return i
    t = pr(P[i])
    P[i] = t
    return t

ANS = [0] * M
ans = N * (N-1) // 2
ANS[-1] = ans
for m in range(M-1):
    a, b = X[m]
    pa = pr(a)
    pb = pr(b)
    
    if pa != pb:
        ans -= CT[pa] * CT[pb]
        P[pa] = pb
        CT[pb] += CT[pa]

    ANS[-m-2] = ans

for a in ANS:
    print(a)


Measured memory_bytes: 35816
def main(n, l):
    h = list(map(int, l.split(' ')))
    counter = 0
    max_h = 0
    for i in range(n):
        if max_h <= h[i]:
            counter += 1
            max_h = h[i]
    print(counter)
    
if __name__ == '__main__':
    try:
        n = int(input().strip())
        l = input().strip()
        main(n, l)
    except EOFError:
        pass


Measured memory_bytes: 2940
#include<iostream>
#include<stdio.h>
#include<string>
#include<algorithm>
#include<array>
using namespace std;

int main() {
        int n;
        long long ll;
        cin >> n;
        int march[20];
        for (int i = 0; i < 20; i++) {
                march[i] = 0;
        }
        for (int i = 0; i < n; i++) {
                string s;
                cin >> s;
                if(s[0] == 'M')march[0]++;
                else if(s[0] == 'A')march[1]++;
                else if(s[0] == 'R')march[2]++;
                else if(s[0] == 'C')march[3]++;
                else if(s[0] == 'H')march[4]++;
        }

        long long ans = 0;
        for (int i = 0; i < 3; i++) {
                for (int j = i + 1; j < 4; j++) {
                        for (int k = j + 1; k < 5; k++) {
                                ans += march[i]*march[j]*march[k];
                        }
                }
        }

        cout << ans << endl;

        return 0;
}


Measured memory_bytes: 888
w=input()
if len(w)%2 != 0:
    print("No")
    exit()
alp=[]
c='a'
while ord(c) <= ord('z'):
    alp.append(0)
    c=chr(ord(c)+1)
for s in w:
    alp[ord(s)-ord('a')]+=1
c='a'
while ord(c) <= ord('z'):
    if alp[ord(c)-ord('a')]%2 != 0:
        print("No")
        exit()
    c=chr(ord(c)+1)
print("Yes")


Measured memory_bytes: 3188
import java.util.*;
import java.io.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();
        long x = sc.nextLong();
        if(a == 0){
            System.out.println(b/x+1);
        }else{
            System.out.println(b/x - (a-1)/x);
        }
        
    }
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public double nextDouble() {
         return Double.parseDouble(next());
    }
    
    public String[] nextArray(int n) {
        String[] a = new String[n];
        for (int i = 0; i < n; i++)
            a[i] = next();
        return a;
    }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    } 
}


Measured memory_bytes: 25368
num = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K = int(input())
print(num[K-1])

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

int main(){
    int H, W, N;
    cin >> H >> W >> N;
    vector<int> v;
    for(int i = 1; i <= N; ++i){
        int a; cin >> a;
        for(int j = 0; j < a; ++j) v.push_back(i);
    }
    for(int i = 0; i < H; ++i){
        for(int j = 0; j < W; ++j){
            if(i % 2 == 0) cout << v[i*W+j];
            else cout << v[i*W+W-j-1];
            cout << " ";
        }
        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 888
//RAVAN_2070
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fo(i,a,b) for(i=a;i<b;i++)
#define pb push_back
#define mp make_pair
void solve()
{
    int h,w,m,i,r,c;cin>>h>>w>>m;
    vector<int>R(h,0),C(w,0);
    map<pair<int,int>,int>M;
    fo(i,0,m)
    {
        cin>>r>>c;
        r--;c--;
        M[mp(r,c)]++;
        R[r]++;C[c]++;
    }
    int mxr,mxc;mxr=mxc=-1;
    fo(i,0,h)mxr=max(mxr,R[i]);
    fo(i,0,w)mxc=max(mxc,C[i]);

    vector<int>row,col;
    fo(i,0,h)if(R[i]==mxr)row.pb(i);
    fo(i,0,w)if(C[i]==mxc)col.pb(i);

    int ans=0;
    for(auto itr:row)
    {
        int f;
        for(auto itc:col)
        {
            f=1;
            int cnt=R[itr]+C[itc];
            if(M[mp(itr,itc)])f=0,cnt--;
            ans=max(ans,cnt);
            if(f==1)break;

        }
        if(f==1)break;
    }
    cout<<ans<<"\n";
    
}
int main()
{
    fastio
    solve();
    return 0;
}


Measured memory_bytes: 28500
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <deque>

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

using namespace std;

int main()
{

	int a, b, c;
	cin >> a >> b >> c;

	cout << a * b / 2 << endl;

	return 0;
}

Measured memory_bytes: 256
###==================================================
### import
#import bisect
#from collections import Counter, deque, defaultdict
#from copy import deepcopy
#from functools import reduce, lru_cache
#from heapq import heappush, heappop
#import itertools
#import math
#import string
import sys
### stdin
def input(): return sys.stdin.readline()
def iIn(): return int(input())
def iInM(): return map(int, input().split())
def iInM1(): return map(int1, input().split())
def iInLH(): return list(map(int, input().split()))
def iInLH1(): return list(map(int1, input().split()))
def iInLV(n): return [iIn() for _ in range(n)]
def iInLV1(n): return [iIn()-1 for _ in range(n)]
def iInLD(n): return [iInLH() for _ in range(n)]
def iInLD1(n): return [iInLH1() for _ in range(n)]
def sInLH(): return list(input().split())
def sInLV(n): return [input().rstrip('\n') for _ in range(n)]
def sInLD(n): return [sInLH() for _ in range(n)]
### stdout
def OutH(lst, deli=' '): print(deli.join(map(str, lst)))
def OutV(lst): print('\n'.join(map(str, lst)))
### setting
sys.setrecursionlimit(10 ** 6)
### utils
int1 = lambda x: int(x) - 1
### constants
INF = int(1e9)
MOD = 1000000007
dx = (-1, 0, 1, 0)
dy = (0, -1, 0, 1)
###---------------------------------------------------

N = iIn()
A = iInLH()

A.sort(reverse=True)

ans = 0
for i in range(N):
    if i % 2 == 0:
        ans += A[i]
    else:
        ans -= A[i]

print(ans)

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

const int MAX = 100005;
int A[MAX];

int main() {
    int N;
    scanf("%d", &N);
    for (int i = 0; i < N; i++) scanf("%d", &A[i]);

    int ans = 0;
    for (int i = 0; i < N; i++) {
        if (A[i] == i+1) {
            ans++;
            i++;
        }
    }

    printf("%d\n", ans);
    return 0;
}

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

typedef long long ll;

const int mod = 1000000007;
const int INF = 101234567;

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

    ll a = 2;
    ll b = 3;

    for (ll h = 1; h <= 3500; h++) {
        for (ll n = 1; n <= 3500; n++) {
            ll v1, v2;
            v1 = N*h*n;
            v2 = 4*h*n - N*n - h*N;
            if (v1 > 0 && v2 > 0 && v1%v2 == 0) {
                ll w = v1/v2;
                cout << h << " " << n << " " << w << endl;
                return 0;
            }
        }
    }
}


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

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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int n,a; cin>>n;
	set<int> st;
	while(n-->0) {
		cin>>a;
		if(st.count(a)) st.erase(a);
		else st.insert(a);
	}
	cout<<st.size()<<"\n";
	return 0;
}

Measured memory_bytes: 4992
# coding: utf-8
N = int(input())
A = list(map(int, input().split()))
d = {}
for a in A:
    if a not in d.keys():
        d[a] = 1
    else:
        d[a] += 1
total = 0
for k in d.keys():
    total += (d[k] * (d[k]-1)) // 2
# print(total)
for i in range(N):
    v = total
    t = A[i]
    v -= ((d[t]) * (d[t]-1)) // 2
    v += ((d[t]-1) * (d[t]-2)) // 2
    print(v)

Measured memory_bytes: 25716
x = int(input())
key = x // 100
if key == 4 or key == 5:
    print(8)
elif key == 6 or key == 7:
    print(7)
elif key == 8 or key == 9:
    print(6)
elif key == 10 or key == 11:
    print(5)
elif key == 12 or key == 13:
    print(4)
elif key == 14 or key == 15:
    print(3)
elif key == 16 or key == 17:
    print(2)
else:
    print(1)

Measured memory_bytes: 61812
{-# LANGUAGE PartialTypeSignatures #-}
module Main (main) where

import Control.Monad
import qualified Data.ByteString.Char8 as C8
import qualified Data.Char as C
import qualified Data.List as L
import qualified Data.Set as Set

main :: IO ()
main = do
  [n,k] <- readInts
  replicateM k (readInts >> readInts) >>= output . solve n . concat

solve :: Int -> [Int] -> _
-- solve n = Set.size . (xs Set.\\) . Set.fromList
solve n as = n - (Set.size . Set.fromList $ as)
  where
    xs = Set.fromList [1..n]

output :: _ -> IO ()
output = print

-- utils
readInts :: IO [Int]
readInts = L.unfoldr (C8.readInt . C8.dropWhile C.isSpace) <$> C8.getLine


Measured memory_bytes: 4816
package main

import (
	"fmt"
)

func main() {

	var S, T string
	fmt.Scanf("%s", &S)
	fmt.Scanf("%s", &T)

	if S[0:len(S)] == T[0:len(S)] {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 1832
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll n,i,j,k,sum=0,arr[10]={0},p;
    cin>>n;
    string s;
    while(n--)
    {
        cin>>s;
        if(s[0]=='M')arr[1]++;
        if(s[0]=='A')arr[2]++;
        if(s[0]=='R')arr[3]++;
        if(s[0]=='C')arr[4]++;
        if(s[0]=='H')arr[5]++;
    }
    sum=0;
    for(i=1;i<=5;i++)
    {
        for(j=i+1;j<=5;j++)
        {
            for(k=j+1;k<=5;k++)
            {
                p=arr[i]*arr[j]*arr[k];//cout<<p<<endl;
                sum+=p;
            }
        }
    }
    cout<<sum<<endl;
    return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cmath>
#define pb push_back
#define ld long double
#define mp make_pair
#define vl vector<ll> 
#define vd vector<double>
#define vld vector<long double>
#define ll long long int
#define pl pair<ll, ll>
#define all(a) a.begin(), a.end()
#define forr(i, n) for(ll i=0; i<n; i++) 
#define forr1(i, n) for(ll i=1; i<=n; i++)
using namespace std;
const ld PI =3.1415926535897923846;
const ll MOD = 1000000007;
const ll N=998244353;
ll power(ll x,ll n){ll res=1;while(n>0){if(n&1) res=res*x%MOD;x=x*x%MOD;n>>=1;}return res;}
ll modinverse(ll a){return power(a, MOD-2);}
void solve()
{
    ll n;
    cin>>n;
    vl a(n);
    forr(i, n)
    {
    	cin>>a[i];
    }
    ll sum=0;
    for(ll i=1; i<n; i++)
    {
    	if(a[i]<a[i-1])
    	{
    		sum+=(a[i-1]-a[i]);
    		a[i]=a[i-1];
    	}
    }
    cout<<sum<<endl;
}
int main()
{
	#ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll test=1;
    //cin>>test;
    while(test--)
    {
        solve();
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

Measured memory_bytes: 4744
IDENTIFICATION DIVISION.
      PROGRAM-ID. 062A.
      DATA DIVISION.
      WORKING-STORAGE SECTION.
      01 INP PIC X(100).
      01 A   PIC X(2).
      01 B   PIC X(2).
      01 CLASSA PIC X(1).
      01 CLASSB PIC X(1).
      
      PROCEDURE DIVISION.
      
      ACCEPT INP.
      UNSTRING INP DELIMITED BY " "
      INTO A B.
      
      EVALUATE A
      WHEN 1
      WHEN 3
      WHEN 5
      WHEN 7
      WHEN 8
      WHEN 10
      WHEN 12
      	MOVE 1 TO CLASSA
      WHEN 4
      WHEN 6
      WHEN 9
      WHEN 11
      	MOVE 2 TO CLASSA
      WHEN 2
      	MOVE 3 TO CLASSA
      END-EVALUATE.

      EVALUATE B
      WHEN 1
      WHEN 3
      WHEN 5
      WHEN 7
      WHEN 8
      WHEN 10
      WHEN 12
      	MOVE 1 TO CLASSB
      WHEN 4
      WHEN 6
      WHEN 9
      WHEN 11
      	MOVE 2 TO CLASSB
      WHEN 2
      	MOVE 3 TO CLASSB
      END-EVALUATE.
      
      IF CLASSA = CLASSB
      	 DISPLAY "Yes"
      ELSE
      	 DISPLAY "No"
      END-IF.
      
      STOP RUN.


Measured memory_bytes: 384
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<map>
#include<iostream>
#include<algorithm>
#define m(a,b) memset(a,b,sizeof(a));
using namespace std;
const int maxn = 1e3;
const int inf = 1<<30;
typedef long long LL;
LL n,m,k;
int main(){
	cin >> n >> m;
	if(n%m==0) {
		cout << "-1" << endl;
		return 0;
	}
	for(int i = 2;;i++){
		if(i*n>1e18) break;
		if(i*n%m!=0){
			cout << i*n << endl;
			return 0;
		}
	}
	cout << "-1" << endl;
	return 0;
}

Measured memory_bytes: 256
// 2014/01/28 Tazoe

#include <iostream>
#include <string>
using namespace std;

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

	string S;
	cin >> S;

	int DP[1000][8];

	DP[0][7] = DP[0][6] = DP[0][5] = DP[0][4] = 1;
	DP[0][3] = DP[0][2] = DP[0][1] = DP[0][0] = 0;
	if(S[0]=='J'){
		DP[0][3] = DP[0][2] = DP[0][1] = DP[0][0] = 0;
	}
	else if(S[0]=='O'){
		DP[0][5] = DP[0][4] = DP[0][1] = DP[0][0] = 0;
	}
	else{
		DP[0][6] = DP[0][4] = DP[0][2] = DP[0][0] = 0;
	}

	for(int i=1; i<N; i++){
		DP[i][7] = DP[i-1][7]+DP[i-1][6]+DP[i-1][5]+DP[i-1][4]+DP[i-1][3]+DP[i-1][2]+DP[i-1][1];
		DP[i][6] = DP[i-1][7]+DP[i-1][6]+DP[i-1][5]+DP[i-1][4]+DP[i-1][3]+DP[i-1][2];
		DP[i][5] = DP[i-1][7]+DP[i-1][6]+DP[i-1][5]+DP[i-1][4]+DP[i-1][3]+DP[i-1][1];
		DP[i][4] = DP[i-1][7]+DP[i-1][6]+DP[i-1][5]+DP[i-1][4];
		DP[i][3] = DP[i-1][7]+DP[i-1][6]+DP[i-1][5]+DP[i-1][3]+DP[i-1][2]+DP[i-1][1];
		DP[i][2] = DP[i-1][7]+DP[i-1][6]+DP[i-1][3]+DP[i-1][2];
		DP[i][1] = DP[i-1][7]+DP[i-1][5]+DP[i-1][3]+DP[i-1][1];
		DP[i][0] = 0;

		if(S[i]=='J'){
			DP[i][3] = DP[i][2] = DP[i][1] = DP[i][0] = 0;
		}
		else if(S[i]=='O'){
			DP[i][5] = DP[i][4] = DP[i][1] = DP[i][0] = 0;
		}
		else{
			DP[i][6] = DP[i][4] = DP[i][2] = DP[i][0] = 0;
		}

		for(int j=0; j<8; j++){
			DP[i][j] %= 10007;
		}
	}
/*
	for(int i=0; i<N; i++){
		for(int j=0; j<8; j++){
			cout << DP[i][j] << ' ';
		}
		cout << endl;
	}
*/
	int sum = 0;

	for(int j=0; j<8; j++){
		sum += DP[N-1][j];
	}

	cout << sum%10007 << endl;

	return 0;
}

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

int main(){
    int n;
    cin>>n;
    
    double ans = 0, x;
    string s;
    
    rep(i,n){
        cin>>x>>s;
        if(s=="BTC") x *= 380000;
        ans += x;
    }
    printf("%.10lf\n", ans);
    return 0;
}

Measured memory_bytes: 256