akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

int N;
string S;
string dummy;
vector<bool> shape = vector<bool>(52, false); // false: 1 * 2, true: 2 * 1

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


    cin >> N;
    cin >> S;
    cin >> dummy;

    int m = 0;
    for (int i = 0; i < N - 1;)
    {
        if (S[i + 1] == S[i])
        {
            shape[m++] = true;
            i += 2;
        }
        else
        {
            shape[m++] = false;
            i += 1;
        }
    }
    if (N == 1 || (N >= 2 && S[N - 1] != S[N]))
    {
        shape[m++] = false;
    }

    u64 ans = shape[0] ? 6 : 3;
    for (int i = 1; i < m; ++i)
    {
        if (shape[i] && shape[i - 1])
        {
            ans *= 3;
        }
        else if (shape[i] || (!shape[i] && !shape[i-1]))
        {
            ans *= 2;
        }
        ans %= MOD;
    }

    cout << ans << "\n";
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan0
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/












int LIM = 10;

int N, V[1 << 19], W[1 << 19], Q;
//---------------------------------------------------------------------------------------------------
vector<pair<int, int>> memo[1 << 18];
void naive(int cu, vector<int>& arr) {
	if (memo[cu].size() != 0) return;

	int n = arr.size();
	map<int, int> dp;
	rep(msk, 0, 1 << n) {
		int val = 0, wei = 0;
		rep(i, 0, n) if (msk & (1 << i)) {
			val += V[arr[i]];
			wei += W[arr[i]];
		}
		chmax(dp[wei], val);
	}

	fore(p, dp) memo[cu].push_back(p);
	int ma = -inf;
	fore(p, memo[cu]) {
		chmax(ma, p.second);
		p.second = ma;
	}
}
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> N;
	rep(i, 1, N + 1) cin >> V[i] >> W[i];
	cin >> Q;
	rep(_, 0, Q) {
		int v, L; cin >> v >> L;
		
		int v2 = v;
		vector<int> arr;
		while (1 <= v2) {
			arr.push_back(v2);
			v2 /= 2;
		}

		int n = arr.size();
		if (n <= LIM) {
			naive(v, arr);

			int ans = 0;
			auto idx = upper_bound(all(memo[v]), make_pair(L, inf)) - memo[v].begin();
			if (0 < idx) {
				ans = memo[v][idx - 1].second;
			}
			printf("%d\n", ans);
		}
		else {
			vector<int> arr2;
			rep(i, n - LIM, n) arr2.push_back(arr[i]);
			int p = arr[n - LIM];
			naive(p, arr2);

			int m = n - LIM;
			int ans = 0;
			rep(msk, 0, 1 << m) {
				int val = 0, wei = 0;
				rep(i, 0, m) if (msk & (1 << i)) {
					val += V[arr[i]];
					wei += W[arr[i]];
				}

				auto idx = upper_bound(all(memo[p]), make_pair(L - wei, inf)) - memo[p].begin();
				if (0 < idx) chmax(ans, memo[p][idx - 1].second + val);
			}
			printf("%d\n", ans);
		}

	}
}







Measured memory_bytes: 16340
import os
import sys


def solve(n):
    ans = 0
    for i in range(1, int(n ** 0.5) + 1):
        k = n // i
        ans += i * k * (k + 1) // 2
        if i != k:
            l = n // (i + 1)
            ans += i * (i + 1) * (k + l + 1) * (k - l) // 4
    return ans


if sys.argv[-1] == 'ONLINE_JUDGE':
    from numba.pycc import CC

    cc = CC('my_module')
    cc.export('solve', '(i8,)')(solve)
    cc.compile()
    exit()

if os.name == 'posix':
    # noinspection PyUnresolvedReferences
    from my_module import solve
else:
    from numba import njit

    solve = njit('(i8,)', cache=True)(solve)

print(solve(int(input())))


Measured memory_bytes: 27388
<?php
// 整数の入力
fscanf(STDIN, "%d", $n);
//n個の整数の入力
$format = "%d";
for ($i = 1; $i < $n; $i++) {
  $format .= " %d";
}
  //n個を配列に格納
$data = fscanf(STDIN, $format);

//２つに分ける
$even = array();
$odd = array();

for ($i = 0; $i < $n; $i++) {
  if ($i % 2 === 0) {
    $even[] = $data[$i];
  } else {
    $odd[] = $data[$i];
  }
}

//それぞれについて一番多く出た数字を探す
asort($even);

$count = 0; //何連でその数字が出たか
$max_even = 0; //何連のmax値
$pre_num = 0; //前の数字
$max_num = 0; //その数字
foreach ($even as $num) {
  if ($num === $pre_num) {
    //同じ数字出たから
    $count++;
  } else {
    if ($count > $max_even) {
      //何連続記録更新！！
      $max_even = $count;
      $max_num = $pre_num;
    }
    $count = 1;
    $pre_num = $num;
  }
}

//一番最後の数字が一番出てきた時
if ($count > $max_even) {
  $max_even = $count;
  $max_num = $pre_num;
}

//一番出てきた数字以外をその数字に変える
$change_even_first = $n / 2 - $max_even;

//同じことをもう１つの数列でもやる
asort($odd);

$count = 0; //何連でその数字が出たか
$max_odd = 0; //何連のmax値
$pre_num = 0; //前の数字
foreach ($odd as $num) {
  //evenと同じ数字に揃えてはだめ
  if ($num === $max_num) {
    continue;
  }
  if ($num === $pre_num) {
    //同じ数字出たから
    $count++;
  } else {
    if ($count > $max_odd) {
      //何連続記録更新！！
      $max_odd = $count;
    }
    $count = 1;
    $pre_num = $num;
  }
}

//一番最後の数字が一番出てきた時
if ($count > $max_odd) {
  $max_odd = $count;
}

//一番出てきた数字以外をその数字に変える
$change_even_first += $n / 2 - $max_odd;


//evenとoddの順番を入れ替える
//sortは済んでる
$count = 0; //何連でその数字が出たか
$max_odd = 0; //何連のmax値
$pre_num = 0; //その数字
$max_num = 0; //その数字
foreach ($odd as $num) {
  if ($num === $pre_num) {
    //同じ数字出たから
    $count++;
  } else {
    if ($count > $max_odd) {
      //何連続記録更新！！
      $max_odd = $count;
      $max_num = $pre_num;
    }
    $count = 1;
    $pre_num = $num;
  }
}

//一番最後の数字が一番出てきた時
if ($count > $max_odd) {
  $max_odd = $count;
  $max_num = $pre_num;
}

//一番出てきた数字以外をその数字に変える
$change_odd_first = $n / 2 - $max_odd;


$count = 0; //何連でその数字が出たか
$max_even = 0; //何連のmax値
$pre_num = 0; //前の数字
foreach ($even as $num) {
  //oddと同じ数字に揃えてはだめ
  if ($num === $max_num) {
    continue;
  }
  if ($num === $pre_num) {
    //同じ数字出たから
    $count++;
  } else {
    if ($count > $max_even) {
      //何連続記録更新！！
      $max_even = $count;
    }
    $count = 1;
    $pre_num = $num;
  }
}

//一番最後の数字が一番出てきた時
if ($count > $max_even) {
  $max_even = $count;
}

//一番出てきた数字以外をその数字に変える
$change_odd_first += $n / 2 - $max_even;

if ($change_even_first < $change_odd_first) {
  echo $change_even_first;
} else {
  echo $change_odd_first;
}

?>


Measured memory_bytes: 30236
S = int(input())

dp = [0] * (S + 1)
dp[0] = 1
M = 10 ** 9 + 7

for i in range(1, S + 1):
    num = 0
    for j in range(i - 2):
        num += dp[j]
        dp[i] = num % M

print(dp[S])



Measured memory_bytes: 9136
#include <bits/stdc++.h>
#define rep(i,n)    for(int i = 0; i < (n) ; ++i)
#define orep(i,n)   for(int i = 1; i <= (n); ++i)   // one rep
#define drep(i,n)   for(int i = (n)-1; i >= 0; --i) // down rep
#define srep(i,s,t) for(int i = (s); i < (t); ++i)  // set rep
#define rng(x)  (x).begin(),(x).end()   // range
#define rrng(a) (a).rbegin(),(a).rend() // reverse range
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define ru(x,y) (((x)+(y)-1)/(y)) // round up
#define fi first
#define se second
#define eb emplace_back
#define fcout cout << fixed << setprecision(15)


using namespace std;
using ll  = long long;
using P   = pair<int,int>;
using vi  = vector<int>;
using vvi = vector<vi>;
using vp  = vector<P>;
using vl  = vector<ll>;

template<typename T> void Yes(T flag) {
  cout << (flag ? "Yes" : "No") << endl;
}

template<typename T> void pv(vector<T> vec) {
  cout << "[";
  for(auto& v : vec) { cout << v << ","; }
  cout << "]" << endl;
}

template<>
void pv(vector<P> vec) {
  cout << "[";
  for(auto& v : vec) {
    cout << "<" << v.fi << ","<< v.se << ">" << ",";
  }
  cout << "]" << endl;
}

int main() {
  int r;
  cin >> r;
  float p = 3.141592;
  fcout << 2 * p * r << endl;

  return 0;
}


Measured memory_bytes: 3788
#include<stdio.h>
#include<string.h>
#include <stdlib.h>
int main(void){
    int N,a;
    long int SUM=0;
    scanf("%d",&N);
    for (int a=1; a<=N; a++) {
        if(a%3!=0 && a%5!=0){
            SUM+=a;
        }
    }
    printf("%ld\n",SUM);
    return 0;
}

Measured memory_bytes: 1736
#include<iostream>
using namespace std;
int main(){
  int x, y, s, ans;
  while (cin >> x >> y >> s, x||y||s){
    ans = 0;
    for (int i = 1; i < s; ++i){
      for (int j = 1; j < s; ++j){
	if (i*(100+x)/100 + j*(100+x)/100 == s){
	  ans = max(ans, i*(100+y)/100 + j*(100+y)/100);
	}else if (i*(100+x)/100 + j*(100+x)/100 > s) break;
      }
    }
    cout << ans << endl;
  }
  return 0;
}

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

int main(){
    bool cards[4][14];
    int n, rank;
    char suit;
    
    for(int i = 0; i < 4; i++){
        for(int j = 1; j <= 13; j++){
            cards[i][j] = 0;
        }
    }
    
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> suit >> rank;
        if(suit == 'S') cards[0][rank] = 1;
        if(suit == 'H') cards[1][rank] = 1;
        if(suit == 'C') cards[2][rank] = 1;
        if(suit == 'D') cards[3][rank] = 1;
    }
    
    for(int i = 0; i < 4; i++){
        for(int j = 1; j <= 13; j++){
            if(cards[i][j]) continue;
            if(i == 0) suit = 'S';
            if(i == 1) suit = 'H';
            if(i == 2) suit = 'C';
            if(i == 3) suit = 'D';
            cout << suit << " " << j << endl;
        }
    }
}


Measured memory_bytes: 3080
//#pragma GCC optimize("O3")
//#pragma GCC target("avx2")
// 293206GT
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <unordered_set>
#include <stack>
#include <string>
#include<algorithm>
#include <random>
#include <bitset>
#include <chrono>

typedef long long ll;
#define int ll
using namespace std;
#define put(a) cout << (a) << '\n'
#define sqr(x) (x) * (x)
typedef pair<ll, ll> pii;
typedef long double ld;

typedef pair<ld, ld> pld;
#define rep(x, y, a) for (int x = (y); x < (int)(a); ++x)
#define all(a) a.begin(), a.end()
#define chkmax(a, b) a = max(a, (b))
#define chkmin(a, b) a = min(a, (b))
#define prev asasdasd
#define next aasdasda
#define left asdasdasdasd
#define right asnabsdkasdl
#define rank asdasdknlasd
#define move asdasdas

typedef vector<int> vi;
typedef vector<pii> vpii;
namespace IO {
    template<class A, class B>
    ostream &operator<<(ostream &out, pair<A, B> &a) {
        out << a.first << " " << a.second;
        return out;
    }

    template<class A, class B>
    ostream &operator<<(ostream &out, vector<pair<A, B>> &a) {
        for (pair<A, B> x: a)
            out << x.first << " " << x.second << '\n';
    }

    template<class A>
    ostream &operator<<(ostream &out, vector<A> &a) {
        for (A x: a) out << x << ' ';
        return out;
    }

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

    template<class A>
    istream &operator>>(istream &in, vector<A> &a) {
        for (A &x: a) in >> x;
        return in;
    }
}
using namespace IO;

void solve() {
    int n;
    cin >> n;
    vector<vi> a(n);
    rep(i, 0,  n - 1) {
        int p;
        cin >> p;
        --p;
        a[p].push_back(i + 1);
    }
    rep(i, 0, n) {
        put(a[i].size());
    }
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

//    freopen("input.txt", "r", stdin);
    int t = 1;
//    cin >> t;
    while (t--) solve();
}


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

int main (void)
{
    int N;
    cin >> N;
    vector<int> X(N+1);
    rep(i, N)
    {
        cin >> X[i];
    }
    int M;
    cin >> M;
    rep(i, M)
    {
        int A;
        cin >> A;
        A--;
        if (X[A] != 2019)
            if (X[A]+1 != X[A+1])
                X[A]++;
    }
    rep(i, N)
    {
        cout << X[i] << endl;
    }
}



Measured memory_bytes: 3124
#include<bits/stdc++.h>
#define rep(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define SORT(c) sort((c).begin(),(c).end())
#define MOD 1000000007
//S.size()
//配列名.Length()

using namespace std;

typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<bool> VB;
typedef unsigned long long ll;

int main(void){
	int X,Y,Z;cin>>X>>Y>>Z;
	int wa = 0;
	int cnt = 0;
	while (wa + Z <= X) {
		wa += Y + Z;
		cnt++;
	}
	cout<<cnt - 1;
}


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

int main() {
    string s;
    cin >> s;
    set<char> st;
    for(auto c:s) 
        st.insert(c);
    int tam = st.size();
    if(tam==2)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 256
//This is getting accepted!
// I HATE BUG
// God Of The Bugs
// 12/11/2016
#include<bits/stdc++.h>

using namespace std;

#define ms(s, n) memset(s, n, sizeof(s))
#define FI first
#define SE second
#define pb push_back
#define mp make_pair
#define ll long long
#define sz(a) ((int)(a).size())
#define __builtin_popcount __builtin_popcounll
#define ld long double

typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<int, pii> ppi;

const double PI = acos(0) * 2;
const double EPS = 1e-8;
const ll MOD = 1e9 + 7;
const int MAXN = 1e5 + 5;
const int oo = 1e9;
const double foo = 1e30;

template<class T> int getbit(T s, int i) { return (s >> i) & 1; }
template<class T> T onbit(T s, int i) { return s | (T(1) << i); }
template<class T> T offbit(T s, int i) { return s & (~(T(1) << i)); }
template<class T> int cntbit(T s) { return __builtin_popcounll(s);}
template<class T> T sqr(T x) { return x * x; }

inline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}
inline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}
inline int mult(int a, int b, int p = MOD) {return (ll) a * b % p;}

int n;
vector<ll> a;

int main() {
//#ifndef ONLINE_JUDGE
//    freopen("inp.txt", "r", stdin);
////    freopen("out.txt", "w", stdout);
//#endif

	cin >> n;
	
	for (int i=0; i<n; i++) {
		int x;
		cin >> x;
		a.pb(x);
	}

	sort(a.begin(), a.end());
	
	int cnt = 1;
	int pre = -1;
	ll ans = 0;
	for (int i=a.size()-2; i>=0; i--) {
		if (a[i] != a[i + 1]) {
			if (cnt >= 2 && ~pre) {
				ans = max(ans, a[pre] * a[i + 1]);
			}
			if (cnt >= 4) ans = max(ans, a[i + 1] * a[i + 1]);
			if (cnt >= 2) pre = i + 1;
			cnt = 1;
		}
		else {
			cnt++;
		}
	}
	
	if (cnt >= 2 && ~pre) ans = max(ans, a[pre] * a[0]);
	if (cnt >= 4) ans = max(ans, a[0] * a[0]);
	
	cout << ans;
}


Measured memory_bytes: 1400
N = int(input())
A = list(map(int, input().split()))

if N == 0:
    if A[0] != 1:
        print(-1)
    else:
        print(1)
    exit()


leaf = []
miki = []
under = 1

for i, a in enumerate(A):
    if a > under:
        print(-1)
        exit()
    miki.append(under - a)
    under = miki[-1] * 2


ans = 0
child = 0
for i in reversed(range(N + 1)):
    child = min(child, miki[i]) + A[i]
    ans += child

print(ans)

Measured memory_bytes: 668964
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  ll k,a,b;
  cin >> k >> a >> b;
  if(k <= a || a >= b - 1)cout << k + 1<< endl;
  else{
    ll res = 0;
    res = a;
    k -= a - 1;
    res += (k / 2) * (b - a);
    if(k % 2 == 1)res++;
    cout << res << endl;
  }
}

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

const int MAXN = 1e5 + 10, lg = 30;
int n, a[MAXN], X, ans;
bool r[MAXN];


int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		X ^= a[i];
		r[__builtin_ctz(a[i])] = 1;
	}
	for (int i = lg - 1; i >= 0; i--) {
		if ((X & (1 << i)) != 0) {
			ans++;
			X ^= (1 << (i + 1)) - 1;
			if (!r[i])
				return cout << -1, 0;
		}
	}
	cout << ans;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <tuple>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>
#include <cassert>
#include <random>

int main() {
	int n, takahashi, aoki; std::cin >> n >> takahashi >> aoki; --takahashi; --aoki;
	std::vector<std::vector<int>> tree(n);
	for (auto i = 0; i < n - 1; ++i) {
		int a, b; std::cin >> a >> b; --a; --b;
		tree[a].push_back(b);
		tree[b].push_back(a);
	}
	std::vector<int> from_takahashi(n, -1), from_aoki(n, -1);
	from_takahashi[takahashi] = from_aoki[aoki] = 0;
	std::queue<int> queue; queue.push(takahashi);
	while (!queue.empty()) {
		auto top = queue.front(); queue.pop();
		for (const auto next : tree[top]) if (from_takahashi[next] == -1) {
			from_takahashi[next] = from_takahashi[top] + 1;
			queue.push(next);
		}
	}
	queue.push(aoki);
	while (!queue.empty()) {
		auto top = queue.front(); queue.pop();
		for (const auto next : tree[top]) if (from_aoki[next] == -1) {
			from_aoki[next] = from_aoki[top] + 1;
			queue.push(next);
		}
	}
	int aoki_move = 0;
	int new_aoki = -1;
	int new_takahashi = -1;
	if (from_takahashi[aoki] % 2 == 0) {
		for (auto i = 0; i < n; ++i) {
			if (from_takahashi[i] == from_aoki[i] + 2 && from_takahashi[i] + from_aoki[i] == from_takahashi[aoki]) {
				aoki_move = from_aoki[i];
				new_aoki = i;
			}
			else if (from_takahashi[i] + 2 == from_aoki[i] && from_takahashi[i] + from_aoki[i] == from_takahashi[aoki]) {
				new_takahashi = i;
			}
		}
	}
	else {
		for (auto i = 0; i < n; ++i) {
			if (from_takahashi[i] == from_aoki[i] + 1 && from_takahashi[i] + from_aoki[i] == from_takahashi[aoki]) {
				aoki_move = from_aoki[i];
				new_aoki = i;
			}
			else if (from_takahashi[i] + 1 == from_aoki[i] && from_takahashi[i] + from_aoki[i] == from_takahashi[aoki]) {
				new_takahashi = i;
			}
		}
	}
	std::vector<int> from_new_aoki(n, -1); from_new_aoki[new_aoki] = 0;
	std::vector<bool> is_sub_tree(n, false);
	queue.push(new_aoki);
	while (!queue.empty()) {
		auto top = queue.front(); queue.pop();
		for (const auto next : tree[top]) if (from_new_aoki[next] == -1) {
			from_new_aoki[next] = from_new_aoki[top] + 1;
			is_sub_tree[next] = (next == new_takahashi) || is_sub_tree[top];
			queue.push(next);
		}
	}


	int max_leaf = 0;
	for (auto i = 0; i < n; ++i) if (is_sub_tree[i]) {
		max_leaf = std::max(max_leaf, from_new_aoki[i]);
	}
	aoki_move += max_leaf - 1;
	std::cout << aoki_move << std::endl;
}


Measured memory_bytes: 7040
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  double n;
  while (cin >> n) {
    if (n == 0)
      break;
    vector<double> v(n);
    rep(i, 0, n) cin >> v[i];
    double m = accumulate(v.begin(), v.end(), 0) / n;
    double t = 0;
    rep(i, 0, n) { t += pow(v[i] - m, 2); }
    double ans = sqrt(t / n);
    cout << fixed << setprecision(10) << ans << endl;
  }
}



Measured memory_bytes: 3260
#include <iostream>

using namespace std;

int main() {
  //intput
  char a;
  cin >> a;

  //solve
  char ans;
  if (a == 'A'){
    ans = 'T';
  }else if(a == 'T'){
    ans = 'A';
  }else if(a == 'G'){
    ans = 'C';
  }else{
    ans = 'G';
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public final class Main{
	private static int solution(int[] array)
	{
		int current = 1;
		int score = 1;
		int minimum = array[0];
		while(current < array.length)
		{
			if(array[current] < minimum)
			{
				minimum = array[current];
				score++;
			}
			current++;
		}
		return score;
	}
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] array = new int[n];
		for(int i = 0; i < n; i++)
		{
			array[i] = sc.nextInt();
		}
		System.out.println(solution(array));
	}
}

Measured memory_bytes: 84792
#include <iostream>
#include <algorithm>

using namespace std;

int main(){
    string W, T;
    cin >> W;
    int count = 0;

    while(true){
        cin >> T;
        if(T == "END_OF_TEXT") break;
        transform(T.begin(), T.end(), T.begin(), ::tolower);
        // cout << T << endl;

        if(W == T){
            count++;
            // cout << " count is "<< count << endl;
        }
    }
    cout << count << endl;
    return 0;
}



Measured memory_bytes: 3152
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;	
int main()
{
	int n,m,q;
	vector<int> a[550];
	scanf("%d%d%d",&n,&m,&q);
	for(int i=0;i<m;i++){
		int l,r;
		scanf("%d%d",&(l),&(r));
		a[l].push_back(r);
	}		
 	for(int i=1;i<=500;i++){
 		sort(a[i].begin(),a[i].end());
	 }
	 for(int i=1;i<=q;i++){
	 	int ll,rr;
	 	int ans=0;
	 	scanf("%d%d",&(ll),&(rr));
	 	for(int j=ll;j<=rr;j++){
	 		ans+=upper_bound(a[j].begin(),a[j].end(),rr)-a[j].begin();	
		}
		printf("%d\n",ans);
	 }
}


Measured memory_bytes: 2176
import sys
input = sys.stdin.buffer.readline

#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return input().rstrip().decode()
def II(): return int(input())
def FI(): return float(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()



def main():
	r=II()
	ans="AGC"
	if r<1200:
		ans="ABC"
	elif r<2800:
		ans="ARC"
	print(ans)





if __name__ == "__main__":
	main()


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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 29;
const ll INF64 = 1ll << 45;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

struct UnionFind
{
  vector<int> par;
  vector<int> siz;
  UnionFind(int N) : par(N), siz(N, 1) {for (int i = 0; i < N; i++) par[i] = i;}
  void init(int N) {
    siz.assign(N, 1);
    par.resize(N);
    for(int i = 0; i < N; ++i) par[i] = i;
  }
  int root(int x) {
    while(par[x] != x) {x = par[x] = par[par[x]];}
    return x;
  }
  bool unite(int x, int y)
  {
    x = root(x);
    y = root(y);
    if(x == y) return false;
    if(siz[x] < siz[y]) swap(x, y);
    siz[x] += siz[y];
    par[y] = x;
    return true;
  }
  bool isSame(int x, int y) {return root(x) == root(y); }
  int size(int x) { return siz[root(x)]; }
};

int main()
{
  int n, m;
  cin >> n >> m;
  vector<int> a(m), b(m);
  rep(i, m) cin >> a[i] >> b[i];
  int ans = 0;
  rep(i, m) {
    UnionFind uf(n+1);
    rep(j, m) {
      if(i==j) continue;
      uf.unite(a[j], b[j]);
    }
    if(uf.size(1) != n) ++ans;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const ll INF = 1LL << 60;

int main(){
    int n, m;
    cin >> n >> m;
    int leftmax=1;
    int rightmin=n;
    for(int i=0; i<m; i++){
        int left, right;
        cin >> left >> right;
        leftmax = max(leftmax,left);
        rightmin = min(rightmin,right);
    }
    if(rightmin - leftmax <0){
        cout << 0 << endl;
        return 0;
    }
    cout << rightmin - leftmax + 1 << endl;
}

Measured memory_bytes: 3620
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) {
        try {
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            String line = br.readLine();
            int count = 0;
            
            while(line.equals("0") == false){
            	System.out.println("Case "+ ++count + ": " +line);
            	//strList.add(line);
                line = br.readLine();
            }
            /*
            for (String str : strList) {
            	System.out.println("Case "+ (strList.indexOf(str) + 1) + ": " +str);
			}
            */
            br.close();
        } catch (IOException e) {
            System.err.println(e);
        }
    }
}

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

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

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

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

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

  set<int> s;
  int H[N];
  for (int i = 0; i < N; i++) {
    cin >> H[i];
    s.insert(i+1);
  }

  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    if (H[a-1] < H[b-1]) s.erase(a);
    if (H[a-1] > H[b-1]) s.erase(b);
    if (H[a-1] == H[b-1]) {
      s.erase(a);
      s.erase(b);
    }
  }

  cout << s.size() << endl;
  return 0;
}


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

int main() {
  int64_t n, s = 0;
  cin >> n;
  vector<vector<int>> v(10, vector<int>(10, 0));
  rep(i, 10) v[i][i] = 1;
  for(int i = 10; i <= n; ++i){
    int a = i, b = i % 10;
    while(a / 10 != 0) a /= 10;
    ++v[a][b];
  }
  rep(i, 9){
    rep(j, 9){
      s += v[i+1][j+1]*v[j+1][i+1];
    }
  }
  if(n < 10) s = n;
  cout << s << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,a[105];
	scanf("%d",&n);
	for (int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	sort(a+1,a+n+1);
	printf("%d",unique(a+1,a+n+1)-a-1);
}

Measured memory_bytes: 256
N = int(input())

C = [0]
S = [0]
F = [0]

for i in range(N-1):
    tmp = list(map(int,input().split()))
    C.append(tmp[0])
    S.append(tmp[1])
    F.append(tmp[2])

for i in range(1,N+1):
    t = 0
    for j in range(i,N):
        if t -S[j] <= 0:
            t =S[j]+C[j]
        else:
            t = S[j] + ((t-S[j]-1)//F[j]+1)*F[j] + C[j]
    print(t)

Measured memory_bytes: 3188
#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>;
const int INF = 1000000001;

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

int main() {
  int n;
  cin >> n;
  map<int, int> mp;
  rep(i, n){
    int a;
    cin >> a;
    mp[a]++;
  }

  int ans = 0;
  for(int i = 0; i < 100000; ++i){
    int count = 0;
    if(mp.count(i-1)){
      count += mp[i-1];
    }
    if(mp.count(i)){
      count += mp[i];
    }
    if(mp.count(i+1)){
      count += mp[i+1];
    }
    ans = max(ans, count);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3200
using System;
using System.IO;

class Program
{
    static void Main(string[] args) {
        var writer = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
        Console.SetOut(writer);
        Console.WriteLine(Solve());
        Console.Out.Flush();
    }
    static object Solve() {
        int diff = 0, modmin = 10, result = 0;
        for (int i = 0; i < 5; i++) {
            var x = int.Parse(Console.ReadLine());
            var ceil = (int) Math.Ceiling((double) x / 10) * 10;
            result += ceil;
            if (x % 10 == 0) continue;
            (modmin, diff) = x % 10 < modmin ? (x % 10, ceil - x) : (modmin, diff);
        }
        return result - diff;
    }
}

Measured memory_bytes: 27316
// Command quickstart generates an audio file with the content "Hello, World!".
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	r := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()

	var c string
	fmt.Fscan(r, &c)

	fmt.Fprintln(w, string(c[0]+1))
}


Measured memory_bytes: 1844
#include <stdio.h>

int main(void) {

    int width, hight, x, y, radius;

    

    scanf("%d%d%d%d%d", &width, &hight, &x, &y, &radius);

    

    if(x - radius >= 0 && x + radius <= width

        && y - radius >= 0 && y + radius <= hight) {

            printf("Yes\n");

    }

    else {

        printf("No\n");

    }

        return 0;

}



Measured memory_bytes: 1996
#include <iostream>
using namespace std;
 
int main(){
    char n;
    cin >> n;
  
  	if(n=='A') cout << 'T' << "\n";
  	if(n=='T') cout << 'A' << "\n";
  	if(n=='C') cout << 'G' << "\n";
  	if(n=='G') cout << 'C' << "\n";
  
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<bitset>
using namespace std;

typedef long long ll;
#define rep(i, n) for(int i = 0;i < (n);i++)
#define repr(i, n) for(int i = (n);i >= 0;i--)
#define repf(i, m, n) for(int i = (m);i < (n);i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1;} return 0;}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////


int main() {
    ll n, m; cin >> n >> m;
    ll sum = 0;
    rep(i,m) {
        ll t; cin >> t;
        sum += t;
    }
    cout << max(-1ll, n-sum) << endl;
    return 0;
}

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

int main() {
  int k,s,ans=0;
  cin>>k>>s;
  for(int i=0;i<=k;i++){
    for(int j=0;j<=k;j++){
      int z=s-i-j;
      if(z>=0&&z<=k){
        ans++;
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}

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

typedef long long LL;
const int mod = 1e9 + 7;

int main()
{
	LL sum = 0, res = 0;
	int N, T;
	scanf("%d", &N);
	while (N--) {
		scanf("%d", &T);
		res += sum * T;
		sum += T;

		res %= mod;
		sum %= mod;
	}
	printf("%lld\n", res);
}

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

int main()
{
    ll n,m;
    ll ans;

    cin >> n;
    m = 0;
    for (ll i = sqrt(n);i > 0;--i) {
        if (n % i == 0) {
            //割り切れる
            m = i;
            break;
        }
    }
    ans = (m - 1) + (n / m - 1);
    std::cout << ans << endl;
    return 0;
}

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

#define fi first
#define se second
#define show(x) cerr << #x << "=" << "\n"
typedef long long ll;
typedef unsigned long long ull;

using namespace std;
const ll llinf = LLONG_MAX;
const ull ullinf = ULLONG_MAX;

int n;
ll m;
ll a[100011];
map<int, vector<ll> > mp;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout << fixed;
#ifdef LOCAL_DEFINE
  FILE *stream1;
  //FILE *stream2;
  stream1 = freopen("in.txt", "r", stdin);
  //stream2 = freopen("out.txt", "w", stdout);
  if (stream1 == NULL) return 0;
  //if (stream2 == NULL) return 0;
#endif
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i < n; i++) {
    a[i] += a[i - 1];
  }
  for (int i = 0; i < n; i++) {
    mp[a[i] % m].push_back(a[i]);
  }
  ll res = 0;
  ll pre = 0;
  for (int i = 0; i < n; i++) {
    res += mp[pre % m].size(); 
    mp[a[i] % m].erase(mp[a[i] % m].begin());
    pre = a[i];
  }
  cout << res << endl;
#ifdef LOCAL_DEFINE
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s.\n";
  fclose(stream1);
  //fclose(stream2);
#endif
  return 0;
}


Measured memory_bytes: 8320
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



#define SIZE 100005

struct Info{
	bool operator<(const struct Info &arg) const{

		return A < arg.A;
	}
	ll A,B;
};

ll N,M;
Info info[SIZE];


int main(){

	scanf("%lld %lld",&N,&M);

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

		scanf("%lld %lld",&info[i].A,&info[i].B);
	}
	sort(info,info+N);


	if(info[0].A > M){

		printf("0\n");
		return 0;
	}

	priority_queue<ll> Q;
	int index = 0;
	ll ans = 0;

	for(int day = 1; day <= M; day++){

		while(index < N && info[index].A == day){

			Q.push(info[index].B);
			index++;
		}

		if(!Q.empty()){
			ans += Q.top();
			Q.pop();
		}
	}

	printf("%lld\n",ans);

	return 0;
}


Measured memory_bytes: 2936
#[allow(unused_imports)]
use proconio::{fastout, input};

#[fastout]
fn main() {
    input!(s: String);
    let v: Vec<char> = s.chars().collect();

    for i in 0..s.len() {
        if i % 2 == 0 {
            if v[i] == 'L' {
                println!("{}", "No");
                return;
            }
        } else {
            if v[i] == 'R' {
                println!("{}", "No");
                return;
            }
        }
    }
    println!("{}", "Yes");
}


Measured memory_bytes: 2136
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;

const int MAX_N = 200005, MOD = 1000000007;
typedef long long LL;

int X[MAX_N], V[MAX_N], id[MAX_N], L[MAX_N], R[MAX_N], C[MAX_N];

bool cmp(int a, int b) {
  return V[a] < V[b];
}

bool cmp1(int a, int b) {
  return C[a] < C[b];
}

bool cmp2(int a, int b) {
  return C[a] > C[b];
}

bool cmp3(int a, int b) {
  if (L[a] != L[b]) return L[a] < L[b];
  return R[a] < R[b];
}

LL sum[MAX_N];
int N;
void update(int x, LL val) {
  for (; x <= N; x += x & -x)
    sum[x] = (sum[x] + val) % MOD;
}
LL query(int x) {
  LL res = 0;
  for (; x; x -= x & -x)
    res = (res + sum[x]) % MOD;
  return res;
}

int main() {

  scanf("%d", &N);
  for (int i = 1; i <= N; ++i)
    scanf("%d%d", &X[i], &V[i]), id[i] = i;
  sort(id + 1, id + N + 1, cmp);

  for (int i = 1; i <= N; ++i) C[i] = X[id[i]];
  
  static int st[MAX_N], top;
  
  for (int i = 1; i <= N; ++i) {
    if (!top || C[i] > C[st[top]]) st[++top] = i;
    L[i] = lower_bound(st + 1, st + top + 1, i, cmp1) - st;
    L[i] = st[L[i]];
  }
  
  top = 0;
  for (int i = N; i; --i) {
    if (!top || C[i] < C[st[top]]) st[++top] = i;
    R[i] = lower_bound(st + 1, st + top + 1, i, cmp2) - st;
    R[i] = st[R[i]], id[i] = i;
  }

  sort(id + 1, id + N + 1, cmp3);
  
  LL res = 0;
  for (int i = 1; i <= N; ++i) {
    LL now = 0;
    if (L[id[i]] == 1) now = 1;
    now = now + query(R[id[i]]);
    if (L[id[i]] > 2) now -= query(L[id[i]] - 2);
    if (R[id[i]] == N) res = (res + now) % MOD;
    update(R[id[i]], now);
  }

  printf("%lld\n", (res + MOD) % MOD);
  return 0;
}


Measured memory_bytes: 7168
#include <algorithm>
#include <array>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <set>
#include <stack>
#include <string>
#include <utility>

using namespace std;

int main() {
  string s, t;

  cin >> s >> t;

  int cnt = 0;

  for (int i = 0; i < s.size(); i++) {
    if (s[i] != t[i]) {
      cnt++;
    }
  }

  cout << cnt << endl;

  return 0;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h> //全てのヘッダファイルをインクルード

//ループ
#define REP(i, n) for(int i = 0; i < n; i++) //普通のループ
#define REPR(i, n) for(int i = n; i >= 0; i--) //逆ループ
#define FOR(i, m, n) for(int i = m; i < n; i++) //最初の数値を指定したループ

//型名省略
typedef long long ll;

//配列要素数
static const int MAX = 200000;

using namespace std;

//#include "./lib/string.h"

std::tuple<int, int> swap(int num1, int num2){
     return std::forward_as_tuple(num1, num2);
}

void traceArray(int A[], int N){
    for(int i=0; i<N; i++){
        cout << A[i];
        if(i!=N-1){
            cout  << " ";
        }
    }
    cout << endl;
}

void insertSort(int A[], int N){
    int i, j, v, k;
    for(i=1; i<N; i++){
        v=A[i];
        j=i-1;
        while(j>=0 && A[j]>v){
            A[j+1] = A[j];
            j--;
        }
        A[j+1] = v;
        traceArray(A, N);
    }
}

int main(){
    int  N;
    cin >> N;
    int  A[N];
    REP(i, N) cin >> A[i];
    traceArray(A, N);
    insertSort(A, N);

    return 0;
}


Measured memory_bytes: 3084
n, m = map(int, input().split())
ac_lst = [False] * (n + 1)
wa_lst = [0] * (n + 1)
w = ac = 0
for _ in range(m):
    a, b = input().split()
    a = int(a)
    if ac_lst[a]:
        continue
    if b == 'WA':
        wa_lst[a] += 1
    else:
        ac += 1
        w += wa_lst[a]
        ac_lst[a] = True
print(ac, w)


Measured memory_bytes: 4596
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,b,n) for(int i=b;i<(int)n;i++)
#define rep(i,n) REP(i,0,n)
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll x;cin>>x;
    ll m=x/11;
    ll n=x%11;
    if(n==0)cout<<2*m<<endl;
    else if(n<7)cout<<2*m+1<<endl;
    else cout<<2*m+2<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
	int n,a,b,i,ca,cb;
	scanf("%d",&n);
	while(n>0){
		a=0;
		b=0;
	for(i=0;i<n;i++){
		scanf("%d %d",&ca,&cb);
		if(ca>cb){
		a+=ca+cb;
		}else if(ca<cb){
		b+=ca+cb;
		}else{
		a+=ca;
		b+=cb;
		}
	}
	printf("%d %d\n",a,b);
	scanf("%d",&n);
	}
	return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    int L[100000];
    for(int i = 0;i < 100000;i++) L[i] = 0;
    for(int i = 0;i < N;i++) {
      cin >> A[i];
      L[A[i]]++;
    }
    int ans = 0;
    for(int i = 1;i < 99999;i++){
      ans = max(ans,L[i-1]+L[i]+L[i+1]);
    }
    cout << ans << endl;
    
}

Measured memory_bytes: 1024
X, Y = map(int, input().split())

ans = 0
if X == 1:
  ans +=300000
if Y == 1:
  ans +=300000
if X ==2:
  ans += 200000
if Y ==2:
  ans +=200000
if X ==3:
  ans+=100000
if Y ==3:
  ans+=100000
if X ==1 and Y==1:
  ans += 400000
print(ans)


Measured memory_bytes: 3060
package main

import (
	"fmt"
	"sort"
)

func main() {
	var a, b, c int

	var nums []int
	fmt.Scan(&a, &b, &c)
	nums = append(nums, a)
	nums = append(nums, b)
	nums = append(nums, c)
	sort.Sort(sort.IntSlice(nums))

	for i, v := range nums {
		if i == 2 {
			fmt.Printf("%d", v)
		} else {
			fmt.Printf("%d ", v)
		}
	}
	fmt.Printf("\n")
}



Measured memory_bytes: 1128
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#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 <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <queue>

using namespace std;

//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 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)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int x, int y){
  return (y==0? x: gcd(y,x%y));
}

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

  int x, y; cin >> x >> y;
  cout << gcd(x,y) << endl;

  return 0;
}

Measured memory_bytes: 1192
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <set>
using namespace std;
#define rep(i, s, n) for(int i = s; i < n; i++) 
#define ll long long

int main() {
    const ll N = 1e9+7;
    int n, k;
    cin >> n >> k;

    vector<vector<ll>> dp(2020, vector<ll>(2020, 0));
    dp[0][0] = 1;
    dp[1][0] = 1;
    dp[1][1] = 1;
    rep(i, 2, 2010) {
        dp[i][0] = 1;
        rep(j, 1, i) {
            dp[i][j] = dp[i-1][j]+dp[i-1][j-1]%N;
        }
        dp[i][i] = 1;
    }
    
    /*
    rep(i, 0, n+1) {
        rep(j, 0, n+1) {
            cout << dp[i][j] << " ";
        }
        cout << endl;
    }
    */
    

    int select = n-k+1;
    rep(i, 1, k+1) {
        ll ans = (dp[select][i]%N) * (dp[k-1][i-1]%N);
        cout << ans%N << endl;
    }
    return 0;
}

Measured memory_bytes: 32256
#include <bits/stdc++.h>
#include<algorithm>
using namespace std;
#define ll long long 
const int MAX = 510000;
const int MOD = 1000000007;
int main() {
  int x;
  cin >> x;
  if(x == 0){
    cout << 1;
  }else{
    cout << 0;
  }
}

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

int main() {
    string N; cin >> N;
    int sum=0;
    char k;
    for(int i=0; i<N.size(); i++){
        k=N.at(i);
       sum=sum+(k-'0');
    }
    if(sum%9==0) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3736
#include <iostream>
#include <vector>
#include <algorithm>

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

  unsigned N, W;
  std::cin >> N >> W;
  unsigned weight, value;
  std::vector<std::vector<size_t>> dp(N+1);

  dp[0] = std::vector<size_t>(W+1, 0);

  for (unsigned i = 1; i < N+1; ++i)
  { 
    std::cin >> weight >> value;
    dp[i] = std::vector<size_t>(W+1, 0);
    for (unsigned j = 0; j < W+1; ++j) 
    { 
      if (j >= weight)
      { 
        dp[i][j] = std::max(dp[i-1][j], dp[i-1][j-weight] + value);
      }
      else
      { 
        dp[i][j] = dp[i-1][j];
      }
    }
  }
  std::cout << dp[N][W];
  return 0;
}

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

#define print cout <<
#define printl(s) cout << s << endl;
#define rep(i,n) for (int i = 1; i < (n); ++i)
using ll = long long;

const ll modseed = pow(10,9) + 7;

template <typename T>
vector<T> getValues(int num){
    vector<T> values(num);
    for(int i=0;i<num;i++){
        cin >> values.at(i);
    }
    return values;
}

int main(){
    int N;
    cin >> N;
    rep(i,10){
      rep(g,10){
        if(i*g==N){
          printl("Yes");
          return 0;
        }
      }
    }
    printl("No");
}


Measured memory_bytes: 3632
N=int(input())
A=list(map(int,input().split()))
B=list(map(str,A))
print(' '.join(B))
for i in range(1,N):
    v=A[i]
    j=i-1
    while j!=-1 and A[j]>v:
        A[j+1]=A[j]
        j-=1
    A[j+1]=v
    B=list(map(str,A))
    print(' '.join(B))



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

int main() {
	int N;
	int i;
	int A;
	int B[200010];

	cin >> N ;

	for(i=1;i<N;i++){
		B[i]=0;
		cin >> A;
		B[A]++;
	}
  	B[N]=0;
	for(i=1;i<=N;i++){
		cout << B[i] << endl;
	}
	return 0;
}


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

#define ll long long
#define all(x) (x).begin(), (x).end()
const long long INF = 1LL << 60;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  //(i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

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

    // 入力
    int n, L;
    cin >> n >> L;
    int appleSum = 0;

    // 処理
    if (L >= 0) {
        for (int i = 2; i <= n; i++) {
            appleSum += L + i - 1;
        }
    } else if (L < 0) {
        if (n + L > 0) {
            for (int i = 1; i <= n; i++) {
                appleSum += L + i - 1;
            }
        } else {
            for (int i = 1; i < n; i++) {
                appleSum += L + i - 1;
            }
        }
    }

    // 出力
    cout << appleSum << endl;

    return 0;
}


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

using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
const ll mod = 1e9 + 7;
const int INF = 1e9;



int main() {
	cin.sync_with_stdio(false);
	int H, W;
	cin >> H >> W;
	int c[26] = {};
	char a[100][100];
	rep(i, H) {
		rep(j, W) {
			cin >> a[i][j];
			c[a[i][j] - 'a']++;
		}
	}
	int cnt = 0;
	while (W > 1 && H > 1) {
		cnt++;
		cnt += (W - 2) / 2 + (H - 2) / 2;
		W -= 2; H -= 2;
	}
	rep(i, 26) {
		if (c[i] >= 4) {
			cnt-=c[i]/4;
			c[i] %= 4;
		}
	}
	if (cnt > 0) {
		cout << "No" << endl;
		return 0;
	}
	int odd = 0;
	rep(i, 26) {
		if (c[i] % 2 != 0)odd++;
	}
	if (H % 2 != 0 && W % 2 != 0) {
		if (odd == 1)cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	else {
		if (odd)cout << "No" << endl;
		else cout << "Yes" << endl;
	}




	return 0;
}

Measured memory_bytes: 384