akhauriyash/Code-Regression huggingface dataset:
import java.io.IOException;

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            String s = reader.readLine();

            final String[] sl = s.split(" ");
            int A = Integer.parseInt(sl[0]);
            int B = Integer.parseInt(sl[1]);

            s = reader.readLine();

            boolean flg = false;

            if (s.length() == A + B + 1) {
                flg = true;
                for (int i = 0; i < A + B + 1; i++) {
                    if (A == i) {
                        if (s.charAt(i) == '-') {
                            continue;
                        } else {
                            flg = false;
                            break;
                        }
                    }

                    if (s.charAt(i) < '0' || '9' < s.charAt(i)) {
                        flg = false;
                        break;
                    }
                }
            }
            System.out.println(flg ? "Yes" : "No");
        }
    }
}


Measured memory_bytes: 22864
using System;
using System.IO;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Numerics;
using System.Diagnostics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using static System.Math;


class P
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        HashSet<int> set = new HashSet<int>();
        for (int i = 1;; i++)
        {
            if(!set.Add(n))
            {
                Console.WriteLine(i);
                return;
            }
            n = n % 2 == 0 ? n / 2 : n * 3 + 1;
        }
    }
}


Measured memory_bytes: 13396
a, b, c = list(map(int,input().split()))
flag = 0
if a == b:
    if a != c:
        flag = 1
if b == c:
    if b != a:
        flag = 1
if c == a:
    if c != b:
        flag = 1
if flag == 1:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
//typedef
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;
//define
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
 
int main(){
  int x,y;
  cin >> x >> y;
 
  for(int i=0; i<=x; i++){
    for(int j=x-i; j<=x-i; j++){
      if(2*i + 4*j == y){
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
 
  cout << "No" << endl;
 
    return 0;
}

Measured memory_bytes: 3620
#include<iostream>
#include<cmath>
#include<algorithm>
#include <cassert>
#include<string>
using namespace std;
int main(){
	int a = 0, b = 0, c=0, d[100000], e[100000],f=0, count = 0;
	char uc[100000];
	cin >> a>>b>>c>>f;
	if ((a + b) == (c + f)) {
		cout << "Balanced" << endl;
	}
	else if ((a + b) >= (c + f)) {
		cout << "Left" << endl;
	}
	else {
		cout << "Right" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <queue>
#include <iostream>
#include <bits/stdc++.h>
#include<stdio.h>
#include<string.h>
#include<fstream>

#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
using namespace std;

int main() {
    cin.tie(0);
   	ios::sync_with_stdio(false);
       
    ll i,j,k,p=1,q=1;
    ll n,m,tmp;
    string s[200000];
    string str;
    ll sum=0;
    ll strr[200005];
    cin>>n;
    cin>>str;
    k=str.size();
    p=k;
    k=k/2;
    //cout<<k<<endl;
    int f=0;
    rep(i,k){
        if(str[i]!=str[i+k]) {
            f=1;
            //cout<<str[i]<<" "<<str[i+k]<<endl;
        }
    }
    //cout<<k<<endl;
    f+=p%2;
    if(f==0){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int main() {
    ll n, k; cin >> n >> k;
    vector<ll> a(n);
    rep(i, n) {
        cin >> a[i];
        a[i]--;
    }
    int v = 0;
    vector<int> visited(n, -1);
    ll cnt = 0;
    ll r = 0;
    ll sz = 0;
    while(true) {
        if (cnt == k) {
            cout << v + 1;
            return 0;
        }
        if (visited[v]!=-1) {
            r = visited[v];
            sz = cnt - visited[v];
            break;
        }
        visited[v] = cnt;
        cnt++;
        v = a[v];
    }
    //printf("%d %d\n", r, sz);
    k -= r; k %= sz;

    cnt = 0;
    while(true) {
        if (cnt == k) {
            cout << v + 1;
            return 0;
        }
        cnt++;
        v = a[v];
    }
}


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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define FOR(i, start, end) for(int i = (start); i < (end); i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;


void solve()
{
    int N; cin >> N;
    cout << (int)pow(floor(sqrt(N)), 2) << endl;
}

int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}

Measured memory_bytes: 256
/// Author:- Lazy_Coder

#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    ll n,m;
    cin>>n>>m;
    vector<ll> a;
    for(ll i=0;i<n;i++)
    {
        ll val;
        cin>>val;
        a.push_back(val);
    }
    sort(a.begin(),a.end());
    vector<pair<ll,ll>> b(m);
    for(ll i=0;i<m;i++)
    {
        ll val,val1;
        cin>>val>>val1;
        b[i].first = val1;
        b[i].second = val;
    }
    ll cur=0,cnt=0;
    sort(b.begin(),b.end());
    reverse(b.begin(),b.end());
    for(ll i=0;i<m && cur<n;i++)
    {
        for(ll j=0;j<b[i].second && cur<n;j++)
        {
            if(a[cur]<b[i].first)
            {
                a[cur] = b[i].first;
                cur++;
            }
            else
            {
                cnt++;
                break;
            }
        }
        if(cnt==1)
            break;
    }
    ll ans=0;
    for(ll i=0;i<n;i++)
        ans+=a[i];
    cout<<ans<<'\n';
    return 0;
}


Measured memory_bytes: 2676
#include<iostream>
using namespace std;
const int null=-1;

struct Node{
	int parent;
	int child;
	int sibling;
	int depth;
	int degree;
};
Node *nodes;

int rootSearch(Node *nodes, int n){
	for( int i=0;;i++ ){
		if( nodes[i].parent==null ){
			return i;
		}
	}
}


void setDepth( Node *nodes, int id, int d ){
	nodes[id].depth=d;
//	cout<<"d : "<<d;
//	cout<<"id.child"<<nodes[id].child<<endl;
//	cout<<"id.parent"<<nodes[id].parent<<endl;
	if( nodes[id].sibling !=null ){
		setDepth( nodes, nodes[id].sibling, d );
	}
	if( nodes[id].child !=null ){
		setDepth( nodes, nodes[id].child, d+1 );
	}
	
}

void show(Node *nodes, int n){
	for( int id=0; id<n; id++ ){
		cout<<"node "<<id<<": "
			<<"parent = "<<nodes[id].parent<<", "
			<<"depth = "<<nodes[id].depth<<", ";
		if( nodes[id].parent==null ) cout<<"root, ";
		else if( nodes[id].child==null ) cout<<"leaf, ";
		else cout<<"internal node, ";

		cout<<"[";
		if( nodes[id].child !=null ){
			int tp=nodes[id].child;
			cout<<tp;
			for( int i=1; i<nodes[id].degree; i++ ){
				tp=nodes[tp].sibling;
				cout<<", "<<tp;
			}
		}
		cout<<"]"<<endl;

	}
}

int main()
{
	int n;cin>>n;
	nodes=new Node[n];

	for( int i=0; i<n; i++ ) nodes[i].parent=nodes[i].child=nodes[i].sibling=null;

	int root;	
	for( int i=0, id, deg, cld, prevcld; i<n; i++ ){
		cin>>id>>deg;
		nodes[id].degree=deg;
		
		if( deg>0 ){
			for( int j=0; j<deg; j++ ){ //??????????????????.
				cin>>cld;
				nodes[cld].parent=id; //?????????????????????????????????????????????
				
				if( j==0 ){
					nodes[id].child=cld; //????????????????????????????????????
				}else{
					nodes[prevcld].sibling=cld; //??????????????????????????????
				}
				prevcld=cld;
			}

		}
	//	if( nodes[id].parent==null ) root=id; //root???????????????????????????????????????
	}

	root=rootSearch(nodes, n);
	setDepth(nodes, root, 0);
	show(nodes, n);
}


		

Measured memory_bytes: 6256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		/*
		int i = 1;
		int x;

		while (true) {

			x = sc.nextInt();
			System.out.println("Case " + i + ":" + x);
			i++;
			if (x == 0) {
				break;
			}
		}

		*/

		StringBuilder sb = new StringBuilder();
		String n;
		String a = "Case ";
		String b = ": ";
		for(int i = 1;(n = sc.next()).length() != 1 || n.charAt(0) != '0';i++) {
			sb.append(a);
			sb.append(i);
			sb.append(b);
			sb.append(n);
			sb.append('\n');
		}
		System.out.print(sb.toString());
	}
}


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

int main() {
    int64_t x, ans=0;
    cin >> x;
    ans += x/11*2;
    x %= 11;
    if(7<=x) ans += 2; 
    else if(1<=x && x<=6) ans++; 
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
#define dump(x)                             \
    if (dbg) {                              \
        cerr << #x << " = " << (x) << endl; \
    }
#define overload4(_1, _2, _3, _4, name, ...) name
#define FOR1(n) for (ll i = 0; i < (n); ++i)
#define FOR2(i, n) for (ll i = 0; i < (n); ++i)
#define FOR3(i, a, b) for (ll i = (a); i < (b); ++i)
#define FOR4(i, a, b, c) for (ll i = (a); i < (b); i += (c))
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
#define bit(n, k) ((n >> k) & 1) /*nのk bit目*/
namespace mydef {
const int INF = 1ll << 60;
const int MOD = 1e9 + 7;
template <class T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return 1;
    } else
        return 0;
}
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    } else
        return 0;
}
void Yes(bool flag = true) {
    if (flag)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}
void No(bool flag = true) {
    Yes(!flag);
}
void YES(bool flag = true) {
    if (flag)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}
void NO(bool flag = true) {
    YES(!flag);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
bool dbg = false;
}  // namespace mydef
using namespace mydef;
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vp vector<pair<int, int>>
#define vvp vector<vector<pair<int, int>>>
#define pi pair<int, int>
//#define P pair<int, int>
//#define V vector<int>
//#define S set<int>
#define asn ans

int N;

void solve() {
}

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

    int ans = 0;
    int cnt = 0;
    cin >> N;
    while (N--) {
        int a;
        cin >> a;
        cnt += a;
        if (a == 0) {
            ans += cnt / 2;
            cnt = 0;
        }
    }
    ans += cnt / 2;
    cnt = 0;
    cout << ans << endl;

    solve();
    return 0;
}


Measured memory_bytes: 3636
fn main() {
    let (n, m, a) = input();
    println!("{}", solve(n, m, a));
}

fn input() -> (u32, u32, Vec<u32>) {
    let mut n_m = String::new();
    let mut a_vec = String::new();
    std::io::stdin().read_line(&mut n_m).unwrap();
    std::io::stdin().read_line(&mut a_vec).unwrap();
    n_m.pop();
    a_vec.pop();

    let mut n_m = n_m.split_whitespace();
    let aa = a_vec.split_whitespace();
    let n: u32 = n_m.next().unwrap().parse().unwrap();
    let m: u32 = n_m.next().unwrap().parse().unwrap();
    let a: Vec<u32> = aa.map(|x| x.parse().unwrap()).collect();
    (n, m, a)
}

fn solve(n: u32, m: u32, a: Vec<u32>) -> String {
    let sum = a.iter().sum();
    let mut counter = 0;
    for i in a.iter() {
        if i * 4 * m >= sum {
            counter += 1;
        }
    }
    if counter < m {
        return String::from("No");
    }
    String::from("Yes")
}


Measured memory_bytes: 4352
n = int(input())
l = []
for _ in range(n):
    l.append(map(int, input().split()))

temp_t, temp_x, temp_y = 0, 0, 0
is_reachable = True
for t, x, y in l:
    diff_t = t - temp_t
    diff_x = abs(x-temp_x)
    diff_y = abs(y-temp_y)
    distance = diff_x + diff_y
    if diff_t < distance or diff_t%2 != distance%2:
        print("No")
        is_reachable = False
        break

if is_reachable:
    print("Yes")


Measured memory_bytes: 81112
#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);
  }
  
  long long ans = 0;
  int a, res = 0;
  for (int i = 0; i < N; i++) {
    a = A.at(i) - res;
    if (a < 0) {
      res = 0;
      continue;
    }
    ans += res;
    ans += a / 2;
    res = a % 2;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3788
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <unordered_set>
#include <iostream>
#include <fstream>

using namespace std;

const int DIV = 1000000007;

void execute(int test, istream &in) {
    int a, b, c, k;
    in >> a >> b >> c >> k;
    int ka = std::min(a, k);
    k -= ka;
    int kb = std::min(b, k);
    k -= kb;
    int kc = k;
    int result = ka - kc;
    printf("%d\n", result);
}

int main(int argc, char* argv[])
{
#ifdef VLAD_LOCAL
    //FILE *f = fopen("in.txt", "r");
    ifstream f("in.txt");
#else
    //FILE *f = stdin;
    istream &f = cin;
#endif
    int tests = 1;
    //f >> tests;
    for (int test = 0; test < tests; test++) {
        execute(test, f);
    }
    return 0;
}


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

int main() {
  int N, L;cin >> N >> L;
  vector<string> S(N);
  rep(i, N){cin >> S.at(i);}

  sort(S.begin(), S.end());
  
  string ans = "";
  rep(i, S.size()){
    ans += S.at(i);
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define F first
#define S second
#define mod 1000000007
#define all(a) a.begin(),a.end()
#define dbg(n) cout<<#n<<' '<<n<<endl;
#define dbg_v(v) cout<<#v<<":";for(auto c:v) cout<<" "<<c; cout<<endl;
int power(ll x,ll y){ll res = 1;while(y>0){if(y&1)res = (res*x)%mod;y=y>>1;x=(x*x)%mod;}return res;}
void solve(){
	ll h,n;
	cin>>h>>n;
	int dp[h+1];
	int a[n],b[n];
	for(int i=0;i<n;i++){
		cin>>a[i]>>b[i];
	}
	dp[0]=0;
	for(int i=1;i<=h;i++){
		dp[i]=(i-a[0]>=0)?dp[i-a[0]]+b[0]:b[0];
	}
	for(int i=1;i<n;i++){
		for(int j=0;j<=h;j++){
			if(j-a[i]>=0)
				dp[j]=min(dp[j],dp[j-a[i]]+b[i]);
			else
				dp[j]=min(dp[j],b[i]);
		}
	}
	cout<<dp[h]<<endl;
}
int main(){ 
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);	
	int T=1;
//	cin>>T;
	while(T--){
		solve();
	}
}


Measured memory_bytes: 3672
import sys
f = sys.stdin

q = int(f.readline())
for line in f:
    c, a, n = map(int, line.split())
    can = min(c,a,n)
    c -= can
    a -= can
    
    cca = min(c // 2, a)
    c -= cca * 2
    ccc = c // 3
    print(can + cca + ccc)

Measured memory_bytes: 6724
a,b,c,d,e,f,g = map(int,input().split())
res = []
res.append(b + (a//2)*2+ d//2*2 + e//2*2)
if a >= 1 and d >= 1 and e >= 1:
    res.append(3 + b + (a-1)//2*2 + (d-1)//2*2 + (e-1)//2*2)
print(max(res))


Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<string>
#include<sstream>
#include<cmath>
#include<climits>
#include<algorithm>
#include<bitset>
#include<set>
#include<stack>
#include<queue>
#include<iomanip>
#include<memory.h>
#include<complex>
using namespace std;  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef tuple<int,int> tii;
#define rep(i,n) for(ll i=0;i<(n);i++)  
#define pb push_back
#define mt make_tuple
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second  
const int INF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const double eps = 1e-8;
const double PI = M_PI;  
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
#define SHOWARRAY(ar,i,j) REP(a,i)REP(b,j)cerr<<ar[a][b]<<((b==j-1)?((a==i-1)?("\n\n"):("\n")):(" "))
#define DIV int(1e9+7)
inline ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if((n&1)==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;}
inline ll lcm(ll d1, ll d2){return d1 / __gcd(d1, d2) * d2;}

 /* Coding Space*/
int main(){
  string s; cin >> s;
  int ss = s.size();
  int t = 0;
  if(s[0] == s[ss-1])
    t++;
  if((ss+t) % 2 == 1)
    cout << "First" << endl;
  else
    cout << "Second" << endl;
}

Measured memory_bytes: 512
# -*- coding: utf-8 -*-
import sys
import os

#x,y,z = [int(i) for i in input().split(' ')]

n = float(input())

if n % 2 == 1:
    #奇数
    print((n // 2 + 1) / n)
else:
    #偶数
    print(1.0/2.0)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main() {
  ll n, m;
  cin >> n >> m;
  vector<ll> p(m);
  vector<string> s(m);
  vector<ll> pena(n, 0);
  vector<bool> ok(n, false);
  REP(i, m) {
    cin >> p[i] >> s[i];
    p[i]--;
    if (ok[p[i]]) continue;
    if (s[i] == "AC") {
      ok[p[i]] = true;
      continue;
    }
    pena[p[i]]++;
  }
  ll sei = 0, husei = 0;
  REP(i, n) {
    if (ok[i]) {
      sei++;
      husei += pena[i];
    }
  }
  cout << sei << " " << husei << endl;
}

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

int main() {
	string s;
	cin>>s;
	char c='a';
	if(s.length() == 26) {
		for(int i = 24; ; i--) {
			if(s[i] < s[i + 1]) {
				c = s[i] + 1;
				s = s.substr(0, i);
				break;
			}
			if(i == 0) {
				cout<<-1<<endl;
				return 0;
			}
		}
	}

	cout<<s;
	for(; ; c++) {
		if(s.find(c) == string::npos) {
			cout<<c<<endl;
			return 0;
		}
	}
	return 0;
}

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

using namespace std;

#define rep(i,n) for(int i=0;i<(int)(n);i++)
void sort2array(double *a,long *b,long n){
    for(int i=0;i<n;i++){
        b[i]=i;
    }
    sort(b,b+n,[a](long i,long j)->bool {return a[i]<a[j];} );
}
//bを何回足せばaを超えるか
int wtover(int a,int b){
    if(a%b>0)return (a/b)+1;
    else return a/b;
}
const int INF=100000001,ID_MAX=20;
int bi_e[ID_MAX]={0};
//2進数表示したときの最高桁
int bi_max(long n){
    int m=0;
    for(m;pow(2,m)<=n;m++);m=m-1;
    return m;
}
//bi_eに二進数表示したやつを代入
void bi_exs(long n){
    rep(i,ID_MAX){
        bi_e[i]=0;
    }
    if(n<pow(2,ID_MAX)){
        int m=bi_max(n);
        long l;
        for(m;m>-1;m--){
            l=pow(2,m);
            bi_e[m]=n/l;
            n=n%l;
        }
    }
}
//x^n mod m (nが負の時は０)
long myPow(long x, long n, long m){
  if(n<0)return 0;
  if(n == 0)
    return 1;
  if(n % 2 == 0)
    return myPow(x * x % m, n / 2, m);
  else
    return x * myPow(x, n - 1, m) % m;
}


int main(){
    long int i,n,x,y;
    //入力
    cin>>n;
    //処理
    bool tof=false;
    /*for(int i=1;i<=floor(sqrt(n));i++){
        if(n%i==0){
            for(int j=-109;i<=109;i++){
                long int a=j+i,b=j;
                if(pow(a,5)-pow(b,5)==n){
                    x=a;
                    y=b;
                    tof=true;
                    break;
                }
            }
        }
        if(tof)break;
    }*/
    for(int i=-200;i<=200;i++){
        for(int j=-200;j<=200;j++){
            long re=pow(i,5)-pow(j,5);
            if(re-n==0){
                x=i;
                y=j;
                tof=true;
                break;
            }
        }
        if(tof)break;
    }
    //出力
    cout<<x<<' '<<y<<endl;
}

Measured memory_bytes: 4064
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  if(a==1){
  a+=13;
  }
  if(b==1){
  b+=13;
  }
  if(a>b){cout<<"Alice"<<endl;}
  else if(a==b){cout<<"Draw"<<endl;}
  else{cout<<"Bob"<<endl;}
}


Measured memory_bytes: 3600
//For higher stack size use g++ -O2 -std=c++11 -Wall -Wl,--stack=268435456 a.cpp -o a.exe in cmd
    #include <bits/stdc++.h>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <cstring>
    #include <chrono>
    #include <complex>
    #define ll long long
    #define ld long double
    #define vi vector<int>
    #define vll vector<ll>
    #define vvi vector < vi >
    #define pii pair<int,int>
    #define pll pair<long long, long long>
    #define mod 1000000007
    #define inf 1000000000000000001;
    #define all(c) c.begin(),c.end()
    #define mp(x,y) make_pair(x,y)
    #define mem(a,val) memset(a,val,sizeof(a))
    #define eb emplace_back
    #define pb push_back
    #define f first
    #define s second
    
    using namespace std;

// https://github.com/Sarwar05/SPOJ/blob/master/DQUERY%20-%20D-query.cpp

#define mx 500005
int arr[mx], tree[4*mx], mp[10000005];
int ans[ 500005];
struct str
{
    int x, y, ind;
    bool operator<(const str &ob)const
    {
        return y<ob.y;
    }
};
void update(int pos, int b, int e, int i, int j, int val)
{
    if(b>e) return;
    if(b>j || e<i) return;
    if(b>=i && e<=j){
        tree[pos] = val;
        return;
    }
    int mid = (b+e)/2;
    int left = pos*2;
    int right = left + 1;
    update(left, b, mid, i, j, val);
    update(right, mid+1, e, i, j, val);
    tree[pos] = tree[left] + tree[right];
}
int query(int pos, int b, int e, int i, int j)
{
    if(b>e) return 0;
    if(b>j || e<i) return 0;
    if(b>=i && e<=j){
        return tree[pos];
    }
    int mid = (b+e)/2;
    int left = pos*2;
    int right = left + 1;
    int q1 = query(left, b, mid, i, j);
    int q2 = query(right, mid+1,e,  i, j);
    return q1 + q2;
}

    int main()
{
    int tc, n, q, cs=1,a,b;
    //scanf("%d", &tc);
    tc = 1;
    while(tc--){
        memset(tree, 0, sizeof tree);
        memset(mp, -1, sizeof mp);
        scanf("%d", &n);
        scanf("%d", &q);
        for(int i=1; i<=n; i++){
            scanf("%d", &arr[i]);
        }
        
        vector<str> qry(q);
        for(int i=0; i<q; i++){
            scanf("%d%d", &qry[i].x, &qry[i].y);
            qry[i].ind = i;
        }
        sort(qry.begin(), qry.end());
        int idx = 1;
        for(int i=0; i<q; i++){
            for(idx; idx<=qry[i].y; idx++){
                int val = arr[idx];
                if(mp[val] == -1){
                    mp[val] = idx;
                    update(1,1,n,idx,idx,1);
                }
                else{
                    int ii = mp[val];
                    update(1,1,n,ii,ii,0);
                    mp[val] = idx;
                    update(1,1,n,idx,idx,1);
                }
            }
            ans[ qry[i].ind  ] =  query(1,1,n,qry[i].x, qry[i].y);
        }
        //printf("Case %d:\n", cs++);
        for(int i=0; i<q; i++){
            printf("%d\n", ans[i]);
        }
    }
    return 0;
}

Measured memory_bytes: 60508
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy,copy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
    n, m = MAP()
    if n > m:
        print('No')
    else:
        print('Yes')


if __name__=='__main__':
    main()


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

struct Node
{
	int key;
	Node* parent;
	Node* left;
	Node* right;
};

Node* root_ptr = NULL;

void insert(int key)
{
	Node* x_ptr = root_ptr;
	Node* y_ptr = NULL;
	Node* z_ptr = new Node();
	z_ptr->key = key;

	while (x_ptr != NULL) {
		y_ptr = x_ptr;
		if (z_ptr->key < x_ptr->key) x_ptr = x_ptr->left;
		else x_ptr = x_ptr->right;
	}
	z_ptr->parent = y_ptr;

	if (y_ptr == NULL) root_ptr = z_ptr;
	else {
		if (z_ptr->key < y_ptr->key) y_ptr->left = z_ptr;
		else y_ptr->right = z_ptr;
	}
}

bool find(int key)
{
	Node* ptr = root_ptr;
	while (ptr != NULL) {
		if (key < ptr->key) ptr = ptr->left;
		else if (ptr->key < key) ptr = ptr->right;
		else return true;
	}
	return false;
}

// 左部分木->根->右部分木
void print_inorder(Node* ptr)
{
	if (ptr == NULL) return;
	print_inorder(ptr->left);
	cout << " " << ptr->key;
	print_inorder(ptr->right);
}

// 根->左部分木->右部分木
void print_preorder(Node* ptr)
{
	if (ptr == NULL) return;
	cout << " " << ptr->key;
	print_preorder(ptr->left);
	print_preorder(ptr->right);
}

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

	for (int i = 0; i < n; i++) {
		string cmd;
		cin >> cmd;
		if (cmd == "insert") {
			int key;
			cin >> key;
			insert(key);
		}
		else if (cmd == "find") {
			int key;
			cin >> key;
			if (find(key)) cout << "yes" << endl;
			else cout << "no" << endl;
		}
		else {
			print_inorder(root_ptr);	cout << endl;
			print_preorder(root_ptr);	cout << endl;
		}
	}
}


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

int solve(int n){
  int res = 0;
  if((n%2)==0){
    res = (n/2)-1;
  }else{
    res = (n-1)/2;
  }
  return res;
}

int main(){
  int n;
  cin>>n;
  cout<<solve(n)<<endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

		int x=scan.nextInt();
		int y=scan.nextInt();
		
		
		if(x>=1 && x<=100 && y>=1 && y<=100 && y%2==0) {
			y=y/2;
			
		}
		
		
		System.out.println(x+y);
	}
}



Measured memory_bytes: 21588
n=int(input())
cnt=0
x=0
 
for i in range(0,5,2):
    if n>=10**(i+1):
        cnt+=9*(10**i)
    else:
        if n>=10**(i):
            cnt+=n-(10**i)+1
        else:
            x+=1
    
print(cnt) 

Measured memory_bytes: 3060
S = input()

Cflag = 0
if S[0] == 'A':
    for i in range(1, len(S)):
        if S[i] == 'C' and Cflag == 0 and 2 <= i < len(S)-1:
            Cflag = 1
        elif S[i] == 'C' and Cflag != 0:
            print('WA')
            exit()
        elif ord(S[i]) < 97:
            print('WA')
            exit()
    if Cflag == 1:
        print('AC')
    else:
        print('WA')
else:
    print('WA')


Measured memory_bytes: 3060
A,B,K = map(int, input().split())

for i in reversed(range(K,0,-1)):

    if i%2 == 1:
        #Aの処理
        if A%2 == 1:
            A=A-1
        A=int(A/2)
        B=B+A
#        print("RES_A: " + str(A) + str(B) )

    else:
        #Bさん
        if B%2 == 1:
            B=B-1
        B=int(B/2)
        A=A+B
#        print("RES_B: " + str(A) + str(B))

print(A, B)


Measured memory_bytes: 3064
import collections
N = int(input())
A = [int(_) for _ in input().split()]
c = collections.Counter(A)
l = min(c)
r = max(c)
if r != l + 1:
    print('Yes' if r == l == N - 1 or r == l <= N // 2 else 'No')
    exit()
cl = c[l]
cr = c[r]
print('Yes' if cl + 1 <= r <= cl + cr // 2 else 'No')


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

int main(){
 int n,ans; cin >> n;
 for(int i=0;i<100000;i++){
   int m=n+i;
   bool flag=1;
   for(int j=2;j<m;j++){
     if(m%j==0){
       flag=0;
       break;
   }
 }
   if(flag){
     ans=m;
     break;
   }


}
cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		int sum = 0;

		for (int i = 0; i < 2; i++) {
			
			sum += Math.max(a, b);
			
			if (a >= b) {
				a--;
			} else {
				b--;
			}
			
		}

		
		System.out.println(sum);
	}
}


Measured memory_bytes: 21844
#include "bits/stdc++.h"
#define MAXN 200009
#define INF 1000000007
#define mp(x,y) make_pair(x,y)
#define all(v) v.begin(),v.end()
#define pb(x) push_back(x)
#define wr cout<<"----------------"<<endl;
#define ppb() pop_back()
#define tr(ii,c) for(__typeof((c).begin()) ii=(c).begin();ii!=(c).end();ii++)
#define ff first
#define ss second
#define my_little_dodge 46
#define debug(x)  cerr<< #x <<" = "<< x<<endl;
using namespace std;

typedef long long ll;
typedef pair<int,int> PII;
template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
int dp[MAXN],DP[MAXN];
int main(){
	int n,last;
	scanf("%d",&n);
	dp[0]=1;
	for(int i=1;i<=n;i++){
		int x;
		scanf("%d",&x);
		if(x!=last){
			dp[i]=DP[x];
			dp[i]+=dp[i-1];
			if(dp[i]>=INF)
				dp[i]-=INF;
			DP[x]+=dp[i-1];
			if(DP[x]>=INF)
				DP[x]-=INF;
			last=x;	
		}
		else
			dp[i]=dp[i-1];
	}	
	printf("%d\n",dp[n]);
	return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1e9+7;

int main(){
  
  string x,y; cin>>x>>y;
  if(x<y)cout<<'<'<<endl;
  else if(x>y)cout<<'>'<<endl;
  else cout<<'='<<endl;
}


Measured memory_bytes: 3556
import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    
    String c=sc.next();
    
    if(c.equals("a")){
      System.out.println("vowel");
    }else if(c.equals("i")){
      System.out.println("vowel");
    }else if(c.equals("u")){
      System.out.println("vowel");
    }else if(c.equals("e")){
      System.out.println("vowel");
    }else if(c.equals("o")){
      System.out.println("vowel");
    }else{
      System.out.println("consonant");
    }
  }
}

Measured memory_bytes: 21844
#include <iostream>
#include <sstream>
#include <fstream>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <list>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <climits>
using namespace std;

struct node {
	int id, parent, left, right;
	void walkPreorder(node *nds){
		printf(" %d", this->id);
		if(this->left != -1) nds[this->left].walkPreorder(nds);
		if(this->right!= -1) nds[this->right].walkPreorder(nds);
	}
	void walkInorder(node *nds){
		if(this->left != -1) nds[this->left].walkInorder(nds);
		printf(" %d", this->id);
		if(this->right!= -1) nds[this->right].walkInorder(nds);
	}
	void walkPostorder(node *nds){
		if(this->left != -1) nds[this->left].walkPostorder(nds);
		if(this->right!= -1) nds[this->right].walkPostorder(nds);
		printf(" %d", this->id);
	}
};

int main() {
	int n;
	scanf("%d", &n);
	
	node *nds = new node[n];
	for(int i = 0; i < n; i++){
		nds[i].parent = nds[i].right = nds[i].left = -1;
	}
	
	for(int i = 0; i < n; i++){
		int id, r, l;
		scanf("%d %d %d", &id, &l, &r);
		nds[id].id = nds[l].parent = nds[r].parent = id;
		nds[id].left = l;
		nds[id].right = r;
	}
	
	for(int i = 0; i < n; i++){
		if(nds[i].parent == -1){
			printf("Preorder\n");
			nds[i].walkPreorder(nds);
			printf("\nInorder\n");
			nds[i].walkInorder(nds);
			printf("\nPostorder\n");
			nds[i].walkPostorder(nds);
			printf("\n");
			break;
		}
	}
	
	return 0;
}

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

using namespace std;
typedef long long ll;
typedef vector<int> vi;
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define out(n) cout << n << '\n'
#define rep(i, n) for (ll i = 0; i < (n); i++)
const int inf = 1000000000;
const ll linf = (ll)inf * (ll)inf;
void solve()
{
    int n, k;
    in2(n, k);
    vi p(n);
    rep(i, n) in(p[i]);
    sort(all(p));
    int ans = 0;
    rep(i, k) ans += p[i];
    out(ans);
}

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

Measured memory_bytes: 3620
import java.io.IOException;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;
import java.util.TreeSet;

public class Main {

	public static void main(String[] args) throws IOException {

		new Main().run();
	}

	private void run() throws IOException {
		Scanner scanner = new Scanner(System.in);
		n = scanner.nextInt();
		int q = scanner.nextInt();
		int[] st = new int[n];
		for (int i = 0; i < n; i++)
			st[i] = scanner.nextInt();
		int[] s = Arrays.copyOf(st, n);
		Arrays.sort(s);
		List<Integer> list = new LinkedList<Integer>();
		while (q-- > 0) {
			char query = scanner.next().charAt(0);
			int x = scanner.nextInt();
			if (query == 'A') {
				list.add(st[x - 1]);
			} else if (query == 'R') {
				list.remove(Integer.valueOf(st[x - 1]));
			} else {
				int r = INF;
				int l = 0;
				while (r != l) {
					int mid = (r + l) / 2;
					int pre = 0;
					int BAN = 0;
					TreeSet<Integer> set = new TreeSet<Integer>();
					set.addAll(list);
					for (int i : set) {
						int p = lower(s, i - mid);
						BAN += Math.max(p - pre, 0);
						pre = upper(s, i);
					}
					BAN += n - pre;
					if (BAN <= x)
						r = mid;
					else
						l = mid + 1;
				}
				System.out.println(l != INF ? l : "NA");
			}
		}
	}

	private int lower(int[] s, int i) {
		int p = Arrays.binarySearch(s, i);
		if (p < 0) {
			p = p * -1 - 1;
		} else {
			for (int j = p - 1; j >= 0; j--) {
				if (s[j] != i)
					break;
				p--;
			}
		}
		return p;
	}

	private int upper(int[] s, int i) {
		int pre = Arrays.binarySearch(s, i);
		for (int j = pre + 1; j < n; j++) {
			if (s[j] != i)
				break;
			pre++;
		}

		return pre + 1;
	}

	int INF = 1000000001;
	int n;
}

Measured memory_bytes: 298248
#include<stdio.h>
#include<map>
#include<algorithm>
#include<stack>
#include<queue>
#include<string.h>
#include<math.h>
#include<iostream>
using namespace std;
long long a,b,c,d,x;
int main()
{
    scanf("%lld",&x);
    a=x/500;
    x-=a*500;
    b=x/5;
    c=a*1000+b*5;
    printf("%lld\n",c);
}

Measured memory_bytes: 764
#include <stdio.h>

int main(void){

	int A, B, C, X;

	scanf("%d", &A);
	scanf("%d", &B);
	scanf("%d", &C);
	scanf("%d", &X);

	int count = 0;
	int i, j;

	if( X % 50 != 0){
		
		printf("%d\n", count);
	
	}else{
		
		for(i = 0; i <= X/500; i++){
			if(i <= A){
				int rest1 = X - 500 * i;
				for(j = 0; j <= rest1/100; j++){
					int rest2 = rest1 - 100 * j;
					if(j <= B){
						int rest3 = rest2 / 50;
						if(rest3 <= C){
							count++;
						}
					}
				}
			}
		}
		printf("%d\n", count);	
	}	


}

Measured memory_bytes: 128
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <list>
#include <numeric>
#include <map>
#include <cmath>
#include <string>

#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
typedef long long ll;
using namespace std;
//================================================

ll a = 0, b = 0, c, d, n, k = 0;
string s, t;



int main()
{
	cin >> n >> a >> b;
  ll  x = n / (a + b);
ll  y = n % (a + b);
	cout << x * a + min(y, a) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef int ll;
typedef long double ld;
const ll N = 100005;
char en = '\n';
ll inf = 1e16;
ll mod = 1000000007;
ll power(ll x, ll n, ll mod) {
  ll res = 1;
  x %= mod;
  while (n) {
    if (n & 1)
      res = (res * x) % mod;
    x = (x * x) % mod;
    n >>= 1;
  }
  return res;
}

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

  ll n;
  cin >> n;
  ll arr[n + 5];

  for (ll i = 1; i <= n; i++) {
    cin >> arr[i];
    arr[i] = -arr[i];
  }

  multiset<int> s;
  multiset<int>::iterator it;

  for (ll i = 1; i <= n; i++) {
    s.insert(arr[i]);

    it = s.upper_bound(arr[i]);

    if (it != s.end())
      s.erase(it);
  }

  cout << s.size() << endl;

  return 0;
}

Measured memory_bytes: 5760
/*input
20 40 6

*/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;

#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
#define mod 1000000007
#define PI 3.14159265
// #define endl '\n'
#define debug(x) cout << #x << " = " << x << endl;
#define MAX 250001

template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(ll a, ll b) {a += b; if (a < 0) a += mod; return a;}
inline int sub(ll a, ll b) {a -= b; if (a < 0) a += mod; return a;}
inline int mul(ll a, ll b) {return (a * 1ll * b) % mod;}
inline int pwr(ll x, ll y) {
  int ans = 1 % mod;
  while (y) {
    if (y & 1) ans = mul(ans, x);
    x = mul(x, x);
    y >>= 1;
  }
  return ans;
}
inline int inv(int a) {return pwr(a, mod - 2);}


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

  int n, k;
  cin >> n >> k;
  string str;
  cin >> str;
  vector <int> vec;
  int c = 0;
  int s = 0;
  for (int i = 0; i < n; i++) {
    if (str[i] == '0') {
      c = 0;
      s++;
      while (i < n && str[i] == '0') {
        c++;
        i++;
      }
      while (i < n && str[i] == '1') {
        c++;
        i++;
      }
      if (i < n) {
        i--;
      }
      vec.pb(c);
    }
  }
  k = min(k, s);
  vector <int> psum;
  psum.pb(0);
  for (auto it : vec) {
    psum.pb(psum[psum.size() - 1] + it);
  }
  if (vec.size() == 0) {
    cout << n << endl;
    return 0;
  }
  int ans = psum[k];
  s = (str[0] == '0');
  for (int i = 0; i < n; i++) {
    if (str[i] == '1') {
      c = 0;
      while (i < n && str[i] == '1') {
        c++;
        i++;
      }
      ans = max(ans, c + psum[min((int)psum.size() - 1, s + k)] - psum[s]);
      s++;
    }
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 972
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.math;
import std.regex;

void main() {
	auto N = readln.chomp.to!int;
	auto A = readln.split.to!(uint[]);
	uint count;
	loop: while(true) {
		foreach(ref A_i; A) {
			if(A_i % 2 != 0) break loop;
			else A_i /= 2;
		}
		count++;
	}
	writeln(count);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w

#define int long long
//typedef    long long          ll;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

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

signed main(){
	int n,a[200000],ma = 0;
	cin >> n;
	for(int i = 0;i < n;i++) cin >> a[i];
	sort(a,a + n);
	for(int p = 0;p < 2;p++){
		int l = 0,r = n - 1,m = (n - 1) / 2,ans = 0;
		for(int i = 0;i < n - 1;i++){
			if(i % 2 == 0){
				ans += abs(a[r] - a[m]);
				m = r--;
			}
			else{
				ans += abs(a[m] - a[l]);
				m = l++;
			}
		}
		chmax(ma,ans);
		reverse(a,a + n);
	}
	cout << ma << endl;
	return 0;
}

Measured memory_bytes: 1024
w = input()
res = []
for i in w:
  if i not in res:
    res.append(i)
#print(res)
ans = 0
for j in res:
  if w.count(j) % 2 == 0:
    ans += 1
if ans == len(res):
  print('Yes')
else:
  print('No')

Measured memory_bytes: 8940
<?php

// 入力
fscanf(STDIN, "%d", $people);
$vehicles = [];
for ($i = 0; $i < 5; $i++) {
    fscanf(STDIN, "%d", $input);
    $vehicles[] = $input;
}

sort($vehicles);
$t = ceil($people / $vehicles[0]) + 4;

printf("%d\n", $t);


Measured memory_bytes: 4856
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <numeric>
typedef long long Int;
#define rep(i,a,b) for(Int i=a;i<b;++i)
#define rrep(i,a,b) for(Int i=a;i>=b;--i)
using namespace std;

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

    char c, res;
    cin >> c;
    
    if (c == 'A') res = 'T';
    if (c == 'T') res = 'A';
    if (c == 'G') res = 'C';
    if (c == 'C') res = 'G';
  
    cout << res << endl;
}


Measured memory_bytes: 256
N = int(input())
L = list(map(int,input().split()))

dp = [0 for i in range(N)]
dp[1] = abs(L[0] - L[1])
for i in range(2,N) :
    dp[i] = min(dp[i-1] + abs(L[i-1] - L[i]), dp[i-2] + abs(L[i-2] - L[i]))

ans = dp[N-1]

print(ans)


Measured memory_bytes: 52720
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())





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

	int m;
	cin >> m;
	long long sc = 0, sd = 0;

	rep(i,m) {
		long long d, c;
		cin >> d >> c;
		sc += c;
		sd += d * c;
	}

	long long carry = 0;
	if (sd >= 10)carry = 1 + (sd - 10) / 9;

	cout << sc - 1 + carry << endl;


	return 0;
}

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

long long layer_num[51], patty_num[51];

long long getPatty(long long n, long long x) {
    if (n == 0) {
        return (x == 1 ? 1 : 0);
    } else if (x <= layer_num[n - 1] + 1) {
        return getPatty(n - 1, x - 1);
    } else if (x <= 2 * layer_num[n - 1] + 2) {
        return patty_num[n - 1] + 1 + getPatty(n - 1, x - (layer_num[n - 1] + 2));
    } else {
        return 2 * patty_num[n - 1] + 1;
    }
}

int main() {
    long long N, X;
    cin >> N >> X;

    layer_num[0] = 1;
    patty_num[0] = 1;
    for (int i = 1; i <= 50; i++) {
        layer_num[i] = 2 * layer_num[i - 1] + 3;
        patty_num[i] = 2 * patty_num[i - 1] + 1;
    }

    cout << getPatty(N, X) << endl;
}

Measured memory_bytes: 256
l={}
s=[]
h=[n=d=m=0]+gets.chars.map{|c|c==?\\?(l[1+d-=1]=n):c==?/&&(k=l[d+=1])&&(s.pop while s[0]&&s[-1][1]>k;s<<[k,n]);n+=1;d}
a=[s.size]+s.map{|i,j|t=0;h[i..j].map{|k|t+=h[i]-k};m+=t;t}
puts m,a*" "

Measured memory_bytes: 9208
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		for(;T>0;T--){
			
			N = ri();
			A = rla();
			S = rs();
			
			var l = new List<char>();
			var ll = new List<List<long>>();
			
			l.Add(S[0]);
			ll.Add(new List<long>(){A[0]});
			
			for(int i=1;i<N;i++){
				if(S[i] == l[l.Count - 1]){
					ll[ll.Count - 1].Add(A[i]);
				} else {
					l.Add(S[i]);
					ll.Add(new List<long>(){A[i]});
				}
			}
//foreach(var a in ll) Console.WriteLine(String.Join(" ",a));
			/*
			if(l[l.Count - 1] != '0'){
				Console.WriteLine(1);
				continue;
			}
			*/
			List<List<long>> bs = new List<List<long>>();
			for(int i=0;i<ll.Count;i++){
				bs.Add(Gauss(ll[i]));
			}
			
//foreach(var a in bs) Console.WriteLine(String.Join(" ",a));
			
			
			List<long> a = new List<long>();
			bool chk = true;
			for(int i=l.Count - 1; i>= 0; i--){
				switch(l[i]){
					case '0':{
						foreach(var n in bs[i]) a.Add(n);
						a = Gauss(a);
					} break;
					case '1':{
						var nl = new List<long>();
						var xb = a.ToList();
						xb.Add(0);
						foreach(var n in bs[i]){
							xb[xb.Count - 1] = n;
//Console.WriteLine("xb: {0}",String.Join(" ",xb));
							var g = Gauss(xb);
//Console.WriteLine("g: {0}",String.Join(" ",g));
							if(g.Count == xb.Count){
								chk = false;
							}
						}
					} break;
				
				}
			}
			Console.WriteLine(chk ? 0 : 1);
		}
	}
	
	List<long> Gauss(List<long> _l){
		var l = _l.ToList();
		int row = 0;
		int msb = 63;
		while(true){
			l.Sort();
			l.Reverse();
			if(row >= l.Count || l[row] == 0) break;
			while((l[row] >> msb) % 2 == 0) msb--;
			for(int j=row + 1;j < l.Count; j++){
				if((l[j] >> msb) % 2 == 1) l[j] ^= l[row];
			}
			row++;
		}
		while(l.Count > 0 && l[l.Count - 1] == 0) l.RemoveAt(l.Count - 1);
		return l;
	}
	
	
	
	
	
	int T;
	int N;
	long[] A;
	String S;
	public Sol(){
		T = ri();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 23628
q = int(input())
list_range = [list(map(int, input().split())) for _ in range(q)]

list_flag_prime = [1 for i in range(10**5+1)]
list_flag_prime[0:2] = [0, 0]
for i in range(2, 10**5+1):
  if list_flag_prime[i] == 1:
    for j in range(2*i, 10**5+1, i):
      list_flag_prime[j] = 0

list_subj = [0 for i in range(10**5+1)]
for i in range(3, 10**5+1, 2):
  if list_flag_prime[i] == 1 & list_flag_prime[int((i+1)/2)] == 1:
    list_subj[i] += 1

list_satisfy = [0 for i in range(10**5+1)]
for i in range(1, 10**5+1):
  list_satisfy[i] += list_satisfy[i-1] + list_subj[i]

for l, r in list_range:
  print(list_satisfy[r] - list_satisfy[l-1])

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

using namespace std;
using ll = long long;

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

int main() {
  string s;
  cin >> s;
  int n = s.size();

  int ans = n;
  rep(i, 2) {
    int now = 0;
    char c = i + '0';
    rep(j, n) {
      // if (j % 2 == 0 && s[j] != c) ++now;
      // if (j % 2 != 0 && s[j] == c) ++now;
      if ((j % 2 == 0) ^ (s[j] == c)) ++now;
    }
    ans = min(ans, now);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3732