akhauriyash/Code-Regression huggingface dataset:
//Author: kaiyu
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <cstring>
#include <string>
#include <queue>
#include <stack>
#include <numeric>
#include <iomanip>
#include <climits>
using namespace std;
typedef long long ll;
#define sz(x) ((long long)(x).size())
#define all(x)  x.begin(),x.end()
#define endl "\n"
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define pii pair<int,int>
#define tt ll t;cin >> t;while(t--)
#define int3(x,y,z) ll x,y,z;cin >> x >> y >> z;
#define int2(x,y) ll x,y;cin >> x >>y;
#define int1(x) ll x;cin>>x;
#define  fio ios::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
ll power(ll a,ll b,ll m=mod){ ll ans=1; a=a%m;  while(b>0) {  if(b&1)  ans=(1ll*a*ans)%m; b>>=1;a=(1ll*a*a)%m;}return ans;}

ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}


bool cmp(pair<string,int>p1,pair<string,int>p2) {
    return p1.ss > p2.ss;
}

const int MAXN = 5 * 100000 + 10;

#define int long long

int32_t main() {
    fio
    string a;
    cin >> a;
    if(a == "ABC") {cout << "ARC" << endl;}
    else cout << "ABC" << endl;
}






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


int main() {
  int n;
  string s;
  cin >> n >> s;
  
  if (n%2 == 1) {
    cout << "No" <<endl;
    return 0;
  }
  string a = s.substr(0,n/2);
  string b = s.substr(n/2);
  if (a == b) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


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

int main() {
    int n;
    string s;
    cin >> s;
    n = s.size();
    vector<int> ans(n);
    
    rep(ri,2){
        int cnt = 0;
        rep(i,n){
            if(s[i]=='R'){
                cnt ++;
            }else{
                ans[i] += cnt/2;
                ans[i-1] += (cnt+1)/2;
                cnt = 0;
            }
        }
        reverse(ans.begin(),ans.end());
        reverse(s.begin(),s.end());
        rep(i,n){
            if(s[i]=='R') s[i]='L';
            else s[i]='R';
        }
    }
    
    rep(i,n) {
        cout << ans[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <utility>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>


using namespace std;

using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mkp(a,b) make_pair(a,b)
#define pbk(a) push_back(a)

int main() {
	ll n;
	cin >> n;
	ll cur = n;
	vector<ll> ps;

	for(ll i = 1; i * i <= n; i++) {
		if (cur % i == 0) {
			ps.pbk(i);
			ll another = n / i;
			if (another != i) {
				ps.pbk(n / i);
			}
		}
	} 
	ll ans = 0;
	for (ll p : ps) {
		ll cur = p - 1;
		if (cur <= 1) continue;
		if (n / cur == n % cur) {
			ans += cur;
		} 
	}
	cout << ans << endl;

	
	return 0;
}

Measured memory_bytes: 384
#include "bits/stdc++.h"
using namespace std;
#define int               long long
#define pb                push_back
#define ppb               pop_back
#define pf                push_front
#define ppf               pop_front
#define all(x)            (x).begin(),(x).end()
#define uniq(v)           (v).erase(unique(all(v)),(v).end())
#define sz(x)             (int)((x).size())
#define fr                first
#define sc                second
#define pii               pair<int,int>
#define rep(i,a,b)        for(int i=a;i<b;i++)
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
#define ppc               __builtin_popcount
#define ppcll             __builtin_popcountll

template<typename T1,typename T2>istream& operator>>(istream& in,pair<T1,T2> &a){in>>a.fr>>a.sc;return in;}
template<typename T1,typename T2>ostream& operator<<(ostream& out,pair<T1,T2> a){out<<a.fr<<" "<<a.sc;return out;}
template<typename T,typename T1>T amax(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T amin(T &a,T1 b){if(b<a)a=b;return a;}

const long long INF=1e18;
const int32_t M=1e9+7;
const int32_t MM=998244353;

const int N=0;



void solve(){
	string s;
	cin>>s;
	s.resize(4);
	if(s=="YAKI") cout<<"Yes";
	else cout<<"No";
}
signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	#ifdef SIEVE
		sieve();
	#endif
	#ifdef NCR
		init();
	#endif
	int t=1;
	//cin>>t;
	while(t--) solve();
	return 0;
}


Measured memory_bytes: 3544
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

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


	ll N;
	cin >> N;

	set<int> kotae;

	ll n = N - 1;
	int rt = sqrt(n);
	rep1(i, rt) {
		if (n % i == 0) {
			if(i != 1) kotae.insert(i);
			if (n / i != i) kotae.insert(n / i);
		}
	}
	rt = sqrt(N);
	rep1(i, rt) {
		if (N % i == 0) {
			if (i != 1) {
				ll tmp = N;
				while (tmp % i == 0) tmp /= i;
				if (tmp % i == 1) kotae.insert(i);
			}
			if (N / i != i) {
				ll tmp = N;
				while (tmp % (N / i) == 0) tmp /= (N / i);
				if (tmp % (N / i) == 1) kotae.insert(N / i);
			}
		}
	}

	int ans = kotae.size();
	co(ans);

	Would you please return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
int W,H,x,y,r;
   scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
   if(0 <= x <= W){
      if(0 <= y <= H){
         if(x+r <= W){
            if(0 <= x-r){
               if(y+r <= H){
                  if(0 <= y-r){
                     printf("Yes\n");
                  }else{
                     printf("No\n");
                  }
               }else{
                  printf("No\n");   
               }
            }else{
               printf("No\n");
            }
         }else{
            printf("No\n");
            }
      }else{
         printf("No\n");
      }
   }else{
      printf("No\n");
   }
return 0;
}


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

using namespace std;
typedef long long ll;
int n;
const int maxN = 5005;
int where[maxN];
int mn[maxN][maxN];
int p[maxN];
int a, b;
ll dp[maxN][maxN];
const ll INF = (ll)1e18;
int main() {
    //freopen("input.txt", "r", stdin);
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n >> a >> b;
    for (int i = 1; i <= n; i++) {
        cin >> p[i];
        where[p[i]] = i;
    }
    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= n; j++) {
            dp[i][j] = INF;
        }
    }
    dp[0][0] = 0;
    ll best = INF;
    for (int i = 0; i + 1 <= n; i++) {
        for (int j = 0; j <= n; j++) {
            if (dp[i][j] == INF) continue;
            if (p[i + 1] > j) {
                dp[i + 1][p[i + 1]] = min(dp[i + 1][p[i + 1]], dp[i][j]);
                dp[i + 1][j] = min(dp[i + 1][j], dp[i][j] + a);
            }
            else {
                dp[i + 1][j] = min(dp[i + 1][j], dp[i][j] + b);
            }
        }
    }
    for (int j = 0; j <= n; j++) {
        best = min(best, dp[n][j]);
    }
    cout << best;
    return 0;
}

Measured memory_bytes: 196864
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a; i< (int)(b); ++i)
#define ALL(x) (x).begin(),(x).end()
#define rALL(x) (x).rbegin(),(x).rend()
typedef long double ld;
using ll=long long;
using namespace std;
const int mod=1e9+7;
const ll inf = 1LL << 60;
const ld pi = (acos(-1));
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; }

float dis(vector<int> a,vector<int> b){
   float distance=0;
   for(int i=0;i<a.size();i++){
     distance+=(a[i]-b[i])*(a[i]-b[i]);
   }
   return distance;
}


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  
  int n; cin >> n;
  int ans=0;
  for(int i=1;i<=n;i+=2){
    int m=i;
    int res=0;
    rep(j,1,m+1){
      if(i%j==0)res++;
    }
    if(res==8) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <cstring>
#include <iomanip>
#include <algorithm>
#include <cmath>
using namespace std;

int main()
{
    int n,t,j,r,k;
    int tongji[30];
    int tongg1[30],tongg2[30];
    char s[105],ss[105],sss[105];
    int sum[105];
    while (cin >> n >> s)
    {
        for (int r=0;r<26;r++)
        {
            tongji[r]=(char)(r+97);
        }
        for (int i=0;i<26;i++)
        {
            tongg1[i]=0;
            tongg2[i]=0;
        }
        for (int i=1;i<n;i++)
        {
            sum[i]=0;
        }
        for (int i=1;i<n;i++)
        {
            for (int k=0;k<26;k++)
            {
            tongg1[k]=0;
            tongg2[k]=0;
            }
            for (j=0;j<i;j++)
            {
                ss[j]=s[j];
            }
            ss[j]='\0';
            int dd=n-j;
            for (k=0;k<dd;k++,j++)
            {
                sss[k]=s[j];
            }
            sss[k]='\0';
            for (r=0;r<26;r++)
            {
                for (int f=0;f<strlen(ss);f++)
                {
                    if (ss[f]==tongji[r]){tongg1[r]++;break;}
                }
                for (int f=0;f<strlen(sss);f++)
                {
                    if (sss[f]==tongji[r]){tongg2[r]++;break;}
                }
            }
            for (int r=0;r<26;r++)
            {
                if (tongg1[r]&&tongg2[r])
                    sum[i]++;
            }
        }
        int maxx=0;
        for (int i=1;i<n;i++)
        {
            if (sum[i]>maxx)maxx=sum[i];
        }
        cout << maxx <<endl;
    }
    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
        int n,i;

        scanf("%d",&n);

        int a[n];

        for(i=0;i<n;i++)
                scanf("%d",&a[i]);

        for (i = 0; i < n; i++) {
                if (a[i] % 2 == 0 && a[i] % 3 != 0 && a[i] % 5 != 0) {
                        printf("DENIED");
                        return 0;
                }
        }
        printf("APPROVED");
        return 0;
}


Measured memory_bytes: 128
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const char White = '.';
    const char Black = '#';
    const long Mod = 1000000007;

    static void Main(string[] args) {
        checked {
#if DEBUG
            MyDebugger.Test(process, "../TextFile1.txt");
            //TestCaseMaker.MakeTestCase1("../TextFile2.txt");
            //MyDebugger.Test(process, "../TextFile2.txt");
#else
            object ret = process(new StreamReader(Console.OpenStandardInput()));
            Console.WriteLine(ret);
#endif
        }
    }

    static object process(TextReader input) {
        var dic = new DefaultDectionary<string, int>(0);

        var n = int.Parse(input.ReadLine());
        for(int i=0; i<n; i++) {
            var s = input.ReadLine();
            dic[s]++;
        }

        Console.WriteLine("AC x " + dic["AC"]);
        Console.WriteLine("WA x " + dic["WA"]);
        Console.WriteLine("TLE x " + dic["TLE"]);
        Console.WriteLine("RE x " + dic["RE"]);

        return null;
    }

    class DefaultDectionary<Tkey, TValue> : Dictionary<Tkey, TValue>
    {
        TValue DefaultValue;
        public DefaultDectionary(TValue defaultvalue) {
            this.DefaultValue = defaultvalue;
        }
        public new TValue this[Tkey key] {
            get {
                if (this.ContainsKey(key)) return base[key];
                else return DefaultValue;
            }
            set {
                base[key] = value;
            }
        }
    }

    static int[] ToIntArray(string strs, int n) {
        var ret = new int[n];
        if (n == 0) return ret;
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = int.Parse(spl[i]);
        return ret;
    }
}


Measured memory_bytes: 30532
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;

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

    int a,b;
    while(cin >> a >>  b){
      if(a == b){
        cout << "Draw" << endl;
        return 0;
      }

      a = a == 1 ? a + 13 : a;
      b = b == 1 ? b + 13 : b;

      if(a > b){
        cout << "Alice" << endl;
      }else{
        cout << "Bob" << endl;
      }
      return 0;
    }
}


Measured memory_bytes: 888
# 高橋君は、英小文字から成る文字列 S を持っています。
# この S から始めて、ある与えられた手順に従って文字列を作ることにしました。
# 手順は Q 回の操作から成ります。操作 i(1≤i≤Q) では、まず整数 Ti が与えられます。
# Ti=1 のとき : 文字列 S の前後を反転する。
# Ti=2 のとき : 追加で整数 Fi と英小文字 Ci が与えられる。
# Fi=1 のとき : 文字列 S の先頭に Ci を追加する。
# Fi=2 のとき : 文字列 S の末尾に Ci を追加する。
# 高橋君のために、手順の後に最終的にできる文字列を求めてあげてください。

s = gets.chomp
t = String.new
q = gets.to_i

is_reverse = false
q.times do
    input = gets.chomp.split
    case input[0].to_i
    when 1
        is_reverse = !is_reverse
    when 2
        case input[1].to_i
        when 1
            case is_reverse
            when false
                t << input[2]
            when true
                s << input[2]
            end
        when 2
            case is_reverse
            when false
                s << input[2]
            when true
                t << input[2]
            end
        end
    end
end

case is_reverse
when false
    puts t.reverse + s
when true
    puts s.reverse + t
end

Measured memory_bytes: 2940
#include <cmath>
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<set>
#include<map>
#include<bitset>
#include<iomanip>
#include<stack>
#include<set>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll mod = 1000000007;

int main() {
	string s;
	cin >> s;
	if (s[s.size() - 1] == 's') {
		cout << s + "es" << endl;
	}
	else {
		cout << s + "s" << endl;
	}
	return 0;
}

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

int main()
{
  int a,b;
  cin >> a >>b;
  if(a > b){
    rep(i,a) cout << b;
  }
  else{
    rep(i,b) cout << a;
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<n; ++i)
#define rep1(i, n) for (int i=1; i<=n; ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
constexpr ll  MOD = (1e9+7);
constexpr int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
constexpr int lcm(int a, int b) { return a / gcd(a, b) * b; }

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
ll factorial(ll n, ll m=2) {
    // calculate n!
    m = max(2LL, m);
    ll rtn = 1;
    for (ll i=m; i<=n; i++) {
        rtn = (rtn * i) % MOD;
    }
    return rtn;
}
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
ll modpow(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1)
            res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> a(n);
    rep(i, n) {cin >> a[i]; a[i]--;}
    int now = 0, c = 0;
    for (;;) {
        if (now==1) {cout << c << endl; break;}
        if (c >= n) {cout << "-1" << endl; break;}
        now = a[now];
        c++;
    }
    return 0;
}

Measured memory_bytes: 640
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    from string import ascii_uppercase
    import bisect

    N, Q = map(int, readline().split())
    S = "*" + input()

    query = []
    for _ in range(Q):
        t, d = input().split()
        query.append([t, d])

    def judge(x):
        cur = x
        for t, d in query:
            if S[cur] == t:
                if d == "L":
                    cur -= 1
                else:
                    cur += 1
            if cur < 1:
                return -1
            if cur > N:
                return 1
        return 0

    def calc():
        l_ok = N + 1
        r_ok = 0

        l_ng = 0
        r_ng = N + 1

        # l_ok <= x <= r_ok
        # x <= l_ng, r_ng <= x

        while True:
            l_mid = (l_ok + l_ng) // 2
            r_mid = (r_ok + r_ng) // 2
            result = judge(l_mid)
            if result == -1:
                l_ng = max(l_ng, l_mid)
            elif result == 1:
                l_ok = l_mid
                r_ng = min(r_ng, l_mid)
            else:
                l_ok = min(l_ok, l_mid)
                r_ok = max(r_ok, l_mid)

            result = judge(r_mid)
            if result == -1:
                r_ok = r_mid
                l_ng = max(l_ng, r_mid)
            elif result == 1:
                r_ng = min(r_ng, r_mid)
            else:
                l_ok = min(l_ok, r_mid)
                r_ok = max(r_ok, r_mid)

            if l_ng + 1 == l_ok and r_ok + 1 == r_ng:
                return max(0, r_ok - l_ok + 1)
            if l_ng + 1 == r_ng:
                return 0

    print(calc())


if __name__ == '__main__':
    main()


Measured memory_bytes: 119556
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define pb push_back
#define F first
#define S second
#define vi vector<int>
#define pi pair<int, int>
#define vpi vector<pair<int, int>>
#define er(n) cout<<"error "<<n<<endl;
int mod=1000000007;

int32_t main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    int n, m;
    cin>>n>>m;
    n==m ? cout<<"Yes\n" : cout<<"No\n";
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
#solve
def solve():
    n, k = LI()
    a = LI()
    if k in a:
        print("POSSIBLE")
        return
    if max(a) < k:
        print("IMPOSSIBLE")
        return
    g = a[0]
    for ai in a:
        g = gcd(g, ai)
    if k % g != 0:
        print("IMPOSSIBLE")
    else:
        print("POSSIBLE")
    return


#main
if __name__ == '__main__':
    solve()


Measured memory_bytes: 58864
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define Rep(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll,vector<ll>,greater<ll>> SMALLPQ;
using vi=vector<ll>;
using vvi=vector<vector<ll>>;
using vc=vector<char>;
using vvc=vector<vector<char>>;
const int inf=1000000007;
const int mod=1000000007;
void chmin(auto &a,auto b){if(b<a)a=b;}
void chmax(auto &a,auto b){if(a<b)a=b;}
int main(){
  int n,k;cin>>n>>k;
  ll ans=k;
  vi used(n);
  vi c(n);
  vvi v(n);
  rep(i,n-1){
    int a,b;cin>>a>>b;a--;b--;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  queue<int> q;
  q.push(0);
  for(int x:v[0])used[x]++;
  while(!q.empty()){
    int a=q.front();q.pop();c[a]=1;
    for(int x:v[a]){
      if(c[x]==1)continue;
      q.push(x);
      for(int y:v[x])used[y]++;
      ans*=(k-used[a]);
      ans%=mod;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 11636
private data class Rev(val name: String, val score: Int, val index:Int)

fun main(args: Array<String>) {
    val n = readLine()!!.toInt()

    var data = mutableListOf<Rev>()
    for ( i in 0 until n) {
        val (name, score) = readLine()!!.split(" ")
        data.add(Rev(name, score.toInt(), i+1))
    }

    data.sortByDescending { it.score }
    data.sortBy { it.name }

    for (d in data) {
        println(d.index)
    }
}

Measured memory_bytes: 36324
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vll = vector<vector<ll>>;
using pii = pair<int,int>;
#define FOR(i,a,b) for(ll i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()
#define eb(val) emplace_back(val)
const double PI = acos(-1);
const double EPS = 1e-10;
const ll MOD = 1e9+7;
void cioacc(){//accelerate cin/cout
  cin.tie(0);
  ios::sync_with_stdio(false);
}
int main(){
  vi a(4);
  REP(i,4) cin >> a[i];
  sort(ALL(a));
  vi b = {1,4,7,9};
  cout << (a==b?"YES":"NO") << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <bitset>

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

using namespace std;

int main() {
	int H, W;
	cin >> H >> W;

	vector<vector<char>> a(H, vector<char>(W));
	rep(i, H) {
		rep(j, W) {
			cin >> a[i][j];
		}
	}

	for (int i = 0; i < H + 2; i++) {
		for (int j = 0; j < W + 2; j++) {
			if (i == 0 || i == H + 1 || j == 0 || j == W + 1) printf("#");
			else printf("%c", a[i - 1][j - 1]);
		}
		printf("\n");
	}
}




Measured memory_bytes: 3572
#include <iostream>
#include <vector>
#include <queue>
#include <sstream>
#include <algorithm>
#include <bitset>
#include <limits>
#include <map>
#include <set>
#include <iomanip>
#include <cmath>

using namespace std;

typedef long long int ll;
typedef std::numeric_limits<double> dbl;
const long long int LL_INF=1LL<<60;

vector<string> split(const string& input, char delimiter)
{
    stringstream stream(input);
    
    string field;
    vector<string> result;
    while (getline(stream, field, delimiter)) {
        result.push_back(field);
    }
    return result;
}

//#define DEBUG

ll A, B, M, N, D, K, L, Q, W, H, T, X, Y, S;

int main()
{
    cin >> N >> A; cout << N*N-A << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    int x, y;
    cin >> x >> y;
    int a = 4 * x - y;
    if (a % 2 != 0 || a < 0) {
        cout << "No" << '\n';
    }
    else {
        a /= 2;
        int b = x - a;
        if (b < 0) cout << "No" << '\n';
        else cout << "Yes" << '\n';
    }
}


Measured memory_bytes: 3628
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++)
    cin >> A[i];
  vector<int> dv(N);
  for (int i = 0; i < N; i++)
  {
    int tmp = 0;
    while (A[i] % 2 == 0)
    {
      A[i] /= 2;
      tmp++;
    }
    dv[i] = tmp;
  }
  sort(dv.begin(), dv.end());
  cout << dv[0] << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
typedef long long ll;

int main(){
    ll a, b;
    cin >> a >> b;
    if(a == b){
        cout << "Draw" << endl;
    }else if(a == 1 || (b != 1 && b < a)){
        cout << "Alice" << endl;
    }else{
        cout << "Bob" << endl;
    }
    return 0;
}


Measured memory_bytes: 888
#include <stdio.h>
#include <string.h>
int main() {
  char input[11];
  scanf("%s", input);
  int i; /* index */
  int count = 0;
  int ans = 0;
  for (i = 0; i < 11; ++i) {
    if (input[i] == 'A' || input[i] == 'T' || input[i] == 'C' || input[i] == 'G') {
      ++count;
    } else {
      if (count > ans) {
        ans = count;
        count = 0;
      } else {
        count = 0;
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 128
#include<stdio.h>

int main(){
  int a,b;
  
  scanf("%d",&a);
  scanf("%d",&b);
  
  if(a+b==15){
    printf("+");
  }else if(a*b==15){
    printf("*");
  }else{
    printf("x");
  }
  
  return 0;
}

Measured memory_bytes: 128
import java.util.*;
public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        int all = 0;
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        for (int i = 1; i <= n; i++) {
            String str = i + "";
            if (str.length() % 2 == 1) {
                all++;
            }
        }
        System.out.println(all + "");
    }
}

Measured memory_bytes: 36280
import numpy as np
import math
import sys

def is_dubble_wall(min_, max_, S):
    for i in range(min_, max_):
        if (S[i] == "#") and (i != max_ - 1) and (S[i + 1] == "#"):
            return True
    return False

def main():
    N, A, B, C, D = map(int, input().split())
    S = "#"
    S += input()
    assert(len(S) == N + 1)
    if (B < C):
        if is_dubble_wall(min(A, B), max(C, D), S):
            print("No")
            sys.exit()
        if (D < C):
            #二人が入れ替わる時
            num = 0
            array = []
            for i in range(B - 1, D + 2):
                if S[i] == ".":
                    num += 1
                else:
                    array.append(num)
                    num = 0
            array.append(num)
            if max(array) >= 3:
                print("Yes")
            else:
                print("No")
        else:
            #入れ替わらない時
            print("Yes")
    else:
        if (~is_dubble_wall(A, C, S) and ~is_dubble_wall(B, D, S)):
            print("Yes")
        else:
            print("No")

if __name__ == '__main__':
    main()

Measured memory_bytes: 12960
import math

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

x = int(input())

i = 0
while True:
    if is_prime(x+i) == True:
        break
    else:
        i +=1

print(x+i)


Measured memory_bytes: 3060
#include <cstdio>
#include <vector>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)

int Q;
bool prime[100001];
bool used[100001];
int S[100001];

int main()
{
  scanf( "%d", &Q );

  used[0] = used[1] = true;
  repi( i, 2, 100001 ) if( !used[i] )
  {
    prime[i] = true;

    for( int j = i; j <= 100000; j += i )
      used[j] = true;
  }

  rep( i, 100001 )
    S[i] = S[i-1]+(i%2&&prime[i]&&prime[(i+1)/2]?1:0);

  rep( i, Q )
  {
    int l, r;
    scanf( "%d%d", &l, &r );
    printf( "%d\n", S[r]-S[l-1] );
  }

  return 0;
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
long long n,w,a,b,dp[100000];
int main()
{
	cin>>n>>w;
	for(int i=1;i<=n;i++){
		cin>>a>>b;
		for(int j=w-a;j>=0;j--)
		   dp[j+a]=max(dp[j+a],dp[j]+b);
	}
	cout<<*(max_element(dp,dp+w+1))<<endl;
	return 0;
}


Measured memory_bytes: 1024
//agc007_a.cpp
//Sat Nov  3 10:16:50 2018

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

int main(){
	int h,w;
	cin >> h >> w;

	string s[h+2];
	s[0] += '.';
	s[0] += '#';
	for (int i=2;i<w+2;i++){
		s[0] += '.';
	}

	for (int i=1;i<=h;i++){
		string temp;
		cin >> temp;
		s[i] = '.' + temp + '.';
	}

	for (int i=0;i<w;i++){
		s[h+1] += '.';
	}
	s[h+1] += '#';
	s[h+1] += '.';

	int flag = 1;

	for (int i=1;i<=h;i++){
		for (int j=1;j<=w;j++){
			if (s[i][j] == '#'){
				if ((s[i-1][j] == '#' && s[i][j-1] == '#') ||
					(s[i-1][j] == '.' && s[i][j-1] == '.')
					){
					flag = 0;
				}else if ((s[i+1][j] == '#' && s[i][j+1] == '#') ||
						(s[i+1][j] == '.' && s[i][j+1] == '.')
					){
					flag = 0;
				} 
			}
		}
	}

	if (flag == 1){
		cout << "Possible" << endl;
	}else {
		cout << "Impossible" << endl;
	}
}

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

int main() {
  int n, m;
  cin>>n>>m;
  int a[n], b[m];
  for (int i=0; i<n; i++) cin>>a[i];
  for (int i=0; i<m; i++) cin>>b[i];

  sort(a, a + n);
  sort(b, b + m);

  set<int> sa(a, a + n);
  if (sa.size() != n) {
    cout<<0<<endl;
    return 0;
  }
  set<int> sb(b, b + m);
  if (sb.size() != m) {
    cout<<0<<endl;
    return 0;
  }
  long long ans = 1;
  long long mod = 1e9 + 7;
  int c = 0, r = 0;
  for (int i=n*m; i>=1; i--) {
    if (sa.find(i) != sa.end() && sb.find(i) != sb.end()) {
      ++c;
      ++r;
    } else if (sa.find(i) != sa.end()) {
      ++r;
      ans *= c;
    } else if (sb.find(i) != sb.end()) {
      ++c;
      ans *= r;
    } else {
      ans *= c*r - (n*m - i);
    }
    ans %= mod;
  }
  cout<<ans<<endl;
}

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

int main() {
	long long a, b, x;
	long long temp, count = 0;

	cin >> a >> b >> x;

	if(a%x==0)count = b / x - a / x + 1;
	else count = b / x - a / x ;


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

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

int main(){
    int a,b,c;
    cin  >> a >> b >> c;
    if (a==b&&b==c)  cout << "No" << endl;
    else if(a==b||b==c||a==c) cout << "Yes" << endl;
    else  cout << "No" << endl;
}


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

int d[] = {1, 1,  1, 2, 1,  2, 1, 5, 2, 2, 1,
           5, 1,  2, 1, 14, 1, 5, 1, 5, 2, 2,
           1, 15, 2, 2, 5,  4, 1, 4, 1, 51};
int k;

int main() {
  cin >> k;

  cout << d[k - 1] << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rREP(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string s;
    cin >> s;

    set<char> st;
    rep(i,3) st.insert(s[i]);
    if (st.size() == 3)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    


}


Measured memory_bytes: 256
//struct cmp {bool operator()(const pair<int, char> &a, const pair<int, char> &b) {if (a.first == b.first) {return a.second > b.second;} else {return a.first > b.first;}}};
#include<bits/stdc++.h>
#define endl "\n"
#define _  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define mp make_pair
#define min_heap priority_queue <int, vector<int>, greater<int> >
#define max_heap priority_queue <int>
#define ll long long
//#define int long long
#define MOD 1000000007#define deb3(x,y,z) cout << #x << "=" << x << "\t"<<#y<<"="<<y<< "\t"<<#z<<"="<<z<<endl;
#define DEBUG cout<<"Hello1\n";
#define deb(x) cout << #x << " " << x << endl;
#define deb2(x,y) cout << #x << "=" << x << "\t\t"<<#y<<"="<<y<<endl;
#define deb3(x,y,z) cout << #x << "=" << x << "\t"<<#y<<"="<<y<< "\t"<<#z<<"="<<z<<endl;
#define all(v) (v).begin(),(v).end()
using namespace std;
vector<int> v;
int ans = INT_MAX;
int n, k;


void give(int curr) {

	for (auto x : v)
	{
		int val = curr * 10 + x;
		if (val >= n) {
			ans = min(ans, val);
		} else if (val != 0)
		{
			give(val);
		}
	}

}

void solve() {
	cin >> n >> k;
	set<int> ms;
	while (k--) {
		int x; cin >> x;
		ms.insert(x);
	}
	for (int i = 0; i <= 9; i++) {
		if (!ms.count(i)) {
			v.pb(i);
		}
	}

	give(0);

	cout << ans << endl;
}

int32_t main() {
	_


	solve();
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << endl;
#define CFYN(n) cout << ( (n) ? "YES":"NO") << endl;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;

int main(void)
{
    IOS
    int n; cin >> n;
    vector<ll> v(n);
    REP(i,n) cin >> v[i];
    ll ans = 1;
    REP(i,n) {
        ll a = ans;
        ll b = v[i];
        if (a < b) swap(a,b);
        ll ax = 1;
        while(a * ax % b != 0) {
            ax++;
        }
        ans = a*ax;

    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
N = int(input())
S = list(input())
c = 0
a = 0
cw = [0] * N
cb = [0] * N
tw = 0
tb = 0
for i in range(N):
    if S[i] == '.':
        tw += 1
        cw[i] = tw
        cb[i] = tb
    else:
        tb += 1
        cb[i] = tb
        cw[i] = tw
A = cw[i]
for i in range(N):
    A = min(A, cb[i] + cw[N - 1] - cw[i])
print(A)


Measured memory_bytes: 14116
#include<bits/stdc++.h>
using namespace std;
int main(){
  int H,W;
  cin>>H>>W;
  vector<string>S(H);
  for(int i=0; i<H; i++){
    cin>>S[i];}
  
  int count=0;
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      if(S[i][j]=='.'){
        count=0;
        for(int k=max(0,i-1); k<min(H,i+2); k++){
          for(int l=max(0,j-1); l<min(W,j+2); l++){
            if(S[k][l]=='#'){
              count++;}
          }
        S[i][j]=count+'0';}
      }
    }
  }
  for(int i=0; i<H; i++){
    cout<<S[i]<<endl;}
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <functional>
#include <math.h>
#include <stdlib.h>
#include <map>
#include <deque>
#include <sys/timeb.h>
#include <fstream>

using namespace std;

#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define INF 1050000000
#define INFL 1100000000000000000LL
#define EPS (1e-10)
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> Pi;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<double> > vvd;
typedef vector<vector<Pi> > vvPi;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi> > pqlP;
struct Edge {
	int from, to, cost;
	bool operator<(Edge e) {
		return cost < e.cost;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
template <class T>
using vec = vector<T>;
template<class T>
using pql = priority_queue<T, vector<T>, greater<T>>;
string debug_show(Pi a) {
	return "(" + to_string(a.first) + "," + to_string(a.second) + ")";
}

template<class T>
struct augEdge {
	T from, to;
	int cost;
	bool operator<(augEdge e) { return cost < e.cost; }
	bool operator>(augEdge e) { return cost > e.cost; }
};
template<class T>
using augGraph = vector<augEdge<T>>;


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

	int n;
	cin >> n;
	vi s(n);
	vi a;
	bool f = true;
	rep(i, n) {
		cin >> s[i];
		if (s[i] % 10 != 0) {
			f = false;
			a.push_back(s[i]);
		}
	}
	if (f) {
		cout << '0' << endl;
		return 0;
	}

	sort(all(s));
	sort(all(a));

	int ans = 0;
	rep(i, n) {
		ans += s[i];
	}
	if (ans % 10 != 0) {
		cout << ans << endl;
		return 0;
	}
	rep(i, a.size()) {
		ans -= a[i];
		if (ans % 10 != 0) {
			cout << ans << endl;
			return 0;
		}
	}

	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    static int MOD = 365;
    
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        
        // k: コンテストの種類数
        int k = 26;
        
        // n: 1日目～n日目にコンテストが開催される
        int n = sc.nextInt();
        
        // c[i]: タイプiのコンテストのマイナス係数
        int[] c = new int[k];
        for (int i = 0; i < k; i++) {
            c[i] = sc.nextInt();
        }
        
        // s[d][i]: タイプiをd日目に開催したときに増加する満足度
        int[][] s = new int[n+1][k];
        for (int i = 1; i <= n; i++) {
            for (int j = 0; j < k; j++) {
                s[i][j] = sc.nextInt();
            }
        }
        
        // t[i]: i日目に開かれるコンテストのタイプ
        int[] t = new int[n+1];
        // for (int i = 1; i <= n; i++) {
        //     t[i] = sc.nextInt() - 1;
        // }
        
        // last[i]: タイプiのコンテストが最近何日目に開かれたか
        int[] last = new int[k];
        
        // 満足度計算
        int score = 0;
        for (int i = 1; i <= n; i++) {
            int max = -1;
            int choice = -1;
            for (int contest = 0; contest < k; contest++) {
                // int contest = t[i];
                
                int tmp = 0;
                
                // UP
                tmp += s[i][contest];
                // last[contest] = i;
                
                // DOWN
                for (int j = 0; j < k; j++) {
                    tmp -= c[j] * (i-last[j]);
                }
                
                // System.out.println(score);
                
                if (contest == 0 || tmp > max) {
                    choice = contest;
                    max = tmp;
                }
                
                // System.out.println(contest + " " + choice + " " + tmp + " " + max);
            }
            
            score += max;
            last[choice] = i;
            t[i] = choice;
        }
        
        for (int i = 1; i <= n; i++) {
            System.out.println(t[i] + 1);
        }
    }
    
    static public class Test {
        Test() {
            System.out.println(MOD);
        }
        
    }
}


Measured memory_bytes: 46624
#include<cstdio>
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#define INF 9999999
#define EPS 1.0e-6

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

int n;
P h[105000];
int t[105000];
int a[105000];

int main()
{
	cin >> n;

	for (int i = 1; i <= n; i++) {
		h[i].first = INF;
		h[i].second = -1;
	}
	for (int i = 1; i <= n; i++) {
		cin >> t[i];
	}
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	for (int i = 1; i <= n; i++) {
		if (t[i] - t[i - 1]>0) {
			h[i].first = t[i];
			h[i].second = 1;
		}
		if (t[i] == t[i - 1]) {
			h[i].first = t[i];
			h[i].second = 2;
		}
	}
	int ope = 0;
	for (int i = n; i >= 1; i--) {
		if (h[i].second == 2) {
			if (a[i] - a[i + 1] > 0) {
				h[i].first = a[i];
				h[i].second = 1;
			}
			if (a[i] == a[i + 1]) {
				h[i].first = min(a[i], h[i].first);
			}
		}
		if (h[i].second == 1) {
			if (a[i] - a[i + 1] > 0) {
				if (h[i].first != a[i]) {
					ope++; break;
				}
			}
			if (a[i] - a[i + 1] == 0) {
				if (h[i].first > a[i]) {
					ope++; break;
				}
			}
		}
	}
	if (ope == 1) {
		cout << 0 << endl;
		return 0;
	}

	ll ans = 1;
	for (int i = 1; i < n; i++) {
		if (h[i].second == 2) {
			ans *= h[i].first;
			ans = ans % 1000000007;
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1792
# -*- coding: utf-8 -*-

def readInts():
  return [int(s) for s in input().split(" ")]

def solve(N):
  for i in range(1, 10):
    if N % i == 0 and N // i <= 9:
      return 'Yes'
  return 'No'

def main():
  N = readInts()[0]
  print(solve(N))

if __name__ == "__main__":
  main()


Measured memory_bytes: 2940
import java.io.*;
import java.util.*;


public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		@SuppressWarnings("unused")
		int r = sc.nextInt();
		int g = sc.nextInt();
		int b = sc.nextInt();

		if ((g * 10 + b) % 4 == 0) {
			pr.println("YES");
		} else {
			pr.println("NO");
		}
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);

		solve();

		pr.close();
		sc.close();
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}


Measured memory_bytes: 21844
import math
def fac(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

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

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

    return arr

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

n = int(input())
if n==1:
    print(0)
elif is_prime(n):
    print(1)
else:
    cnt = 0
    P = fac(n)
    for p,_ in P:
        c = 1
        while n%pow(p,c)==0:
            n /= pow(p,c)
            cnt += 1
            c += 1
    print(cnt)

Measured memory_bytes: 9444
#include <stdio.h>
void swap(long int v[], int i, int j){
	int temp;
	temp = v[i];
	v[i] = v[j];
	v[j] = temp;
}
void qsort(long int v[], int left, int right){
	int i, last;
	if(left >= right)
		return;
	swap(v, left, (left + right) / 2);
	last = left;
	for(i = left+1; i <= right; i++)
		if(v[i] < v[left])
			swap(v, ++last, i);
	swap(v, left, last);
	qsort(v, left, last-1);
	qsort(v, last+1, right);
}
int main(){
	long int L[101];
	int N;
	scanf("%d", &N);
	for(int i = 1; i <= N; i++)
		scanf("%ld", &L[i]);
	qsort(L, 1, N);
	int n = N;
	long int ans = 0;
	while(n >= 1){
		int s = n - 1;
		while(s - 1 >= 1){
			if(L[n] > L[s]){
				for(int t = s - 1; t >= 1; t--){
					if(L[s] + L[t] > L[n]){
						if(L[s] > L[t])
							ans++;
					}
					else{
						break;
					}
				}
			}
			s--;
		}
		n--;
	}
	printf("%ld", ans);
	return 0;
}

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

typedef long long ll;
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define REP(i,n) for (int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
 
using namespace std;

int main(){

    int n;
    cin >> n;
    if(n <= 999)cout << "ABC";
    else cout << "ABD";
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
int main(){
    string s;
    int n,ans=0;
    cin>>n>>s;
    REP(i,n-2){
        if(s[i]-'A'==0&&s[i+1]-'B'==0&&s[i+2]-'C'==0) ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


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


	int N, K;
	string S;
	cin >> N >> S >> K;

	char c = S[K - 1];
	rep(i, N) if (S[i] != c) S[i] = '*';

	co(S);

	Would you please return 0;
}

Measured memory_bytes: 256
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;
import java.util.function.BiFunction;

public class Main {
    long MOD = (long) 1e9 + 7;

    void run() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();
        int q = sc.nextInt();

        SegmentTree[] sg = new SegmentTree[26];
        for (int i = 0; i < 26; i++) {
            sg[i] = new SegmentTree(n, Long::sum, 0);
        }

        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            int c = s.charAt(i) - 'a';
            a[i] = c;
            sg[c].update(i, 1);
        }

        PrintWriter out = new PrintWriter(System.out);

        for (int i = 0; i < q; i++) {
            int t = sc.nextInt();

            if (t == 1) {
                int iq = sc.nextInt() - 1;
                int c = sc.next().charAt(0) - 'a';
                if (a[iq] == c) continue;
                sg[c].update(iq, 1);
                sg[a[iq]].update(iq, 0);
                a[iq] = c;
            } else {
                int lq = sc.nextInt() - 1, rq = sc.nextInt();
                int cnt = 0;
                for (int j = 0; j < 26; j++) {
                    cnt += sg[j].query(lq, rq) > 0 ? 1 : 0;
                }
                out.println(cnt);
            }

        }

        out.flush();
    }

    public class SegmentTree {
        int n;
        long[] arr;
        BiFunction<Long, Long, Long> fn;
        long unity;

        SegmentTree(int n, BiFunction<Long, Long, Long> fn, long unity) {
            this.n = 1;
            while(this.n < n) {
                this.n *= 2;
            }
            arr = new long[2 * this.n - 1];
            this.fn = fn;
            this.unity = unity;
        }

        SegmentTree(int n) {
            this(n, Math::min, 1L << 60);
        }

        void update(int i, long x) {
            int k = this.n + i - 1;
            this.arr[k] = x;

            while (k > 0) {
                k = (k - 1) / 2;
                this.arr[k] = this.fn.apply(this.arr[2 * k + 1], this.arr[2 * k + 2]);
            }
        }

        long query(int l, int r) {
            return this.inneQuery(l, r, 0, 0, this.n);
        }

        private long inneQuery(int l, int r, int k, int il, int ir) {
            if (ir <= l || r <= il) {
                return this.unity;
            } else if(l <= il && ir <= r) {
                return this.arr[k];
            }

            long vl = this.inneQuery(l, r, k * 2 + 1, il, (il + ir) / 2);
            long vr = this.inneQuery(l, r, k * 2 + 2, (il + ir) / 2, ir);
            return this.fn.apply(vl, vr);
        }
    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) {
        new Main().run();
    }
}

Measured memory_bytes: 396672
#include <iostream>
using namespace std;
int main() {
    int i = 1;
    while (true) {
        int a;
        cin >> a;
        if (a != 0) {
            cout << "Case " << i << ": " << a << endl;
            i++;
        }else{
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 3048