akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,s,f) for(int i=s;i<f;i++)
#define INF 1000000000000000000
#define MOD 1000000007
typedef pair<int, int> P;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
	if (p == 0) return 1;
	if (p % 2 == 0) {
		int t = mod_pow(n, p / 2, m);
		return (t * t) % m;
	}
	return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}
int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int digit(int x) {
	int cnt = 0;
	while (x > 0) {
		cnt += x % 10;
		x /= 10;
	}
	return cnt;
}
int read() {
	int tmp;
	cin >> tmp;
	return tmp;
}
int xor128() {
	static int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
	int t = (x xor (x << 11));
	x = y; y = z; z = w;
	return (w = (w xor (w >> 19)) xor (t xor (t >> 8)));
}
map<int, int> factaring(int x) {
	map<int, int>ans;
	int now = 2;
	while (now * now <= x) {
		if (x % now == 0) {
			x /= now;
			ans[now]++;
		}
		else now++;
	}
	if (x != 1) ans[x]++;
	return ans;
}
int comb(int n, int k) {
	k = min(k, n - k);
	int x = 1, y = 1;
	rep(i, k) {
		y *= i + 1;
		y %= MOD;
	}
	for (int i = n - k + 1; i <= n; i++) {
		x *= i;
		x %= MOD;
	}
	return x * modinv(y, MOD) % MOD;
}

signed main() {
	int a, b;
	cin >> a >> b;
	for (double i = 1; i < 100000; i++) {
		int c = floor(i * 0.08), d = floor(i * 0.1);
		if (a == c && b == d) {
			cout << i << endl;
			return 0;
		}
	}
	cout << -1 << endl;

	return 0;
}


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

int main(){
	int h,w;
	cin >> h >> w;
	vector<vector<char>> s(h, vector<char>(w));
	rep(i,h)rep(j,w) cin >> s[i][j];
	int counts = 0;
	rep(i,h)rep(j,w){
		if(s[i][j] == '.'){
			s[i][j] = '0';
			for(int x = -1; x <=1; x++){
				for(int y = -1; y <= 1; y++){
					int nx = i+x;
					int ny = j+y;
					if(nx >= 0 && nx < h && ny >= 0 && ny < w && s[nx][ny] == '#')	s[i][j]++;
				}
			}
		}
	}
	rep(i,h){
		rep(j,w){
			cout << s[i][j];
		}
		cout << endl;
	}
}

Measured memory_bytes: 3604
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <limits.h>
#include <cmath>
#include <queue>
#include <map>
#include <iomanip>
#include <random>
#include <fstream>
#include <cassert>
#define rep(i, n) for (int i = 0; i < n; i++)
#define PI 3.14159265358979323846
#define MOD 1000000007
#define vi vector<int>
using namespace std;
using ll = long long;

// ----ここから下は以前競プロをやっていた時に使っていたものです----　

const int MAX = 1000000;

ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++){
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

// 二項係数計算
long long COM(int n, int k){
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll gcd(ll a, ll b)
{
  ll r;
  while ((r = a % b))
  {
    a = b;
    b = r;
  }
  return b;
}

template <class T> struct cord{
  T x,y;
};

template <class T> double dist(cord<T> a, cord<T> b){
  T dx=a.x-b.x;
  T dy=a.y-b.y;
  return sqrt(dx*dx+dy*dy);
}

struct s{
  int p,i,r;
};

//比較関数（降順）
bool cmpP(const s &a, const s &b){
  return a.p > b.p;
}

//比較関数（昇順）
bool cmpI(const s &a, const s &b){
  return a.i < b.i;
}

// ----本問について----
// 問題：カントリーロード
// 問題文URL：https://onlinejudge.u-aizu.ac.jp/problems/2104
// 所要時間：
// 学んだこと：
// ------------------

// ----ここから本問のソースコード----

// グローバル変数（入力）
int t,n,k,x[100010];

int solve() {
  int answer=0;
  
  rep(i,n){
    cin >> x[i];
  }
  answer = x[n-1]-x[0]; // 総延長を計算
  vector<int> diff(n-1); // 家同士の差を格納する配列
  rep(i,n-1){
    diff[i]=x[i+1]-x[i]; // 差を計算
  }
  sort(begin(diff),end(diff));
  reverse(begin(diff),end(diff)); // 降順にソート
  rep(i,min(n-1,k-1)){ // 参照外にならないようにする
    answer -= diff[i]; // 大きい順からk-1個を減算
  }

  return answer;
}

int main()
{

  cin >> t;
  //cout << fixed << setprecision(10);
  rep(ii,t){
    cin >> n >> k;
    cout << solve() << endl;
  }


  return 0;
}



Measured memory_bytes: 3916
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
// using namespace boost::multiprecision;

// Define
using ll = long long;
using ull = unsigned long long;
using ld = long double;
// using int128 = __int128;
// using cint = cpp_int;
const ll MOD = 1e9 + 7;
const ll INF = LONG_MAX;
const ull MAX = ULONG_MAX;
#define endl '\n'
#define space ' '
#define def inline auto
#define func inline constexpr ll
#define run __attribute__((constructor)) def _
#define all(v) begin(v), end(v)

// Debug
#define debug(...)                                                             \
    {                                                                          \
        cerr << __LINE__ << ": " << #__VA_ARGS__ << " = ";                     \
        for (auto &&X : {__VA_ARGS__}) cerr << "[" << X << "] ";               \
        cerr << endl;                                                          \
    }

// Loop
#define inc(i, a, n) for (ll i = (a), _##i = (n); i <= _##i; ++i)
#define dec(i, a, n) for (ll i = (a), _##i = (n); i >= _##i; --i)
#define each(i, a) for (auto &&i : a)
#define rep(i, n) inc(i, 0, n - 1)

// Stream
#define input(a) scanf("%lld", &(a))
#define output(a) printf("%lld\n", (a))
#define fout(n) cout << fixed << setprecision(n)
#define fasten cin.tie(0), ios::sync_with_stdio(0)

// Speed
run() { fasten, fout(10); }
#pragma GCC optimize("O3")
#pragma GCC optimization_level 3
#pragma GCC target("avx")

// Math
func gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
func lcm(ll a, ll b) { return a * b / gcd(a, b); }

ll N, A[100000], B[100000], S, V;

signed main() {
    cin >> N;
    rep(i, N) cin >> A[i];
    sort(A, A + N);
    ll t = N / 2;
    rep(i, N - N / 2 - ((N & 1) && (N / 2) & 1)) {
        B[t - 1 + (N & 1)] = A[i];
        debug(t);
        if (i & 1)
            t -= (i + 1) * 2;
        else
            t += (i + 1) * 2;
    }
    t = N / 2 + 1;
    rep(i, N / 2 + ((N & 1) && (N / 2) & 1)) {
        B[t - 1 + (N & 1)] = A[N - 1 - i];
        debug(t);
        if (i & 1)
            t += (i + 1) * 2;
        else
            t -= (i + 1) * 2;
    }
    rep(i, N - 1) S += abs(B[i + 1] - B[i]);
    rep(i, N) debug(B[i]);

    t = N / 2;
    rep(i, N - N / 2 - ((N & 1) && (N / 2) & 1)) {
        B[t - 1 + (N & 1)] = A[N - 1 - i];
        debug(t);
        if (i & 1)
            t -= (i + 1) * 2;
        else
            t += (i + 1) * 2;
    }
    t = N / 2 + 1;
    rep(i, N / 2 + ((N & 1) && (N / 2) & 1)) {
        B[t - 1 + (N & 1)] = A[i];
        debug(t);
        if (i & 1)
            t += (i + 1) * 2;
        else
            t -= (i + 1) * 2;
    }
    rep(i, N - 1) V += abs(B[i + 1] - B[i]);
    rep(i, N) debug(B[i]);

    cout << max(S, V) << endl;
}

// for compilation: g++ -Ofast -march=native -o _ _.cpp -std=c++17


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

while True:
    n = int(input())
    data = [0] * 10
    if n == 0:
        break

    for _ in range(n):
        in_data = int(input())
        data[in_data] += 1

    for d in data:
        for _ in range(d):
            print("*", end="")

        if d == 0:
            print("-")
        else:
            print(end="\n")

Measured memory_bytes: 9472
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt(),w = sc.nextInt(),o = sc.nextInt();
		double sum = h * w * 0.5;
		System.out.println((int)sum);
	}
}

Measured memory_bytes: 23124
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;
use std::f64::consts::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        mut n: usize,
    }
    let mut sum_ = 0;
    let mut max_ = 0;
    for i in 1..n + 1 {
        sum_ += i;
        if sum_ >= n {
            max_ = i;
            break;
        }
    }
    for i in 1..max_ + 1 {
        if sum_ - i != n {
            println!("{}", i)
        }
    }
}


Measured memory_bytes: 4352
#include <iostream>
#include <queue>
#include <map>
#include <string>

using namespace std;

typedef pair <string,int> P;

int ans;
string str;

bool f(string s){
	for (int i=1; i<s.size(); i++) {
		if (s[0]!=s[i]) {
			return false;
		}
	}
	return true;
}

char c(char a,char b){
	if (a=='r'&&b=='g'||a=='g'&&b=='r') {
		return 'b';
	}
	else if (a=='r'&&b=='b'||a=='b'&&b=='r') {
		return 'g';
	}
	else {
		return 'r';
	}
}


bool bfs(){
	queue<P> que;
	map<string,int> mat;
	que.push(P(str,0));
	while (que.size()) {
		P p=que.front();
		que.pop();
		
		string s=p.first;
		int n=p.second+1;
		if (mat[s]) {
			continue;
		}
		
		if (f(s)) {
			ans=n-1;
			return true;
		}
		
		mat[s]=n;
		
		for (int i=0; i<s.size()-1; i++) {
			if (s[i]!=s[i+1]) {
				string t=s;
				char u=c(t[i],t[i+1]);
				t[i]=t[i+1]=u;
				que.push(P(t,n));
			}
		}
		
		
		
	}
	return false;
}

int main(){
	
	while (cin>>str&&str!="0") {
		if (bfs()) {
			cout << ans <<endl;
		}
		else {
			cout << "NA" <<endl;
		}
	}
	
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define IO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
int n,m;
int main() {
	IO
	cin>>n;
	for(int i=1;i<=9;++i)
        for(int j=1;j<=9;++j)
        {
            if(i*j==n)
            {
                cout<<"Yes"<<endl;
                return 0;
            }
        }

                cout<<"No"<<endl;
	return 0;
}


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

using namespace std;
int main()
{
	string a, b, c;
	cin >> a >> b >> c;
	cout << a[0] << b[0] << c[0] << endl;
	return 0;
}

Measured memory_bytes: 256
import sys

def warn(*m):
    print(m, file=sys.stderr)

D,*CS = map(int, open(0).read().split())
C = CS[:26]
S = [CS[26*i:26*(i+1)] for i in range(1, D+1)]

def imax(xs):
    m = -1
    i = 0
    for j, x in enumerate(xs):
        if x > m:
            i = j
            m = x
    return i

def ratio(xs):
    s = sum(xs)
    return [x / s for x in xs]

ds = [0] * 26

def pick(d):
    s = ratio(S[d])
    c = ratio([(1 + d - ds[i]) * x for i, x in enumerate(C)])
    return imax([x * y for x, y in zip(s, c)])

for d in range(D):
    i = pick(d)
    ds[i] = d + 1
    print(i + 1)

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

using namespace std;
#define mp make_pair
#define all(x) (x).begin(), (x).end()
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<vector<int>> vvi;
typedef vector<vector<long long>> vvl;
typedef pair<int,int> pii;
typedef long long ll;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    set<string> ans;
    for(int i=0;i<n;i++){
        string s;
        cin >> s;
        ans.insert(s);
    }
    cout << (ans.size()) << "\n";

    return 0;
}

Measured memory_bytes: 19272
def main ():
  N = int(input())
  A = list(map(int,input(). split ()))
  if 0 in A:
    print(0)
    return
  prod = 1
  for a in A:
    prod *= a
    if prod > 1000000000000000000:
      print(-1)
      return
  print(prod)
main ()

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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef double ld;
#define int ll
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<vvc> vvvc;
typedef pair<int, int> pii;
typedef pair<pii, pii> piii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector< vi > vvi;
typedef vector< vvi > vvvi;
typedef vector<short> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<ld> vld;
typedef vector<vld> vvld;
typedef vector<vvld> vvvld;
typedef vector<string> vst;
typedef vector<vst> vvst;
typedef pair<ld, ld> pld;

#define inmin(a, b) a = min(a, (b))
#define inmax(a, b) a = max(a, (b))
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define sqr(x) ((x) * (x))
#define fori(i, n) for(int i = 0; i < int(n); ++i)
#define SZ(a) ((int)((a).size()))
#define triple(T) tuple<T, T, T>
#define quad(T) tuple<T, T, T, T>
#define watch(x) cerr << (#x) << " = " << (x) << endl;

#ifdef RUS_HOME
#define cerr cout
#else
#define cerr if (false) cerr
#endif

const double PI = 2 * acos(0.0);
#define rand shittttty_shit
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng_64(chrono::steady_clock::now().time_since_epoch().count());

const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";


template <class T0, class T1>
inline ostream & operator << (ostream &out, pair<T0, T1> &a) {
    return out << "{" << a.first << ", " << a.second << "}";
}

template <class T0, class T1>
inline istream & operator >> (istream &in, pair<T0, T1> &a) {
    return in >> a.first >> a.second;
}

template <class T0, class T1, class T2>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << "}";
}

template <class T0, class T1, class T2, class T3>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2, T3> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << ", " <<  get<3>(a) << "}";
}

template<class T>
inline ostream & operator << (ostream &out, vector<T> &a) {
    out << "[";
    fori (i, a.size())
        out << a[i] << vector<string>{", ", "]  "}[i + 1 == a.size()];
    return out;
}


void smain();



signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
#ifdef RUS_HOME
    freopen("input", "r", stdin);
    clock_t start = clock();
#endif
    cout << setprecision(12) << fixed;
    smain();
#ifdef RUS_HOME
    cout << "\n\n\n\nTOTAL EXECUTION TIME: " << float( clock () - start ) /  CLOCKS_PER_SEC << endl;
#endif
    return 0;
}


void smain() {

    int n;
    cin>>n;
    vi p(n);

    vi a(n),b(n);
    for(int i=0;i<n;i++){
        cin>>p[i];
        p[i]--;
        a[p[i]]+=i;
    }

    for(int i=0;i<n;i++){
        a[i]+=i*n+1;
        b[n-i-1]+=i*n+1;
    }

    for(int i=0;i<n;i++){
        cout<<a[i]<<" ";
    }
    cout<<"\n";
    for(int i=0;i<n;i++){
        cout<<b[i]<<" ";
    }




}


Measured memory_bytes: 1152
#include <iostream>
#include <queue>

using namespace std;

typedef long long LL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)


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

  queue<LL> q;
  q.push(3); q.push(5); q.push(7);
  int count = 0;
  while (true) {
    LL p = q.front(); q.pop();
    if (p > N)
      break;
    q.push(p * 10 + 3); q.push(p * 10 + 5); q.push(p * 10 + 7);
    bool found3 = false, found5 = false, found7 = false;
    while (p > 0) {
      if (p % 10 == 3)
        found3 = true;
      if (p % 10 == 5)
        found5 = true;
      if (p % 10 == 7)
        found7 = true;
      p /= 10;
    }
    if (found3 && found5 && found7)
      ++count;
  }
  cout << count << endl;

  return 0;
}


Measured memory_bytes: 768
#include<iostream>
#include<math.h>
using namespace std;

int main(){
  int A,B,C,X,Y;
  int ans=0;
  int h,l;
  cin>>A>>B>>C>>X>>Y;
  int s=abs(X-Y);
  if(A+B>C*2){
    if(X>Y){
      ans+=Y*C*2;
      ans+=(A<(C*2))?A*s:C*2*s;
    }
    else{
      ans+=X*C*2;
      ans+=(B<(C*2))?B*s:C*2*s;
    }
  }
  else{
    ans+=X*A+Y*B;

  }
  cout<<ans;
  return 0;
}

Measured memory_bytes: 256
s = input()
n = len(s)
ans = 0
l = 0
ll = [0] * (n + 1)
r = 0
rl = [0] * (n + 1)
for i in range(n):
    if s[i] == '<':
        l += 1
        ll[i+1] = l
    else:
        l = 0
    if s[n-1-i] == '>':
        r += 1
        rl[n-i-1] = r
    else:
        r = 0
for i in range(n + 1):
    ans += max(rl[i], ll[i])
print(ans)

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

int main() {
  int N;
  cin >> N;
  double ans;
  if (N % 2 == 0) ans = (double)(N/2) / (double)(N);
  else ans = (double)(N/2 + 1) / (double)(N);
  cout << fixed << setprecision(10);
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <stack>
#include <iostream>
#include <cmath>
#include <string>
#include <cctype>
using namespace std;
typedef string::const_iterator State;
class ParseError{};
string str;
bool flag;

struct P{
	int a,b;
	P(){}
	P(int aa,int bb){
		a=aa;
		b=bb;
	}
	P operator + (P p){
		return P(a+p.a,b+p.b);
	}
	P operator - (P p){
		return P(a-p.a,b-p.b);
	}
	P operator * (P p){
		return P(a*p.a-b*p.b,a*p.b+b*p.a);
	}
	bool check(){
		if(abs(a)>10000 || abs(b)>10000)return true;
		return false;
	}
};

P number(State &begin);
P factor(State &begin);
P term(State &begin);
P expression(State &begin);

P number(State &begin){
	int ret=0;
	if(*begin=='i'){
		begin++;
		return P(0,1);
	}
	while(isdigit(*begin)){
		ret*=10;
		ret+=*begin-'0';
		begin++;
		if(ret>10000)flag=true;
	}
	return P(ret,0);
}

P factor(State &begin){
	if(*begin=='('){
		begin++;
		P ret=expression(begin);
		begin++;
		return ret;
	}else{
		return number(begin);
	}
}


P term(State &begin){
	P ret=factor(begin);
	while(1){
		if(*begin=='*'){
			begin++;
			ret=ret*factor(begin);
			if(ret.check())flag=true;
		}else{
			break;
		}
	}
	return ret;
}

P expression(State &begin){
	P ret=term(begin);
	while(1){
		if(*begin=='+'){
			begin++;
			ret=ret+term(begin);
			if(ret.check())flag=true;
		}else if(*begin=='-'){
			begin++;
			ret=ret-term(begin);
			if(ret.check())flag=true;
		}else{
			break;
		}
	}
	return ret;
}


int main(void){
	while(getline(cin,str)){
		State begin=str.begin();
		flag=false;
		P res=expression(begin);
		if(flag){
			cout << "overflow\n";
			continue;
		}
		if(res.b==0){
			cout << res.a << endl;
			continue;
		}
		if(res.a==0){
			cout << res.b << "i" << endl;
			continue;
		}
		if(res.b>0){
			cout << res.a << "+" << res.b << "i" << endl;
		}
		if(res.b<0){
			cout << res.a << res.b << "i" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1184
//def
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

//array
#include <vector>
#include <set>
#include <map>

using namespace std;

typedef pair<int,int> Paint;

bool Pairfirst(const Paint& pf,Paint&ps){//sortCompare
  return pf.first < ps.first;
}

#define anyfill(n,s) setw(n) << setfill(s)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define pb push_back
#define MAX 1000000000
#define MOD 1000000007
/*
最短手以外で出すメリット

*/
int main(){
  int h,w,n;cin>>h>>w>>n;
  int sr,sc;cin>>sr>>sc;
  string s,t;cin>>s>>t;
  int R = w-sc+1;
  int L = sc;
  int U = sr;
  int D = h-sr+1;
  for(int i = 0; s.size() > i; i++){
    if(s[i] == 'R'){
      R--;
      if(R == 0){
        cout << "NO" << endl;
        return 0;
      }
    }else if(s[i] == 'L'){
      L--;
      if(L == 0){
        cout << "NO" << endl;
        return 0;
      }
    }else if(s[i] == 'U'){
      U--;
      if(U == 0){
        cout << "NO" << endl;
        return 0;
      }
    }else if(s[i] == 'D'){
      D--;
      if(D == 0){
        cout << "NO" << endl;
        return 0;
      }
    }
    if(t[i] == 'L'){
      if(R!=w)R++;
    }
    if(t[i] == 'R'){
      if(L!=w)L++;
    }
    if(t[i] == 'D'){
      if(U!=h)U++;
    }
    if(t[i] == 'U'){
      if(D!=h)D++;
    }
  }
  cout << "YES" << endl;
  return 0;
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define MOD 1000000007

typedef long long int ll;

const ll INF=(ll)1e19;
//const int INF=(1<<30);


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

  cout << (1900*M+100*(N-M)) * (1<<M) << endl;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String a = sc.nextLine();
        String b = String.valueOf(a.length() -2);
        String c = String.valueOf(a.charAt(0));
        String d = String.valueOf(a.charAt(a.length()-1));
        System.out.println(c+b+d);
    }
}

Measured memory_bytes: 23764
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
template <class T> inline void chmin(T &a, const T& b) { if (b < a) a = b; }
template <class T> inline void chmax(T &a, const T& b) { if (b > a) a = b; }
/* clang-format on */

int main() {
#ifdef DEBUG
  ifstream ifs("in.txt");
  cin.rdbuf(ifs.rdbuf());
#endif
  int M;
  ll K;
  while (cin >> M >> K) {
    if (K >= (1 << M)) {
      cout << -1 << endl;
      continue;
    }
    if (M == 0) {
      cout << 0 << " " << 0 << endl;
    } else if (M == 1) {
      if (K == 0) {
        cout << 0 << " " << 0 << " " << 1 << " " << 1 << endl;
      } else {
        cout << -1 << endl;
      }
    } else {
      vector<int> a;
      for (int x = 0; x < (1 << M); x++) {
        if (x != K) a.push_back(x);
      }
      vector<int> res;
      res.insert(res.end(), a.begin(), a.end());
      res.push_back(K);
      res.insert(res.end(), a.rbegin(), a.rend());
      res.push_back(K);
      for (int x : res) cout << x << " ";
      cout << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 3440
#include "bits/stdc++.h"
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define INF 100000000
typedef long long ll;

using namespace std;


int main() {
    ll n, k;
    ll ans = 0;
    cin >> n >> k;
    if (k == 0)ans = n * n;
    else {
        FOR(i, k + 1, n + 1) {
            int c = n / i;
            int d = n % i;
            int e = (d + 1 >= k ? d + 1 - k : 0);
            ans += (i - k)*c + e;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
MOD = 10 ** 9 + 7
n, m = map(int, input().split())
fac = [1] * (m + 1)
for i in range(m):
    fac[i + 1] = fac[i] * (i + 1) % MOD


def comb(n, k):
    if n < 0 or n < k or k < 0:
        return 0
    return fac[n] * pow(fac[n - k], MOD - 2, MOD) * pow(fac[k], MOD - 2, MOD) % MOD


ans = 0
t = 0
cnt = 0
a = 1
for j in range(n + 1):
    if j % 2 == 0:
        ans += comb(m - j, n - j) * fac[n - j] * comb(n, j)
    else:
        ans -= comb(m - j, n - j) * fac[n - j] * comb(n, j)
print(ans * comb(m, n) * fac[n] % MOD)


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

#define dforsn(i,s,n) for(int i=int(n-1);i>=int(s);i--)
#define forsn(i,s,n) for(int i=int(s);i<int(n);i++)
#define dforn(i,n) for(int i=int(n-1);i>=0;i--)
#define forn(i,n) for(int i=0;i<int(n);i++)
#define D(a) cerr << #a << " = " << a << endl
#define all(a) a.begin(),a.end()
#define si(a) int((a).size())
typedef pair<int,int> pii;
typedef long long int ll;
typedef vector<int> vi;
#define pb emplace_back
#define mp make_pair
#define snd second
#define fst first

const double EPS = 1e-9;

struct pto {
	double x, y;
	pto(double _x=0, double _y=0) : x(_x),y(_y) {}
	pto operator+(pto a) { return pto(x + a.x, y + a.y); }
	pto operator-(pto a) { return pto(x - a.x, y - a.y); }
	pto operator*(double a) { return pto(x*a, y*a); }
	pto operator/(double a) { return pto(x/a, y/a); }
	double norm() { return sqrt(x*x + y*y); }
};
double dist(pto a, pto b) { return (b-a).norm(); }
pto CCW90(pto p) { return pto(-p.y, p.x); }

struct circle { pto p; double r; };

vector<pto> interCC(circle &a, circle &b) {
    vector<pto> r;
    double d = dist(a.p, b.p);
    if (d > a.r + b.r + EPS || d + min(a.r, b.r) < max(a.r, b.r) - EPS) return r;
    double x = (d*d + a.r*a.r - b.r*b.r) / (2*d);
    double y = sqrt(a.r*a.r - x*x);
    pto v = (b.p - a.p) / d;
    r.pb(a.p + v*x + CCW90(v)*y);
    if (y > EPS) r.pb(a.p + v*x - CCW90(v)*y);
    return r;
}
bool inside(circle &c, pto &p) {
    return dist(c.p, p) < c.r + EPS;
}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    
    int n,k; cin >> n >> k;
    vector<pto> a(n); 
    int b[n];
    forn(i, n) cin >> a[i].x >> a[i].y >> b[i];

    auto f = [&](double t) { // O(n^3)
        vector<circle> cir(n);
        forn(i, n) cir[i] = {a[i], t/b[i]};

        vector<pto> can(all(a));
        forn(i, n) forsn(j, i+1, n)
            for (pto &p : interCC(cir[i], cir[j])) 
                can.pb(p);

        int m = 0;
        for (auto &p : can) {
            int q = 0;
            for (auto &c : cir)
                if (inside(c, p)) q++;
            m = max(m, q);
        }
        return m < k;
    };

    double l = 0, h = 3e5;
    while (h-l > EPS) {
        double m = (l+h)/2;
        if (f(m)) l = m;
        else h = m;
    }
    cout << fixed << setprecision(6) << l << endl;
    return 0;
}


Measured memory_bytes: 384
import math
from typing import List, Any


def read_int() -> int:
    return int(input().strip())


def read_ints() -> List[int]:
    return list(map(int, input().strip().split(' ')))


def solve() -> Any:
    N, M = read_ints()
    S = read_ints()
    T = read_ints()
    dp = [
        [0 for _ in range(M+1)] for _ in range(N+1)
    ]
    dp[0][0] = 1
    for i in range(1, N+1):
        dp[i][0] = 1
    for j in range(1, M+1):
        dp[0][j] = 1
    modulo = 10**9+7
    for i in range(1, N+1):
        for j in range(1, M+1):
            dp[i][j] = (dp[i-1][j]+dp[i][j-1]-dp[i-1][j-1])%modulo
            if S[i-1] == T[j-1]:
                dp[i][j] = (dp[i][j]+dp[i-1][j-1])%modulo
    return dp[N][M]


if __name__ == '__main__':
    print(solve())


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


int main() {
  string s,t,u;
  int a,b;

   cin >> s >> t >> a >> b >> u;

   if(u == s) cout << a-1 <<  " " << b << endl;
   else cout << a  << " " << b-1    << endl;

  return 0;
}

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

string s;
int n, a = 0;

int main() {
	cin >> s;
	n = s.size();
	for (int i = 0; i < n; ++i) {
		a += (int) (s[i] - '0');
		a %= 9;
	}
	cout << (a ? "No" : "Yes") << endl;
}


Measured memory_bytes: 3696
def main():
    n, m = map(int, input().split())
    lamps = []
    for _ in range(m):
        data = [int(i)-1 for i in input().split()][1:]
        lamps.append(data)
    p = [int(i) for i in input().split()]

    #bit全探索
    #全てのswichのonoffを試す
    res = 0
    for i in range(1<<n):
        onSwitch = set()
        flag = True
        for j in range(n):
            if i>>j & 1:
                onSwitch.add(j)
        #swichOn setに含まれるlamp jのswitchの数を数える
        for j in range(m):
            cnt = 0
            for k in range(len(lamps[j])):
                if lamps[j][k] in onSwitch:
                    cnt += 1
            if cnt%2 != p[j]:
                flag = False
        if flag:
            res += 1 
    print(res)
main()

Measured memory_bytes: 44272
#include <iostream>
#include <cstring>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <cstdio>
using namespace std;

int min(int a,int b){return a<b?a:b;}

int main(void){
    char c;
    char str[100008];
    int arr[100008];
    int N = 0;
    int K;
    
    scanf("%s",str);
    N = strlen(str);
    for(int i = 0 ; i < N ; i++ ){
        c = str[i];
        arr[i] = ((int)(c)) - ((int)('a'));
    }
    
    scanf("%d",&K);
    
    for(int i = 0 ; i < N ; i++ ){
        int move = arr[i] != 0 ? 26-arr[i] : 0;
        if( move <= K ){
            arr[i] = 0;
            //printf("1 %d ,%d,%d\n",i,K,move);
            K -= move;
        }
    }
    
    if( K > 0 ){
        arr[N-1] = (arr[N-1]+K)%26;
    }
    
    for(int i = 0 ; i < N ; i++ )
        printf("%c",((char)(arr[i]+((int)'a'))));
    printf("\n");
    
    
    return 0;
}

Measured memory_bytes: 768
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
 
     String[] nyu=sc.nextLine().split("");

//     String nyu=sc.nextLine();
//int A=Integer.parseInt(nyu[0]);
//int B=Integer.parseInt(nyu[1]);
//int C=Integer.parseInt(nyu[2]);
//int D=Integer.parseInt(nyu[3]);



//double A=Double.parseDouble(nyu[0]);
//double B=Double.parseDouble(nyu[1]);
/*
switch(C){
case 7:
case 5:
case 3:
System.out.println("YES") ;
break;
default:
System.out.println("NO") ;

break;
}
*/

int res=0;

for(String tem:nyu){
if(tem.equals("1"))res++;
}

//if(A+B<C+D){
//double res=Math.ceil((A+B)/2);

System.out.println(res);
//}else if(A+B>C+D){
//System.out.println("Left");

//}else{
//System.out.println("Balanced");

//}




	}
}

Measured memory_bytes: 21844
#include <iostream>

using namespace std;

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

    int N;
    cin >> N;

    int odds = 0, evens = 0;
    for (int i = 1; i <= N; ++ i) {
        int val;
        cin >> val;

        if (val & 1)
            ++ odds;
        else
            ++ evens;
    }

    evens += (odds / 2);
    odds %= 2;

    while (evens > 1)
        evens --;

    if (odds + evens == 1)
        cout << "YES\n";
    else
        cout << "NO\n";
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;

class Program {
  static void Main() {
    var arr = Console.ReadLine().Split().Select(int.Parse).ToArray();
    int a = arr[0];
    int b = arr[1];
    if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0) {
      Console.WriteLine("Possible");
    } else {
      Console.WriteLine("Impossible");
    }
  }
}

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

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<string> vs;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpll = vector<pll>;
struct Edge {
	ll to;
 	ll cost;
 };
using Graph = vector<vector<Edge>>;

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
/***** define constant start *******/
const ll MOD = 1000000007;
const double PI = 3.1415926535897932;
const ll INF = LLONG_MAX;
string abc = "abcdefghijklmnopqrstuvwxyz";
string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const ll MAX = 10000000;
/****** define constant end ********/
/****** define variable start ******/
ll n;
/******* define variable end *******/
int solve() {
	cin >> n;
	for(ll i = 0; i < 10; i++){
		if(pow(2, i) > n){
			cout << (ll)pow(2, i-1) << endl;
			break;
		}
	}
	return 0;
}

int main() {
	//clock_t start = clock();
	cout << std::fixed << std::setprecision(10);
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int end_solve = solve();
	/*
	clock_t end = clock();
	const double time = static_cast<double>(end - start) / CLOCKS_PER_SEC *
	1000.0; printf("time %lf[ms]\n", time);
	*/

	return end_solve;
}


Measured memory_bytes: 256
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    n = int(input())
    a = list(map(int, input().split()))
    b = 1
    for i in a:
        b *= i
    c = 0
    for i in a:
        c += b//i
    print(b/c)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3436
class priorityQueue {
  constructor() {
    this.keys = [];
    Number.prototype.parentIdx = function() { return Math.ceil(this/2 - 1); };
    Number.prototype.leftIdx = function() { return this * 2 + 1; };
    Number.prototype.rightIdx = function() { return this * 2 + 2; };
  }

  insert(key) { this.heapIncrease(this.keys.push(key) - 1); }

  heapIncrease(idx) {
    const keys = this.keys;
    for (let i=idx, p=idx.parentIdx(); i > 0 && keys[i] > keys[p]; i=p, p=i.parentIdx()) {
      keys[p] = [keys[i], keys[i] = keys[p]][0];
    }
  }

  extract() {
    const res = this.keys[0];
    this.keys[0] = this.keys.pop();
    this.maxHeapify(0);
    return res;
  }

  maxHeapify(idx) {
    const keys = this.keys;
    const n = keys.length;
    const innerMaxHeapify = (i) => {
      let left, right, largest = i;
      left = i.leftIdx();
      right = i.rightIdx();
      if (left < n && Number(keys[left]) > Number(keys[largest])) largest = left;
      if (right < n && Number(keys[right]) > Number(keys[largest])) largest = right;
      if (largest != i) {
        keys[largest] = [keys[i], keys[i] = keys[largest]][0];
        innerMaxHeapify(largest);
      }
    };
    innerMaxHeapify(idx);
  }
}

(function main() {
  const lines = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n');
  lines.pop();
  const queue = new priorityQueue();
  let str = '';
  lines.forEach(function(cmd) {
    switch(cmd.charAt(0)) {
      case 'i': queue.insert(Number(cmd.split(' ')[1])); break;
      case 'e': str += `${queue.extract()|0}\n`; break;
    }
  });
  process.stdout.write(str);
})();




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

using namespace std;

typedef double db;
typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long long ull;

typedef pair < db, db > pdd;
typedef pair < db, ld > pdl;
typedef pair < ld, db > pld;
typedef pair < ld, ld > ldp;

typedef pair < ll, ll > pll;
typedef pair < int, ll > pil;
typedef pair < ll, int > pli;
typedef pair < int, int > pii;

#define F first
#define S second

#define en end()
#define bg begin()

#define rev reverse
#define mp make_pair
#define pb push_back

#define y1 y1234567890
#define um unordered_map

#define all(x) x.bg, x.en
#define sz(x) (int)x.size()
#define len(x) (int)strlen(x)

#define sqr(x) ((x + 0ll) * (x))
#define sqrd(x) ((x + 0.0) * (x))

#define forn(i, n) for (int i = 1; i <= n; i++)

const ll inf = (ll)1e18;
const ll mod = (ll)1e9 + 7;

const db eps = (db)1e-9;
const db pi = acos(-1.0);

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

const int N = 100500;

struct query {
	int v, d, c;
	query(){};
	inline void in() {
		cin >> v >> d >> c;
	}
} qr[N];

vector < int > g[N], qrs[11];
int n, m, q, ans[N], dp[N][11];

inline void solve(int dist) {
	memset(dp, 0, sizeof(dp));
	for (auto i : qrs[dist])
		dp[qr[i].v][0] = i;
	for (int j = 1; j <= dist; j++) {
		for (int v = 1; v <= n; v++) {
			dp[v][j] = max(dp[v][j], dp[v][j - 1]);
			for (auto to : g[v]) {
				dp[to][j] = max(dp[to][j], dp[v][j - 1]);
			}
		}
	}
	for (int i = 1; i <= n; i++)
		ans[i] = max(ans[i], dp[i][dist]);
}

int main() {
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	//freopen(".err", "w", stderr);

	//srand(time(NULL));

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

	//cout << setprecision(10) << fixed;
	
	cin >> n >> m;

	for (int i = 1; i <= m; i++) {
		int x, y;
		cin >> x >> y;
		g[x].pb(y);
		g[y].pb(x);
	}

	cin >> q;

	for (int i = 1; i <= q; i++) {
		qr[i].in();
		qrs[qr[i].d].pb(i);
	}

	for (int i = 0; i <= 10; i++)
		solve(i);

	for (int i = 1; i <= n; i++)
		cout << qr[ans[i]].c << "\n";
	
	//cerr << (clock() + 0.0) / CLOCKS_PER_SEC;

	return 0;
}


Measured memory_bytes: 13048
import sys
import fractions
from collections import deque

input = sys.stdin.readline

N = int(input())
a = [int(x) for x in input().rstrip("\n").split()]
q = deque(a)

while len(q) > 1:
    x = q.popleft()
    y = q.popleft()
    z =  fractions.gcd(x, y)
    q.append(z)

ans = q.popleft()
print(ans)

Measured memory_bytes: 16296
#include <bits/stdc++.h>
#define int long long
using namespace std;
using Graph = vector<vector<int>>;

signed main(){
  int N;
  cin >> N;
  
  vector<int> A(N);
  for( int i = 0; i < N; i++ ) cin >> A.at(i);
  
  vector<int> B(N);
  vector<int> ans;
  for( int i = N-1; i >= 0; i-- ){
    int sum = 0;
    for( int j = (i+1)*2; j <= N; j +=(i+1) ){
      sum += B.at(j-1);
    }
    if( (B.at(i)+sum)%2!=A.at(i) ){
      B.at(i)++;
      ans.push_back(i+1);
    }
  }
  
  cout << ans.size() << endl;
  for( int i = 0; i < ans.size(); i++ ) cout << ans.at(i) << " ";
  cout << endl;
}


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



int main() {
   string s;
   cin>>s;
   string ss="LR";
   for(int i=0;i<s.size();i++)
   {
      if(ss[i%2]==s[i]){
         cout<<"No"<<endl;
         return 0;
      }
   }
   cout<<"Yes"<<endl;
}

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

#define irep(i,n)  for(int i=0;i<(n);i++)
#define irepy(i,n) for(int i=1;i<=(n);i++)
#define jrep(j,n)  for(int j=0;i<(n);j++)
#define jrepy(j,n) for(int j=1;i<=(n);j++)

int main(){

  long long  n,k,q;
  long long  A[100010]={};
  long long  p[100010]={};//個人の点数

  cin >> n >> k >> q;//n=匹数,k=初期点,q=ラウンド数
  
  for(int i=0;i<q;i++) cin >> A[i];
  
  if(k > q){//終わり
    irep(i,n){
      cout<<"Yes"<<endl;
    }
    return 0;
  }

    irep(i,n) p[i]=k-q;
  
  for(int i=0;i<q;i++){
    p[A[i]-1]++;
  }

  irep(i,n){
    if(p[i] > 0) cout <<"Yes" <<endl;
    else         cout <<"No"  <<endl;
  }
  return 0;
}


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

using namespace std;

long long int K;

long long int X;

int used[1000006];

int main(void) {

	cin >> K;

	X = 0;
	int ans = 0;
	while (1) {
		X *= 10; X += 7;  X %= K;
		ans++;
		if (X == 0) { cout << ans << endl; return 0; }
		if (used[X] > 0) { cout << -1 << endl; return 0; }
		used[X]++;
	}

	return 0;
}

Measured memory_bytes: 7512
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;

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

    vector<lint> d(n);
    for(auto& e : d)  cin >> e;

    lint ans = 0;
    for(lint i=0; i<n; i++)
    for(lint j=0; j<n; j++) {
        if(i == j)  continue;
        ans += d[i] * d[j];
    }

    cout << ans/2 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <cmath>
using namespace std;
typedef long long i64;
typedef long double ld;
typedef pair<i64,i64> P;
#define rep(i,s,e) for(int i = (s);i <= (e);i++)

int a,b,c;

int main()
{
    cin >> a >> b >> c;
    if(b - a == c - b)
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }
}

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

int main(){
 int N,K;
  cin >> N >> K;
  long long c=0;
  vector <long long> H(N);
  
  rep(i,N){
    cin >> H.at(i);
  }
  
  sort(H.begin(),H.end());
  reverse(H.begin(),H.end());
  if(K>N)
    cout << '0' << endl;
  else{
  
  for(int i=K;i<N;i++){
    c+=H.at(i);
  }
  
  cout << c << endl;
  }

}

Measured memory_bytes: 1920
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int gcd(int *, int *);
void swap(int * , int * );

int main() {
  int x,y;
  scanf("%d%d",&x,&y);
  if (1<=x && x <=1000*1000*1000 && 1<=y && y <=1000*1000*1000)
  x = gcd(&x,&y);
  printf("%d\n",x);

  return 0;
}

int gcd(int *x,int *y){
  int r;
  if(*x < *y) swap(x,y);
  while(*y > 0){
    r = *x%*y;
    *x=*y;
    *y=r;
  }
  return *x;
}

void swap(int *x, int *y)
{
  int tmp;

  tmp = *x;
  *x = *y;
  *y = tmp;
}

Measured memory_bytes: 592
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
#include<list>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> IP;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)

int main() {
	int N;
	cin >> N;
	vector<lint>A(N);
	rep(i, N) {
		cin >> A[i];
	}
	int Q;
	cin >> Q;
	rep(i, Q) {
		lint k;
		cin >> k;
		cout << lower(A, k)-A.begin() << ' ' << upper(A, k)-A.begin() << endl;
	}
}




Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using ll = long long; 
using vpii = vector<pair<int, int>>;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define rep1(i, n) for (int i = 1; i < (int)n; i++)
ll mod = 1e9+7;
ll inf = 1e10;

ll gcd(ll a, ll b){
  return (b != 0) ? gcd(b, a%b) : a;
}

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

template<class T>
bool contain(const string& s, const T& v){
  return s.find(v) != std::string::npos;
}

int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  priority_queue<int> a;
  rep(i, n){
    int tmp;
    cin >> tmp;
    a.push(tmp);
  }
  rep(i, m){
    int maxvalue = a.top();
    a.pop();
    a.push(maxvalue/2);
  }
  ll ans = 0;
  rep(i, n){
    ans += a.top();
    a.pop();
  }
  cout << ans << "\n";
  return 0;
}

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

int main() {
  int N,K;
  cin >> N >> K;
  int t=0;
  for(int i=0;i<N;i++){
    int x;
    cin >> x;
     if(x<K-x){
       t+=x; 
     }else{
       t+=(K-x);
     }
  }
  t*=2;
  cout << t << endl;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define REP(i,n) for(int64_t i=0;i<(n);i++)
#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REV(c) reverse((c).begin(),(c).end())
#define YES cout << "YES" << endl;
#define NO cout << "NO" << endl;
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define COUTDOUBLE(d,i) cout << setprecision((i)) << (d) << endl;
#define VIN(v) for(int64_t i=0;i<(v).size();i++){cin >> (v).at(i);}
#define MREP(i,m) for(auto i=(m).begin(); i != (m).end(); ++i) // auto key = i->first;auto value = i->second;

using namespace std;
typedef int64_t I;
typedef pair<I,I> P;
typedef vector<I> V;

I MOD = pow(10,9)+7;
I MAX = LONG_MAX;
I MIN = LONG_MIN;

// 最大公約数
I gcd(I a, I b) {
  return b != 0 ? gcd(b, a % b) : a;
}

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

int ctoi(char c){
  return c - '0';
}

I nCr[2006][2006];

int setnCrMOD(){
  nCr[0][0] = 1;
  for(int i = 1; i<2006; i++){
    nCr[i][0] = 1;
    for(int j = 1; j<2006; j++){
      nCr[i][j] = nCr[i-1][j-1] + nCr[i-1][j];
      nCr[i][j] %= MOD;
    }
  }
}

int main(){
  int64_t n, k;
  cin >> n >> k;
  int64_t r = n - k;

  setnCrMOD();

  REP(i,k){
    int64_t t=0;
    t = nCr[k-1][i] * nCr[r+1][r-i];
    cout << t % MOD << endl;
  }

  /*
  REP(i,k){
    if (i==0){
      cout << r+1 << endl;
    }else{
      int64_t j = r - i;
      if (j < 0 || i >= k){
        cout << 0 << endl;
        continue;
        //break;
      }
      unsigned long long c=1;
      unsigned long long cc=0;
      REP(l,i){ // (k-1)C(i+1-1)
        c *= (k -1 - l);
        if ( c / MOD != 0){
          cc += c / MOD;
          c %= MOD;
        }
      }
      REP(l,i){ // (k-1)C(i+1-1)
        while ( c < MOD && cc > 0 && c % (l+1) != 0){
          c += MOD;
          cc--;
        }
        cc += (c / (l+1)) / MOD;
        c = (c / (l+1)) % MOD;
      }
      unsigned long long t=1;
      unsigned long long tt=0;
      int64_t ccc = i+1;
      ccc = min(r-i,ccc);
      REP(l,ccc){ // (r+1)C(r-i-1+1)
        t *= (r + 1 - l);
        if ( t / MOD != 0){
          tt += t / MOD;
          t %= MOD;
        }
      }
      REP(l,ccc){ // (k-1)C(i+1-1)
        while ( t < MOD && tt > 0 && t % (l+1) != 0){
          t += MOD;
          tt--;
        }
        tt += (t / (l+1)) / MOD;
        t = (t / (l+1)) % MOD;
      }
      //cout << "c:" << c << ",t:" << t << endl;
      cout << (t % MOD) * (c % MOD) % MOD << endl;
    }
  }
  */
  return 0;
}



Measured memory_bytes: 31616
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
	ll int n,ans,i,k;
	cin>>n;
	i=0;k=0;
	while(i<10000007)
	{
		while(k<n)
		{
			k*=10;
			k+=7;
			i++;
		}
		if(k==n)
		{
			cout<<i<<endl;
			return 0;
		}
		if(k%n==0)
		{
			cout<<i<<endl;
			return 0;
		}
		k=k%n;
	}
	cout<<"-1\n";
	return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


const long long INF = 1LL << 60;
vector<ll> a(100010), dp(100010);

int main(){
  int H, W;
  cin >> H >> W;
  vector<string> C(H);
  for(int i = 0; i < H ; i++){
    cin >> C.at(i);
  }
  for(int i = 0; i < H; i++){
    cout << C.at(i) << endl << C.at(i) << endl;
  }

}

Measured memory_bytes: 1792