akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

#define MOD 1000000007
#define TWO 500000004

int n, x[105], par[105], ta, tc;
set<int> m;
set<int>::iterator it;
long long ya[105], yb[105], tb;

int find(int a) {
	return par[a] == a ? a : par[a] = find(par[a]);
}

long long po(long long b, int p) {
	long long re = 1;
	while (p) {
		if (p & 1)
			re = re * b % MOD;
		b = b * b % MOD;
		p >>= 1;
	}
	return re;
}

int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		scanf("%d", x + i);
		m.insert(x[i]);
	}
	m.insert(1);
	it = m.end();
	while (it != m.begin()) {
		it--;
		ta = *it;
		for (int i = 1; i <= n; i++)
			if (par[i]) {
				if (par[i] == i) {
					yb[i] = yb[i] * po(2, x[i] - ta) % MOD;
					x[i] = ta;
					if (par[i - 1]) {
						tc = find(i - 1);
						tb = yb[tc] * yb[i] % MOD * TWO % MOD;
						ya[tc] = ((ya[tc] + yb[tc]) * (ya[i] + yb[i]) % MOD + MOD - tb) % MOD;
						yb[tc] = tb;
						par[i] = tc;
					}
				}
			} else if (x[i] == ta) {
				if (par[i - 1]) {
					tc = find(i - 1);
					ya[tc] = (ya[tc] * 2 + yb[tc]) % MOD;
					par[i] = tc;
				} else {
					par[i] = i;
					yb[i] = 2;
				}
			}
		// printf("[%d]\n", ta);
		// for (int i = 1; i <= n; i++) if (par[i] == i) printf("%d  %lld %lld\n", i, ya[i], yb[i]);
	}
	printf("%lld\n", (ya[1] + yb[1]) % MOD);
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;

long long po(long long a, long long b, long long m){
    if(b==0){
        return 1;
    }
    
    long long z = po(a,b/2,m);
    z = (z*z)%m;
    if(b%2!=0){
        z = (a*z)%m;
    }
    return z;
}

bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}

int main(){
  
  long long l,a,b,m;
  cin>>l>>a>>b>>m;
  long long c;
  long long power = 1;
  long long ans[3];
  ans[0] = 0;
  ans[1] = a%m;
  ans[2] = 1LL;
  for(long long d = 1; d<=18; d++){
    long long left, right;
    left = ((power - a) + b - 1)/b;
    left = max(left, 0LL);
    right = ((10LL*power - a) + b - 1)/b;
    right = min(right, l);
    c = right - left;
    //cout<<c<<endl;
    power *= 10LL;
    long long mat[3][3] = {};
    mat[0][0] = po(10LL, d, m);
    mat[1][0] = mat[1][1] = mat[2][2] = 1LL;
    mat[2][1] = b%m;
    while(c>0){
      if(c & 1){
        long long temp[3] = {};
        REP(i,3){
          REP(j,3){
            temp[i] += (ans[j]*mat[j][i])%m;
            temp[i] %= m;
          }
        }
        REP(i,3){
          ans[i] = temp[i];
        }
      }
      c /= 2;
      
      long long tempMat[3][3] = {};
      REP(i,3){
        REP(j,3){
          REP(k,3){
            tempMat[i][j] += (mat[i][k]*mat[k][j])%m;
            tempMat[i][j] %= m;
          }
        }
      }
      REP(i,3){
        REP(j,3){
          mat[i][j] = tempMat[i][j];
        }
      }
    }
  }
  
  cout<<ans[0]<<endl;
  return 0;
}


Measured memory_bytes: 256
N,K = map(int, input().split())
if N==0:
    print(0)
    exit()
if K==1:
    print(0)
    exit()
if K==2:
    if N%2==0:
        print(0)
        exit()
    else:
        print(1)
        exit()

def func(x,K):
    tmp=x-K
    if tmp<0:
        tmp*=(-1)
    return tmp

if (N>K):
    y=int(N/K)
    N=func(N,K*y)

ans = N
while(True):
    N=func(N,K)
    if N<ans:
        ans=N
    else:
        break
print(ans)


Measured memory_bytes: 3064
sx,sy,tx,ty = map(int,input().split())
ans1 =tx - sx
ans2 = ty - sy
Answer1 = 'R'*ans1 + 'U'*ans2 +'L'*ans1+'D'*(ans2+1)
Answer2 = 'R'*(ans1+1) +'U'*(ans2+1)+'L' +'U'+'L'*(ans1+1)+'D'*(ans2+1)+'R'
Answer = Answer1 + Answer2
print(Answer)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define fi first
#define se second
#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)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=1010010010010010000;
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;
}
//グリッド：（典型）dp,dfs,bfs,最短経路,その他
ll n;
vl Divisor(ll x){
    vl res;
    for(ll i=1;i*i<=x;i++){
        if(x%i==0) res.push_back(i);
        if(i*i!=x&&x%i==0) res.push_back(x/i);
    }
    return res;
}
int main(){
    cin>>n;
    ll ans=0;
    for(auto x:Divisor(n)){
        if(x==1) continue;
        ll tmp=n;
        while(tmp%x==0) tmp/=x;
        tmp%=x;
        if(tmp==1) ans++;
    }
    ans+=(ll)Divisor(n-1).size()-1;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 384
/*
* @Author: _dp95
* @Date:   2020-04-05 07:42:40
*/
#include "bits/stdc++.h"
using namespace std ;

#define timesaver ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll ;
typedef long double ldb ;

#define mp make_pair
#define pb push_back
#define F first
#define S second
#define nl '\n'

#define all( x ) x.begin(),x.end() 
#define sz( x ) ( int )( x ).size( )
#define mem( a, val ) memset(a, val, sizeof( a ) )
#define deci( x ) cout<<fixed<<setprecision( x );
#define bitcount( x ) __builtin_popcountll( x )

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

const int MAX = 2*1000*1000 + 10 ;
const ll INF = 1e18 ;
const int MOD = 1e9 + 7 ;

ll add( ll a, ll b ){
    return ( ( a % MOD ) + ( b % MOD ) ) % MOD ;
}

ll sub( ll a, ll b ){
    return ( ( a % MOD ) - ( b % MOD ) + MOD ) % MOD ;
}

ll mul( ll a, ll b ){
    return ( ( a % MOD ) * ( b % MOD ) ) % MOD ;
}

ll exp( ll a, ll b ){
    ll ans = 1 ;
    while( b ){
        if( b&1 )
            ans = mul( ans, a ) ;
        a = mul( a, a ) ;
        b >>= 1 ;
    }
    return ans ;
}

const int M = 51 ;
struct Matrix {
  int a[M][M];
  int n ;

  Matrix( int n = M ):n(n) {
    for (int i = 0; i < M; ++i)
      fill(a[i], a[i] + M, 0);
  }

  int* operator[](int x) {
    return a[x];
  }

  Matrix operator * (Matrix &to) {
    Matrix ans;
    for (int i = 0; i < n; ++i)
      for (int j = 0; j < n; ++j)
        for (int k = 0; k < n; ++k)
          ans[i][j] = add(ans[i][j], mul(a[i][k], to[k][j]));
    return ans;
  }

} ONE;

Matrix bin(Matrix A, ll n ) {
  for (int i = 0; i < M; ++i)
    ONE[i][i] = 1;
  Matrix B = ONE;
  while (n) {
    if (n & 1)
      B = B * A;
    A = A * A;
    n >>= 1;
  }
  return B;
}


signed main( ){
  timesaver ;
  ll n, k ;
  cin >> n >> k ;
  Matrix x( n ) ;
  for( int i = 0 ; i < n ; i++ )
    for( int j = 0 ; j < n ; j++ )
      cin >> x[i][j] ;
  x = bin( x, k ) ;
  ll ans(0) ;
  for( int i = 0 ; i < n ; i++ )
    for( int j = 0 ; j < n ; j++ ){
      ans += x[i][j] ;
      if( ans >= MOD )
        ans %= MOD ;
    }
  cout << ans << nl ;
}

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

using namespace std;

typedef long long int ll;
#define pb push_back
vector< vector<int> > gr;

int dp[100005];

int n,m;


int find(int u)
{
	if(dp[u]!=0) return dp[u];

	int mx=0;

	for(int i=0;i<gr[u].size();i++)
	{
		mx=max(1+find(gr[u][i]),mx);
	}
	return dp[u]=mx;
}


int main()
{

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);

	
	memset(dp,0,100005);

	cin>>n>>m;



	for(int i=0;i<=n;i++)
	{
		vector<int> v;
		gr.pb(v); 
	}

	for(int i=0;i<m;i++)
	{
		int j,k;
		cin>>j>>k;

		gr[j].pb(k);
	}
	
	for(int i=1;i<=n;i++)
	{
		int tt=find(i);
	}
	
	int mx=0;

	for(int i=1;i<=n;i++) mx=max(mx,dp[i]);

	cout<<mx<<endl;
	return 0; 
}











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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

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

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

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

    ll N;
    cin >> N;
    vector<ll> A(N);
    REP(i, N) cin >> A[i];

    ll sum = 0;
    ll tum = 0;
    REP(i, N) sum += A[i], tum += (i+1);
    vector<ll> B(N);
    REP(i, N-1) B[i] = A[i+1] - A[i];
    B[N-1] = A[0] - A[N-1];

    bool flag = true;
    if(sum%tum){
    	flag = false;
    }else{
    	REP(i, N){
    		B[i] -= (sum/tum);
    		B[i] *= -1;
    	}
    	ll tmp = 0;
    	REP(i, N){
            if(B[i]<0) flag = false;
    		if(B[i]%N) flag = false;
    		tmp += B[i]/N;
    	}
    	if(tmp != sum/tum) flag = false;
    }
    cout << (flag ? "YES" : "NO") << endl;
    return 0;
}

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


int main() {
  string s;
  int cnt = 0;
  cin >> s;
  vector<char> a(s.size()),b(s.size());
  rep(i,s.size()) {
    a.at(i) = s.at(i);
    b.at(i) = a.at(i);
  }
  reverse(b.begin(),b.end());
  rep(i,s.size()/2){
    if(a.at(i) != b.at(i)){
      a.at(i) = b.at(i);
      cnt ++;
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int ,int> P;
#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for(int i = ( n ) - 1; i >= ( m ); i--)
#define sort_asc( X ) sort(( X ).begin(), ( X ).end())
#define sort_desc( X ) sort(( X ).begin(), ( X ).end(), greater <>())

template <class T> bool chmax( T& a, T b );
template <class T> bool chmin( T& a, T b );
int* eratosthenes( int N );
bool bit_search( int pattern, int N );
template <class T> void cumulative_sum( T array, size_t N );

const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;

int main( void ){
	int N, A;
	cin >> N >> A;
	cout << N*N -A << endl;
}

int* eratosthenes( int N ){
	int* prime_array = new int[ N + 1 ];
	int lim = N;
	prime_array[ 0 ] = 0;
	prime_array[ 1 ] = 0;
	rep( i, 2, N + 1 ){
		prime_array[ i ] = 1;
	}
	rep( i, 2, lim ){
		if (prime_array[ i ] == 0)
			continue;
		lim = N / i;
		for(int j = i * 2; j < N + 1; j += i){
			prime_array[ j ] = 0;
		}
	}
	return prime_array;
}
template <class T> void cumulative_sum( T array, size_t N ) {
	rep( i, 1, N + 1 ){
		array[ i ] += array[ i - 1 ];
	}
}
template <class T> bool chmax( T& a, T b ) {
	if (a < b){
		a = b; return true;
	}
	return false;
}
template <class T> bool chmin( T& a, T b ) {
	if (a > b){
		a = b; return true;
	}
	return false;
}
bool bit_search( int pattern, int N ){
	int cnt = 0;
	rep( bit, 0, N ){
		if (pattern & ( 1 << bit )){
			cnt++;
		}
	}
	return true;
}


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

using namespace std;

int main()
{
    int a, b, c,d,sum1, sum2;
    cin>>a>>b>>c>>d;
    sum1=a+b;
    sum2=c+d;
    if(sum1>sum2)
    {
        cout<<"Left"<<endl;
    }
    else if(sum2==sum1)
    {
        cout<<"Balanced"<<endl;
    }
    else
    {
        cout<<"Right"<<endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main( void ){
    int a, b;
    scanf("%d", &a);
    scanf("%d", &b);
    if(a != 1 && b != 1){
        printf("1\n");
    } else if(a != 2 && b != 2){
        printf("2\n");
    } else {
        printf("3\n");
    }
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include <bits/stdc++.h>
#include<algorithm>
#include <cstring>
#include <string>
#define endl "\n"
#define SRK ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define EPS 1e-6
#define MAX 100000
typedef long long ll;
const ll MOD = 1e9 + 7;
using namespace std;

int main()
{
    int k;
    cin >> k;
    string s = "ACL";
    for (int i = 0; i < k; i++)
    {
        cout << s;
    }
}


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

int main(){
  long long N;
  cin >> N;
  long long A[101];
  for (int i=0;i<N;i++){
    cin >> A[i];
  }
  long long v;
  int j;
  for (int i=0;i<N;i++){
    v = A[i];
    j = i-1;
    while (j>=0 && A[j]>v){
      A[j+1] = A[j];
      j--;
    }
    A[j+1] = v;
    for (int j=0;j<N;j++){
      cout << A[j];
      if (j<N-1){
        cout << " ";
      }else{
        cout << endl;
      }
    }
  }
}


Measured memory_bytes: 3096
/** MIT License Copyright (c) 2018 Vasilyev Daniil **/
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
template<typename T> using v=vector<T>;
#define int long long
typedef string str;
typedef vector<int> vint;
#define rep(a,l,r) for(int a=(l);a<(r);a++)
#define pb push_back
#define sz(a) ((int)(a).size())
const long long inf=4611686018427387903;//2^62-1
#if 0 //FileIO
ifstream fin ("input.txt" );
ofstream fout("output.txt");
#define get fin>>
#define put fout<<
#else
#define get cin>>
#define put cout<<
#endif
#define eol put endl
void read(){}             template<typename Arg,typename... Args> void read (Arg& arg,Args&... args){get   (arg)     ;read(args...) ;}
void print(){}            template<typename Arg,typename... Args> void print(Arg  arg,Args...  args){put   (arg)<<" ";print(args...);}
void debug(){cerr<<endl;} template<typename Arg,typename... Args> void debug(Arg  arg,Args...  args){cerr<<(arg)<<" ";debug(args...);}
int getInt(){int a; get a; return a;}
//code goes here
void run(){
    int a,b;read(a,b);
    put max(max(a+b,a-b),a*b);eol;
}
int32_t main() {ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);run();return 0;}


Measured memory_bytes: 256
// Aizu Vol-1 0104: Magical Tiles
// 2017.8.2

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

char *gets(char *);
char buf[100], *p;

#define MAX 100
char a[MAX+5][MAX+5];

int getInt(void)
{
	int n = 0;
	while (isspace(*p)) p++;
	while (isdigit(*p)) n = 10 * n + (*p++ - '0');
	return n;
}

int main()
{
	int h, w, r, c, k;

	while (1) {
		gets(p = buf), h = getInt(), w = getInt();
		if (!h) break;
		for (r = 0; r < h; r++) gets(a[r]);
		r = c = 0;
		while (1) {
			k = a[r][c], a[r][c] = 0;
			if (!k) { puts("LOOP"); break; }
			if      (k == '>') c++;
			else if (k == '<') c--;
			else if (k == '^') r--;
			else if (k == 'v') r++;
			else if (k == '.') { printf("%d %d\n", c, r); break; }
		}
	}
	return 0;
}

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

int main() {
	int n;
	cin >> n;
	int a;
	string ans = "APPROVED";
	rep(i, n){
		cin >> a;
		if ( a % 2 == 0 && a % 3 != 0 && a % 5 != 0 ){
			ans = "DENIED";
			break;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3636
// Author: πα

#include<bits/stdc++.h>
using namespace std;



void ans()
{

}

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

	string t;
	cin>>t;
	int v=1;
	
		for(int i=0;i<s.length();i++)
		{
			if(s[i]!=t[i])
			{
				v=0;
				break;
			}
		}
	
	if(v==1 && t.length()-s.length()==1)
	{
		cout<<"Yes";
	}
	else
	{
		cout<<"No";
	}

}



Measured memory_bytes: 3632
#include<iostream>

int main(){
        int n;
        while(std::cin >> n){
                int comb = 0;
                for(int a=0;a<10;a++){
                        for(int b=0;b<10;b++){
                                for(int c=0;c<10;c++){
                                        for(int d=0;d<10;d++){
                                                if(a+b+c+d == n) comb++;
                                        }
                                }
                        }
                }
                std::cout << comb << std::endl;
        }
        return 0;
}

Measured memory_bytes: 3040
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rRep(i,a,b) for(int i=a;i>=b;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ll INF=1000000011;
constexpr ll MOD2=998244353;
constexpr ll LINF = 1001002003004005006ll;
constexpr ld EPS=10e-8;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
    for(auto i=begin(v); i != end(v); ++i){
        if(i !=begin(v)) os << ' ';
        os << *i;
    }
    return os;
}

int main(){
    ll N,K;
    cin >> N >> K;
    cout << max(N+1-K,0LL) << endl;
}

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

#define ll long long
#define ull unsigned long long
#define pb push_back
#define pf push_front
#define pof pop_front
#define pob pop_back
#define mp make_pair
#define pll pair<ll,ll>
#define pii pair<int,int>
#define all(s) s.begin(),s.end()
#define vll vector<ll>
#define vi vector<int>
#define vpii vector<pii>
#define vpll vector<pll>
#define vd vector<double>
#define vull vector<ull>
#define vc vector<char>
#define vs vector<string>
#define fi first
#define se second
#define sz(x) x.size()
#define cinarr(n,a) for(int i = 0; i < n; i++) cin >> a[i];
#define coutarr(n,a) for(int i = 0; i < n; i++) cout << a[i] << (i+1==n?'\n':' ');
#define fori(i,a,b,x) for(int i = a; i <= b; i+=x)
#define ford(i,a,b,x) for(int i = a; i >= b; i-=x)
#define tc int t; cin >> t; for(int cs = 1; cs <= t; cs++)
#define IOS ios_base::sync_with_stdio(0); cin.tie(NULL);
#define ld long double
#define reset(x,y) memset(x,y,sizeof x);
#define sqr(x) 1LL*(x)*(x)
#define cube(x) 1LL*(x)*(x)*(x)
#define ub(v, a) upper_bound(all(v), a)
#define lb(v, a) lower_bound(all(v), a)
#define EPS 1e-10
#define INF 2000000000
#define mod 1000000007
#define minof(a) min_element(all(a))
#define maxof(a) max_element(all(a))
#define debug(val) cerr << "The value of " << #val << " is = " << val << endl;
#define testing cerr << "--------------------------\n";

//input space ---> scanf("%[^\n]%*c",s);

ll n,a[100005][5],dp[100005][5],vis[100005][5];

ll f(ll now, ll i) {
	if(now > n)
		return 0;
	if(vis[now][i])
		return dp[now][i];
	ll best = -INF;
	fori(idx,1,3,1) {
		if(idx != i)
			best = max(best,f(now+1,idx));
	}
	vis[now][i]=1;
	return dp[now][i] = best+a[now][i];
}

int main() {
	IOS
	cin >> n;
	fori(i,1,n,1) {
		fori(j,1,3,1) {
			cin >> a[i][j];
		}
	}
	cout << max(f(1,1),max(f(1,2),f(1,3))) << endl;
}


Measured memory_bytes: 16640
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define int ll
#define double long double
#define YES cout<<"YES"<<'\n'
#define NO cout<<"NO"<<'\n'
#define Yes cout<<"Yes"<<'\n'
#define No cout<<"No"<<'\n'
#define yes cout<<"yes"<<'\n'
#define no cout<<"no"<<'\n'
void YN(bool flg) {cout<<(flg?"YES":"NO")<<'\n';}
void Yn(bool flg) {cout<<(flg?"Yes":"No")<<'\n';}
void yn(bool flg) {cout<<(flg?"yes":"no")<<'\n';}
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define out(n) cout << n << '\n'
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<VI> VVI;
const int MOD = 1000000007;
const long long INF = 10e10;
const double PI = acos(-1.0);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
int ABS(int a) {if(a<0) a = -a; return a;}
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
int POW(int a, int n) { int r = 1; while (n > 0) { if (n & 1)r *= a; a *= a; n >>= 1; }return r; }
int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*素因数分解*/map< int, int >prime_factor(int n){map< int, int > ret;for(int i = 2; i * i <= n; i++) {while(n % i == 0) {ret[i]++;n /= i;}}if(n != 1) ret[n] = 1;return ret;}
/*約数の個数*/int divisor_number(int n){auto p = prime_factor(n); int res = 1; for(auto x:p)res*=(x.second+1); return res;}
/*約数列挙*/vector<int> divisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------ライブラリとか----------------

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(15);

    int a,b,c; cin >> a >> b >> c;
    YN((b-a)==(c-b));

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <vector>
#include <cstring>
#include <queue>
#include <map>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
const int INF = 1e6;
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using uld = unsigned long long;
using P = pair<int,int>;
const ll mod = 1e9+7;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
template<class T> inline bool chmax(T &a,T& b){if(a < b){a = b; return true;} else return false;}
template<class T> inline bool chmin(T &a,T& b){if(a > b){a = b; return true;} else return false;}
int main(){
    int a,b,c;
    cin >> a >> b >> c;
    int k;
    cin >> k;
    rep(i,k){
        if(b <= a){
            b *= 2;
        }
        else if(c <= b){
            c *= 2;
        }
        else break;
    }
    cout << (b > a && c > b ? "Yes" : "No") << endl;
}

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

using namespace std;
int main(){
    int N, A;
    int sum[2000001];

    cin>>N;

    for(int i =1; i<N; i++){
        cin>>A;
        sum[A] = sum[A] + 1;
    }

    for(int i =1; i<=N; i++){
        cout<<sum[i]<<"\n";
    }

    return 0;
}



Measured memory_bytes: 4264
n = int(input())

a = list(map(int,input().split()))

m = int(input())

b = list(map(int,input().split()))

da = {}
db = {}

if n < m:
    bul = 0
else:
    bul = 1



for i in a:
    da[i] = 1

for j in b:
    db[j] = 1

for i in db:
    if (not i in da) or (bul == 0):
        bul = 0
        break

    else:
        del da[i]



print (bul)




Measured memory_bytes: 52696
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace ABC134D
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));

            return;
        }

        public void Solve(ConsoleInput cin)
        {

            var N = cin.ReadInt;
            var a = new int[N + 1];
            for(int i = 1; i <= N; i++)
            {
                a[i] = cin.ReadInt;
            }

            var c = new int[N + 1];
            for (int i = N; i > 0; i--)
            {
                int tmpCount = 0;
                for (int j = i; j <= N; j += i)
                {
                    tmpCount += c[j];
                }
                if (tmpCount % 2 != a[i])
                {
                    c[i] = 1;
                }
            }
            var M = c.Sum();
            Console.WriteLine(M);
            if(M != 0)
            {
                var b = c.Select((value, index) => new { Index = index, Value = value })
                         .Where(value => value.Value == 1)
                         .Select(value => value.Index);
                Console.WriteLine(string.Join(" ",  b.ToList()));
            }
            return;
        }
    }

    public static class Extensions
    {
        public static string Reverse(this string sourse)
        {
            char[] chrAry = sourse.ToCharArray();
            Array.Reverse(chrAry);
            return new string(chrAry);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}


Measured memory_bytes: 34520
#include <bits/stdc++.h>
using namespace std;
typedef bool boolean;

const int N = 1e5 + 5;

int n, m, V, P;
int a[N];

boolean check(int mid) {
	int hig = V - 1, r1 = m, r2 = 0;
	int cnt = 0, r = n;
	for (r = n; r && cnt < P - 1; r--) {
		if (r == mid)
			continue;
		hig--, cnt++;
	}
	for (int i = 1; i <= r; i++) {
		if (i == mid)
			continue;
		if (a[i] > a[mid] + m)
			return false;
		int need = min(m, a[mid] + m - a[i]);
		if (r1 > need) {
			r1 -= need;
			r2 += need;
		} else {
			r1 = need - r1;
			r2 = m - r1;
			swap(r1, r2);
			hig--;
		}
	}
	return hig <= 0;
}

int main() {
	scanf("%d%d%d%d", &n, &m, &V, &P);
	for (int i = 1; i <= n; i++) {
		scanf("%d", a + i);
	}
	sort(a + 1, a + n + 1);
	int l = 1, r = n;
	while (l <= r) {
		int mid = (l + r) >> 1;
		if (check(mid)) {
			r = mid - 1;
		} else {
			l = mid + 1;
		}
	}
	printf("%d\n", n - r);
	return 0;
}


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

using namespace std;

typedef long long LL;
#define N 1200

const LL mod=1000000007;
LL n,rt,rt1,rt2,q[N],tot,len,head[N],f[N][N][2],fa[N],dep[N];
bool vis[N];
struct edge{LL v,nxt;}e[N<<1];

void add(LL x,LL y){
	e[++tot].v=y; e[tot].nxt=head[x]; head[x]=tot;
}

LL bfs(LL s){
	memset(vis,0,sizeof vis);
	LL tt=0,ww=1; q[1]=s; vis[s]=1;
	while (tt<ww){
		LL u=q[++tt];
		for (LL i=head[u],v;i;i=e[i].nxt)
			if (!vis[v=e[i].v]){vis[v]=1; q[++ww]=v;}
	}
	return q[n];
}

void dfs(LL u){
	for (LL i=head[u],v;i;i=e[i].nxt)
		if ((v=e[i].v)!=fa[u]){fa[v]=u; dfs(v);}
}

void dp(LL u){
	for (LL i=0;i<=len-dep[u];++i) f[u][i][0]=f[u][i][1]=f[u][i+1][1]=1;
	for (LL i=head[u],v;i;i=e[i].nxt)
		if ((v=e[i].v)!=fa[u]){
			dep[v]=dep[u]+1; fa[v]=u; dp(v);
			for (LL j=0;j<=len;++j){
				f[u][j][0]=f[u][j][0]*(f[v][j][0]+(j?f[v][j-1][0]:0))%mod;
				f[u][j][1]=f[u][j][1]*(f[v][j][1]+(j?f[v][j-1][1]:0))%mod;
			}
		}
}

int main(){
	scanf("%lld",&n);
	for (LL i=1;i<n;++i){
		LL x,y; scanf("%lld%lld",&x,&y);
		add(x,y); add(y,x);
	}
	LL S=bfs(1); LL T=bfs(S); dfs(S);
	len=0; for (LL i=T;i!=S;i=fa[i]) ++len;
	if (len&1){
		len/=2;
		rt1=T; for (int i=1;i<=len;++i) rt1=fa[rt1]; rt2=fa[rt1];
		memset(fa,0,sizeof fa);
		fa[rt1]=rt2; fa[rt2]=rt1;
		dp(rt1); dp(rt2);
		LL ans=0;
		#define f1 f[rt1]
		#define f2 f[rt2]
		for (LL i=0;i<=len;++i)
			ans=(ans+f1[i][0]*(f2[i][1]+f2[i+1][1]-f2[i][0])%mod
				+f2[i][0]*(f1[i][1]+f1[i+1][1]-f1[i][0])%mod
				-f1[i][0]*f2[i+1][0]%mod-f1[i+1][0]*f2[i][0]%mod
				+mod*10)%mod;
		printf("%lld\n",ans);
	}
	else{
		len/=2;
		rt=T; for (int i=1;i<=len;++i) rt=fa[rt];
		memset(fa,0,sizeof fa);
		dp(rt);
		LL ans=0;
		for (LL i=0;i<=len;++i) ans=(ans+f[rt][i][0])%mod;
		printf("%lld\n",ans);
	}
	
	return 0;
}
			

Measured memory_bytes: 19968
#include<bits/stdc++.h>
using namespace std;
int main(void){
  long long N, A[5];
  cin >> N;
  long long m = 1000000000000001LL;
  for(int i = 0; i < 5; i++){
    cin >> A[i];
	if(A[i] <= m){
      m = A[i];
    }
  }
  cout << 4 + (N + m - 1) / m << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,m) for(long long i=0; i<m; i++)
#define per(i,m) for(long long i=m-1; i>=0; i--)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define ROF(i,n,m) for(long long i=m-1; i>=n; i--)
#define SORT(v,n) do{sort(v,v+n);reverse(v,v+n);}while(0)
#define all(x) (x).begin(),(x).end()
#define EPS (1e-7)
#define INF (1e18)
#define PI (acos(-1))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
typedef pair<ll, ll> LP;

ll POW(ll x,ll n){
  if(n==0)return 1;
  if(n%2==0)return POW(x*x,n/2)%MOD;
  return x%MOD*POW(x,n-1)%MOD;
}

ll POW2(ll x,ll n){
  if(n==0)return 1;
  if(n%2==0)return POW2(x*x,n/2);
  return x*POW2(x,n-1);
}

ll POW3(ll x,ll n,ll m){
  x%=m;
  if(n==0)return 1;
  if(n%2==0)return POW3(x*x,n/2,m)%m;
  return x*POW3(x,n-1,m)%m;
}

ll gcd(ll u, ll v) {
  ll r;
  while (0 != v) {
    r = u % v; u = v; v = r;
  }
  return u;
}

ll lcm(ll u, ll v) {
  return u*v/gcd(u,v);
}
 
ll KAI(ll m)
{
  if(m<0) return 0;
  if(m==0) return 1;
  return m*KAI(m-1)%MOD;
}
 
ll KAI2(ll m)
{
  if(m<0) return 0;
  if(m==0) return 1;
  return m*KAI2(m-1);
}

ll extGCD(ll a, ll b, ll &x, ll &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll d = extGCD(b, a%b, y, x);
    y -= a / b * x;
    return d;
}
 
inline ll mod(ll a, ll m) {
    return (a % m + m) % m;
}
 
ll modinv(ll a) {
    ll x, y;
    extGCD(a, MOD, x, y);
    return mod(x, MOD);
}
 
ll COM(ll m,ll n)
{
  if(m<n) return 0;
  if(n<0) return 0;
  if(n==0) return 1;
  if(m==n) return 1;
  return KAI(m)%MOD*modinv(KAI(n)%MOD*KAI(m-n)%MOD)%MOD;
}

ll COM2(ll m,ll n)
{
  if(m<n) return 0;
  if(n<0) return 0;
  if(n==0) return 1;
  if(m==n) return 1;
  return KAI2(m)/KAI2(n)/KAI2(m-n);
}

ll DEC(ll x,ll m,ll n)//xのm進数でのx^nの位の値
{
  return x%POW(m,n+1)/POW(m,n);
}

ll keta(ll x,ll n)//xのn進数での桁数
{
  if(x==0)return 0;
  return keta(x/n,n)+1;
}

ll DIV(ll x,ll n)//x!のnで割り切れる回数
{
  if(x==0)return 0;
  return x/n+DIV(x/n,n);
}

ll ORD(ll x,ll n)//xのnで割り切れる回数
{
  if(x==0)return INF;
  if(x%n!=0)return 0;
  return 1+ORD(x/n,n);
}

ll SGS(ll x,ll y, ll m)//1+x+…+x^(y-1)をmで割った余り
{
  if(y==0)return 0;
  if(y%2==0){
    return (1+POW3(x,y/2,m))*SGS(x,y/2,m)%m;
  }
  return (1+x*SGS(x,y-1,m))%m;
}

ll SSGS(ll x,ll y,ll m)//Σ[k=1→y](1+x+…+x^(k-1))をmで割った余り
{
  if(y==0)return 0;
  if(y==1)return 1;
  if(y%2==0){
    return (SSGS(x,y/2,m)*(POW3(x,y/2,m)+1)%m+SGS(x,y/2,m)*y/2%m)%m;
  }
  return (SSGS(x,y-1,m)*x%m+y)%m;
}

int main()
{
  ll a,b,c;
  cin >> a >> b >> c;
  if(a<b)printf("0");
  else printf("10");
}

Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
  ll N,a,b;
  cin >> N;
  multimap<ll,vector<ll>> abmap;
  for (ll i = 0; i < N; ++i) {
    cin >> a >> b;
    vector<ll> v = {a,b};
    abmap.emplace(a+b,v);
  }
  ll i=0,tak=0,aok=0;
  for (auto itr = abmap.rbegin();itr != abmap.rend(); ++itr) {
  	if (i%2==0) tak+=(itr->second)[0];
    else aok+=(itr->second)[1];
    i++;
  }
  cout << tak-aok << endl;
  return 0;
}

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

int N;
int A[210];

int main(void)
{
    int flag=1;

    cin >> N;

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

    }

    int cnt=0;

    while(flag)
    {
        for(int i=0;i<N;i++)
        {
            if(A[i]%2==0)
            {
                A[i]/=2;
            }
            else
            {
                flag=1;
                cout << cnt << endl;
                return 0;
            }
        }
        cnt++;
    }
}

Measured memory_bytes: 256
#include <stdio.h>
 
int main() {
  int a,b;
  
  scanf("%d %d", &a, &b);
  
  // 計算結果が 1 の場合 Odd
  // 計算結果が 0 の場合 Even
  printf("%s\n", (a * b) % 2? "Odd" : "Even");
  
 
  return 0;
}

Measured memory_bytes: 1640
H,W = map(int,input().split(" "))
field = []
row_0 = ["." for i in range(W)]
for i in range(H):
    row_i = list(input())
    if row_i == row_0:
        H -= 1
    else:
        field.append(row_i)
col_0 = ["." for i in range(H)]
for i in range(W)[::-1]:
    col_i = []
    for j in range(H):
        col_i.append(field[j][i])
    if col_i == col_0:
        for j in range(H):
            del field[j][i]

for i in range(len(field)):
    print("".join(field[i]))

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

int main(){
    int val;
    map<int,int> mapa;
    for(int i = 0;i<3;i++){
        cin >> val;
        mapa[val]++;
    }

    bool f = 0;
    for(auto it:mapa){
        if(it.second == 2)
            f = 1;
    }
    if(f) cout<<"Yes";
    else cout<<"No";

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define sz(x) (int)(x.size())

class SegTree{
public:
    vector<int> t;
    SegTree(int n) {
        t.assign(4 * n, 0);
    }

    void update(int v, int tl, int tr, int pos, int val) {
        if (tl == tr) {
            t[v] = val;
        } else {
            int tm = (tl + tr) / 2;
            if (pos <= tm) 
                update(2 * v, tl, tm, pos, val);
            else 
                update(2 * v + 1, tm + 1, tr, pos, val);
            t[v] = max(t[2 * v], t[2 * v + 1]);
        }
    }

    int get_max(int v, int tl, int tr, int l, int r) {
        if (l > r) {
            return 0;
        }
        if (tl == l && tr == r) {
            return t[v];
        }
        int tm = (tl + tr) / 2;
        return max(get_max(2 * v, tl, tm, l, min(tm, r)),
            get_max(2 * v + 1, tm + 1, tr, max(tm + 1, l), r));
    }
};

signed main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int n;
    cin >> n;
    int a[n], h[n];
    for (int i = 0; i < n; i++) {
        cin >> h[i];
    }
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    SegTree sg(n + 2);
    int ans = 0;
    for (int i = 0; i < n; i++) {
        int mx = sg.get_max(1, 0, n + 1, 0, h[i]);
        ans = max(ans, mx + a[i]);
        sg.update(1, 0, n + 1, h[i], mx + a[i]);
    }
    cout << ans << "\n";
}

Measured memory_bytes: 9600
#include "iostream"
#include "random"
#include "string"
#include "bitset"
#include "algorithm"
#include "map"
#include "queue"
#include "list"
#include "set"
#include "climits"
#include "iomanip"
#include "stack"
#include "functional"
#include "unordered_map"
#include "unordered_set"

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

int a[100001];
int b[100001];
long long int c[100001];

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

	long long int N, M, K, D, S;
	cin >> N >> M >> K >> D >> S;
	int minus = S;
	for (int i = 0; i < M; i++) {
		cin >> a[i] >> b[i] >> c[i];
	}
	map<long long int, int>m;
	set<pair<int, long long int>>s;
	int index = 0;
	while (K) {
		while (index < M&&a[index] <= S + D) {
			auto it = s.find({ m[c[index]], c[index] });
			if (it != s.end()) {
				s.erase(it);
			}
			s.insert({ max(a[index],m[c[index]]) + b[index],c[index] });
			m[c[index]] = max(a[index], m[c[index]]) + b[index];
			index++;
		}
		if (m.size() != N) {
			S += D;
		}
		else {
			if (s.empty()) {
				S += D;
			}
			else {
				auto box = *s.begin();
				S = max(box.first, (int)S + (int)D);
			}
		}
		K--;
	}
	cout << S - minus << endl;
}


Measured memory_bytes: 16696
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;

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

// container util
#define all(x) (x).begin(), (x).end()

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

// typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

// constant
const int MOD = (int)1e9 + 7;
const int INF = (int)1e18;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

// conversion
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

//
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
//

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

  lint r, d, x;
  cin >> r >> d >> x;

  lint tmp = x;
  for (int i = 1; i <= 10; i++) {
    cout << r * tmp - d << endl;
    tmp = r * tmp - d;
  }
  return 0;
}

Measured memory_bytes: 256
#2019/10/24
# AB, S = open(0).readlines()
# print(AB, S)
# A, B = map(int, AB.split())
# print(A, B)
A, B = map(int, input().split())
S = input()
print('Yes' if S[:A].isdecimal() and S[A]=='-' and S[A+1:].isdecimal() else 'No')

Measured memory_bytes: 2940
n, m, c = map(int, input().split())
b = list(map(int, input().split()))
k = 0
a = []
for i in range(n):
  a.append(list(map(int, input().split())))
for i in range(n):
  s = 0
  for j in range(m):
    s += a[i][j]*b[j]
  if s + c > 0:
    k += 1
  
print(k)

Measured memory_bytes: 3060
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

h,n = nm()
a = nl()
print("YNeos"[sum(a)<h::2])


Measured memory_bytes: 14040
function Main(input){
	var a = input.split("\n");
  var b = a[0].split(" ");
  var n = b[0]*1;
  var m = b[1]*1;
  var S = a[1];
  var T = a[2];
  var l = n*m/gcd(m,n);
  var hoge = "";
  var fuga = "";
  var t = "" + l + "\n\n";
    for(var j = 0;j < n ; j+=(l/m)){
  		hoge += S[j];
  	}
  	for(var j = 0;j < m ; j+=(l/n)){
  		fuga += T[j];
 		}
 	return hoge===fuga?l:-1; 
}

function gcd(m, n) {
  // 剰余
  var r;

  if(m < n) {  // m >= nにする
    r = m;  //一時退避
    m = n;
    n = r;
  }

  while ((r = m % n) != 0) {
    m = n;
    n = r;
  }

  return n;
}

console.log(Main(require("fs").readFileSync("/dev/stdin", "utf8")));

Measured memory_bytes: 21064
while True:
    n, goal = [int(x) for x in input().split(" ")]
    res =[]

    if n == goal == 0:
        break

    for first in range(1, n+1):
        for second in range(first+1, n+1):
            rem = goal - (first + second)
            if rem > second and n >= rem:
                res.append([first, second, rem])

    print(len(res))

Measured memory_bytes: 7760
X = int(input())
A = 0
flag = False
while True:
    B = A-1
    while pow(B,5)>=pow(A,5)-X:
        if pow(B,5)==pow(A,5)-X:
            flag=True
            break
        B -= 1
    if flag:
        break
    A+=1
print(A,B)

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

using namespace std;

int main(){
    int n, k;
    cin >> n >> k;
    int a[n];
    for(int i=0;i<n;i++)cin >> a[i];

    sort(a, a+n, greater<int>());
    int ans = 0;
    for(int i=0;i<k;i++)ans += a[i];
    cout << ans << endl;
}


Measured memory_bytes: 256
h,w = map(int, input().split())
d = [list(map(int,input().split())) for i in range(h)]
l = []
for i in range(h):
  if i%2==0:
    for j in range(w):
      l.append([i,j])
  else:
    for j in range(w-1,-1,-1):
      l.append([i,j])
m = 0
x = []
for i in range(len(l)-1):
  if d[l[i][0]][l[i][1]]%2==1:
    d[l[i][0]][l[i][1]] -= 1
    d[l[i+1][0]][l[i+1][1]] += 1
    x.append(i)
    m += 1
print(m)
for i in x:
  print(l[i][0]+1, l[i][1]+1, l[i+1][0]+1, l[i+1][1]+1)

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


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

  if (Y <= 1) {
    cout << "No" << endl;
    return 0;
  }

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

  if ((double)Y / 4 > X) {
    cout << "No" << endl;
    return 0;
  }

  if (Y / 2 < X) {
    cout << "No" << endl;
    return 0;
  }

  cout << "Yes" << endl;

  return 0;
}


Measured memory_bytes: 3636
n = input()
digits = len(n)
i = 0
count = 0
while (2*i+1) <= digits:
    if (2*i+1) == digits:
        count += int(n) - 10**(digits-1) + 1
        break
    else:
        count += (10**(2*i+1) - 1) - 10**(2*i) + 1
    i += 1

print(count)

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

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(solver());
        }
        static int solver()
        {
            var XN = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            var X = XN[0]; var N = XN[1];
            if (N == 0) return X;
            var p = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            for (int i = 0; i < 100; i++)
            {
                if (!p.Contains(X - i))
                {
                    return X - i;
                }
                if (!p.Contains(X + i))
                {
                    return X + i;
                }
            }
            return 0;
        }
    }
}


Measured memory_bytes: 27912
import java.util.*;
import java.lang.*;
 
public class Main {
	public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int n = sc.nextInt();
	int m = sc.nextInt();
	for(int i = 0; i < m; i++) {
		n -= sc.nextInt();
	}
	if(n >= 0) {
		System.out.println(n);
	}else{
		System.out.println("-1");
	}
	}
}

Measured memory_bytes: 46048
#include <iostream>
#include <cmath>

using namespace std;

#define INF 10000000
int cost[110][110];
int mincost[110];
bool used[110];

int prim(int V) {
	for (int i = 0; i < V; i++) {
		mincost[i] = INF;
		used[i] = false;
	}
	mincost[0] = 0;
	int res = 0;

	while (true) {
		int v = -1;
		for (int u = 0; u < V; u++) {
			if (!used[u] && (v == -1 || mincost[u] < mincost[v])) {
				v = u;
			}
		}

		if (v == -1) {
			break;
		}
		used[v] = true;
		res += mincost[v];

		for (int u = 0; u < V; u++) {
			mincost[u] = min(mincost[u], cost[v][u]);
		}
	}
	return res;
}
int main() {
	int n, m;
	while (cin >> n >> m) {
		if (n == 0 &&  m == 0) {
			break;
		}
		for (int i = 0; i < 110; i++) {
			for (int j = 0; j < 110; j++) {
				cost[i][j] = INF;
			}
		}
		int a,b,c;
		for (int i = 0; i < m; i++) {
			cin >> a >> b >> c;
			cost[a][b] = c;
			cost[b][a] = c;
		}
		cout << prim(n) << endl;
	}
	return 0;
}

Measured memory_bytes: 1208
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <algorithm>
#include <bitset>
#include <complex>

#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define rep(i,n) for(int i=0;i<(n); i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define WHITE 0
#define GRAY 1
#define BLACK 2

using namespace std;
typedef long long ll;
const int NMAX = 100;
const int k = 200000;
static const int INF = 1<<29;
string s,t,ans;
int dp[3001][3001];
ll gcd(ll a, ll b){
if(a<b) swap(a,b);
    if(b==0) return a;
    return gcd(b, a%b);
}
int n,M[NMAX+1][NMAX+1]={0};
int color[NMAX]={WHITE},d[NMAX],f[NMAX],tt;

void dfs_visit(int u){
    color[u]=GRAY;
    d[u] = ++tt; //最初の訪問
    rep2(v,n){
        if(M[u][v]==0) continue;
        if(color[v]==WHITE){
            dfs_visit(v); //再帰
        }
    }
    color[u]=BLACK;
    f[u] = ++tt; //訪問完了
}

void dfs(){
    //初期化はcolor[NMAX]の定義で完了
    tt=0; //時間メモ
    rep2(u,n){
        if(color[u]==WHITE){
            dfs_visit(u); //まだ未踏の地であったらdfs_visit関数を動かす。
        }
    }
    rep2(u,n){
        cout << u << " " << d[u] << " " << f[u] << endl;
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0); //この2行はより速度を向上させる
    // 追加２, 以降 cin の入力元が 'input.txt' になる


    int u,v,k;
    cin >> n;
    rep2(i,n){
        int u,k;
        cin >> u >> k;
        int v[k+1];
        rep2(j,k) cin >> v[j];
        rep2(j,k){
            M[i][v[j]]=1;
        }
    }
    dfs();
    return 0;
}


Measured memory_bytes: 3224
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string s;
  long long int n;
  cin>>n;
  cin>>s;
  int c=0,i;
  for(i=0;i<s.size()-1;i++)
  {      if(s[i]!=s[i+1]) c++;
  }
  cout<<c+1;
  return 0;
}


Measured memory_bytes: 512