akhauriyash/Code-Regression huggingface dataset:
// #includes {{{
#include <algorithm>
#include <numeric>
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <list>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <cstring>
#include <cmath>
using namespace std;
// }}}
// pre-written code {{{
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define RREP(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();++i)
#define LET(x,a) __typeof(a) x(a)
//#define IFOR(i,it,c) for(__typeof((c).begin())it=(c).begin();it!=(c).end();++it,++i)
#define ALL(c) (c).begin(), (c).end()
#define MP make_pair

#define EXIST(e,s) ((s).find(e)!=(s).end())

#define RESET(a) memset((a),0,sizeof(a))
#define SET(a) memset((a),-1,sizeof(a))
#define PB push_back
#define DEC(it,command) __typeof(command) it=command

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define debug2(x) cerr << #x << " = [";REP(__ind,(x).size()){cerr << (x)[__ind] << ", ";}cerr << "] (L" << __LINE__ << ")" << endl;

const int INF=0x3f3f3f3f;

typedef long long Int;
typedef unsigned long long uInt;
#ifdef __MINGW32__
typedef double rn;
#else
typedef long double rn;
#endif

typedef pair<int,int> pii;

/*
#ifdef MYDEBUG
#include"debug.h"
#include"print.h"
#endif
*/
// }}}

int N,x;
int a[100100];

int main(){
	scanf("%d%d",&N,&x);
	REP(i,N)scanf("%d",a+i);
	Int ans = 0;
	REP(i,N-1){
		//compare i and i+1
		if(a[i]+a[i+1]>x){
			int d = a[i+1]+a[i]-x;
			ans+=d;
			if(d<=a[i+1]){
				a[i+1]-=d;
			}else{//d>a[i+1];
				d-=a[i+1];
				a[i+1]=0;
				a[i]-=d;
			}
		}
	}
	printf("%lld\n",ans);
	return 0;
}


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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end());
#define vdelete(v) (v).erase(unique(all(v)), (v).end());
#define pb(n) push_back(n);
#define mp make_pair
#define MOD 1000000007
#define INF 9223372036854775807

int n,R,L;
deque<char> d;

signed main() {
    cin >> n;
    rep(i,n) {
        char tmp;
        cin >> tmp;
        d.pb(tmp)
    }
    rep(i,n) {
        if (d[i] == '(') R++;
        else L++;
        if (R < L) {
            R++,i++,n++,d.push_front('(');
        }
    }
    rep(i,R-L) n++,d.pb(')')
    for(auto i : d) cout << i;
    cout << endl;
}

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

#define rep(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ROF(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで大きい順
#define UNIQUE(v) v.erase(unique(all(v)),v.end())
#define SUM(a) accumlate(all(a),0)
#define pb push_back
#define fst first
#define snd second
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef long long ll;

bool same(string s, string t){
  rep(i,s.size())
    if(s[i] == '?') continue;
    else if(s[i] == t[i]) continue;
    else return false;
  return true;
}

main(){
  string s, t; cin >> s >> t;

  ROF(i,s.size()-t.size()+1,0)
    if(same(s.substr(i,t.size()),t)){
      rep(j,i)
	if(s[j] == '?') cout << "a";
	else cout << s[j];
      cout << t;
      FOR(j,i + t.size(),s.size())
	if(s[j] == '?') cout << "a";
	else cout << s[j];
      cout << endl;
      return 0;
    }

  cout << "UNRESTORABLE\n";
}

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

#define MAX(x,y) ((x>y)?x:y)

struct bug{
	int a,b;
};
struct bug f[300005];
int comp(const void *p,const void *q){
	bug *x=(bug*)p,*y=(bug*)q;
	if(x->b==y->b)return y->a-x->a;
	else return y->b-x->b;
}

int n;

//seg
struct SEGt{
	int a,x;
};
SEGt seg[1<<20];
int sn;
void init(int m){
	int i;
	for(i=0;i<sn*2-1;i++)seg[i].a=0;
}
void seg_add(int pos,int x){
	int y;
	pos+=sn-1;
	seg[pos].a=x;
	y=seg[pos].x=pos;
	while(pos>0){
		pos=(pos-1)/2;
		//seg[pos]+=MAX(seg[pos*2+1],seg[pos*2+2]);
		if(seg[pos*2+1].a>seg[pos*2+2].a)seg[pos]=seg[pos*2+1];
		else seg[pos]=seg[pos*2+2];
	}
	return;
}

//BIT
long long bit[300005];
void bit_add(int pos,int x){
	while(pos<=n){
		bit[pos]+=x;
		pos+=pos&(-pos);
	}
	return;
}
long long sum(int i){
	long long s=0;
	while(i>0){
		s+=bit[i];
		i-=i&(-i);
	}
	return s;
}

int judge(int m){
	int i,j,k,p,q;
	memset(bit,0,sizeof(long long)*(n+3));
	init(n);
	for(i=0;i<m;i++){
		bit_add(i+1,f[i].a);
		seg_add(i,f[i].a);
	}
	if(sum(m)<=(long long)f[m-1].b*m)return 1;
	//for(i=1;i<=n;i++)printf("%2lld ",bit[i]);
	//printf("\n");
	//printf("seg[0].a %d   seg[0].x %d\n",seg[0].a,seg[0].x-(sn-1));
	for(i=m-1;i<n-1;i++){
		if(sum(i+1)>(long long)f[i].b*m){
			p=seg[0].a;
			q=seg[0].x-(sn-1);
			bit_add(q+1,-p);
			seg_add(q,0);
			bit_add(i+2,f[i+1].a);
			seg_add(i+1,f[i+1].a);
			//for(j=1;j<=n;j++)printf("%2lld ",bit[j]);printf("\n");
		}
		else return 1;
	}
	if(sum(n)<=(long long)f[n-1].b*m)return 1;
	return 0;
}

int main(){
	int i,j,k;
	int ub,lb,mid;
	
	scanf("%d",&n);
	sn=1;
	while(sn<n)sn*=2;
	//printf("sn:%d\n",sn);
	for(i=0;i<n;i++)scanf("%d%d",&f[i].a,&f[i].b);
	qsort(f,n,sizeof(bug),comp);
	//for(i=0;i<n;i++)printf("%3d %3d\n",f[i].a,f[i].b);
	
	//judge(3);
	//for(i=0;i<=n;i++)printf("%d:(%d)\n\n",i,judge(i));
	
	ub=n+1;
	lb=0;
	while(ub-lb>1){
		mid=(lb+ub)/2;
		if(judge(mid)==1){
			lb=mid;
		}
		else{
			ub=mid;
		}
	}
	printf("%d\n",lb);
	
	return 0;
}

Measured memory_bytes: 13956
#include<bits/stdc++.h>
using namespace std;
const int N = 3e5+5;
int a[N]; 

int main(){
	int n;
	scanf("%d",&n);
	memset(a,0,sizeof(a));
	int m,k=0;		
	while(n--) {		
		scanf("%d",&m);
		if(k<m) k=m;
		a[m-1]++;
		a[m]++;
		a[m+1]++;
	}
	int M=-1;
	for(int i=0;i<=k;i++)
		M=max(M,a[i]);	
	printf("%d\n",M);
	return 0;
}


Measured memory_bytes: 1408
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <climits>
using namespace std;
#define MOD int(1e9 + 7)
#define INF (long long)(1e18)

int main()
{
    long long N;
    vector<long long> A;

    cin >> N;
    for(long long i = 0; i < N; i++){
        long long t;
        cin >> t;
        A.push_back(t);
    }

    A.push_back(0);

    long long c = 0;
    for(long long i = 0; i < N; i++){
        c += A[i] / 2;
        if(A[i] % 2 == 1 && A[i+1] > 0){
            A[i+1]--;
            c++;
        }
    }

    cout << c << endl;
}

Measured memory_bytes: 1528
#include <iostream>
using namespace std;
int main(){
  int a;
  cin >> a;
  int array[200];
  
  for(int i = 0; i < a;++i) cin >> array[i];
  
  int sum = 0;
  
  while(true){
    bool odd = false;
    for(int i = 0;i < a;++i){
      if(array[i]%2 != 0) odd = true;
    }
    if(odd) break;
    for(int i = 0; i < a;++i){
      array[i] /= 2;
    }
    ++sum;
  }
  
  cout << sum << endl;
}

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

const int N = 100010;
const int M = 200010;
const int INFM = 0x8c8c8c8c;

struct edge{
	int v , w , n ; 
}e[M<<1];int head[N];
int dis[N];
int n , m ;
bool book[N]; 
bool con[N];
queue< int > q ; 

bool spfa( ){
	memset( dis , 0x8c , sizeof( dis ) );
	for( int k = 1; k <= n; k ++ ){
		if( !con[k] ){
			q.push( k );
			dis[k] = 0 ; 
			while( q.size() ){
				int ts = q.front();
				con[ts] = 1;
				q.pop();
				book[ts] = 0 ;
				for( int i = head[ts] ; i ; i = e[i].n ){
					int tv = e[i].v;					
					if( dis[tv] == INFM ){
						dis[tv] = dis[ts]+e[i].w ;
						if( !book[tv] )q.push( tv );
					}
					else if( dis[tv] != dis[ts] + e[i].w )
						return 0 ;
				}
			}
		}
	}
	return 1 ; 
}

int main()
{
	scanf("%d%d" , & n , & m );
	int u , v , w ; 
	for( int i = 1; i <= m ; i ++ ){
		scanf( "%d%d%d" , & u , & v , & w );
		e[i] = ( edge ){ u , w  , head[v] };
		e[i+m] = ( edge ){ v , -w , head[u] };
		head[v] = i ; head[u] = i + m ;
	}
	if( spfa( ) ) printf("Yes");
	else printf("No");
	return 0;
} 

Measured memory_bytes: 6272
N = gets.to_i
Ary = gets.split.map(&:to_i)
Q = gets.to_i
Qary = []
Q.times do
  Qary.push(gets.split.map(&:to_i))
end

map = {}
first_sum = 0
Ary.each do |e|
  first_sum += e
  if map[e]
    map[e] += 1
  else
    map[e] = 1
  end
end

Q.times do |q|
  b, c = Qary[q]

  gap = c - b

  #binding.irb

  if map[b]
    first_sum += gap * map[b]
    if map[c]
      map[c] += map[b]
    else
      map[c] = map[b]
    end

    map[b] = 0
    puts first_sum
  else
    puts first_sum
  end
end


Measured memory_bytes: 33016
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tommy6073
 */

#include <iostream>
#include <string>

using namespace std;

class ARoundOne {
public:
    void solve(std::istream& in, std::ostream& out) {
        int A, B;
        in >> A >> B;

        int ans;
        if (A == 1) {
            if (B == 2) {
                ans = 3;
            } else {
                ans = 2;
            }
        } else if (A == 2) {
            if (B == 1) {
                ans = 3;
            } else {
                ans = 1;
            }
        } else if (A == 3) {
            if (B == 1) {
                ans = 2;
            } else {
                ans = 1;
            }
        }
        out << ans;
    }
};


int main() {
	ARoundOne solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int N;
    cin>>N;
    for(int a=1;a<=3500;++a){
        for(int b=1;b<=3500;++b){
            long long lu = (long long) N*a*b;
            long long ld = (long long) 4*a*b - N*b - N*a;
            if(ld<=0){
                continue;
            }
            if(lu%ld==0){
                cout<<a<<' '<<b<<' '<<lu/ld<<endl;
                return 0;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    int h, w;
    cin >> h >> w;
    cout << (h - 1) * (w - 1) << '\n';
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define double long double
#define int long long
#define mii map<int,int>
#define low lower_bound
#define upp upper_bound
#define inf 1000000007 //10^9+7
#define rep(i,n) for(int i=0;i<n;i++)
#define all(vec) vec.begin(),vec.end()
#define sort(vec) sort(all(vec));
#define rever(vec) reverse(all(vec));
#define bisea binary_search
#define unsort(vec) sort(vec); rever(vec);
#define cend cout<<endl;
#define F first
#define S second
using namespace std;
int h,w;
char tab[50][50];
int a[4]={1,0,-1,0};
int b[4]={0,1,0,-1};
signed main() {
  cin>>h>>w;
  bool can[h][w];
  rep(i,h) rep(j,w) {
    cin>>tab[i][j];
    can[i][j]=false;
  }
  rep(i,h) {
    rep(j,w) {
      if(tab[i][j]=='.') {
        can[i][j]=true;
        continue;
      }
      rep(k,4) {
        int nx=i+a[k],ny=j+b[k];
        if(0<=nx&&nx<h&&0<=ny&&ny<w) {
          if(tab[nx][ny]=='#') {
            can[i][j]=true;
            break;
          }
        }
      }
    }
  }
  rep(i,h) {
    rep(j,w) {
      if(can[i][j]) {
        continue;
      }
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
from collections import deque

n=int(input())
que=deque()

for i in range(n):
    command=input()

    if command=="deleteFirst":
        que.popleft()
    elif command=="deleteLast":
        que.pop()
    else:
        command,num=command.split()
        num=int(num)
        if command=="insert":
            que.appendleft(num)
        else:
            if num in que:
                que.remove(num)

print(*que,sep=" ")


Measured memory_bytes: 45884
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000000000000
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define pb push_back
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int kaijo[2000010];
struct edge{int to,cost;};
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
void init_fact(){
    kaijo[0]=1;
    for(int i=1;i<=2000000;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=MOD;
    }
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%MOD;
    int memo=modpow(a,b/2);
    return memo*memo%MOD;
}
int comb(int a,int b){
    if(!kaijo[0])init_fact();
    return kaijo[a]*modpow(kaijo[a-b],MOD-2)%MOD*modpow(kaijo[b],MOD-2)%MOD;
}
int inv(int x){
    x=modpow(x,MOD-2);
    return x;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){
    double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
    double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
    double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
    double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
    return tc*td<0&&ta*tb<0;
}
double dist(double ax,double ay,double bx,double by){
    return sqrt((bx-ax)*(bx-ax)+(ay-by)*(ay-by));
}
int n,k,r,s,p,ans;
string t;
int a[100010];
int dp[100010][3];
signed main(){
    cin>>n>>k>>r>>s>>p>>t;
    rep(i,n){
        if(t[i]=='r')a[i]=2;
        if(t[i]=='s')a[i]=0;
        if(t[i]=='p')a[i]=1;
    }
    int score[3]={r,s,p};
    rep(j,n){
        rep(l,3){
            dp[j][l]=-INF;
        }
    }
    rep(i,k){
        
        int j=i;
        while(1){
            if(j==i){
                rep(l,3){
                    if(l==a[j])dp[j][l]=score[l];
                    else dp[j][l]=0;
                }
            }
            else{
                rep(l,3){
                    rep(o,3){
                        if(l==o)continue;
                        if(l==a[j])dp[j][l]=max(dp[j][l],dp[j-k][o]+score[l]);
                        else dp[j][l]=max(dp[j][l],dp[j-k][o]);
                    }
                }
            }
            if(j+k<n)j+=k;
            else{
                ans+=max({dp[j][0],dp[j][1],dp[j][2]});
                break;
            }
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 4608
n = int(input())
l = list(map(int, input().split()))
edge = [0 for x in range(n)]

if l[0] != 0:
    print(0)
    exit()

for i in l:
    edge[i]+=1

ans = 1
for i in range(1, n):
    ans *= edge[l[i] - 1]
    ans %= 998244353
print(ans)


Measured memory_bytes: 20588
#include <bits/stdc++.h>
using namespace std;
int main(){
int N;cin>>N;vector<int> P(N);
int sum=0;int maxn=0;
for(int i=0;i<N;i++){
cin>>P.at(i);
sum=sum+P.at(i);
maxn=max(maxn,P.at(i));
}cout<<sum-maxn/2<<endl;
}

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

int n,k=2;
int ar[maxn];
int dp[maxn];

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


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b)  for(int i=(a),i##formax=(b);i< i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formin=(b);i>=i##formin;i--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max((x),(y))
#define mins(x,y) x=min((x),(y))
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define all(a) ((a).begin()),((a).end())
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define bit(n) (1LL<<(n))
typedef long long ll;
typedef __int128_t lll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>using P=pair<T,Y>;
template<class T,class Y>ostream& operator<<(ostream&o,P<T,Y>&p){return o<<"("<<p.fi<<","<<p.se<<")";}
template<class T>ostream& operator<<(ostream&o,V<T>&v){for(T&t:v)o<<t<<",";return o;}
template<class T>void uniq(V<T>&v){sort(all(v));v.erase(unique(all(v)), v.end());}
template<class A,size_t N,class T>void Fill(A(&a)[N],const T&v){fill((T*)a,(T*)(a+N),v);}

const int MOD = 1e9+7; //998244353;

lll gcd(lll a,lll b,lll&x,lll&y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll modInv(ll a,ll m=MOD){lll x,y;gcd(a,m,x,y);return(x%m+m)%m;}
ll modPow(lll a,lll n,ll m=MOD){lll p=1;for(;n;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return p;}
//V<ll>Fac,Rac;void setF(int n,int m=MOD){Fac=Rac=V<ll>(++n);Fac[0]=1;FOR(i,1,n)Fac[i]=Fac[i-1]*i%m;Rac[n-1]=modInv(Fac[n-1],m);FORR(i,n-1,1)Rac[i-1]=Rac[i]*i%m;}
//ll comb(int a,int b,int m=MOD){return a<b||b<0?0:Fac[a]*Rac[b]%m*Rac[a-b]%m;}

const int IINF = 1e9+6;
const ll LINF = 1e18;
const int N = 1e5;
ll a, b, v, w, t;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> a >> v >> b >> w >> t;
  cout << ((abs(a-b)+t*w<=t*v) ? "YES" : "NO") << endl;
}

Measured memory_bytes: 3664
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef ll Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int dp[5010][5010];
// a^b mod MOD
ll powmod(ll a,ll b,ll m=1000000007){
	ll out=1;
	ll p=a%m;
	while(b){
		if(b&1)out=out*p%m;
		p=p*p%m;
		b>>=1;
	}
	return out;
}
int main(){
	ll n,MOD=1000000007;
	cin>>n;
	string s;cin>>s;
	
	dp[0][0]=1;
	rep(i,n)rep(j,n+1)if(dp[i][j]){
		(dp[i+1][j+1]+=2*dp[i][j])%=MOD;
		(dp[i+1][max(0,j-1)]+=dp[i][j])%=MOD;
	}
	cout<<dp[n][s.size()]*powmod(powmod(2,s.size()),MOD-2)%MOD<<endl;
}








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

int main() {
    int K ;
    cin >> K ;
    
    string S ;
    cin >> S ;
    
    if( S.size() <= K ){
        cout << S << endl;
    }
    else{
        string s = S.substr(0,K) ;
        cout << s << "..." << endl;
    }
    
}


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


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, X, T;
    cin >> N >> X >> T;
    cout << (N + X - 1) / X * T << endl;

    return 0;
}


Measured memory_bytes: 3608
#include <iostream>
#include <fstream>
#include <cassert>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#include <random>
#include <complex>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<61;
const double pi=acos(-1);
const double eps=1e-7;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

typedef complex<double> vec;
#define eq(a,b) (fabs(a-b)<eps)

// ??\???
void In(vec& p){
	double x,y;
	cin>>x>>y;
	p=vec(x,y);
}

// ??????
void Out(vec p){
	cout<<syosu(10)<<p.real()<<' '<<p.imag()<<endl;
}

// ??????
double IP(vec p,vec q){
	return p.real()*q.real()+p.imag()*q.imag();
}

// ??????
double CP(vec p,vec q){
	return p.real()*q.imag()-q.real()*p.imag();
}

// ??´?????????
bool is_Orthgonal(vec a1,vec a2,vec b1,vec b2){
	return eq(IP(a1-a2,b1-b2),0);
}

// ????????????
bool is_Parallel(vec a1,vec a2,vec b1,vec b2){
	return eq(CP(a1-a2,b1-b2),0);
}

int n;
vec a,b,c,d;

int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		In(a);In(b);In(c);In(d);
		if(is_Orthgonal(a,b,c,d)) cout<<1<<endl;
		else if(is_Parallel(a,b,c,d)) cout<<2<<endl;
		else cout<<0<<endl;
	}
}

Measured memory_bytes: 3200
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int sx,sy,tx,ty;
    cin >> sx >> sy >> tx >> ty;
    int dx=tx-sx,dy=ty-sy;
    cout << string(dx,'R') << string(dy,'U');
    cout << string(dx,'L') << string(dy,'D');
    cout << 'L' << string(dy+1,'U') << string(dx+1,'R') << 'D';
    cout << 'R' << string(dy+1,'D') << string(dx+1,'L') << 'U';
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

char c[55][55];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h, w;
    cin >> h >> w;
    rep(i,h)rep(j,w) cin >> c[i+1][j+1];
    rep(i,h)rep(j,w){
        if(c[i+1][j+1] == '#'){
            if(c[i][j+1] == '#') continue;
            if(c[i+1][j] == '#') continue;
            if(c[i+1][j+2] == '#') continue;
            if(c[i+2][j+1] == '#') continue;
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)

int main() {
	string s1,s2;
	cin >> s1 >> s2;
	sort(s1.begin(), s1.end());
	sort(s2.begin(), s2.end(), greater<int>());
	if(s1<s2){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}

}


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

using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i, n) for(ll i = 0; i < (ll)n; i++)

int main() {
    ll A, B;
    cin>>A>>B;
    cout<<A*B<<endl;
    return 0;
}

Measured memory_bytes: 3188
import sys
import bisect

input = sys.stdin.readline


def main():
    n = int(input())
    l = map(int, input().split())
    # 種類組み合わせ・条件
    l = sorted(l)
    hoge = 0
    for i, a in enumerate(l[:-2], start=1):
        for j, b in enumerate(l[i:-1], start=i):
            index = bisect.bisect_left(l, a + b)
            hoge += index - j - 1
    print(hoge)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3188
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
fact = math.factorial
sys.setrecursionlimit(10**9)
INF = 10**9
mod = 10**9+7

N = i()
a = l()
a.sort(reverse=True)
ans = 0
for i in range(2*N):
    if i%2 == 1:
        ans += a[i]
print(ans)

Measured memory_bytes: 118472
#include <bits/stdc++.h>
using namespace std;
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;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

ll f(ll n)
{
    ll tmp = (n+1) % 4;
    ll ans = 0;
    for (ll i = 0; i < tmp; i++)
    {
        ans = ans ^ (n - i);
    }
    return ans;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a, b;
    cin >> a >> b;
    // cout << f(a - 1) << ' ' << f(b) << endl;
    ll ans = f(a - 1) ^ f(b);
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> ii;
typedef pair<ii ,ii> iii;
typedef long long ll;
int main()
{
  ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        ll n,x,t;
        cin>>n>>x>>t;
        ll y =ceil(double(n)/x);
 cout<<(y*t);}


Measured memory_bytes: 3764
#include <bits/stdc++.h>
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end() 
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000
using namespace std;
typedef long long ll;

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

    int B[N-1];
    REP(i, N-1){
        cin >> B[i];
    }

    int A[N];
    A[0] = B[0];
    A[N-1] = B[N-2];
    FOR(i, 1, N-2){
        A[i] = min(B[i-1], B[i]);
    }

    int ans = 0;
    REP(i, N){
        ans += A[i];
    }

    cout << ans << endl;
}


Measured memory_bytes: 3616
import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())

A,B = MI()

q1,r1 = (B-1)//50,(B-1)%50
q1 += 1
q2,r2 = (A-1)//50,(A-1)%50
q2 += 1

if B > 1 and A > 1:
    print(2*(q1+q2),100)
elif (B == 1 and A > 1) or (B > 1 and A == 1):
    print(2*(q1+q2)-1,100)
else:
    print(2,100)

if B > 1:
    for i in range(2 * q1):
        if i % 2 == 1:
            print(''.join(['.'] * 100))
        elif i != 2 * q1 - 2:
            print(''.join(['.', '#'] * 50))
        else:
            print(''.join(['.', '#'] * r1 + ['.'] * (100 - 2 * r1)))
else:
    print(''.join(['.']*100))


if A > 1:
    for i in range(2 * q2):
        if i % 2 == 0:
            print(''.join(['#'] * 100))
        elif i != 2 * q2 - 1:
            print(''.join(['#', '.'] * 50))
        else:
            print(''.join(['#', '.'] * r2 + ['#'] * (100 - 2 * r2)))
else:
    print(''.join(['#']*100))


Measured memory_bytes: 62000
#pragma GCC optimize("O2")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("avx,avx2,sse,sse2,fma,tune=native")
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
using namespace std;
using ll = long long;
using vi = vector<ll>;
using pi = pair<ll, ll>;
using vpi = vector<pi>;
using ld = long double;
const int maxn = 5e2 + 10, mlg = 17, mod = 1e9 + 7;
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n, t;
	cin >> n;
	while(n--) {
		cin >> t;
		if(t&1) continue;
		if((t%5)&&(t%3)) {
			cout << "DENIED";
			return 0;
		}
	}
	cout << "APPROVED";
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define endl "\n"
#define se second
#define ls( s) (s&(-s))
#define ll long long
const int N = 3000300;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
const int mod =    1e9+7;
ll n;
ll arr[100];
int main()
{ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin>>n;
ll ans=0;
rep(i,1,n+1)
cin>>arr[i];

rep(i,1,n+1)
rep(j,1,n+1)
{
	if(i!=j)
	ans+=arr[i]*arr[j];
}
cout<<ans/2;




}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
//#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>


#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979
#define MAXI 7500000

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

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

int main(void){
    int n;
    int mini = INF;
    int maxi = 0;
    int count[10] = {};

    cin >> n;
    int a;
    FOR(i,1,n){
        cin >> a;
        if(a>=3200){
            count[8]++;
        }else{
            count[a / 400]++;
        }
    }
    if(count[8]==0){
        FOR(i,0,7){
            if(count[i]>0){
                maxi++;
            }
        }
        mini = maxi;
    }else{
        mini = 0;
        FOR(i,0,7){
            if(count[i]>0){
                mini++;
            }
        }
        if(mini==0){
            mini = 1;
            maxi = count[8];
        }else{
            maxi = mini + count[8];
        }
    }
    cout << mini << " " << maxi << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<algorithm>
#define rep(i,n) for(i=0;i<(n);i++)
using namespace std;
using ll=long long;
using P=pair<int,int>;
#define ll long long int
int main()
{
    string s;
    cin>>s;
    if(s[s.size()-1]=='s')
        cout<<s+"es"<<endl;
    else
        cout<<s+"s"<<endl;
    return 0;
}


Measured memory_bytes: 3648
#include <cstdio>
#include <algorithm>
using namespace std;
int main()
{
    long long h, count = 0, inc = 1;
    scanf("%lld", &h);
    while (true)
    {
        if (h <= 1)
        {
            count += inc;
            break;
        }
        count += inc;
        h /= 2;
        inc *= 2;
    }
    printf("%lld", count);

    return 0;
}

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

int main() {
  int N,M;
  long long ans=0;
  cin>>N>>M;
  priority_queue<int> a;
  for(int i=0;i<N;i++){
    int x;
    cin>>x;
    a.push(x);
  }
  for(int i=0;i<M;i++){
    a.push(a.top()/2);
    a.pop();
  }
  for(int i=0;i<N;i++){
    ans+=a.top();
    a.pop();
  }
  
  cout<<ans;
}


Measured memory_bytes: 892
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void _main()
{
    int N;
    cin >> N;
    vector<int> p(N);
    int max = 0;
    int sum = 0;
    rep(i, 0, N)
    {
        cin >> p[i];
        chmax(max, p[i]);
        sum += p[i];
    }
    cout << sum - max + max / 2 << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define rep(i,n) for(ll i=0;i<(n);i++)  
#define pii pair<int,int>
#define piii pair<int,pii>
#define mp make_pair
#define pb push_back  
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second  
const int INF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const double eps = 1e-5;
const double PI = M_PI;  
#define DEB cout<<"!"<<endl
#define SHOW(a,b) cout<<(a)<<" "<<(b)<<endl
#define SHOWARRAY(ar,i,j) REP(a,i)REP(b,j)cout<<ar[a][b]<<((b==j-1)?((a==i-1)?("\n\n"):("\n")):(" "))
  
#define DIV 1000000007
typedef vector<ll> Array;
typedef vector<Array> matrix;

#define MAX 1000000005

int main(){
  int a,b; cin >> a >> b;
  cout << (a-1)*(b-1) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip> // cout<<setprecision(n)
#include <functional> // std::function<void(long long)>
using namespace std;
#define All(v) (v).begin(),(v).end()
const long long mod = 1000000007;
const long long inf = mod*mod;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
signed main(){
    long long n;
    cin>>n;
    vector<int> A(n),B(n),C(n);
    for(int i=0;i<n;i++)cin>>A[i];
    for(int i=0;i<n;i++)cin>>B[i];
    for(int i=0;i<n;i++)cin>>C[i];
    sort(All(A));
    sort(All(B));
    sort(All(C));
    long long res = 0;
    for(auto b:B){
        long long u = distance(A.begin(),lower_bound(All(A),b));
        long long d = n-distance(C.begin(),upper_bound(All(C),b));
        res+=u*d;
    }
    cout<<res<<endl;

}

Measured memory_bytes: 1408
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    S = SS()

    len_S = len(S)
    ans = 0
    for i in range(len_S // 2):
        if S[i] != S[len_S-1-i]:
            ans += 1

    print(ans)

if __name__ == '__main__':
    resolve()


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

#define debug(a) cout << #a << " " << a << endl;
#define _debug(a, i) cout << #a << "[" << i << "]" << " = " << a[i] << endl;
#define fastio ios_base::sync_with_stdio(false); \
			cin.tie(0);							     \
			cout.tie(0);
#define sz(arr) ll(arr.size())

using namespace std;

using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1e18 + 9;
const double PI = 4.0 * atan(1.0);

ll powmod(ll a, ll b, const ll MOD) { ll res = 1; a %= MOD; assert(b >= 0); for (; b; b >>= 1) { if (b & 1)res = res * a % MOD; a = a * a % MOD; } return res; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a, b); }
ll modInverse(ll n, const ll p) { return powmod(n, p - 2, p); }
ll div_floor(ll a, ll b) { return a / b - (((a ^ b) < 0) and a % b); }
ll div_ceil(ll a, ll b) { return a / b + (((a ^ b) >= 0) and a % b); }
ll kCn(ll k, ll n, ll f[]) { return (f[n] * modInverse((f[n - k] * f[k]) % MOD, MOD)) % MOD; }

vector<int> a[100005];
bool good[100005];

int main() {
	//#ifndef ONLINE_JUDGE
	//	(void)freopen("input.txt", "r", stdin);
	//	(void)freopen("output.txt", "w", stdout);
	//#endif // !ONLINE_JUDGE
	fastio;

	int n, m;
	cin >> n >> m;
	vector<int> h(n + 1);
	for (int i = 1; i <= n; ++i) {
		cin >> h[i];
	}
	while (m--) {
		int u, v;
		cin >> u >> v;
		a[u].push_back(v);
		a[v].push_back(u);
	}
	int cnt = 0;
	for (int i = 1; i <= n; ++i) {
		if (!good[i]) {
			bool ok = true;
			for (auto u : a[i]) {
				if (h[i] > h[u]) {
					good[u] = true;
				}
				else {
					ok = false;
					break;
				}
			}
			if (ok)
				++cnt;
		}
	}
	cout << cnt;

	return 0;
}


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

int main()
{
	int n; 
	cin>> n ; 
	vector<int> h(n);
	vector<int> dp(n, INT_MAX);
	dp[0]=0;
	for( int i=0 ;i<n ;i++ )
		cin>>h[i];

	for( int i=0 ; i<n-1; i++ )
	{
		dp[i+1] = min(dp[i+1], abs(h[i]-h[i+1]) + dp[i] );
		if( i != n-2 )
			dp[i+2] = min(dp[i+2], abs(h[i]-h[i+2]) + dp[i] );
	}
	cout<<dp[n-1];
	return 0;

}

Measured memory_bytes: 1024
#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() {
  string s;
  cin >> s;
  int n = s.length();
  vector<int> cnt(4);
  rep(i, n) {
    if (s[i] == 'N') cnt[0]++;
    if (s[i] == 'S') cnt[1]++;
    if (s[i] == 'E') cnt[2]++;
    if (s[i] == 'W') cnt[3]++;
  }

  bool ok = false, ok1 = false;
  if ((cnt[0] > 0 && cnt[1] > 0) || (cnt[0] == 0 && cnt[1] == 0)) ok = true;
  if ((cnt[2] > 0 && cnt[3] > 0) || (cnt[2] == 0 && cnt[3] == 0)) ok1 = true;

  if (ok && ok1) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3632
// https://atcoder.jp/contests/abc148/tasks/abc148_c

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;
template <typename T>
inline bool chmax(T& a, T b);
template <typename T>
inline bool chmin(T& a, T b);
void print_ints(vector<ll> v);
template <typename T>
void drop(T a);

const ll INF = 1e18;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

void solve() {
  ll A, B;
  cin >> A >> B;

  ll res = A * B / gcd(A, B);
  cout << res << endl;
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

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

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

void print_ints(vector<ll> v) {
  rep(i, v.size()) {
    if (i > 0) {
      cout << " ";
    }

    cout << v[i];
  }

  cout << endl;
}

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
if n==1:
  if a[0]%2==0:
    print(1)
  else:
    print(2)
else:
  total = 3**n
  evens = 0
  for x in a:
    if x%2==0:
      evens += 1
  exceptns = 2**evens
  print(total-exceptns)

Measured memory_bytes: 3060
import java.util.*;

public class Main {
	
	
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt(),b=sc.nextInt();
		if(0<a&&a<10&&0<b&&b<10) {
			System.out.println(a*b);
		}else System.out.println(-1);
		
	}

}


Measured memory_bytes: 23252
#include <cstdio>

int main()
{
    int N;
    scanf("%d", &N);
    int V[20];
    int C[20];
    for (int i = 0; i < N; i++) {
        scanf("%d", &V[i]);
    }

    for (int i = 0; i < N; i++) {
        scanf("%d", &C[i]);
    }
    int ans = 0;
    for (int i = 0; i < N; i++) {
        if (V[i] - C[i] > 0) {
            ans += V[i] - C[i];
        }
    }

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


Measured memory_bytes: 128
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
#include<limits.h>
#include<unordered_map>
#include<unordered_set>
#include<deque>
#include<cstdio>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N = 1000000;
const int mod = 1000000007;
const int INF = 1 << 30;
#define rep(i,n) for(ll i=(ll)0;i<(ll)n;++i)
#define ALL(x) x.begin(),x.end()
#define pp pair<ll,ll>
#define fi first
#define se second
#define pb push_back
#define fix(n) fixed<<setprecision(n)
#define itr vector<ll>::iterator
int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
string YN(bool b) { return(b ? "YES" : "NO"); }
string yn(bool b) { return(b ? "Yes" : "No"); }
ll a, b,c,sz=0;
int main() {
	cin >> a >> b;
	c = b;
	while (b > 0) { ++sz, b /= 10; }
	c += pow(10, sz)*a;
	int s = sqrt(c);
	cout << yn(s*s == c) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <ctype.h>
#include <map>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <cctype>
#include <queue>
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define REP1(j,n) for(int j=0;j<(int)n;++j)
#define REPD(i,n) for(int i=n;i>=0;--i)
#define REPD1(j,n) for(int j=n;j=>0;--j)
#define REPS(i,n) for(int i=1;i<=(int)n;++i)
#define REPS1(j,n) for(int j=1;j<=(int)n;++j)
#define rep(i,a,n) for(int i=a;i<=(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;

int main(void) {
	int a, b, t;
	cin >> a >> b >> t;
	cout << (t / a)*b << endl;
	return 0;
}



Measured memory_bytes: 256
import math
N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))

used = [False]*N
pth = 0
for i in range(N):
    used[P[i] - 1] = True
    pth += ((P[i] -1) - used[:P[i]-1].count(True)) *math.factorial(N-i-1)

used = [False]*N
qth = 0
for i in range(N):
    used[Q[i] - 1] = True
    qth += ((Q[i] -1) - used[:Q[i]-1].count(True) ) *math.factorial(N-i-1)

print(abs(pth - qth + 1 -1))

Measured memory_bytes: 3064
a = input().split()
a += input().split()
a += input().split()
n = int(input())
b = set([(input()) for i in range(n)])

bingo = False
if set([a[0], a[1], a[2]]).issubset(b):
	bingo = True
if set([a[3], a[4], a[5]]).issubset(b):
	bingo = True
if set([a[6], a[7], a[8]]).issubset(b):
	bingo = True
if set([a[0], a[3], a[6]]).issubset(b):
	bingo = True
if set([a[1], a[4], a[7]]).issubset(b):
	bingo = True
if set([a[2], a[5], a[8]]).issubset(b):
	bingo = True
if set([a[0], a[4], a[8]]).issubset(b):
	bingo = True
if set([a[2], a[4], a[6]]).issubset(b):
	bingo = True
if bingo:
  print("Yes")
else:
  print("No")  

Measured memory_bytes: 3064
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>


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

const ll INF = 1e16;
const ll MOD = 998244353;
// const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)




const long long table_size = 300005;
long long fact[table_size], finv[table_size], inv[table_size];

// 前処理
void make_table(long long mod) {
    fact[0] = fact[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (long long i = 2; i < table_size; i++){
        fact[i] = fact[i - 1] * i % mod;
        inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

// nCr
long long nCr(long long n, long long r, long long mod){
    return fact[n] * (finv[r] * finv[n - r] % mod) % mod;
}


int main() {
    ll n, a, b, k;
    cin >> n >> a >> b >> k;
    
    make_table(MOD);
    
    ll ans = 0;
    REP(i, n + 1){
        ll t = k - i * a;
        if(t < 0 || t > n * b || t % b != 0)continue;
        ll tt = t / b;
        ans += nCr(n, i, MOD) * nCr(n, tt, MOD) % MOD;
        ans %= MOD;
    }
    cout << ans << endl;
}


Measured memory_bytes: 7296
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define F first
#define S second
#define int long long
#define ll long long
//#define int  unsigned long long
#define pb push_back
#define double long double

using namespace std;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
const int N = 35000;
const int K = 19;
int mod =  1e9 + 7;
int n, dp[210][100200], a[N], f[N], invf[N];
int solve(int m, int x){
    if (m > n) return dp[m][x] = x;
    if (dp[m][x] != 0) return dp[m][x];
    int cnt = 0;
    int l = m;
    while (l <= n && a[l] > x){
        cnt++;
        l++;
    }
    if (cnt != 0) return dp[m][x] = f[n - m + 1] * invf[n - m - cnt + 1] % mod * solve(m + cnt, x) % mod;
    int res = 0;
    for (int i = m; i <= n; i++){
        res = (res + f[n - m] * invf[n - i] % mod * solve(i + 1, x % a[i])) % mod;
    }
    return dp[m][x] = res;
}
int binpow(int x, int y){
    if (y == 0) return 1;
    if (y % 2) return x * binpow(x, y - 1) % mod;
    int z = binpow(x, y / 2);
    return z * z % mod;
}
main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);
    int x;
    cin >> n >> x;
    f[0] = 1;
    invf[0] = 1;
    for (int i = 1; i <= n; i++) f[i] = f[i - 1] * i % mod;
    for (int i = 1; i <= n; i++) invf[i] = binpow(f[i], mod - 2);
    for (int i = 1; i <= n; i++) cin >> a[i];
    sort(a + 1, a + n + 1);
    reverse(a + 1, a + n + 1);
    cout << solve(1, x);
}


Measured memory_bytes: 157952