akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
// Need start
#include<vector>
// Need end
using namespace std;

template <class T>
class WarshallFloyd {
    private:
        T identity;
        vector<vector<T> > dist;
    public:
        WarshallFloyd(int node_num, T _identity):
        identity(_identity), dist(vector<vector<T> >(node_num, vector<T>(node_num, _identity))) {}
        void add_edge(int from, int to, T cost) {
            dist[from][to] = cost;
        }
        void calc_shortest_path() {
            int n = (int)dist.size();
            for (int k = 0; k < n; k++) {
                for (int i = 0; i < n; i++) {
                    for (int j = 0; j < n; j++) {
                        if (dist[i][k] == identity || dist[k][j] == identity) continue;
                        dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
                    }
                }
            }
        }
        T get_dist(int from, int to) {
            return dist[from][to];
        }
};

const int INF = 1 << 30;

int main() {
    // This sample is Atcoder Beginners Contest 73 D
    int N, M, R, A, B, C;
    cin >> N >> M >> R;
    vector<int> r(R);
    for (int i = 0; i < R; i++) {
        cin >> r[i];
        r[i]--;
    }
    WarshallFloyd<int> warshall(N, INF);
    for (int i = 0; i < M; i++) {
        cin >> A >> B >> C;
        A--, B--;
        warshall.add_edge(A, B, C);
        warshall.add_edge(B, A, C);
    }
    warshall.calc_shortest_path();
    vector<int> perm(R);
    for (int i = 0; i < R; i++) {
        perm[i] = i;
    }
    int ans = INF;
    do {
        int now_dist = 0;
        for (int i = 1; i < R; i++) {
            if (warshall.get_dist(r[perm[i - 1]], r[perm[i]]) == INF) {
                now_dist = INF;
                break;
            }
            now_dist += warshall.get_dist(r[perm[i - 1]], r[perm[i]]);
        }
        ans = min(ans, now_dist);
    } while (next_permutation(perm.begin(), perm.end()));
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
int main(){
    ll A, B, N;
    int k;
    cin >> A >> B >> N;
    if(N < B){
        ll ans = 0;
        ans = (A * N) / B;
        k = ans;
        cout << k << endl;
    }
    else{
        int ans = 0;
        ans = (A * (B - 1)) / B;
        k = ans;
        cout << k << endl;
    }
    return 0;
}

Measured memory_bytes: 3568
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#define FUP(i,x,y) for(int i=(x);i<=(y);i++)
#define FDW(i,x,y) for(int i=(x);i>=(y);i--)
#define MAXN 100010
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define ll long long
#define db double
using namespace std;
ll read(){
    int w=0,flg=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')flg=-1;ch=getchar();}
    while(ch<='9'&&ch>='0'){w=w*10-'0'+ch,ch=getchar();}
    return w*flg;
}
ll x;
int main(){
	x=read();
	printf("%lld",x/500*1000+x%500/5*5);
    return 0;
}

Measured memory_bytes: 256
/* Dsingh_24 */

#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define ios	    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;

#define N  100005

int main()
{
	ios
	ll n,i,j;
	cin>>n;
	ll ans=0;
	for(i=1;i<=n;i++){
		string s=to_string(i);
		if(s.size()%2)ans++;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
using ll=long long;
#define rep(i,a,b) for(ll i=a;i<ll(b);i++)
#define repr(i,a,b) for(ll i=a;i>=ll(b);i--)
#define endl "\n"
#define ALL(x) x.begin(),x.end()
#define ALLR(x) x.rbegin(),x.rend()
#define INF 1e9
#define DEBUG(x) cout<<"debug: "<<x<<endl

vector<pair<ll, ll>> GetPrimes(ll parm){
    // first: prime, second: ex
    vector<pair<ll, ll>> res;

    ll ex = 0;
    while (parm % 2 == 0) {
        ex++;
        parm /= 2;
    }
    if(ex != 0) res.push_back({2, ex});

    for(ll i = 3; i*i <= parm; i += 2 ){
        ex = 0;
        while(parm % i == 0){
            ex++;
            parm /= i;
        }
        if(ex != 0) res.push_back({i, ex});
    }

    if(parm != 1) res.push_back({parm, 1});
    return res;
}

ll n, ans;
int main() {
    cin >> n;
    const auto &res = GetPrimes(n);

    for(auto p : res){
        ll ex = p.second;
        int i = 1;
        while(ex > 0){
            ex -= i; i++;
            if(ex >= 0) ans++;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3196
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static final long CONST = 100000007L;

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int numN = scan.nextInt();
		long[] numH = new long[numN];

		for (int i = 0; i < numN; i++) {
			numH[i] = scan.nextLong();
		}

		ArrayList<Integer> list = new ArrayList<>();

		int count = 0;

		for (int i = 1; i < numN; i++) {
			if (numH[i] <= numH[i - 1]) {
				count++;
			} else {
				list.add(count);
				count = 0;
			}
		}

		list.add(count);

		int max = 0;
		for (int num: list) {
			if (num > max) {
				max = num;
			}
		}

		System.out.println(max);
	}
}


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

int main(){
    int a[32]={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 n;
    cin>>n;
    cout<<a[n-1];
	return 0;
}

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

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

    int n, k;
    cin >> n >> k;

    if ((n - 1) * (n - 2) < 2 * k)
    {
        cout << -1 << endl;
        return 0;
    }

    vector<pair<int, int>> c;

    forx(i, 1, n) forx(j, i + 1, n + 1)
    {
        c.push_back(make_pair(i, j));
    }

    cout << c.size() - k << endl;
    rep(i, c.size() - k) cout << c[i].first << ' ' << c[i].second << endl;

    return 0;
}

Measured memory_bytes: 384
N = int(input())

L = []
for _ in range(N):
    p = [int(n) for n in input().split()]
    L.append((p[0], p[1], 'R'))

for _ in range(N):
    p = [int(n) for n in input().split()]
    L.append((p[0], p[1], 'B'))

L.sort(key=lambda x: x[0])

S = set()
for x, y, c in L:
    if c == 'R':
        S.add((x, y))
    else:
        SL = list(S)
        SL.sort(key=lambda x: x[1], reverse=True)
        SL = [s for s in SL if s[1] < y]
        if len(SL) > 0:
            S.remove(SL[0])

print(N - len(S))


Measured memory_bytes: 3064
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll inf=1000000000000000000;
double pi=2*acos(0);
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
int main(){
    ios::sync_with_stdio(false);cin.tie(0);
    int n;cin>>n;
    int a[n];
    vector<int> v;
    rep(i,0,n){
        cin>>a[i];
        v.push_back(a[i]);
    }
    sort(v.begin(),v.end());
    unordered_map<int,int> mp;
    rep(i,0,v.size()){
        mp[v[i]]=i+1;
    }
    rep(i,0,n)a[i]=mp[a[i]];
    int ans=0;
    for(int i=0;i<n;i+=2){
        if(a[i]%2==0)ans++;
    }
    cout<<ans<<endl;
}


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

#define rep2(x,fr,to) for(int x=(fr);x<(to);x++)
#define rep(x,to) for(int x=0;x<(to);x++)
#define repr(x,fr,to) for(int x=(fr);x>=(to);x--)
#define all(c) c.begin(),c.end()
#define sz(v) (int)v.size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
typedef vector<ll> VL; const int MD = 1e9 + 7;
void dbg(){ cerr << "\n"; } template <typename T,typename ...T2> void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }

vector<int64_t> fct, inv;
void finit(int cmx, ll mod =MD){
	fct.resize(cmx+20); inv.resize(cmx+20);
	fct[0] = fct[1] = inv[1] = inv[cmx] = 1;
	for(int i=2;i<cmx+3;i++) fct[i] = fct[i-1] * i % mod;
	for(ll x=fct[cmx], n=mod-2; n > 0; n >>=1, x = x*x %mod)
		if(n & 1) inv[cmx] = inv[cmx] * x %mod;
	for(int i=cmx;i>=1;i--) inv[i-1] = inv[i] * i % mod;
}
ll nPk(ll n, ll k, ll mod =MD) {
	if(k > n || n <0 || k <0) return 0;
	ll ret =fct[n] * inv[n-k] % mod;
	return ret;
}

int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n; cin >>n;
	VI a(n);
	rep(i, n) cin >>a[i];
	
	int mx1=0, mx2=0;
	rep(i, n){
		if(a[i] > mx1){ mx2 = mx1; mx1=a[i];}
		else if(a[i] > mx2) mx2=a[i];
	}
	rep(i, n){
		cout <<(a[i] == mx1? mx2: mx1 )<<"\n";
	}
	return 0;
}


Measured memory_bytes: 2432
// :) 
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 1e5 + 5;
int d[MAXN];
int main () {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		d[x]++;
	}
	int opnum = 0;
	int k = 0;
	for (int i = 0; i < MAXN; i++) {
		if (d[i] <= 1)
			continue;
		opnum += (d[i]-1)/2;
		if (d[i] % 2 == 0)
			k++;
	}
	opnum += k/2 + k%2;
	cout << n - opnum*2 << "\n";
}

Measured memory_bytes: 640
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

n = 0
for j in range(N):
    if B[j] < A[j]:
        n += A[j] - B[j]
        B[j] = A[j]
    elif (B[j] - A[j]) % 2 == 1:
        n += 1
        B[j] += 1

s = sum([b - a for a, b in zip(A, B)])
print("Yes" if s % 2 == 0 and s >= 2 * n else "No")

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

public class Main {
    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        PrintWriter cout = new PrintWriter(System.out);

        int n = cin.nextInt();
        int[] a = new int[n];
        for(int i=0;i<n;i++) a[i] = cin.nextInt();

        Arrays.sort(a);
        int cnt = 0;

        for(int i=0;i<n-2;i++) {
            int k = i + 2;
            for(int j=i+1;j<n;j++) {
                while(k < n && a[k] < a[i] + a[j]) k++;
                if(k > j) cnt += k - j - 1;
            }
        }

        cout.println(cnt);
        cout.close();
    }
}

Measured memory_bytes: 25616
#include <iostream>

void PrintWallLine( int length ){
    using namespace std;

    for( int i = 0; i < length; ++i ){
        cout << '#';
    }
    cout << endl;
}

void PrintRoomLine( int length ){
    using namespace std;
    
    for( int i = 0; i < length; ++i ){
        if( i == 0 || i == length-1 ){
            cout << '#';
        } else {
            cout << '.';
        }
    }
    cout << endl;
}

void PrintArea( int H, int W ){
    using namespace std;

    for( int i = 0; i < H; ++i ){
        if( i == 0 || i == H-1 ){
            PrintWallLine( W );
        } else {
            PrintRoomLine( W );
        }
    }
    cout << endl;
}

int main(){
    using namespace std;

    while( true ){
        int H = 0;
        int W = 0;
        cin >> H >> W;

        if( H == 0 && W == 0 ){ break; }

        PrintArea( H, W );
    }

    return 0;
}

Measured memory_bytes: 1152
import sys
sys.setrecursionlimit(10 ** 7)
read = sys.stdin.buffer.read 
input = sys.stdin.buffer.readline
def inputS(): return input().rstrip().decode()
readlines = sys.stdin.buffer.readlines  

N = int(input())
S, T = inputS().split()
ans = ""
for s, t in zip(S, T):
  ans += s+t
print(ans)  

Measured memory_bytes: 2940
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define llong long long
#define pb(a) push_back(a)
#define INF 9999999

using namespace std;

typedef pair<int,int> P;

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

int main(){
	int N;
	int A[100001];
	cin>>N;
	A[0]=0;
	REP(i,N){
		cin>>A[i+1];
	}
	A[N+1]=0;
	int ans=0;
	REP(i,N+1){
		ans+=abs(A[i+1]-A[i]);
	}
	REP(i,N){
		if(abs(A[i+2]-A[i])==abs(A[i]-A[i+1])+abs(A[i+1]-A[i+2]))cout<<ans<<endl;
		else if(abs(A[i+1]-A[i])==abs(A[i]-A[i+2])+abs(A[i+1]-A[i+2]))cout<<ans-2*abs(A[i+1]-A[i+2])<<endl;
		else if(abs(A[i+2]-A[i+1])==abs(A[i]-A[i+2])+abs(A[i+1]-A[i]))cout<<ans-2*abs(A[i]-A[i+1])<<endl;
	}

}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
int main() {
    int n,w;
    cin>>n>>w;
    long long int we[n+1],v[n+1];
    for(int i=1;i<=n;i++)
        cin>>we[i]>>v[i];
    long long int arr[n+1][w+1];
    for(int i=0;i<n+1;i++)
        arr[i][0]=0;
    for(int j=0;j<w+1;j++)
        arr[0][j]=0;
    for(int i=1;i<n+1;i++) {
        for(int j=1;j<w+1;j++) {
            if(j<we[i])
                arr[i][j]=arr[i-1][j];
            else {
                arr[i][j]=max(arr[i-1][j],v[i]+arr[i-1][j-we[i]]);
            }
        }
    }
    cout<<arr[n][w];
    return 0;
}


Measured memory_bytes: 79104
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <math.h>
using namespace std;

const int MAXN = 1e5 + 10;
const int MAXM = 2e5 + 10;
int N;
int cnt = 1, Head[MAXN], Next[MAXM], To[MAXM];

inline void add_edge(int x, int y) {
	Next[++cnt] = Head[x], To[cnt] = y, Head[x] = cnt;
}

inline void insert_edge(int x, int y) {
	add_edge(x, y), add_edge(y, x);
}

inline int Dfs(int x, int fa = 0) {
	register int i; int res = 0;
	for(i = Head[x]; i; i = Next[i])
		if(To[i] != fa)
			res ^= Dfs(To[i], x) + 1;
	return res;
}

int main() {
	register int i; int x, y;
	scanf("%d", &N);
	for(i = 1; i < N; ++i)
		scanf("%d%d", &x, &y),
		insert_edge(x, y);
	puts(Dfs(1, 0) ? "Alice" : "Bob");
	return 0;
}

Measured memory_bytes: 4224
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n; i >= 0; i--)
#define inf LLONG_MAX
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


ll gcd(ll x, ll y) {
    if (y == 0) return x;
    else return gcd(y, x % y);
}

int main()
{
    ll n, m; cin >> n >> m;
    vll a(n);
    rep(i, n) {
        ll num; cin >> num; num /= 2;
        a[i] = num;
    }

    while (a[0] % 2 == 0) {
        for (int i = 0; i < n; ++i) {
            if (a[i] % 2 != 0) {cout << 0 << endl; return 0;}
            a[i] /= 2;
        }
        m /= 2;
    }

    for (int i = 0; i < n; i++) if (a[i] % 2 == 0) {cout << 0 << endl; return 0;}

    ll lcm = 1;
    for (int i = 0; i < n; ++i) {
        lcm = lcm / gcd(lcm, a[i]) * a[i];
        if (lcm > m) {cout << 0 << endl; return 0;};
    }
    cout << (m / lcm + 1) / 2 << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define mod 1000000007
#define dd double
#define ld long double
#define f(i,a,b) for(ll i = a; i < b; i++)
#define fr(i,a,b) for(ll i = b;i>=a;i--)
#define vll vector<ll>
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define vpll vector< pii >
#define clr(x) x.clear()
#define sz(x) ((int)(x).size())
#define F first
#define S second
#define all(v) (v).begin(),(v).end()
#define Sort(v) sort(v.begin(), v.end(), sortbysec)
#define MEM(a, b) memset(a, (b), sizeof(a))

ll power(ll x, ll y, ll p)  
{  
    ll res = 1;      
    x = x % p; 
                
    while (y > 0)  
    {   
        if (y & 1)  
            res = (res*x) % p;   
        y = y>>1;
        x = (x*x) % p;  
    }  
    return res;  
}  

 

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

ll n;
cin>>n;

string ac = "AC";
string re = "RE";
string wa = "WA";
string tle = "TLE";

ll a=0,b=0,c=0,d=0;
f(i,0,n){
    string s;
    cin>>s;
    if(s == ac)
    a++;
    else if(s == re)
    b++;
    else if(s == wa)
    c++;
    else
    {
        d++;
    }
    
}

cout<<ac<<" "<<"x"<<" "<<a<<endl;
cout<<wa<<" "<<"x"<<" "<<c<<endl;
cout<<tle<<" "<<"x"<<" "<<d<<endl;
cout<<re<<" "<<"x"<<" "<<b<<endl;





}


Measured memory_bytes: 3568
// 解き直し.
// https://img.atcoder.jp/data/agc/004/editorial.pdf
#include <bits/stdc++.h>
using namespace std;
#define repex(i, a, b, c) for(int i = a; i < b; i += c)
#define repx(i, a, b) repex(i, a, b, 1)
#define rep(i, n) repx(i, 0, n)
#define repr(i, a, b) for(int i = a; i >= b; i--)
int board[555][555], r[555][555], b[555][555];

int main(){
    
    // 1. 入力情報.
    int H, W;
    scanf("%d %d", &H, &W);
    rep(i, H){
        char c[555];
        scanf("%s", c);
        rep(j, W) if(c[j] == '#') board[i][j] = 1; // 紫色.
    }
    
    // 2. 事前準備 および 紫色箇所を, 赤色, 青色 で 着色.
    rep(i, H){
        rep(j, W){
            // 1列目 … 赤色.
            if(j == 0)     r[i][j] = 1;
            
            // W列目 … 青色.
            if(j == W - 1) b[i][j] = 1;
            
            // それ以外 … 赤色 もしくは 青色.
            if(j > 0 && j < W - 1){
                if(i & 1){
                    b[i][j] = 1;
                    // 紫色あれば赤色も着色.
                    if(board[i][j]) r[i][j] = 1;
                }else{
                    r[i][j] = 1;
                    // 紫色あれば青色も着色.
                    if(board[i][j]) b[i][j] = 1;
                }
            }
        }
    }
    
    // 3. 出力.
    rep(i, H){
        rep(j, W) printf("%c", (r[i][j]) ? '#' : '.');
        puts("");
    }
    puts("");
    rep(i, H){
        rep(j, W) printf("%c", (b[i][j]) ? '#' : '.');
        puts("");
    }
    return 0;
    
}

Measured memory_bytes: 7036
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		//		new Main().solveA();
		new Main().solveB();
		// new Main().solveC();
		// new Main().solveD();
	}

	private void solveA() {
		Scanner scanner = null;
		int numRating = 0;

		try {
			scanner = new Scanner(System.in);
			numRating = scanner.nextInt();

			if (numRating < 1200) {
				System.out.println("ABC");
			} else if (numRating < 2800) {
				System.out.println("ARC");
			} else {
				System.out.println("AGC");
			}

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveB() {
		Scanner scanner = null;
		String strS = "";

		try {
			scanner = new Scanner(System.in);
			strS = scanner.next();

			if (strS.charAt(0) != 'A') {
				System.out.println("WA");
				return;
			}
			int res = 0;
			int wkIndex = 0;
			for (int i = 2; i < strS.length() - 1; i++) {
				if (strS.charAt(i) == 'C') {
					res++;
					wkIndex = i;
				}
			}
			if (res != 1) {
				System.out.println("WA");
				return;
			}
			for (int i = 0; i < strS.length(); i++) {
				if (i != 0 && i != wkIndex && !Character.isLowerCase(strS.charAt(i))) {
					System.out.println("WA");
					return;
				}
			}
			System.out.println("AC");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveC() {
		Scanner scanner = null;
		int numN = 0;
		int numK = 0;
		int numS = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveD() {
		Scanner scanner = null;
		int numN = 0;
		int numK = 0;
		int numS = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}
}

Measured memory_bytes: 23636
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
 
int main(){
    vector<int> n(3);
    cin >> n[0] >> n[1] >> n[2];
    sort(n.begin(), n.end());
    cout << n[0] << " " << n[1] << " " << n[2] << endl;
    return 0;
}



Measured memory_bytes: 3120
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = "";

		StringTokenizer st;
		StringBuilder sb = new StringBuilder();
		int[] stock = new int[100];
		int[] needs = new int[100];

		next: while ((line = br.readLine()) != null && !line.isEmpty()) {

			int n = Integer.parseInt(line.substring(0, line.indexOf(' ')));
			int k = Integer.parseInt(line.substring(line.indexOf(' ') + 1));
			if ((n | k) == 0) {
				break;
			}

			st = new StringTokenizer(br.readLine());
			for (int i = 0; i < k; i++) {
				stock[i] = Integer.parseInt(st.nextToken());
				needs[i] = 0;
			}
			for (int i = 0; i < n; i++) {
				st = new StringTokenizer(br.readLine());
				for (int j = 0; j < k; j++) {
					needs[j] += Integer.parseInt(st.nextToken());
				}
			}
			for (int i = 0; i < k; i++) {
				if (stock[i] < needs[i]) {
					sb.append("No\n");
					continue next;
				}
			}
			sb.append("Yes\n");
		}
		System.out.print(sb.toString());
	}
}

Measured memory_bytes: 40960
/* This code is written by Nemlit */
#include<bits/stdc++.h>
using namespace std;
#define il inline
#define re register
#define debug printf("Now is Line : %d\n",__LINE__)
#define file(a) freopen(#a".in","r",stdin);freopen(#a".out","w",stdout)
#define rep(i, a, b) for(re int i = (a); i <= (b); ++ i)
#define drep(i, a, b) for(re int i = (b); i >= (a); -- i)
#define Next(i, u) for(re int i = head[u]; i; i = e[i].next)
#define mem(k, p) memset(k, p, sizeof(k))
#define int long long
#define D double
#define inf 1023456789
#define mod 1000000007
#define lb(x) (x)&(-(x))
il int read() {
    re int x = 0, f = 1; re char c = getchar();
    while(c < '0' || c > '9') { if(c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9') x = x * 10 + c - 48, c = getchar();
    return x * f;
}
il int Mul(int a, int b) { return 1ll * a * b % mod; }
il int Inc(int a, int b) { return (a += b) >= mod ? a - mod : a; }
il int Dec(int a, int b) { return (a -= b) < 0 ? a + mod : a; }
il int qpow(int a, int b) { int r = 1; while(b) { if(b & 1) r = Mul(r, a); a = Mul(a, a), b >>= 1; } return r; }
#define ls k * 2
#define rs k * 2 + 1
#define maxn 100005
namespace Graph {
	int head[maxn], cnt;
	struct edge { int v, next; }e[maxn << 1];
	il void add(int u, int v) { e[++ cnt] = (edge){v, head[u]}, head[u] = cnt; }
}
//using namespace Graph;
int n, m, ans, a[maxn];
char c[maxn];
signed main() {
	n = ans = read(), m = read();
	rep(i, 1, m) {
		int x = read();
		rep(j, 1, x) {
			int y = read();
			if(!a[y]) a[y] = 1, -- ans;
		}
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long n,d,ans;
  ans=0;
  cin>>n>>d;
  vector<vector<long long>> a(n, vector<long long>(2));
  for(int i=0;i<n;i++){
    for(int j=0;j<2;j++){
      cin>>a.at(i).at(j);
    }
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<2;j++){
      if(a.at(i).at(j)<0){
        a.at(i).at(j)=-a.at(i).at(j);
      }
    }
  }
  for(int i=0;i<n;i++){
    if(d*d>=a.at(i).at(0)*a.at(i).at(0)+a.at(i).at(1)*a.at(i).at(1)){
      ans++;
    }
  }
  cout<<ans;
}

Measured memory_bytes: 14348
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define BIT(X, i) ((X>>i)&1)
#define REP(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 r_all(a) (a).rbegin(), (a).rend()

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pii;
typedef vector<pii> vii;
typedef priority_queue<ll> pq;

const int MOD = 1e9+7;
const int INF = (1<<30);
const ll INFL = (1L<<62);

int main() {
  int n; cin >> n;
  cout << (n-2)*180 << endl;
  return 0;
}


Measured memory_bytes: 256
N,M = [int(a) for a in input().split()]
H = [int(a) for a in input().split()]

maxs = [0 for _ in range(N)]
for i in range(M):
    a, b = [int(a) for a in input().split()]
    maxs[a-1] = max(maxs[a-1], H[b-1])
    maxs[b-1] = max(maxs[b-1], H[a-1])

ans = 0
for i in range(len(maxs)):
    if maxs[i] < H[i]:
        ans += 1

print(ans)


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

int main(){
	int a,b,ans=1;
	cin>>a>>b;
	if(b==1) cout<<0<<endl;
	else {
	while(ans*a-(ans-1)<b){
		ans++;
	}
	cout<<ans<<endl;
	}
}

Measured memory_bytes: 3632
import java.util.Scanner;

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

		String s = sc.next();
		int cnt = 0;

		int l = 0;
		int r = s.length() - 1;

		while (l <= r) {
			if (!s.substring(l, l + 1).equals(s.substring(r, r + 1))) {
				cnt++;
			}
			l++;
			r--;
		}

		System.out.println(cnt);
		sc.close();
	}
}

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

using lli = long long int;

template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

template <class T>ostream &operator<<(ostream &o,const pair<T, T>&p)
{o<<"("<<p.first<<", "<<p.second<<")";return o;}

int main(void){
    lli n;
    cin >> n;
    vector<pair<lli, lli>> p;
    for(int i = 0; i < n; i++){
        lli a;
        cin >> a;
        p.push_back({i, a});
    }
    sort(p.begin(), p.end(), [](pair<lli, lli> p1, pair<lli, lli> p2)
    {return (p1.second < p2.second);
    });
    for(auto i : p){
        cout << i.first+1 << endl;
    }
    return 0;
}


Measured memory_bytes: 2544
n = int(input())
nowx = 0
nowy = 0
nowt = 0

def manhattan(x1,y1,x2,y2):
    return abs(x1-x2) + abs(y1-y2)

for i in range(n):
    nextt, nextx, nexty = map(int,input().split())
    if (nextt - nowt) >= manhattan(nowx,nowy,nextx,nexty) and (nextt - nowt)%2 == manhattan(nowx,nowy,nextx,nexty)%2:
        nowx, nowy, nowt = nextx, nexty, nextt
    else:
        print('No')
        exit()
print('Yes')



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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  string ns;
  getline(cin, ns);
  int a = 0, b = 1;
  for (auto c : ns) {
    int d = c - '0';
    int a_ = min(a + d, b + 10 - d);
    b = min(a + d + 1, b + 9 - d);
    a = a_;
  }
  cout << a << '\n';
}


Measured memory_bytes: 1912
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

void print(char *str, int a, int b) {
  while (a <= b) {
    printf("%c", str[a]);
    a++;
  }
  printf("\n");
}

void replace(char *str, int a, int b, char *repstr) {
  strncpy(str+a, repstr, b - a + 1);
}

void reverse(char *str, int a, int b) {
  char holder;
  while (a < b) {
    holder = str[a];
    str[a] = str[b];
    str[b] = holder;
    a++;
    b--;
  }
}

int main(void)
{
  char str[1001];
  char command[8];
  int q, i, a, b;
  scanf(" %s", str);
  scanf(" %d", &q);
  for (i = 0; i < q; i++)
    {
      scanf(" %s %d %d", command, &a, &b);
      if (!strcmp(command, "print"))
	print(str, a, b);
      else if (!strcmp(command, "replace"))
	{
	  char *repstr = (char *) malloc(b - a + 2);
	  scanf(" %s", repstr);
	  replace(str, a, b, repstr);
	  free(repstr);
	}
      else
	reverse(str, a, b);
    }
  return 0;
}



Measured memory_bytes: 2080
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int a, b, c, i, j;
int main(void){
    scanf("%d %d",&a, &b);
    for (i = 10; i <1100; i++)
    {
        if (((int)((double)i * 0.08) == a) && ( (int)((double)i * 0.1) == b))
        {
            printf("%d\n",i);
            return 0;
        }
        //printf("%d %d , %d %d\n",(int)((double)i * 0.08),a,(int)((double)i * 0.1),b);
    }
    printf("-1\n");
    //printf("%d %d\n",((int)((double)25 * 0.08)) , ( (int)((double)25 * 0.1)));
    return 0;
}

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

using namespace std;

using ll = long long;
using vl = vector<ll>;
using vs = vector<string>;
using vvl = vector<vl>;
using pll = pair<ll,ll>;
using vb = vector<bool>;

const ll oo = 0x3f3f3f3f3f3f3f3fLL;
const double eps = 1e-9;

#define sz(c) ll((c).size())
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define xx first
#define yy second

#define has(c,i) ((c).find(i) != end(c))
#define FOR(i,a,b) for (int i=(a); i<(b); i++)
#define FORD(i,a,b) for (int i=int(b)-1; i>=(a); i--)

#define rv(type,name,count) vector<type> name(count); FOR(_i,0,count) cin >> name[_i];
#define grid(type,name,c1,c2) vector<vector<type>> name(c1, vector<type>(c2)); FOR(_i,0,c1)FOR(_j,0,c2)cin >> name[_i][_j];

int main() {
	ll n, w;
	cin >> n >> w;
	vvl v(2, vl(w + 1));
	FOR(i, 0, n) {
		ll wei, val;
		cin >> wei >> val;
		FOR(ww, 0, w+1) {
			v[i%2][ww] = v[(i+1)%2][ww];
			if (wei <= ww) v[i%2][ww] = max(v[i%2][ww], val + v[(i+1)%2][ww-wei]);
		}
	}
	cout << v[(n+1) % 2][w] << endl;
}


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

int main() {
  int H,W,A=0;
  cin>>H>>W;
  vector<char> p(H*W);
  queue<int> q;
  vector<int> r(H*W,-1);
  for(int i=0;i<H*W;i++){
    cin>>p.at(i);
    if(p.at(i)=='#'){
      q.push(i);
      r.at(i)=0;
    }
  }
  
  while(!q.empty()){
    int a=q.front();
    q.pop();
    if(r.at(a)>A){
      A++;
    }
    if(a>=W){
      if(r.at(a-W)==-1){
        r.at(a-W)=r.at(a)+1;
        q.push(a-W);
      }
    }
    if(a+W<H*W){
      if(r.at(a+W)==-1){
        r.at(a+W)=r.at(a)+1;
        q.push(a+W);
      }
    }
    if(a%W!=0){
      if(r.at(a-1)==-1){
        r.at(a-1)=r.at(a)+1;
        q.push(a-1);
      }
    }
    if(a%W!=W-1){
      if(r.at(a+1)==-1){
        r.at(a+1)=r.at(a)+1;
        q.push(a+1);
      }
    }
  }
  cout<<A<<endl;
    
}

Measured memory_bytes: 9216
def main():
    n = int(input())
    a = list(map(int, input().split()))
    b = [0]*(n+1)
    ans = []
    for i in range(n, 0, -1):
        if sum(b[i::i])%2 != a[i-1]:
            ans.append(i)
            b[i] = (b[i]+1)%2
    print(len(ans))
    if len(ans):
        print(*reversed(ans))

if __name__ == '__main__':
    main()

Measured memory_bytes: 18272
#include<bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define A first
#define B second
#define db double
#define lowbit(p) (p&(-p))
using namespace std;
inline void read(int &x){
	x=0; char c=getchar(); int p=1;
	for (;c<48;c=getchar())if (c=='-')p=-1;
	for (;c>47;c=getchar())x=(x<<1)+(x<<3)+(c^48);
	x*=p;
}
void read(ll &x){
	x=0; char c=getchar(); int p=1;
	for (;c<48;c=getchar())if (c=='-')p=-1;
	for (;c>47;c=getchar())x=(x<<1)+(x<<3)+(c^48);
	x*=p;
}
void Min(int &x,int y){
	if (x>y)x=y;
}
void Max(int &x,int y){
	if (x<y)x=y;
}
void Min(ll &x,ll y){
	if (x>y)x=y;
}
void Max(ll &x,ll y){
	if (x<y)x=y;
}

map< pii,int >id;
#define M 100005
struct ed{
	int x,l,nx;
}e[M*12];
int nx[6*M],dis[6*M],n,m,ecnt=1;
bool mark[6*M];
int tot,r[2];
int Q[2][6*M];
inline void add(int x,int y,int l){
	e[ecnt]=(ed){y,l,nx[x]};
	nx[x]=ecnt++;
}
void bfs(int s,int t){
	int x,now=0,l;
	memset(dis,63,sizeof(dis));
	dis[s]=0;
	Q[now][++r[now]]=(s);
	
	for (;r[now];now=!now){
		for (l=1;l<=r[now];l++){
			x=Q[now][l];
			if (mark[x])continue;
			mark[x]=1;
			if (x==t){
				printf("%d\n",dis[t]);
				return ;
			}
			for (int i=nx[x];i;i=e[i].nx){
				if (dis[x]+e[i].l<dis[e[i].x]){
					dis[e[i].x]=dis[x]+e[i].l;
					Q[now^e[i].l][++r[now^e[i].l]]=e[i].x;
				}
			}
		}		
		r[now]=0;
	}
	printf("-1\n");
}
inline int cal(int x,int col){
	int &res=id[mp(x,col)];
	if (res)return res;
	res=++tot;
	add(x,res,1);
	add(res,x,0);
	return res; 
}
int main(){
//	int Caseid;
// 	freopen("4.in","r",stdin);
//	read(Caseid);
	read(n); read(m);	
	int i,x,y,c;
	tot=n;
	for (i=1;i<=m;i++){
		read(x); read(y); read(c);
		x=cal(x,c);
		y=cal(y,c);
		add(x,y,0);
		add(y,x,0);
	}
	bfs(1,n);
	return 0;
}

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

int main() {
	int N; cin>>N;
	vector<int> A(N);
	for(int i=0; i<N; i++) cin >> A.at(i);
	for(int i=0; i<N; i++) cout << A.at(i) <<(i<N-1?" ":"");
	cout << endl;
	for(int i=1; i<N; i++){
		int v = A[i];
		int j = i - 1;
		while (j >= 0 && A[j] > v){
			A[j+1] = A[j];
			j--;
			A[j+1] = v;
		}
		for(int i=0; i<N; i++) cout << A.at(i) <<(i<N-1?" ":"");
		cout << endl; 
	}
	
}


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

using namespace std;

#define int long long

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

#ifdef DBG
#define log(item) cout<<#item<<" "<<item<<endl
#else
#define log(item)
#endif

typedef vector<int> VI;
typedef pair<int, int> PII;

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

int N, K;

signed main(){
    cin >> N;
    cin >> K;

    cout << (N - K) + 1 << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		long K = sc.nextLong();
		long A[] = new long[N];
		long B[] = new long[M];
		for(int i = 0 ; i < N ; ++i){
			A[i] = sc.nextLong();
		}
		for(int i = 0 ; i < M ; ++i){
			B[i] = sc.nextLong();
		}
		long ASum[] = new long[N + 1];
		long BSum[] = new long[M + 1];
		for(int i = 0 ; i < N ; ++i){
			ASum[i + 1] = ASum[i] + A[i];
		}
		for(int i = 0 ; i < M ; ++i){
			BSum[i + 1] = BSum[i] + B[i];
		}
//		System.out.println(Arrays.toString(ASum));
//		System.out.println(Arrays.toString(BSum));
		long ret = 0;
		for(int i = 0 ; i <= N ; ++i){
			if(ASum[i] > K){
				break;
			}
			long left = K - ASum[i];
			int ind = Arrays.binarySearch(BSum, left);
			if(ind >= 0){
				ret = Math.max(ret, i + ind);
			}else{
				ind = - ind - 1;
				ret = Math.max(ret, i + ind - 1);				
			}
		}
		System.out.println(ret);
	}
}


Measured memory_bytes: 63592
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vdo=vector<double>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vvdo=vector<vector<double>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using pqin=priority_queue<int>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#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++)
#define all(v) v.begin(),v.end()
#define _GLIBCXX_DEBUG
int main()
{
    int n;
    cin>>n;
    int sum=0;
    rep2(i,1,n+1){
        if(i%2){
            int div=0;
            rep2(j,1,i+1){
                if(i%j==0)div++;
            }
            if(div==8)sum++;
        }
    }
    cout<<sum<<endl;
}

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

int main(){
	char s[100];
	int flag = 1;
	scanf("%s",s);
	int len = strlen(s);
	int a = (len-1)/2;
	int aa = (1 + a) / 2;
	int b = (len + 3) / 2;
	int bb = (b + len) /2;
	for(int i = 0;i < a;i++){
		if(s[i] != s[len - 1-i]){
			flag = 0;
			break;
		}
	}
	if(flag == 1){
		for(int i = 0;i < aa;i++){
			if(s[i] !=  s[a-1-i]){
				flag = 0;
				break;
			}
		}
	}
	if(flag == 1){
		for(int i = b-1;i < bb;i++){
			if(s[i] != s[len-1-i]){
				flag = 0;
				break;
			}
		}

	}	
	if(flag == 0){
		printf("No\n");
	}else{
		printf("Yes\n");
	}


}


Measured memory_bytes: 128
import itertools

N, M, Q = map(int, input().split())
a = [0] * Q
b = [0] * Q
c = [0] * Q
d = [0] * Q
for i in range(Q):
    a[i], b[i], c[i], d[i] = map(int, input().split())
    a[i] -= 1
    b[i] -= 1

ans = 0
for seq in itertools.combinations_with_replacement(range(1, M+1), N):
    tmp = 0
    for i in range(Q):
        if seq[b[i]] - seq[a[i]] == c[i]:
            tmp += d[i]
    ans = max(ans, tmp)

print(ans)


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

int gcd(int p, int q) {
  if (p%q==0) return q;
  return gcd(q,p%q);
}

int main() {
  	int a;cin>>a;
  	int ans=0;
  	for (int i=1;i<=a;i++) {
    	for (int j=1;j<=a;j++) {
        	for (int k=1;k<=a;k++) {
            	ans+=gcd(gcd(i,j),k);
            }
        }
    }
  	cout << ans << endl;
  	return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <string>
#include <stdio.h>
#include <math.h>
#include <algorithm>

using namespace std;

int main(){
	int64_t n,k,ans;
	cin>>n>>k;
	if(n==1){
    	cout<<k;
    }else{
    	ans=k*pow(k-1,n-1);
		cout<<ans;
    }
	
	
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <ctime>
#include <algorithm>
#include <sstream>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <cstdlib>
#include <cstdio>
#include <iterator>
#include <functional>
#include <bitset>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#else
#define eprintf(...)
#endif

#define TIMESTAMP(x) eprintf("["#x"] Time : %.3lf s.\n", clock()*1.0/CLOCKS_PER_SEC)
#define TIMESTAMPf(x,...) eprintf("[" x "] Time : %.3lf s.\n", __VA_ARGS__, clock()*1.0/CLOCKS_PER_SEC)

using namespace std;

#ifdef LOCAL
static struct __timestamper {
  string what;
  __timestamper(const char* what) : what(what){};
  __timestamper(const string& what) : what(what){};
  ~__timestamper(){
    TIMESTAMPf("%s", what.data());
	}
} __TIMESTAMPER("end");
#else 
struct __timestamper {};
#endif

typedef long long ll;
typedef long double ld;

int main() {
#ifdef LOCAL
  freopen("b.in", "r", stdin);
  freopen("b.out", "w", stdout);
#endif

  int n;
  multiset<int> s;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int a;
    scanf("%d", &a);
    s.insert(a);
  }
  int m;
  scanf("%d", &m);
  for (int i = 0; i < m; i++) {
    int a;
    scanf("%d", &a);
    auto it = s.find(a);
    if (it != s.end()) {
      s.erase(it);
    } else {
      printf("NO\n");
      return 0;
    }
  }
  printf("YES\n");


  return 0;
}


Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL MOD = 1000000007;
#define lcm(x, y) ((x) * (y) / __gcd((x), (y)))
#define sz(a) (long long)((a).size())
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define debug(x) cout << #x << " : " << x << endl
#define part cout << "----------------------------------\n";
#define mp make_pair
#include <iostream>

#define fastinput                     \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);

LL POW(LL x, LL y)
{
    LL ans = 1;
    LL base = x;
    while (y)
    {
        if (y & 1)
        {
            ans *= base;
        }
        base = base * base;
        y = y >> 1;
    }
    return ans;
}

int main()
{
    fastinput;
    LL n, i, j, k, t, temp,tc,m;
    cin>>n>>m;
    vector<LL> adj[n+1];
    const LL INF=10000000000000000;
    vector<LL> dis(n+1,INF);
    vector<LL> parent(n+1,-1);
    dis[1]=0;

    queue<LL> q;
    q.push(1);
    for(i=1;i<=m;i++)
    {
        cin>>j>>k;
        adj[j].pb(k);
        adj[k].pb(j);
    }
    while(!q.empty())
    {
        LL node=q.front();
        q.pop();
        for(auto x:adj[node])
        {
            if(dis[node]+1<dis[x])
            {
                dis[x]=dis[node]+1;
                parent[x]=node;
                q.push(x);
            }
        }
    }

    for(i=2;i<=n;i++)
    {
        if(parent[i]==-1)
        {
            cout<<"No\n";
            return 0;
        }
    }
    cout<<"Yes\n";
    for(i=2;i<=n;i++)
    {
        cout<<parent[i]<<endl;
    }


    return 0;
}


Measured memory_bytes: 13892
#include <iostream>
#include <queue>
#include <functional>
#include <algorithm>

using namespace std;

using ll = long long int;

ll arr[300010] = {};

ll resL[100010] = {};

int main(void){
    
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll k,sum = 0,result = 0,sum1 = 0;
    cin >> k;
    
    priority_queue<ll, vector<ll>, greater<ll> > que;
    priority_queue<ll> que1;
    
    for(int i = 0; i < 3*k; i++){
        cin >> arr[i];
    }
    
    //init
    
    for(int i = 0; i < k; i++){
        sum += arr[i];
        que.push(arr[i]);
    }
    
    resL[0] = sum;
    
    for(int i = 0; i < k; i++){
        
        sum1 += arr[3*k-(i+1)];
        que1.push(arr[3*k-(i+1)]);
        
        que.push(arr[i+k]);
        ll a = que.top();
        que.pop();
        
        sum += arr[i+k]-a;
        
        resL[i+1] = sum;
    }
    
    /// left
    
    result = resL[k] - sum1;
    
    for(int i = 1; i <= k; i++){
        
        que1.push(arr[2*k-i]);
        ll a = que1.top();
        que1.pop();
        
        sum1 += arr[2*k-i]-a;
        
        result = max(resL[k-i] - sum1,result);
    }
    
    /// right
    
    cout << result << endl;
}


Measured memory_bytes: 5492
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

n = int(input())
make_divisors(n)
len(make_divisors(n))
ans = 0
ans_list = []

for i in range(1,n+1):
    if len(make_divisors(i)) == 8 and i % 2 == 1:
        ans += 1
        ans_list.append(i)
# print(ans_list)
print(ans)

Measured memory_bytes: 3064
import Data.Vector.Unboxed ((!))
import qualified Data.Vector.Unboxed as V
import Control.Monad

main = do
  [n,q]<-map read.words<$>getLine
  s<-getLine
  ops<-replicateM q$(\[a,b]->(a,b)).map head.words<$>getLine
  print $ solve n s ops

solve n s ops = right - left
  where
  right = findBorder surviveR n
  left  = findBorder (not.surviveL) n
  surviveR = f ops
  f [] _ = True
  f ((t,'L'):ops) pos = if golems!pos == t then pos==0 || f ops (pos-1) else f ops pos
  f ((t,'R'):ops) pos = if golems!pos == t then pos/=n-1 && f ops (pos+1) else f ops pos
  surviveL = g ops
  g [] _ = True
  g ((t,'R'):ops) pos = if golems!pos == t then pos==n-1 || g ops (pos+1) else g ops pos
  g ((t,'L'):ops) pos = if golems!pos == t then pos/=0 && g ops (pos-1) else g ops pos
  golems = V.fromListN n s

findBorder f = go (-1)
  where
  go l r
    | l+1 == r = l
    | f m = go m r
    | otherwise = go l m
    where m = (l+r) `div` 2

Measured memory_bytes: 66940
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<long, long>
#define ff first
#define ss second
#define pb push_back


main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int H, W, K; cin >> H >> W >> K;
    int a[H][W], b[H][W];
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            char c; cin >> c;
            if(c == '.') b[i][j] = 0;
            else if(c == '#') b[i][j] = 1;
        }
    }
    int ans = 0;
    for(int mask1 = 0; mask1 < (1 << H); mask1++){
        for(int mask2 = 0; mask2 < (1 << W); mask2++){
            for(int i = 0; i < H; i++){
                for(int j = 0; j < W; j++){
                    a[i][j] = b[i][j];
                }
            }
            for(int i = 0; i < H; i++){
                if((1<<i)&mask1){
                    for(int j = 0; j < W; j++)
                        a[i][j] = 0;
                }
            }
            for(int j = 0; j < W; j++){
                if((1<<j)&mask2){
                    for(int i = 0; i < H; i++)
                        a[i][j] = 0;
                }
            }
            int sum = 0;
            for(int i = 0; i < H; i++){
                for(int j = 0; j < W; j++)
                    sum += a[i][j];
            }
            if(sum == K) ans++;
        }
    }
    cout << ans;
}


Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
    int n;
    cin>>n;
    vector<int> p(n);
    for(int i=0; i<n; i++){
        cin>>p.at(i);
    }
    int ans=0;
    for(int i=1; i<n-1; i++){
        vector<int> q(3);
        for(int j=0; j<3; j++){
            q.at(j)=p.at(i-1+j);
        }
        sort(q.begin(), q.end());
        if(q.at(1)==p.at(i)){
            ans++;
        }
    }
    cout<<ans<<endl;
}


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

using ll = long long;
using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<ll> a(n);
    for(int i = 0; i < n; i++)cin >> a[i];

    ll curl = 0;
    ll curr = accumulate(a.begin(), a.end(),0LL);
    ll nin =   curr - curl;

    for(int i = 0; i < n ;i++){
        curl +=a[i];
        curr -= a[i];
        nin = min(nin, abs(curl - curr));
        
    }
    cout << nin << endl;

}

Measured memory_bytes: 1792
# -*- coding: utf-8 -*-
n,k = map(int, input().split())
pl = list(map(int, input().split()))

ppl = [0]*n
for i in range(n):
    ppl[i] = (pl[i]+1)/2

acc = [0]*(n+1)
for i in range(n):
    acc[i+1] += acc[i]+ppl[i]

res = -1
for i in range(n-k+1):
    res = max(res, acc[i+k]-acc[i])

print(res)

Measured memory_bytes: 24804
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.lang.StringBuilder
import java.util.*

fun gcd(a:Int, b:Int):Int {
    val c = a % b
    if (c == 0) return b
    return gcd(b, c)
}

fun gcd(a:Int, b:Int, c:Int):Int {
    return gcd(gcd(a, b), c)
}

fun PrintWriter.solve(sc: FastScanner) {
    val k = sc.nextInt()
    var sum = 0L
    for (a in 1..k) {
        for (b in 1..k) {
            for (c in 1..k) {
                sum += gcd(a,b,c)
            }
        }
    }
    println(sum)
}

fun main(args: Array<String>) {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}


Measured memory_bytes: 34608
fn main() {
    let h: i64 = read();
    let w: i64 = read();
    let m = h * w;
    if h == 1 || w == 1 {
        println!("1");
        return
    }
    println!("{}", m / 2 + (m % 2));
}

use std::io::stdin;
use std::io::Read;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let cin = stdin();
    let cin = cin.lock();
    let token: String = cin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
inline ll read(){
    ll x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-') f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}
    return x*f;
}
ll fastPow(ll x, ll y){
        ll ans = 1;
        while (y != 0){
            if (y & 1) ans *= x;
            x *=x;
            y >>= 1;
    }
    return ans;
}
int main(){
    ll a=read();
    printf("%d",a+fastPow(a,2)+fastPow(a,3));
}

Measured memory_bytes: 3756