akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#define FI first.first
#define SE first.second
#define TH second
#define fi first
#define se second
#define th second

using namespace std;

template<typename T>
string to_string(const vector<T>& vc, int w) {
	if(vc.empty()) return "";
	if(w + 1 == vc.size()) return to_string(vc[w]);
	return to_string(vc[w]) + "," + to_string(vc, w + 1);
}

template<typename T>
string to_string(const vector<T>& vc) {
	return "{" + to_string(vc, 0) + "}";
}

void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
 
#ifdef DEBUG
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

class DebugStream {}LOG;
template <typename T>DebugStream &operator<<(DebugStream &s, const T&) { return s; }
#ifdef DEBUG
#define LOG clog
#endif

typedef long long ll;
typedef pair<ll, ll> ii;
typedef long double ld;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

const int maxN = 1e5 + 9, maxV = 1e6 + 9, MOD = 1e9 + 7, SQ = 335, lg = 20, bs = 29;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	#ifdef DEBUG
	freopen("input.txt", "r", stdin);
	#endif

	int x, y;
	cin >> x >> y;
	if(y % 2 == 0 && x * 2 <= y && y <= x * 4) cout << "Yes\n";
	else cout << "No\n";
}



Measured memory_bytes: 3644
#include <algorithm>
#include <iostream>
#include <stdio.h>

#define MAX_N 200'000

typedef long long ll;

using namespace std;

double E[MAX_N];

int main() {
  int N, K;
  cin >> N >> K;
  for (int i = 0; i < N; ++i) {
    int p;
    cin >> p;
    E[i] = (double)(p + 1) / 2;
  }
  double res = 0;
  for (int i = 0; i < K; ++i) {
    res += E[i];
  }
  double t = res;
  for (int i = K; i < N; ++i) {
    t += -E[i - K] + E[i];
    res = max(res, t);
  }
  printf("%f\n", res);
}

Measured memory_bytes: 4700
import java.util.Scanner;

public class Main {
	
	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int n = sc.nextInt();
		int k = sc.nextInt();
		
		if(n % k == 0) {
			System.out.println(0);
		} else {
			System.out.println(1);
		}
		
	}
}

Measured memory_bytes: 21844
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <functional>
#include <iomanip>

using namespace std;

#ifdef LOCAL
    #define debug(v) cerr<<v<<"\n"
#else
    #define debug(...) 42
#endif
#define out(v) cout<<v<<"\n"
#define _overload3(_1,_2,_3,name,...) name
#define _all1(a) (a).begin(),(a).end()
#define _all2(a,n) (a),(a)+n
#define all(...) _overload3(__VA_ARGS__,42,_all2,_all1,)(__VA_ARGS__)
#define _rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _fromto2(i,n) for(int i=0;i<=(n);++i)
#define _fromto3(i,a,b) for(int i=(a);i<=(b);++i)
#define fromto(...) _overload3(__VA_ARGS__,_fromto3,_fromto2,)(__VA_ARGS__)

#define rrep(i,n) for(int i=(n);i>=0;--i)
#define iter(it,v) for(auto it=v.begin();it!=v.end();++it)
const int MOD = 1e9+7;
const int INF = 1e9;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T>ostream& operator<<(ostream& os, vector<T>& vec){os<<"{";for(int i=0;i<vec.size();++i)os<<(i?", ":"")<<vec[i];os<<"}";return os;}
template<class T1,class T2>ostream& operator<<(ostream& out,const pair<T1,T2>& rhs){out<<"("<<rhs.first<<", "<<rhs.second<<")";return out;}
#include<type_traits>
template<typename T,size_t SIZE,enable_if_t<!is_same<remove_cv_t<T>,char>::value,nullptr_t> = nullptr>ostream& operator<<(ostream& os,T(&arr)[SIZE]){os<<"{";for(size_t i=0;i<SIZE;++i)os<<(i?", ":"")<<arr[i];os<<"}";return os;}

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  int N; cin >> N;
  string S, T; cin >> S >> T;

  rep(i, N) {
    cout << S[i] << T[i];
  }
  cout << "\n";

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    string s;cin>>s;
    if (s[2]==s[3] && s[4]==s[5]){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <deque>
#include <tuple>
#include <map>
#include <sstream>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define chmax(a, b) a = (((a)<(b))?(b):(a))

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}


signed main(){
  int r,c; cin>>r>>c;
  int sy,sx,gy,gx;
  // cin>>sy>>sx>>gy>>gx;
  // sy--; sx--; gy--; gx--;
  string C[r];
  rep(i,r) cin>>C[i];
  int dx[4]={1,0,-1,0}, dy[4]={0,1,0,-1};
  int visited[r][c];
  // Fill(visited, false):

  // rep(i,r) rep(j,c) visited[i][j]=INF;
  int ans = 0;
  rep(i,r){
    rep(j,c){
      // rep(k,r){
      //   rep(l,c){
          // if(C[i][j]=='#'||C[k][l]=='#') continue;
          if(C[i][j]=='#') continue;
          memset(visited, INF, sizeof(visited));
          sy = i; sx = j;
          // gy = k; gx = l;
          queue<VI> q;
          VI s; s.PB(sy); s.PB(sx); s.PB(0);
          q.push(s);
          visited[sy][sx]=0;

          while(!q.empty()){
            VI p = q.front();
            int y=p[0], x=p[1], cnt=p[2];
            // cerr << y SP x SP cnt << endl;
            q.pop();
            cnt++;
            rep(m,4){
              int ny=y+dy[m], nx=x+dx[m];
              if(nx<0||nx>=c||ny<0||ny>=r) continue;
              if(visited[ny][nx]<=cnt) continue;
              if(C[ny][nx]=='.'){
                VI ad; ad.PB(ny); ad.PB(nx); ad.PB(cnt); q.push(ad);
                visited[ny][nx]=cnt;
                chmax(ans,visited[ny][nx]);
              }
              // if(nx==gx&&ny==gy){
              //   chmax(ans,cnt); break;
              // }
            }
          }
      //   }
      // }
    }
  }
  cout << ans << endl;


  return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
long long n,a[100000],b[100000],cnt;
main(){
    cin>>n;
    for(int i=0;i<n;i++)cin>>a[i]>>b[i];
    for(int i=n-1;i>=0;i--){
        a[i]+=cnt;
        if(a[i]%b[i])cnt+=b[i]-a[i]%b[i];
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 2300
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
using ll = long long;
int main(void){
   int A,B;
   cin>>A>>B;
   
   
   if(A<9&&B<9){
       cout<<"Yay!"<<endl;
   }
   else{
       cout<<":("<<endl;
   }
   
   
    
}

Measured memory_bytes: 3596
#include<stdio.h>
int main (void){
int a,i;
i=1;
while(i<=10000){
  scanf("%d",&a);
  if( a==0 ){
    printf("Case %d: %d\n",i,a);
  i=10001;
}
  else{
    printf("Case %d: %d\n",i,a);
  i=i+1;
}
}
return 0;



}



Measured memory_bytes: 2040
#include<stdio.h>

int main()
{
    int n,i,j,k=0,l=0,count1=0,count2=0;

    scanf("%d",&n);
    int ar[n+1];
    for(i=1;i<=n;i++)
    {
        scanf("%d",&ar[i]);
    }
    for(i=1;i<=n;i++)
    {
            if(ar[i]!=i)
            {
                count1++;
            }
            if(count1>2) break;
    }
    if(count1==0 || count1 ==2)
    {
           printf("YES\n");
    }
    else
    {
        printf("NO\n");
    }

    return 0;
}


Measured memory_bytes: 128
use std::io::Read;
use std::cmp::min;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let h: usize = iterator.next().unwrap().parse().unwrap();
    let w: usize = iterator.next().unwrap().parse().unwrap();
    let mut map: Vec<Vec<char>> = Vec::new();
    for _ in 0..h {
        let line: Vec<char> = iterator.next().unwrap().chars().collect();
        map.push(line);
    }

    let mut dp: Vec<Vec<usize>> = vec![vec![0; w]; h];
    if map[0][0] == '#' {
        dp[0][0] = 1;
    }
    const INF: usize = 100_001;
    for i in 0..h {
        for j in 0..w {
            if i == 0 && j == 0 {
                continue;
            }
            let mut d = INF;
            if i > 0 {
                let mut c = dp[i - 1][j];
                if map[i - 1][j] == '.' && map[i][j] == '#' {
                    c += 1;
                }
                d = min(d, c);
            }
            if j > 0 {
                let mut c = dp[i][j - 1];
                if map[i][j - 1] == '.' && map[i][j] == '#' {
                    c += 1;
                }
                d = min(d, c);
            }
            dp[i][j] = d;
        }
    }
    return dp[h - 1][w - 1].to_string();
}


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

const int MOD = 1000000007;
const int N = 100005;
void pp(int &x, int y) {
	x += y;
	if (x >= MOD) x -= MOD;
}

int n, a, b, c;
int pow_mod(int x, int k) {
	int ans = 1;
	while (k) {
		if (k&1) ans = 1LL * ans * x % MOD;
		x = 1LL * x * x % MOD;
		k >>= 1;
	}
	return ans;
}

int f[N], rf[N];

int C(int n, int m) {
	if (n < 0 || m < 0 || n < m) return 0;
	return 1LL * f[n] * rf[m] % MOD * rf[n - m] % MOD;
}

int cal(int x, int y) {
	if (b % 2) return 0;
	int yu = n - 2 * x - 3 * y - (a - x);
	if (c - x - 3 * y != yu - b) return 0;
	int tot = a + y + b / 2;
	int tr = c - x - 3 * y;
	if (tr == 0) return 1LL * C(tot, x) % MOD * C(tot - x, y) % MOD * C(tot - x - y, a - x) % MOD;
	return 1LL * C(tr + b / 2 - 1, b / 2 - 1) * C(tot, x) % MOD * C(tot - x, y) % MOD * C(tot - x - y, a - x) % MOD;
}

int main() {
	f[0] = 1;
	for (int i = 1; i < N; i++) f[i] = 1LL * f[i - 1] * i % MOD;
	for (int i = 0; i < N; i++) rf[i] = pow_mod(f[i], MOD - 2);
	scanf("%d%d%d%d", &n, &a, &b, &c);
	int ans = 0;
	for (int i = 0; i <= a && i <= c; i++)
		for (int j = 0; j * 3 + i <= c; j++)
			pp(ans, cal(i, j));
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 1152
H,W=map(int, input().split())
S = []
for i in range(H):
  S.append(input())

tate_value = [[0]*W for i in range(H)]
yoko_value = [[0]*W for i in range(H)]

for i in range(H):
  for j in range(W):
    if S[i][j] == '#':
      yoko_value[i][j] = 0
    else:
      if j==0:
        left = 0
        right = W-1
        for k in range(0,W):
          if S[i][k] == '#':
            right = k-1
            break
        yoko_value[i][j] = right+1
      else:
        if S[i][j-1] == '.':
          yoko_value[i][j] = yoko_value[i][j-1]
        else:
          right = W-1
          for k in range(j,W):
            if S[i][k] == '#':
              right = k-1
              break
          yoko_value[i][j] = right-j+1

for j in range(W):
  for i in range(H):
    if S[i][j] == '#':
      tate_value[i][j] = 0
    else:
      if i==0:
        up = 0
        down = H-1
        for k in range(0,H):
          if S[k][j] == '#':
            down = k-1
            break
        tate_value[i][j] = down+1
      else:
        if S[i-1][j] == '.':
          tate_value[i][j] = tate_value[i-1][j]
        else:
          down = H-1
          for k in range(i,H):
            if S[k][j] == '#':
              down = k-1
              break
          tate_value[i][j] = down-i+1
          
max = 0
for i in range(H):
  for j in range(W):
    temp = yoko_value[i][j] + tate_value[i][j]-1
    if temp>max:
      max = temp
      
print(max)

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

using namespace std;

typedef unsigned long long ll;

int main(){
  ll n;
  cin>>n;
  ll t,a;
  ll tv,av;
  cin>>tv>>av;
  
  for(int i=1;i<n;i++){
    cin>>t>>a;
       
   	ll aa=(tv+t-1)/t;
    ll bb=(av+a-1)/a;
    ll mx=bb;
    if(aa>bb){
      mx=aa;
    }
    //cout<<i<<" hey "<<tv<<" "<<av<<" "<<aa<<" "<<bb<<endl;

    tv=mx*t;
    av=mx*a;
    
    /*for(ll j=max(aa,bb);!found;j++){
      if(tt*j>=tv&&ta*j>=av){
        found=true;
        tv=tt*j;
        av=ta*j;
      }
    }*/
  }
  
  cout<<(tv+av)<<endl;
  return 0;
}

Measured memory_bytes: 3628
//Code by Mukul Totla
#include<bits/stdc++.h>
using namespace std;
#define ll long long
void sublime(){ 
	  #ifndef ONLINE_JUDGE 
    freopen ("input.txt", "r", stdin);
    freopen ("output.txt", "w", stdout);
    #endif
      }
	
int main()
{   
  // sublime();
   ios_base::sync_with_stdio(false);
	cin.tie(NULL);
   
	  ll n,i;
	   cin>>n;
	   ll arr[n];
	   for(i=0; i<n; i++)
	   cin>>arr[i];
	   if(n<3)
	   {
	   	cout<<0;
	   	return 0;
	   } 
	   ll ans=0;
	   for(i=0; i<n; i++)
	   {
	   	for(ll j=i+1; j<n; j++)
	   	{
          for(ll k=j+1; k<n; k++)
          {
            if(arr[i]!=arr[j] && arr[i]!=arr[k] && arr[j]!=arr[k])
            {
            	if(arr[i]+arr[j]>arr[k] && arr[j]+arr[k]>arr[i]
            		&& arr[i]+arr[k]>arr[j])
            		ans++;
            }
          }
	   	}
	   }
	   cout<<ans;
	
	return 0;
}

Measured memory_bytes: 3648
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
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;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
//-std=gnu++17
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    ll sum=0;
    for(ll i=1;i<=n;i++){
        ll j=1;
        while(i*j<=n){
            sum+=i*j;
            j++;
        }
    }
    cout<<sum<<"\n";
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
#define REP(i,n) for(int i = 0;i < (n);i++)
#define P pair<int,int>
#define pb push_back
#define mk make_pair
using namespace std;
const int INF = 1 << 20;

typedef long long ll;




int main(){
  string s;
  cin >> s;
  int n = 0;
  REP(i,3){
    if(s[i] == 'o')
      n++;
  }
  cout << 700+100*n << endl;
  return 0;
}


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

vector<int> G[MAX_V];
int V;
int color[MAX_V];

// 頂点を1と-1で塗っていく
bool dfs(int v, int c) {
    color[v] = c;
    for (int i = 0; i < G[v].size(); i++) {
        // 隣接している頂点が同じ色ならfalse
        if (color[G[v][i]] == c) return false;
        // 隣接している頂点がまだ塗られていないなら-cで塗る
        if (color[G[v][i]] == 0 && !dfs(G[v][i], -c)) return false;
    }

    // すべての頂点を塗れたらtrue
    return true;

}
typedef pair<int, int> P;
int d[210];
void dijkstra(int s) {
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d, d + V + 1, INF);
    d[s] = 0;
    que.push(P(0, s));

    while (!que.empty()) {
        P p = que.top(); que.pop();
        int v = p.second;
        if (d[v] < p.first) continue;
        for (int i = 0; i < G[v].size(); i++){
            int to = G[v][i];
            if (d[to] > d[v] + 1) {
                d[to] = d[v] + 1;
                que.push(P(d[to], to));
            }
        }
    }
}
string S[210];
int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> V;
    rep(i, V) cin >> S[i];
    rep(i, V) {
        rep(j, V) {
            if(S[i][j] == '1') {
                G[i].push_back(j);
            }
        }
    }
    if(!dfs(0, 1)) {
        cout << -1 << endl;
        return 0;
    }
    int ans = 0;
    rep(i, V) {
        dijkstra(i);
        rep(j, V) ans = max(ans, d[j]);
    }
    cout << ans + 1 << endl;


    return 0;
}


Measured memory_bytes: 3772
w, h, n = map(int, input().split(" "))
x_y_a = [tuple(map(int, input().split(" "))) for i in range(n)]

min_x, max_x, min_y, max_y = 0, w, 0, h
for x_y_a_i in x_y_a:
    x, y, a = x_y_a_i
    if a == 1:
        min_x = max(min_x, x)
    elif a == 2:
        max_x = min(max_x, x)
    elif a == 3:
        min_y = max(min_y, y)
    elif a == 4:
        max_y = min(max_y, y)

print(0 if min_x > max_x or min_y > max_y else (max_x-min_x) * (max_y-min_y))

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <numeric>
#include <unordered_map>
using namespace std;
using var = long long;
#define rep(i,n) for(var i=0, i##_len=(n); i<i##_len; ++i)
#define repin(a,n) vector<var> a(n);rep(i,n){cin>>a[i];}
#define in(a) var a;cin>>a;
#define out(a) cout<<a;

int main()
{
	in(n);
	unordered_map<string, var> s(n);
	rep(i, n) {
		string a;
		cin >> a;
		sort(a.begin(), a.end());
		s[a] += 1;
	}

	var c = 0;
	for (auto a : s) {
		c += a.second * (a.second-1) / 2;
	}

	out(c);
}


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

int n, a[105], b[105];
int main() {
	int i, j;
	cin >> n;
	for(i=1; i<=n; i++) cin >> a[i];
	for(i=1; i<=n; i++) {
		for(j=n; a[j]!=j; j--);
		if(j==0) return puts("-1"), 0;
		b[i] = j;
		for(; j<=n-i; j++) a[j] = a[j+1];
		a[j] = -1;
	}
	for(i=n; i; i--) cout << b[i] << endl;
	return 0;
}

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

int find(int h[],int n)
{
	if(n==1)
		return 0;
	int dp[n];
	dp[0]=0;
	dp[1]=abs(h[1]-h[0]);

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

	return dp[n-1];
}

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

    int n;
    cin>>n;
     int h[n];
     for(int i=0;i<n;i++)
     	cin>>h[i];

     int ans=find(h,n);
     cout<<ans;
    
	return 0;
}

Measured memory_bytes: 1024
import sys

#2以上の整数nに対して素因数分解
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr

def count(n):
    ret = 0
    for i in range(1,10):
        n -= i
        if n < 0:
            break
        else:
            ret += 1
    return ret

N = int(input())
if N == 1:
    print(0)
    sys.exit()
bunkai = factorization(N)
ans = 0
for i in bunkai:
    ans += count(i[1])
print(ans)


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

int main()
{
    int c, a, b, p;
    cin >> c >> a >> b;
    if (a > b && a > c) p = b * c;
    else if (b > c) p = c * a;
    else p = a * b;
    cout << p / 2 << '\n';
    return(0);
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String t = sc.nextLine();
		StringBuffer sb = new StringBuffer(t);
		t = sb.reverse().toString();
		if(s.equals(t)) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
}

Measured memory_bytes: 21844
N, M = map(int, input().split())
P_Y = []
for i in range(M):
   p,y = map(int,input().split())
   P_Y.append([p-1,y,i])
#n次元リストのソート
#普通にsort()をつけると1番目の要素でソート
#1番目の要素が同じ場合は2番目の要素の大小によってソートされる
P_Y.sort() 

ans_P_Y = [] 
count = 1
for i in range(M):
  if(i != 0):
    if(P_Y[i-1][0] == P_Y[i][0]): count += 1
    else: count = 1
  ans_P_Y.append([P_Y[i][2],P_Y[i][0]+1,count])
ans_P_Y.sort()

for i in range(M):
  ans = str(ans_P_Y[i][1]).zfill(6) + str(ans_P_Y[i][2]).zfill(6)
  print(ans)

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

int main(){
  int n; cin >> n;
  int cnt = 0;
  for(int i = 0; i < n; i++){
    int a; cin >> a;
    if(i % 2 == 1) continue;
    if(a % 2 == 1) cnt++;
  }
  cout << cnt;
    
}
  
      

Measured memory_bytes: 3592
n = int(input())
num_seq = list(map(int,input().split()))
count = 0
for i in range(n-2):
    if num_seq[i+1] < max(num_seq[i],num_seq[i+2]) and num_seq[i+1] > min(num_seq[i],num_seq[i+2]):
        count += 1
print(count)

Measured memory_bytes: 3060
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<vector>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
#define ll long long
#define pll pair<ll,ll>
#define fi first
#define se second
#define mp(a,b) make_pair(a,b)
#define maxn 140005
#define pb(x) push_back(x)
using namespace std;

vector<pll > v[maxn];

pll nx[maxn],ny[maxn];

int n;

struct note{
	int lson,rson,lv,rv;
}a[maxn];

ll ans,chk;

int sx,sy;

void ins(int x,pll y){
	if (v[x].size()==0) {
		v[x].pb(y);
		return;
	}
	int siz=v[x].size();
	if (v[x][siz-1].se<=y.se) return;
	v[x].pb(y);
}

bool dfs(int x){
	if (a[x].lson==0) {
		v[x].pb(mp(0,0));
		return 1;
	}
	if (!dfs(a[x].lson)) return 0;
	if (!dfs(a[x].rson)) return 0;
	sx=sy=0;
	int lson=a[x].lson,rson=a[x].rson,add=a[x].lv+a[x].rv;
	//
	int wz=v[rson].size()-1;
	fd(i,v[lson].size()-1,0) {
		while (wz>=0 && v[lson][i].se+v[rson][wz].fi+add>chk) wz--;
		if (wz<0) break;
		sx++;
		nx[sx]=mp(v[lson][i].fi+a[x].lv,v[rson][wz].se+a[x].rv);
	}
	//
	wz=v[lson].size()-1;
	fd(i,v[rson].size()-1,0) {
		while (wz>=0 && v[rson][i].se+v[lson][wz].fi+add>chk) wz--;
		if (wz<0) break;
		sy++;
		ny[sy]=mp(v[rson][i].fi+a[x].rv,v[lson][wz].se+a[x].lv);
	}
	//
	int wz1=sx,wz2=sy;
	while (wz1 && wz2) {
		if (nx[wz1].fi<ny[wz2].fi) ins(x,nx[wz1]),wz1--;
		else ins(x,ny[wz2]),wz2--;
	}
	while (wz1) ins(x,nx[wz1]),wz1--;
	while (wz2) ins(x,ny[wz2]),wz2--;
	return v[x].size();
}

int main(){
	scanf("%d",&n);
	fo(i,2,n) {
		int father,len;
		scanf("%d%d",&father,&len);
		if (a[father].lson==0) {
			a[father].lson=i;
			a[father].lv=len;
		}
		else {
			a[father].rson=i;
			a[father].rv=len;
		}
	}
	ll l=0,r=1e10;
	while (l<=r) {
		ll mid=(l+r) >> 1;
		chk=mid;
		fo(i,1,n) v[i].clear();
		if (dfs(1)) {
			ans=mid;
			r=mid-1;
		}
		else l=mid+1;
	}
	cout<<ans;
	return 0;
}

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

int main() {
  int N; cin >> N;
  vector<int> W(N);
  for (int i = 0; i < N; i++) cin >> W[i];
  
  int min_abs = 100000;
  int first = 0;
  int second;
  int sum_W = accumulate(W.begin(), W.end(), 0);
  for (int i = 0; i < N; i++) {
    first += W[i];
    second = sum_W - first;
    min_abs = min(min_abs, abs(first-second));
  }
  cout << min_abs << endl;
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <map>
#include <set>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;

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

Measured memory_bytes: 256
'''
Problem Link - https://atcoder.jp/contests/abc178/tasks/abc178_b
'''
from sys import stdin,stdout
from math import *
from collections import *

mod = 1000000007

def gcd(a,b):
	while b:
		a,b = b,a%b
	return a

def lcm(a,b): return (a*b) // gcd(a,b)

def set_bits(X):
	c = 0
	while X:
		X &= (X-1);c += 1
	return c

def compute_MOD(N,M): return (N%M + M) % M

def get_array(): return list(map(int, stdin.readline().split()))
 
def get_ints(): return map(int, stdin.readline().split())

def get_int(): return int(stdin.readline())

def get_input(): return stdin.readline().strip()

def main():
	a,b,c,d = get_ints()
	stdout.write(str(max(a*c,a*d,b*c,b*d))+'\n')

if __name__ == "__main__":
    main()

Measured memory_bytes: 9416
import math
from math import gcd,pi,sqrt
INF = float("inf")
MOD = 10**9 + 7

import sys
sys.setrecursionlimit(10**6)
import itertools
import bisect
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]


def main():
    n = i_input()
    l = i_list()
    l.sort()

    if n == 1:
        if 0 in l:
            print(1)
            exit()
        else:
            print(0)
            exit()


    L = {}
    for i,k in itertools.groupby(l):
        L[i] = len(list(k))

    cnt = 0

    for i, k in L.items():
        if i == 0:
            if k > 1:
                print(0)
                exit()
        else:
            if k != 2:
                print(0)
                exit()
            else:
                cnt += 1
    print(2**cnt % MOD)









if __name__=="__main__":
    main()


Measured memory_bytes: 83060
using namespace std;

#include <stdio.h>
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <algorithm>

typedef pair<int, int> ii;
typedef vector<int> vi;

int n;

signed main() {
  scanf("%d", &n);
  if (n == 1) {
    printf("Hello World\n");
  } else {
    int a, b;
    scanf("%d%d", &a, &b);
    printf("%d\n", a + b);
  }
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LL long long
#define MOD 1000000007
#define fastio ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0)
using namespace std;

int main()
{
    fastio;
  	char a;
  	cin>>a;
  	if(isupper(a))
      cout<<'A';
  	else
      cout<<'a';
}

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

#define ed cout << "\n";
#define speed                         \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define ll long long
#define ffor(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(i, n) ffor(i, 0, n)
#define All(obj) (obj).begin(), (obj).end()
#define INF ((ll)1e9 + 7)
#define c(a) cout << a << "\n";
using namespace std;
const int N = 100005;

int main()
{
    speed;
    cout << fixed << setprecision(6);
    /*start*/
    int a, b;
    string s;
    cin >> a >> b >> s;
    bool ans = true;
    rep(i, s.size())
    {
        if (i == a)
        {
            if (s[i] != '-')
            {
                ans = false;
            }
        }
        else
        {
            if (s[i] == '-')
            {
                ans = false;
            }
        }
    }
    if (ans)
    {
        c("Yes");
    }
    else
    {
        c("No");
    }
    return 0;
}

Measured memory_bytes: 256
program main
  implicit none

  integer :: n, a(20), i, c = 0

  read(*,*)n
  read(*,*)(a(i), i = 1, n)
  
  do i = 2, n-1
    if ((a(i-1) > a(i)) .and. (a(i) > a(i+1))) then
      c = c + 1
    else if ((a(i+1) > a(i)) .and. (a(i) > a(i-1))) then
      c = c + 1
    end if
  end do
  write(*,*)c

end program main

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>

#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define M 1046524  // 生成できないhash値が出ないようにするためにハッシュテーブルの要素数は大きい素数
#define L 14  // 入力される値の最大サイズ
#define NIL (-1)
#define ll long long

char H[M][L];

// 文字から数値に変換
int getChar(char ch){
  if (ch=='A') return 1;
  else if (ch == 'C') return 2;
  else if (ch == 'G') return 3;
  else if (ch == 'T') return 4;
  else return 0;
}

// 文字列から数値へ変換してkeyを生成する
ll getKey(char str[]){
  ll sum = 0, p=1, i;
  for (i=0; i<strlen(str); i++){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}

// hash値を生成する関数
int h1(int key){
  return key % M;
}
int h2(int key){
  return 1 + (key % (M-1));
}
int h0(int key, int i){
  return (h1(key) + i*h2(key)) % M;
}

int find(char str[]){
  ll key, i, h;
  key = getKey(str);  // 文字列を数値に変換
  for (i=0; ; i++){
    h = h0(key, i);
    if (strcmp(H[h], str)==0) return 1;
    else if(strlen(H[h]) == 0) return 0;
  }
  return 0;
}

int insert(char str[]){
  ll key, i, h;
  key = getKey(str); // 文字列を数値に変換
  for (i=0; ; i++){
    h = h0(key, i);
    if (strcmp(H[h], str)==0) return 1;
    else if (strlen(H[h]) == 0){
      strcpy(H[h], str);
      return 0;
    }
  }
  return 0;
}


int main(int argc, char const *argv[]){
  int i, n, h;
  char str[L], com[9];
  rep (i, M) H[i][0] = '\0';
  scanf("%d", &n);
  for(i=0; i<n; i++){
    scanf("%s %s", com, str);

    if (com[0] == 'i'){
      insert(str);
    }else{
      if (find(str))
        printf("yes\n");
      else
        printf("no\n");
    }
  }
  return 0;
}




Measured memory_bytes: 17064
#include<bits/stdc++.h>
using namespace std;
#define BeatMeScanf ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

int main()
{
    BeatMeScanf;
    //freopen("G:/C++/in.txt", "r", stdin);
    //freopen("G:/C++/out.txt", "w", stdout);

    int H, A;
    cin >> H >> A;
    int cnt=0;
    for(int i = 0; i<10000;i++)
    {
        H = H - A;
        cnt++;
        if(H<=0)
            break;
    }

    cout<<cnt<<endl;
    return 0;
}



Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		Map data = new TreeMap();
//		Set num = new HashSet();
		int[] num = new int[N];
		for(int i = 0 ; i<N; i++){
			int input = sc.nextInt();
			num[i] = input;
		//	num.add(input);
			if(data.containsKey(input)){
				int v = (int)data.get(input);
				data.replace(input, v, v+1);
			}
			else{
				data.put(input, 1);
			}
		}
		Set judge = new HashSet();
		int res = 0;
		for(int i = 0 ; i<N; i++){
			if(judge.contains(num[i]))continue;
			else{
				judge.add(num[i]);
				int add = 0;
				if(data.containsKey(num[i])){
					add+=(int)data.get(num[i]);
				}
				if(data.containsKey(num[i]-1)){
					add+=(int)data.get(num[i]-1);
				}
				if(data.containsKey(num[i]+1)){
					add+=(int)data.get(num[i]+1);
				}
				if(add>res)res = add;
			}
		}
		System.out.println(res);
	}
}


Measured memory_bytes: 60400
S = input()
n = len(S)-1

while n > 1:
    n = len(S)
    S = S[:n-1]
    if len(S)%2 != 0:
        continue
    m = len(S)//2
    x = S[:m]
    y = S[m:]
    if x == y:
        n =len(S)
        break

print(n)

Measured memory_bytes: 3060
#!/usr/bin/python3
# li = list(map(int,input().split()))	

s = input()

li = [1]*len(s)

for i,c in enumerate(s[:len(s)-1]):
   if c == "R":
       if s[i+1]=="R":
           li[i+1]+=li[i]
           li[i]=0

for i in range(len(s)-1,0,-1):
    if s[i]=="L":
        if s[i-1]=="L":
            li[i-1]+=li[i]
            li[i]=0


# print(li)
for i in range(len(s)):
    if li[i]!=0 and s[i]=="R":
        tmp=li[i]+li[i+1]
        if (tmp)%2==0:
            li[i]=li[i+1]=(tmp)/2
        else:
            # print(i)
            if li[i]%2!=0:
                # print("?")
                li[i]=((tmp)//2) + 1
                li[i+1]=(tmp)//2
            else:
                # print("!")
                li[i]=(tmp)//2
                li[i+1]=((tmp)//2) + 1
# print(li)
for c in li:
    print(int(c),end=" ")
print("")

Measured memory_bytes: 6000
import numpy as np
import heapq


H, w = map(int, input().split())
cost = np.zeros((10, 10), dtype=np.int64)
for i in range(10):
    temp = map(int, input().split())
    for j, x in enumerate(temp):
        cost[j, i] = x
d = np.zeros(10, dtype=np.int64)
h = []
heapq.heappush(h, (0, 1))
while h:
    dx, x = heapq.heappop(h)
    for y in range(10):
        if y in [1, x]:
            continue
        if d[y] == 0 or dx + cost[x, y] < d[y]:
            d[y] = dx + cost[x, y]
            heapq.heappush(h, (d[y], y))
ans = 0
for _ in range(H):
    row = input().split()
    for x in row:
        x = int(x)
        ans += 0 if x == -1 else d[x]
print(ans)


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

using namespace std;


int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    string s;
    int n;
    cin >> s >> n;
    auto rev = false;
    deque<char> q(s.begin(), s.end());
    for (int i = 0; i < n; i++) {
        int op, dir;
        char ch;
        cin >> op;
        if (op == 1) {
            rev = !rev;
        } else {
            cin >> dir >> ch;
            if (rev) {
                dir = 3-dir;
            }
            if (dir == 1) {
                q.push_front(ch);
            } else {
                q.push_back(ch);
            }
        }
    }
    if (rev) {
        reverse(q.begin(), q.end());
    }
    for (char ch: q) {
        cout << ch;
    }
    cout << endl;
}



Measured memory_bytes: 976
#include <iostream>
#include <vector>
#include<algorithm>
#include <string>
#include <cmath>
#include<queue>
#define PI 3.141592653589793238
#define ll long long
using namespace std;

int main()
{
	int n;
	bool flag;
	int ans;

	cin >> n;

	for (int i = n; i <= 100003; i++) {
		flag = true;
		for (int j = 2; j < sqrt(i); j++) {
			if (i % j == 0) {
				flag = false;
				break;
			}
		}
		if (flag) {
			ans = i;
			break;
		} else {
			continue;
		}
	}

	cout << ans;

	return 0;
}

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

const int mod = 1e9 + 7 ; 

int n ;

int a[100010] ;

long long Pow(long long foo, long long bar){
    long long ans = 1ll ;
    while(bar){
        if(bar % 2) ans = (ans * foo) % mod ;
        foo = (foo * foo) % mod ;
        bar /= 2 ;
    }
    return ans ;
}

long long prefix[100010] ;

int main(){
    #define NAME "example"
    //freopen( NAME".inp" , "r" , stdin ) ; freopen( NAME".out" , "w" , stdout ) ;

    ios_base :: sync_with_stdio(false) ;

    cin >> n ;

    for (int i = 1; i <= n; ++ i) cin >> a[i] ;

    for (int i = 1; i <= n; ++ i) prefix[i] = prefix[i - 1] + Pow(1ll * (i + 1), 1ll * (mod - 2)), prefix[i] %= mod ; 

    long long foo = 1 ;
    
    for (int i = 1; i <= n; ++ i) foo *= 1ll * i, foo %= mod ;

    long long ans = 0 ;
    
    for (int i = 1; i <= n; ++ i){
        long long bar = prefix[i - 1] + prefix[n - i] + 1ll ; bar %= mod ;
        ans += 1ll * bar * a[i] ; ans %= mod ;
    }

    cout << (ans * foo) % mod << endl ; 

    return 0 ;
}

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

int main(){
	int n;
	scanf("%d", &n);
	multiset < int > s;
	int ans = 0;
	for (int i=0; i<n; i++){
		int x;
		scanf("%d", &x);
		s.insert(x);
		auto it = s.lower_bound(x);
		if(it == s.begin()) ans++;
		else {
			it--;
			s.erase(it);
		}
	}
	printf("%d\n", ans);
}


Measured memory_bytes: 4992
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(0);cin.tie(0);
#define all(v)    ((v.begin()),(v.end()))
#define sz(v)     ((int)(v.size()))
#define forv(i, v) for(int i = 0; i < sz(v); ++i)
#define forn(i,n)   for(int i = 0; i < (int)(n); i++)
using namespace std;

typedef long long       ll;
typedef long double     ld;
typedef vector<int>     vi;
typedef vector<double>  vd;
typedef vector< vi >    vii;
typedef vector< vd >    vdd;
typedef vector<string>  vs;


int main()
{
	string a, b;
	cin >> a >> b;
	int m = a.size();
	int n = b.size();

	int L[m + 1][n + 1];

	for (int i = 0; i <= m; i++) {
		for (int j = 0; j <= n; j++) {
			if (i == 0 || j == 0) L[i][j] = 0;
			else if (a[i - 1] == b[j - 1]) L[i][j] = L[i - 1][j - 1] + 1;
			else {
				L[i][j] = max(L[i - 1][j], L[i][j - 1]);
			}
		}
	}

	int index = L[m][n];

	char lcs[index + 1];
	lcs[index] = '\0';

	int i = m, j = n;
	while (i > 0 && j > 0) {
		if (a[i - 1] == b[j - 1]) {
			lcs[index - 1] = a[i - 1];
			i--;
			j--;
			index--;
		}
		else if (L[i - 1][j] > L[i][j - 1]) i--;
		else j--;
	}
	cout << lcs << endl;
	return 0;
}


Measured memory_bytes: 35456
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(ll I=ll(A);I<ll(B);++I)

const int Xx = 'x'-'X';
const int xX = 'X'-'x';

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

	string s;
	while(cin>>s,s!="0"){
		int ans = 0;
		for(auto c:s){
			ans += c-'0';
		}
		cout << ans << endl;
	}
}


Measured memory_bytes: 3140
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	static ArrayList<Integer> cities = new ArrayList<>();
	static int N,M,R;
	static int dist[][];
	static boolean used[];
	static int result;
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		N = Integer.parseInt(sc.next());
		M = Integer.parseInt(sc.next());
		R = Integer.parseInt(sc.next());
		dist = new int[N][N];
		for(int i=0;i<N;i++){
			for(int j=0;j<N;j++){
				if(i!=j) dist[i][j] = 1000000000;
				else dist[i][j] = 0;
			}
		}
		for (int i = 0; i < R; i++) {
			cities.add(Integer.parseInt(sc.next())-1);
		}
		for (int i = 0; i < M; i++) {
			int a = Integer.parseInt(sc.next()) - 1;
			int b = Integer.parseInt(sc.next()) - 1;
			int c = Integer.parseInt(sc.next());
			dist[a][b] = Math.min(c,dist[a][b]);
			dist[b][a] = Math.min(c,dist[b][a]);
		}

		for(int k=0;k<N;k++){
			for(int i=0;i<N;i++){
				for(int j=0;j<N;j++){
					dist[i][j] = Math.min(dist[i][j], dist[i][k]+dist[k][j]);
				}
			}
		}

		result = Integer.MAX_VALUE;
		for(int i=0;i<R;i++) {
			int st=cities.remove(0);
			result = Math.min(result,  search(st, cities));
			cities.add(st);
		}

		out.println(result);
		out.flush();
	}


	public static int search (int now, ArrayList<Integer> toVisit) {
		int opt = Integer.MAX_VALUE;
		if(toVisit.size()==0) return 0;
		for(int i=0;i<toVisit.size();i++) {
			int v=toVisit.remove(0);
			opt = Math.min(opt, search(v, toVisit)+dist[now][v]);
			toVisit.add(v);
		}
		return opt;
	}
}

class edge {
	int cost;

	public edge(int a, int b, int c) {
		this.cost = c;
	}
}

Measured memory_bytes: 43156
main=getLine>>=putStrLn.f "AKIHABARA"
f [] [] = "YES"
f ['A'] [] = "YES"
f [] _ = "NO"
f _ [] = "NO"
f (a:ar) (b:br)
    | a==b = f ar br
    | a=='A' = f ar (b:br)
    | otherwise = "NO"

Measured memory_bytes: 380
#k,x=map(int,input().split())
#p_3,p_4=map(int,input().split())
n=int(input())
s=input()
#r=[int(input()) for _ in range(n)]
#o=list(map(int,input().split()))
#b=list(map(int,input().split()))
#c=list(map(float,input().split()))
#n=int(input())
#a=[list(map(int,input().split()))for _ in range(n)]
#a=list(input().split("+"))
#m=[list(input().split())for _ in range(n)]
if 3200<=n:
    print(s)
else:
    print("red")

Measured memory_bytes: 2940
using System;

namespace B___Trained
{
    class Program
    {
        static void Main (string[] args)
        {
            var n = int.Parse (Console.ReadLine ());
            var a = new int[n];
            for (var i = 0; i < n; i++)
            {
                a[i] = int.Parse (Console.ReadLine ());
            }
            var index = 0;
            var count = 1;
            for (var i = 0; i < a.Length - 1; i++)
            {
                if (a[index] == 2)
                {
                    Console.WriteLine (count);
                    return;
                }
                index = a[index] - 1;
                count++;
            }
            Console.WriteLine (-1);
        }
    }
}

Measured memory_bytes: 13280
#include <bits/stdc++.h> 
using namespace std;
typedef long long intl;
int MOD=998244353;
using namespace std;
int main(){
	vector <vector<int> > dp(4001,vector <int>(4001,0));
	vector <vector<int> > visited(4001,vector <int>(4001,0));
	string s;
	cin>>s;
	int n=s.size();
	vector <pair<int,int> > v;
	v.push_back({0,0});
	for(int i=1;i<=n;i++){
		if(s[i-1]=='0'){
			v.push_back({v[i-1].first+2,v[i-1].second});
		}
		else if(s[i-1]=='1'){
			v.push_back({v[i-1].first+1,v[i-1].second+1});
		}
		else{
			v.push_back({v[i-1].first,v[i-1].second+2});
		}
	}
	dp[0][0]=1;
	queue<pair<int,int> > q;
	q.push({0,0});
	while(!q.empty()){
		int a=q.front().first;
		int b=q.front().second;
		q.pop();
		if(visited[a][b]){
			continue;
		}
		visited[a][b]=1;
	
		int tot=a+b+1;
		if(tot>n){
			tot=n;
		}
		
		if(v[tot].second>b){
			dp[a][b+1]+=dp[a][b];
			dp[a][b+1]=dp[a][b+1]%MOD;
			q.push({a,b+1});
		}
		if(v[tot].first>a){
			dp[a+1][b]+=dp[a][b];
			dp[a+1][b]=dp[a+1][b]%MOD;
			q.push({a+1,b});
		}
		
	}
	cout<<dp[v[n].first][v[n].second]<<endl;
	
}

Measured memory_bytes: 127616
#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;
const int MOD = 1000000007;

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

ll gcd(ll a, ll b) {
	if (b == 0) { return a; }
	if (a < b) { return gcd(b, a); }
	return gcd(b, a % b);
}

int n, ans;

int main() {
    cin >> n;
    rep(i, n) {
        int a;
        cin >> a;
        ans = gcd(ans, a);
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int w = sc.nextInt();
		while(h != 0 || w != 0){
			for(int i = 0; i < h; i++){

				for(int j = 0; j < w; j++){
					System.out.print("#");
				}
				System.out.println();

			}
			System.out.println();

			h = sc.nextInt();
			w = sc.nextInt();
		}
	}
}

Measured memory_bytes: 26980
import java.util.*;
import java.util.stream.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long h = sc.nextLong();
        long ans = 1;
        long count = 1;
        while (h > 1) {
            h = h/2;
            ans += Math.pow(2, count);
            count++;
        }
        System.out.println(ans);
    }

}


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

using namespace std;

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

  if (S[0] == S[1] && S[1] == S[2]) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
dic = {}
while True:
    try:
        word, pgn = input().split()

        if word in dic.keys():
            dic[word].append(int(pgn))
        else:
            dic[word] = [int(pgn)]
    except:
        break

for k, v in sorted(dic.items()):
    print(k)
    print(' '.join(map(str, sorted(v))))

Measured memory_bytes: 7596
#include<stdio.h>
#define NMAX 1000000

int cnt = 0;
int A[NMAX];

void insertionSort(int A[], int n, int g){
    int v;
    int i,j;

    for(i=g; i<n; i++){
        v = A[i];
        j = i - g;
        while(j>=0 && A[j] > v){
            A[j+g] = A[j];
            j = j - g;
            cnt++;
        }
        A[j+g] = v;
    }
}

void shellSort(int A[], int n){
    int i;
    int m = 13;
    int G[13] = {1, 4, 13, 40, 121, 364, 1093, 3280, 9841, 29524, 88573, 265720, 797161};
    cnt = 0;

    while(G[m-1] > n) m--;
    printf("%d\n%d", m, G[m-1]);
    for(i=m-2; i>=0; i--) printf(" %d", G[i]);
    putchar('\n');

    for(i=m-1; i>=0; i--){
        insertionSort(A, n, G[i]);
    }
}

int main(){
    int i,n;

    scanf("%d", &n);
    for(i=0; i<n; i++) scanf("%d", &A[i]);
    shellSort(A,n);
    printf("%d\n", cnt);
    for(i=0; i<n; i++) printf("%d\n", A[i]);
    return 0;
}


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

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<29;

typedef pair<int,int> pii;

int X,Y,Z;
int roulette[4];
pii ba[50];
double memo[50][5001];

double solve(int now, int money) {
  if (now >= Y) return money;
  if (memo[now][money] >= 0) return memo[now][money];
  int e = ba[now].first, a = ba[now].second;
  double res = 0;
  int oldnow = now, oldmoney = money;
  if (e == 1)
    now += a;
  else if (e == 2) {
    money += a;
  } else if (e == 3){
    money = max(0, money-a);
  }
  REP(i,X) {
    res += 1.0/X * solve(now+roulette[i], money);
  }
  return memo[oldnow][oldmoney] = res;
}

int main() {
  while(cin>>X>>Y>>Z,X||Y||Z) {
    REP(i,X) cin >> roulette[i];
    REP(i,Y)
      ba[i] = pii(0,0);
    REP(i,Z) {
      int n,e,a;
      cin>>n>>e>>a;
      ba[n] = pii(e,a);
    }
    REP(i,50) REP(j,5001) memo[i][j] = -1;
    cout << (int)(solve(0,0)+1e-4) << endl;
  }
}

Measured memory_bytes: 0
#include <iostream>
#include <math.h>
#define rep(i,n) for (int i=0; i<(n); i++)
using namespace std;

int main(){
    int a,b;
    cin >> a >> b;

    // double x = b * 10;
    // int y = x * 0.08;
    // cout << y << endl;

    
    // if(y==a){
    //     cout << x << endl;
    // }
    // else{
    //     cout << -1 << endl;
    // }

    rep(i, 10000){
        if( (floor(i*0.08) == a) && (floor(i*0.1) == b) ){
            cout << i << endl;
            return 0;
        }
    }
    cout << "-1" << endl;
    return 0;
}

Measured memory_bytes: 256
# coding:utf-8
# ??????????????¢???????????????????????????

WHxyr = raw_input().split()

W = int(WHxyr[0])
H = int(WHxyr[1])
x = int(WHxyr[2])
y = int(WHxyr[3])
r = int(WHxyr[4])

if x-r >= 0 and x+r <= W and y-r >= 0 and y+r <= H:
    print "Yes"
else:
    print "No"

Measured memory_bytes: 6428
#include<bits/stdc++.h>
#define endl "\n"
#define ll long long 
#define F first
#define end 1000000000
#define S second
#define pb push_back
#define mp make_pair
using namespace std;

int main()
{
  ll n;
  cin >> n;ll a[n];ll sum=0;map<ll,ll> mp;
  for(ll i=0;i<n;i++)
  {
      cin >> a[i];
      mp[a[i]]++;
      sum+=a[i];
  }
  ll q;
  cin >> q;
  while(q--)
  {
      ll a,b;
      cin >> a >> b;
      sum+=mp[a]*(b-a);
      ll x=mp[a];mp[b]+=x;
      mp[a]=0;
      cout << sum << endl;
  }
  
}

Measured memory_bytes: 10220
s = input()
s = s.replace('BC','D')
N = len(s)
a = [0]*(N+1)
ans = [0]*(N+1)

for n in range(N):
    ans[n+1] = ans[n]
    if s[n] == 'A':
        a[n+1] = a[n]+1
    elif s[n] == 'D':
        a[n+1] = a[n]
        ans[n+1] += a[n]

print(ans[N])

Measured memory_bytes: 45552
#include <cstdio>
int main() {
	int n;
	std::scanf("%d", &n);
	if (n < 10) {
		std::printf("%d\n", n);
	}
	else if (n < 100) {
		std::printf("%d\n", 9);
	}
	else if (n < 1000) {
		std::printf("%d\n", n - 90);
	}
	else if (n < 10000) {
		std::printf("%d\n", 909);
	}
	else if (n < 100000) {
		std::printf("%d\n", n - 9090);
	}
	else {
		std::printf("90909\n");
	}
	return 0;
}

Measured memory_bytes: 128