akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;

int m[2][2000][2000];

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

	for (auto i = 0; i < N; ++i)
	{
		long long x, y;
		char c;
		cin >> x >> y >> c;
		
		auto tempM = m[0];
		if (c == 'W')
		{
			tempM = m[1];
		}

		x %= 2 * K;
		y %= 2 * K;

		for (auto addY = -2; addY < 2; ++addY)
		{
			for (auto addX = -2; addX < 2; ++addX)
			{
				int by = y + K * addY + 1;
				int bx = x + 2 * K * addX + 1;
				if ((addY % 2) != 0)
				{
					bx += K;
				}

				if (bx <= -K || by <= -K || bx >= 2 * K || by >= 2 * K)
				{
					continue;
				}

				auto ex = bx + K;
				auto ey = by + K;
				tempM[max(0, by)][max(0, bx)] += 1;
				if (ex < 2 * K)
				{
					tempM[max(0, by)][ex] -= 1;
					if (ey < 2 * K)
					{
						tempM[ey][ex] += 1;
					}
				}
				if (ey < 2 * K)
				{
					tempM[ey][max(0, bx)] -= 1;
				}
			}
		}
	}

	for (auto i = 0; i < 2; ++i)
	{
		for (auto j = 0; j < 2 * K; ++j)
		{
			for (auto k = 1; k < 2 * K; ++k)
			{
				m[i][j][k] += m[i][j][k - 1];
			}
		}
		for (auto j = 0; j < 2 * K; ++j)
		{
			for (auto k = 1; k < 2 * K; ++k)
			{
				m[i][k][j] += m[i][k - 1][j];
			}
		}
	}

	auto result = 0;
	for (auto i = 0; i < K; ++i)
	{
		for (auto j = 0; j < 2 * K; ++j)
		{
			result = max(result, m[0][i][j] + m[1][i][(j + K) % (2 * K)]);
		}
	}

	cout << result << endl;

	return 0;
}

Measured memory_bytes: 31488
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
using pii = pair<int, int>;
int main() {
  int x;
  cin >> x;

  int a = 400;

  for (int i = 0; i < 8; i++) {
    if (a <= x && x < a + 200) {
      cout << 8 - i << endl;
      return 0;
    } else {
      a += 200;
    }
  }
}

Measured memory_bytes: 3596
function Main(input) {
	input = input.split("\n");
    tmp = input[0].split(" ");

    const n = parseInt(tmp[0]);
    const n2 = parseInt(n*n);
    const n3 = parseInt(n*n*n);
  
    console.log( '%d', n+n2+n3);

}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

int main(int argc, const char * argv[]) {



    cin.tie(0);
    ios::sync_with_stdio(false);

    /////////////////////
    // Write code below /
    /////////////////////
    string S,T;

    cin>>S>>T;

    cout<<T + S<<endl;


    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main{
    public static void main(String args[]) {
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        int c = scan.nextInt();
        scan.close();
        System.out.println(a <= c && c <= b ? "Yes" : "No");
    }
}


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

int main(){
  int K,X;
  cin >> K >> X;

  for (int i = X-K+1; i <= X+K-1; i++) {
    printf("%d ",i);
  }

  return 0;
}


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

int main(){
    int v, e;
    cin >> v >> e;

    int d[100][100];
    for(int i = 0; i < 100; i++){
        for(int j = 0; j < 100; j++){
            d[i][j] = INT_MAX;
        }
    }
    for(int i = 0; i < 100; i++)    d[i][i] = 0;

    int s, t, dist;
    for(int i = 0; i < e; i++){
        cin >> s >> t >> dist;
        d[s][t] = dist;
    }

    for(int k = 0; k < v; k++){
        for(int i = 0; i < v; i++){
            for(int j = 0; j < v; j++){
                if(d[i][k] == INT_MAX || d[k][j] == INT_MAX)    continue;
                d[i][j] = min(d[i][j], d[i][k]+d[k][j]);
            }
        }
    }

    for(int i = 0; i < v; i++){
        if(d[i][i] < 0){
            cout << "NEGATIVE CYCLE" << endl;
            return 0;
        }
    }

    for(int i = 0; i < v; i++){
        for(int j = 0; j < v; j++){
            if(j)   cout << " ";
            if(d[i][j] == INT_MAX)  cout << "INF";
            else                    cout << d[i][j];
        }
        cout << endl;
    }

    return 0;
}


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

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	double a,b,x,deg;
	double pi = acos(-1);// cos theta = - 1 となる theta が出てくる 単位はRadinan
	cin >> a >> b >> x;
	double s = x/a;
	if(s>= (a*b)/2){
		double b2 = 2*(a*b - s)/a;
		// tan (theta) = a/b2;
		deg = atan2(b2,a) * 180/pi;
	}else{
		double a2 = 2*s/b;
		deg = atan2(b,a2) * 180/pi;
	}
	cout << fixed << setprecision(10) << deg << endl;
}

Measured memory_bytes: 256
#! env python
# -*- coding: utf-8 -*-

import os
import sys


# ac_py.main
# Date: 2020/06/14
# Filename: main 
# Author: acto_mini

def main():
    A, B, C, D = map(int, input().split())

    if B > C:
        if A <= C <= B and A <= D <= B:
            print(D - C)
        elif A <= D <= B and A >= C:
            print(D - A)
        elif A <= C <= B and D >= B:
            print(B - C)
        elif C <= A and B <= D:
            print(B - A)
        else:
            print(0)
    else:
        print(0)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
import scala.io.StdIn.readLine
import scala.collection.mutable.ArrayBuffer

object Main extends App {
  val b = new ArrayBuffer[String]
  var l = "0 0"
  while({l= readLine.trim;l} != "0 0") {
    val size = l.split(" ").map(_.toInt)
    val matrix = (0 until size(0)).map(_=>readLine.trim.toArray)
    var (x,y,count) = (0,0,0)
    while(matrix(y)(x)!='.' && count<=size(0)*size(1)) {
      val c = matrix(y)(x)
      if(c=='>') x+=1
      else if(c=='v') y+=1
      else if(c=='^') y-=1
      else if(c=='<') x-=1
      count += 1
    }
    if(count<=size(0)*size(1))
      b += x + " " + y
    else
      b += "LOOP"
  }
  println(b.mkString("\n"))
}

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

using namespace std;

int main()
{
	int n, k, q;
	vector<int> p;

	cin >> n >> k >> q;

	p.resize(n);

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

	for(int i = 0; i < q; ++i)
	{
		int ai;
		cin >> ai;
		++p[ai - 1];
	}

	for(int i = 0; i < n; ++i)
	{
		cout << (k - q + p[i] > 0 ? "Yes" : "No") << endl;
	}

	return 0;
}

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

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

  int a, b, c;
  cin >> a >> b >> c;
  cout << (a + b >= c ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
N = int(input())
src = list(map(int,input().split()))
odd = two = four = 0
for a in src:
    if a%2: odd += 1
    elif a%4==0: four += 1
    else: two += 1
if two:
    print('Yes' if odd <= four else 'No')
else:
    print('Yes' if odd <= four+1 else 'No')

Measured memory_bytes: 14252
#include<iostream>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<cstdio>
#include<cstdlib>
using namespace std;

int main() {
  int N, X;
  cin >> N >> X;
  int d = 0;
  int ans = 0;
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    d = d + a;
    if (d <= X) {
      ans++;
    }
  }
  cout << ans + 1 << endl;
}


Measured memory_bytes: 256
/*
  B - A to Z String
  Contest 054
  Rakesh Kumar --> 04/08/2020
 */

#include <bits/stdc++.h>

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

    std::string s;
    std::getline(std::cin, s);
    int i = 0, j = s.size() - 1;
    while (s[i++] != 'A');
    while (s[j--] != 'Z');
    std::cout << j - i + 3 << std::endl;

    return 0;
}


Measured memory_bytes: 3784
#include <bits/stdc++.h>
using namespace std;
struct Edge {
    int to;     // 辺の行き先
    int weight; // 辺の重み
    Edge(int t, int w) : to(t), weight(w) { }
};
using Graph = vector<vector<int> >;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define rrep(i,m, n) for(int i = m; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define mk make_pair
#define sum accumulate
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<int>(n,a)));
typedef long long ll;
const int INF = 2000000000;
const long INF64 = 1000000000000000ll;
const ll MOD = 1000000007LL;
typedef unsigned int uint;
int main(){
    string s;
    std::cin >> s;
    int x=0,y=0;
    int ans=s.size();
    rep(i,s.size()){
        if(s[i]=='S'){
            x++;
        }else{
            y++;
            if(x>0){
                y--;x--;
                ans-=2;
            }
        }
    }
    std::cout << ans << std::endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#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++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
const ll inf=1e9+7;
const ll INF=1e18;

int main(){
    ll x,k,d;cin>>x>>k>>d;
    ll b=(k-x/d)/2;
    ll a=b-1;ll c=b+1;
    bool can=false;
    ll ans=9*INF;
    if(0<=a&&a<=k){
        ans=min(ans,abs(x+(2*a-k)*d));
        can=true;
    }
    if(0<=b&&b<=k){
        ans=min(ans,abs(x+(2*b-k)*d));
        can=true;
    }
    if(0<=c&&c<=k){
        ans=min(ans,abs(x+(2*c-k)*d));
        can=true;
    }
    if(!can)ans=min(abs(x-k*d),abs(x+k*d));
    cout<<ans<<endl;
}

Measured memory_bytes: 3632
#include<iostream>
#include<string>
#include<cstdlib>
#include<stack>
using namespace std;
int main()
{
    stack<int> s;
    int a, b;
    string c;
    while (cin >> c)
    {
        if (c[0] == '+')
        {
            a = s.top();
            s.pop();
            b = s.top();
            s.pop();
            s.push(a + b);
        }
        else if (c[0] == '-')
        {
            b = s.top(); s.pop();
            a = s.top(); s.pop();
            s.push(a - b);
        }
        else if (c[0] == '*')
        {
            a = s.top(); s.pop();
            b = s.top(); s.pop();
            s.push(a * b);
        }
        else
        {
            s.push(atoi(c.c_str()));
        }
    }
    cout << s.top() << endl;
    return 0;
}


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

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


	string s, t;
	cin >> s >> t;

	map<int, int> cs, ct;

	for (int i = 0; i < s.length(); i++)
		cs[s[i]]++;
	for (int i = 0; i < t.length(); i++)
		ct[t[i]]++;

	vector<int> vs, vt;
	for (auto it : cs)
		vs.push_back(it.second);
	for (auto it : ct)
		vt.push_back(it.second);

	sort(vs.begin(), vs.end());
	sort(vt.begin(), vt.end());

	cout << (vt == vs ? "Yes\n" : "No\n");
}

Measured memory_bytes: 916
#include <stdio.h>
int main(void){
 int a, b, c;
 scanf("%d%d%d", &a, &b, &c);
 int kawaisou = 0;
 if (a == b && b != c)
   kawaisou = 1;
 if (b == c && c != a)
   kawaisou = 1;
 if (c == a && a != b)
   kawaisou = 1;
 if (kawaisou == 1) {
   puts("Yes");
 } else {
   puts("No");
 }
 return 0;
}

Measured memory_bytes: 1588
#include <stdio.h>
int main(){
	int a,b,c;scanf("%d%d%d",&a,&b,&c);
	if(a==1) puts("YES");
	else{
		for(register int i=1;i<=b;i++) if(a*i%b==c) return puts("YES"),0;
		puts("NO");
	}
	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<stdlib.h>
#include<string.h>
#include<string>
#include<vector>
//#include <bits/stdc++.h>

using namespace std;

int a, b;
int main()
{
	cin >> a >> b;
	bool flag = false;
	for (int i = 1; i <= 3; i++)
	{
		if (a*b*i == 1 || (a*b*i) % 2 == 1)
		{
			cout << "Yes" << endl;
			flag = true;
			break;
		}
		
	}if (!flag)cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    int A[100010];
    rep(i, N + 1) cin >> A[i];
    int sum = 0;
    rep(i, N + 1) sum += A[i];
    if(N == 0) {
        if(A[0] != 1) cout << -1 << endl;
        else cout << 1 << endl;
        return 0;
    }
    if(A[0] != 0) {
        cout << -1 << endl;
        return 0;
    }
    int ans = 1;
    int cnt = 1;
    rep(i, N) {
        int leaf = A[i + 1];
        cnt = min(cnt * 2 - leaf, sum - A[i + 1]);
        sum -= A[i + 1];
        if(cnt < 0) {
            cout << -1 << endl;
            return 0;
        }
        ans += leaf + cnt;
        //cout <<  leaf << " " << cnt << " " << ans << endl;
    }
    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 4436
import java.util.*;
public class Main{
	public static void main(String args[]){
		
		Scanner ob = new Scanner(System.in);
		int N = ob.nextInt();
		int R;
		
		if(N % 2 != 0){
			R = (N / 2) + 1;
		}
		else{
			R = N / 2;
		}

		System.out.println(R);	
	}
}


Measured memory_bytes: 22996
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<map>
#include<set>
#define N 100010
#define M 3010
#define ll long long
using namespace std;
ll num[N];
int prime[M],cnt;
bool is_prime[M];
ll f[N],r[N];
map<ll,int>mp;
set<ll>s;
int main()
{
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%lld",&num[i]);
	
	for(int i=2;i<=M-10;i++)
	if(!is_prime[i])
	{
		prime[++cnt]=i;
		for(int j=i*2;j<=M-10;j+=i) is_prime[j]=true;
	}
	for(int i=1;i<=n;i++)
	{
		ll x1=1,x2=1;
		for(int j=1;j<=cnt;j++)
		if(num[i]%prime[j]==0)
        {
            int tot=0;
            while(num[i]%prime[j]==0) num[i]/=prime[j],tot=(tot+1)%3;
            if(!tot) continue;
            for(int _=1;_<=tot;_++) x1*=prime[j];
            for(int _=1;_<=3-tot;_++) x2*=prime[j];
        }
        x1*=num[i];
        if((ll)sqrt(num[i])*(ll)sqrt(num[i])==num[i]) x2*=sqrt(num[i]);
		else x2*=num[i]*num[i];
		f[i]=x1;
		r[i]=x2;
		mp[f[i]]++;
	}
	ll ans=0;
	for(int i=1;i<=n;i++)
	if(!s.count(f[i]) && !s.count(r[i]))
    {
    	if(mp[r[i]]>mp[f[i]]) f[i]=r[i];
    	s.insert(f[i]);
    	if(f[i]==1) ans++;
    	else ans+=mp[f[i]];
    }
    printf("%lld",ans);
	return 0;
}


Measured memory_bytes: 19840
N, X, Y = [int(x) for x in input().split()]

a = [0]*N 

for i in range(1,N+1):
    for j in range(i+1,N+1):
        if (i <= X) and (j >= Y):
                a[(j - i) - (Y - X) + 1 ] += 1
        else:
            if (j - i ) > (abs(X - i) + abs(Y - j) + 1):
                a[abs(X - i) + abs(Y - j) + 1] +=  1
            else:
                a[j - i] += 1
for i in range(1,len(a)):
    print(a[i])


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

const int MAX = 510000;
const int MOD = 1000000007;


int64_t mpow(int64_t x, int64_t n){
  int64_t ans = 1;
  while(n != 0){
    if(n%2==1) ans = ans*x % MOD;
    x = x*x % MOD;
    n = n/2;
  }
  return ans;
}

int64_t mfact(int64_t n){
  int64_t ans = 1;
  for(int64_t i=2; i<=n; i++){
    ans = ans*i % MOD;
  }
  return ans;
}

int64_t mcomb(int64_t n, int64_t m){ //aCbをmod計算
  if(n == 0 && m == 0) return 1;
  if(n < m || n < 0) return 0;
  if(n < 0 || m < 0) return 0;
  int64_t ans = mfact(n)*mpow(mfact(m), MOD-2) %MOD;
  ans = ans*mpow(mfact(n-m), MOD-2) %MOD;
  return ans;
}



int main(){
  int N, K;
  cin >> N >> K;
  for(int i=1; i<=K; i++){
    cout << mcomb(N-K+1,i) * mcomb(K-1,i-1) % MOD << endl;
  }

}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vl;
typedef pair<ll,ll> pll;
#define MOD 1000000007
#define INF 1000000000
#define mp make_pair
#define pb push_back
#define ss second
#define ff first
#define endl '\n'
#define pl cout<<endl;
# define PI  3.14159265358979323846
ll maxi=LLONG_MIN;
ll mini=LLONG_MAX;
int main() 
{
	// #ifndef ONLINE_JUDGE
 // 	freopen("L:\\Codes\\in.txt", "r", stdin);
 // 	freopen("L:\\Codes\\out.txt", "w", stdout);
 // 	#endif
 	 ll n;cin>>n;
 	 ll a[n+1],b[n+1],c[n+1],dp[n+1][4];
 	 for (int i = 1; i <= n; ++i)
 	  {
 	  	cin>>a[i]>>b[i]>>c[i];
 	  } 
 	  dp[1][1]=a[1];dp[1][2]=b[1];dp[1][3]=c[1];
 	  for (int i = 2; i <= n; ++i)
 	  {
 	  	dp[i][1]=max(dp[i-1][2]+a[i],dp[i-1][3]+a[i]);
 	  	dp[i][2]=max(dp[i-1][1]+b[i],dp[i-1][3]+b[i]);
 	  	dp[i][3]=max(dp[i-1][2]+c[i],dp[i-1][1]+c[i]);
 	  }
 	  ll ans=0;
 	  ans=max(dp[n][1],max(dp[n][2],dp[n][3]));
 	  cout<<ans;
 	return 0;
 }

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

using namespace std;

int main()
{
	long n;
	cin >> n;
	long mae_a = 0;
	bool sankaku = false;

	for (int i = 0; i < n; i++) {
		long a;
		cin >> a;
		if (mae_a > a + 1) {
			cout << "No" << endl;
			return 0;
		}
		else if(mae_a > a){
			if (sankaku) {
				cout << "No" << endl;
				return 0;
			}
			else {
				sankaku = true;
			}
		}
		if (mae_a < a) {
			sankaku = false;
		}
		mae_a = a;
	}

	cout << "Yes" << endl;
}

Measured memory_bytes: 256
#[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)*}
    };
}

#[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, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

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

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

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn f(d1: &Vec<i32>, d2: &Vec<i32>) -> bool {
    for i in 0..d1.len() {}

    return true;
}

use std::cmp;
use std::iter::Iterator;

fn main() {
    input! {
        n:usize,
         p:[i32;n]
    }

    let mut cnt = 0;
    for i in 0..n - 2 {
        if (p[i] > p[i + 1] && p[i + 1] > p[i + 2]) 
        || (p[i + 2] > p[i + 1] && p[i + 1] > p[i]) {
            cnt +=1
        }
    }
    println!("{}", cnt);
}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <map>
#include <set>
using namespace std;
typedef long long lli;
lli n;
vector<lli> a;
map<lli,lli> m;
set<lli> s;
lli ans = 0;
int main(int argc, char const *argv[]) {
    cin >> n;
    a = vector<lli> (n+2);
    for(lli i = 1;i <= n;i++){
        lli a;
        cin >> a;
        m[a] = i;
    }
    s.insert(0);s.insert(n+1);
    for(lli i = 1;i <= n;i++){
        auto itr = s.lower_bound(m[i]);
        lli x = *itr - m[i];
        itr--;
        lli y = m[i] - *itr;
        s.insert(m[i]);
        ans += x * y * i;
    }
    cout << ans << endl;

    return 0;
}


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

class Dice{
public:

int s, t, face[6];

void scan(){
  for( int i = 0; i < 6; i++){
    cin >> face[i];
  }
}

void determine(){
  if( s == face[0] ){
    if( t == face[1] ) cout << face[2] << endl;
    if( t == face[2] ) cout << face[4] << endl;
    if( t == face[4] ) cout << face[3] << endl;
    if( t == face[3] ) cout << face[1] << endl;
  } else if( s == face[1] ){
    if( t == face[0] ) cout << face[3] << endl;
    if( t == face[3] ) cout << face[5] << endl;
    if( t == face[5] ) cout << face[2] << endl;
    if( t == face[2] ) cout << face[0] << endl;
  } else if( s == face[2] ){
    if( t == face[0] ) cout << face[1] << endl;
    if( t == face[1] ) cout << face[5] << endl;
    if( t == face[5] ) cout << face[4] << endl;
    if( t == face[4] ) cout << face[0] << endl;
 } else if( s == face[3] ){
    if( t == face[0] ) cout << face[4] << endl;
    if( t == face[4] ) cout << face[5] << endl;
    if( t == face[5] ) cout << face[1] << endl;
    if( t == face[1] ) cout << face[0] << endl;
 } else if( s == face[4] ){
    if( t == face[0] ) cout << face[2] << endl;
    if( t == face[2] ) cout << face[5] << endl;
    if( t == face[5] ) cout << face[3] << endl;
    if( t == face[3] ) cout << face[0] << endl;
 } else if( s == face[5] ){
    if( t == face[1] ) cout << face[3] << endl;
    if( t == face[3] ) cout << face[4] << endl;
    if( t == face[4] ) cout << face[2] << endl;
    if( t == face[2] ) cout << face[1] << endl;
 }
}
};

int main(){
  Dice p1;
  int q;

  p1.scan();
  cin >> q;

  for( int i = 0; i < q; i++){
    cin >> p1.s >> p1.t;
    p1.determine();
  }

  return 0;
}

Measured memory_bytes: 3100
n,m=map(int,input().split())
h=list(map(int,input().split()))
ans=[1]*n
for i in range(m):
  a,b=map(int,input().split())
  a-=1
  b-=1
  if h[a]>h[b]:ans[b]=0
  elif h[a]<h[b]:ans[a]=0
  elif h[a]==h[b]:ans[a]=ans[b]=0
print(ans.count(1))

Measured memory_bytes: 20052
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,m,x;
	cin>>n>>m>>x;
	vector<int>toll;
	for(int i=0;i<m;i++)
	{
		int a;
		cin>>a;
		toll.push_back(a);
	}
	vector<int>::iterator low,up;
	low=lower_bound(toll.begin(),toll.end(),x);
	up = upper_bound(toll.begin(),toll.end(),x);
	int posl,posu;
	posl=low-toll.begin();
	posu=toll.end()-up;
	cout<<min(posl,posu)<<"\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <memory>
#include <memory.h>
#include <cmath>
#include <fstream>
#include <cmath>
#include <numeric>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <sstream>
#include <cstdlib>
#include <cstdio>
#include <map>
#include <iomanip>
#include <list>
#include <cctype>
#include <algorithm>
#include <complex>
#define USE_MATH_DEFINES
using namespace std;

typedef complex<double> xy_t;
typedef pair<xy_t, xy_t> line;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef pair<int, PP> PPP;
const int INF = 1 << 29;
const double EPS = 1E-9;

typedef pair<xy_t, bool> dat;

namespace std{
	bool operator < (const xy_t &a, const xy_t &b){
		return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
	}
}

int n, hx, hy, dx, dy;
xy_t points[21];
double dis[1 << 21];
double adj[21][21];
double adjd[21];

bool dfs(double t, int v, int st){
	
	for(int i = 1; i <= n; i++) {
		if(!(st & (1 << i)) && (adjd[i] <= t || adjd[i] <= t + adj[v][i])) return false;
	}
	if(st == (1 << (n + 1) ) - 1) return true;
	for(int i = 1; i <= n; i++){
		if(st & (1 << i)) continue;
		if(dfs(t + adj[v][i], i, st | (1 << i))) return true;
	}
	return false;
}

int main(){
	while(cin >> n >> hx >> hy >> dx >> dy && (n || hx || hy || dx || dy)){
		
		points[0] = xy_t(hx, hy);
		for(int i = 1; i <= n; i++){
			int x, y;
			cin >> x >> y;
			points[i] = xy_t(x, y);
		}

		for(int i = 0; i < n + 1; i++){
			adjd[i] = abs(points[i] - xy_t(dx, dy));
			
			for(int j = 0; j < n + 1; j++)
				adj[i][j] = abs(points[i] - points[j]);
		}

		if(dfs(0.0, 0, 1)) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 888
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std;

int main()
{
	long long n, m;
	vector<pair<long long, long long> > ab;

	cin >> n >> m;

	ab.resize(n);

	for(int i = 0; i < n; ++i)
	{
		cin >> ab[i].first >> ab[i].second;
	}

	sort(ab.begin(), ab.end());

	long long sum = 0;
	for(int i = 0; i < n; ++i)
	{
		long long a = ab[i].first;
		long long b = ab[i].second;
		long long cnt = min(m, b);

		sum += a * cnt;
		m -= cnt;
	}

	cout << sum << endl;
}

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

using namespace std;

int main(void){
    int n;
    cin >> n;
    vector<int> a(n);
    
    for(int i = 0; i < n; i++) {
        cin >> a.at(i);
        a.at(i)--;
    }
    
    int cnt = 0;
    int keep = -1;
    for(auto i: a) {
        if(i != keep + 1) continue;
        else {
            cnt++;
            keep = i;
        }
    }
    int ans = n - cnt;
    if(ans == n) cout << -1 << endl;
    else cout << ans << endl;
}


Measured memory_bytes: 4000
N,M = map(int,input().split())
L = [0]*M
R = [0]*M
for i in range(M):
    L[i],R[i] = map(int,input().split())
mL = max(L)
mR = min(R)
ans = 0
for i in range(1,N+1):
    if ((mL <=i) and (i<=mR)):
        ans += 1
print(ans)


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

signed main() {
  int N;
  cin >> N;
  
  vector<int> X(N);
  for( int i=0; i < N; i++ ){
    cin >> X.at(i);
  }
  sort(X.begin(), X.end());
  
  
  int ans = 1000000000000;
  for( int i = 0; i <= 100; i++ ){
    int now = 0;
    for( int j = 0; j < N; j++ ){
      now += (X.at(j)-i)*(X.at(j)-i);
    }
    ans = min(now, ans);
  }
  cout << ans << endl;
}

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

int main() {
  int N,ans=0;
  cin >> N;
  vector<int> L(N);
  for(int i=0;i<N;i++) cin >> L[i];
  sort(L.begin(),L.end());
  
  for(int i=0;i<N;i++){
    for(int j=i+1;j<N;j++){
      int x = L[i] + L[j];
      int y = j;
      y = (lower_bound(L.begin(),L.end(),x)-L.begin()) - y - 1;
      ans += y;
    }
  }
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define P pair<int,int>
#define fr first
#define se second
using namespace std;
const int maxx=2e5+10;
typedef long long ll;
const ll mod=1e9+7;
vector<P> a;
ll f[maxx];
int main(){
    int n; cin>>n;
    ll ans=0;
    for(int i=1;i<=n;i++)
        f[i]=(n-i+1);
    for(int i=n;i;i--)
        f[i]+=f[i+1];
    for(int i=1;i<=n;i++){
        ans+=f[i];
    }
    for(int i=1;i<n;i++){
        int x,y; scanf("%d%d",&x,&y);
        if(x>y) swap(x,y);
        ans-=1ll*x*(n-y+1);
    }
    cout<<ans;
}


Measured memory_bytes: 5248
a, b, k = gets.chomp.split(" ").map(&:to_i)

if k > a
  k -= a
  a = 0

  if b == 0
  elsif k > b
    k -= b
    b = 0
  else
    b -= k
  end
else
  a -= k
end

puts("#{a} #{b}")


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

using namespace std;
typedef long long int lli;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef pair <lli,lli> pii;
#define all(vec) vec.begin(),vec.end()
#define ff first
#define ss second
#define pi 3.141592653589
#define inf 4e18
#define MOD 1000000007
#define pb push_back
#define for1(low,high,k) for(int i=low;i<high;i+=k)
#define for2(low,high,k) for(int j=low;j<high;j+=k)
#define rev(high,low,k) for(int i=high;i>=low;i-=k) 

int main(){
	fast;
	lli n;
	string s;
	cin>>n>>s;
	lli k=0;
	int c=0;
	for (int i=s.size()-1;i>=0;i--){
		if (s[i]!='.'){
			if (c==0) k+=s[i]-'0';
			else if (c==1) k+=(s[i]-'0')*10;
			else k+=(s[i]-'0')*100;
			c++;
		}
	}
	lli prod=n*k;
	cout<<prod/100<<endl;
	
}

Measured memory_bytes: 3608
import math
n, d = map(int, input().split(' '))

x = [[]] * n

for i in range(n):
  x[i] = [num for num in map(int, input().split(' '))]

ans = 0

for i in range(n-1):
  std_vertex = x[i]
  for j in range(i+1, n):
    other_vertex = x[j]
    tmp = 0
    for dim in range(d):
      tmp += (std_vertex[dim] - other_vertex[dim]) ** 2
    dist = math.sqrt(tmp)
    # print(dist)
    # print(dist % 1)
    if dist % 1 == 0:
      ans += 1
  
# print(n, d, x)

print(ans)

Measured memory_bytes: 38256
H, W = map(int, input().split())
ans = 0
S = []
for _ in range(H):
    s = list(input())
    ans += s.count('.')
    S.append(s)

inf = float('inf')
G = [[inf] * H * W for _ in range(H * W)]

dx = [0, 1, 0, -1]
dy = [1, 0, -1, 0]

for h in range(H):
    for w in range(W):
        for x, y in zip(dx, dy):
            nx = w + x
            ny = h + y
            if 0 <= nx < W and 0 <= ny < H and S[ny][nx] != '#':
                G[W * h + w][W * ny + nx] = 1

from scipy.sparse.csgraph import dijkstra

d = dijkstra(G, indices=0)
if d[-1] == inf:
    print(-1)
else:
    print(int(ans - d[-1] - 1))


Measured memory_bytes: 209232
#include<bits/stdc++.h>
using namespace std;
vector<tuple<string, int, int> > S;
int N, M;
int a[11];
int main()
{
  scanf("%d%d", &N, &M);
  for(int i=0; i<M; ++i)
  {
    int t; scanf("%d", &t);
    for(int j=0; j<t; ++j)
    {
      int x; scanf("%d", &x);
      a[x-1] += 1<<i;
    }
  }
  int p = 0;
  for(int i=0; i<M; ++i)
  {
    int t; scanf("%d", &t);
    p += t<<i;
  }
  int cnt= 0;
  for(int i=0; i<(1<<N); ++i)
  {
    int f = p;
    for(int j=0; j<N; ++j)
    {
      if(i&(1<<j))
        f^= a[j];
    }
    if(!f) ++cnt;
  }
  printf("%d\n", cnt);
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <fstream>
#include <chrono>
#include <random>
#include <bitset>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) ((int)(x).size())
#define pb push_back
using ll = long long;
using namespace std;
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; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}

const ll mod = 998244353;
vector<ll> fac(202000), finv(202000), inv(202000);
void initcom(){
  fac[0] = fac[1] = finv[0] = finv[1] = inv[1] = 1;
  for(int i=2; i<202000; i++){
    fac[i] = (fac[i-1]*i) % mod;
    inv[i] = mod - inv[mod%i] * (mod/i) % mod;
    finv[i] = finv[i-1] * inv[i] % mod;
  }
}
ll nCr(int n, int k){
  if(n<k) return 0;
  if(n<0 || k<0) return 0;
  return fac[n] * (finv[k] * finv[n-k] % mod) % mod;
}
ll mpow(ll a, ll x){
  ll res = 1;
  while(x > 0){
    if(x & 1) res = (res * a) % mod;
    a = (a * a) % mod;
    x >>= 1;
  }
  return res;
}
int main(){
  initcom();
  ll N,M,K; cin >> N >> M >> K;
  if(N==1){
    cout << M << endl;
    return 0;
  }

  ll ans = 0;
  for(int i=0; i<=K; i++){
    ll mul = M*mpow(M-1, N-1-i);
    mul %= mod;
    //cout << mul << endl;
    mul *= nCr(N-1, i);
    mul %= mod;
    //cout << mul << endl;
    ans += mul;
    ans %= mod;

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


Measured memory_bytes: 7872
/**
 * Created by hiramekun at 20:51 on 2019-09-01.
 */
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using P = pair<ll, ll>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template<typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = ll(n - 1); i >= 0; i--)
#define each(i, mp) for(auto& i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template<class T>
ostream &operator<<(ostream &out, const vector<T> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << ' ';
    return out;
}


template<class T>
istream &operator>>(istream &in, vector<T> &list) {
    ll n = list.size();
    rep(i, n) in >> list[i];
    return in;
}

template<class T>
ostream &operator<<(ostream &out, const vector<vector<T>> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << '\n';
    return out;
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */

void solve() {
    ll a, b;
    cin >> a >> b;
    ll now = 1;
    ll ans = 0;
    while (now < b) {
        now--;
        now += a;
        ans++;
    }
    cout << ans << '\n';
}

int main() {
#ifdef MY_DEBUG
    while (true) {
#endif
        solve();
#ifdef MY_DEBUG
    }
#endif
    return 0;
}



Measured memory_bytes: 256
#include<cstdio>
#include<cstring>

int main(){
    char s[201],t[101],p[101];
    scanf("%s %s",s,p);
    strcpy(t,s);
    strcat(s,t);
    if(strstr(s,p)==NULL)printf("No\n");
    else printf("Yes\n");
    return 0 ;
    
}


Measured memory_bytes: 2752
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
#define era(t) t.erase(unique(be(t)),t.end())
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
typedef long long ll;
using namespace std;
const ll mod=1000000007,mod9=1000000009;
template <class T>inline T lcm(T a,T b){return (a*b/__gcd(a,b));}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    int numa=0,numb=0,numc=0,num=0;
    int len[n];
    string s[n];
    for(int i=0;i<n;i++){
        cin>>s[i];
        len[i]=s[i].length();
    }
    for(int i=0;i<n;i++){
        if(s[i][0]=='B'){
            if(s[i][len[i]-1]=='A'){
                numc++;
            }
            else{
                numa++;
            }
        }
        else{
            if(s[i][len[i]-1]=='A'){
                numb++;
            }
        }
    }
    if(numc){
    if(numa){
        numa--;
        numc++;
    }
    if(numb){
        numb--;
        numc++;
    }
    num+=numc-1;
}
    
    num+=min(numa,numb);
    //cout << num<<endl;
    for(int i=0;i<n;i++){
        for(int j=1;j<len[i];j++){
            if(s[i][j-1]=='A'&&s[i][j]=='B'){
                num++;
            }
        }
    }
    cout << num<<endl;
    return 0;
}



Measured memory_bytes: 896
D_str=input().split("/")
D=list(map(int,D_str))
if D[0]>=2020:
  print("TBD")
elif D[0]==2019 and D_str[1]=="01":
  print("Heisei")
elif D[0]==2019 and D_str[1]=="02":
  print("Heisei")
elif D[0]==2019 and D_str[1]=="03":
  print("Heisei")
elif D[0]==2019 and D_str[1]=="04":
  print("Heisei")  
elif D[0]==2019:
  print("TBD")
else:
  print('Heisei')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
template <typename T> using V = vector<T>;

constexpr int Mod = 998244353;
constexpr int mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;

template <typename T> constexpr bool chmax(T &a, const T &b) {
    if(a >= b) return false;
    a = b;
    return true;
}
template <typename T> constexpr bool chmin(T &a, const T &b) {
    if(a <= b) return false;
    a = b;
    return true;
}

/*-------------------------------------------*/

ll L, R;
ll dp[2][2][2][65];

ll f(int d, int S, int l, int r) {
    if(d == -1) return S;
    if(dp[S][l][r][d] >= 0) return dp[S][l][r][d];

    ll ret = 0;
    rep(a, 2) rep(b, 2) {
        if(!a && l && (L >> d & 1)) continue;
        if(b && r && !(R >> d & 1)) continue;
        if(a > b) continue;
        if(!S && a != b) continue;
        int Nl = l && (L >> d & 1) == a;
        int Nr = r && (R >> d & 1) == b;
        int NS = S || a == 1;
        ret += f(d - 1, NS, Nl, Nr);
    }
    return dp[S][l][r][d] = ret % mod;
}

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

    cin >> L >> R;
    memset(dp, -1, sizeof(dp));
    cout << f(61, 0, 1, 1) << endl;

    return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
brokens = set(int(input()) for _ in range(m))
dp = [0 for _ in range(n+1)]
mod = 10**9 + 7

dp[0] = 1
if 1 not in brokens:
    dp[1] = 1

for i in range(2, n+1):
    if i in brokens:
        continue
    dp[i] = (dp[i-1] + dp[i-2]) % mod

print(dp[-1])


Measured memory_bytes: 11884
using System;
using System.Collections.Generic;
using System.Linq;

class Procon
{
    public Procon() { }
    static void Main(string[] agrs)
    {
        new Procon().Do();
    }

    Scanner cin;

    public void Do()
    {
        cin = new Scanner();
        int N = cin.nextInt();
        int K = cin.nextInt();
        string S = cin.nextString();
        string ret = "";

        for (int i = 0; i < N; i++)
        {
            char c = S[i];
            if (i == K - 1)
            {
                c = Char.ToLower(c);
            }
            ret += c.ToString();

        }
        Console.WriteLine(ret);
    }
}

class Scanner
{
    string[] s;
    int i;
    int max_i;

    public Scanner()
    {
        s = new string[0];
        max_i = 0;
        i = 0;
    }

    public string nextString()
    {
        if (i >= s.Length)
        {
            s = Console.ReadLine().Split(' ');
            max_i = s.Length;
            i = 0;
            if (max_i == 0)
            {
                return "";
            }
            return s[i++];
        }
        else
        {
            return s[i++];
        }
    }

    public int nextInt()
    {
        return int.Parse(nextString());
    }

    public long nextLong()
    {
        return long.Parse(nextString());
    }

    public double nextDouble()
    {
        return double.Parse(nextString());
    }

    public string[] arrayString()
    {
        return Console.ReadLine().Split(' ');
    }

    public int[] arrayInt()
    {
        string[] str = Console.ReadLine().Split(' ');
        int[] array = new int[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = int.Parse(str[i]);
        }
        return array;
    }

    public long[] arrayLong()
    {
        string[] str = Console.ReadLine().Split(' ');
        long[] array = new long[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = long.Parse(str[i]);
        }
        return array;
    }

    public double[] arrayDouble()
    {
        string[] str = Console.ReadLine().Split(' ');
        double[] array = new double[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = double.Parse(str[i]);
        }
        return array;
    }
}

Measured memory_bytes: 11092
import java.util.Scanner;
 
public class Main {
 
	public static final MyScanner in = new MyScanner();
 
	public static void main(String[] args) {
 
		int A = in.nextInt();
		int B = in.nextInt();

		int answer=1;
		while(true) {
			int a = (int) (answer * 0.08);
			int b = (int) (answer * 0.1);
			if (b > 100) {
				System.out.println(-1);
				return;
			}

			if (a == A && b == B) {
				System.out.println(answer);
				return;
			}
			answer++;
		}

	}

	public static class MyScanner{
		Scanner sc = new Scanner(System.in);
		String nextLine() {return sc.nextLine();}
		String next() {return sc.next();}
		int nextInt() {return Integer.valueOf(sc.next());}
		long nextLong() { return Long.valueOf(sc.next());}
	}

}

Measured memory_bytes: 22996
from collections import deque
n=int(input())
a=sorted([int(i) for i in input().split()])[::-1]

if n==2:
    print(a[0])
else:
    b=deque([a[1],a[2]])
    ans=a[0]+a[1]
    minlist=[min(b)]
    j=1
    for i in range(n-3):
        if j==0:
            j+=1
            ans+=b[0]
            b+=[a[i+3]]
        else:
            j=0
            ans+=b[0]
            b.popleft()
            b+=[a[i+3]]

    print(ans)

Measured memory_bytes: 96784
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x) for(int i=0; i<x;i++)
#define mod 1000000007
#define INF 10000000000
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }


int main(){
  ios::sync_with_stdio(false);
  
  int R;
  cin>>R;
  
  cout<<fixed<<setprecision(5)<<2*R*M_PI;
  
}

Measured memory_bytes: 3788
#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <complex>
#include <set>
#include <list>
#include <iomanip>
#include <map>
#include <limits.h>
#include <memory.h>


using namespace std;
static const double EPS = 1e-10;
typedef long long ll;
typedef unsigned long long ull;
#define FOR(i,n) for(int i=0;i<(int)n;++i)
#define FORNUM(p, x) for (int num = p; num < (int)(x); ++num)
#define FORI(p, x) for (int i = p; i < (int)(x); ++i)
#define FORJ(p, x) for (int j = p; j < (int)(x); ++j)
#define FORK(p, x) for (int k = p; k < (int)(x); ++k)
#define FORL(p, x) for (int l = p; l < (int)(x); ++l)

typedef vector<double> vec;
typedef vector<vec> mat;



int main() {

	int a,b,c;
	bool flg=false;
	cin>>a>>b>>c;
	for(int i=1;i<=b;i++){
		if((i*a)%b==c)
			flg=true;
		
	}
	if(flg)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;

	return 0;
}




Measured memory_bytes: 256
#include <iostream>
#include <vector>

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    int ans = 0;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        ans += a[i]-1;
    }

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    map<string, int> m;
    int mmax = 0, n;
    cin >> n;
    while(n--) {
        string str;
        cin >> str;
        ++m[str];
        mmax = max(m[str], mmax);
    }
    for(map<string, int>::iterator it = m.begin(); it != m.end(); ++it){
        if(it -> second == mmax)
            cout << it -> first << "\n";
    }
    return 0;
}

Measured memory_bytes: 25216
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int ctoi(const char c) {
    if ('0' <= c && c <= '9') return (c - '0');
    return -1;
}
vector<int> input(int n) {
    vector<int> vec(n);
    for (int i = 0; i < n; i++) {
        cin >> vec.at(i);
    }
    return vec;
}
void output(vector<int> vec) {
    for (int i = 0; i < vec.size(); i++) {
        cout << vec[i] << " ";
    }
    return;
}
vector<vector<int>> input(int n, int m) {
    vector<vector<int>> table(n, vector<int>(m));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> table. at(i).at(j);
        }
    }
    return table;
}
void output(vector<vector<int>> table) {
    for (int i = 0; i < table.size(); i++) {
        for (int j = 0; j < table.at(0).size(); j++) {
            cout << table.at(i).at(j) << " ";
        }
        cout << endl;
    }
}
long long perm(int n, int r) {
    if (n < r) {
        cout << "error" << endl;
        return 0;
    }
    long long perm = 1;
    for (int i = n; i > n - r; i--) {
        perm *= i;
    }
    return perm;
}
long long comb(int n, int r) {
    if (n < r) {
        cout << "error" << endl;
        return 0;
    }
    long long comb = perm(n,r);
    for (int i = r; i > 0; i--) {
        comb /= i;
    }
    return comb;
}
long long homo(int n, int r) {
    return comb(n + r - 1, n - 1);
}
long long fact(int n) {
    long long fact = 1;
    for (int i = n; i > 0; i--) {
        fact *= i;
    }
    return fact;
}
int gcd(int a, int b)
{
    if (a % b == 0)
    {
        return(b);
    }
    else
    {
        return(gcd(b, a % b));
    }
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
int main() {
  string a,b;
  cin >> a >> b;
  int n=stoi(a+b);
  bool flag=false;
  for(int i=1;i<320;i++){
    if(i*i==n){
      flag=true;
      break;
    }
  }
  if(flag){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

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

int main() {
  char c;
  cin >> c;

  if( c == 'a'|| c == 'e'|| c == 'i'|| c == 'o'|| c == 'u'){
    cout << "vowel" << endl;
  }
  else{
    cout << "consonant" << endl;
  }
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<algorithm>
#include<queue>
#include<stack>
#include<math.h>
#include<map>
typedef long long int ll;
using namespace std;
#define maxn 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
const int mm=2e5+100;
ll d[mm];
int main()
{
   ll n,m,i,j,t,a,b,c,p,k,kk,dd;
    cin>>a>>b>>c>>dd>>k; 
//    cout<<-a*60-b+c*60+dd-k<<endl;
    cout<<max(-a*60-b+c*60+dd-k,(ll)0);

   
   	
} 

Measured memory_bytes: 3636
#include <stdio.h>

int main(){
    int count[4] = {}, num, i;
    char ch1, ch2;
    
    while(scanf("%d,%c%c", &num, &ch1, &ch2) != EOF){
        if (ch1 == 'B') count[1]++;
        else if (ch1 == 'O') count[3]++;
        else if (ch1 == 'A' && ch2 == 'B') count[2]++;
        else count[0]++;
    }
    for (i = 0; i < 4; i++) printf("%d\n", count[i]);
    
    return 0;
}

Measured memory_bytes: 596
n = int(input())
ans = 0
def mask(i): return 1 << ((i-3) >> 1)
def dfs(a, use):
    global ans
    if a > n: return
    if use == 0b111: ans += 1
    for i in [3, 5, 7]: dfs(a*10+i, use | mask(i))

dfs(0, 0)
print(ans)


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

using namespace std;

#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}


int main() {

    int N;
    cin >> N;

    vector<int> a(N);
    for (int i = 0; i < N; i++) cin >> a[i];

    vector<int> p_a(N + 1, 0);
    for (int i = 0; i < N; i++) p_a[i + 1] += p_a[i] + a[i];

//    SHOW_VECTOR(p_a);

    int ans = 0;
    for (int i = 1; i <= 100; i++) {
        bool good = true;
        for (int j = 1; j <= N; j++) if (i * j > p_a[j]) good = false;
        if (good) ans = max(ans, i);
    }

    cout << ans << endl;

}












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

string S;
int N;

void input() {
    cin >> N;
    cin >> S;
}

void solve() {
    input();
    string tmp = "No";
    int K = N / 2;
    if(N % 2 == 0 && S.substr(0, K) == S.substr(K, N)) tmp = "Yes";
    cout << tmp << endl;
    return;
}

int main() {
    solve();
    return 0;
}


Measured memory_bytes: 3628