akhauriyash/Code-Regression huggingface dataset:
/* ex7_3
    sak_Citrue  */

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

int main(void){
    int height,width;
    char **ptr;
    scanf("%d %d",&height,&width);
    char flag = 0;
    char *ptrrow = (char*)calloc(height,sizeof(char));
    char *ptrcol = (char*)calloc(width,sizeof(char));


    ptr = (char**)calloc(height,sizeof(char*));

    for(int i = 0;i<height;i++){
        ptr[i] = (char*)calloc(width,sizeof(char));
    }
    
    for(int i=0;i<height;i++){
        for(int j=0;j<width;j++){
            scanf(" %c",ptr[i]+j);
        }
    }
    
    //どの行を出力すべき列か走査
    for(int i=0;i<height;i++){
        for(int j=0;j<width;j++){
            if(*(ptr[i]+j)=='#'){
                *(ptrrow+i) = 1;
                break;
            }
        }
    }
    
    //どの列を出力すぺきか走査
    for(int i=0;i<width;i++){
        for(int j=0;j<height;j++){
            if(*(ptr[j] + i)=='#'){
                *(ptrcol+i) = 1;
                break;
            }
        }
    }
    
    
    //出力
    for(int i=0;i<height;i++){
        flag = 0;
        for(int j=0;j<width;j++){
            //出力すべき行、列にどちらも該当しているときのみ書き込む
            if(*(ptrrow+i)==1 && *(ptrcol+j)==1){
                printf("%c",*(ptr[i]+j));
                flag = 1;
            }
            //出力が存在した行末尾で改行
            if(j==width -1 && flag == 1){
                printf("\n");
            }
        }
    }
    return 0;
}

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

typedef long long ll;
const int MAX_N = 100030;    // Change as necessary
const ll  MODD = 1000000009; //

vector<ll> pr;
bool is_prime[MAX_N];

__int128 fast_exp_mod(__int128 b, __int128 n, __int128 m) {
  if (n == 0) return 1 % m;
  if (n % 2 == 0) return fast_exp_mod((b*b)%m, n/2, m);
  return (fast_exp_mod(b, n-1, m) * b) % m;
}

ll q_mod(ll x,ll m){ return (x >= m) ? x-m : x; }
ll mult_mod(ll x,ll y,ll m){ // Use int128
  __int128 X = x, Y = y, M = m;
  return ll(X * Y % M);
  ll r = 0;
  while(y){
    if(y % 2) r = q_mod(r+x,m);
    y >>= 1; x = q_mod(x << 1,m);
  } return r;
}

const ll val[] = {2,13,23,1662803};
bool isLargePrime(ll n){
  if(n < 100000) return false;
  for(auto p : pr){
    if(p*p*p > n) break;
    if(n % p == 0) return false;
  }
  
  ll s = __builtin_ctzll(n-1), d = (n-1) >> s;
  for(int i=0;i<4;i++){
    if(val[i] >= n) break;
    ll x = fast_exp_mod(val[i],d,n); // Use int128 in here
    if(x == 1 || x == n-1) continue;
    for(ll r=1;r<s;r++) if((x = mult_mod(x,x,n)) == n-1) goto nextPr;
    return false;
  nextPr:;
  }
  return true;
}

vector<pair<ll,int> > factor(long long x){
  vector<pair<ll,int> > ans;
  
  if(isLargePrime(x)){
    ans.emplace_back(x,1);
    return ans;
  }
  
  for(auto p : pr){
    if(p*p > x) break;
    if(x % p == 0){
      int ctr = 0;
      while(x % p == 0){
        x /= p;
        ctr++;
      }
      
      if(ctr % 3)
        ans.emplace_back(p,ctr%3);
    }
  }
  if(x != 1) ans.emplace_back(x,1);
  return ans;
}

ll A[MAX_N];
map<vector<pair<ll,int> >, int> M;

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  
  pr.push_back(2);
  fill(is_prime,is_prime+MAX_N,true);
  for(int i=3;i*i<MAX_N;i++)
    if(is_prime[i])
      for(int j=i*i;j<MAX_N;j+=i)
        is_prime[j] = false;
  
  for(int i=3;i<MAX_N;i+=2)
    if(is_prime[i])
      pr.push_back(i);
  
  int n; cin >> n;
  for(int i=0;i<n;i++) cin >> A[i];
  
  for(int i=0;i<n;i++)
    M[factor(A[i])]++;
  
  int ans = 0;
  for(const auto& x : M){
    vector<pair<ll,int> > tmp = x.first;
    bool found = false;
    for(auto& p : tmp){
      p.second = (3-p.second)%3;
      found |= p.second;
    }
    
    if(!found) ans+=2;
    else if(M.count(tmp)){
      ans += max((ll)x.second,(ll)M[tmp]);
    } else {
      ans += x.second*2;
    }
  }
  
  cout << ans/2 << endl;
  
  return 0;
}


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

int main() {
  
  int K, S; cin >> K >> S; int ans = 0;
  
  for (int X = 0; X <= K; X++) {
    
    for (int Y = 0; Y <= K; Y++) {
      
      int Z = S - (X + Y);
      
      if (0 <= Z && Z <= K) ans++;
      
    }
    
  }
  
  cout << ans << endl;
  
}

Measured memory_bytes: 256
import java.util.Scanner;


public class Main {
	public static void main(String[] args){
		try(Scanner sc = new Scanner(System.in)) {
		
			int n = sc.nextInt();
			int[] as = new int[n];
			
			for(int i = 0 ; i < n ; i++ ) {
				as[i] = sc.nextInt();
			}
			
			int cn = 1;
			int bc = 0;
			
			for(int i = 0 ; i < n ; i++ ) {
				if ( as[i] == cn) {
					//satisfied
					cn++;
				}
				else {
					//break it
					bc++;
				}
			}
			
			if ( cn == 1 ) {
				System.out.println(-1);
			}
			else {
				System.out.println(bc);
			}

		}
	}

}

Measured memory_bytes: 60576
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    x, n = map(int, input().split())
    if n >= 1:
        p_set = set(map(int, input().split()))
    else:
        p_set = set()

    print(f(x, p_set))


def f(x, p_set):
    for i in range(101):
        if (x - i) not in p_set:
            return x - i
        elif (x + i) not in p_set:
            return x + i


if __name__ == '__main__':
    main()


Measured memory_bytes: 9132
// 2020-07-17 00:56:53
#include<bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (ll i = (ll)(n); i < (ll)(m); i++)
#define REPC(i, n, m) for (ll i = (ll)(n); i <= (ll)(m); i++)
#define REPCM(i, n, m) for (ll i = (ll)(n); i >= (ll)(m); i--)
using namespace std;
using ll = long long;
using ld = long double;
using pr = pair<ll, ll>;
using vll = vector<ll>;
using vpr = vector<pr>;
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }

void answer() {
  ll n;
  cin >> n;
  vector<ll> s(n);
  rep(i, n) {
    cin >> s[i];
  }
  ll ans = 0;
  REP(i, 1, n/2) {
    ll cur = 0, c = i;
    vector<int> used(n, 0);
    for(ll k = 0; k*c < n-1; k++) {
      ll l = k*c, r = n-1-k*c;
      if(used[l] || used[r] || l == r || r < c) break;
      used[l] = used[r] = 1;
      cur += s[l] + s[r];
      chmax(ans, cur);
    }
  }
  cout << ans << '\n';
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  answer();
  return 0;
}

Measured memory_bytes: 4500
# coding: utf-8
intLength = int(input())
strSentence = input()
intIndex = int(input())

strAnswer = ""
strWord = strSentence[intIndex-1]

for intIdx in range(intLength):
    if strSentence[intIdx] != strWord:
        strAnswer += "*"
    else:
        strAnswer += strWord

print(strAnswer)


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

int main() {
  int x, y;
  while (1) {
    cin >> x >> y;
    if (x == 0 && y == 0) {
      break;
    }
    if (x <= y) {
      cout << x << " " << y << endl;
    } else {
      cout << y << " " << x << endl;
    }
  }
  return 0;
}



Measured memory_bytes: 3004
#include <iostream> 
using namespace std;
int n, ans;
string s;
int main() {
    cin >> s;
    n = s.size()-1;
    for (int i=0;i<=n;i++) ans += (i > n/2) - (s[i] == 'p');    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define int long long
#define inf 1000000007
#define LINF 100000000000000007LL
#define ll long long
using namespace std;
signed main(){
	int n,r,s,p,k;
	cin>>n>>k;
	cin>>r>>s>>p;
	string st;
	cin>>st;
	int ans = 0;
	for(int i=0;i<n;i++){
		if( i < k || st[i-k] != st[i] ){
			if( st[i] == 'r' ) ans += p;
			if( st[i] == 'p' ) ans += s;
			if( st[i] == 's' ) ans += r;
		}
		else if ( i >= k ){
			st[i] = 'u';
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 512
n,m=map(int,input().split())

t=[True]*(n+1)

for i in range(m):
    a=int(input())
    t[a]=False

dp=[0]*(n+1)
dp[0]=1
#dp[1]=2

for i in range(0,n):
    for j in range(i+1,min(n,i+2)+1):
        if t[j]:
            dp[j]+=dp[i]
            dp[j] %=(1000000007)

#print(dp)
print(dp[n])        

Measured memory_bytes: 7700
import numpy as np
N, K = map(int, input().split())
a = list(map(int, input().split()))

def uniq(a):
    d = {}
    for a_ in a:
        if a_ not in d:
            d[a_] = 1
        else:
            d[a_] += 1
    return d.keys(), d.values()

def solve():
    u, c = uniq(a)
    k = len(u) - K
    if len(u) > K:
        print(sum(sorted(c)[:k]))
    else:
        print(0)

solve()

Measured memory_bytes: 41992
n,m,r=map(int,input().split())
a,b=sorted([n-1,r-m*n])
if a<1:print(0)
else:
 d=1
 for i in range(a):d*=i+1
 u=1
 for i in range(b,a+b):u*=i+1
 print(u//d)


Measured memory_bytes: 5668
#include<bits/stdc++.h>
using namespace std;
long long mod=1000000007;

int main(){
  int x,y;
  cin >> x >> y;
  int ans=2000000009;
  if(y-x>=0)ans=min(ans,y-x);
  if(y+x>=0)ans=min(ans,y+x+1);
  if(-y-x>=0)ans=min(ans,-y-x+1);
  if(-y+x>=0)ans=min(ans,-y+x+2);
  cout << ans << endl;
}

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

int main (void)
{
    unsigned long cash, x, year;

    scanf("%lu", &x);
    cash = 100;

    for (year=0; cash<x;) {
        cash = (unsigned long)((double)cash * 1.01);
      	year++;
    }

    printf("%lu", year);

    return 0;
}



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

int main() {
    int n;
    cin >> n;
    double ans = 0;
    double x;
    string u;
    rep(i, n) {
        cin >> x >> u;
        if (u[0] == 'J') ans += x;
        else ans += x * 380000;
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
	int N;
	cin >> N;
	vector<int> v(N);
	rep(i, N) cin >> v[i];
	
	vector<P> odd_counter(100000);
	vector<P> even_counter(100000);
	
	int si = 0;
  	rep(i, odd_counter.size()){
      odd_counter[i].first = 0;
      odd_counter[i].second = i;
      even_counter[i].first = 0;
      even_counter[i].second = i;
    }
	
	for(int i = 0; i < N; i += 2){
		odd_counter[v[i] - 1].first++;
		even_counter[v[i+1] - 1].first++;
	}
	
	sort(odd_counter.begin(), odd_counter.end(), greater<P>());
	sort(even_counter.begin(), even_counter.end(), greater<P>());
	
	int odd_sum = 0;
	int even_sum = 0;
	rep(i, odd_counter.size()){
		odd_sum += odd_counter[i].first;
		even_sum += even_counter[i].first;
	}
	
	if(odd_counter[0].second == even_counter[0].second){
        int dif = min(odd_counter[0].first - odd_counter[1].first, even_counter[0].first - even_counter[1].first);
		odd_sum -= odd_counter[0].first;
		even_sum -= even_counter[0].first;
        cout << odd_sum + even_sum + dif << endl;
	}
	else{
		odd_sum -= odd_counter[0].first;
		even_sum -= even_counter[0].first;
		cout << odd_sum + even_sum << endl;
	}
	
	return 0;
}



Measured memory_bytes: 2304
#include<cstdio>
#include<cstring>
#include<algorithm>
int a,b,c,ans;
template<class T>
inline void read(T&a){
	char c=getchar();
	for(a=0;c<'0'||c>'9';c=getchar());
	for(;c>='0'&&c<='9';c=getchar())a=a*10+c-'0';
}
int main(){
	read(a),read(b),read(c);
	printf("%d\n",std::min(std::min(a+b,b+c),a+c));
	return 0;
}

Measured memory_bytes: 128
n=int(input())
gr=[]
for i in range(n):
  s,p=input().split()
  p=int(p)
  gr.append([[s,p],i])

gr=sorted(gr,key=lambda x:(x[0][0],-x[0][1]))

for i in range(len(gr)):
  print(gr[i][1]+1)

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

int main()
{
    ll N, Q;
    ll A_sum[100001] = {};
    vector<ll> S;
    cin >> N;
    ll total = 0;

    for (ll i = 0; i < N; i++) {
        ll A;
        cin >> A;
        A_sum[A] += A;
        total += A;
    }
    cin >> Q;
    for (ll i = 0; i < Q; i++) {
        ll B, C;
        cin >> B >> C;
        total += (A_sum[B] / B) * C - A_sum[B];
        A_sum[C] += (A_sum[B] / B) * C;
        A_sum[B] = 0;
        S.push_back(total);
    }
    for (ll i = 0; i < Q; i++) {
        cout << S[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 5104
#include <stdio.h>
#include <vector>

std::vector<int> A;

int main(void){
    int n; scanf("%d", &n);
    A.resize(n); for(int i = 0; i < n; ++i) scanf("%d", &A[i]);
    int idx = 0; long long res = 0;
    while(idx < n){
        if(A[idx] == 0){idx++; continue;}
        int cnt = 0; long long T = 0;
        while(idx + cnt < n and A[idx+cnt] > 0) T += A[idx+(cnt++)];
        res += T / 2;
        idx += cnt;
    }
    printf("%lld\n", res);
    return 0;
}

Measured memory_bytes: 640
#include<iostream>
using namespace std;
int main(){
  long long int H;
long long int W;
  cin>>H>>W;
  if(H!=1&&W!=1){
  if((H*W)%2==0){
  cout<<H*W/2;
  }
  else{
  cout<<(H*W)/2+1;
  }
  }
  else {
  cout<<1;
  }
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define Ans(f, y, n) if(f) cout << y << endl; else cout << n << endl;
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i, v.size()){ cout << v[i] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i, m.size()){ REP(j, m[i].size()){ cout << m[i][j] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

template<typename T> void readv(vector<T> &a){ REP(i, a.size()) cin >> a[i]; }
void readv_m1(vector<int> &a){ REP(i, a.size()){cin >> a[i]; a[i]--;} }

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

int mod = 1000000007;
//int mod = 998244353;
#define Add(x, y) x = (x + (y)) % mod
#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    int X, Y, Z, K; cin >> X >> Y >> Z >> K;
    vec A(X); readv(A); Sort(A); Reverse(A);
    vec B(Y); readv(B); Sort(B); Reverse(B);
    vec C(Z); readv(C); Sort(C); Reverse(C);

    priority_queue<vec> que;
    map<vec, bool> used;
    que.push(vec({A[0] + B[0] + C[0], 0, 0, 0}));
    used[vec({0, 0, 0})] = true;
    vec ans(K);
    REP(i, K){
        vec v = que.top(); que.pop();
        ans[i] = v[0];
        int x = v[1], y = v[2], z = v[3];
        if(x < X - 1) if(!used[vec({x + 1, y, z})]){
            que.push(vec({A[x + 1] + B[y] + C[z], x + 1, y, z}));
            used[vec({x + 1, y, z})] = true;
        }
        if(y < Y - 1) if(!used[vec({x, y + 1, z})]){
            que.push(vec({A[x] + B[y + 1] + C[z], x, y + 1, z}));
            used[vec({x, y + 1, z})] = true;
        }
        if(z < Z - 1) if(!used[vec({x, y, z + 1})]){
            que.push(vec({A[x] + B[y] + C[z + 1], x, y, z + 1}));
            used[vec({x, y, z + 1})] = true;
        }
    }
    REP(i, K){
        cout << ans[i] << endl;
    }


    return 0;
}


Measured memory_bytes: 1536
#!python3

iim = lambda: map(int, input().rstrip().split())
liim = lambda: list(map(int, input().rstrip().split()))

def resolve():
    N, M = iim()
    wa = dict()
    ac = set()
    for i in range(M):
        p, s = input().split()

        if not p in wa:
            wa[p] = 0

        if s == "AC":
            ac.add(p)
        elif not p in ac:
            wa[p] += 1

    x = 0
    for p in ac:
        x += wa[p]
    print(len(ac), x)


if __name__ == "__main__":
    resolve()


Measured memory_bytes: 20496
/// IN THE NAME OF METAL
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long int ll;
typedef pair<ll, ll> pll;
 
#define sz(x)                       (ll) x.size()
#define all(x)                      (x).begin(),(x).end()
#define F                           first
#define S                           second
 
ll Pow(ll a, ll b, ll md, ll ans = 1) {
    for (; b; b >>= 1, a = a * a % md)
        if (b & 1)
            ans = ans * a % md;
    return ans % md;
}
 
const ll MAXN = 1e5 + 10;
const ll INF = 8e18;
const ll LOG = 22;
const ll MOD = 1e9 + 7;
ll ans[MAXN], par[LOG][MAXN], H[MAXN], cnt[MAXN], val[MAXN], sum[MAXN], n, q;
vector<pair<pll, ll>> adj[MAXN], Q[2][MAXN];

void DFS(ll v, ll p = -1) {
    if (p == -1) par[0][v] = v;
    for (ll i = 1; i < LOG; i++) {
        par[i][v] = par[i - 1][par[i - 1][v]];
    }
    for (auto nei : adj[v]) {
        ll u = nei.S, w = nei.F.S, c = nei.F.F;
        if (u != p) {
            H[u] = H[v] + 1;
            sum[u] = sum[v] + w;
            par[0][u] = v;
            DFS(u, v);
        }
    }
}

ll getpar(ll v, ll h) {
    for (ll i = LOG - 1; i--;) {
        if (h & (1LL << i)) {
            v = par[i][v];
        }
    }
    return v;
}

ll LCA(ll u, ll v) {
    if (H[u] < H[v]) swap(u, v);
    u = getpar(u, H[u] - H[v]);
    if (u == v) return v;
    for (ll i = LOG - 1; i--;) {
        if (par[i][u] != par[i][v]) {
            v = par[i][v], u = par[i][u];
        }
    }
    return par[0][v];
}

void DFSCalc(ll v, ll p = -1) {
    for (auto x : Q[0][v]) {
        ll c = x.F.F, d = x.F.S, id = x.S;
        ans[id] += (-val[c]) + cnt[c] * d;
    }
    for (auto x : Q[1][v]) {
        ll c = x.F.F, d = x.F.S, id = x.S;
        ans[id] -= 2 * ((-val[c]) + cnt[c] * d);
    }
    for (auto nei : adj[v]) {
        ll u = nei.S, w = nei.F.S, c = nei.F.F;
        if (u == p) continue;
        cnt[c]++, val[c] += w;
        DFSCalc(u, v);
        cnt[c]--, val[c] -= w;
    }
}

int main() {
    scanf("%lld%lld", &n, &q);
    for (ll i = 1; i <= n - 1; i ++) {
        ll u, v, w, c;
        scanf("%lld%lld%lld%lld", &u, &v, &c, &w);
        adj[u].push_back({{c, w}, v});
        adj[v].push_back({{c, w}, u});
    }
    DFS(1);
    for (ll i = 1; i <= q; i++) {
        ll c, d, u, v;
        scanf("%lld%lld%lld%lld", &c, &d, &u, &v);
        ll lca = LCA(u, v);
        ans[i] = sum[u] + sum[v] - 2 * sum[lca];
        Q[0][v].push_back({{c, d}, i});
        Q[0][u].push_back({{c, d}, i});
        Q[1][lca].push_back({{c, d}, i});
    }
    DFSCalc(1);
    for (ll i = 1; i <= q; i++) printf("%lld\n", ans[i]);
    return 0;
}


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

typedef long long ll;

int main()
{

    int N, a, b; cin >> N;
    vector<ll> A, B;
    for(int i=0;i<N;i++) {
        cin >> a >> b;
        A.push_back(a); B.push_back(b);
    }
    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    ll X, Y;
    if (N % 2 == 1) {
        X = A[N/2];
        Y = B[N/2];
    } else {
        X = A[N/2 - 1] + A[N/2];
        Y = B[N/2 - 1] + B[N/2];
    }

    cout << Y-X+1 << endl;


}


Measured memory_bytes: 6572
using System;

namespace Question2
{
    class Program
    {
        public const int ARRAY_AB = 2;

        static void Main(string[] args)
        {
            int ab;
            string[] readStr;

            readStr = Console.ReadLine().Split(' ');
            ab = int.Parse(readStr[0] + readStr[1]);


            for(int i = 1; (i*i) <= ab; i++ )
            {
                if (i*i == ab)
                {
                    Console.WriteLine("Yes");
                    return;
                }
            }

            Console.WriteLine("No");

        }
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
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; }

//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int N, ga, sa, ba, gb, sb, bb;
	cin >> N >> ga >> sa >> ba >> gb >> sb >> bb;

	int dp[N + 1];
	eREP(i, N)dp[i] = i;
	//i個ドングリを見て何個に増やせるか

	eFOR(i, 1, N) {
		if (i - ga >= 0)chmax(dp[i], dp[i - ga] + gb);
		if (i - sa >= 0)chmax(dp[i], dp[i - sa] + sb);
		if (i - ba >= 0)chmax(dp[i], dp[i - ba] + bb);
	}
	//cout << dp[N] << endl;
	int M = dp[N];
	int dp2[M];
	eREP(i, M)dp2[i] = i;
	//cout << M << endl;
	eFOR(i, 1, M) {
		if (i - gb >= 0)chmax(dp2[i], dp2[i - gb] + ga);
		if (i - sb >= 0)chmax(dp2[i], dp2[i - sb] + sa);
		if (i - bb >= 0)chmax(dp2[i], dp2[i - bb] + ba);
	}
	cout << dp2[M] << endl;



	return 0;
}



Measured memory_bytes: 195584
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  

#pragma warning(disable:4996)  
#pragma comment(linker, "/STACK:336777216")  
using namespace std;

#define mp make_pair  
#define Fi first  
#define Se second  
#define pb(x) push_back(x)  
#define szz(x) ((int)(x).size())  
#define rep(i, n) for(int i=0;i<n;i++)  
#define all(x) (x).begin(), (x).end()  
#define ldb ldouble  

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 19;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;

int main() {
	int N;
	scanf("%d", &N);
	if (N == 0) return !printf("0\n");

	vector <int> Vl;
	while (N) {
		if (N % 2) Vl.push_back(1);
		else Vl.push_back(0);
		N -= Vl.back();
		N /= -2;
	}
	reverse(all(Vl));
	for (auto it : Vl) printf("%d", it);
	return !printf("\n");
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1 {
    class Program {
        static int lower_bound(List<int> a, int num)
        {
            int ng = -1, ok = a.Count();
            while (Math.Abs(ok - ng) > 1)
            {
                int mid = (ng + ok) / 2;
                if (a[mid] < num) ng = mid;
                else ok = mid;
            }
            return ok;
        }
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            var d = Console.ReadLine().Split().Select(int.Parse).OrderByDescending(x => x).ToArray();
            List<int> a = new List<int>();
            for (int i = 0; i < d.Length; ++i) a.Add(d[i]);
            a.Sort();

            int ans = 0;
            for(int i = 0; i < n; ++i)
            {
                for(int j = i + 1; j < n; ++j)
                {
                    ans += lower_bound(a, a[i] + a[j]) - j - 1;
                }
            }

            Console.WriteLine(ans);
            //Console.ReadKey();
        }
    }
}


Measured memory_bytes: 13508
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		// 得点カウント
		int player1Score = 0, player2Score = 0;

		// 勝負の回数(カード枚数)
		int round = Integer.parseInt(sc.nextLine());

		for (int i = 0; i < round; i++) {
			String[] cards = sc.nextLine().split("[\\s]+");
			// あいこの場合はお互いに+1
			if (cards[0].equals(cards[1])) {
				player1Score++;
				player2Score++;
				// player1,player2の順で勝利判定に渡す
			} else if (VictoryDecision(cards[0], cards[1])) {
				player1Score += 3;
			} else {
				player2Score += 3;
			}

		}

		// 出力
		System.out.println(player1Score + " " + player2Score);

	}

	// 勝利判定
	static boolean VictoryDecision(String str1, String str2) {
		// 文字列が短いほうにループ回数と勝利フラグをあわせる
		int looplimit = str1.length();
		boolean Victoryflag = false;
		if (str1.length() > str2.length()) {
			looplimit = str2.length();
			Victoryflag = true;
		}
		for (int i = 0; i < looplimit; i++) {
			if (str1.charAt(i) == str2.charAt(i)) {
				continue;
			} else {
				// 違う文字が出た場合文字のアルファベット順で判定
				return CharDecision(str1.charAt(i), str2.charAt(i));
			}
		}
		return Victoryflag;
	}

	// 1文字の判定
	static boolean CharDecision(char a, char b) {
		if ((int) a > (int) b) {
			return true;
		} else {
			return false;
		}
	}

}



Measured memory_bytes: 33200
#include "stdio.h"
#include "algorithm"

int n,i,j;
int a[105];

int main(){

	scanf("%d",&n);
	for(i = 0; i < n; i++){
		scanf("%d",&a[i]);
	}
	std::sort(a,a+n);
	int v;
	if(a[n-1]!=a[n-2]) printf("Impossible\n");
	else{
		//printf("IN1\n");
		n -= 2;
		v = a[n];
		for(i = 1; i < v; i++){
			int d = std::max(i,v-i);
			for(j = 0; j < n; j++){
				if(a[j]==d){
					a[j] = -1;
					break;
				}
			}
			if(j==n) break;
		}

		if(i!=v) printf("Impossible\n");
		else{
			//printf("IN2\n");
			for(i = 0; i < n; i++){
				if(a[i]!=-1&&a[i]<v/2+v%2+1) break;
			}
			if(i!=n) printf("Impossible\n");
			else printf("Possible\n");
		}
	}
}

Measured memory_bytes: 128
/*
Character Drawing Adapted from FAKEUPDATE.NET
		   _    _____         _
		   \`,""   ,'7"r-..__/ \
		  ,'\ `, ,',','    _/   \
		 /   \, 7 / /     (   \ |
		J     \/ j  L______\  / |
		L   __JF"""/""\"\_,    /
		L,-"| O|  f O |  L_  _/
		F   \_ /  \__/   `-  j|
			.-'    `"""    ,' |          _..====.._
			\__/         r"_  A        ,' _..---.._`,
			 `-.______,,-L// / \  ___,' ,'_..:::.. `,`,
					  j   / / / 7"    `-<""=:'  '':. \ \
					 /   <,' /  F  . i , \   `,    :T W I
					 |    \,'  /    >X<  |     \   :| | L
					 |     `._/    ' ! ` |      I  :| |  G
					  \           \     /       |  :H T  |
					 __>-.__   __,-\   |        |  S P   |
					/     /|   | \  \  \_       | 'A R   |
				   /   __/ |   |  L  L   \      K./ /    L
				  /   |    |   4  I  I    |    E./ /   ,'
				 J    \    I    L F  I    |    // / _,'
		_________|     |   F    |J   F    |   //_/-'
		\   __   |    /   J     |/  J     |  /="
		\\  \_\  \__,' \  F     |   F     |
		\\\_____________\/      F__/      F
		 \\| 计算机编程 |_____/  (______/
		  \/从入门到入土/
*/
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
#include <sstream>
#include <set>
#include <queue>
#include <stack>
#include <cctype>
#include <map>
#include <climits>
#include <bitset>
#include <functional>
using namespace std;
#define MATH_PI 3.14159265358979323846
int main(){
	ios::sync_with_stdio(false);
	vector<int> arrHouse;
	int nCount, iTemp;
	cin >> nCount;
	while (nCount--){
		cin >> iTemp;
		arrHouse.push_back(iTemp);
	}
	cout << *max_element(arrHouse.begin(), arrHouse.end()) - *min_element(arrHouse.begin(), arrHouse.end()) << endl;
endapp:
	//system("pause > nul");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//<(") 
#define ll long long   
using namespace std;
 
typedef pair<ll, ll> ii;
typedef pair<ii, ii> iii;
 
const ll mod = 1e9 + 7;
const ll siz = 1e3 + 10;
const ll base = 32;
const ll MAXX = 1e18;

ll n, m;
char hold[siz][siz];
ll cap[siz][siz], flow[siz][siz];
ll s, t;

vector<ll> graph[siz];

void setup() {
	for (ll i = 1; i <= n; i++) {
		for (ll j = 1; j <= m; j++) {
			//cerr << hold[i][j] << ' ';
			if (hold[i][j] == 'S') {
				graph[s].push_back(i);
				graph[i].push_back(s);
				cap[s][i] = MAXX;
				graph[s].push_back(j + n);
				graph[j + n].push_back(s);
				cap[s][j + n] = MAXX;
				//cerr << 'S' << ' ' << s << ' ' << i << '\n';
				//cerr << 'S' << ' ' << i << ' ' << j + n << '\n';
			}
			else if (hold[i][j] == 'T') {
				graph[j + n].push_back(t);
				graph[t].push_back(j);
				cap[j + n][t] = MAXX;
				graph[i].push_back(t);
				graph[t].push_back(i);
				cap[i][t] = MAXX;
				//cerr << 'T' << ' ' << j << ' ' << t << '\n';
				//cerr << 'T' << ' ' << i << ' ' << j + n << '\n';
			}
			else if (hold[i][j] == 'o') {
				graph[i].push_back(j + n);
				graph[j + n].push_back(i);
				cap[i][j + n] = 1;
				cap[j + n][i] = 1;
				//cerr << 'o' << ' ' << i << ' ' << j + n << '\n';
				//cerr << 'o' << ' ' << j + n << ' ' << i << '\n';
			}
		}
		//cerr << '\n';
	}
}

ll d[siz];

bool findAns() {
	queue<ll> nxt;
	nxt.push(s);
	for (ll i = 1; i <= t; i++) {
		d[i] = 0;
	}
	d[s] = MAXX;
	while (!nxt.empty()) {
		ll u = nxt.front();
		nxt.pop();
		if (u == t) {	
			return true;
		}
		for (ll i = 0; i < (int)graph[u].size(); i++) {
			ll v = graph[u][i];
			if (d[v] == 0 && cap[u][v] > flow[u][v]) {
				d[v] = u;
				nxt.push(v);
			}
		}
	}
	return false;
}

void rev() {
	ll u, del = MAXX;
	for (ll i = t; (u = d[i]) != MAXX; i = u) {
		del = min(del, cap[u][i] - flow[u][i]);
	}
	for (ll i = t; i != s; i = u) {
		u = d[i];
		flow[u][i] += del;
		flow[i][u] -= del;
	}
}

ll getAns() {
	ll ans = 0;
	for (ll i = 0; i < (int)graph[s].size(); i++) {
		ll v = graph[s][i];
		ans += flow[s][v];
	}
	return ans;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	//freopen("INP.txt", "r", stdin);
	//freopen("OUT.txt", "w", stdout);
	cin >> n >> m;
	s = n + m + 1, t = n + m + 2;
	for (ll i = 1; i <= n; i++) {
		string s;
		cin >> s;
		s = ' ' + s;
		for (ll j = 1; j <= m; j++) {
			hold[i][j] = s[j];
		}
	}
	setup();
	while (findAns()) {
		rev();
	}
	// for (ll i = 1; i <= t; i++) {
		// for (ll j = 0; j < graph[i].size(); j++) {
			// ll v = graph[i][j];
			// cerr << i << ' ' << v << ' ' << flow[i][v] << '\n'; 
		// }
	// }
	ll need = getAns();
	if (need > n * m) {
		cout << -1 << '\n';
	}
	else {
		cout << need << '\n';
	}
	return 0;
} 

Measured memory_bytes: 5712
#include <iostream>

using namespace std;

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

int main()
{
    long long int a = 0;
    long long int b = 0;
    long long int GCD = 0;
    long long int LCM = 0;
    
    while (cin >> a >> b)
    {
        if (a < b)
        {
            long long int tmp = a;
            a = b;
            b = tmp;
        }
        
        GCD = gcd(a, b);
        LCM = a / GCD * b;
        
        cout << GCD << " " << LCM << endl;
    }
    
    return 0;
}



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

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

    bool ans[1000] = {};
    while (n != 0) {
        int bit;
      	long long sum;
        if (n > 0) {
            sum = 0b01;
            for (bit = 0; n > sum; bit += 2) sum = (sum << 2) | 0b01;
            n -= (1 << bit);
        } else {
            sum = 0b10;
            for (bit = 0; abs(n) > sum; bit += 2) sum = (sum << 2) | 0b10;
            bit++;
            n -= -1 * (1 << bit);
        }
        ans[bit] = true;
    }

    int i = 1000 - 1;
    while (ans[i] == false && i > 0) i--;
    for (; i >= 0; i--) cout << (ans[i] ? 1 : 0);
    cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cmath>
#include <iomanip>
using namespace std;
 
#define f first
#define s second
 
#define pb push_back
#define pp pop_back
#define mp make_pair
 
#define sz(x) (int)x.size()
#define sqr(x) ((x) * 1ll * (x))
#define all(x) x.begin(), x.end()
#define clr(a,v) memset(a, v, sizeof(a))
 
#define rep(i, l, r) for (int i = (l); i <= (r); i++)
#define per(i, l, r) for (int i = (l); i >= (r); i--)
#define reflex ios_base::sync_with_stdio(false)
 
#define nl '\n'
#define ioi exit(0);
 
 
#define PI 3.14159265
 
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
 
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
//~ const int N= (int)2e5 + 7;
const int inf = (int)1e9 + 7;
const int mod = (int)1e9 + 7;
//const int mod = 1000000007;
const ll linf = (ll)1e18 + 7;
 
const int dx[] = {-1, 0, 1, 0, 1, -1, -1, 1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int kx[] = {-1,1,2,2,1,-1,-2,-2};
const int ky[] = {2,2,1,-1,-2,-2,-1,1};



int main(){
	string s; cin>> s;
	if(s[2] == s[3] && s[4] == s[5])
		cout<<"Yes";
	else
		cout<<"No";

    return 0;
}
	


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <list>
#include <stack>
#include <string>
#include <functional>
#include <numeric>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
using namespace std;
#define INT_MAX 2147483647
#define INT_MIN (-2147483647 - 1)
#define INF (int)1e8
#define _INF (int)-1e8
#define INFLL (long long)1e14
#define _INFLL (long long)-1e14
#define Loop(i, n) for(int i = 0; i < (int)n; i++)
#define Loop1(i, n) for(int i = 1; i <= (int)n; i++)
#define Loopr(i, n) for(int i = (int)n - 1; i >= 0; i--)
#define Loopr1(i, n) for(int i = (int)n; i >= 1; i--)
#define bitmanip(m,val) static_cast<bitset<(int)m>>(val)
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> P;

class Range_Query {
private:
	struct segdata_t {
		int val;
	};
	int n;
	vector<segdata_t> seg;
	void update_rule(int k) {
		int l = k * 2 + 1, r = k * 2 + 2;
		seg[k].val = min(seg[l].val, seg[r].val);
	}
	int find_rule(int s, int t, int l, int r, int k) {
		if (s == l&&t == r) return seg[k].val;
		else {
			int mid = (l + r) / 2;
			if (s < mid&&mid < t) {
				int result1 = find_rule(s, mid, l, mid, k * 2 + 1);
				int result2 = find_rule(mid, t, mid, r, k * 2 + 2);
				return min(result1, result2);
			}
			else if (s < mid) {
				return find_rule(s, t, l, mid, k * 2 + 1);
			}
			else if (mid < t) {
				return find_rule(s, t, mid, r, k * 2 + 2);
			}
		}
	}
public:
	Range_Query(int N, vi a) {
		n = (int)pow(2, ceil(log2(N)));
		seg.resize(n * 2 - 1);
		Loop(i, N) {
			seg[n - 1 + i].val = a[i];
		}
		Loop(i, n - N) {
			seg[n - 1 + N + i].val = INT_MAX;
		}
		Loopr(i, n - 1) {
			update_rule(i);
		}
	}
	void update(int k, int x){
		k += n - 1;
		seg[k].val = x;
		while (k > 0) {
			k = (k - 1) / 2;
			update_rule(k);
		}
	}
	int fnd(int s, int t) {
		return find_rule(s, t, 0, n, 0);
	}
};


int main() {
	int n, m;
	cin >> n >> m;
	vi a(n, INT_MAX);
	Range_Query rq(n, a);
	Loop(i, m) {
		int c, x, y; cin >> c >> x >> y;
		if (c == 0) {
			rq.update(x, y);
		}
		else {
			cout << rq.fnd(x, y + 1) << endl;
		}
	}
	return 0;
}

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

int main()
{
  ll n;
  cin >> n;
  vector<ll> v;
  rep(n){
    ll tmp;
    cin >> tmp;
    v.push_back(tmp);
  }
  sort(v.begin(),v.end());
  double tmp = (v[0]+v[1])/2.0;
  for (ll i = 2; i < n; i++)
  {
    tmp = (tmp+v[i])/2.0;
  }
  printf("%.16f",tmp);
  return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<iostream>
# define ll int64_t
# define rep(i,n) for(ll i=0;i<n;i++)
# define rrep(i,n) for(ll i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define mod 1000000007
# define vec vector
#define dump(x) cerr<<#x<<"="<<x<<endl
using namespace std;

bool compare_by_b(pair<string,ll> a,pair<string,ll> b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

bool my_compare(pair<string,ll> a,pair<string,ll> b){
    
    if(a.first != b.first) return a.first<b.first;
    if(a.second != b.second) return a.second>b.second;
    else return true;
}

ll factorial(ll n){
    ll x=1;
    rrep(i,n) (x*=i)%=mod;
    return x;
}

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

ll lcm(ll a,ll b)
{
   return a/gcd(a,b)*b;
}

//累乗だってさ
ll modpow(ll a,ll n,ll mod1) {
    ll res=1;
    while(n>0){
        if(n&1) res=res*a%mod1;
        a = a*a%mod1;
        n >>= 1;
    }
    return res;
}
//逆元だってさ
ll modinv(ll a,ll mod1) {
    return modpow(a, mod1 - 2, mod1);
}


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n;
    cin>>n;
    vec<ll> num(n+10,0);
    rep(i,n-1){
        ll a;
        cin>>a;
        num[a]++;
    }
    rrep(i,n){
        cout<<num[i]<<endl;
    }
    return 0;
}


Measured memory_bytes: 4768
//T1 

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int a, b, k;
    cin >> a >> b >> k;
    int imax = max(a, b);
    int cnt = 0;
    for(int i = imax; i >= 1; --i)
    {
        if(a % i == 0 && b % i == 0)
            cnt++;
        if(cnt == k)
        {
            cout << i;
            break;
        }
    }
    return 0;
}


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


void solve(long long a, long long b){
    if(a <= b) cout << a << endl;
    else cout << a - 1 << endl;
}

int main(){
    long long a;
    scanf("%lld",&a);
    long long b;
    scanf("%lld",&b);
    solve(a, b);
    return 0;
}


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

#define rep(i, n) for(long long i=0;i<(long long)(n);i++)
#define rep2(i, s, n) for(long long i=(s);i<(long long)(n);i++)
#define repi(i, n) for(int i=0;i<(int)(n);i++)
#define rep2i(i, s, n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define chmax(s, t) s=max(s,t);
#define chmin(s, t) s=min(s,t); 

#define deg2rad(deg) (((deg)/360)*2*M_PI)
#define rad2deg(rad) (((rad)/2/M_PI)*360)

using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;

const ll INF = (1LL<<60);
const int INFi = (1<<29);

/*素数判定*/
bool is_prime(ll n){
    if(n==1) return false;
    for(ll i=2;i*i<=n;i++){
        if(n%i==0) return false;
    }
    return true;
}

/*約数列挙*/
vll enum_divisors(ll n){
    vll l;
    for(ll i=1;i*i<=n;i++){
        if(n%i==0){
            l.push_back(i);
            if(n/i != i) l.push_back(n/i);
        }
    }
   sort(all(l));
   return l;
}

/*素因数分解*/
vector<P> prime_factorize(ll n){
    vector<P> l;
    for(ll i=2;i*i<=n;i++){
        if(n%i!=0) continue;
        ll e = 0;
        while(n%i==0){
            e++;
            n /= i;
        }
        l.push_back({i, e});
    }
    if(n!=1) l.push_back({n, 1});
    return l;
}

/*最小公倍数*/
ll lcm(ll a, ll b){
    return a*b/__gcd(a,b);
}

/*最大公約数*/
ll gcd(ll a, ll b){
    return __gcd(a,b);
}

/*組み合わせ(Combination)*/
const ll CMAX = 1010000;
const ll CMOD = 1e9+7;
ll fac[CMAX], finv[CMAX], inv[CMAX];
// テーブルを作る前処理
void combinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (ll i = 2; i < CMAX; i++) {
		fac[i] = fac[i - 1] * i % CMOD;
		inv[i] = CMOD - inv[CMOD%i] * (CMOD / i) % CMOD;
		finv[i] = finv[i - 1] * inv[i] % CMOD;
	}
}
// 二項係数計算
ll comb(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % CMOD) % CMOD;
}

/*階乗*/
ll factorial(ll n){
    const ll FMOD = 1e9+7;
    ll ret = n;
    for(ll i=n-1;i>0;i--){
        ret*=i;
        ret%=FMOD;
    }
    return (ret?ret:1);
}


int main(){

    ll n; cin >> n;
    vll p(n); rep(i, n) cin >> p[i];

    ll ans = 0;
    rep2(i, 1, n-1){
        if(max(max(p[i-1],p[i+1]), p[i]) != p[i] && min(min(p[i-1], p[i+1]), p[i]) != p[i]) ans++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
 
using namespace std;
 
#define FOR(i, n) for(int i = 0; i < (int) n; i++)
#define rall(x) x.rbegin(), x.rend()
#define all(x) x.begin(), x.end()
#define PB push_back
#define F first
#define S second
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
 
const ll MOD = 1e9+7;
const ll INF = 1e9+10;

int main(){
	ios::sync_with_stdio(false); cin.tie(0);
 
	int n, m, x; cin >> n >> m >> x;
	vi c(n);
	vector<vi> plus(n, vi(m));
	FOR(i, n){
		cin >> c[i];
		FOR(j, m)
			cin >> plus[i][j];
	}


	int ans = INF;
	for(int i = 1; i < (1<<n); i++){
		vi aux(m, 0);
		int cost = 0;
		for(int j = 0; j < n; j++){
			if((1<<j)&i){
				cost+=c[j];
				FOR(p, m)
					aux[p]+=plus[j][p];
			}
		}
		bool ok = true;
		FOR(j, m){
			if(aux[j] < x) ok = false;
		}
		if(ok){
			ans = min(ans, cost);
		}
	}

	if(ans == INF) cout << "-1\n";
	else cout << ans << '\n';

	return 0;
}

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


int main() {
    string s;
    cin >> s;
    int ans;
    vector<bool> a(26, false);
    rep(i, s.size()) {
        a.at(s.at(i) - 'a') = true;
    } 
    rep(i, 26) {
        if (!a.at(i)) {
            ans = i;
            goto last;
        }
    }
    cout << "None" << endl;
    return 0;
    last:
    cout << (char)('a' + ans) << endl;
}

Measured memory_bytes: 512
use std::io::stdin;
use std::str::FromStr;
#[allow(dead_code, unused_mut)]
fn read<T: FromStr>() -> T {
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    s.trim().parse().ok().expect("1")
}
#[allow(dead_code, unused_mut)]
fn read_vec<T: FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().expect("2"))
        .collect()
}
#[allow(dead_code, unused_mut)]
fn read_two<T: FromStr>() -> (T, T) {
    let mut s = String::new();
    stdin().read_line(&mut s).unwrap();
    let mut x = s.split_whitespace().map(|x| x.parse().ok().unwrap());
    (x.next().unwrap(), x.next().unwrap())
}
#[allow(dead_code, unused_mut)]
fn read_three<T: FromStr>() -> (T, T, T) {
    let mut s = String::new();
    stdin().read_line(&mut s).unwrap();
    let mut x = s.split_whitespace().map(|x| x.parse().ok().unwrap());
    (x.next().unwrap(), x.next().unwrap(), x.next().unwrap())
}
#[allow(dead_code)]
fn remove_whitespace(s: &str) -> String {
    s.chars().filter(|c| !c.is_whitespace()).collect()
}

#[allow(unused_imports)]
use std::io::{stdout, Write};
#[allow(unused_imports)]
use std::collections::HashMap;
fn gcd(mut x: u64, mut y: u64) -> u64 {
    let mut z = x;
    let mut gcd_num = x;
    while z != 0 {
        gcd_num = z;
        z = y % x;
        y = x;
        x = z;
    }
    gcd_num
}
fn main() {
    let n = read::<i32>();
    let mut a = [0; 4];
    for i in 0..n {
        let s = read::<String>();
        if s == "AC" {
            a[0] += 1;
        } else if s == "WA" {
            a[1] += 1;
        } else if s == "TLE" {
            a[2] += 1;
        } else {
            a[3] += 1;
        }
    }
    println!("AC x {}", a[0]);
    println!("WA x {}", a[1]);
    println!("TLE x {}", a[2]);
    println!("RE x {}", a[3]);
}

Measured memory_bytes: 2144
#define MOD_TYPE 1

#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
/*
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
using multiInt = boost::multiprecision::cpp_int;
using lld = boost::multiprecision::cpp_dec_float_100;
*/
/*
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
*/
using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

constexpr ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
//constexpr ll MOD = 1;
constexpr int INF = (int)1e9 + 10;
constexpr ll LINF = (ll)4e18;
constexpr double PI = acos(-1.0);
constexpr double EPS = 1e-11;
constexpr int Dx[] = {0, 0, -1, 1, -1, 1, -1, 1, 0};
constexpr int Dy[] = {1, -1, 0, 0, -1, -1, 1, 1, 0};

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define REPI(i, m, n) for (int i = m; i < (int)(n); ++i)
#define repi(i, n) REPI(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << "\n"
#define Yes(n) cout << ((n) ? "Yes" : "No") << "\n"
#define possible(n) cout << ((n) ? "possible" : "impossible") << "\n"
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << "\n"
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << "\n"
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << "\n";

inline void init_main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(30) << setiosflags(ios::fixed);
}
template <typename T>
inline bool chmin(T &a, T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
inline bool chmax(T &a, T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
inline ll CEIL(ll a, ll b)
{
  return (a + b - 1) / b;
}
template <typename A, size_t N, typename T>
inline void Fill(A (&array)[N], const T &val)
{
  fill((T *)array, (T *)(array + N), val);
}
template <typename T, typename U>
constexpr istream &operator>>(istream &is, pair<T, U> &p) noexcept
{
  is >> p.first >> p.second;
  return is;
}
template <typename T, typename U>
constexpr ostream &operator<<(ostream &os, pair<T, U> &p) noexcept
{
  os << p.first << " " << p.second;
  return os;
}
#pragma endregion

void solve()
{
  int n, m;
  cin >> n >> m;
  ll k;
  cin >> k;
  vector<ll> a(n), b(m);
  rep(i, n) cin >> a[i];
  rep(i, m) cin >> b[i];
  ll csuma[200010], csumb[200010];
  csuma[0] = csumb[0] = 0;
  rep(i, n + 1) csuma[i + 1] = a[i] + csuma[i];
  rep(i, m + 1) csumb[i + 1] = b[i] + csumb[i];

  ll Max = 0;
  rep(i, n + 1)
  {
    if (csuma[i] > k)
      break;
    ll r = k - csuma[i];

    int lo = -1, hi = m + 1;
    while (hi - lo > 1)
    {
      int mi = (lo + hi) / 2;
      if (r - csumb[mi] >= 0)
        lo = mi;
      else
        hi = mi;
    }
    chmax(Max, i + lo);
  }
  cout << Max << "\n";
}

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


Measured memory_bytes: 9532
import java.io.*;
import java.math.*;
import java.util.*;
public class Main { 
 
	public static void main(String[] args) { 
		Scanner input = new Scanner(System.in);
		String S = input.next();
		String ans = "No";
		if (S.charAt(0)!=S.charAt(1)&&S.charAt(1)!=S.charAt(2)&&S.charAt(0)!=S.charAt(2)) {
			ans="Yes";
		}
		System.out.println(ans);
	}	
}

Measured memory_bytes: 22612