akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb push_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef multiset<ll> S;
typedef priority_queue<ll> PQ;
typedef priority_queue<P,vector<P>,greater<P>> SPQ;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
using vp=vector<P>;
using vvp=vector<vp>;
using vb=vector<bool>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())outp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size()){rep(j,v[i].size()){if(j)cout<<' ';cout<<v[i][j];}cout<<'\n';}}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll modpow(ll a,ll b){a%=mod;if(b==0)return 1;if(b&1)return a*modpow(a,b-1)%mod;ll k=modpow(a,b/2);return k*k%mod;}

int main(){
    string s;cin>>s;
    ll n=s.size();
    ll ans=0;
    ll cnt=0;
    rep(i,n){
        if(s[i]=='B')cnt++;
        else ans+=cnt;
    }
    out(ans);
}

Measured memory_bytes: 640
// {{{
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
// }}}

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

static constexpr int mod = (int)1e9 + 7;
static constexpr int inf = 100100100;
static constexpr ll linf = 1e18;
static constexpr double eps = 1e-9;
static constexpr double pi = 3.14159265359;

#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rrep(i, n) for (ll i = n; i >= 0; --i)
#define all(c) begin(c), end(c)
#define rall(c) rbegin(c), rend(c)
#define pb push_back
#define ist insert
#define fst first
#define snd second


template <typename T>
vector<T> trial_division(T num) {
    assert(num > 1);
    vector<T> factor;
    T n = sqrt(num) + 1;
    for (T i = 2; i < n; ++i) {
        while (num % i == 0) {
            num /= i;
            factor.push_back(i);
        }
    }
    if (num > 1) {
        factor.push_back(num);
    }
    return factor;
}

int main() {
    // cin.tie(0);
    // ios_base::sync_with_stdio(false);
    ll N;
    cin >> N;
    if (N == 1) {
        cout << 1 << endl;
        return 0;
    }
    auto D = trial_division(N);
    ll ans = linf;
    for (ll i = 0; i < (1 << D.size()); ++i) {
        ll A = 1;
        ll B = 1;
        for (ll j = 0; j < D.size(); ++j) {
            if ((1 << j) & i) {
                A *= D[j];
            } else {
                B *= D[j];
            }
        }
        ans = min(ans,
                  (ll)max(to_string(A).size(), to_string(B).size()));
    }
    cout << ans << endl;
}



Measured memory_bytes: 632
#ifdef LOCAL111
#else
	#define NDEBUG
#endif
#include <bits/stdc++.h>

using namespace std;

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define RBP(i,a) for(auto& i : a)
#ifdef LOCAL111
	#define DEBUG(x) cout<<#x<<": "<<(x)<<endl
#else
	#define DEBUG(x) true
#endif
#define F first
#define S second
#define SNP string::npos
#define WRC(hoge) cout << "Case #" << (hoge)+1 << ": "
#define INF 1e8
#define rangej(a,b,c) ((a) <= (c) and (c) < (b))
#define rrangej(b,c) rangej(0,b,c)
template<typename T> void pite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}

typedef pair<int,int> P;
typedef long long int LL;
typedef unsigned long long ULL;
typedef pair<LL,LL> LP;

void ios_init(){
	//cout.setf(ios::fixed);
	//cout.precision(12);
#ifdef LOCAL111
	return;
#endif
	ios::sync_with_stdio(false); cin.tie(0);	
}

typedef vector<int> vi;

int main()
{
	ios_init();
	int n,m;
	while(cin >> n >> m and n != 0){
		int r;
		cin >> r;
		vector<vi> st(m,vi(1261,0));
		REP(i,r){
			bool s;
			int pn;
			int sm;
			int ti;
			cin >> ti >> pn >> sm >> s;
			ti--;
			sm--;
			if(s){
			//	DEBUG(ti);
				st[sm][ti]++;
			}else{
				st[sm][ti]--;
			}
		}
		REP(i,m) {
			FOR(j,1,SZ(st[i])){
				st[i][j] += st[i][j-1];
			//	cout << st[i][j];
			}
			//cout << endl;
		}
		//REP(i,m) pite(ALL(st[i]));
		int q;
		cin >> q;
		REP(i,q){
			int ts,te,ms;
			int ans = 0;
			cin >> ts >> te >> ms;
			ts--;
			te--;
			ms--;
			FOR(j,ts,te){
				ans += bool(st[ms][j]);
			}
			cout << ans << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 50868
#include<bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
#define fi first
#define se second
#define mp make_pair
const int N=200005;
int a[N],n,l;
struct segment{
	int Flag;
	struct Tree{
		int l,r,num;
	}T[N*4];
	void build(int x,int l,int r){
		T[x].l=l;T[x].r=r;
		if (l==r){
			T[x].num=(l&1)==Flag?l:0;
			return;
		}
		int mid=(l+r)/2;
		build(x*2,l,mid);
		build(x*2+1,mid+1,r);
		if (a[T[x*2].num]<a[T[x*2+1].num])T[x].num=T[x*2].num;
		else T[x].num=T[x*2+1].num;
	}
	int find(int x,int l,int r){
		if (T[x].l>r||l>T[x].r)return 0;
		if (T[x].l>=l&&T[x].r<=r)return T[x].num;
		int ans1=find(x*2,l,r),ans2=find(x*2+1,l,r);
		if (a[ans1]<a[ans2])return ans1;
		return ans2;
	}
}T[2];
struct Ask{
	int l,r;
	pii Ans;
	Ask(int _l=0,int _r=0,pii _Ans=mp(0,0)){l=_l;r=_r;Ans=_Ans;}
	bool operator < (const Ask &b)const {
		return a[Ans.fi]<a[b.Ans.fi]||(a[Ans.fi]==a[b.Ans.fi]&&a[Ans.se]<a[b.Ans.se]);
	}
}f[N];
pii get(int l,int r){
	pii ans;
	ans.fi=T[l&1].find(1,l,r);
	ans.se=T[(l&1)^1].find(1,ans.fi,r);
	return ans;
}
void up(int x){
	if (x==1)return;
	if (f[x]<f[x/2]){
		swap(f[x],f[x/2]);
		up(x/2);
	}
}
void down(int x){
	int i=x;
	if (x*2<=l&&f[x*2]<f[x])i=x*2;
	if (x*2<l&&f[x*2+1]<f[i])i=x*2+1;
	if (i!=x){
		swap(f[x],f[i]);
		down(i);
	}
}
int main(){
	scanf("%d",&n);
	for (int i=1;i<=n;i++)scanf("%d",&a[i]);
	a[0]=1e9;
	T[0].Flag=0;T[1].Flag=1;
	T[0].build(1,1,n);
	T[1].build(1,1,n);
	f[++l]=Ask(1,n,get(1,n));
	while (l){
		printf("%d %d ",a[f[1].Ans.fi],a[f[1].Ans.se]);
		Ask now=f[1];
		f[1]=f[l--];
		down(1);
		if (now.l!=now.Ans.fi)f[++l]=Ask(now.l,now.Ans.fi-1,get(now.l,now.Ans.fi-1)),up(l);
		if (now.Ans.fi+1!=now.Ans.se)f[++l]=Ask(now.Ans.fi+1,now.Ans.se-1,get(now.Ans.fi+1,now.Ans.se-1)),up(l);
		if (now.Ans.se!=now.r)f[++l]=Ask(now.Ans.se+1,now.r,get(now.Ans.se+1,now.r)),up(l);
	}
}


Measured memory_bytes: 22144
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
 
using namespace std;
 
int main()
{
    int A, B;
    cin >> A >> B;

    int result = 0;
    for (int i=0; i<20; i++) {
        if (B == 1) {break;}
        B = B-A;
        result++;
        if (B <= 0) {break;}
        B++;
    }
    cout << result;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		//		new Main().solveA();
		//		new Main().solveB();
		new Main().solveC();
		// new Main().solveD();
	}

	private void solveA() {
		Scanner scanner = null;
		int numA = 0;
		int numB = 0;

		try {
			scanner = new Scanner(System.in);
			numA = scanner.nextInt();
			numB = scanner.nextInt();

			if (numA * numB % 2 == 0) {
				System.out.println("Even");
			} else {
				System.out.println("Odd");
			}

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveB() {
		Scanner scanner = null;
		String numA = "";
		String numB = "";

		try {
			scanner = new Scanner(System.in);
			numA = scanner.next();
			numB = scanner.next();

			double wkNum = Double.parseDouble(numA + numB);
			int wk = (int) Math.sqrt(wkNum);
			if (Math.pow(wk, 2) == wkNum) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveC() {
		Scanner scanner = null;
		int numN = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();
			int[] t = new int[numN];
			int[] x = new int[numN];
			int[] y = new int[numN];

			for (int i = 0; i < t.length; i++) {
				t[i] = scanner.nextInt();
				x[i] = scanner.nextInt();
				y[i] = scanner.nextInt();
			}

			int cT = 0;
			int cX = 0;
			int cY = 0;
			for (int i = 0; i < numN; i++) {

				boolean wkB = (t[i] % 2 == 0);
				boolean wkB2 = ((x[i] + y[i]) % 2 == 0);

				if (wkB != wkB2) {
					System.out.println("No");
					return;
				}

				if (t[i] - cT < Math.abs(Math.abs(cX + cY) - Math.abs(x[i] + y[i]))) {
					System.out.println("No");
					return;
				} else {
				}
				cT = t[i];
				cX = x[i];
				cY = y[i];
			}

			System.out.println("Yes");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveD() {
		Scanner scanner = null;
		int numN = 0;
		int numK = 0;
		int numS = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}
}

Measured memory_bytes: 91304
#include <stdio.h>

typedef struct tagS_RECTANGLE {
	int H;
	int W;
} S_RECTANGLE;

int main( void )
{
	S_RECTANGLE sRectangle;
	int i;
	int j;

	while( 1 ){
		scanf( "%d %d", &sRectangle.H, &sRectangle.W );
		if( sRectangle.H == 0 && sRectangle.W == 0 ){
			break;
		}
		for( i = 0; i < sRectangle.H; i++ ){
			for( j = 0; j < sRectangle.W; j++ ){
				if( i == 0					||
					i == sRectangle.H - 1	||
					j == 0					||
					j == sRectangle.W - 1 ){
					printf("#");
				}else{
					printf(".");
				}
			}
			printf("\n");
		}
		printf("\n");
	}

	return 0;
}

Measured memory_bytes: 572
<?php
# スペース区切りの整数の入力
fscanf(STDIN, "%d %d %d", $n, $x, $t);

$result = ($n / $x);
if ($n % $x !== 0) {
    $result = intval($result) + 1;
}
echo $result * $t.PHP_EOL;



Measured memory_bytes: 16148
# 金額を取得
money = int(input())

# 嬉しさ指数を計算し出力
hcnt_500 = money // 500
money = money - (hcnt_500 * 500)
hcnt_5 = (money // 5)
hcnt = (hcnt_500 * 1000) + (hcnt_5 * 5)
print(hcnt)

Measured memory_bytes: 9160
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vd = vector<double>;
using vvd = vector<vector<double>>;
using vvvd = vector<vector<vector<double>>>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vs = vector<string>;
using pint = pair<int, int>;
using Graph = vvi;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
bool cmp(pint a, pint b) {return a.second < b.second;}

int main() {
    int n, k;
    cin >> n >> k;

    vll h(n);
    rep(i, n) cin >> h[i];

    sort(all(h));

    ll sum = 0;
    for(int i = n - 1; i >= 0; i--) {
        if(k > 0) {
            k--;
            continue;
        }
        sum += h[i];
    }

    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 1792
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using ll = long long;
const int INF = 1e9 + 5;

void min_self(int &a, int b){
	a = min(a,b);
	}
int main(){
	int n, k;
	scanf("%d%d",&n, &k);
	vector<int> h(n);
	for(int& x: h){
		scanf("%d",&x);
		}
	vector<int> dp(n, INF);
	dp[0] = 0;
	for(int i = 0 ; i < n; ++i){
		for(int j = i + 1; j <= i + k; ++j){
			if(j < n){
				min_self(dp[j], dp[i] + abs(h[i] - h[j]));
				}
			}
		}
	printf("%d",dp[n - 1]);
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int ans = 1;
    int N;
    cin >> N;
    for(int i = 1; i <= N; i*=2){
        ans = i;
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<bits/stdc++.h>
typedef long long int ll;
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOR_IN(i, a, b) for(int i = (a); i < (b); i++)
#define BETWEEN(x, a, b) ((x) >= (a) && (x) <= (b))
#define BIT(b, i) (((b) >> (i)) & 1)
#define LOG_F 1
#define LOG(...) if(LOG_F) fprintf(stderr, __VA_ARGS__)

using namespace std;

ll pow(int x, int n){
  return n == 0 ? 1 : x * pow(x, n - 1);
}

const ll INF = 2 * pow(10,14);
/*
n
a1 ... a3n

n 10^5
ai 10^9
 */
int n;
int a[300000];
ll lsum[300000], rsum[300000];
  
int main(){
  cin>>n;
  REP(i,3*n){
    cin>>a[i];
  }

  REP(i,n){
    lsum[n-1]+=a[i];
    rsum[2*n-1]+=a[3*n-1-i];
  }

  priority_queue<int, vector<int>, greater<int>> ql(a, a+n);
  priority_queue<int> qr(a+2*n, a+3*n);

  FOR_IN(k,n,2*n){
    ql.push(a[k]);
    int m = ql.top();
    ql.pop();
    lsum[k] = lsum[k-1] + a[k] - m;
  }

  for(int k=2*n-2; k >= n-1; k--){
    qr.push(a[k+1]);
    int m=qr.top();
    qr.pop();
    rsum[k] = rsum[k+1] + a[k+1] - m;
  }

  ll ans = -INF;
  FOR_IN(k,n-1,2*n){
    ans = max(ans, lsum[k] - rsum[k]);
  }

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


Measured memory_bytes: 4992
mod = 10**9+7
n,a,b=map(int, input().split())
total = pow(2, n, mod) - 1
comb1 = 1
for i in range(n-a+1, n+1):
    comb1*=i
    comb1%=mod
for i in range(1, a+1):
    comb1*=pow(i, mod-2, mod)
    comb1%=mod
comb2 = 1
for i in range(n-b+1, n+1):
    comb2*=i
    comb2%=mod
for i in range(1, b+1):
    comb2*=pow(i, mod-2, mod)
    comb2%=mod
ans = total - comb1 - comb2
print(ans%mod)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
    #define rep(i,n) for (int i= 0;i<(n);++i)
    using namespace std;
    typedef long long ll;
    typedef pair<int,int> P;
     
     
    int main(){
      int a,b,c,d;
      cin>>a>>b>>c>>d;
     
      bool wint =false;
      while(a>0){
        c-=b;
        if(c<=0){
          wint =true;
          break;
        }
        a-=d;
     
      }
      if(wint){
        cout<<"Yes"<<endl;
      }
      else{
        cout<<"No"<<endl;
      }
     
    }

Measured memory_bytes: 3624
#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++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    ll n, m, x;
    cin >> n >> m >> x;
    vll vec(m);
    REP(i, m) cin >> vec.at(i);

    ll count_left = 0;
    for (int i = 0; i < x; i++) {
        if (find(ALL(vec), i) != vec.end()) {
            count_left++;
        }
    }

    ll count_right = 0;
    for (int i = x + 1; i <= n; i++) {
        if (find(ALL(vec), i) != vec.end()) {
            count_right++;
        }
    }
    ll ans = count_left < count_right ? count_left : count_right;
    cout << ans << endl;
    return 0;
}

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


//M-SOLUTIONS プロコンオープン
//C-Marks
int main() {
    int n,k; cin >> n >> k;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    for(int i = k; i < n; i++) {
        cout << (a[i-k] < a[i]? "Yes" : "No") << endl;
    }
}


Measured memory_bytes: 4056
#include <iostream>

using namespace std;

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

  int r = N / (2 * D + 1);

  if (r * (2 * D + 1) == N) {
    cout << r << endl;
  } else {
    cout << r + 1 << endl;
  }
  return 0;
}

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

using namespace std;

using ll = long long;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORE(i, a, b) for (int i = (a); i <= (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repe(i, n) for (int i = 0; i <= (n); ++i)
#define ALL(v) (v).begin(), (v).end()
#define SP cout << fixed << setprecision(10)
typedef pair<int, int> P;
const int inf = (int)1e9;
const int mod = (int)1e9 + 7;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

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

    string s;
    cin >> s;

    bool yymm = true, mmyy = true;
    if (!("01" <= s.substr(2, 2) and s.substr(2, 2) <= "12")) yymm = false;
    if (!("01" <= s.substr(0, 2) and s.substr(0, 2) <= "12")) mmyy = false;

    if (yymm and mmyy)
        cout << "AMBIGUOUS" << endl;
    else if (yymm)
        cout << "YYMM" << endl;
    else if (mmyy)
        cout << "MMYY" << endl;
    else
        cout << "NA" << endl;

    return 0;
}

Measured memory_bytes: 256
/*  ex3_4
    UMAboogie */
#include <stdio.h>

int main(void){
  int num;
  scanf("%d\n",&num); //整数を入力
  for(int row = 1;row<= 9;row++){ //九九の各行において判定する
    for(int column = 1;column<= 9;column++){ //i行目のj列を考える
      if(row*column == num){ //もしnumがその行と列の積に等しければその数は九九の中にある
        printf("Yes\n"); //Yesと出力
        return 0; //プログラムを終了
      }
    }
  }
  printf("No\n"); //この時点でnumは九九の中にないのでNoと出力
  return 0;
}


Measured memory_bytes: 128
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>

using namespace std;
using llong = long long;
const int MOD=1000000007;

int main(int argc, char**argv){
    int n;
    cin >> n;
    vector<int> a(n);
    int n_odd = 0;
    for (int i = 0; i < n; i++){
        cin >> a[i];
        if (a[i] % 2 == 1) n_odd++;
    }

    if (n_odd % 2 == 0){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }

    return 0;
}






Measured memory_bytes: 640
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

static void inputString(std::vector<char>& v1)
{
    std::string tmp;

    if (0x00 == &v1) {
        std::cerr << "v1 is null" << std::endl;
        exit (1);
    }

    std::cin >> tmp;
    for (int i = 0; i < tmp.size(); i++) {
        v1.push_back(tmp.at(i));
    }
}

static void reverseString(std::vector<char>& v1, std::vector<char>& v2)
{
    if (0x00 == &v1 || 0x00 == &v2) {
        std::cerr << "v1 or v2 are null." << std::endl;
        exit (1);
    }

    std::reverse_copy(v1.begin(), v1.end(), v2.begin());
}

int main()
{
    std::vector<char> vec1;
    
    inputString(vec1);

    std::vector<char> vec2(vec1.size());
    reverseString(vec1, vec2);
    for (int i = 0; i < vec2.size(); i++) {
        std::cout << vec2.at(i);
    }
    std::cout << std::endl;

    return 0;
}

Measured memory_bytes: 3160
#include <stdio.h>

int main(){
	float x[4],y[4];
	while(scanf("%f %f %f %f %f %f %f %f",&x[0],&y[0],&x[1],&y[1],&x[2],&y[2],&x[3],&y[3]) != EOF){
		if((x[1] - x[0]) * (x[3] - x[2]) + (y[1] - y[0]) * (y[3] - y[2]) == 0) puts("YES");
		else puts("NO");
	}
	return 0;
}

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

int main(){
    int n;
    cin >> n;
    ll x1,t1=0;
    double x2,t2=0;
    string s;
    rep(i,n){
        cin >> x2;
        cin >> s;
        if(s=="JPY"){
            t1+=x2;
        }
        else{
            //cin >> x2;
            t2+=x2;
        }
    }

    double ans=0;
    ans=t1+t2*380000;

    printf("%.10f",ans);

    

    return 0;
}

Measured memory_bytes: 3844
#include <stdio.h>
#include <string.h>
int main()
{
    int l = 0,buf = 0;
    char s[11];
    scanf("%s",s);
    int len = strlen(s);
    for (int i = 0; i < len; i++)
    {
        if((s[i] != 'A') && (s[i] != 'C') && (s[i] != 'G') && (s[i] != 'T'))
        {
            if(l < buf)l = buf;
            buf = 0;
        }
        else
        {
            buf++;
        }
    }
    if(l < buf)l = buf;
    printf("%d",l);
}

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

int main()
{
    ll n;
    cin >> n;
    vector<ll> arr(n);
    map<ll, ll> mp;
    for (int i = 0; i < n; i++)
    {
        cin >> arr[i];
        mp[arr[i] + i]++;
    }
    ll ans = 0;
    for (int j = 0; j < n; j++)
    {
        ans += mp[j - arr[j]];
    }
    cout << ans << endl;
}


Measured memory_bytes: 27460
from sys import stdin
from itertools import combinations_with_replacement
input = stdin.readline

N, M, Q = map(int, input().split())

abcd = [list(map(int, input().split())) for _ in range(Q)]

s = list(range(1, M + 1))
ans = 0


for s in combinations_with_replacement(s, N):
    num = 0
    for q in range(Q):
        a, b, c, d = abcd[q]
        if s[b - 1] - s[a - 1] == c:
            num += d
    ans = max(ans, num)

print(ans)


Measured memory_bytes: 9192
n=int(input())
l=list(map(int,input().split()))

ans_l=[0]*(n+1)
ans=0
def con(a):
    return int(a*(a-1)*0.5)
for i in l:
    ans_l[i]+=1
#print("ans_l",ans_l)
#print("l",l)
for j in ans_l:
    ans+=con(j)
# print(ans)
for i in l:
    ans_2=ans
    # print("ans_2_0:",ans_2)
    #print("ans_l[i]",ans_l[i])
    ans_2-=con(ans_l[i])
    #print("ans_2_1:",ans_2)
    
    #print("ans_l[i]:",ans_l[i]-1)   
    ans_2+=con(ans_l[i]-1)
    print(ans_2)

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

using namespace std;

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define pb push_back
#define fastIO ios::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
typedef long long ll;
typedef double lf;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int main() {
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
#else
    fastIO;
#endif
    int n;
    cin>>n;
    vector<int> v(n);
    forn(i,n)cin>>v[i];
    sort(all(v));
    ll ans=0;
    for(int i=n-1;i>1;i--){
        for(int j=i-1;j>0;j--){
            int c=upper_bound(all(v),v[i]-v[j])-v.begin();
            //cout<<v[i]<<" "<<v[j]<<" "<<v[c]<<" "<<max(0,j-c)<<endl;
            ans+=max(0,j-c);
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3640
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(ll i = m, i##_len = (n); i < i##_len; ++i)
#define reprev(i, n) for(ll i = (n-1LL); i >= 0; --i)
#define all(x) (x).begin(), (x).end()
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; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<ll> a(n);
	rep (i, n) cin >> a[i];
	sort(all(a));
	ll ans = 0;
	if (n % 2 == 0) {
		rep (i, n) {
			if (i < n / 2 - 1) {
				ans -= 2 * a[i];
			} else if (i < n / 2) {
				ans -= a[i];
			} else if (i == n / 2) {
				ans += a[i];
			} else {
				ans += 2 * a[i];
			}
		}
	} else {
		ll tmp = 0;
		// ue n/2 - 1
		rep (i, n) {
			if (i < n / 2 - 1) {
				ans -= 2 * a[i];
			} else if (i < n / 2 + 1) {
				ans -= a[i];
			} else {
				ans += 2 * a[i];
			}
		}
		rep (i, n) {
			if (i < n / 2) {
				tmp -= 2 * a[i];
			} else if (i < n / 2 + 2) {
				tmp += a[i];
			} else {
				tmp += 2 * a[i];
			}
		}
		chmax(ans, tmp);
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 1024
N = int(input())
M = 7 + 10 ** 9
A = 0


def fac_mod(a, b):
    x = 1
    for i in range(1, b+1):
        x = (x*a) % M
    return x


A = (fac_mod(10, N) - fac_mod(9, N) * 2 + fac_mod(8, N)) % M
if A < 0:
    A = M + A
print(A)

Measured memory_bytes: 62260
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int a[200000];
int main()
{
    int n, k;
    cin >> n >> k;
    for(int i=0;i<n;++i){
        cin >> a[i];
        if(i>=k){
            if(a[i]>a[i-k])cout << "Yes" << endl;
            else cout << "No" << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 4408
#include<bits/stdc++.h>
#define mod 1000000009
using namespace std;
typedef long long int ll;
typedef pair<int,int> pi;
int a[3],ans=mod;
int b[]={0,1,2};
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    for (int i=0;i<3;i++) {
        cin>>a[i];
    }
    do {
        ans = min(ans,abs(a[b[1]]-a[b[0]])+abs(a[b[2]]-a[b[1]]));
    }while(next_permutation(b,b+3));
    cout<<ans;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
int h[100005];
int dp[100005];

int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&h[i]);
	dp[1]=0;
	dp[2]=abs(h[1]-h[2]);
	for(int i=3;i<=n;i++){
		dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
	}
	printf("%d\n",dp[n]);
	
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ldb;
 
#define endl '\n'
#define loop(i, m, n) for (lli i = m; i < n; i++)
#define loope(i, m, n) for (lli i = m; i <= n; i++)
#define epool(i, m, n) for (lli i = m; i >= n; i--)
#define maxe *max_element
#define mine *min_element
#define mod 1000000007
#define mod2 998244353
#define vt vector<lli>
#define fi first
#define se second
#define pb push_back
#define umap unordered_map
#define mmap multimap
#define MP make_pair
#define empf emplace_front
#define empb emplace_back
#define ret(x) return cout << x, 0;
#define all(v) v.begin(),v.end()

#define fast_io                       \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
using namespace std;
vector<int> mt[200001];

int main(){
    fast_io
    int i = 0,j = 0;
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    //cout << fixed << setprecision(22);
    int t;
    t=1;
    //cin >> t;
    //lli cno=0;
    //while (t--){
        int p=2019;
        string s;   
        cin >> s;
        int n=s.size();

        lli ans=0;
        map<int,int> mp;
        mp[0]++;
        lli po=1;
        lli cur_ans=0;
        for(int i=n-1; i>=0; i--){
            int cur=s[i]-'0';
            cur_ans+=cur*po;
            cur_ans%=p;
            po*=10;
            po%=2019;
            ans+=mp[cur_ans];
            mp[cur_ans]++;
        }

        cout << ans << endl;

        
   // }

}



Measured memory_bytes: 8372
/*
    coder:xxjAc
    name:
    time:2017/8/12 
*/
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
using namespace std;
const int INF=1000000007;
int main(){
	int a,b,c,d;
	scanf("%d%d%d%d",&a,&b,&c,&d);
	int qd=max(a,c);
	int zd=min(b,d);
	if (zd-qd<0){
		printf("0\n");
		return 0;
	}
	printf("%d\n",zd-qd);
	return 0;
} 

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    //cout.precision(10);
    int n;
    cin >> n;
    for(int i = 1; i <= 9; i++){
        if(i * 111 >= n){
            cout << i * 111 << endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
        long long int n; cin >> n;
        long long int sum = 0;
        map<long long int, long long int> mp;
        for (long long int x = 0; x < n; ++x){
            long long int q; cin >> q;
            sum += q;
            mp[q]++;
        }
        long long int q; cin >> q;
        for (long long int x = 0; x < q; ++x){
            long long int b, c; cin >> b >> c;
            sum += mp[b] * (c - b);
            mp[c] += mp[b];
            mp[b] = 0;
            cout << sum << endl;
        }
    return 0;
}

Measured memory_bytes: 9428
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
#define ALL(v) v.begin(), v.end()
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define chmax(x, a) x = max(x, a)
#define chmin(x, a) x = min(x, a)

int main() {
    long double A, B; cin >> A >> B;
    ll ans = A*B;
    cout << ans << endl;
}


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

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

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

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

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

fn main(){
    input! {
        w: i64,
        h: i64,
        x: i64,
        y: i64,
    }
    match (x * 2, y * 2){
        (xx, yy) if (xx == w && yy == h) => println!("{:.6} 1", (w * h) as f64 / 2.0),
        _ => println!("{:.6} 0", (w * h) as f64 / 2.0),
    }
}

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

#define fs first
#define sc second
#define pb emplace_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

const int32_t inf = 1001001001;
const int64_t infll = 1001001001001001001ll;
const int dx[] = {0, -1, 1, 0, -1, 1, -1, 1}, dy[] = {-1, 0, 0, 1, -1, -1, 1, 1};

template <typename T> using vector2d = vector<vector<T>>;

// clang-format off
template <typename T> void sort(vector<T> &v) { sort(all(v)); }
// ostream &operator<<(ostream &os, __int128_t value) { if (ostream::sentry(os)) { __uint128_t tmp = value < 0 ? -value : value; char buffer[64]; char *d = end(buffer); do { --d; *d = "0123456789"[tmp % 10]; tmp /= 10; } while (tmp != 0); if (value < 0) { --d; *d = '-'; } int len = end(buffer) - d; if (os.rdbuf()->sputn(d, len) != len) { os.setstate(ios_base::badbit); }} return os; }
// istream &operator>>(istream &is, __int128_t &value) { string in; is >> in; value = 0; for (const char &c : in) { if ('0' <= c && c <= '9') value = 10 * value + (c - '0'); } if (in[0] == '-') value *= -1; return is; }
// ostream &operator<<(ostream &os, __uint128_t value) { if (ostream::sentry(os)) { char buffer[64]; char *d = end(buffer); do { --d; *d = "0123456789"[value % 10]; value /= 10; } while (value != 0); int len = end(buffer) - d; if (os.rdbuf()->sputn(d, len) != len) { os.setstate(ios_base::badbit); }} return os; }
// istream &operator>>(istream &is, __uint128_t &value) { string in; is >> in; value = 0; for (const char &c : in) { if ('0' <= c && c <= '9') value = 10 * value + (c - '0'); } return is; }
template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { os << v[0]; for (int i = 1; i < v.size(); ++i) os << " " << v[i]; return os; }
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p) { os << p.fs << " " << p.sc; return os; }
template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.fs >> p.sc; return is; }

struct IoSetup { IoSetup(){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(0); cerr << fixed << setprecision(10); } } iosetup;

inline int64_t in() { int64_t x = 0; cin >> x; return x; }
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
// clang-format on

signed main(int argc, char *argv[]) {
  int n = in(), m = in();

  cout << (100 * (n - m) + 1900 * m) * pow(2, m) << endl;
}


Measured memory_bytes: 384
#include <iostream>
#include<algorithm>
#include<climits>
//#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb emplace_back
#define mp make_pair
#define MOD (int) 1e9+7
#define for0(i, n) for (int i = 0; i < n; i++)
#define ff first
#define ss second
#define endl "\n"
#define bits(n) __builtin_popcount(n)
#define ini(a, i) memset(a, i, sizeof(a))

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll t;
	// cin >> t;
	t  = 1;
	while (t--)
	{
		ll n, k;
		cin >> k >> n;
		ll arr[n], hash[105] = {0};
		for (ll i = 0; i < n; i++)
		{
			cin >> arr[i];
			hash[arr[i]]++;
		}
		ll i = k;
		while (i > 0 && hash[i] != 0)
			i--;
		ll a = 0;
		if (i > 0)
			a = i;
		i = k;
		while (i < 105 && hash[i] != 0)
			i++;
		ll b = INT_MAX;
		if (i < 105)
			b = i;

		ll d1 = k - a;
		ll d2 = b - k;
		// cout << d1 << " " << d2 << endl;
		// cout << a << " " << b << endl;
		if (d1 == d2)
			cout << a << endl;
		else if (d1 < d2)
			cout << a << endl;
		else
			cout << b << endl;

	}
	return 0;
}


Measured memory_bytes: 3652
#include <stdio.h>
#include <iostream>
#include <string>
#include <cstdlib>
#include <algorithm>

using namespace std;

int main(){
	int N;
	cin >> N;
	int a[N];
	for(int i = 0; i < N; i++){
		cin >> a[i];
	}
	for(int i = N-1; i >= 0; i--){
		for(int j = 0; j < i; j++){
			if(a[j] < a[j+1]){
				int tmp = a[j];
				a[j] = a[j+1];
				a[j+1] = tmp;
			}
		}
	}
	int result[2] = {0, 0};
	for(int i = 0; i < N; i++){
		result[i%2] += a[i];
	}
	cout << result[0]-result[1] << "\n";
}


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

int main() {
  int n; cin >> n;
  vector<int> a(n);
  vector<vector<int>> x(n, vector<int>(n));
  vector<vector<int>> y(n, vector<int>(n));
  for (int i = 0; i < n; i ++) {
    cin >> a[i];
    for (int j = 0; j < a[i]; j ++) {
      cin >> x[i][j] >> y[i][j];
      x[i][j] --;
    }
  }

  int ans = 0;
  for (int bit = 0; bit < (1 << n); bit ++) {
    bool ok = true;
    int sum = __builtin_popcount(bit);
    for (int i = 0; i < n; i ++) {
      if (!(bit & (1 << i))) continue;
      for (int j = 0; j < a[i]; j ++) {
        if (((bit >> (x[i][j])) & 1)  ^ y[i][j]) ok = false;
      }
    }
    if (ok) ans = max(ans, sum);
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
// 2012/02/22 Tazoe

#include <iostream>
using namespace std;

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

	int A, B;
	cin >> A >> B;

	int C;
	cin >> C;

	int D[100];
	for(int i=0; i<N; i++){
		cin >> D[i];
	}

	for(int i=0; i<N-1; i++){
		for(int j=i+1; j<N; j++){
			if(D[i]<D[j]){
				int tmp = D[i];
				D[i] = D[j];
				D[j] = tmp;
			}
		}
	}

	int sum1 = C;
	int sum2 = A;
//	cout << sum1/sum2 << endl;
	for(int i=0; i<N; i++){
//		cout << D[i] << ' ' << (sum1+D[i])/(sum2+B) << endl;
		if(sum1/sum2>(sum1+D[i])/(sum2+B)){
			break;
		}
		else{
			sum1 += D[i];
			sum2 += B;
		}
	}

	cout << sum1/sum2 << '\n';

	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

const int line_size = 16001;
const int line_base = line_size / 2;

using namespace std;

bool check_x(vector<int>& str, int answer);
bool check_y(vector<int>& str, int answer);
bool check_func(vector<int>& str, int deep, int answer);

int* line1 = new int[line_size];
int* line2 = new int[line_size];
int* tmp;

int main()
{
	int x = 0, y = 0;
	vector<int> lines;
	int count = 1;
	string code;
	
	cin >> code;
	cin >> x >> y;
	std::string::size_type first, last;

	first = 0;
	last = 0;
	while (last != std::string::npos)
	{
		last = code.find('T', first);
		if (first == last)
		{
			lines.push_back(0);
			first = last + 1;
			continue;
		}
		lines.push_back(code.substr(first, last - first).size());
		first = last + 1;
	}
	/*
	while (count < lines.size())
	{
		switch (count % 2)
		{
		case 0:
			forword_some(lines, lines[count], x);
			break;
		case 1:
			forword_some(lines, lines[count], y);
			break;
		}
		++count;
	}
	*/

	if (check_x(lines, x) == true)
	{
		if (check_y(lines, y) == true)
		{
			cout << "Yes" << endl;
		}
		else
		{
			cout << "No" << endl;
		}
	}
	else
	{
		cout << "No" << endl;
	}

	delete[] line1;
	delete[] line2;

	return 0;
}

bool check_x(vector<int>& str, int answer)
{
	if (str.size() < 1 && answer == 0)
	{
		return true;
	}
	for (int i = 0; i < line_size; ++i)
	{
		line1[i] = -1;
		line2[i] = -1;
	}
	line1[line_base + str[0]] = 0;
	return check_func(str, 2, answer);
}

bool check_y(vector<int>& str, int answer)
{
	if (str.size() < 2 && answer == 0)
	{
		return true;
	}
	for (int i = 0; i < line_size; ++i)
	{
		line1[i] = -1;
		line2[i] = -1;
	}
	line1[line_base + str[1]] = 0;
	line1[line_base - str[1]] = 0;
	return check_func(str, 3, answer);
}

bool check_func(vector<int>& str, int init_deep, int answer)
{
	bool correct = false;
	int count = 1;
	for (; init_deep < str.size(); init_deep += 2)
	{
		for (int i = 0; i < line_size; ++i)
		{
			if (line1[i] != count - 1)
			{
				continue;
			}

			if (i + str[init_deep] < line_size)
			{
				line2[i + str[init_deep]] = count;
			}
			if (i - str[init_deep] > 0)
			{
				line2[i - str[init_deep]] = count;
			}
		}
		tmp = line1;
		line1 = line2;
		line2 = tmp;
		++count;
	}

	if (line1[line_base + answer] == (count - 1))
	{
		correct = true;
	}

	return correct;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
    ll n;
    cin>>n;
    vector<ll> p(n);
    rep(i,n){
        cin>>p[i];
        p[i]--;
    }
    ll cnt=0;
    rep(i,n){
        if(p[i]==i){
            if(i==n-1) swap(p[i],p[i-1]);
            else swap(p[i],p[i+1]);
            cnt++;
        }
    }
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 1024
use std::rc::Rc;

pub fn main() {
  fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse::<T>().ok().unwrap()
  }
  fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
  }

  let nxt = read_vec::<i32>();
  let n = nxt.get(0).unwrap();
  let x = nxt.get(1).unwrap();
  let t = nxt.get(2).unwrap();

  println!("{}", (n/x + if n%x>0 {1} else {0}) * t);
}


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


int main()
{
	string a,b,t;
	int A,B;
	cin>>a>>b>>A>>B>>t;
	if(a==t) cout<<A-1<<" "<<B<<"\n";
	else cout<<A<<" "<<B-1<<"\n";
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
typedef short int INT16_t;
int main()
{
 INT16_t a,b,c;
 scanf("%hd%hd%hd", &a, &b, &c);
 if(a == b && a == c && b == c)
  printf("1\n");
 else if(a == b || a == c || b == c)
  printf("2\n");
 else
  printf("3\n");
}

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

int main()
{
    int h,w;
    while(cin>>h>>w&&h||w){
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                if(i%2){
                    if(j%2){
                        cout<<"#";
                    }else{
                        cout<<".";
                    }
                }else{
                    if(j%2){
                        cout<<".";
                    }else{
                        cout<<"#";
                    }
                }
            }
            cout<<endl;
        }
        cout<<endl;
    }
}


Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define MOD 1000000007
int main()
{
	ll n;
	cin>>n;
	ll a[n+1][3];
	for(ll i=1;i<=n;i++)     cin>>a[i][0]>>a[i][1]>>a[i][2];
	ll dp[n+1][3];
	dp[1][0] = a[1][0];
	dp[1][1] = a[1][1];
	dp[1][2] = a[1][2];
	for(ll i=2;i<=n;i++)
	{
		dp[i][0] = max(a[i][0] + dp[i-1][1],a[i][0] + dp[i-1][2]);
		dp[i][1] = max(a[i][1] + dp[i-1][0],a[i][1] + dp[i-1][2]);
		dp[i][2] = max(a[i][2] + dp[i-1][1],a[i][2] + dp[i-1][0]);
	}
	ll ans = max({dp[n][0],dp[n][1],dp[n][2]});
	cout<<ans;
}

Measured memory_bytes: 4992
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
using namespace std;

typedef long long ll;
ll n, m;
string str, ans, ansbuf;

bool hantei(bool last, bool first){
	bool left  = last;
	bool now = first;
	bool right;
	ansbuf = "";

	for(ll i = 0; i < n; i++){
		ansbuf += (now)? "S" : "W";
		if(str[i] == 'o'){
			right = (now)? left : !left;
		}
		else{
			right = (now)? !left : left;
		}
		left = now;
		now = right;
	}
	return left == last && now == first;
}

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

	ans = "-1";
	ans = hantei(true, true)? ansbuf : ans;
	ans = hantei(true, false)? ansbuf : ans;
	ans = hantei(false, true)? ansbuf : ans;
	ans = hantei(false, false)? ansbuf : ans;

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


Measured memory_bytes: 896
import math

a, b, x = map(int, input().split())
V = a**2 * b

if 2 * x > V:
  y = V - x
  r = r = (2 * y) /(a**3)
else:
  y = x
  r = (a * b**2) / (2 * y) 

theta = float(math.degrees(math.atan(r)))

print(theta)

  

Measured memory_bytes: 38384
#include <iostream>

using namespace std;

#define NMAX 50

int main(){

	int n,r;
	int p,c;
	int tmp;
	int deck[NMAX];

	while(1){

		cin>>n>>r;
		if(n==0&&r==0) break;

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

		while(r--){
			cin>>p>>c;
			for(int k=c-1;k>=0;k--){
				tmp=deck[p-1+c-1];
				for(int i=p-1+c-1;i>0;i--){
					deck[i]=deck[i-1];
				}
				deck[0]=tmp;
			}
		}

		cout<<deck[0]<<endl;

	}

	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n) ; ++i)
#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define emb emplace_back
#define fcout cout << fixed << setprecision(15)

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

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;
}

ll a[87];

ll l(ll i) {
  if(i==0) return 2ll;
  if(i==1) return 1ll;
  if(a[i]) return a[i];
  return a[i] = l(i-1) + l(i-2);
}

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

  cout << l(n) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int a,b,c,n,counter=0;
    while (scanf("%d",&n) !=EOF) {
        for (a=0; a<=9; a++) {
            for (b=0; b<=9; b++) {
                for (c=0; c<=9; c++) {
                    if (0<=n-a-b-c && n-a-b-c<=9) {
                        counter++;
                    }
                }
            }
        }
        printf("%d\n",counter);
        counter=0;
    }
    
    return 0;
}

Measured memory_bytes: 592
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printfin(a) printf(a ? "possible\n" : "inposible\n")
#define all(x) (x).begin(), (x).end()
using ll = long long;

const int INF = 2147483647;
//const ll LINF = ll();今度書く

//マクロとかここまで

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>

using namespace std;

int main() {
	
	int w, a, b, ans = 0;
	scanf("%d%d%d", &w, &a, &b);
	while (true) {
		if (a + w >= b && b + w >= a) break;
		if (a + w < b)--b;
		else ++b;
		++ans;
	}
	printf("%d\n", ans);

	return 0;
}


Measured memory_bytes: 128