akhauriyash/Code-Regression huggingface dataset:
//参考：https://qiita.com/DaikiSuyama/items/9dba963ba74396b9b7fd
//インクルード(アルファベット順)
#include <algorithm>     //sort,二分探索,など
#include <bitset>        //固定長bit集合
#include <cmath>         //pow,logなど
#include <complex>       //複素数
#include <deque>         //両端アクセスのキュー
#include <functional>    //sortのgreater
#include <iomanip>       //setprecision(浮動小数点の出力の誤差)
#include <iostream>      //入出力
#include <iterator>      //集合演算(積集合,和集合,差集合など)
#include <map>           //map(辞書)
#include <numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include <queue>         //キュー
#include <set>           //集合
#include <stack>         //スタック
#include <string>        //文字列
#include <unordered_map> //イテレータあるけど順序保持しないmap
#include <unordered_set> //イテレータあるけど順序保持しないset
#include <utility>       //pair
#include <vector>        //可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      //sizeをsize_tからllに直しておく
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007    //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define FIR first    //pairの一つ目の要素
#define SEC second   //pairの二つ目の要素

signed main()
{
    //入力の高速化用のコード
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    ll N;
    cin >> N;

    ll t[N + 1], x[N + 1], y[N + 1];
    t[0] = 0;
    x[0] = 0;
    y[0] = 0;

    FOR(i, 1, N)
    {
        cin >> t[i] >> x[i] >> y[i];
    }

    bool is_travel = true;

    REP(i, N)
    {
        // マンハッタン距離
        ll d = abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i]);

        // 移動可能距離
        ll n = abs(t[i + 1] - t[i]);

        //移動可能距離よりマンハッタン距離が大きい場合、移動不可能
        if (n < d)
        {
            is_travel = false;
            break;
        }

        //マンハッタン距離が奇数かつ移動可能距離が偶数の場合、移動不可能
        if (n % 2 == 0 && d % 2 == 1)
        {
            is_travel = false;
            break;
        }

        //マンハッタン距離が偶数かつ移動可能距離が奇数の場合、移動不可能
        if (n % 2 == 1 && d % 2 == 0)
        {
            is_travel = false;
            break;
        }
    }

    cout << (is_travel ? "Yes" : "No") << endl;

    return 0;
}


Measured memory_bytes: 5912
#include <iostream>

using namespace std;

int main() {
  int X;
  cin >> X;
  
  int ans;
  if (X < 600) {
    ans = 8;
  } else if (X < 800) {
    ans = 7;
  } else if (X < 1000) {
    ans = 6;
  } else if (X < 1200) {
    ans = 5;
  } else if (X < 1400) {
    ans = 4;
  } else if (X < 1600) {
    ans = 3;
  } else if (X < 1800) {
    ans = 2;
  } else {
    ans = 1;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3636
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#include <functional>
#include <vector>
#include <deque>
#include <utility>
#include <bitset>
#include <limits.h>
#include <time.h>
#include <functional>
#include <numeric>
#include <iostream>

using namespace std;
typedef long long ll;
typedef unsigned long long llu;
typedef double lf;
typedef unsigned int uint;
typedef long double llf;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;

const int MOD = (int)1e9 + 7;

class modint {
  int v;
public:
  modint (): v(0) { }
  modint (ll v): v((v + MOD) % MOD) { }

  bool operator== (modint x) { return v == x.v; }
  bool operator!= (modint x) { return v != x.v; }

  modint operator+ (modint x) { return v + x.v; }
  modint operator- (modint x) { return v - x.v; }
  modint operator* (modint x) { return (ll)v * x.v; }

  modint& operator+= (const modint x) { return *this = (*this + x); }
  modint& operator-= (const modint x) { return *this = (*this - x); }
  modint& operator*= (const modint x) { return *this = (*this * x); }

  int operator* () { return v; }
};

#define debug(format, ...) printf(format, __VA_ARGS__);

int main() {
  ll H, W;
  while(scanf("%lld %lld\n", &H, &W) == 2) {
    long long ans = H * W;
    auto upd = [&](ll x, ll y, ll z) {
      assert(x + y + z == H * W);
      if(x == 0 || y == 0 || z == 0) return;
      if(x > y) swap(x, y);
      if(y > z) swap(y, z);
      if(x > y) swap(x, y);
      ans = min(ans, z - x);
    };

    for(ll h = 1; h < H; h++) {
      upd(h * W, ((H - h + 1) / 2) * W, ((H - h) / 2) * W);
      upd(h * W, (H - h) * ((W + 1) / 2), (H - h) * (W / 2));
    }

    for(ll w = 1; w < W; w++) {
      upd(H * w, ((H + 1) / 2) * (W - w), (H / 2) * (W - w));
      upd(H * w, H * ((W - w + 1) / 2), H * ((W - w) / 2));
    }

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


Measured memory_bytes: 256
using System;

namespace AtCoderBeginnerContest166
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            if (s == "ABC")
            {
                Console.WriteLine("ARC");
            }
            else
            {
                Console.WriteLine("ABC");
            }
        }
    }
}

Measured memory_bytes: 25804
//#include "stdafx.h"
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <functional>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <tuple>
#include <numeric>
#include <assert.h>
#include <functional>
#include <unordered_map>

using namespace std;

/*-----------------------------------------------------------------------------
　定義
 -------------------------------------------------------------------------------*/
#define REP(i, n)				for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n)			for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define INF						2e9
#define MOD						(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)				(((((x))+((n)-1))/n))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)				(((((x))+((n)-1))/n)*n)		/* Nの倍数に切り上げ */
#define FloorN(x, n)			((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)				(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)				(!IsOdd((x)))						
#define	BitSetV(Val,Bit)		((Val) |= (Bit))			
#define	BitTstV(Val,Bit)		((Val) & (Bit))				
#define ArrayLength(x)			(sizeof( x ) / sizeof( x[ 0 ]))
#define	MAX_QWORD				((QWORD)0xFFFFFFFFFFFFFFFF)
#define	MIN_QWORD				((QWORD)0x0000000000000000)
#define	MAX_SQWORD				((SQWORD)0x7FFFFFFFFFFFFFFF)
#define	MIN_SQWORD				((SQWORD)0x8000000000000000)
#define M_PI					3.14159265358979323846
typedef long long				ll;
typedef unsigned long			DWORD;
typedef unsigned long long int	QWORD;
typedef pair<ll, ll>			P;

/*-----------------------------------------------------------------------------
　処理
 -------------------------------------------------------------------------------*/
// メイン
int main()
{
	// 入力
	int R, G;
	cin >> R >> G;
	cout << 2 * G - R << endl;

	return 0;
}



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

using namespace std;
const int N = 300003;
const long long infll = 1000000000000000000;
int arr[N];
long long lef[N], righ[N];
int main()
{
    int n;
    scanf("%d",&n);
    for(int i = 0;i<3*n;i++)
        scanf("%d",&arr[i]);
    for(int i = 0;i<N;i++)
        lef[i] = -infll, righ[i] = infll;
    long long sum = 0;
    multiset<int> s;
    for(int i = 0;i<3*n;i++) {
        s.insert(arr[i]);
        sum += arr[i];
        if(s.size() == n) {
            lef[i] = sum;
        } else if(s.size() > n) {
            sum -= *s.begin();
            s.erase(s.begin());
            lef[i] = sum;
        }
    }
    s.clear();
    sum = 0;
    for(int i = 3*n-1;i>=0;i--) {
        sum += arr[i];
        s.insert(arr[i]*-1);
        if(s.size() == n) {
            righ[i] = sum;
        } else if (s.size() > n) {
            sum -= *(s.begin()) * -1;
            s.erase(s.begin());
            righ[i] = sum;
        }
    }
    for(int i = 1;i<N;i++)
        lef[i] = max(lef[i],lef[i-1]);
    for(int i = N-2;i>=0;i--)
        righ[i] = min(righ[i], righ[i+1]);
    long long ans = -infll;
    for(int i = 0;i<3*n;i++)
        ans = max(ans,lef[i] - righ[i+1]);
    printf("%lld",ans);
    return 0;
}


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

typedef vector<int> vi;
typedef vector<bool> vb;
typedef pair<int,int> pii;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<bool> > vvb;
typedef map<int, bool> mib;

typedef long long ll;
typedef vector<long long> vl;
typedef pair<long long,long long> pll;
typedef vector<pair<long long,long long> > vpll;

typedef vector<string> vs;

typedef long double ld;

#define _GLIBCXX_DEBUG

#define REP(i,n) for (int i = 0; i < (n); ++i)
#define REPD(i,n) for (int i = (n-1); i >= 0; --i)
#define FORE(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define debug(x) cerr << #x << ": " << x << '\n'
#define debug2(x, y) cerr << #x << ": " << x << ", " << #y << ": " << y << '\n'
#define debug3(x, y, z) cerr << #x << ": " << x << ", " << #y << ": " << y << ", " << #z << ": " << z << '\n'
#define debugs(s) cerr << s << "\n"
#define hyphen() cerr << "--\n"

#define ALL(vec) (vec).begin(), (vec).end()
#define REVALL(vec) (vec).rbegin(), (vec).rend()

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

#define fst first
#define snd second
#define pb push_back
#define mk(x,y) make_pair((x),(y))

// http://ehafib.hatenablog.com/entry/2015/12/23/164137
int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a;a=1ll*a*a;}while(b>>=1);return ans;}
int qpm(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}

#define sz(v) int(v.size())

// x1, x2ライブラリとの被りを避ける
#define x1 x192837465
#define x2 x123456789
#define y1 y192837465
#define y2 y123456789

// typo
#define itn int
#define reutrn return
#define reutnr return

#define make(type, x) type x; cin>>x;
#define make2(type, x, y) type x, y; cin>>x>>y;
#define make3(type, x, y, z) type x, y, z; cin>>x>>y>>z;
#define make4(type, x, y, z, t) type x, y, z, t; cin>>x>>y>>z>>t;

const int MOD = (int)1e9 + 7;
const int INF = numeric_limits<int>::max();

int solve(int X) {
    if (X == 0) {
        return 0;
    } else if (X <= 6) {
        return 1;
    } else if (X <= 11) {
        return 2;
    }

    // 2回の操作で11ポイント
    int ans = 0;
    int n = X / 11;
    int r = X % 11;
    ans += n * 2;
    ans += solve(r);
    return ans;
}

signed main() {
    make(int, X);

    // 例えば
    //   6
    // 2 3 5 4
    //   1

    // まず6点を得ます
    // 1以外なら取れます
    // つまり、6,5,6,5ループが最善

    int ans = solve(X);
    cout << ans << endl;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
template <class T1, class T2>void print(T1 a[], T2 n) { for (T2 i = 0; i < n; i++) { cout << a[i] << " ";} cout << endl;}
template <class T1, class T2>void print(vector<T1> a, T2 n) { for (T2 i = 0; i < n; i++) { cout << a[i] << " "; } cout << endl;}



int main() {

  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif



  double r;
  cin >> r;
  cout << fixed << setprecision(10) << (2 * 3.14159265358979323846264 * r) << endl;
}

Measured memory_bytes: 3796
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
using namespace std;
typedef long long ll;
typedef pair<int, int> P; 
const int inf = 1<<21;
const ll INF = 1LL << 60;
const ll mod = 1e9+7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int main() {
    int a, b, q;
    cin >> a >> b >> q;
    vector<ll> s(a), t(b);
    rep(i, a) cin >> s[i];
    rep(i, b) cin >> t[i];

    rep(i, q){
        ll x;
        cin >> x;
        auto siter = lower_bound(s.begin(), s.end(), x);
        auto titer = lower_bound(t.begin(), t.end(), x);
        ll s1 = s[min(siter - s.begin(), a-1L)], s2 = s[max(siter - s.begin() - 1, 0L)];
        ll t1 = t[min(titer - t.begin(), b-1L)], t2 = t[max(titer - t.begin() - 1, 0L)];

        ll ans = INF;

        if (s1==s2 and t1==t2){
            if ((s1>x and t1>x) or (s1<=x and t1<=x)){
                chmin(ans, max(abs(s1-x), abs(t1-x)));
            }else{
                chmin(ans, abs(s1-t1) + min(abs(s1-x), abs(t1-x)));
            }
        }else if (s1==s2) {
            if (s1>x){
                chmin(ans, max(s1-x, t1-x));
                chmin(ans, s1-t2 + min(s1-x, x-t2));
            }else{
                chmin(ans, max(abs(s1-x), abs(t2-x)));
                chmin(ans, t1-s1 + min(abs(s1-x), abs(t1-x)));
            }
        }else if (t1==t2){
            if (t1>x){
                chmin(ans, max(s1-x, t1-x));
                chmin(ans, t1-s2 + min(t1-x, x-s2));
            }else{
                chmin(ans, max(abs(t1-x), abs(s2-x)));
                chmin(ans, s1-t1 + min(abs(s1-x), abs(t1-x)));
            }
        }else{
            chmin(ans, max(s1-x, t1-x));
            chmin(ans, max(abs(s2-x), abs(t2-x)));
            chmin(ans, s1-t2 + min(abs(s1-x), abs(x-t2)));
            chmin(ans, t1-s2 + min(abs(t1-x), abs(s2-x)));
        }
        cout << ans << endl;
    }
    return 0;
}

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

using namespace std;
typedef long long ll;
using Graph =vector<int>;
typedef pair<ll,int> P;

const ll MAX_N=131072;
int bit[MAX_N*2-1];
ll n;
int main(){
  int H,W;cin>>H>>W;
  rep(i,H){
    string S;
    cin>>S;
    cout<<S<<endl<<S<<endl;
  }
}


Measured memory_bytes: 256
n = int(input())
plus_bracket = []
minus_bracket = []

for _ in range(n):
  mini = 0
  cur = 0
  for bracket in input():
    if bracket == '(':
      cur += 1
    else:
      cur -= 1
    if cur < mini:
      mini = cur
  if cur > 0:
    plus_bracket.append([-mini, cur])
  else:
    minus_bracket.append([cur - mini, -cur])

success = True
cur = 0
plus_bracket.sort()
minus_bracket.sort()
for bracket in plus_bracket:
  if cur < bracket[0]:
    success = False
    break
  cur += bracket[1]
back_cur = 0
for bracket in minus_bracket:
  if back_cur < bracket[0]:
    success = False
    break
  back_cur += bracket[1]
if cur != back_cur:
  success = False

if success:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 96160
#include <iostream>
using namespace std;
int main()
{
  int n;
  while(cin >> n && n){
    int	c=0;
    int	i=3;
    while(i<=n){
      if(n%i==0)
        c++;
      i+=2;
    }
    cout << c << endl;
  }
}

Measured memory_bytes: 3068
#include <functional>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <sstream>
#include <numeric>
#include <string>
#include <vector>
#include <cstdio>
#include <bitset>
#include <cmath>
#include <ctime>
#include <queue>
#include <stack>
#include <map>
#include <set>

using namespace std;

#define forit(it, s) for(__typeof(s.begin()) it = s.begin(); it != s.end(); it++)
#define np(v) next_permutation(v.begin(), v.end())
#define pll pair < long long, long long>
#define all(a) a.begin(), a.end()
#define ull unsigned long long
#define pii pair < int, int >
#define sz(a) (int)a.size()
#define sqr(x) ((x) * (x))
#define y1 stupid_cmath
#define vi vector <int>
#define pb push_back
#define mp make_pair
#define ll long long
#define f first
#define s second

const int inf = (int)3e6;
const int mod = inf + 7;
const double eps = 1e-9;
const double pi = acos(-1.0);

ll ans, a, b, n;

int main(){
    ios_base::sync_with_stdio(0), cin.tie(0);
    cin >> n;
    ans = 1;
    for(int i = 0; i < n; ++i){
        cin >> a;
        ans = ans / __gcd(a, ans) * a;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int a,b,c,k;
  cin>>a>>b>>c>>k;
  int sum=0;
  if(k>a)
  {
    sum+=a;
    k=k-a;
  }
  else
  {
    sum+=k;
    k=0;
  }
  if(k>b)
  {
    k=k-b;
  }
  else
  {
    k=0;
  }
  if(k>0)
  {
    sum-=k;
    k=0;
  }
  printf("%d",sum);
  
  return 0;
}

Measured memory_bytes: 3748
class Array
def insert k
x,l,r=self
x ?(k<x ?l:r).insert(k):self<<k<<[]<<[]
end
def print
$x,$y=[p],[p]
w
puts $y*" ",$x*" "
end
def w
x,l,r=self
x&&($x<<x
l.w
$y<<x
r.w)
end
end
t=[]
gets
eval"t.#$_"while gets

Measured memory_bytes: 109216
#include <bits/stdc++.h>
using namespace std;
#define int                  long long int
#define ff                   first
#define ss                   second
#define pb                   push_back
#define mp                   make_pair
#define pii                  pair<int,int>
#define vi                   vector<int>
#define mi                   map<int,int>
#define pqb                  priority_queue<int>
#define pqs                  priority_queue<int,vi,greater<int>>
#define setbits(x)           __builtin_popcountll(x)
#define zrobits(x)           __builtin_ctzll(x)
#define mod                  1000000007
#define inf                  1e18
#define precise(x,y)         fixed<<setprecision(y)<<x
#define w(x)                 int x;cin>>x;while(x--)
#define endl                 "\n"
#define no_of_digit(n)       floor(log10(n))+1
#define copyarr(a,b,n)       copy_n(a,n,b)
mt19937                      rng(chrono::steady_clock::now().time_since_epoch().count());

//*******************to check if all number in array are positive*******************
//all_of(arr,arr+n,[](int x){return x>0;})?cout<<"positive":cout<<"some negative";


//*******************to check if any element in array is negative*******************
//any_of(arr,arr+n,[](int x){return x<0;})?cout<<"Any negative":cout<<"All positive";


int32_t main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //*****************Enter the code here*******************//
    int n;
    cin>>n;
    int ans=no_of_digit(n);
    for(int i=1;i*i<=n;i++){
        if(n%i!=0)
            continue;
        int b=n/i;
        int curr=max(no_of_digit(i),no_of_digit(b));
        if(ans>curr){
            ans=curr;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>
#include <functional> // for less
#include <iostream>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;

#define pf(n) cout << n << endl
#define ps() cout <<" ";
#define sf(n) cin >> n
#define in(i,n) for (int i = 0; i < n; i++)
#define vi vector<int>
#define vp vector<pair<int, int>>
#define graph vector< vector<int> >
#define vs vector<string>
#define mn -
#define pls +
#define mod %
#define E =
#define EE ==
#define le <=
#define ge <=
int mx=9999999;
/**  '' "\n" - ^ **/

class Template{
    public:
    void yes()
    {
        cout<<"Yes\n";
    }

    void no()
    {
        cout<<"No\n";
    }
    void YES()
    {
        cout<<"YES\n";
    }

    void NO()
    {
        cout<<"NO\n";
    }

    void Case(int i,int n)
    {
        cout<<"Case:"<<i<<" "<<n<<endl;
    }
    /**  '' "\n" x ^ **/
    /** printf("\n") */
};
bool comp(pair<ll,ll> a,pair<ll,ll> b)
{
    if(a.first<b.first)return true;
    if(a.first>b.first)return false;
    return a.second>b.second;
}
int main() {

    ios::sync_with_stdio(false);
    cin.tie(0);
    Template root;
    int n;
    cin>>n;
    ll sum=0;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=n;j++)
        {
            for(int k=1;k<=n;k++)
            {
                sum+=__gcd(i,__gcd(j,k));
            }
        }
    }
    pf(sum);
}


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

int main() {
  int n;
  long int nord, allsum, temp;
  cin >> n;
  int a[n+1];
  allsum = 0;
  for(int i=0; i<=n; i++){
    cin >> a[i];
    allsum = allsum + a[i];
  }
  temp = 1;
  nord = allsum;
  for(int i=0; i<=n; i++){
    if(a[0] >= 2 ){
      nord = -1;
      break;
    }
    if(a[i] > temp*2){
      nord = -1;
      break;
    }
    else{
      allsum = allsum - a[i];
      if(i==0){
        temp = 1 - a[i];
        nord = nord + temp;
      }
      else{
        temp = min(temp*2 - a[i], allsum);
        nord = nord + temp;
      }
    }
  }
  cout << nord << endl;
}

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

#define EPS (1e-10)
#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
#define rrep(i, a, b) for (int i = b - 1; i >= (int)(a); --i)
#define all(a) a.begin(), a.end()

using namespace std;
using ll = long long;
using vi = vector<int>;
using vb = vector<bool>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;
using vvb = vector<vb>;

constexpr int MOD = 1000000007;

bool check(const vi& l, const vi& r, int mid, int k) {
    rep(i, 0, (int)l.size() - mid + 1) {
        int start = l[i], end = r[i + mid - 1];
        if (end - start <= k) { return true; }
    }
    return false;
}

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

    int n, k;
    cin >> n >> k;

    string s;
    cin >> s;

    int cnt = 0;
    vi l(n, 0), r(n, 0);
    if (s[0] == '1') { ++cnt; }

    rep(i, 1, n) {
        if (s[i] == '1' && s[i - 1] == '0') { ++cnt; }
        if (s[i] == '1') {
            l[i] = r[i] = cnt;
        } else {
            l[i] = cnt;
            r[i] = cnt + 1;
        }
    }
    if (s[0] == '1') {
        l[0] = r[0] = 1;
    } else {
        l[0] = 0;
        r[0] = cnt > 0 ? 1 : 0;
    }

    int ok = 1, ng = n + 1;
    while (ok + 1 < ng) {
        int mid = (ok + ng) / 2;
        if (check(l, r, mid, k)) {
            ok = mid;
        } else {
            ng = mid;
        }
    }
    cout << ok << endl;

    return 0;
}

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

int main() {
  int n;long long mc = 0,ac = 0,rc = 0,cc = 0,hc = 0;
  long long ans = 0;
  cin >> n;
  for(int i = 0;i < n;i++){
    string s;
    cin >> s;
    if(s[0] == 'M') mc++;
    if(s[0] == 'A') ac++;
    if(s[0] == 'R') rc++;
    if(s[0] == 'C') cc++;
    if(s[0] == 'H') hc++;
  }
  ans += mc*ac*rc;
  ans += mc*ac*cc;
  ans += mc*ac*hc;
  ans += mc*rc*cc;
  ans += mc*rc*hc;
  ans += mc*cc*hc;
  ans += ac*rc*cc;
  ans += ac*rc*hc;
  ans += ac*cc*hc;
  ans += rc*cc*hc;
  cout << ans << endl;
}


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

template<typename T>
class UnionFind {
 private:
  T _size;
  vector<T> _parent; // 親の番号（親自身はー（マイナス）集合要素の個数）

 public:
  // n要素で生成
  explicit UnionFind(T n) : _size{n}, _parent{vector<T>(n, -1)} {}

  // 木の根を求める
  T find(T x) {
    if (x < 0 || x >= _size) {
      return x;
    }

    if (_parent[x] < 0) {
      return x;
    }

    return _parent[x] = find(_parent[x]);
  }

  // xとyの属する集合を併合する
  bool unite(T x, T y) {
    if (x < 0 || x >= _size || y < 0 || y >= _size) {
      return false;
    }

    x = find(x);
    y = find(y);
    if (x == y) {
      return false;
    }

    if (size(x) > size(y)) {
      _parent[x] += _parent[y];
      _parent[y] = x;
    } else {
      _parent[y] += _parent[x];
      _parent[x] = y;
    }

    return true;
  }

  // xとyが同じ集合に属するか
  bool same(T x, T y) {
    return find(x) == find(y);
  }

  // xの属する集合の個数を求める
  T size(T x) {
    if (x < 0 || x >= _size) {
      return 1;
    }

    return -_parent[find(x)];
  }

  // 全体の個数を求める
  T size() {
    return _size;
  }
};

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> A(M), B(M);
  for (int i{}; i < M; ++i) {
    cin >> A[i] >> B[i];
    --A[i];
    --B[i];
  }

  UnionFind<int> uni(N);

  vector<long> ans(M);
  ans[M - 1] = (long) N * (N - 1) / 2;

  for (int i{M - 1}; i >= 1; --i) {
    ans[i - 1] = ans[i];
    if (uni.find(A[i]) != uni.find(B[i])) {
      ans[i - 1] -= (long) uni.size(A[i]) * uni.size(B[i]);
      uni.unite(A[i], B[i]);
    }
  }

  for (int i{}; i < M; ++i) {
    cout << ans[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
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 int INF=1001001001;
vector<pair<int64_t,int64_t>>prime_factorize(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p; 
}
int main() {
  int N;
  cin>>N;
  vector<int>a(N);
  for(int i=0;i<N;i++){
    cin>>a[i];
  }
  for(int i=0;i<N;i++){
    if(a[i]%2!=0){cout<<"first"<<endl;return 0;}
  }
  cout<<"second"<<endl;
  return 0;
}

Measured memory_bytes: 3752
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
// Welcome to my source code!

int main() {
    int n;
    cin >> n;
    int a[n], maxv = -1, minv = 1e9+10;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        maxv = max(maxv, a[i]);
        minv = min(minv, a[i]);
    }
    cout << maxv - minv << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=(ll)1e9+7;
const ll MOD2=(ll)998244353;
const ll INF=(ll)1e18+10;
const double PI = 2.0*acos(0);

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int dy[]={-1,1,0,0};
int dx[]={0,0,-1,1};

int N,M,Q;
int a[55],b[55],c[55],d[55];
vector<int> to[10];
vector<int> arr;

int dfs(int n){
    int ret=0;
    if(n==0){
        for(int i=1;i<=M;++i){
            arr.push_back(i);
            ret=max(ret,dfs(n+1));
            arr.pop_back();
        }
        return ret;
    }
    if(n==N){
        int val=0;
        for (int i = 0; i < Q; ++i) {
            if(arr[b[i]]-arr[a[i]]==c[i]) val+=d[i];
        }
        return val;
    }
    for (int i = arr[n-1]; i <= M; ++i) {
        arr.push_back(i);
        ret=max(ret,dfs(n+1));
        arr.pop_back();
    }
    return ret;
}

void solve(int ca){
    cin>>N>>M>>Q;
    for (int i = 0; i < Q; ++i) {
        cin>>a[i]>>b[i]>>c[i]>>d[i];
        a[i]--; b[i]--;
        to[b[i]].push_back(i);
    }
    vector<int> tmp;
    ll ans=dfs(0);
    cout<<ans<<endl;
}

//#define MULTI
int main() {
#ifdef MULTI
    int N; cin>>N;
    for (int i = 0; i < N; ++i) {
        solve(i+1);
    }
#else
    solve(0);
#endif
    return 0;
}


Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int a,b;
int main(){
	cin>>a>>b;
	for(int i=1;i<=1e7;i++)if((int)(i*0.08)==a&&(int)(i*0.1)==b)cout<<i,exit(0);
    puts("-1");
	return 0;
}

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

using namespace std;
template <typename T> using V = vector<T>;

int n;
map<int, int> s;
V<int> a;

int solve(int x) {
    if (s[x] == 0) return 0;
    s[x]--;
    for (int d = 30; d >= 0; d--) {
        int u = 1 << d;
        if (u <= x) break;
        if (s[u - x] != 0) {
            s[u - x]--;
            return 1;
        }
    }
    return 0;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    a = V<int>(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        s[a[i]]++;
    }
    sort(begin(a), end(a), greater<int>());

    int ans = 0;
    for (int i = 0; i < n; i++) ans += solve(a[i]);
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 29824
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptor/reversed.hpp>
#include<boost/operators.hpp>
#include<boost/dynamic_bitset.hpp>
namespace adaptor = boost::adaptors;
template<class T>using p_queue = std::priority_queue<T, std::vector<T>, std::greater<>>;

void Main()
{
	double W, H, x, y;
	std::cin >> W >> H >> x >> y;
	auto m = W * H / 2;
	auto f = (x == W / 2 && y == H / 2) ? 1 : 0;
	std::cout << m << " " << f << std::endl;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}

Measured memory_bytes: 256
N, M = 6, 9
ARR = [
    [3, 4],
    [6, 1],
    [2, 4],
    [5, 3],
    [4, 6],
    [1, 5],
    [6, 2],
    [4, 5],
    [5, 6],
]

N, M = 4, 4
ARR = [
    [1, 2],
    [2, 3],
    [3, 4],
    [4, 2],
]

N, M = map(int, input().split())
ARR = []

for i in range(M):
    ARR.append(list(map(int, input().split())))

from collections import deque


def prepare(n, m, arr):
    nodes = [[] for i in range(n)]
    nodeStates = [-1 for i in range(n)]
    prevs = [-1 for i in range(n)]
    for i in range(m):
        startNode = arr[i][0] - 1
        endNode = arr[i][1] - 1

        nodes[startNode].append(endNode)
        nodes[endNode].append(startNode)

    return nodes, nodeStates, prevs


nodes, nodeStates, prevs = prepare(N, M, ARR)


def bfs(nodes, nodeStates, prevs, n):
    q = deque()
    q.append({'prev': -1, 'to': 0})
    while len(q) > 0:
        first = q.popleft()
        currentNode = first['to']
        previousNode = first['prev']
        if nodeStates[currentNode] != -1:
            continue
        prevs[currentNode] = previousNode
        childNodes = nodes[currentNode]
        nodeStates[currentNode] = 1
        for childNode in childNodes:
            q.append({'prev': currentNode, 'to': childNode})

    print("Yes")
    for i in range(1, n):
        print(prevs[i] + 1)


bfs(nodes, nodeStates, prevs, N)


Measured memory_bytes: 149564
#include <bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 60;

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;
}
int main(){
    string S;
    cin >> S;
    int Ac = 0;
    int flag = 0;
    int smallc = 0;
    if (S[0] != 'A')
    {
        Ac++;
    }
    for (int i = 2; i < S.size() - 1;i++)
    {
        if(S[i] == 'C'){
            flag++;
        }
    }
    for (int i = 0; i < S.size();i++)
    {
        if(S[i] >= 'a' &&S[i] <='z'){
            smallc++;
        }
    }
    if (Ac == 0 && smallc == S.size() - 2&& flag == 1)
    {
        cout << "AC" << endl;
    }
    else{
        cout << "WA" << endl;
    }

}


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

int main(){
  ll N,sum=1;
  cin>>N;
  vector<ll> A(N);
  bool ng=false;
  for(ll i=0; i<N; i++){
    cin>>A.at(i);
    if(A.at(i)==0){
      cout<<0<<endl;
      return 0;
    }
    if(ng||1000000000000000000/sum<A.at(i)){
      ng=true;
    }
    sum*=A.at(i);
  }
  if(ng){
    cout<<-1<<endl;
  }
  else{
    cout<<sum<<endl;
  }
}


Measured memory_bytes: 3960
#include <bits/stdc++.h>
using namespace std;
using Int = long long int;
template<typename T> void swap(T *t1, T *t2){ T* tmp=t1; t1=t2; t2=tmp;}
Int tmpi = 0;
double tmpd = 0.0;


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

    Int n, k;
    cin >> n >> k;
    Int cnt=0, h;
    for(Int i=0; i<n; i++){
        cin >> h;
        if(h >= k){
            cnt++;
        }
    }
    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <iostream>
#include <string>
#include <map>
using namespace std;
const int N = 1e6;
int n, A, B;
int a[N];
int count(int x)
{
    int sum = 0;
    while (x)
    {
        sum += (x & 1);
        x >>= 1;
    }
    return sum;
}
void work(int*a, int n, int A, int B)
{
    if (!n)
    {
        a[0] = A;
        return;
    }
    if (n == 1)
    {
        a[0] = A;
        a[1] = B;
        return;
    }
    int sig = 0;
    int AA, BB;
    int x;
    while (1) {
        while (((1 << sig) & A) == ((1 << sig) & B)) sig++;
        AA = (A & ((1 << (sig)) - 1)) + ((A >> (sig + 1)) << (sig));
        BB = ((B & ((1 << (sig)) - 1)) + ((B >> (sig + 1)) << (sig)));
        x = 1;
        while ((AA ^ x) == BB && x <= (1 << (n - 2)) ) x <<= 1;
        if (x <= (1 << (n - 2))) break;
    }
    work(a, n - 1, AA, (AA ^ x));

    work(a + (1 << (n - 1)), n - 1, (AA ^ x), BB);
    for (int i = 0; i < (1 << (n - 1)) ; i ++)
        a[i] = ((a[i] >> (sig)) << (sig + 1)) + (a[i] & ((1 << (sig)) - 1)) + (A & (1 << sig));
    for (int i = (1 << (n - 1)); i < (1 << n) ; i ++)
        a[i] = ((a[i] >> (sig)) << (sig + 1)) + (a[i] & ((1 << (sig)) - 1)) + (B & (1 << sig));
}
int main(){
    scanf("%d %d %d", &n, &A, &B);
    if ((count(A) &1) == (count(B) & 1))
    {
        printf("NO");
        return 0;
    }
    work(a, n, A, B);
    printf("YES\n");
    for (int i = 0; i < (1 << n); i ++)
        printf("%d ", a[i]);
    return 0;
}

Measured memory_bytes: 1536
#include <stdio.h>
#define MAX 10000
int main(void){
        int i,j;
        int a[MAX+1];
        int counter = 0;
	int cp_counter;
        int n;
	a[1] = 1;
	for(i = 2; i <= MAX; i++){
		a[i] = 0;
	}
	for(i = 2; i <= MAX; i++){
		if(a[i]){continue;}
		for(j = i; j <= MAX; j += i){
			if(j == i){a[i] = 0;}
			else{a[j] = 1;}
		}
	}

        while(scanf("%d",&n) != EOF){
		cp_counter = 0;
		for(i = 1; i <= n/2; i++){
			if(!a[i] && !a[n-i+1]){
				cp_counter++;
			}
		}
		cp_counter *= 2;
		if(n % 2 == 1){
			if(!a[n/2 + 1]){
				cp_counter++;
			}
		}
		printf("%d\n",cp_counter);
        }
        return 0;
}

Measured memory_bytes: 0
while True:

    N = int(input())
    if N == 0:
        break

    for l in range(N):
        m,e,j = [int(i) for i in input().split()]

        ans = ""
        if m == 100 or e == 100 or j == 100:
            ans = "A"
        elif m + e >= 180:
            ans = "A"
        elif m + e + j >= 240:
            ans = "A"
        elif m + e + j >= 210:
            ans = "B"
        elif (m + e + j >= 150) and (m >= 80 or e >= 80):
            ans = "B"
        else:
            ans = "C"

        print(ans)



Measured memory_bytes: 5620
#include"bits/stdc++.h"
#include<cassert>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long inf = 1ll << 62;
typedef pair<int, int> P;
typedef pair<P, int> PP;
int sum[605][605];
int rwa[605][605];

int query(int ai, int aj, int bi, int bj) {//ai+1~ai
	return rwa[bi][bj] + rwa[ai][aj] - rwa[ai][bj] - rwa[bi][aj];
}

signed main() {
	int h, w; cin >> h >> w;
	rep(i, h) {
		string s; cin >> s;
		rep(j, w) {
			if (s[j] == '#') {
				sum[i + j][i - j+w]++;
			}
		}
	}
	rep(i, h + w) {
		rep(j, h + w) {
			rwa[i + 1][j + 1] += sum[i][j];
		}
	}
	rep(i, 603)rep(j, 603)rwa[i + 1][j] += rwa[i][j];
	rep(i, 603)rep(j, 603)rwa[i][j + 1] += rwa[i][j];

	int cnt = 0;
	rep(i, h + w) {
		vector<int>V;
		rep(j, h + w) {
			if (sum[i][j])V.push_back(j);
		}
		rep(j, V.size()) {
			for (int k = j + 1; k < V.size(); k++) {
				int l = V[j], r = V[k];
				if (i - r + l >= 0)cnt += query(i - r + l, l, i - r + l + 1, r + 1);
				if (i + r - l <= h + w)cnt += query(i + r - l, l, i + r - l + 1, r + 1);
			}
		}
	}

	rep(j, h + w) {
		vector<int>V;
		rep(i, h + w) {
			if (sum[i][j])V.push_back(i);
		}
		rep(i, V.size()) {
			for (int k = i + 1; k < V.size(); k++) {
				int u = V[i], d = V[k];
				if (j - d + u >= 0)cnt += query(u+1, j - d + u, d, j - d + u + 1);
				if (j + d - u <= h + w)cnt += query(u + 1, j + d - u, d, j + d - u + 1);
			}
		}
	}
	cout <<cnt << endl;
}


Measured memory_bytes: 5888
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	Scanner sc = new Scanner(System.in);
	int N, M;
	int INF = Integer.MAX_VALUE / 2;
	int[][] graph, memo;

	void run() {
		N = sc.nextInt(); // edge number
		M = sc.nextInt(); // vertex number
		graph = new int[N][N];
		memo = new int[N][1 << N];
		for (int i = 0; i < N; i++) {
			Arrays.fill(graph[i], INF);
			Arrays.fill(memo[i], -1);
		}
		for (int i = 0; i < M; i++) {
			int s = sc.nextInt();
			int t = sc.nextInt();
			int cost = sc.nextInt();
			graph[s][t] = cost;
		}
		int res = tsp(0, 1);
		System.out.println(res == INF ? -1 : res);
	}

	int tsp(int v, int mask) {
		if (memo[v][mask] != -1)  return memo[v][mask];
		if (mask == (1 << N) - 1) return graph[v][0];

		int res = INF;
		for (int i = 0; i < N; i++) {
			if ((mask & (1 << i)) != 0) continue;
			res = Math.min(res, graph[v][i] + tsp(i, mask | (1 << i)));
		}
		return memo[v][mask] = res;
	}

	public static void main(String[] args) {
		new Main().run();
	}
}


Measured memory_bytes: 31780
#include <bits/stdc++.h>
using namespace std;
using LL = long long int;
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define dec(i, n)  decID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define FI first
#define SE second
#define FR front()
#define BA back()
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
auto setmin   = [](auto & a, auto b) { return (b <  a ? a = b, true : false); };
auto setmax   = [](auto & a, auto b) { return (b >  a ? a = b, true : false); };
auto setmineq = [](auto & a, auto b) { return (b <= a ? a = b, true : false); };
auto setmaxeq = [](auto & a, auto b) { return (b >= a ? a = b, true : false); };
#define SI(v) static_cast<int>(v.size())
#define RF(e, v) for(auto & e: v)
#define until(e) while(! (e))
#define if_not(e) if(! (e))
#define ef else if
#define UR assert(false)
#define IN(T, ...) T __VA_ARGS__; IN_(__VA_ARGS__);
void IN_() { };
template<typename T, typename ... U> void IN_(T &  a, U &  ... b) { cin >> a; IN_(b ...); };
template<typename T                > void OUT(T && a            ) { cout << a << endl; }
template<typename T, typename ... U> void OUT(T && a, U && ... b) { cout << a << " "; OUT(b ...); }

// ---- ----

template<typename T> T MV(T v) { return v; }
template<typename T, typename ... U> auto MV(T v, int a, U ... b) { return vector<decltype(MV(v, b ...))>(a, MV(v, b ...)); }

#define bit(b, i) (((b) >> (i)) & 1)
#define PC __builtin_popcountll
#define BL(a) (a ? 64 - __builtin_clzll(a) : 0)

int main() {
	const int B = 11;
	const int M = 100'000;
	
	IN(int, n);
	vector<int> v(n + 1), w(n + 1);
	inc1(i, n) { cin >> v[i] >> w[i]; }
	
	auto dp = MV(0, 1 << B, M + 1);
	inc(i, 1 << B) {
		int p = i;
		if(p > n) { break; }
		
		vector<int> a;
		until(p == 0) {
			a.PB(p);
			p /= 2;
		}
		
		inc(b, 1 << SI(a)) {
			int vs = 0, ws = 0;
			inc(j, SI(a)) { if(bit(b, j) == 1) { vs += v[a[j]]; ws += w[a[j]]; } }
			if(ws <= M) { setmax(dp[i][ws], vs); }
		}
		inc1(j, M) { setmax(dp[i][j], dp[i][j - 1]); }
	}
	
	IN(int, q);
	inc(qq, q) {
		IN(int, p, L);
		if(p < (1 << B)) { OUT(dp[p][L]); continue; }
		
		vector<int> a;
		until(BL(p) == B) {
			a.PB(p);
			p /= 2;
		}
		
		int ans = 0;
		inc(b, 1 << SI(a)) {
			int vs = 0, ws = 0;
			inc(j, SI(a)) { if(bit(b, j) == 1) { vs += v[a[j]]; ws += w[a[j]]; } }
			if(ws <= L) { setmax(ans, vs + dp[p][L - ws]); }
		}
		OUT(ans);
	}
}


Measured memory_bytes: 808468
#include<iostream>
#include<algorithm>
using namespace std;
int d[200004], t[200004];
int main(){
int n;
cin>>n;
for(int i=0;i<n;i++)
cin>>d[i];
int m;
cin>>m;
for(int i=0;i<m;i++)
    cin>>t[i];
sort(t,t+m);
sort(d, d+n);
int j=0;
for(int i=0;i<m;i++)
{
    bool ok=0;
    for( j;j<n;j++)
    {
        if(d[j]==t[i])
        {
            ok=1;
            d[j]=-1;
            break;
        }
    }
    if(!ok)
    {
        cout<<"NO\n";
        return 0;
    }
}
cout<<"YES\n";
return 0;
}


Measured memory_bytes: 1792
#include<iostream>
using namespace std;
int main(){
    int i,j;
    int r,c;
    int b;
    cin >> r >> c;
    int rsum[100]={};
    int csum[100]={};
    int sum=0;
    for(i=0;i<r;i++){
        cin >> b;
        cout << b;
        rsum[i]+=b;
        csum[0]+=b;
        for(j=1;j<c;j++){
                cin >> b;
                cout <<" " << b;
                rsum[i]+=b;
                csum[j]+=b;
            }
            cout << " " << rsum[i] << endl;
            sum+=rsum[i];
    }
    cout << csum[0];
    for(j=1;j<c;j++){
        cout << " " << csum[j];
    }
    cout << " " << sum <<endl;
    return 0;
}



Measured memory_bytes: 3116
#include <bits/stdc++.h>
#define inf 0x3f3f3f3f
#define m_k make_pair
#define int long long
using namespace std;
const int N=1e5+100;
int n,m,k,a[N],b[N],f[N],c[N];
int fa[N][64],sum[N];
signed main()
{
	scanf("%lld",&n);
	for (int i=1;i<=n;i++) scanf("%lld",&f[i]);
	scanf("%lld%lld",&m,&k);
	for (int i=1;i<=m;i++) scanf("%lld",&a[i]);
	for (int i=1;i<=n;i++) b[i]=i;
	for (int i=1;i<=m;i++) swap(b[a[i]],b[a[i]+1]);
	for (int i=1;i<=n;i++) fa[i][0]=b[i];
	for (int j=1;j<=62;j++)
	{
		for (int i=1;i<=n;i++) fa[i][j]=fa[fa[i][j-1]][j-1];
	}
	for (int i=1;i<=n;i++)
	{
		int cnt=k,x=i;
		for (int j=62;j>=0;j--)
		{
			if (cnt>=(1ll<<j))
			{
				cnt-=(1ll<<j);
				x=fa[x][j];
			}
		}
		if (x==1) c[i]=f[x];
		else c[i]=f[x]-f[x-1];
	}
	for (int i=1;i<=n;i++) sum[i]=sum[i-1]+c[i];
	for (int i=1;i<=n;i++)
	{
		double ans=sum[i];
		printf("%.12lf\n",ans);
	}
}

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

int main(){
  int N;
  cin >> N;
  int AC=0,WA=0,TL=0,RE=0;
  string A;
  for (int i=0; i<N; i++){
    cin >> A;
    if(A.at(0) == 'A')
      AC++;
    if(A.at(0) == 'W')
      WA++;
    if(A.at(0) == 'T')
      TL++;
    if(A.at(0) == 'R')
      RE++;
  }
  cout << "AC x " << AC << endl;
  cout << "WA x " << WA << endl;
  cout << "TLE x " << TL << endl;
  cout << "RE x " << RE << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s; cin >> s;
  long long k; cin >> k;
  for(int i = 0; i < k; i++) {
    if(s[i] != '1') {
      cout << s[i] << endl;
      return 0;
    }
  }
  cout << '1' << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main(int argc, char *argv[]){
    char s[11];
    char t[11];
    char u[11];
    int ball[2];

    scanf("%s %s", s,t);
    scanf("%d %d", ball, ball+1);
    scanf("%s", u);

    if(strcmp(s, u) == 0){
        ball[0]--;
    }else{
        ball[1]--;
    }

    printf("%d %d", ball[0],ball[1]);
    return 0;
}

Measured memory_bytes: 128
// Author: HarshKumar

#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
const ll N = 1e6 + 6, M = 1e9 + 7;
struct DSU
{
    int parts;
    vector<int> rt, sz;

    DSU(int n)
    {
        rt.resize(n + 1);
        sz.resize(n + 1, 1);
        iota(rt.begin(), rt.end(), 0);
        parts = n;
    }

    int root(int k)
    {
        while (k != rt[k])
            k = rt[k] = rt[rt[k]];
        return k;
    }

    void U(int u, int v)
    {
        int r1 = root(u), r2 = root(v);
        if (r1 == r2)
            return;
        parts--;
        if (sz[r1] > sz[r2])
            swap(r1, r2);
        sz[r2] += sz[r1];
        sz[r1] = 0;
        rt[r1] = rt[r2];
    }
};
set<ll> g[N], h[N];
int main()
{
    ios::sync_with_stdio(false), cin.tie(nullptr);
    ll n, m, k, u, v;
    cin >> n >> m >> k;
    DSU d(n);
    while (m--)
        cin >> u >> v, u--, v--, g[u].insert(v), g[v].insert(u), d.U(u, v);
    while (k--)
        cin >> u >> v, u--, v--, h[u].insert(v), h[v].insert(u);
    for (ll i = 0; i < n; i++)
    {
        ll x = d.sz[d.root(i)] - 1 - g[i].size();
        for (ll e : h[i])
            if (d.root(e) == d.root(i) && g[i].find(e) == g[i].end())
                x--;
        cout << x << ' ';
    }
}

Measured memory_bytes: 114176
#include<stdio.h>
#include<string.h>

#define SIGN_LENGTH 9
#define CIPHER_NUM 32
#define CODE_MAX 801
#define NUL 0x00
#define INITIALIZE 0
#define TEXT_LENGTH_MAX 101
#define FIVE 5

typedef struct cipher
{
	char charcter_change_sign[SIGN_LENGTH];
	char sign_change_charcter[FIVE + 1];
	char charcter;
}CIPHER;

int main(void)
{
	
	CIPHER code[CIPHER_NUM] = {
		{"100101", "00000", 'A'},
		{"10011010", "00001", 'B'},
		{"0101", "00010", 'C'},
		{"0001", "00011", 'D'},
		{"110", "00100", 'E'},
		{"01001", "00101", 'F'},
		{"10011011", "00110", 'G'},
		{"010000", "00111", 'H'},
		{"0111", "01000", 'I'},
		{"10011000", "01001", 'J'},
		{"0110", "01010", 'K'},
		{"00100", "01011", 'L'},
		{"10011001", "01100", 'M'},
		{"10011110", "01101", 'N'},
		{"00101", "01110", 'O'},
		{"111", "01111", 'P'},
		{"10011111", "10000", 'Q'},
		{"1000", "10001", 'R'},
		{"00110", "10010", 'S'},
		{"00111", "10011", 'T'},
		{"10011100", "10100", 'U'},
		{"10011101", "10101", 'V'},
		{"000010", "10110", 'W'},
		{"10010010", "10111", 'X'},
		{"10010011", "11000", 'Y'},
		{"10010000", "11001", 'Z'},
		{"101", "11010", ' '},
		{"010001", "11011", '.'},
		{"000011", "11100", ','},
		{"10010001", "11101", '-'},
		{"000000", "11110", '\''},
		{"000001", "11111", '?'}
	};
	
	unsigned short i = INITIALIZE;
	unsigned short j = INITIALIZE;
	unsigned short k = INITIALIZE;
	char input_text[TEXT_LENGTH_MAX];
	
	
	for(i = 0; i < TEXT_LENGTH_MAX; i++)
	{
		input_text[i] = NUL;
	}
	
	while(gets(input_text) != NULL)
	{
		unsigned short text_length = INITIALIZE;
		unsigned short barcode_length = INITIALIZE;
		unsigned short count = INITIALIZE;
		unsigned short c = 0;
		unsigned short match_count = 0;
		char barcode[CODE_MAX];
		char code_fivecut[CODE_MAX / FIVE][FIVE];/*160:5*/
		
		for(i = 0; i < CODE_MAX - 1; i++)//配列の最後(800番目)には\0が入るためマイナス1してある
		{
			barcode[i] = NUL;
		}
		
		for(i = 0; i < CODE_MAX / FIVE;i++)
		{
			for(j = 0; j < 5; j++)
			{
				code_fivecut[i][j] = '0';
			}
		}
		
		for(i = 0; i < TEXT_LENGTH_MAX; i++)
		{
			text_length++;
			if(input_text[i] == NUL)
			{
				break;
			}
		}
		
		for(i = 0; i < text_length; i++)
		{
			for(j = 0; j < CIPHER_NUM; j++)
			{
				if(input_text[i] == code[j].charcter)
				{
					strcat(barcode, code[j].charcter_change_sign);
				}
			}
		}
		
		for(i = 0; i < CODE_MAX; i++)
		{
			barcode_length++;
			if( barcode[barcode_length] == '\0')
			{
				break;
			}
		}
		
		for(i = 0; i < barcode_length; i++)
		{
			for(j = 0; j < FIVE; j++)
			{
				if(c < barcode_length)
				{
					code_fivecut[i][j] =  barcode[c];
					c++;
				}
			}
		}
		
		for(i = 0;i < CODE_MAX ; i+= FIVE)
		{
			if(barcode_length <= i)
			{
				count = i / FIVE;
				break;
			}
		}
		
		for(i = 0; i < count; i++)
		{
			for(j = 0; j < CIPHER_NUM; j++)
			{
				for(k = 0; k < FIVE; k++)
				{
					if(code_fivecut[i][k] == code[j].sign_change_charcter[k])
					{
						match_count++;
					}
				}
				if(match_count == FIVE)
				{
					printf("%c",code[j].charcter);
				}
				match_count = 0;
			}
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 520