akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    string s;
    cin >> s;
    if(s[2] == s[3] && s[4] == s[5]) {
        output("Yes");
    }
    else output("No");
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    long n,k;
    cin >> n >> k;
    long a[n];
    for(int i=0;i<n;i++)cin >> a[i];
    for(int i=0;i<k;i++){
        vector<int>s(n);
        for(int j=0;j<n;j++){
            s[max(0L,j-a[j])]++;
            if(j+a[j]+1 <= n-1)s[j+a[j]+1]--;
        }
        bool chk = true;
        a[0] = s[0];
        if(a[0] != n)chk=false;
        for(int j=1;j<n;j++){
            a[j] = a[j-1] + s[j];
            if(a[j] != n)chk=false;
        }
        if(chk)break;
    }


    for(int i=0;i<n;i++){
        cout << a[i] << " ";
    }
    cout << endl;
}

Measured memory_bytes: 5964
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
/*
1 x x x 5
1 3 5 7 5
7 x x 6 4-5
7 2 6 6 OUT
7-6=1
1/4=0
1/5=0
xが奇数ならOKだった

1 x x 5 4-6
4/6=0
4/4=1
2-1=1 OK
繰り返しに至れるか
最低値と最高値で何回でいたるか
普通に全探索N通りでいけるじゃん
*/
int main(){
  ll N,A,B,C,D; cin>>N>>A>>B>>C>>D;
  for(int i=0; i<N; i++){//最大をとる回数
    ll cnt=N-i-1;
    ll high=D*i-C*cnt;
    ll low=C*i-D*cnt;
    if(B-A<=high && B-A>=low){
      cout<<"YES"<<endl;
      return 0;
    }
  }
  cout<<"NO"<<endl;
}

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

using namespace std;

#define ll long long
#define endl '\n'
const int N = 1e5 + 5;
int main(){
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        if (fopen("A.inp", "r")){
                freopen("test.inp", "r", stdin);
                freopen("test.out", "w", stdout);
        }
        ll a, b, c, d;
        cin >> a >> b >> c >> d;
        cout << max(a * c, max(a * d, max(b * c, b * d)));
}
/*
*/


Measured memory_bytes: 3584
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main()
{
    string S;
    
    cin >> S;
    
    int length = S.length();
    
    int count = 0;
    for(int i=0; i<length/2; i++)
    {
        if(S[i] != S[length-i-1]){
            count++;
        }
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <array>
#include <string>
#include <queue>
#include <cmath>
#include <iterator>
 
using namespace std;
using lli = long long int;
 
int main(void){
    vector <int> N; 
    int roop;
    int A=0;
    int stk;
    cin >> roop;
    for(int i=0;i<roop;i++){
        cin >> stk;
        N.push_back(stk);
    }
    while(1){
        for(int i=0;i<roop;i++){
            if(N[i] % 2 == 0){
                N[i]/=2;
            }else{
                cout << A << endl;
                return 0;
            }
        }
        A++;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
	int n; cin >> n;
	int wv[n+10];
	for(int i = 0; i < n; i++){
		int w;cin >> w;
		wv[i] = w; 
	}

	int ls = 0;
	int mins = 1e9;
	for(int i = 0; i < n; i++){
		int rs = 0;
		ls += wv[i];
		for(int j = i+1; j < n; j++){
			rs += wv[j];
		}
		mins = min(mins, abs(ls - rs));
	}
	cout << mins << endl;
}

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

//--------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX/3

//--------------------------------------------
const double EPS = 1e-14;
const double PI  = acos(-1.0);

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

int main(){
  int k, t;

  scanf("%d %d",&k, &t);

  vector<int> v;
  int a;

  REP (i, t) {
    scanf("%d",&a);
    v.push_back(a);
  }

  sort(v.begin(), v.end());

  int sum = 0;
  REP (i, t - 1) sum += v.at(i);
  printf("%d\n", max(0, v.at(t - 1) - sum - 1));
}


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

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> h(n + k);
  for (int i = k; i < n + k; i++) cin >> h.at(i);
  for (int i = 0; i < k; i++) h.at(i) = h.at(k);
  vector<int> dp(n + k, 2000000000);
  for (int i = 0; i < k; i++) dp.at(i) = 0;
  for (int i = k; i < n + k; i++) {
    for (int j = 1; j <= k; j++) {
      dp.at(i) = min(dp.at(i), dp.at(i - j) + abs(h.at(i) - h.at(i - j)));
    }
  }
  cout << dp.at(n + k - 1) << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
#define sz(x) (int)(x).size()
/* --- */
const int N = 100010;
int x[N], y[N], t[N], id[N], n;

int manDist (int i, int j) {
	return abs(x[i] - x[j]) + abs(y[i] - y[j]);
}

bool can() {
	for (int i = 1; i <= n; i++) {
		int k = manDist(i - 1, i);
		int d = t[i] - t[i - 1];
		if (k > d || (d - k) % 2 == 1) return false;
	}
	return true;
}

int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)
		scanf("%d%d%d", &t[i], &x[i], &y[i]);
	t[0] = x[0] = y[0] = 0;
	printf("%s\n", can() ? "Yes" : "No");
}



Measured memory_bytes: 1408
import sys
input=sys.stdin.readline
n,q=map(int,input().split())

BIT=[0]*n
def ADD(x,y):#A[x]+=y,1-origin
	while x<=n:
		BIT[x-1]+=y
		x+=x&(-x)
def SUM(l):#1からlまでの和
	if l==0:
		return 0
	ret=0
	while l>=1:
		ret+=BIT[l-1]
		l-=l&(-l)
	return ret

IN=list(map(int,input().split()))
for i in range(n):
	ADD(i+1,IN[i])

for i in range(q):
	t,a,b=map(int,input().split())
	if t==0:
		ADD(a+1,b)
	else:
		print(SUM(b)-SUM(a))

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

int main(){
    int A,B,C,D;
    cin>>A>>B>>C>>D;
    while(A>0&&B>0){
        A-=D;
        C-=B;
    }
    if(A<=0&&C<=0){
        cout<<"Yes"<<endl;
    }else if(A<=0){
        cout<<"No"<<endl;
    }else if(C<=0){
        cout<<"Yes"<<endl;
    }
}

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

int main() {
    int a;
    cin >> a;
    cout << a + a * a + a * a * a;

    return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
#define ll long long int 
using namespace std;
int main()
{
    
    string s;
    cin>>s;
    ll l=s.length(),c=0;
    for(ll i=0;i<l;i++)
    {
        c+=(s[i]-'0');
    }
    if(c%9==0)
        cout<<"Yes\n";
    else cout<<"No\n";
    return 0;
}

Measured memory_bytes: 3692
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
typedef long long ll;
const ll MOD=1000000007;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }

int l,n,i,j;
string s[100];
int main(void){
    // Your code here!
    for(cin >> n >> l;i<n;i++) cin >> s[i];
    for(sort(s,s+n);j<n;j++) cout <<s[j];
    cout << endl;

}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
	long long n,k;
	scanf("%lld %lld", &n, &k);

		n = n%k;
		long long temp = n-k;
		if(temp<0) temp *= -1;
		if(temp<n) printf("%lld\n", temp);
		else printf("%lld\n", n);

}

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

// クラス利用部 (main 関数)
int main(){

int sl,sk;
cin >>   sl >> sk;

if(sl>sk)
cout << "No"<< endl;
else
cout << "Yes"<< endl;



//printf("%c", (sl[0]+1));



}

Measured memory_bytes: 256
// 以下のソースを勉強する.
// zscoder氏.
// https://atcoder.jp/contests/dp/submissions/3939310
#include <bits/stdc++.h>
using namespace std;

int a[111111];
int dp[111111];

int main(){

    // 1. 入力情報取得.
    int N, K;
    scanf("%d %d", &N, &K);
    for(int i = 0; i < N; i++) scanf("%d", &a[i]);
    
    // 2. dp更新.
    for(int i = 1; i <= K; i++){
        for(int j = 0; j < N; j++) if(i - a[j] >= 0 && dp[i - a[j]] == 0) dp[i] = 1;
    }
    // for(int i = 0; i <= K; ++i) printf("%d ", dp[i]);
    // printf("\n");
    
    // 3. 出力.
    if(dp[K] == 1) printf("%s\n", "First");
    else           printf("%s\n", "Second");
    return 0;

}

Measured memory_bytes: 640
import itertools
import heapq
n,m = [int(i) for i in input().split()]
a = [[int(i) for i in input().split()] for j in range(n)]
ans = 0
c = [0,1]
for l,j,k in itertools.product(c,repeat=3):
    ans = max(ans,sum(heapq.nlargest(m,([a[i][0]*(-1)**l+a[i][1]*(-1)**j+a[i][2]*(-1)**k for i in range(n)]))))
print(ans)

Measured memory_bytes: 3444
#include <bits/stdc++.h>
#define re return
#define pb push_back
#define po pop_back
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
#define ss second.second
#define sf second.first
#define ff first.first
#define fs first.second
#define si size
#define sqrt(x) sqrt(abs(x))
#define mp make_pair
#define pi 3.14159265359
#define er erase
#define in insert
#define em empty
#define ft front
#define fo(i,n) for(i = 0; i < n; i++)
#define ro(i,n) for(i = n - 1; i >= 0; i--)
#define fr(i,j,n) for(i = j; i < n; i++)
#define rf(i,j,n) for(i=n-1;i>=j;i--)
typedef std::vector<int> vi;
typedef std::vector<vi> vvi;
typedef std::pair<int,int> ii;
typedef std::vector<ii> vii;
typedef std::vector<std::string> vs;
typedef double dl;
typedef long double ld;
typedef long long ll;
typedef std::pair<ll, ll> pll;
typedef std::vector<ll> vll;
#define filename ""
using namespace std;

int main()
{
    /*
	freopen(filename".in","r",stdin);
	freopen(filename".out","w",stdout);
	*/
	/*
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	*/
    int n,i,t,x=0,y=0,a,b,s,q=0;
    cin>>n;
    fo(i,n)
    {
        scanf("%d%d%d",&t,&a,&b);
        s=abs(a-x)+abs(y-b);
        s=t-s-q;
        if (s<0||s%2)
        {
            cout<<"No\n";
            re 0;
        }
        x=a;
        y=b;
        q=t;
    }
    cout<<"Yes\n";
    re 0;
}


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

#include <cstdio>
#include <cmath>


using namespace std;

int main(){
  int N, D;
  cin >> N >> D;
  vector<vector<int> > X(N);
  for(int i = 0; i < N; i++)
    X[i].resize(D);


  for(int i = 0; i < N; i++){
    for(int j = 0; j < D; j++){
      cin >> X[i][j];
    }
  }

  int count = 0;
  for(int i = 0; i < N; i++){
    for(int j = i+1; j < N; j++){
      long distance = 0;
      for(int d = 0; d < D; d++){
        distance += pow(X[i][d]-X[j][d], 2);
      }

      long dist = sqrt(distance);
      if(dist*dist == distance)
        count++;
    }
  }

  cout << count << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
	char	*s = (char *)malloc(27);
	int		i = 0;
	int		j;
	s[0] = '\0';
	scanf("%s",s);  
	while(s[i]!='\0')
	{
		j=i+1;
		while(s[j] != '\0')
		{
			if (s[i] == s[j])
			{
				printf("no");
				return (0);
			}
			j++;
		}
		i++;
	}
	printf("yes");
  return (0);
}

Measured memory_bytes: 1724
n = int(input())
k = list(map(int,input().split()))
ans = 1
if 0 in k:
  ans = 0
for i in range(n):
  if ans == 0:
    break
  ans *= k[i]
  if ans > 10**18:
    ans = -1
    break
  
print(ans)


Measured memory_bytes: 21640
#include <stdio.h>

int main(void)
{
    int a,b,t;
    int i;
    int count=0;
    scanf("%d %d %d",&a,&b,&t);

    for(i=1;i<=t;i++){
        if(i%a==0){
            count+=b;
        }
    }

    printf("%d\n",count);

    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,M;cin>>N>>M;
  vector<int> a(N);
  vector<int> b(N);
  vector<int> c(M);
  vector<int> d(M);
  for(int i=0; i<N; i++)cin>>a[i]>>b[i];
  for(int i=0; i<M; i++)cin>>c[i]>>d[i];
  for(int i=0; i<N; i++){
    vector<pair<int,int>> h(M);
    
    for(int j=0; j<M; j++){
      h[j]=make_pair(abs(a[i]-c[j])+abs(b[i]-d[j]),j);
    }
    sort(h.begin(),h.end());
    cout<<h[0].second+1<<endl;
    
  }
}

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

int main(void){
  int n;
  long int a,ans=0;
  scanf("%d",&n);
  
  for(int i = 0; i < n ; i++){
    scanf("%lld",&a);
    while(a%2 == 0){
      a /= 2;
      ans++;
    }
  }
  printf("%lld\n",ans);
}

Measured memory_bytes: 128
fun main(args: Array<String>) {
    val n = readLine()?.toInt() ?: 0

    var current = Pair(0, 0)
    var now = 0
    var ans = "Yes"
    for (_i in 0 until n) {
        val input = readLine()!!.split(" ").map(String::toInt)
        if (ans == "No") {
            continue
        }
        val d = Math.abs(current.first - input[1]) + Math.abs(current.second - input[2])
        val t = (input[0] - now) % d
        if (t == 3 || t == 0) {
            current = Pair(input[1], input[2])
        } else {
            ans = "No"
        }
        now = input[0]
    }
    println(ans)
}


Measured memory_bytes: 57352
<?php 
fscanf(STDIN, "%d", $n);

$flag = 0;
for ($i=1; $i < 10; $i++) {
  if ($n/$i<=9 && $n%$i==0) {
    echo "Yes";
    $flag = 1;
    break;
  }
}
if ($flag == 0) {
  echo "No";
}

 ?>

Measured memory_bytes: 3576
N,M = map(int,input().split())
AC = N*[0]
WA = N*[0]

for m in range(M):
  P,S = input().split()
  P = int(P)-1
  
  if AC[P]==1:
    continue
  if S=="WA":
    WA[P]+=1
  else:
    AC[P]=1

wa = 0 
for a,w in zip(AC,WA):
  wa+=w*a

print(sum(AC),wa)

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

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

int n, m;
string s, t;
int dp[3030][3030];
bool vis[3030][3030];
int solve(int a, int b) {
    if (a == n || b == m) return 0;
    if (vis[a][b]) return dp[a][b];
    vis[a][b] = true;
    int ans = max(solve(a+1, b), solve(a, b+1));
    if (s[a] == t[b]) ans = max(ans, 1 + solve(a+1, b+1));
    return dp[a][b] = ans;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> s >> t;
    n = int(s.size());
    m = int(t.size());
    int u = solve(0, 0);
    int a = 0, b = 0;
    string ans;
    while (u) {
        if (a < n && solve(a + 1, b) == u) {
            a++;
            continue;
        }
        if (b < m && solve(a, b + 1) == u) {
            b++;
            continue;
        }
        ans += s[a];
        u--; a++; b++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 45184
n,m = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
x = [0]
mod = m
for i in range(n):
    x.append((a[i]+x[i])%mod)
ans = 0
from collections import Counter
c = dict(Counter(x))
for i in c.values():
    ans += i*(i-1)//2
print(ans)

Measured memory_bytes: 63768
/* ex4_2
   masaaki52	*/

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

int main(void){
  double hlen,mlen,hour,minute,rad,len;
  scanf("%la %la %la %la",&hlen,&mlen,&hour,&minute);//それぞれの変数に値を入力
  rad = M_PI * (hour/6 - minute * 11/360);//長針と短針の成す角を計算
  len = sqrt(pow(hlen,2) + pow(mlen,2) -2*hlen*mlen*cos(rad));//余弦定理で端点同士の距離を計算
  printf("%.10f\n",len);//結果を出力
  return 0;
}

Measured memory_bytes: 2620
#include <iostream>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <cmath>
#include <map>
using namespace std;
long long INF = 1000000009;
map<int, int> mp;
int main()
{
	ios::sync_with_stdio(false);
	int n, m;
	cin >> n;
	vector<string> blue(n);
	for (int i = 0; i < n; i++) cin >> blue[i];
	cin >> m;
	vector<string> red(m);
	for (int i = 0; i < m; i++) cin >> red[i];
	int ans = 0;
	auto calc = [&](string s) {
		int buf = 0;
		for (string t : blue) {
			if (t == s) buf++;
		}
		for (string t : red) {
			if (t == s) buf--;
		}
		return buf;
	};
	for (string t: blue) {
		ans = max(ans, calc(t));
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
/* Coached by rainboy */
#include <stdio.h>

#define N 200000

int main() {
	static int aa[N + 1], bb[N];
	int n, m, i, j;

	scanf("%d", &n);
	for (i = 1; i <= n; i++)
		scanf("%d", &aa[i]);
	for (i = n; i >= 1; i--)
		for (j = i + i; j <= n; j += i)
			aa[i] ^= aa[j];
	m = 0;
	for (i = 1; i <= n; i++)
		if (aa[i] == 1)
			bb[m++] = i;
	printf("%d\n", m);
	for (i = 0; i < m; i++)
		printf("%d ", bb[i]);
	printf("\n");
	return 0;
}


Measured memory_bytes: 2176
#include <iostream>
#include <string>
#include <sstream>
#define repo(i,n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;

int main(){

    int N;
    cin >> N;

    std::ostringstream oss;

    oss << N;
    string str = oss.str();
    for(int i = 0; i < 3; i++){
        if(str[i]== '7'){
            cout << "Yes" << endl;        
            return 0;
        }

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



Measured memory_bytes: 3636
from itertools import permutations
lst = [int(input()) for _ in range(5)]
lst_per = list(permutations(lst))
min_time = 643
for x in lst_per:
    ttl_time = 0
    for i in range(len(x)):
        if i != 4:
            ttl_time += x[i]
            if ttl_time % 10 != 0:
                ttl_time = (ttl_time // 10 + 1) * 10
        else:
            ttl_time += x[i]
    if ttl_time < min_time:
        min_time = ttl_time

print(min_time)

Measured memory_bytes: 3060
#include<stdio.h>
#include<vector>
#include<queue>
using namespace std;
vector<int> G[100001];
int dis[2][100001];
void bfs(int j,int start)
{
	dis[j][start]=1;
	int now,i;
	queue<int> q;
	q.push(start);
	while(!q.empty())
	{
		now=q.front();
		q.pop();
		for(i=0;i<G[now].size();i++)
		{
			if(dis[j][G[now][i]]==0)
			{
				dis[j][G[now][i]]=dis[j][now]+1;
				q.push(G[now][i]);
			}
		}
	}
}
int main()
{
	int n,i,j,s,e;
	scanf("%d",&n);
	for(i=1;i<n;i++)
	{
		scanf("%d%d",&s,&e);
		G[s].push_back(e);
		G[e].push_back(s);
	}
	bfs(0,1);
	bfs(1,n);
	s=0,e=0;
	for(i=1;i<=n;i++)
	{
		if(dis[0][i]<=dis[1][i])
			s++;
		else
			e++;
	}
	if(s>e)
		printf("Fennec");
	else
		printf("Snuke");
	return 0;
}

Measured memory_bytes: 6656
#include <bits/stdc++.h>
using namespace std;
/// Typedef
typedef long long           ll;
typedef vector<int>         vi;
typedef pair<int,int>       pii;

#define pb                  push_back
#define ppb                 pop_back
#define MP                  make_pair
#define ff                  first
#define ss                  second
#define sf                  scanf
#define pf                  printf
#define SQR(x)              ((x)*(x))
#define loop(i, y)          for(int i=0; i<int(y); i++)
#define FOR(i, x, y)        for(int i=int(x); i<int(y); i++)
#define ROF(i, x, y)        for(int i=int(x); i>=int(y); i--)
#define all(c)              c.begin(), c.end()
#define sz(c)               int(c.size())
#define clr(x, y)           memset(x, y, sizeof(x))
#define si(x)               scanf("%d", &x)
#define sii(x, y)           scanf("%d %d", &x, &y)
#define siii(x, y, z)       scanf("%d %d %d", &x, &y, &z)
#define sl(x)               scanf("%lld", &x)
#define sll(x, y)           scanf("%lld %lld", &x, &y)
#define slll(x, y, z)       scanf("%lld %lld %lld", &x, &y, &z)

#ifdef VAMP
     #define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template < typename Arg1 >
    void __f(const char* name, Arg1&& arg1){
        cout << name << " = " << arg1 << std::endl;
    }
    template < typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names+1, ',');
        cout.write(names, comma - names) << " = " << arg1 <<" | ";
        __f(comma+1, args...);
    }
#else
    #define debug(...)
#endif
///******************************************START******************************************

/// Constants
#define MAX                 200005
#define MOD                 1000000007
#define eps                 1e-9
#define INF                 0x3f3f3f3f3f3f3f3f // 4,557,430,888,798,830,399
#define inf                 0x3f3f3f3f // 1,061,109,567
#define PI                  acos(-1.0)  // 3.1415926535897932
#define VT                  int

int main(){
    #ifdef VAMP
        clock_t tStart = clock();
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    ll a, b; sll(a, b);
    ll c = __gcd(a, b);
    ll res = 1;
    for(ll i = 2; i * i <= c; i++){
        if(c%i == 0){
            res++;
            while(c%i==0) c/=i;
        }
    }
    if(c>1) res++;
    cout<<res<<endl;


    #ifdef VAMP
        fprintf(stderr, "\n>> Runtime: %.10fs\n", (double) (clock() - tStart) / CLOCKS_PER_SEC);
    #endif
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> VI;
typedef pair <int,int> ii;
typedef long long LL;
#define pb push_back
const int INF = 2147483647;

int n, i, x[55], y[55], res, j;
set<int> s, s2;

int get(int a, int b) {
	int i, res;
	s.clear();
	for (i=0;i<n;i++) s.insert(i);
	res = 0;
	while (s.size() > 0) {
		s2.clear();
		s2.insert(*s.begin());
		s.erase(s.begin());
		int ind = 0;
		while (true) {
			ind = -1;
			for (auto &w : s) for (auto& w2 : s2) {
				if ((x[w] - x[w2] == a && y[w] - y[w2] == b) || (x[w2] - x[w] == a && y[w2] - y[w] == b)) ind = w;
			}
			if (ind == -1) break;
			s.erase(ind);
			s2.insert(ind);
		}
		res++;
	}
	return res;		
}

int main() {
scanf("%d", &n);
for (i=0;i<n;i++) scanf("%d %d", &x[i], &y[i]);
if (n == 1) {
	printf("1\n");
	return 0;
}
res = INF;
for (i=0;i<n;i++) for (j=i+1;j<n;j++) res = min(res, get(x[j] - x[i], y[j] - y[i]));
printf("%d\n", res);
return 0;
}

Measured memory_bytes: 256
s = input()
x = set()
y = [chr(i) for i in range(97, 97+26)]
for i in s:
    x.add(i)
x = list(x)
for i in x:
    y.remove(i)
if len(y) == 0:
    print("None")
else:
    print(y[0])

Measured memory_bytes: 3188
import sys
input = sys.stdin.readline
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
RB = B[::-1]

start = v = -1
seq = 0
for i,(a,b) in enumerate(zip(A,RB)):
    if a==b:
        v = a
        seq += 1
        if start == -1:
            start = i

if v == -1:
    print('Yes')
    print(*RB)
    exit()

if A.count(v) + B.count(v) > N:
    print('No')
    exit()

from bisect import bisect_left,bisect
al = bisect_left(A,v)
bl = bisect_left(B,v)
br = bisect(B,v)
rbl = N - br

m = min(seq,start,al,rbl)
RB[:m],RB[start:start+m] = RB[start:start+m],RB[:m]
seq -= m
start += m
if seq:
    RB[start:start+seq],RB[-seq:] = RB[-seq:],RB[start:start+seq]

assert all(a!=b for a,b in zip(A,RB))
print('Yes')
print(*RB)

Measured memory_bytes: 41604
import java.io.*;
import java.math.*;
import java.util.*;
 
public class Main {
    private static boolean debug = false;
    private static boolean elapsed = false;
 
    private static PrintWriter _out = new PrintWriter(System.out);
    private static PrintWriter _err = new PrintWriter(System.err);
 
    private void solve(Scanner sc) {
        int N = sc.nextInt();
        Map<Long, Integer> map = new HashMap<>();
        for (int i = 0; i < N; ++i) {
            long A = sc.nextInt();
            Integer cnt = map.get(A);
            if (cnt == null) {
                cnt = 0;
            }
            map.put(A, cnt + 1);
        }
 
        if (map.size() % 2 == 0) {
            _out.println((map.size() - 1));
        } else {
            _out.println(map.size());
        }
    }
    private static BigInteger C(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        for (long i = r; i > 1; --i) {
            res = res.divide(BigInteger.valueOf(i));
        }
        return res;
    }
    private static BigInteger P(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        return res;
    }
    /*
     * 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9
     * 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18
     */
    public static void main(String[] args) {
        long S = System.currentTimeMillis();
 
        Scanner sc = new Scanner(System.in);
        new Main().solve(sc);
        _out.flush();
 
        long G = System.currentTimeMillis();
        if (elapsed) {
            _err.println((G - S) + "ms");
        }
        _err.flush();
    }
}

Measured memory_bytes: 65216
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
int main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	string a,b,c;
	cin>>a>>b;
	int n,m;
	cin>>n>>m;
	cin>>c;
	if(c==a){
		n--;
		cout<<n<<' '<<m<<endl;
	}else{
		m--;
		cout<<n<<' '<<m<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.ArrayList;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		ArrayList<Integer>  ls1 = new ArrayList() ;
		int A = sc.nextInt();
		int B = sc.nextInt();
		int T = (A+B) % 24;
		System.out.println(T);
	}

}


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

int main() {
  int64_t X, Y;
  cin >> X >> Y;
  int ans =0;
  if(X>Y){
    if(X*Y>0){
      ans += X-Y+2;
    }

    else ans += max(X, -Y)-min(X, -Y)+1;
  }
  else{
    if(X*Y>=0){
      ans += Y-X;
    }

    else ans += max(-X, Y)-min(-X, Y)+1;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
#define int long long
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;

const int MXN = 100, MXK = 100000;
const int MOD = 1000000000 + 7;
int dp[MXN+1][MXK+2];
int a[MXN+1];
int n,k;


// dp[ i ][ k ] = no of ways of distributed k candy amonges firt i people
int32_t main()
{
   IOS
   memset(dp,0,sizeof(dp));
   cin >> n >> k;
   dp[0][0]=1;
   for(int i=0;i<n;i++)
   {
	   int x;cin>>x;
	   for(int j=0;j<=MXK;j++)
	   {
		   int dx=min(k-j,x);
		   if( dx < 0 )continue;
		   dp[i+1][j]+=dp[i][j];
		   dp[i+1][j+dx+1]-=dp[i][j];
	   }
	   for(int j=1;j<=MXK;j++)
	   {
		   dp[i+1][j]+=dp[i+1][j-1];
		   dp[i+1][j]%=MOD;
		   if(dp[i+1][j]<0)
		   dp[i+1][j]+=MOD;
	   }
   }
   cout<< dp[n][k] << endl;
}


Measured memory_bytes: 79232
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
void solution(){
    ll n,k;
    cin>>n>>k;
    ll counter =0;
    while(n > 0){
        counter++;
        n = n/k;
    }
    cout<<counter;
}
int main(){
        ios_base::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
        cerr.tie(0);
        /*ll t;
        cin>>t;
        while(t--)*/
        solution();
        return 0;
}

Measured memory_bytes: 3568
loop.with_index do |_, k|
  n = gets.to_i
  break if n == 0
  p = []
  n.times{ p << gets.split.map(&:to_f) }
  n.times{ |i| p[i] += p[(i+1) % n] }
  s = p.map{ |x0, x1, y0, y1| x1*y0 - x0*y1 }.inject(:+) / 2
  puts "#{k+1} %.1f" % s
  gets
end

Measured memory_bytes: 8808
#include<bits/stdc++.h>
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
using namespace std;
long long s,a1,a2,a3,b1,b2,b3;
signed main(){
//	freopen(".inp","r",stdin);
//	freopen(".out","w",stdout);
	scanf("%lld",&s);
	a1=b1=0;
	a2=1e9;
	b2=1;
	b3=(s-1)/a2+1;
	a3=b3*a2-s;
	printf("%lld %lld %lld %lld %lld %lld",a1,b1,a2,b2,a3,b3);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < (int)(b); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int x, y;
    cin >> x >> y;
    rep(i, 0, 200) {
        rep(j, 0, 200) {
            int sum1 = i + j;
            int sum2 = 2 * i + 4 * j;
            if (sum1 == x && sum2 == y) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3632
n,k,q =map(int,input().split())
a = [int(input()) for _ in range(q)]

point = [0]*n

for i in range(q):
    point[a[i]-1] += 1


for i in range(n):
    if point[i]>= q-k+1:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 13612
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)

template<int MV> class UndirectedEulerPath {
public:
	vector<int> path;
	multiset<int> E[MV];
	void add_path(int x, int y) { E[x].insert(y); E[y].insert(x); }

	void dfs(int cur) {
		while (E[cur].size()) {
			int tar = *E[cur].begin();
			E[cur].erase(E[cur].begin());
			E[tar].erase(E[tar].find(cur));
			dfs(tar);
		}
		path.push_back(cur);
	}

	bool GetPath() {
		int fo = -1, odd = 0, i, np = 0;
		rep(i, 0, MV) {
			np += E[i].size();
			if (E[i].size() % 2) odd++, fo = (fo == -1) ? i : fo;
		}
		if (odd != 0 && odd != 2) return false;
		dfs(odd ? fo : 0);
		reverse(path.begin(), path.end());
		return path.size() == np / 2 + 1;
	}
};
//-----------------------------------------------------------------
int main() {
	int a, b;
	while (cin >> a >> b) {
		UndirectedEulerPath<105> ep;
		ep.add_path(a, b);
		while (cin >> a >> b) {
			if (a == 0 && b == 0) break;
			ep.add_path(a, b);
		}

		if (ep.GetPath() && (ep.path.front() == 1 && ep.path.back() == 2))
			cout << "OK" << endl;
		else
			cout << "NG" << endl;
	}
}

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

#define rep(i,n) for (int i = 0; i < n; i++)

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

int main(){
  int H,W; cin >> H >> W;
  vector<string> s(H);
  rep(i, H) cin >> s[i];

  int l[H][W] = {}, r[H][W] = {}, u[H][W] = {}, d[H][W] = {};
  rep(h, H) rep(w, W){
    if(s[h][w] == '#') {l[h][w] = 0;u[h][w] = 0;}
    else{
      if(h == 0) u[h][w] = 1;
      else u[h][w] = u[h-1][w] + 1;
      if(w == 0) l[h][w] = 1;
      else l[h][w] = l[h][w-1] + 1;
    }
  }
  for (int h = H-1; h >= 0; h--) for(int w = W-1; w >= 0; w--){
    if(s[h][w] == '#') {r[h][w] = 0; d[h][w] = 0;}
    else{
      if(h == H-1) d[h][w] = 1;
      else d[h][w] = d[h+1][w] + 1;
      if(w == W-1) r[h][w] = 1;
      else r[h][w] = r[h][w+1] + 1;
    }
  }

  int ans = 0;
  rep(h, H) rep(w, W){
    chmax(ans,l[h][w]+r[h][w]+u[h][w]+d[h][w]-3);
  }
  std::cout << ans << '\n';
}


Measured memory_bytes: 66816
S=input()

for i in reversed(range(len(S) - 1)):
  if i % 2 == 1:
    moji1 = S[0:(i//2) + 1]
    moji2 = S[(i//2) + 1: i+ 1]
    
    if moji1==moji2:
      print(i+1)
      break


Measured memory_bytes: 2940
#include<iostream>
#include<vector>
#include<set>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<map>
#include<queue>
#include<iomanip>
#define INF 1e9
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using ll = long long;
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << "\t";
  }
  return s;
}

template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
  s << vv[i] << endl;
  }
  return s;
}

int d[3];
signed main(){
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  cin >> d[0] >> d[1] >> d[2];
  sort(d,d+3,greater<int>());
  cout << d[0] * 10 + d[1] + d[2] << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)

using lint = long long;
using plint = pair<double, lint>;

int N;
lint L;

array<plint, 500000> deq;
int s = 0;
int t = -1;

double Qsum = 0;
lint Vnow = 0;

void trim()
{
    while (Vnow > L)
    {
        lint nuku = min(Vnow - L, deq[s].second);
        deq[s].second -= nuku;
        Vnow -= nuku;
        Qsum -= nuku * deq[s].first;
        if (deq[s].second == 0) s++;
    }
}

void add(double tadd, lint vadd)
{
    if (deq[t].first < tadd) // 追加するほうが高温の場合、先頭から余剰分を抜いていく
    {
        t++; deq[t] = plint(tadd, vadd);
        Qsum += tadd * vadd;
        Vnow += vadd;
        trim();
    }
    else // 低温の場合、うしろとくっつけていく
    {
        if (deq[t].second + vadd >= L)
        {
            Qsum = deq[t].first * (L - vadd) + tadd * vadd;
            Vnow = L;
            s = 0, t = -1;
            t++; deq[t] = plint(Qsum / L, L);
        }
        else
        {
            double Qaddnew = deq[t].first * deq[t].second + tadd * vadd;
            lint vaddnew = deq[t].second + vadd;
            Qsum -= deq[t].first * deq[t].second;
            Vnow -= deq[t].second;
            t--;
            add(Qaddnew / vaddnew, vaddnew);
        }
    }
}

array<double, 500000> res;

int main()
{
    scanf("%d", &N);
    scanf("%lld", &L);
    REP(i, N)
    {
        double tmp;
        lint v;
        scanf("%lf %lld", &tmp, &v);

        if (i == 0)
        {
            t++; deq[t] = plint(tmp, v);
            Qsum = tmp * v;
            Vnow = v;
        }
        else add(tmp, v);

        res[i] = Qsum / L;
    }
    REP(i, N) printf("%.7f\n", res[i]);
}


Measured memory_bytes: 20736
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
int A, B, K;
int main() {
	std::cin >> A >> B >> K;
	for (int i = 0; i < K; i++) {
		if (A + i > B)break;
		std::cout << A + i << std::endl;
	}
	for (int i = K - 1; i >= 0; i--) {
		if (B - i < A + K)continue;
		std::cout << B - i << std::endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const long long mod=1000000000+7;
const long long INF=-mod;

//マクロ
//型エイリアス
using ll = long long;
using P=pair<long long,long long>;
using vl=vector<long long>;
//ショートカット
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,k,n) for(int i=k;i<n;i++) //半開区間
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
//入力
#define vin(v,N) for(long long i=0;i<N;i++) cin>>v.at(i)
#define lin(n) long long n;cin>>n
#define vlin(v,N) vector<long long>v(N);for(long long i=0;i<N;i++)cin>>v.at(i)

#define max(a,b) max((ll)a,(ll)b)
#define min(a,b) min((ll)a,(ll)b)

//関数
//最大公約数
long long gcd(long long m,long long n){
  long long a=max(m,n);
  long long b=min(m,n);
  long long r=a%b;
  while(r!=0){
    a=b; b=r; r=a%b;
  }
  return b;
}
// 最小公倍数
long long lcd(long long m,long long n){
  return m*n/gcd(m,n);
}
//xのn乗
long long power(long long x,long long N){
  long long ret=1;
  for(long long i=0;i<N;i++)   
    ret*=x;
  return ret;
}
//nCr
long long C(long long n, long long r);
//nCr (mod)
long long modC(long long n, long long r) {
    vector<long long> f(n+1),inv(n+1),invf(n+1);
    f[0]=f[1]=1;
    invf[0]=invf[1]=1;
    inv[1]=1;
    for (long long i=2;i<n+1;i++) {
        f[i]=(i*f[i-1])%mod;
        inv[i]=mod-((mod/i)*inv[mod%i])%mod;
        invf[i]=(inv[i]*invf[i-1])%mod;
    }
    long long cmb=f[n]*(invf[r]*invf[n-r]%mod)%mod;
    if (n>=r) return cmb;
    else return 0;
}
//素因数分解(mapで返す)
map<long long,long long> factor(long long p){
  ll p1=p;
  map<long long,long long>ret;
  for(long long i=2;i*i<=p1;i++){
     while(p%i==0){
      ret[i]++;
      p/=i;
    }
  }
  if(p!=1)
  ret[p]++;
  return ret;
}
//素数判定
bool is_prime(long long N){
  for(long long i=2;i*i<=N;i++){
    if(N%i==0)
      return false;
  }
  return true;
}
//最大値更新
void chmax(long long &a,long long b){
  a=max(a,b);
}
//最小値更新
void chmin(long long &a,long long b){
  a=min(a,b);
}
struct edge{
  ll to; ll cost;
};
using Graph=vector<vector<edge>>;

void dfs(Graph &G,vector<ll> &col, ll s, ll num){
  col[s]=num; 
  for(auto e:G[s]){
    if(col[e.to]==0){
      if(e.cost%2==0){
        dfs(G,col,e.to,num);
      }
      else{
        dfs(G,col,e.to,-num);
      }
    }
  }
  
  return;
}
  
//メイン関数
int main(){
  //doubleの桁数
  cout<<fixed<<setprecision(10);
  
  lin(N);
  Graph G(N);
  rep(i,N-1){
    lin(u);lin(v);lin(w); u--; v--;
    G[u].push_back({v,w});
    G[v].push_back({u,w});
  }
  
  vl res(N,0);
  
  dfs(G,res,0,1);
  
  rep(i,N){
    cout<<(res[i]+1)/2<<endl;
  }
}

Measured memory_bytes: 10752
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N,W;
    cin >> N>>W;
    int W1[100],V[100];
    for(int i=0;i<N;i++){
        cin>>W1[i]>>V[i];
    }
    long long dp[101][100001];
    for(int i=0;i<N+1;i++){
        if(i==0){
            for(int j=0;j<W+1;j++){
                dp[i][j]=0;
            }
        }
        else{
            int w=W1[i-1],v=V[i-1];
            for(int j=0;j<W+1;j++){
                int index=j-w;
                if(index<0){
                    dp[i][j]=dp[i-1][j];
                }
                else{
                    long long tmp=dp[i-1][j],tmp1=dp[i-1][index]+v;
                    if(tmp<tmp1){
                        dp[i][j]=tmp1;
                    }
                    else{
                        dp[i][j]=tmp;
                    }
                }
            }
        }
    }
    cout<<dp[N][W]<<endl;
    return 0;
}

Measured memory_bytes: 79104
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(){
    int N, K;
    cin >> N >> K;
    string S;
    cin >> S;

    vector<int> nums;
    if(S[0] == '0'){
        nums.push_back(0);
    }
    for(int i = 0; i < S.size();){
        int j = i;
        while(j < S.size() && S[j] == S[i]){
            j++;
        }
        nums.push_back(j - i);
        i = j;
    }
    if(S.back() == '0'){
        nums.push_back(0);
    }


    vector<int> sums((int)nums.size()+1, 0);
    for(int i = 0; i < nums.size(); i++){
        sums[i+1] = sums[i] + nums[i];
    }


    int ans = 0;
    for(int l = 0; l < sums.size(); l += 2) {
        int r = l+K*2+1;
        if(r >= sums.size()){
            r = (int)sums.size()-1;
        }
        ans = max(ans, sums[r]-sums[l]);
    }
    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 1272
#include <iostream>
using namespace std;
int main(){
  string s; cin >> s;
  string ans = "AC";
  
  if (s[0] != 'A') ans = "WA";
  
  int count = 0;
  for (int i = 1; i < s.size(); ++i) {
    if (isupper(s[i])) {
      if (i == 1 || i == s.size() - 1 || s[i] != 'C') ans = "WA";
      else count++;
    }
  }

  if(count != 1) ans = "WA";
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i= 0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const long long INF = 1LL << 60;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    ll d ;cin>>d;
    vector<ll> c(26);rep(i,26)cin>>c[i];
    vector<vector<ll>> s(d,vector<ll>(26));

    rep(i,d){
        rep(j,26){
            cin>>s[i][j];
        }
    }
     vector<ll> t(d);
     rep(i,d){
         ll dayans = 0;
         rep(j,26){
             if(dayans<s[i][j]){
                 dayans =max(dayans,s[i][j]);
                 t[i] =j+1;
             }

         }

     }
     rep(i,d){
         cout<<t[i]<<endl;
     }

}

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

using namespace std;
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)
  
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()
  
#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

typedef long double Real;
#define EPS 1e-13
#define EQ(x) (-EPS<x && x<EPS)
typedef complex<Real> P;
Real dot(P a,P b){return real(conj(a)*b);}
Real cross(P a,P b){return imag(conj(a)*b);}

#define MP make_pair<int,int>

ll score[4001];

int main(){
  while(true){
    int n;
    cin>>n;
    if(!n)break;
    REP(i,4001)score[i]=0;
    bool flag = true;
    REP(i,n){
      int id;
      ll val,num;
      cin>>id>>val>>num;
      score[id] += val*num;
      if(score[id]>=1000000ll){
        flag = false;
        cout<<id<<endl;
        score[id] = -1145141919810931;
      }
    }
    if(flag)cout<<"NA"<<endl;
  }
  return 0;
}

Measured memory_bytes: 1200
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using TP = tuple<ll,ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(18);
}
signed main(){
  init_io();
  ll x;
  cin >> x;
  cout << 10 - (x/200) << endl;
}


Measured memory_bytes: 3660
#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 mod 1000000007
typedef long long ll;

int main() {
    int n;cin>>n;
    string s,t;cin>>s>>t;
    bool jdg=false;
    int ans;

    for (int i=n;i<2*n;i++) {
        if(s.substr(i-n,2*n-i)==t.substr(0,2*n-i)){
            jdg=true;
            ans=2*n-(2*n-i);
            break;
        }
    }
    if(jdg){
        cout<<ans<<endl;
    }
    else {
        cout<<2*n<<endl;
    }
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
using ll=long long;
template<class T=ll>inline T in(istream&is=cin){T ret;is>>ret;return ret;}
template<class T,class Size=typename vector<T>::size_type>inline auto vector_2d(Size h,Size w,T v){return vector<vector<T>>(h,vector<T>(w,v));}
template<class RandomAccessIterator,class Pair=typename iterator_traits<RandomAccessIterator>::value_type>inline void sort_pairs_by_second(RandomAccessIterator first,RandomAccessIterator last){sort(first,last,[](const Pair&p1,const Pair&p2){return p1.second<p2.second||(p1.second==p2.second&&p1.first<p2.first);});}

int main()
{
    ll h=in(),w=in(),m=in();
    set<pair<ll,ll>>bomb;
    map<ll,ll>row_cnt,col_cnt;
    ll max_row=-1,max_col=-1;
    for(ll i=0;i<m;++i){
        ll y=in(),x=in();
        bomb.emplace(y,x);
        max_row=max(max_row,++row_cnt[y]);
        max_col=max(max_col,++col_cnt[x]);
    }
    set<ll>max_rows,max_cols;
    //cout<<max_row<<' '<<max_col<<endl;
    for(auto r:row_cnt){
        if(r.second==max_row)max_rows.insert(r.first);
    }
    for(auto c:col_cnt){
        if(c.second==max_col)max_cols.insert(c.first);
    }
    //sort(max_rows.begin(),max_rows.end());
    //sort(max_cols.begin(),max_cols.end());
    ll p=max_rows.size()*max_cols.size();
    //cout<<p<<endl;
    for(auto b:bomb){
        //if(binary_search(max_rows.begin(),max_rows.end(),b.first)&&binary_search(max_cols.begin(),max_cols.end(),b.second))--p;
        if(max_rows.count(b.first)&&max_cols.count(b.second))--p;
    }
    cout<<max_row+max_col+(p==0?-1:0)<<endl;
}


Measured memory_bytes: 87856
#include <bits/stdc++.h>
using namespace std;
using Int = int_fast64_t;

Int n;
using P = pair<Int, Int>;
vector<P> v;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> n;
	for(Int i=0; i<n; ++i){
		Int a; cin >> a;
		v.push_back(P(a, i));
	}
	sort(v.begin(), v.end());
	for(Int i=0; i<n; ++i)
		cout << v[i].second+1 << " \n"[i+1==n];
}

Measured memory_bytes: 2544
# coding: utf-8
# Your code here!

# r, g, b = map(int, input().split())
r, g, b = input().split()

# print(r)
# print(g)
# print(b)

# print(int(r + g + b))

if int(r + g + b) % 4 == 0:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 2940
#include <stdio.h>
#include <string.h>
char s[20];
int main(){
	int len,i;
	scanf("%s",s);
	len=strlen(s);
	for(i=0;i<len;i++)
		if(i%2==0){
			if(s[i]!='h'){
				printf("No\n");
				return 0;
			}
		}else if(i%2){
			if(s[i]!='i'){
				printf("No\n");
				return 0;
			}	
		}
	if(len%2)printf("No\n");
	else printf("Yes\n");
	return 0;
}

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

int main(void) {
    // insert code here...
    int A;
    int B;
    int C;
    cin >> A >> B >> C;
    if(A + B + 1 >= C){
        cout << B + C << endl;
    }else{
        cout << 2*B + A + 1 << endl;
    }
    
    return 0;
}


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

#define pi 3.141592654
#define fix(n) cout << fixed << setprecision(n)

#define rep(i,a,b) for(int i=a;i<b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)

#define si(d)  scanf("%d",&d)
#define sll(d) scanf("%lld",&d)
#define pin(d) printf("%d\n",d)
#define pln(d) printf("%lld\n",d)
#define nl 	   printf("\n")

#define ll long long
#define ull unsigned long long

#define mp make_pair
#define pb push_back
#define fi first
#define se second

#define chalne_de continue
int mod=1000000007;
const int N = 1000005;

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

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	ll  a , b , c ;
	cin >> a >> b >> c;
	int cnt = 0;
	while ( cnt <= 1000000)
	{
		if ( a %2 !=0 || b %2 != 0 || c %2 != 0)
			break;
		ll  x = a / 2  ;
		ll y = b / 2 ;
		ll z = c / 2 ;
		a =  y + z ;
		b = x  +  z ;
		c = x + y ;
		cnt ++ ;
	}
	if ( cnt >= 1000000)
		cout << "-1";
	else
		cout << cnt ;
	return 0;
}


Measured memory_bytes: 384
n,m=map(int,input().split())
l=list(map(int,input().split()))
sum=0
for i in range(n):
  sum+=l[i]

d=sum//(4*m)
if sum//(4*m)!=sum/(4*m):
  d=d+1

ct=0
flag=0
for i in range(n):
  if l[i]>=d:
    ct+=1
  
  if ct>=m:
    flag=1
    break

if flag==1:
  print('Yes')
else:
  print('No')
  
  

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main{
	public static void main(String[] args)throws Exception {
		Scanner scan = new Scanner(System.in);
		int num1 = scan.nextInt();
		int num2 = scan.nextInt();
		String result = "";
		if(num1<num2) {
			for(int i = 0;i < num2;i++) {
				result += Integer.toString(num1);
			}
		}else if(num1 >= num2) {
			for(int i = 0;i < num1;i++) {
				result += Integer.toString(num2);
			}
		}
		System.out.println(result);
		scan.close();
	}
}

Measured memory_bytes: 27040