akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll=long long int;
using lld=long double;
#define all(c) (c).begin(), (c).end()
#define rep( i, a, n ) for( int i=a; i<n; i++ )
#define repp( i, a, n, p ) for( int i=a; i<n; i+=p )
#define per( i, a, n ) for( int i=n-1; i>=a; i--)
#define pb push_back
#define mp make_pair
#define acc accumulate

int main () {
    int n;
    cin >> n;
    stack <int> st;
    while ( n-- ) {
        int no;
        cin >> no;
        if ( st.empty() ){ 
            st.push (no);
        }

        else { 
            if ( no >= st.top () ) {
                st.push (no);
            }
        }
    }

    cout << st.size() << endl;
}


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

//Compiler version g++ 6.3.0

int main()
{
    int n,i;char s[100];
    cin>>n;
    
    scanf(" %[^\n]",s);
    if(n%2!=0) {
      cout<<"No"<<endl; 
    }
    else{
     
    for(i=0;i<n/2;i++){
      if(s[i]!=s[(n/2)+i]) break;
    }
    if(i==n/2) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    }
}

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

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

long long gcd(long long a, long long b) {
    for(;;) {
        if(a == 0)
            return b;
        b %= a;
        if(b == 0)
            return a;
        a %= b;
    }
}

long long lcm(long long a, long long b) {
    long long temp = gcd(a, b);
    return temp ? (a / temp * b) : 0;
}

int main() {
    ll N, M;
    cin >> N >> M;
    string S;
    string T;
    cin >> S;
    cin >> T;
    ll L = lcm(N, M);
    //とりあえずLをlcmにすると
    ll g = N * M / L;
    REP(i, g) {
        if(S[i * N / g] != T[i * M / g]) {
            cout << -1 << endl;
            return 0;
        }
    }
    cout << L << endl;
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxx = 1e5 + 7;
const int Inf = 1 << 30;
const ll INF = 1ll << 60;
int a, b, k;

bool cmp(int x, int y) { return x > y; }

int main() {
	cin >> a >> b >> k;
	int t = 0;
	int p[105];
	for(int i = 1; i <= 100; i++) {
		if(a % i == 0 && b % i == 0) p[++t] = i;
	}
	sort(p + 1, p + t + 1, cmp);
	cout << p[k] << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void) {
    int n, i, j, ans = 1, nonsense;
    int d[100];
    scanf("%d", &n);
    for(i = 0; i < n; i++) {
        scanf("%d", &d[i]);
    }
    
    for(i = 0; i < n-1; i++) {
        for(j = i+1; j < n; j++) {
            if(d[i] < d[j]) {
                nonsense = d[i];
                d[i] = d[j];
                d[j] = nonsense;
            }
        }
    }

    for(i = 1; i < n; i++) {
        if(d[i] == d[i-1]) continue;
        ans++;
    }
    printf("%d", ans);
    return 0;
}

Measured memory_bytes: 128
sx, sy, tx, ty = map(int, input().split())

print(
      'U' * (ty - sy) + 'R' * (tx - sx) +
      'D' * (ty - sy) + 'L' * (tx - sx) +
      'L' + 'U' * (ty - sy + 1) + 'R' * (tx - sx + 1) + 'D' +
      'R' + 'D' * (ty - sy + 1) + 'L' * (tx - sx + 1) + 'U'
     )

Measured memory_bytes: 3060
#include <iostream>
#define rep(i,s,N) for(int i=s;i<N;i++)
using namespace std;


int main(void)
{
	int N; cin >> N;
	int min_tmp = 200001;
	int ans = 0;
	rep(i, 0, N) {
		int tmp; cin >> tmp;
		if (tmp <= min_tmp) {
			ans++;
			min_tmp = tmp;
		}
		if (min_tmp == 1)break;
	}
	cout << ans << endl;

	return 0;
}

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

int main(){
  
  int N;
  cin >> N;
  
  vector<int> P(N);
  for(int i = 0; i < N; i++){
  	cin >> P.at(i);
  }
  
  vector<int> m(N);
  for(int i = 0; i < N; i++){
  	if(i == 0){
    m.at(i) = P.at(i);
    }else{
    m.at(i) = min(P.at(i),m.at(i-1));
    }
  }
  
  int Ans = 1;
  
  for(int i = 0; i<N; i++){
  	if(i != 0 && m.at(i-1) >= P.at(i)){
    Ans ++;
    }
  }
  
  cout << Ans << endl;
}


Measured memory_bytes: 1920
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<map>
using namespace std;
typedef long long ll;
const int N=2e5+4;
int n,K;
double a[N];
double sum[N];
inline int read() {
	int x=0,f=1;char c=getchar();
	while (c<'0'||c>'9') {if (c=='-') f=-1;c=getchar();}
	while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
	return x*f;
}
inline void smax(double &x,double y) {
	x=x<y?y:x;
}
int main() {
//	freopen("in.txt","r",stdin);
	n=read(),K=read();
	for (register int i=1;i<=n;++i) {
		a[i]=(double)read();
		a[i]=(a[i]+1)/2.0;
		sum[i]=sum[i-1]+a[i]; 
	}
	double ans=0.0;
	for (register int i=K;i<=n;++i)
		smax(ans,sum[i]-sum[i-K]);
	printf("%.8lf\n",ans);
	return 0;
}

Measured memory_bytes: 6860
#include <iostream>
#include <string.h>
#include <stdio.h>
using namespace std;
const int M=1e5+5;
const int N=1e9+5;
const int mod=1e9+7;
struct Matrix{
    int n,m;
    int ju[5][5];
    Matrix(){
        n=m=3;
        memset(ju,0,sizeof(ju));
        ju[1][1]=ju[2][2]=ju[0][0]=1;
    }
    Matrix(int n1,int m1){
        n=n1,m=m1;
        memset(ju,0,sizeof(ju));
    }
    int MUL(int a,int b){
        int ret=0;
        while(b){
            if((b&1))
                ret=(ret+a)%mod;
            a=(a+a)%mod;
            b>>=1;
        }
        return ret;
    }
    Matrix Se(){
        Matrix ret(n,m);
        for(int i=0;i<n;i++)
            for(int j=0;j<m;j++)
                ret.ju[i][j]=ju[i][j];
        return ret;
    }
    Matrix operator*(const Matrix dd){
        Matrix ret(n,dd.m);
        if(dd.n!=m)
        {
            printf("Error\n");
            return ret;
        }
        for(int i=0;i<ret.n;i++)
            for(int j=0;j<ret.m;j++)
                for(int k=0;k<m;k++)
                    ret.ju[i][j]=(ret.ju[i][j]+(((long long)ju[i][k])*((long long)dd.ju[k][j])%mod))%mod;
//                  ret.ju[i][j]=(ret.ju[i][j]+MUL(ju[i][k],dd.ju[k][j]))%mod;
        return ret;
    }
    Matrix operator^(int p){
        Matrix ret,Self=Se();
        while(p)
        {
            if((p&1))
                ret=ret*Self;
            Self=Self*Self;
            p>>=1;
        }
        return ret;
    }
}EM(3,3),dp(1,3),ES(3,3);

int n,m;
int Si[M],E[3][3]={{1,2,1},{0,1,1},{1,2,2}};

int main()
{
    scanf("%d%d",&n,&m);
    for(int i=1;i<=m;i++)
        scanf("%d",&Si[i]);
    for(int i=0;i<3;i++)
        for(int j=0;j<3;j++)
            EM.ju[i][j]=E[i][j];
    ES=EM;
    ES.ju[2][0]=ES.ju[2][1]=0;
    ES.ju[2][2]=1;
    dp.ju[0][0]=1,dp.ju[0][1]=2,dp.ju[0][2]=1;
    for(int i=1;i<=m;i++)
    {
        dp=dp*(EM^(Si[i]-Si[i-1]-1));
        dp=dp*ES;
    }
    dp=dp*(EM^(n-Si[m]-1));
    cout<<dp.ju[0][2]<<endl;
    return 0;
}

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

using namespace std;
#define int long long
#define pb push_back
template <typename T1, typename T2> inline void chkmin(T1 &x, const T2 & y) {if (x > y) x = y;}
template <typename T1, typename T2> inline void chkmax(T1 &x, const T2 & y) {if (x < y) x = y;}

const int MOD = 1e9 + 7;
const int MAXN = 13;
int dp[MAXN];
int Next[MAXN];

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	string s;
	cin >> s;
	reverse(s.begin(), s.end());
	int n = s.size();

	if (s[0] != '?')
		dp[s[0] - '0'] = 1;
	else 
		for (int i = 0; i <= 9; i++)
			dp[i] = 1;

	int pow = 1;
	for (int i = 1; i < n; i++) {
		pow *= 10;
		pow %= 13;

		if (s[i] != '?') {
			for (int j = 0; j < 13; j++) {
				Next[(j + (s[i] - '0') * pow) % 13] += dp[j];
			}
		}
		else {
			for (int j = 0; j < 13; j++) {
				for (int k = 0; k <= 9; k++) {
					Next[(j + k * pow) % 13] += dp[j];
				}
			}
		}

		for (int i = 0; i < 13; i++) {
			dp[i] = Next[i];
			Next[i] = 0;
			dp[i] %= MOD;
		}
		//cout << "dp = " << endl;
		//for (int i = 0; i < 13; i++)
		//	cout << dp[i] << " ";
		//cout << endl;	
	}

	cout << dp[5] << endl;
	return 0;
}

Measured memory_bytes: 512
using System;

namespace AtCoder
{
    static class Program
    {
        static void Main()
        {
            double N = double.Parse(Console.ReadLine());
            double tax = 1.08;

            double X = Math.Ceiling(N / tax);
            if (Math.Floor(X * tax) == N)
                Console.WriteLine(X);
            else
                Console.WriteLine(":(");
        }
    }
}

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

int main(){
	int n;
	while(cin >> n){
		int output = 0;
		for(int a=0;a<=9;a++){
			for(int b=0;b<=9;b++){
				for(int c=0;c<=9;c++){
					for(int d=0;d<=9;d++){
						if(a+b+c+d==n){
							output++;
						}	
					}
				}
			}
		}
		cout << output << endl;
	}
}

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

int main(){
    int N,M;
    cin >> N >> M;
    vector<string> A(N),B(M);
    for(int i = 0; i < N; i++) cin >> A[i];
    for(int i = 0; i < M; i++) cin >> B[i];
    
    for(int i = 0; i < N - M + 1 ; i++){
        for(int j = 0; j < N - M + 1 ; j++){
            bool ok = true;
            for(int a = 0; a < M; a++){
                for(int b = 0; b < M; b++){
                    if(A[i+a][j+b]!=B[a][b])ok = false;
                }
            }
            
            if(ok){
                cout << "Yes" << endl;
                return 0;
            }   
        }
    }
    
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
using namespace std;
typedef pair<int,int>pii;
int n,ans;
pii a;
pii getab(int x){
	int a=x%10,b=0;
	while(x){
		b=x;
		x/=10;
	}
	return make_pair(a,b);
}
map<pii,int>mm;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++)mm[getab(i)]++;
	for(int i=1;i<=n;i++){
		a=getab(i);
		swap(a.first,a.second);
		ans+=mm[a];
	}
	cout<<ans<<endl;
	return 0;
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

ll N;

int ok(int x, bool out=false) {
	ll V=N;
	while(x) {
		if(V>=x) {
			V-=x;
			if(out) _P("%d\n",x);
		}
		if(V==0) return 1;
		x--;
	}
	return 0;
	
}

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	ll ret=(1<<20)-1;
	for(i=19;i>=0;i--) if(ok(ret-(1<<i))) ret-=1<<i;
	ok(ret,true);
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


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

int main(void)
{
	string s;
	cin >> s;

	int d[26] = {0};
	for (auto c : s) {
		d[c-97]++;
	}

	for (int i = 0; i < 26; i++) {
		if (d[i] == 0) {
			cout << (char)('a'+i) << endl;
			return 0;
		}
	}

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


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

namespace _070_CombinationofNumberSequences
{
	class Program
	{
		const int Length = 10;	//0~9

		static void Main ( string[] args )
		{
			string inputStr;

			while ((inputStr = Console.ReadLine ()) != null)
			{
				int[] inputNum = inputStr.Split (' ').Select (int.Parse).ToArray ();

				int count = 0;

				if (inputNum[1] <= Combination.Max)
				{
					count = Combination.GetCount (inputNum[0], inputNum[1]);
				}

				Console.WriteLine (count);
			}
		}

		static class Combination
		{
			public static int Max { private set; get; }
			private static int[,] CountArray { set; get; }

			static Combination ()
			{
				/*
				 * var range = Enumerable.Range (0, Length);
				 * var muitlple = Enumerable.Range (1, Length);
				 * Max = range.Zip (muitlple, ( r, m ) => r * m).Sum ();
				 * =>330
				*/

				Max = 330;
				CountArray = new int[Length + 1, Max + 1];

				bool[] boolArray = new bool[Length];
				CombinationCount (0, 0, boolArray);
			}

			public static int GetCount ( int leftCount, int sum )
			{
				return CountArray[leftCount, sum];
			}

			private static void CombinationCount ( int count, int sum, bool[] usedNumArray )
			{
				if (Length < count)
				{
					return;
				}

				CountArray[count, sum]++;

				for (int lp = 0; lp < Length; lp++)
				{
					if (!usedNumArray[lp])
					{
						usedNumArray[lp] = true;
						CombinationCount (count + 1, sum + lp * (count + 1), usedNumArray);
						usedNumArray[lp] = false;
					}
				}
			}
		}
	}
}

Measured memory_bytes: 9444
# Node
class Node
  attr_accessor :id, :edges, :cost, :done

  def initialize(id, edges = [], cost = nil, done = false)
    @id, @edges, @cost, @done = id, edges, cost, done
  end
end

# Edge
class Edge
  attr_accessor :to, :cost

  def initialize(to, cost)
    @to, @cost = to, cost
  end
end

# Dijkstra
class Dijkstra
  attr_accessor :nodes

  def initialize(data)
    @nodes = {}
    data.each do |id, edges|
      edges.map! { |edge| Edge.new(*edge) }
      @nodes[id] = Node.new(id, edges)
    end
  end

  def start(start_id)
    @nodes.each do |id, node|
      node.done = false
      node.cost = node.id == start_id ? 0 : -1
    end

    loop do
      done_node = nil
      @nodes.each do |id, node|
        next if node.done || node.cost < 0
        done_node = node if done_node.nil? || node.cost < done_node.cost
      end
      break if done_node.nil?
      done_node.done = true
      done_node.edges.each do |edge|
        node = @nodes[edge.to]
        cost = done_node.cost + edge.cost
        node.cost = cost if node.cost < 0 || cost < node.cost
      end
    end
  end
end

data = {}

n = gets.chomp.to_i

n.times do
  r, k, *t = gets.chomp.split.map(&:to_i)
  data[r] ||= []
  k.times do |i|
    data[r] << [t[i], 1]
  end
end

p = gets.chomp.to_i

p.times do
  s, d, v = gets.chomp.split.map(&:to_i)
  clone = Marshal.load(Marshal.dump(data))
  dijkstra = Dijkstra.new(clone)
  dijkstra.start(s)
  puts (dijkstra.nodes[d].cost != -1 && dijkstra.nodes[d].cost + 1 <= v) ? dijkstra.nodes[d].cost + 1 : :NA
end

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

void fnInput(int &rnLodC, int &rnTrkC, vector<int> &rvnLod)
{
  cin >> rnLodC >> rnTrkC;

  rvnLod.resize(rnLodC);
  for (int i = 0; i < rnLodC; i++)
    cin >> rvnLod[i];
}

int fnSimuAlloc(const vector<int> &cnrvnLod, int nTrkC, int iLod)
{
  int iCurLod;
  int iCntTrk = 0;

  for (int i = 0; i < cnrvnLod.size();    )
  {
    if (cnrvnLod[i] > iLod)  return 0;

    iCntTrk++;
    iCurLod = 0;
    while (i < cnrvnLod.size())
    {
      iCurLod += cnrvnLod[i];
      if (iCurLod > iLod)  break;

      i++;
    }
  }
  return (iCntTrk <= nTrkC);
}

void fnAlloc(const vector<int> &cnrvnLod, int nTrkC, int &rnMinLod)
{
  const int cnnMinLod = 0;
  const int cnnMaxLod = 1000000000;

  int nLow  = cnnMinLod;
  int nHigh = cnnMaxLod;
  rnMinLod = cnnMaxLod;

  while (nLow < nHigh)
  {
    int nMind = (nLow + nHigh) / 2;
    if (fnSimuAlloc(cnrvnLod, nTrkC, nMind))
    {
      rnMinLod = min(rnMinLod, nMind);
      nHigh = nMind;
    }
    else
      nLow = nMind + 1;
  }
}

void fnReSult(int nMinLod)
{
  cout << nMinLod << endl;
}

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

  int nLodC, nTrkC;
  vector<int> vnLod;
  int nMinLod = 0;

  fnInput(nLodC, nTrkC, vnLod);
  fnAlloc(vnLod, nTrkC, nMinLod);
  fnReSult(nMinLod);

  return 0;
}

Measured memory_bytes: 1524
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define PF push_front
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double
#define pii pair<int,int>
#define pll pair<LL,LL>
#define vi vector<int>
#define vii vector<vi>

const double pi = 3.14159265358979323846264;
const int mod=1000000007;


//mod演算ライブラリ
//mod=1000000007

LL add(LL a,LL b){
  return (a+b)%mod;
}

LL sub(LL a,LL b){
  return (a+mod-b)%mod;
}

LL mul(LL a,LL b){
  return ((a % mod) * (b % mod)) % mod;
}

LL power(LL x,LL y){//繰り返し二乗法 単品利用可
  if(y==0)return 1;
  else if(y==1)return x%mod;
  else if(y%2==0){
    LL tmp=power(x, y/2) % mod;
    return tmp*tmp%mod;
  }else {
    LL tmp=power(x, y/2) % mod;
    return ((tmp*tmp)%mod)*x%mod;
  }
}

LL dvs(LL a,LL b){
  return mul(a,power(b,mod-2));
}

const int SIZE_mod=200005;
int invfact[SIZE_mod];
int fact[SIZE_mod];

LL factset(int a){//aまでの階乗%mod表を作成
  fact[0]=1;
  FORQ(i,1,a){
    fact[i]=mul(fact[i-1],i);
  }
}

LL cmbset(int a){//1~aまでの階乗と階乗数の逆元のmod(mod)を用意 O(a)
  factset(a);
  invfact[a]=power(fact[a],mod-2);
  invfact[0]=1;
  FORD(i,a,1){
    invfact[i]=mul(invfact[i+1],i+1);
  }

}

LL cmb(int n,int r){//nCr%mod  (cmbset後に使用)
  if(n<r||r<0||n<0)return 0;
  return mul(fact[n],mul(invfact[r],invfact[n-r]));
}

LL prm(int n,int r){//nPr%mod
    return mul(cmb(n,r),fact[n]);
}

LL homo(int n,int r){//nHr%mod
  return cmb(n+r-1,r);
}


int main(){
	int n;
	cin>>n;
	vector<LL> a(n);
	FOR(i,0,n){
		cin>>a[i];
	}
	int cnt[66][2]={};
	FOR(i,0,n){
		FOR(j,0,62){
			if(a[i]&(1LL<<j)){
				cnt[j][1]++;
			}else{
				cnt[j][0]++;
			}
		}
	}
	LL ans=0;
	FOR(i,0,n){
		FOR(j,0,62){
			if(a[i]&(1LL<<j)){
				ans=add(mul(power(2,j),cnt[j][0]),ans);
			}else{
				ans=add(mul(power(2,j),cnt[j][1]),ans);
			}
		}
	}
	cout<<dvs(ans,2);
}


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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

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

#define FF first
#define SS second

template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class T>
istream& operator>>(istream& is, vector<T>& xs){
  for(auto& x: xs)
	is >> x;
  return is;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
ostream& operator<<(ostream& os, const vector<T>& xs){
  for(unsigned int i=0;i<xs.size();++i)
	os << (i?" ":"") << xs[i];
  return os;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}
void debug(istringstream&){}
template <char sep=',', class Head, class... Tail>
void debug(istringstream& iss, Head&& head, Tail&&... tail)
{
  string name;
  getline(iss, name, ',');
  cerr << sep << name << "=" << head;
  debug(iss, forward<Tail>(tail)...);
}
#define DEBUG(...) \
  do{ \
    istringstream ss(#__VA_ARGS__); \
    debug<' '>(ss, __VA_ARGS__); \
    cerr<<endl; \
  }while(0)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;



typedef vector<LL> Col;
typedef vector<Col> Matrix;

Matrix mul(const Matrix& A, const Matrix& B){
  const int R = A.size(), C = B[0].size(), sz = B.size();
  Matrix AB(R, Col(C));

  for(int i=0;i<R;++i)
    for(int j=0;j<C;++j)
      for(int k=0;k<sz;++k)
		    (AB[i][j] += A[i][k] * B[k][j] % MOD) %= MOD;

  return AB;
}

// O(N^3 lgN)
Matrix powA(const Matrix& A, LL n){
  const int N = A.size();
  Matrix p(N, Col(N, 0)), w = A;
  for(int i=0;i<N;++i) p[i][i] = 1;

  while(n>0){
    if(n&1)
      p = mul(p, w);
    w = mul(w, w);
    n >>= 1;
  }

  return p;
}

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

  LL N, K;
  cin >> N >> K;

  Matrix xs(N, Col(N));
  cin >> xs;

  auto a = powA(xs, K);
  LL ans = 0;
  REP(y,N) REP(x,N) (ans += a[y][x]) %= MOD;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 384
map = 10.times.map{ Array.new(10){0} }
readlines.each do |l|
  x, y, size = l.split(",").map(&:to_i)
  drops = [[0, 0], [0,1], [1,0], [0,-1], [-1,0]]
  drops += [[1, 1], [1, -1], [-1, 1], [-1, -1]] if size>=2
  drops += [[2, 0], [0, 2], [-2, 0], [0, -2]] if size>=3
  drops.each do |dx,dy|
    xt, yt = x+dx, y+dy
    map[xt][yt] += 1 if (0..9).include?(xt) && (0..9).include?(yt)
  end
end
puts map.map{|i| i.count{|j| j==0} }.inject(:+)
puts map.map{|i| i.max}.max

Measured memory_bytes: 6116
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		
		int sum = sc.nextInt() + sc.nextInt() + sc.nextInt();
		
		if(sum >= 22) {
			System.out.println("bust");
		}
		else {
			System.out.println("win");
		}
	}

}


Measured memory_bytes: 25044
N, M = map(int, raw_input().split(" "))

xyz = []
for i in range(N):
    xyz.append(map(int, raw_input().split(" ")))
result = -1
i = j = k = 1

def compare(x, y):
    if i*x[0]+j*x[1]+k*x[2]>i*y[0]+j*y[1]+k*y[2]:
        return 1
    elif i*x[0]+j*x[1]+k*x[2]<i*y[0]+j*y[1]+k*y[2]:
        return -1
    else:
        return 0

def calculate(x, y):
    return [x[0]+y[0], x[1]+y[1], x[2]+y[2]]

for i in [1,-1]:
    for j in [1,-1]:
        for k in [1,-1]:
            xyz.sort(compare)
            tmp = 0 if M==0 else sum(map(abs, reduce(calculate, xyz[:M])))
            result = max(tmp, result)

print result

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

using i64 = int64_t;

int main() {
    i64 n, w;
    cin >> n >> w;
    
    vector<i64> ws(n), vs(n);
    
    for (int i = 0; i < n; i++) {
        cin >> ws[i] >> vs[i];
    }
    
    vector<i64> dp(w + 1);
    
    for (int i = 0; i < n; i++) {
        for (int j = w; j >= 0; j--) {
            if (j + ws[i] <= w) {
                dp[j + ws[i]] = max(dp[j + ws[i]], dp[j] + vs[i]);   
            }
        }
    }
    
    cout << dp[w] << endl;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define aut(r,v) __typeof(v) r = (v)
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL-1
using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
const ll mod = 1e9 + 7;


int main(void){
	int n;
	cin>>n;
	string ans="";
	int cnt[100][27]={0};
	for(int i=0;i<n;i++){
		string str;
		cin>>str;
		for(int j=0;j<str.size();j++){
			cnt[i][str[j]-'a']++;
		}
	}
	for(int i=0;i<27;i++){
		int mi=100;
		for(int j=0;j<n;j++){
			mi=min(cnt[j][i],mi);
		}
		char x='a'+i;
		rep(ii,mi){
			ans+=x;
		}
	}
	cout<<ans<<endl;
}

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

int main(){
    int N; cin >> N;
    vector<int> p(N);
    for(int i=0;i<N;i++){
        cin >> p[i];
    }

    int a=0,b=0,c=0,d=0;
    for(int i=0;i<N;i++){
        if(p[i] != i+1){
            a=i;
            c=p[i];
            p[i]=i+1;
            break;
        }
    }
    for(int i=0;i<N;i++){
        if(p[i] != i+1){
            b=i;
            d=p[i];
            p[i]=i+1;
            break;
        }
    }
    if(c == b+1 && d == a+1){
        cout << "YES" << endl;
    }else if(a==0 && b==0){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
}

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

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF * 300 * 300;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

LL modinv(LL a) {
    LL b = MOD, u = 1, v = 0;
    while (b) {
        LL t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= MOD;
    if (u < 0) u += MOD;
    return u;
}

LL moddev(LL a, LL b){
	return a * modinv(b) % MOD;
}

void Main()
{
    int x,y,a,b,c;
    cin>>x>>y>>a>>b>>c;

    vector<LL> p(a);
    REP(i,a) cin>>p[i];
    vector<LL> q(b);
    REP(i,b) cin>>q[i];
    vector<LL> r(c);
    REP(i,c) cin>>r[i];

    sort(ALL(p), greater<LL>());
    sort(ALL(q), greater<LL>());
    sort(ALL(r), greater<LL>());

    vector<LL> mix;
    LL result = 0;
    REP(i,x){
        result += p[i];
        mix.push_back(p[i]);
    }
    REP(i,y){
        result += q[i];
        mix.push_back(q[i]);
    }

    sort(ALL(mix), greater<LL>());

    LL tm=0;
    LL tr=0;
    LL d=0;

    REP(i,min(x+y,c)){
        tm += mix[x+y-i-1];
        tr += r[i];
        d = max(d,tr-tm);
        //dump(d)
    }

    cout << result+d << endl;
}

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

Measured memory_bytes: 4852
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.List;
import java.util.Queue;

public class Main {

	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());

		double p[] = new double[n];
		String str[] = br.readLine().split(" ");

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

		double dp[][] = new double[3100][3100];
		dp[0][0] = 1.0;

		for (int i = 0; i < n; i++) {
			for (int j = 0; j <= i; j++) {
				dp[i + 1][j + 1] += dp[i][j] * p[i];
				dp[i + 1][j] += dp[i][j] * (1 - p[i]);
			}
		}

		double ans = 0.0;
		for (int i = (n + 1) / 2; i <= n; i++) {
			ans += dp[n][i];
		}

		System.out.println(ans);
	}
}


Measured memory_bytes: 130508
//Md. Shajibul Islam..
//East West University, CSE Department'19

#include<bits/stdc++.h>
using namespace std;
#define FAST             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define loop(i,n)        for(int i=0;i<n;i++)
#define CASE_PRINT       cout<<"Case "<<C<<": "
#define CASE_PRINT2      cout<<"Case "<<C<<":"<<endl
#define ll               long long
#define ld               long double
#define Pi               2*acos(0.0) // acos(-1.0)

int main()
{
    FAST;
    int n,x,t;cin>>n>>x>>t;

    int ans;
    if(n<=x)cout<<t<<endl;
    else
    {
        int tim=t;
        int xx = x;
        while(xx<n)
        {
            xx+=x;
            tim+=t;
        }
        cout<<tim<<endl;
    }
}





Measured memory_bytes: 3580
#include <stdio.h>
int main()
{
    int a, b, fee;
    scanf("%d%d", &a, &b);
    if (a < 6)
        fee = 0;
    else if (a > 12)
        fee = b;
    else
        fee = b / 2;
    printf("%d",fee);
    return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <cstdio>
#include <math.h>
#include <iostream>
#include <string>

int main()
{

    char x, y;

    scanf(" %c", &x);
    scanf(" %c", &y);

    if (x > y)
    {
        std::cout << ">"
                  << "\n";
    }
    else if (x < y)
    {
        std::cout << "<"
                  << "\n";
    }
    else
    {
        std::cout << "="
                  << "\n";
    }

    return 0;
}

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

using namespace std;
using ll = long long;
using ull = unsigned long long;

constexpr ll LLINF {1001002003004005006};//ll = 9*LLINF
constexpr int INTINF {1000000000};//int = 2*INTINF

#define  rep(i,n)   for(int i = 0; i < (n); ++i)
#define rrep(i,n)   for(int i = 1; i <= (n); ++i)
#define drep(i,n)   for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for(int i = s; i < t;  ++i)

template<typename T>
void maxs(T& x, T& y) {
  x=std::max(x,y);
}

template<typename T>
void mins(T& x, T&& y) {
  x=std::min(x,y);
}

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

  int N;
  cin >> N;
  vector<int> W(N);
  rep(i, N) cin >> W[i];
  int sum {};
  rep(i, N) {
    sum += W[i];
  }
  int t_sum {};
  int answer {sum};
  rep(i, N) {
    t_sum += W[i];
    // x + y = z
    // x - y = z - 2*y
    mins(answer, std::abs(sum - 2*t_sum));
  }
  cout << answer << '\n';
}


Measured memory_bytes: 256
# coding: utf-8
# Your code here!
MI=lambda:map(int,input().split())
n,k,c=MI()
s=input()

left=[];right=[]
i=0
while 0<=i<=n-1:
    if s[i]=="o":
        left+=(i),
        i+=c+1
    else:
        i+=1
j=n-1
while 0<=j<=n-1:
    if s[j]=="o":
        right+=j,
        j-=(c+1)
    else:
        j-=1

ans=list(set(left)&set(right))

if len(ans)>k:
    print()
else:
    for q in sorted(ans):
        print(q+1)

Measured memory_bytes: 50336
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 998244353
#define rint register int
inline ll read(){ll r;int s=0,c;for(;!isdigit(c=getchar());s=c);for(r=c^48;isdigit(c=getchar());(r*=10)+=c^48);return s^45?r:-r;}
inline int fxp(int s, int n=MOD-2){int a=1;for(;n;n&1?a=1ll*a*s%MOD:0,s=1ll*s*s%MOD,n>>=1);return a;}
ll K; int fac[300005], efac[300005], N, A, B, Ans; inline int C(int n, int k){return n<0||k<0||n<k?0:1ll*fac[n]*efac[k]%MOD*efac[n-k]%MOD;}
int main()
{
	N = read(); A = read(); B = read(); K = read(); for(rint i = fac[0] = 1; i <= N; fac[i] = 1ll*i*fac[i-1]%MOD, i++); efac[N] = fxp(fac[N]); for(rint i = N; i; efac[i-1] = 1ll*i*efac[i]%MOD, i--);
	for(ll a = 0, b; a <= N && K >= 0; !(K%B) ? b = K/B, Ans = (Ans+1ll*C(N,a)*C(N,b))%MOD : 0, a++, K -= A); return !printf("%d\n",Ans);
}

Measured memory_bytes: 2560
import java.util.*;
import static java.lang.System.*;
import static java.lang.Math.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(in);
String s=sc.next();
    if (s.contains("9")) {
        out.println("Yes");
    }else{
        out.println("No");
    }
        
}
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
int main(){
    int c[5][5];
    int sum = 0;
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 3; j++) {cin >> c[i][j]; sum += c[i][j];}
    }

    if(sum % 3 != 0) {cout << "No" << endl; return 0;}

    int b1 = c[0][0], b2 = c[0][1], b3 = c[0][2];
    int a2_1 = c[1][0] -b1, a2_2 = c[1][1] -b2, a2_3 = c[1][2] -b3;
    int a3_1 = c[2][0] -b1, a3_2 = c[2][1] -b2, a3_3 = c[2][2] -b3;
    if(a2_1 == a2_2 && a2_2 == a2_3 && a2_3 == a2_1){
        if(a3_1 == a3_2 && a3_2 == a3_3 && a3_3 == a3_1){
            cout << "Yes" << endl; return 0;
        }
    }
    cout << "No" << endl;

}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int n,s,t,b;
int kai[16][9];
bool visited[16][9];
int dx[]={0,1,0,-1},dy[]={-3,0,3,0};

void dfs(int p,int e){
  visited[e][p]=1;
  if(e==n){
    if(p==t)kai[e][p]=1;
    return;
  }
  for(int i=0;i<4;i++){
    int np=p+dx[i]+dy[i];
    if(dx[i]+p%3<0||dx[i]+p%3>=3||np<0||9<=np||np==b)np=p;
    if(!visited[e+1][np])dfs(np,e+1);
    kai[e][p]+=kai[e+1][np];
  }
}

int main(){
  while(cin>>n&&n!=0){
    char sc,tc,bc;
    for(int i=0;i<16;i++)for(int j=0;j<9;j++)kai[i][j]=0,visited[i][j]=0;
    cin>>sc>>tc>>bc;
    s=sc-'A',t=tc-'A',b=bc-'A';
    dfs(s,0);
    cout<<1.0*kai[0][s]/(1<<(n*2))<<endl;
  }
  return 0;
}

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

#define REP(i, s, e) for(int i = (int)(s); i < (int)(e); ++i)
#define rep(i, n) REP(i, 0, n)

#define X real()
#define Y imag()

using D = double;
using P = complex<D>;
using G = vector<P>;

const D EPS = 1e-10;
namespace std {
  bool operator < (const P& a, const P& b) {
    return a.X != b.X ? a.X < b.X : a.Y < b.Y;
  }
};

struct L : array<P, 2> {
  L () = default;
  L(const P& a, const P& b) {
    front() = a;
    back() = b;
  }
  P vec() const {
    return back() - front();
  }
};
D dot(const P& a, const P& b) {
  return (conj(a)*b).X;
}
D cross(const P& a, const P& b) {
  return (conj(a)*b).Y;
}
int ccw(P a, P b, P c) {
  b -= a;
  c -= a;
  if(cross(b, c) > 0) return +1; // ccw
  if(cross(b, c) < 0) return -1; // cw
  if(dot(b, c) < 0) return +2; // L c-a-b
  if(norm(b) < norm(c)) return -2; // L a-b-c
  return 0;
}

bool intersectLL(const L& l, const L& m) {
  return abs(cross(l.vec(), m.vec())) > EPS ||
    abs(cross(l[1] - l[0], m[0] - l[0])) < EPS;
}

P projection(const L& l,const P& p) {
  D t = dot(p-l[0], -l.vec()) / norm(-l.vec());
  return l[0] + t*(-l.vec());
}
P refrection(const L& l, const P& p) {
  return p  + 2.0 * (projection(l, p) - p);
}

D area(const G& g) {
  int n = g.size();
  D s = 0.0;
  rep(i, n) {
    int j = (i+1)%n;
    s += cross(g[i], g[j]);
  }
  return abs(s) / 2.0;
}

vector<string> split(const string& s, char c = ' ') {
  stringstream ss(s);
  vector<string> ret;
  string t;
  while(getline(ss, t, c)) ret.push_back(t);
  return ret;
}
int main() {
  cout << fixed << setprecision(15);  
  string s;
  G g;
  while(getline(cin, s)) {
    auto v = split(s, ',');
    D x, y;
    x = stof(v[0].c_str());
    y = stof(v[1].c_str());
    g.emplace_back(x, y);
  }
  cout << area(g) << endl;
  return 0;
}



Measured memory_bytes: 3176
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n=int(input())
s=input()
for i in range(n-2):
    if s[i:i+3]=="ABC":
        count+=1
print(count)


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

#from collections import defaultdict
#from heapq import heappush, heappop
import sys

sys.setrecursionlimit(10**6)
input = sys.stdin.buffer.readline
INF = 10 ** 9 + 1  # sys.maxsize # float("inf")


def debug(*x):
    print(*x, file=sys.stderr)


def solve(N, K, AS):
    AS.sort()
    MIN = AS[0]

    table = [0] * (K + 1)
    for i in range(MIN):
        table[i] = -1  # LOSE

    for i in range(MIN, K + 1):
        for a in AS:
            if table[i - a] == -1:
                table[i] = 1
                break
        else:
            table[i] = -1

    # debug(": table", table)

    if table[K] == 1:
        return "First"

    else:
        return "Second"


def main():
    # parse input
    N, K = map(int, input().split())
    AS = list(map(int, input().split()))
    print(solve(N, K, AS))


# tests
T1 = """
2 4
2 3
"""


def test_T1():
    """
    >>> as_input(T1)
    >>> main()
    First
    """


T2 = """
2 5
2 3
"""


def test_T2():
    """
    >>> as_input(T2)
    >>> main()
    Second
    """


T3 = """
2 7
2 3
"""


def test_T3():
    """
    >>> as_input(T3)
    >>> main()
    First
    """


T4 = """
3 20
1 2 3
"""


def test_T4():
    """
    >>> as_input(T4)
    >>> main()
    Second
    """


T5 = """
3 21
1 2 3
"""


def test_T5():
    """
    >>> as_input(T5)
    >>> main()
    First
    """


T6 = """
1 100000
1
"""


def test_T6():
    """
    >>> as_input(T6)
    >>> main()
    Second
    """
# add tests above


def _test():
    import doctest
    doctest.testmod()


def as_input(s):
    "use in test, use given string as input file"
    import io
    global read, input
    f = io.StringIO(s.strip())

    def input():
        return bytes(f.readline(), "ascii")

    def read():
        return bytes(f.read(), "ascii")


USE_NUMBA = False
if (USE_NUMBA and sys.argv[-1] == 'ONLINE_JUDGE') or sys.argv[-1] == '-c':
    print("compiling")
    from numba.pycc import CC
    cc = CC('my_module')
    cc.export('solve', solve.__doc__.strip().split()[0])(solve)
    cc.compile()
    exit()
else:
    input = sys.stdin.buffer.readline
    read = sys.stdin.buffer.read

    if (USE_NUMBA and sys.argv[-1] != '-p') or sys.argv[-1] == "--numba":
        # -p: pure python mode
        # if not -p, import compiled module
        from my_module import solve  # pylint: disable=all
    elif sys.argv[-1] == "-t":
        print("testing")
        _test()
        sys.exit()
    elif sys.argv[-1] != '-p' and len(sys.argv) == 2:
        # input given as file
        input_as_file = open(sys.argv[1])
        input = input_as_file.buffer.readline
        read = input_as_file.buffer.read

    main()


Measured memory_bytes: 73376
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 

typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
using namespace std;

ll dp[2005][2005];
ll sdp[2005][2005];

int main(int argc, char* argv[])
{
    int n,m;
    scanf("%d%d", &n, &m);

    vector<int> a(n), b(m);
    int i, j;
    for(i=0; i<n; i++) {
        scanf("%d", &a[i]);
    }
    for(i=0; i<m; i++) {
        scanf("%d", &b[i]);
    }

    for(i=0; i<=n; i++) {
        sdp[i][0]=1;
    }
    for(i=0; i<=m; i++) {
        sdp[0][i]=1;
    }

    for(i=1; i<=n; i++) {
        for(j=1; j<=m; j++) {
            dp[i][j] = 0;
            if(a[i-1]==b[j-1]) {
                dp[i][j] = (dp[i][j] + sdp[i-1][j-1])%MOD;
            }
            sdp[i][j]=(dp[i][j]+sdp[i][j-1]+sdp[i-1][j]-sdp[i-1][j-1]+MOD)%MOD;
        }
    }
    printf("%lld\n", sdp[n][m]);

    return 0;
}


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

int main(){
  int w, h, x, y, r;
  cin >> w >> h >> x >> y >> r;
  if(0 <= (x - r) && (x + r) <= w && 0 <= (y - r) && (y + r) <= h) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

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


int N,K;
void solve() {
    cin>>N>>K;
    int c = 0;
    for(int i=0;i<N;i++){
        int h;
        cin >> h;
        if(h>=K) c ++;
    }
    cout<<c<<endl;
}

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



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m; i < n; i++) 
#define mod 1000000007
#define pi 3.1415926535
typedef long long ll;


int main(){
    int N,A,B;
    cin>>N>>A>>B;
    vector<int>P(N);
    int count_1=0,count_2=0, count_3=0;
    rep(i,N){
        cin>>P[i];
        if(P[i]<=A){
            count_1++;
        }else if(P[i]>=A+1&&P[i]<=B){
            count_2++;
        }else if(P[i]>=B+1){
            count_3++;
        }
    }
    cout<<min({count_1,count_2,count_3})<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <ctime>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <numeric>
#include <cassert>
using namespace std;
static const double EPS = 1e-10;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define all(a) a.begin(),a.end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define SS stringstream
#define DBG1(a) rep(_X,sz(a)){printf("%d ",a[_X]);}puts("");
#define DBG2(a) rep(_X,sz(a)){rep(_Y,sz(a[_X]))printf("%d ",a[_X][_Y]);puts("");}
#define bitcount(b) __builtin_popcount(b)
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)

#define delete(a,n) a.erase(remove(all(a),n),a.end())
template<typename T, typename S> vector<T>& operator<<(vector<T>& a, S b) { a.push_back(b); return a; }
template<typename T> void operator>>(vector<T>& a, int b) {while(b--)if(!a.empty())a.pop_back();}
bool isprime(int n){ if(n<2)return false;  for(int i=2;i*i<=n;i++)if(n%i==0)return false;  return true;} 
ll b_pow(ll x,ll n){return n ? b_pow(x*x,n/2)*(n%2?x:1) : 1ll;}
string itos(int n){stringstream ss;ss << n;return ss.str();}

typedef unsigned int uint;
int in() {
    int x = 0, c;
    for (; (uint)((c = getchar()) - '0') >= 10; ) { if (c == '-') return -in(); if (!~c) throw ~0; }
    do { x = (x << 3) + (x << 1) + (c - '0'); } while ((uint)((c = getchar()) - '0') < 10);
    return x;
}

int solve(int S){
	for(int i = 1 ; i <= S ; i++){
		if( S < (3*i+1) || (i > (S-i)/(2*i+1)) ){
			break;
		}
		if( (S-i) % (2*i+1) == 0 ){
			//cout << i << " " << (S-i)/(2*i+1) << " " << i+(S-i)/(2*i+1)+2*i*(S-i)/(2*i+1) << " " << S << endl;
			return 0;
		}
	}
	return 1;
}
int dp[10000] = {};
int main(){
	int n = in();
	int ans = 0;
	while(n--){
		int t = in();
		ans+=solve(t);
	}
	cout << ans << endl;
}

Measured memory_bytes: 1128
import java.util.Scanner;
class Main{
 public static void main(String args[]){
Scanner sc=new Scanner(System.in);
int N= sc.nextInt();
int T= sc.nextInt();
int c[]=new int[N];
int t[]=new int[N];
for(int n=0;n<N;n++) {
c[n]=sc.nextInt();
t[n]=sc.nextInt();
 }
int cost=0;
boolean home=false;
for(int k=0;k<N;k++) {
	if(!home) {
	if(t[k]<=T) {
	cost=c[k];
	home=true;
	  }
	 }
 if(c[k]<cost) {
		if(t[k]<=T){
			cost=c[k];
		}
	}
}
System.out.println((home)?cost:"TLE");
 }
  }

Measured memory_bytes: 23636
N = int(input())
V_li = list((map(int, input().split())))
C_li = list((map(int, input().split())))

ans_li = []
for i in range(N):
    R = V_li[i] - C_li[i]
    if R >= 0:
        ans_li.append(R)
print(sum(ans_li))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
        using namespace std;
        #define tani_nachi_ke  ios_base::sync_with_stdio(false); cin.tie(NULL);
        #define M_PI 3.14159265358979323846
        #define data data_
        #define ff first
        #define ss second
        #define pb push_back
        #define ll long long
        #define ld long double

        int main()
        {
            tani_nachi_ke  


            char c;
            cin >> c;
            c++;
            cout << c << endl;






           return 0;
        }

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

int f(int n) {

    int count = 0;

    for(int i = 1; i <= n; ++i) {

        int x = (i + i + i)*(i + i + i) - 3*i*i;
        if(x > n)
            break;

        for(int j = i; j <= n; ++j) {

            int y = (i + j + j)*(i + j + j) - 2*i*j - j*j;
            if(y > n)
                break;

            for(int k = j; k <= n; ++k) {
                
                int a = i + j + k;
                int b = i*j + j*k + k*i;

                if(a*a - b == n) {
                    
                    if(i == j && j == k)
                        count++;
                    else if(i != j && j != k)
                        count += 6;
                    else
                        count += 3;

                    break;
                }
                else if(a*a - b > n)
                    break;


            }
        }
    }

    return count;

}

int main() {


    int n;

    cin >> n;

    for(int i = 1; i <= n; ++i) {
        cout << f(i) << endl;

    }

    return 0;
}

Measured memory_bytes: 3616
#include <iostream>
#include <stdio.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
using namespace std;
#define REP(i,n); for(int i = 0;i < (int)(n);i++)

int main() {
	vector<int> a;
	a.resize(3);

	cin >> a[0] >> a[1] >> a[2];
	sort(a.begin(), a.end());
	if(a[0]==a[2]){
		cout << "No" <<endl;
	}else if(a[0]!=a[1] && a[1]!=a[2]){
		cout << "No" <<endl;
	}else if(a[0]==a[1] && a[1]!=a[2]){
		cout << "Yes" <<endl;
	}else if(a[0]!=a[1] && a[1]==a[2]){
		cout << "Yes" <<endl;
	}

	return(0);
}


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

int solve(int mx,int n,int s){
	if(n == 0){
		if(s == 0){
			return 1;
		}
		else{
			return 0;
		}
	}
	if(mx == 0 && s > 0){
		return 0;
	}
	if(s == 0){
		if(n == 1){
			return 1;
		}
		else{
			return 0;
		}
	}
	
	int t = solve(mx-1,n,s);
	int u = s >= mx ? solve(mx-1,n-1,s-mx) : 0;
	return t + u;
}

int main(){
	int n,s;
	while(cin >> n >> s,n != 0){
		cout << solve(9,n,s) << endl;
	}
	return 0;
}



Measured memory_bytes: 3088
//author:Deshansh Garg
#include<bits/stdc++.h>
typedef long long int lli;
using namespace std;

    
int main()
{
    lli n; cin>>n;
    lli mat[n][3];
    lli j=0;
    for(int i=0;i<n;i++)
    {
     if(i==0)
     {
        cin>>mat[i][0]>>mat[i][1]>>mat[i][2];
     }
     else 
     {
        cin>>j;
        mat[i][0]=max(j+mat[i-1][1],j+mat[i-1][2]);
        cin>>j;
         mat[i][1]=max(j+mat[i-1][0],j+mat[i-1][2]);
         cin>>j;
          mat[i][2]=max(j+mat[i-1][0],j+mat[i-1][1]);
     }
    }
    cout<<max(max(mat[n-1][2],mat[n-1][1]),mat[n-1][0])<<endl;


     return 0;
    
}

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

using namespace std;

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

	int res = 0;
	int i = 0;

	while (i < N)
	{
		i += (2 * D + 1);
		res += 1;
	}


	cout << res << endl;
	return 0;
}


Measured memory_bytes: 256
N, M, R = map(int, input().split())
rs = list(map(int, input().split()))
rs = [r-1 for r in rs]
D = [[100000*2000]*N for i in range(N)]
for i in range(N):
  D[i][i] = 0
for i in range(M):
  A, B, C = map(int, input().split())
  A, B = A-1, B-1
  D[A][B] = C
  D[B][A] = C
for k in range(N):
  for i in range(N):
    for j in range(N):
      D[i][j] = min(D[i][j], D[i][k]+D[k][j])
#print(D)
r = 100000*2000
import itertools
for rs2 in itertools.permutations(rs):
  r2 = 0
  for i in range(1, R):
    r2 += D[rs2[i-1]][rs2[i]]
  r = min(r, r2)
print(r)


Measured memory_bytes: 47960