akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);

    String S = sc.next();
    String T = sc.next();

    int alphabet_s[] = new int[26];
    int alphabet_t[] = new int[26];
    for (int i = 0; i < 26; i++) {
      alphabet_s[i] = -1;
      alphabet_t[i] = -1;
    }

    for (int i = 0; i < S.length(); i++) {
      int s = S.charAt(i) - 'a';
      int t = T.charAt(i) - 'a';

      if (alphabet_s[s] < 0) {
        alphabet_s[s] = t;
      } else {
        if (alphabet_s[s] != t) {
          System.out.println("No");
          return;
        }
      }
      
      if (alphabet_t[t] < 0) {
        alphabet_t[t] = s;
      } else {
        if (alphabet_t[t] != s) {
          System.out.println("No");
          return;
        }
      }

    }

    System.out.println("Yes");

  }
}

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

int main() {
  ll n, k, s; cin >> n >> k >> s;
  rep(i, k) cout << s << " ";
  rep(i, n - k) {
    if (s != 1000000000)
      cout << 1000000000 << " ";
    else
      cout <<s - 1 << " ";
  }
  return 0;
}

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

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef long double ld;

const int INF = 1e9;
const ld EPS = 1e-8;

bool solve(int N, const vector<int>& a, const vector<int>& b) {
  int M = a.size();
  vector<int> cnt(N, 0);
  REP(i,M - 1) {
    ++cnt[a[i]];
    ++cnt[b[i]];
  }

  int tmp1 = -1, tmp2 = -1;
  REP(i,N) {
    if(cnt[i] % 2 == 1) {
      if(tmp2 != -1) return false;
      else if(tmp1 != -1) tmp2 = i;
      else tmp1 = i;
    }
  }

  if(min(a[M - 1], b[M - 1]) == tmp1 && max(a[M - 1], b[M - 1]) == tmp2) return true;
  return false;
}

int main(){
  int N, M;
  cin >> N >> M;
  vector<int> a(M), b(M);
  REP(i,M) {
    cin >> a[i] >> b[i];
    --a[i]; --b[i];
  }

  cout << (solve(N, a, b) ? "YES" : "NO") << endl;
  return 0;
}



Measured memory_bytes: 1408
#include<iostream>
int main(){
    int N;
    std::cin >> N;
    unsigned long long int A[N];
    unsigned long long pool = 1;
    for(int i = 0; i < N; i++){ std::cin >> A[i];if(A[i] == 0) pool = 0;}
    if(pool == 0) { std::cout << 0; return 0;}

    for(int i = 0; i < N; i++){
        if(A[i] > 1000000000000000000/pool) {std::cout << -1; return 0;}
        pool*=A[i];
    }
    std::cout << pool;
}

Measured memory_bytes: 4364
#include <iostream>

using namespace std;

int h, w, t, p;
int a[105][105], b[105][105];

int main(void)
{
  while(1){
    cin >> w >> h >> t >> p;
    if(w == 0 && h == 0 && t == 0 && p == 0) break;

    for(int x = 0; x < 105; x++){
      for(int y = 0; y < 105; y++){
        a[x][y] = 0;
        if(x < w && y < h) a[x][y] = 1;
      }
    }
    int d, c;
    for(int i = 0; i < t; i++){
      cin >> d >> c;
      for(int x = 0; x < 105; x++){
        for(int y = 0; y < 105; y++){
          b[x][y] = 0;
        }
      }
      if(d == 1){
        for(int x = 0; x < w; x++){
          for(int y = 0; y < h; y++){
            b[x][y] = a[x][y];
          }
        }
        for(int x = 0; x < c; x++){
          for(int y = 0; y < h; y++){
            int nx = c + (c - x - 1);
            b[nx][y] += b[x][y];
          }
        }
        for(int x = 0; x < w; x++){
          for(int y = 0; y < h; y++){
            a[x][y] = b[x+c][y];
          }
        }
        w -= min(c, w-c);
      }

      if(d == 2){
        for(int x = 0; x < w; x++){
          for(int y = 0; y < h; y++){
            b[x][y] = a[x][y];
          }
        }
        for(int x = 0; x < w; x++){
          for(int y = 0; y < c; y++){
            int ny = c + (c - y - 1);
            b[x][ny] += b[x][y];
          }
        }
        for(int x = 0; x < w; x++){
          for(int y = 0; y < h; y++){
            a[x][y] = b[x][y+c];
          }
        }
        h -= min(c, h-c);
      }
    }

    int x, y;
    for(int i = 0; i < p; i++){
      cin >> x >> y;
      cout << a[x][y] << endl;
    }
  }

  return 0;
}



Measured memory_bytes: 3172
#include<bits/stdc++.h>
#define mod 1000000007
#define pb push_back 
#define ll long long
using namespace std;
bool isPerfectSquare(long double x) 
{   
  // Find floating point value of  
  // square root of x. 
  long double sr = sqrt(x); 
  
  // If square root is an integer 
  return ((sr - floor(sr)) == 0); 
} 
int main()
 {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
	ll n,d;
  	cin>>n>>d;
  	ll p[n][d], cont=0;
  	for(int i=0;i<n;i++){
  	    for(int j=0;j<d;j++){
  	        cin>>p[i][j];
  	    }
  	}
  	for(int i=0;i<n-1;i++){
  	    for(int j=i+1;j<n;j++){
  	        long double sum = 0.0;
  	        for(int k=0;k<d;k++){
  	            sum += pow((p[i][k]-p[j][k]),2);
  	        }
  	        if(isPerfectSquare(sum)){cont++;}
  	    }
  	}
  	cout<<cont<<endl;
	return 0;
}

Measured memory_bytes: 384
var n,i,j,tmp:Longint;
A:array[1..50]of Longint;
ans:real;
begin
read(n);
for i:=1 to n do begin
read(A[i]);
for j:=i-1 downto 1 do begin
if A[j]>A[j+1]then begin
tmp:=A[j];
A[j]:=A[j+1];
A[j+1]:=tmp;
end else break;
end;
end;
ans:=A[1];
for i:=2 to n do begin
ans:=(ans+A[i])/2;
end;
writeln(ans:0:9);
end.

Measured memory_bytes: 128
#include <stdio.h>
#include <math.h>
int main(void) {
	int N,i,j,k;
	scanf("%d",&N);
	int c[N][N],kai=1;
	double tmp=0,ans=0;
	for(i=0;i<N;i++){
			scanf("%d %d",&c[i][0],&c[i][1]);
			kai=kai*(i+1);
	}
		for(j=0;j<N-1;j++){
			for(k=j+1;k<N;k++){
				tmp=(double)(c[j][0]-c[k][0])*(c[j][0]-c[k][0])+(double)(c[j][1]-c[k][1])*(c[j][1]-c[k][1]);
				
				ans=ans+pow(tmp,0.5);
			}
		}
		printf("%f",ans*((kai*2)/N)/kai);
	return 0;
}

Measured memory_bytes: 384
N,K = map(int,input().split())
la = list(map(int,input().split()))
la = sorted(la)
la = sorted(la,key=abs,reverse=True)
lg = la[:K]
lgp = []
lgm = []
lr = la[K:]
lrp = []
lrm = []
for a in lg:
    if a >= 0:
        lgp.append(a)
    else:
        lgm.append(a)
for a in lr:
    if a >= 0:
        lrp.append(a)
    else:
        lrm.append(a)
if len(lgm) % 2 == 1:
    if len(lrp) > 0 and len(lrm) > 0:
        if len(lgp) > 0 and len(lgm) > 0:
            if lgp[len(lgp) - 1] * lrp[0] > lgm[len(lgm) - 1] * lrm[0]:
                lg.pop(lg.index(lgm[len(lgm) - 1]))
                lg.append(lrp[0])
            else:
                lg.pop(lg.index(lgp[len(lgp) - 1]))
                lg.append(lrm[0])
        else:
            if len(lgp) > 0:
                lg.pop(lg.index(lgp[len(lgp) - 1]))
                lg.append(lrm[0])
            else:
                lg.pop(lg.index(lgm[len(lgm) - 1]))
                lg.append(lrp[0])
    elif len(lrp) > 0:
        if len(lgm) > 0:
            lg.pop(lg.index(lgm[len(lgm) - 1]))
            lg.append(lrp[0])
        else:
            lg = la[N - K:]
    elif len(lrm) > 0:
        if len(lgp) > 0:
            lg.pop(lg.index(lgp[len(lgp) - 1]))
            lg.append(lrm[0])
        else:
            lg = la[N - K:]
ans = 1
for a in lg:
    ans *= a
    ans %= 10 ** 9 + 7
print(ans)



Measured memory_bytes: 31764
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;

#define MAX (ll(1e6)+7)
#define MOD (ll(1e9)+7)
#define INF (ll(1e18)+7)

#define elif else if
#define def inline auto

#define for_in(a,b,c) for(ll a=(b);a<(c);++a)
#define repeat(a,b) for(ll a=0;a<(b);++a)
#define repeat_down(a,b) for(ll a=(b);a>=0;--a)

#define array_size(a) ll(sizeof(a)/sizeof(a[0]))

#define def_input(...) ll __VA_ARGS__;input(__VA_ARGS__)
#define if_print(a,b,c) output(a?#b:#c)
#define print(a) output(#a)
#define fout(a) cout<<fixed<<setprecision(10)<<a
#define fillout(a,b,c) cout<<setfill(a)<<setw(b)<<right<<c
#define ios_boost cin.tie(0);ios::sync_with_stdio(false)

#define digit(a) to_string(a).length()
#define lcm(a,b) a*b/gcd(a,b)

char N='\n',S=' ';
const ll primes[15]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47};
ll temp_index;

inline void input(){}
template<class T,class...A>inline void input(T&&t,A&&...a){cin>>t;input(move(a)...);}
template<class T>inline void output(T&t){cout<<t<<N;}
template<class T,class...A>inline void output(T t,A...a){cout<<t<<S;output(move(a)...);}
template<class T>istream&operator>>(istream&i,vector<T>&v){for(T&x:v)i>>x;return i;}
template<class T>ostream&operator<<(ostream&o,vector<T>const&v)
{bool d=0;for(T x:v){if(d)o<<S<<x;else{o<<x,d=1;}}o<<N;return o;}

def get_ll(){ll x;input(x);return x;}
def gcd(ll a,ll b){ll c;while(a){c=a;a=b%a;b=c;}return b;}

inline bool is_prime(ll a){
    if(a<48){for_in(i,0,15)if(primes[i]==a)return 1;}
    elif(a<2809)return gcd(614889782588491410,a)==1;
    else {print(Error:Argument>2808);exit(1);}return 0;
}

template<class T>def sum_array(T&a,T&b){
    b[0]=a[0];
    for_in(i,1,array_size(a))b[i]=a[i]+b[i-1];
}

map<string,ll>LIST;
map<ll,string>VLIST;

def val(string a){
    auto IT=LIST.find(a);
    if(IT!=LIST.end()){
        return LIST[a];
    }
    else{
        ll v=LIST.size();
        LIST[a]=v;
        VLIST[v]=a;
        return v;
    }
}

ll a,b,c,d;ll p[201];
int main(){
    ios_boost;
    string A;
    cin>>A;
    cin>>a;
    repeat(i,A.length()){
        if(A[i]!='1'){
            cout<<A[i]-'0'<<N;
            break;
        }
        else if(i+1==a){
            cout<<1<<N;
            break;
        }
    }
}

//for compilation: g++ -o _ _.cpp -std=c++14 (or 17)
//
//for fastening: g++ -O2 -o _ _.cpp -std=c++14 (or 17)
//for fastening: g++ -O3 -mtune=native -march=native -o _ _.cpp -std=c++14 (or 17)


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<stdio.h>
#include<vector>
using namespace std;
#define rep(s,i,n) for(int i=s;i<n;i++)
#define c(n) cout<<n<<endl;
#define ic(n) int n;cin>>n;
#define sc(s) string s;cin>>s;
#define mod 1000000007
#define f first
#define s second
#define int long long
int a[114514];
int ans[114514];
signed main(){
	sc(s)
	string ans="";
	int n=s.size();
	rep(0,i,n){
		if(s[i]=='0')ans+='0';
		if(s[i]=='1')ans+='1';
		if(s[i]=='B')ans=ans.substr(0,ans.size()-1);
	}
	c(ans)
}		

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

int main() {
	int N,K,r=INF;
	cin >> N >> K;
	vector<int> h(N);
	rep(i,N)
		cin >> h.at(i);
	sort(h.begin(), h.end());

	rep(i,N-K+1)
		r = min(r, h.at(i+K-1)-h.at(i));

	cout << r << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    bool a = false;
    bool b = false;
    cin >> s;
    for (int i=0;i < s.size();i+=2){
        if (s[i]!='L'){
            a=true;
        }else{
            cout << "No";
            exit(0);
        }
    }
    for (int i=1;i < s.size();i+=2){
        if (s[i]!='R'){
            b=true;
        }else{
            cout << "No";
            exit(0);
        }
    }
        cout << "Yes";
}




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

int main() {
  int H, W;
  cin >> H >> W;
  string a[H];
  for (int i = 0; i < H; i++) {
    cin >> a[i];
  }
  for (int i = -1; i <= H; i++) {
    cout << "#" << flush;
    for (int j = 0; j < W; j++) {
      if (i == -1 || i == H)
        cout << "#" << flush;
      else
        cout << a[i][j] << flush;
    }
    cout << "#" << endl;
  }
}

Measured memory_bytes: 256
while True:
    line = input().split()
    a = int(line[0])
    op = line[1]
    b = int(line[2])
    
    def add(a, b):
        add = a + b
        return add
    def sub(a, b):
        sub = a - b
        return sub
    def mul(a, b):
        mul = a * b
        return mul
    def div(a, b):
        div = a // b
        return div
    
    if op == '+':
        print(add(a, b))
    elif op == '-':
        print(sub(a, b))
    elif op == '*':
        print(mul(a, b))
    elif op == '/':
        print(div(a, b))
    else:
        break
        


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

int main(){
  int n,t;cin>>n;
  //pair
  pair<int,int> p[n];
  REP(i,n){
    cin>>t;
    p[i]=make_pair(t,i+1);
  }
  sort(p,p+n);
  REP(i,n) cout<<p[i].second<<" ";
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define mp(a,b) make_pair(a,b)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
#define Re(a) reverse((a).begin(),(a).end())
#define YN(a) if(a){cout<<"Yes"<<endl;}else cout<<"No"<<endl;//条件によってYes、Noを出力する
int main(){
    int n;
    cin>>n;
    vector<int> l(n);
    rep(i,n)cin>>l[i];
    int cnt=0;
    if(n<=2){
        cout<<0<<endl;
        return 0;
    }
    for(int i=0;i<n-2;i++){
        for(int j=i+1;j<n-1;j++){
            for(int k=j+1;k<n;k++){
                int a=l[i],b=l[j],c=l[k];
                if(l[i]!=l[j] && l[i]!=l[k] && l[j]!=l[k]){
                    if(a+b>c && b+c>a && c+a>b){
                        cnt++;
                    }
                }
            }
        }
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 3624
// Problem: C - Walking Takahashi
// Contest: AtCoder - AtCoder Beginner Contest 175
// URL: https://atcoder.jp/contests/abc175/tasks/abc175_c
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4.1,sse4.2,avx,avx2,popcnt,tune=native")
//
//#include <immintrin.h>
//#include <emmintrin.h>

#include <bits/stdc++.h>
//#pragma GCC optimize("O2")
#define vi vector<int>
#define pii pair<int, int >
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define LL long long
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define per(i,a,n) for (int i=n;i>=a;i--)
#define all(x) (x).begin(), (x).end()
#define all2(x,n) (x+1), (x+1+n)
#define sz(x) ((int)(x).size())
#define mod(x) ((x)%MOD)
#define debug(x) cerr<<#x<<" : "<<x<<endl
#define mt make_tuple
#define eb emplace_back
#define o(X) (1<<(X))
#define oL(X) (1LL<<(X))
#define contain(S,X) (((S)&o(X))!=0)
#define containL(S,X) (((S)&oL(X))!=0)
#define ppt(x) __builtin_popcount(x)
using namespace std;
const int INF=0x3f3f3f3f,N=1e6+5,MOD=1e9+7;
const LL INF_LL=0x3f3f3f3f3f3f3f3fLL;
inline int getplc(int x,int y) { return (x>>y)&1; }
template<typename T>
T square(T x) {return x*x;}
LL qpow(LL a,LL b=MOD-2,LL _MOD=MOD){
	LL res=1;
	for(;b;b>>=1,a=a*a%_MOD){
		if(b&1)res=res*a%_MOD;
	}
	return res;
}
// Smax
//int Smax() { return -INF; }
template <typename T>
T Smax(T x) { return x; }
template<typename T, typename... Args>
T Smax(T a, Args... args) { return max(a, Smax(args...)); }
// Smin
template <typename T>
T Smin(T x) { return x; }
template<typename T, typename... Args>
T Smin(T a, Args... args) { return min(a, Smin(args...)); }
template <typename T>
// erro
#define errorl(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); errl(_it, args); }

void errl(istream_iterator<string> it) {}
template<typename T, typename... Args>
void errl(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	errl(++it, args...);
}

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); cerr<<endl;}
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << "=" << a << " # ";
	err(++it, args...);
}
void Solve();
int main() {
#ifndef ONLINE_JUDGE
//	freopen("in.txt","r",stdin);
//    freopen("o1.txt","w",stdout);
#endif
	ios::sync_with_stdio(false);cin.tie(0),cout.tie(0);
	Solve();
	return 0;
}

//////////////////////////////////////////////////////////////////

void Solve(){
  LL x,k,d;
  cin>>x>>k>>d;
  x=abs(x);
  if(k<=x/d){
    cout<<x-k*d<<endl;
  }
  else{
    LL times=x/d,cur=x-times*d;
    if((k-times)&1)cur=abs(cur-d);
    cout<<cur<<endl;
  }
} 


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

int main() {
	char n[4];
	for (int i = 0; i < 4; i++) cin >> n[i];

	if ((n[0] == n[1] && n[1] == n[2]) || (n[1] == n[2] && n[2] == n[3])) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

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

typedef long long int ll;

int main()
{
    ll l, r, d;
    cin >> l >> r >> d;
    ll ans = 0;
    for(ll i = l;i <= r;i++){
        if(i % d == 0){
            ans++;
        }
    }

    cout << ans;
    
    return 0;
    
}


Measured memory_bytes: 3672
#include <stdio.h>
#include <algorithm>

int s[100001];

int main(int argc, char *argv[])
{
    int i = 0;
    char c;
    while((c=getchar())!='\n') {
        if (c == '0') s[i] = 0;
        else s[i] = 1;
        i++;
    }
    int t1=0,t2=0;
    for (int j = 0;j<i;j++) {
        if (s[j] != j%2) {
            t1++;
        }
    }
    for (int j = 0;j<i;j++) {
        if (s[j] != (j+1)%2) {
            t2++;
        }
    }
    printf("%d\n", std::min(t1, t2));
    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <list>
#include <algorithm>
using namespace std;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n; cin >> n;
    list<int> li;

    for (int i=0; i<n; ++i) {
        string op; cin >> op;
        if (op == "insert") {
            int key; cin >> key;
            li.push_front(key);
        } else if (op == "deleteFirst") {
            li.pop_front();
        } else if (op == "deleteLast") {
            li.pop_back();
        } else {
            int key; cin >> key;
            list<int>::iterator pos = find(li.begin(), li.end(), key);
            if (pos != li.end()) {
                li.erase(pos);
            }
        }
    }

    for (list<int>::iterator it = li.begin(); it != li.end(); ++it) {
        cout << ((it == li.begin()) ? "" : " ") << *it;
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 32480
#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()
    
int main(){
    int a;
    cin >> a;
    int x = a/100;
    if(4<=x && x<=5) cout << 8 << endl;
    else if(6<=x && x <= 7) cout << 7 << endl;
    else if(8<=x && x <= 9) cout << 6 << endl;
    else if(10<=x && x <= 11) cout << 5 << endl;
    else if(12<=x && x <= 13) cout << 4 << endl;
    else if(14<=x && x <= 15) cout << 3 << endl;
    else if(16<=x && x <= 17) cout << 2 << endl;
    else{
        cout << 1 << endl;
    }
}

Measured memory_bytes: 3616
n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))
cnt = 0
for i in T:
 a = 0
 b = n-1
 while b >= a:
  mid = (a + b) // 2
  if S[mid] == i:
   cnt += 1
   break
  elif S[mid] > i:
   b = mid - 1
   continue
  else:
   a = mid + 1
   continue
print(str(cnt))

Measured memory_bytes: 18760
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;
#define loop(i,N) for(ll (i)=0; (i)<(N);++(i))
struct _OMAZINAI_ { _OMAZINAI_() { std::ios::sync_with_stdio(false); std::cin.tie(0); } } __omazinai_instance__;
#define INF (1LL<<61 + 1<<29)
#define YesNo(x) {std::cout << ((x)?"Yes":"No") << std::endl;}
#define YESNO(x) {std::cout << ((x)?"YES":"NO") << std::endl;}
typedef long long int ll;


int main() {
	int r = 700;
	string s;
	cin >> s;
	for (char c : s)
		r += 100 * !(c - 'o');
	cout << r << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string.h>
using namespace std;
int main(){
    int N,M,Aj,Bj,HAj,HBj,count;
    cin >> N >> M;
    count = N;
    int H[N],Hflag[N];
    for(int i=0;i<N;i++)cin >> H[i];
    memcpy(Hflag,H,sizeof(H));
    for(int j=0;j<M;j++){
        cin >> Aj >> Bj;
        HAj=H[Aj-1];
        HBj=H[Bj-1];
        if(HAj>=HBj && Hflag[Bj-1] != -1){
            Hflag[Bj-1]=-1;
            count--;
        }
        if(HAj<=HBj && Hflag[Aj-1] != -1){
            Hflag[Aj-1]=-1;
            count--;
        }
    }
    cout << count << '\n';
    return 0;
}

Measured memory_bytes: 4404
#include<stdio.h>
#include<stdlib.h>

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){}

Node treeSearch(Node u, int k){}
Node treeSuccessor(Node x){}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y
}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x!=NIL){
    y=x;
    if(z->key<x->key) x=x->left;
    else x=x->right;
  }
    z->parent=y;
    if(y==NIL) root=z;
    else if(z->key<y->key) y->left=z;
    else y->right=z;
}

void inorder(Node u){
  if(u!=NIL){
    inorder(u->left);
    printf(" %d",u->key);
    inorder(u->right);
  }
}

void preorder(Node u){
  if(u!=NIL){
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
  }  
}

int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }
  return 0;
}

Measured memory_bytes: 24040
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      	int a = sc.nextInt();
      	int b = sc.nextInt();
      	int c = sc.nextInt();
      	
      	if (a + b + c <= 21){
        	System.out.println("win");
        }else{
        	System.out.println("bust");
        }
    }
}

Measured memory_bytes: 23892
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P   = pair<ll, ll>;
using mat = vector<vector<ll>>;

void IOS() { ios::sync_with_stdio(false), cin.tie(0); }

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

ll mod(ll a) {
	if (a > 0) return a % MOD;
	if (a % MOD == 0) return 0;
	ll x = -a / MOD + 1;
	a += x * MOD;
	return a % MOD;
}

template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
	fill((T *)array, (T *)(array + N), val);
}
// int dx[4]    = {1, 0, -1, 0};
// int dy[4]    = {0, 1, 0, -1};
// ll pas[5001][5002];

ll used[114514] = {};

int main() {
	IOS();
	double a, b, c;
	cin >> a >> b >> c;
	double ans = a * b / 2.0;
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
X = int(input())


#すぐ発散するからプラスマイナス200で十分な値になる。



for i in range(-200,200):
    for j in range(-200,200):
        A = i
        B = j
        Ans = A**5-B**5
        if Ans == X:
            print(A," ",B)
            break
    else:
        continue
    break









Measured memory_bytes: 9152
#include<stdio.h>

int main(void){
    int n;
    scanf("%d",&n);
    int d[n];
    int i, j;
    int ans=0;
    for(i=0;i<n;i++){
        scanf("%d",&d[i]);
    }
    for(i=0;i<n;i++){
        for(j=i+1;j<n;j++){
            ans = ans + d[i]*d[j];
        }
    }
    printf("%d",ans);
    return 0;
    
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define ref(i,x,y)for(int i=x;i<=y;++i)
#define mp make_pair
#define fi first
#define se second
typedef long long LL;
typedef pair<LL,int> PII;
const int N=200010;
const LL inf=1e18;
int n,D,s[N];
struct node{
	int x,y;
	PII p; LL s;
	PII s1[2],s2[2];
}a[N*5];
void pushup(int t){
	int l=t<<1,r=l|1;PII pp;LL ss;
	ref(d,0,1)a[t].s1[d]=min(a[l].s1[d],a[r].s1[d]);
	ref(d,0,1)a[t].s2[d]=min(a[l].s2[d],a[r].s2[d]);
	if(a[l].s<a[r].s) a[t].p=a[l].p,a[t].s=a[l].s;
		else a[t].p=a[r].p,a[t].s=a[r].s;
	pp=mp(a[l].s2[0].se,a[r].s1[1].se);
	ss=a[l].s2[0].fi+a[r].s1[1].fi;
	if(ss<a[t].s)a[t].p=pp,a[t].s=ss;
	pp=mp(a[r].s1[0].se,a[l].s2[1].se);
	ss=a[l].s2[1].fi+a[r].s1[0].fi;
	if(ss<a[t].s)a[t].p=pp,a[t].s=ss;
}
void build(int x,int y,int t){
	a[t].x=x;a[t].y=y;
	if(x==y){
		a[t].p=mp(0,0); a[t].s=inf;
		a[t].s1[0]=mp(s[x]+(LL)D*x,x);a[t].s1[1]=mp(inf,0);
		a[t].s2[0]=mp(s[x]-(LL)D*x,x);a[t].s2[1]=mp(inf,0);
		return;
	}
	int m=(x+y)>>1;
	build(x,m,t<<1);
	build(m+1,y,t<<1|1);
	pushup(t);
}
void update(int x,int y,int t,int p){
	if(x==y){
		swap(a[t].s1[0],a[t].s1[1]);
		swap(a[t].s2[0],a[t].s2[1]);
		return;
	}
	int m=(x+y)>>1;
	if(p<=m)update(x,m,t<<1,p);
	else update(m+1,y,t<<1|1,p);
	pushup(t);
}
int main(){
	cin>>n>>D;
	ref(i,1,n)cin>>s[i];
	build(1,n,1);
	update(1,n,1,1);
	LL ans=0;
	ref(i,1,n-1){
		PII p=a[1].p;LL s=a[1].s;
		update(1,n,1,p.fi);ans+=s;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 94720
#include<stdio.h>
#include<stdlib.h>

int main(){
int n,min,max;
	long sum=0;
int *a;
int i;
	scanf("%d",&n);
	a=malloc(n*sizeof(int));
	for(i=0;i<n;i++){
		scanf(" %d",&a[i]);
	}
	min=a[0];
	max=a[0];
	for(i=0;i<n;i++){
		sum=sum+a[i];
		if(a[i]<min)
		min=a[i];
		if(a[i]>max)
		max=a[i];
	}
	printf("%d %d %ld\n",min,max,sum);
	free(a);
return 0;
}

Measured memory_bytes: 636
s = input()
acgt = 'ACGT'
max_count = 0
i = 0
while i < len(s):
    count = 0
    if s[i] not in acgt:
        i += 1
        continue
    count += 1
    for j in range(i+1, len(s)):
        if s[j] not in acgt:
            break
        count += 1
    if count > max_count:
        max_count = count
    i += count + 1
print(max_count)


Measured memory_bytes: 9120
#pragma GCC optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define d  long double
//#define d long double
#define pii pair<int,int>
#define pb push_back
#define N 200003
#define inf (int)1e18
#define haha ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int mod=1e9+7;
int c[1000001];
 
 
signed main()
{
    haha
    int n;
    cin>>n;
    int a=0;
    int m=1000000;
    for(int i=0;i<n;i++)
    {
        cin>>c[i];
        m=min(m,c[i]);
        if(c[i]<=m)
        a++;
    }
    cout<<a;
   
    
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
using namespace std;
string each_digit(long long num, long long count) {
  long long n = num;
  int p=0;
  string ans = "";
  vector<char> str(count, 'a');
  vector<long long> surp(count);
  while (1) {
    if (!n) break;
    surp[p] = n%26;
    n /= 26;
    p++;
  }
  for (int i=count-1; i>=0; i--) {
    ans += (char)(str[i]+surp[i]);
  }
  
  return ans;
};

int main() {
  long long n;
  long long alp_count = 26, base_count = 1;
  string val;
  cin >> n;
  while (1) {
    if (n>alp_count) {
      n -= alp_count;
      alp_count *= 26;
      base_count++;
    } else {
      // cout << base_count << endl;
      cout << each_digit(n-1, base_count) << endl;
      break;
    }
  }
  // cout << (char)('a'+5) << endl;
}

Measured memory_bytes: 3088
import Control.Applicative
import Control.Monad
import Data.Char

upperCase :: String -> String
upperCase [] = []
upperCase (x:xs)
  | x < 'a' || x > 'z' = x : upperCase xs
  | otherwise          = chr(ord x - ord 'a' + ord 'A') : upperCase xs

main = do
    w <- upperCase <$> getLine
    t <- (map upperCase.words) <$> getContents
    putStrLn $ show(length (filter (==w) t))
    

Measured memory_bytes: 3748
# Author: cr4zjh0bp
# Created: Sun Mar  8 04:59:35 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
nf = lambda: float(ns())
nfn = lambda y: [nf() for _ in range(y)]
nfa = lambda: list(map(float, stdin.readline().split()))
nfan = lambda y: [nfa() for _ in range(y)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [list(ns()) for _ in range(y)]
nas = lambda: stdin.readline().split()

N = ni()
s = ns()

r, b = 0, 0
for i in range(N):
    if s[i] == 'R':
        r += 1
    else:
        b += 1

if r > b:
    print("Yes")
else:
    print("No")

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

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

  bool d[26] = {false};

  for(int i=0; s[i] != '\0'; ++i) {
    d[s[i] - 'a'] = true;
  }
  for(int i=0; i < 26; ++i) {
    if (!d[i]) {
      printf("%c\n", (char)(i + 'a'));
      return 0;
    }
  }

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

Measured memory_bytes: 3792
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef long double D;
typedef complex<D> P;
#define F first
#define S second
const ll MOD=1000000007;
//const ll MOD=998244353;

template<typename T,typename U>istream & operator >> (istream &i,pair<T,U> &A){i>>A.F>>A.S; return i;}
template<typename T>istream & operator >> (istream &i,vector<T> &A){for(auto &I:A){i>>I;} return i;}
template<typename T,typename U>ostream & operator << (ostream &o,const pair<T,U> &A){o<<A.F<<" "<<A.S; return o;}
template<typename T>ostream & operator << (ostream &o,const vector<T> &A){ll i=A.size(); for(auto &I:A){o<<I<<(--i?" ":"");} return o;}


int main(){
  ll N;
  cin>>N;
  cout<<fixed<<setprecision(12)<<((N+1)/2/(D)N)<<endl;

  
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ar array
#define endl '\n'
#define ll long long
#define in insert
#define pb push_back
#define vt vector
#define P_Q(x) priority_queue<x>
#define p_q(x) priority_queue<x, vector<x>, greater<x>>
#define Rep(i,a,b) for(int i=a;i<=b;i++)
#define Rev(i,a,b) for(ll i=a;i>=b;i--)
#define FOR(m) Rep(i,1,m)
#define For(m) Rep(i,0,m-1)
#define Rbl(x,a) for(auto &x : a)
#define FIO ios::sync_with_stdio(0);   cin.tie(0);
#define F first
#define S second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define vpii vector<pii>
#define vpll vector<pll>
#define all(x) (x).begin(),(x).end()
#define sz(x) (int) (x).size()
const ll INF = 0x3f3f3f3f3f3f3f3fll;
#define mod 1000000007
 
const int mxN = 2e5 + 1;
//ll a[mxN];
ll n;
 
 
int main()
{
FIO
 
    cin >> n;
    cout << (1000 - n % 1000) % 1000;
     
    return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long int ll;

ll mod=1e9+7;
ll dp[10100][2][110];

int main(){
	string s; cin >> s;
	int d; cin >> d;
	int n=s.size();
	dp[0][0][0]=1;
	for(int i=0;i<n;i++){
		for(int j=0;j<2;j++){
			for(int k=0;k<d;k++){
				if(dp[i][j][k]==0)continue;
				if(j==1){
					for(int l=0;l<=9;l++){
						(dp[i+1][j][(k+l)%d]+=dp[i][j][k])%=mod;
					}
				}
				else{
					(dp[i+1][0][(k+(s[i]-'0'))%d]+=dp[i][j][k])%=mod;
					for(int l=0;l<(s[i]-'0');l++){
						(dp[i+1][1][(k+l)%d]+=dp[i][j][k])%=mod;
					}
				}
			}
		}
	}
	cout << (dp[n][0][0]+dp[n][1][0]-1+mod)%mod << endl;
	return 0;
}

Measured memory_bytes: 17408
#include <iostream>
#include <algorithm>
#include <functional>
#include <math.h>

using namespace std;

int main(void){
  long long int a, c = 0, i, sum = 0;
  cin >> a;
  while(a != 0){
    c++;
    a = a / 2;
  }
  for(i = 0; i < c; i++){
    sum += pow(2 , i);
  }
  cout << sum << endl;
  return 0;
}

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

int main(){
  for(int i=1; i<10; i++ ){
    for(int j=1; j<10 ; j++){
      cout << i <<"x"<< j<< "="<<i*j <<endl;
    }
  }
return 0;
}



Measured memory_bytes: 3092
N, K = map(int, input().split())
T = [[] for i in range(N)]
MOD = 10 ** 9 + 7
for i in range(N - 1):
    a,  b = map(int, input().split())
    a, b = a - 1, b - 1
    T[a].append(b)
    T[b].append(a)


# 階乗 & 逆元計算
factorial = [1]
inverse = [1]
for i in range(1, K + 2):
    factorial.append(factorial[-1] * i % MOD)
    inverse.append(pow(factorial[-1], MOD - 2, MOD))


# 組み合わせ計算
def nPr(n, r):
    if n < r or r < 0:
        return 0
    elif r == 0:
        return 1
    return factorial[n] * inverse[r] * inverse[n - r] * factorial[r] % MOD


ans = K
stack = [[0, 0]]  # [頂点番号, 深さ]
visited = [False] * N
while stack:
    n, depth = stack.pop()
    visited[n] = True

    child = 0
    for to in T[n]:
        if visited[to]:
            continue

        child += 1
        stack.append([to, depth + 1])

    if depth == 0:
        ans *= nPr(K - 1, child)
    else:
        ans *= nPr(K - 2, child)
    ans %= MOD

print(ans % MOD)


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

int main() {
  string S, T;
  int ans = 0;
  
  cin >> S;
  cin >> T;
  
  for (int i = 0; i < 3; i++) {
    if (S.at(i) == T.at(i)) {
      ans++;
    }
  }
  
  cout << ans << endl;
}
  
  

Measured memory_bytes: 256
/*
	submission # - User: herp_sy
	https://atcoder.jp/contests/
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdbool.h>

#define _CRT_SECURE_NO_WARNINGS
#define TLong long long
#define TBMod 1000000007

int main(int argc, char const *argv[])
{
	int n,d,x;	
	int a[103];
	scanf("%d",&n);
	scanf("%d%d",&d,&x);
	for (int i = 0; i < n; ++i)
	{
	  scanf("%d",&a[i]);
	  if(d % a[i])  x += d / a[i] + 1;
	  else x += d / a[i];
	}
	printf("%d\n", x);
	return 0;
}


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

int main() {
	ll n, k;
	cin >> n >> k;
	if (k == 0) {
		cout << (ll)n*n << endl;
		return 0;
	}
	ll ans = 0;
	for (ll i = 1; i <= n; i++) {
		if (i <= k)continue;
		ll l = (n + 1) / i;
		ll h = (n + 1) % i;
		ans += l * (i - k) + max((ll)0, h - k);
	}
	cout << ans << endl;
}

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

int main() {
  int H, W;
  cin >> H >> W;
  vector<string> s(H);
  for (int i = 0; i < H; i++)
    cin >> s[i];

  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (s[i][j] == '.') continue;

      bool f = false;
      if (i != 0 && s[i - 1][j] == '#') f = true;
      if (i != H - 1 && s[i + 1][j] == '#') f = true;
      if (j != 0 && s[i][j - 1] == '#') f = true;
      if (j != W - 1 && s[i][j + 1] == '#') f = true;

      if (!f) {
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pi pair<int, int>
#define pb push_back
#define int long long

using namespace std;

const int maxn = 1e5 + 1;

int a[maxn], p[maxn];

int len(int x) {
    if (!x) return 1;
    int ans = 0;
    while (x) {++ans; x /= 10;}
    return ans;
}

int solve(int x) {
    int ln = len(x);
    if (ln == 1) return x;
    string s = "";
    for (int y = x; y; y /= 10)
        s = (char)(y % 10 + '0') + s;
    int dp[ln][10], dp1[ln];
    for (int i = 0; i < ln; i++)
        for (int j = 0; j < 10; j++)
            dp[i][j] = 0;
    for (int i = 0; i < ln; i++)
        dp1[i] = 0;
    for (int i = 1; i < 10; i++)
        dp[0][i] = (s[0] - '0' > i);
    dp1[0] = 1;
    for (int i = 1; i < ln; i++) {
        for (int j = 0; j < 10; j++) {
            dp[i][j] += dp[i - 1][j];
            if (j) dp[i][j - 1] += dp[i - 1][j];
            if (j < 9) dp[i][j + 1] += dp[i - 1][j];
        }
        if (!dp1[i - 1]) continue;
        int ld = s[i - 1] - '0', cd = s[i] - '0';
        if (cd < ld - 1) continue;
        if (cd > ld - 1) dp[i][ld - 1]++;
        if (cd > ld) dp[i][ld]++;
        if (cd > ld + 1) dp[i][ld + 1]++;
        if (abs(cd - ld) <= 1) dp1[i] = 1;
    }
    int ans = 0;
    for (int i = 0; i < 10; i++)
        ans += dp[ln - 1][i];
    ans += dp1[ln - 1];
    int nx = 1;
    for (int i = 1; i < ln; i++)
        nx *= 10;
    return ans + solve(nx - 1);
}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int k; cin >> k;
    int l = 0, r = 1e18 + 1;
    while (r - l > 1) {
        int md = (l + r) / 2;
        if (solve(md) < k)
            l = md;
        else
            r = md;
    }
    cout << r;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.util.function.*;

class Main {
    static Scanner scanner = new Scanner();
    static int mod = 1000000007;
    static long inf = 0xfffffffffffffffL;

    void solve() {
        int n = scanner.nextInt();
        int[] a = scanner.nextIntArray(n);
        long ans = 1;
        int[] count = new int[3];
        for (int i = 0; i < n; i++) {
            int mul = 0;
            if (count[0] == a[i]) {
                count[0]++;
                mul++;
            }
            if (count[1] == a[i]) {
                if (mul == 0) {
                    count[1]++;
                }
                mul++;
            }
            if (count[2] == a[i]) {
                if (mul == 0) {
                    count[2]++;
                }
                mul++;
            }
            ans = ans * mul % mod;
        }
        System.out.println(ans);
    }

    public static void main(String[]$) {
        try {
            new Main().solve();
            System.out.flush();
        } catch (Throwable t) {
            System.out.flush();
            t.printStackTrace();
        }
    }
}

class System {
    static PrintWriter out = new PrintWriter(java.lang.System.out);

    static void exit() {
        java.lang.System.exit(0);
    }
}

class Scanner {
    private BufferedReader reader = new BufferedReader(new InputStreamReader(java.lang.System.in), 0x10000);
    private StringTokenizer tokenizer;

    String next() {
        try {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(reader.readLine());
            }
        } catch (IOException ignored) {
        }
        return tokenizer.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    char[][] nextCharArray(int n, int m) {
        char[][] a = new char[n][m];
        for (int i = 0; i < n; i++) {
            a[i] = next().toCharArray();
        }
        return a;
    }

    int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = nextInt();
        }
        return a;
    }

    int[] nextIntArray(int n, IntUnaryOperator op) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = op.applyAsInt(nextInt());
        }
        return a;
    }

    long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = nextLong();
        }
        return a;
    }

    long[] nextLongArray(int n, LongUnaryOperator op) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = op.applyAsLong(nextLong());
        }
        return a;
    }
}


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

using namespace std;

bool f( string s)
{
	int n = s.size();
	for(int i=0;i<n/2;i++)
	{
		if(s[i]!= s[n-i-1])
			return false;
	}
	return true;
}

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

	int flag = 1;
	//cout<<s<<" "<<s.substr(0,(s.size()-1)/2)<<" "<<s.substr((s.size()+2)/2)<<"\n";
	flag &= f(s);
	flag &= f(s.substr(0,(s.size()-1)/2));
	flag &= f(s.substr((s.size()+2)/2));

	if( flag )
		cout<<"Yes";
	else cout<<"No";
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#define _CRT_SECURE_NO_WARNINGS
#define _CRT_DISABLE_PERFCRIT_LOCKS
#define POPCNTI(a) __builtin_popcount(a)
 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <bits/stdc++.h>
 
using namespace std;
using namespace  __gnu_pbds;
 
// #ifndef _LOCAL_DEFINE
// inline int getchar_unlocked(){return _getchar_nolock();}
// inline void putchar_unlocked(char c) {_putchar_nolock(c);}
// #endif
 
typedef long long ll;  
typedef pair<int,int> pr; 
 
const ll MOD = 1e9 + 7,OOl=LLONG_MAX;
const int N = 1e6+1, M = 1e6+1, OO = INT_MAX,OOmem = 0x4f4f4f4f;
 
inline void WRITE_CHAR(char c)  {putchar_unlocked(c);}
 
template<typename T> 
inline bool READn (T &result) {
  int minus = 1;
  char ch;
  result=0;
  ch = (char) getchar_unlocked();
  if(ch!='-') while (!isdigit(ch) && ch!=EOF) ch= (char) getchar_unlocked(), minus = (ch == '-'? -1 : minus);
 
  if(ch==EOF) return false;
  while (isdigit(ch))  result = result*10 + (int) (ch - '0'),ch = (char) getchar_unlocked();
  
  result *= minus;
  return ch != '\n';
}
template<typename T>
inline void WRITEn(T x) {
  if (x < 0) {putchar_unlocked('-'); x = -x; }
  char writeBuffer[20], *writePtr = writeBuffer;
  do {
    *writePtr++ = (char)('0' + x % 10);
    x /= 10;
  }
  while (x);
  do  { putchar_unlocked(*--writePtr); }
  while (writePtr > writeBuffer);
}
inline bool Read_CHAR(char &c)
{
  char READ_CHARACTER = (char)getchar_unlocked();
  while ((READ_CHARACTER == '\n' || READ_CHARACTER == '\t' || READ_CHARACTER == ' ')) READ_CHARACTER = (char)getchar_unlocked();
  if(READ_CHARACTER == EOF) return false;
  c = READ_CHARACTER;
  return true;
} 
inline bool READ_CHAR_ARRAY(char (&x)[N]) {
  char READ_CHARACTER = (char)getchar_unlocked();
  while ((READ_CHARACTER == '\n' || READ_CHARACTER == '\t' || READ_CHARACTER == ' ')) READ_CHARACTER = (char)getchar_unlocked();
  if(READ_CHARACTER == EOF) return false;
  char *ptr = &x[0];
  while ((READ_CHARACTER != '\n' && READ_CHARACTER != '\t' && READ_CHARACTER != ' ' && READ_CHARACTER != EOF)) *ptr++ = READ_CHARACTER, READ_CHARACTER = (char)getchar_unlocked();
  *ptr = '\0';
  return true;
}
inline void WRITE_CHAR_ARRAY(const char *x) {
  while(*x != '\0')
    putchar_unlocked(*x++);
}
ll dp[2][N];
int w[101],cst[101];
int main()
{
  int n,W;
  READn(n),READn(W);
  for(int i=0;i<n;++i) READn(w[i]),READn(cst[i]);
 
  dp[0][0]=0;
  for(int i=1;i<=n;++i)
  {
    int k = i&1;
    for(int sum = 1 ; sum<=W ; ++sum)
    {
      dp[k][sum] = dp[!k][sum];
      if(sum>=w[i-1]) dp[i&1][sum] = max(dp[!k][sum],dp[!k][sum-w[i-1]]+cst[i-1]);
    }
  }
  WRITEn(dp[n&1][W]);
  return 0;
}

Measured memory_bytes: 5120
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define INF 100000000
#define MOD 1000000007
#define EPS 1e-10
#define MAX_N 100000
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;

int n;
vector<ll> a;
string ans[2] = {"First", "Second"};

ll gcd(ll x, ll y){
    while(y){
        x %= y;
        swap(x,y);
    }
    return x;
}

void solve(vector<ll> b, int now){
    ll g = 0;
    rep(i,b.size()) if(b[i]%2==0) g++;
    if(g&1){
        cout << ans[now] << endl;
        return;
    }
    if(b.size()-g != 1){
        cout << ans[now^1] << endl;
        return;
    }
    rep(i,b.size()){
        if(b[i]&1){
            if(b[i] == 1){
                cout << ans[now^1] << endl;
                return;
            }
            b[i]--;
            break;
        }
    }
    ll d = b[0];
    for(int i = 1; i < b.size(); i++){
        d = gcd(d,b[i]);
    }
    rep(i,b.size()) b[i] /= d;
    solve(b, now^1);
}

int main(){
    cin >> n;
    rep(i,n){
        ll tmp; cin >> tmp;
        a.push_back(tmp);
    }
    if(n == 1){
        puts("Second");
        return 0;
    }
    solve(a,0);
}


Measured memory_bytes: 19956
#include<iostream>
using namespace std;
int main(){
int n;
  cin>>n;
  int arr[n];
  for(int i=0; i<n; i++){
  cin>>arr[i];
      
  }
  int res=0;
  for(int i=0; i<n; i++){
      if(arr[i]%2==0){
          if(arr[i]%3==0 || arr[i]%5==0){
              
          }
          else{
              res++;
          }
      }
  }
  if(res!=0){
      cout<<"DENIED";
  }
  else{
      cout<<"APPROVED";
  }
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string debug_string(const string& s) {
	return '"' + s + '"';
}
string debug_string(bool b) {
	return (b ? "true" : "false");
}
string debug_string(const char* s) {
	return debug_string((string)s);
}
template<class T, class U>
string debug_string(const pair<T, U>& p);
template<class U>
struct can_be_string {
	template<typename...>
	static int f(...) {
		return 0;
	}
	template<typename T>
	static char f(decltype(to_string(T()), char())) { 
		return 'a';
	}
	static const bool value = sizeof(f<U>(char())) == sizeof(char);
};
template<class T> 
typename enable_if<can_be_string<T>::value, string>::type debug_string(const T& a) {
	string s = to_string(a);
	return s;
}
template<class T>
typename enable_if<!can_be_string<T>::value, string>::type debug_string(const T& a) {
	bool first = true;
	string s = "{";
	for (const auto& x : a) {
		if(!first){
			s += ", ";
		}
		first = false;
		s += debug_string(x);
	}
	s += "}";
	return s;
}
template<class T, class U>
string debug_string(const pair<T, U>& p) {
	string s = "(";
	s += debug_string(p.first);
	s += ", ";
	s += debug_string(p.second);
	s += ")";
	return s;
}
void debug_out() {cerr << '\n';}
template<class Head, class... Tail>
void debug_out(Head head, Tail... tail) {
	cerr << ' ' << debug_string(head);
	debug_out(tail...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "] = ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif
using ll = long long;
using ld = long double;
const int mod = 1e9 + 7;
const int mod2 = 1e9 + 9;
const int inf = 1e9 + 100;
const ll inf64 = 1e18l + 100;
void max_self(int& a, int b) {
	a = max(a, b);
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(20);
	int n;
	cin >> n;
	string s;
	cin >> s;
	vector<vector<pair<ll, ll>>> hash(n, vector<pair<ll, ll>>(n));
	int b1 = 1e9 + rand() % 15000;
	int b2 = 1e8 + rand() % 15000;
	for (int i = 0;i < n;++i) {
		ll h1 = 0, h2 = 0;
		for (int j = i;j < n;++j) {
			h1 = (h1 * b1 + (s[j] - '0')) % mod;
			h2 = (h2 * b2 + (s[j] - '0')) % mod2;
			hash[i][j].first = h1;
			hash[i][j].second = h2;
		}
	}
	int answer = 0;
	for (int i = 0;i < n;++i) {
		for (int j = i + 1;j < n;++j) {
			int size = min(n - j, j - i);
			int l = 1, r = size;
			while (l <= r) {
				int mid = l + (r - l) / 2;
				bool ok = hash[i][mid + i - 1].first == hash[j][mid + j - 1].first;
				ok &= hash[i][mid + i - 1].second == hash[j][mid + j - 1].second;
				if (ok) {
					max_self(answer, mid);
					l = mid + 1;
				}
				else {
					r = mid - 1;
				}
			}
		}
	}
	cout << answer << '\n';
	return 0;
}


Measured memory_bytes: 391168
#include<stdio.h>
 
int main(void){
 
    double W,H,x,y,S;
 
    scanf("%lf %lf %lf %lf",&W,&H,&x,&y);
 
    S = (W * H) / 2;
 
    printf("%f ",S);
 
    if(x * 2 == W && y * 2 == H){
        printf("1");
    }else{
        printf("0");
    }
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	double s=0.0;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++) { cin>>a[i]; s+=a[i]; }
	int m=(int)(round(s/n));
	int f=0;
	for(int i=0;i<n;i++) f+=(a[i]-m)*(a[i]-m);
	cout<<f;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
    using namespace std;
    #define lli long long int
    
    
int main()
{
	std::ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int n;
	cin>>n;
	if(n<1200)
	    cout<<"ABC";
	else if(n<2800 && n>=1200)
	    cout<<"ARC";
	 else
	    cout<<"AGC";
	    
	   return 0;
}

Measured memory_bytes: 256