akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

inline void find1(ll x, vector<ll> p, ll* la, ll* ra) {
	*ra = lower_bound(p.begin(), p.end(), x) - p.begin();
	*la = max(*ra - 1, 0LL);
	*la = p[*la], *ra = p[*ra];
}

inline void find(int x, vector<ll> p, ll* la, ll* ra) {
	int l = 0, r = p.size() - 1;
	while (l <= r) {
		int m = (l + r) / 2;
		if (p[m] < x) {
			l = m + 1;
		} else {
			r = m - 1;
		}
	}
	if (l == p.size()) {
		l--;
	}
	if (r == -1) {
		r++;
	}
	*la = p[r], *ra = p[l];
}

int main() {
	int a, b, q;
	ll x;
	scanf("%d %d %d", &a, &b, &q);
	vector<ll> s, t;
	while (a--) {
		scanf("%lld", &x);
		s.push_back(x);
	}
	while (b--) {
		scanf("%lld", &x);
		t.push_back(x);
	}
	int l, r;
	ll ls, rs;
	ll lt, rt;
	ll ps[2], pt[2];
	while (q--) {
		scanf("%lld", &x);
		// find(x, s, ps, ps + 1);
		// find(x, t, pt, pt + 1);
		// cout << ps[0] << " " << ps[1] << endl;
		// cout << pt[0] << " " << pt[1] << endl;
		// ps[1] = lower_bound(s.begin(), s.end(), x) - s.begin();
		// ps[0] = s[max(ps[1] - 1, 0LL)];
		// ps[1] = s[min(ps[1], ll(s.size() - 1))];
		// pt[1] = lower_bound(t.begin(), t.end(), x) - t.begin();
		// pt[0] = t[max(pt[1] - 1, 0LL)];
		// pt[1] = t[min(pt[1], ll(t.size() - 1))];

		l = 0, r = s.size() - 1;
		while (l <= r) {
			int m = (l + r) / 2;
			if (s[m] < x) {
				l = m + 1;
			} else {
				r = m - 1;
			}
		}
		if (l == s.size()) {
			l--;
		}
		if (r == -1) {
			r++;
		}
		ps[0] = s[r], ps[1] = s[l];

		l = 0, r = t.size() - 1;
		while (l <= r) {
			int m = (l + r) / 2;
			if (t[m] < x) {
				l = m + 1;
			} else {
				r = m - 1;
			}
		}
		if (l == t.size()) {
			l--;
		}
		if (r == -1) {
			r++;
		}
		pt[0] = t[r], pt[1] = t[l];

		ll ans = 2e10;
		for (int i = 0; i < 2; i++) {
			for (int j = 0; j < 2; j++) {
				ans = min(ans, abs(x - ps[i]) + abs(ps[i] - pt[j]));
				ans = min(ans, abs(x - pt[i]) + abs(pt[i] - ps[j]));
			}
		}
		printf("%lld\n", ans);
	}
	return 0;
}

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

using namespace std;
int n;
string s[333];

bool is_good(int dx){
	for(int i = 0; i < n; i++){
		for(int j = 0; j < n; j++){
			if(s[(i+dx)%n][j] != s[(j+dx)%n][(i+0)%n]) return false;
		}
	}
	return true;
}
int main () {
	int m; cin >> n;
	int ans = 0;
	for(int i = 0; i < n; i++) cin >> s[i];
	for(int i = 0; i <= n-1; i++){
		ans += is_good(i) * n;
	}

	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 384
#include <stdio.h>

int main(){
  int i,j,n;
  char mark,c;
  int num;

  scanf("%d",&n);

  int cards[4][13];

  for(i=0;i<4;i++){
    for(j=0;j<13;j++){
      cards[i][j]=0;
    }
  }

  for(i=0; i<n; i++){
    scanf("%c",&c);
    scanf("%c %d",&mark,&num);

    if(mark=='S') j=0;
    else if(mark=='H') j=1;
    else if(mark=='C') j=2;
    else j=3;

    cards[j][num-1]=1;
  }
  
  char str[4]={'S','H','C','D'};

  for(i=0; i<4; i++){
    for(j=0; j<13; j++){
      if(cards[i][j]==0) printf("%c %d\n",str[i],j+1);
    }
  }
  return 0;
}

Measured memory_bytes: 596
#include <stdio.h> 

int main(void)
{	
	int m=0, f=0, r=0, sum;

	while(1)
	{
		scanf("%d %d %d",&m, &f, &r);

		sum = m + f;

		if((m == -1) && (f == -1) && (r == -1))
		{
			break;
		}
		else if((m == -1) || (f == -1))
		{
			printf("F\n");
		}
		else if(sum >=80)
		{
			printf("A\n");
		}
		else if(sum >= 65)
		{
			printf("B\n");
		}
		else if(sum >= 50)
		{
			printf("C\n");
		}
		else if((sum >= 30) &&(r >=50))
		{
			printf("C\n");
		}
		else if(sum >= 30)
		{
			printf("D\n");
		}
		else
		{
			printf("F\n");
		}
	}

	

	return 0;
}

Measured memory_bytes: 584
#include <iostream>
#include <string>

using namespace std;

int main()
{
	string s;
	cin >> s;
	
	bool flag[26] = {false};
	for(int i = 0; i < s.size(); i++)
	{
		if(flag[s[i] - 'a'] == false)
		{
			flag[s[i] - 'a'] = true;
		}
		else
		{
			cout << "no" << endl;
			return 0;
		}
	}
	
	cout << "yes" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
  
int m[101][101];
int p[101];
int length;
  
void MCO(){
  int n,i,l,q,j,k;
  
  n = length;
  
  for(i = 1; i <= n; i++){
    m[i][i] = 0;
  }
  
  for(l = 2; l <= n; l++){
    for(i = 1; i <= n-l+1; i++){
      j = i+l-1;
      m[i][j] = 9999999;
      for(k = i; k <= j-1; k++){
    q = m[i][k] + m[k+1][j] + p[i-1]*p[k]*p[j];
    m[i][j] = min(m[i][j],q);
      }
    }
  }
}
  
int min(int A,int B){
  if(A > B){
    return B;
  }else{
    return A;
  }
}
  
int main(){
  int i;
  
  scanf("%d",&length);
  for(i = 0; i < length; i++){
    scanf("%d%d",&p[i],&p[i+1]);
  }
  
  MCO();
  printf("%d\n",m[1][length]);
  
  return 0;
}

Measured memory_bytes: 636
s = input()
l = len(s)
dif = []

for k in range(l-2):
  x100 = int(s[k])
  x10 = int(s[k+1])
  x1 = int(s[k+2])
  x = x100*100 + x10*10 + x1
  dif.append(abs(753 - x))

print(min(dif))

Measured memory_bytes: 3060
#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
import heapq
from fractions  import gcd
#input=sys.stdin.readline
#import bisect
d,g=map(int,input().split())
g=g//100
pc=[list(map(int,input().split())) for _ in range(d) ]
s=[0]*d
for i in range(d):
    p,c=pc[i]
    s[i]=(i+1)*p+c//100
n=2**d
ans=10**4
for i in range(0,n):
    res=0
    q=0
    for j in range(d):
        if i & (1<<j):
            res+=s[j]
            q+=pc[j][0]
    if g>res:
        q_b=q
        for j in range(d):
            if i & (1<<j):
                continue
            else:
                if (g-res)//(j+1)<pc[j][0]:
                    q_b=q+math.ceil((g-res)/(j+1))
                    ans=min(ans,q_b)
    else:
        ans=min(ans,q)
print(ans)

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<P> VP;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define dbgmint(n,arr) rep(i,n){cerr<<arr[i].x<<" ";}cerr<<endl;
#define out(a) cout<<a<<endl
#define out2(a,b) cout<<a<<" "<<b<<endl
#define vout(v) rep(i,v.size()){cout<<v[i]<<" ";}cout<<endl
#define Uniq(v) v.erase(unique(v.begin(), v.end()), v.end())
#define fi first
#define se second

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

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

template<typename T>istream& operator>>(istream&i,vector<T>&v)
{rep(j,v.size())i>>v[j];return i;}

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<std::setprecision(10);

    ll n;
    cin>>n;
    Vec a(n);
    cin>>a;
    Vec b(n);
    rep(i,n){
        if(i+1==a[i]){
            b[i] = 1;
        }
    }
    Vec s(n+2);
    rep(i,n){
        if(b[i]==0)continue;
        s[i+1] = s[i]+b[i];
    }
    ll ans=0;
    rep(i,n+1){
        if(s[i+1]==0){
            ans += (s[i]+1)/2;
        }
    }
    cout<<ans<<endl;
    return  0;
}


Measured memory_bytes: 2560
n,m=map(int,input().split())
s=input()
t=input()
def gcd(n,m):
    n,m=sorted([n,m])
    while(m%n!=0):
        n,m=m%n,n
    return n
def lcm(n,m):
    return n*m//gcd(n,m)
g=gcd(n,m)
ans=lcm(n,m)
n//=g
m//=g
for i in range(g):
    if(s[i*n]!=t[i*m]):
        print(-1)
        break
else:
    print(ans)

Measured memory_bytes: 3316
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <cctype>
#include <unordered_map>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<long, long>;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
#define rep(i, n) for(int i = 0; i<n; i++)
#define rep_s(i, start, n) for(int i= start;  i<n; i++)
#define rep_down(i, n) for(int i = n-1; i>=0; i--)
#define rep_down_s(i, n, start) for(int i = n-1; i>=start; i--)
#define ALL(a) (a).begin(), (a).end()
#define ALL_str(a) (a).cbegin(), (a).cend()

string alphabet_upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alphabet_lower  = "abcdefghijklmnopqrstuvwxyz";
string numbers = "0123456789";
/*
for (iterator = hash.begin(); iterator != hash.end(); iterator++)
{
// ここで、要素毎の操作を行います。
std::pair<std::string, CMyClass> element = *iterator;

}
*/
/*
using edge = struct {int to; ll cost;};
vector<edge> tree[limit];
ll depth[limit];

void dfs(int v, int p, ll d){
  depth[v] = d;
  //cout <<"v: " << v << endl;
  for (auto &e: tree[v]){
    //cout << "e.to: " << e.to << endl;
    if (e.to == p) continue;
    dfs(e.to, v, d+e.cost);
  }
}
*/
int keta_sum(int num){
  int dig, sum = 0;
  while(num){
    dig = num % 10;
    sum = sum + dig;
    num = num / 10;
  }
  return sum;
}

ll binary_search(ll left_key, ll border, ll low, ll high) {
     // 配列 a の左端と右端
    ll mid = (low+high)/2;
    while (high > low+1) {
       mid = (low+high)/2;
        if (left_key*mid>border) high = mid;
        else if (left_key*mid<border) low = mid;
        else {
          mid =mid-1;
          break;
        }
    }
    return mid;
}

bool IsPrime(ll a){
  ll b = sqrt(a);
  b++;
  while(b-->=2){
    if (a%b==0) return false;
  }
  return true;
}

ll gcd(ll a, ll b){
  ll tmp;
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }

  ll r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main(void){
  ll N, M, A, B, C, D,E,K,W, H, Q, X, Y;
  ll ans;
  string S, T;
  ll nums[5];
  cin >> A >> B>> N;
  cout << N/A *B << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
  int x, y;

  while (1)
  {
    scanf("%d %d", &x, &y);
    if (x == 0 && y == 0)
      break;
    else if (x <= y)
      printf("%d %d\n", x, y);
    else
      printf("%d %d\n", y, x);
  }
  
  return 0;
}


Measured memory_bytes: 2020
from collections import deque

# リストでグラフを表現する
n = int(input())
G = [input().split()[2:] for _ in range(n)]

# 頂点1から各頂点への距離を-1 (頂点1からたどり着けない)で初期化する
d = [-1] * n

que = deque()  # 訪問予定の頂点を格納する

# 初期状態をキューに入れる
que.append(0)
d[0] = 0

while que:
    p = que.popleft()  # FIFOでキューの要素を取り出し、その頂点を訪ねる。
    for v in G[p]:
        v = int(v) - 1
        if d[v] < 0:  # まだ訪れたことがない
            que.append(v)
            # 距離を記録する
            d[v] = d[p] + 1


for i in range(n):
    print(i+1, d[i])


Measured memory_bytes: 6044
N = int(input())
P = tuple(map(int,input().split()))
Q = tuple(map(int,input().split()))
from itertools import permutations
s = list(permutations([i for i in range(1,N+1)]))
for i,e in enumerate(s):
    if e == P:
        p_ans = i
    if e == Q:
        q_ans = i
print(abs(p_ans-q_ans))

Measured memory_bytes: 8052
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int m;
int d[200005];
ll c[200005];

int main(void){
	scanf("%d",&m);
	ll sum=0;
	ll sum2=0;
	for(int i=0;i<m;i++){
		scanf("%d%lld",&d[i],&c[i]);
		sum2+=c[i]*d[i];
		sum+=c[i];
	}
	ll ans=sum-1LL;
	while(sum2>=10LL){
		ans+=sum2/10LL;
		sum2=sum2/10LL+sum2%10LL;
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 2560
#include <vector>
#include <list>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <cstdio>
#include <climits>
#include <complex>
#include <cstdint>
#include <tuple>

#define M_PI       3.14159265358979323846

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }
inline int readInt() { int x; scanf("%d", &x); return x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

int main() {
    //cout << fixed << setprecision(15);

    int n, m; cin >> n >> m;


    cout << (n*3+m)/2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define x first
#define y second
using namespace std;
typedef long long ll;
typedef pair<double,double> PAIR;
const int N = 5e5+5;
const int INF = 0x3f3f3f3f;

int a[N];

int main(){
	int k,n;
	scanf("%d %d",&k,&n);
	for(int i = 1;i <= n;i++){
		scanf("%d",&a[i]);
	}
	int ma = 0;
	for(int i = 2;i <= n;i++){
		if(a[i] - a[i-1] > ma) ma = a[i] - a[i-1];
	}
	ma = max(ma,k-a[n]+a[1]);
	cout << k - ma << endl;
    return 0;
}

Measured memory_bytes: 1024
i = j = k = 0
n = ''
m = ''
l = ''

line = input()

while line[i] != ' ':
    n = n + line[i]
    i += 1

i += 1
while line[i] != ' ':
    l = l + line[i]
    i += 1

while i < len(line):
    m = m + line[i]
    i += 1
    
n = int(n)
l = int(l)
m = int(m)

if n < l and l < m:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 7680
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

n = input()[:-1]

n = int(n[-1])

if n == 2 or n == 4 or n == 5 or n == 7 or n == 9:
    print("hon")
elif n == 3:
    print("bon")
else:
    print("pon")

















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

int main() {
  int a, b;
  cin >> a >> b;
  int ans = 0;
  for (int i = a; i <= b; i++){
    if (i % 10 == i / 10000 && i % 100 / 10 == i / 1000 % 10) ans++;
  }
  cout << ans << endl;
}

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

int A, B ,C, K;

int main(void){

    cin >> A >> B >> C >> K;

    bool ans = false;

    for (int i = 0;i <= K;i++){
        if (C > B && B > A){
            ans = true;
        } else if (B > A){
            C = C * 2;
        } else {
            B = B * 2;
        }
    }

    if (ans) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 3632
import java.util.Scanner;
class Main{
    int a,b;
    String op;
    boolean sw = true;
    public void solve(){
        Scanner sc = new Scanner(System.in);
        sc.useDelimiter("\\s");
        while (sw == true){
            a = sc.nextInt();
            op = sc.next();
            b = sc.nextInt();
            if(op.equals("+")){
                System.out.println(a + b);
            }else if(op.equals("-")){
                System.out.println(a - b);
            }else if(op.equals("*")){
                System.out.println(a * b);
            }else if(op.equals("/")){
                System.out.println(a / b);
            }else{
                sw = false;
            }
        }

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

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

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef pair<ll,ll> pll;


#define rep(i,m,n) for(ll i=m;i<n;i++)

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

 ll n,m;
  cin >> n >> m;
 map<ll,ll> mp;
  rep(i,0,m){
   ll a,b;
    cin >> a >> b;
    mp[a]++;
    mp[b]++;
  }
  
  bool flag=true;
  for(auto p:mp) if(p.second%2) flag=false;
  

 if(flag) cout << "YES" << endl;
 else cout << "NO" << endl;
  
  
}

Measured memory_bytes: 5632
#include <bits/stdc++.h>
using namespace std;
 
typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
#define MP make_pair
#define PB push_back
#define X first
#define Y second
 
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define ITER(it, a) for(__typeof(a.begin()) it = a.begin(); it != a.end(); ++it)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())
#define FILL(a, value) memset(a, value, sizeof(a))
#define debug(a) cout << #a << " = " << a << endl;

const double PI = acos(-1.0);
const LL INF = 1e9 + 47;
const LL LINF = INF * INF;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

LL solve(string s)
{
	LL cnt = 0;
	LL ans = 0;
	for(auto i: s)
		if (i == 'A')
			++cnt;
		else
			ans += cnt;
	return ans;
}

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//freopen("In.txt", "r", stdin);
	//freopen("In.txt", "w", stdout);
	
	string s;
	cin >> s;
	int n = SZ(s);
	LL ans = 0;
	string t;
	FOR(i, 0, n)
	{
		if (s[i] == 'A')
		{
			t += s[i];
			continue;
		}
		
		if (i + 1 < n && s[i] == 'B' && s[i + 1] == 'C')
		{
			t += 'X';
			++i;
			continue;
		}
		
		ans += solve(t);
		t.clear();
	}
	
	ans += solve(t);
	
	cout << ans << endl;
	cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;
	return 0;
}


Measured memory_bytes: 916
#include<bits/stdc++.h>
using namespace std;
int aa[105];
int main(){
    int a,b,c,d,e,f,g,h,i,n,m,x;
    cin>>x>>n;
    int ar[n+1];
    for(i=1;i<=n;i++) cin>>ar[i];
    for(i=1;i<=n;i++) aa[ar[i]]++;
    d=0;
    while(1){
        if(d<=x){
            if(!aa[x-d]){
                c=x-d;
                break;
            }
        }
        if(!aa[x+d]){
            c=x+d;
            break;
        }
        d++;
    }
    cout<<c<<"\n";
}

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

int main(){
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  a+=b;
  c+=d;
  if(a==c) puts("Balanced");
  if(a>c) puts("Left");
  if(a<c) puts("Right");
}

Measured memory_bytes: 256
import java.util.*;
import java.util.function.*;
import java.math.*;
public class Main {
    public static void main(String[] args){
		Scanner s = new Scanner(System.in);
		int X = s.nextInt();
		int N = s.nextInt();
		boolean[] p = new boolean[200];
		for(int i = 0; i < N; i++) {
			p[s.nextInt()] = true;
		}
		int plus = 1;
		int minus = 1;
		
		if(!p[X]) {
			System.out.println(X);
			return;
		}
		
		while(true) {
			if((X-minus >= 0 && !p[X-minus]) || X-minus < 0) {
				System.out.println(X-minus);
				return;
			}else {
				minus++;
			}
			if(!p[X+plus]) {
				System.out.println(X+plus);
				return;
			}else {
				plus++;
			}
		}
	}
}

Measured memory_bytes: 35908
from sys import stdin
input = stdin.readline
def BFS(K,path,N):
  """リストのリスト道順path,頂点の個数Nが与えられたとき, 頂点Kから各頂点までの距離をlistで返す"""
  from collections import deque
  dist=[-1]*N
  dist[K]=0
  que=[]
  que.append(K)
  while que:
    label=que.pop(-1)
    for i,c in path[label]:
      if dist[i]==-1:
        dist[i]=dist[label]+c
        que+=[i]
  return dist
 
N=int(input())
path=[ [] for i in range(N)]
for i in range(N-1):
  a,b,c=map(int,input().split())
  path[a-1]+=[(b-1,c)]
  path[b-1]+=[(a-1,c)]
Q,K=map(int,input().split())
xy=[list(map(int,input().split())) for i in range(Q)]
distance=BFS(K-1,path,N)
for i in range(Q):
  print(distance[xy[i][0]-1]+distance[xy[i][1]-1])

Measured memory_bytes: 68024
import java.util.Scanner;
 
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int numA = sc.nextInt();
        int numB = sc.nextInt();
        //numAとnumBの大小比較
        if(numA>numB)
        System.out.println("a > b");
        else if(numA<numB)
        System.out.println("a < b");
        else if(numA==numB)
        System.out.println("a == b");
    }
}



Measured memory_bytes: 26340
import sys
from itertools import accumulate

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60

N, M, Q = map(int, readline().split())
G = [[0] * N for _ in range(N)]
for _ in range(M):
    l, r = map(int, readline().split())
    G[l - 1][r - 1] += 1

csum = [[0] * (N + 1) for _ in range(N + 1)]
for i in range(N):
    for j in range(N):
        csum[i + 1][j + 1] = csum[i + 1][j] + csum[i][j + 1] - csum[i][j] + G[i][j]

ans = []
for _ in range(Q):
    p, q = map(int, readline().split())
    ans.append(csum[q][q] - csum[q][p - 1] - csum[p - 1][q] + csum[p - 1][p - 1])

print(*ans, sep='\n')


Measured memory_bytes: 21184
using System;
class kuku{
  public static void Main(){
    String[] str = Console.ReadLine().Split(' ');
    int a = int.Parse(str[0]);
    int b = int.Parse(str[1]);
    int ret;
    if(a >= 10 || b>= 10){
      ret = -1;
    }
    else{
      ret = a*b;
    }
    Console.WriteLine(ret);
  }
}


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

#define INF 1e9
using namespace std;

int main() {

    int N; cin >> N;

    vector<int> b(N);
    for (int i = 0; i < N; ++i) {
        cin >> b[i];
    }

    int b_size;
    b_size = b.size();
    vector<int> ans;

    while (ans.size() < b_size) {
        int max_j = -1;
        for (int j = 0; j < b.size(); ++j) {
            if (b[j] == j + 1) {
                max_j = j;
            }
        }

        if (max_j == -1) {
            cout << -1 << endl;
            return 0;
        }

        ans.push_back(b[max_j]);
        b.erase(b.begin() + max_j);
    }

    reverse(ans.begin(), ans.end());

    for (int k = 0; k < N; ++k) {
        cout << ans[k] << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define NewNode (ListNode *)malloc(sizeof(ListNode))
#define Mem(a,b) memset(a,b,sizeof(a))
const int N = 1e5 + 5;
const int INF = 0x3f3f3f3f;
const double EPS = 1e-10;
const unsigned long long mod = 998244353;
const double II = 3.1415926535;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> piil;
int main()
{
    std::ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);
    string s,n;
    cin >> s >> n;
    int ans = 1;
    for(int i = 0;i < s.size();i++)
        if(s[i] != n[i])
            ans = 0;
    ans ? cout << "Yes" << endl : cout << "No" << endl;
}


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

int main(){
    
    string s;
    cin >> s;
    int len = s.size();
    bool play = true;
    for(int i = 1; i <= len; i++){
        if(i % 2 == 0){
            if(s[i-1] == 'R'){
                play = false;
                break;
            }
        }else{
            if(s[i-1] == 'L'){
                play = false;
                break;
            }
        }
    }
    
    if(play) cout << "Yes";
    else cout << "No";
    
}


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

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

 int p[5000];

 for(int i=0;i<n;i++){
	cin>>p[i];
 }

 int min_sum=20000;

 for(int i=0;i<=p[0];i++){
	int q[5000];
	for (int j=0;j<n;j++){
		q[j]=p[j];
	}

	int sum=i;
	q[0]-=i;

	for(int j=0;j<=n-2;j++){
		if(q[j]<=0)	continue;

		sum+=q[j]*2;
		q[j+1]-=q[j];
	}

	if(q[n-1]>0){
		sum+=q[n-1];
	}
	min_sum=min(min_sum,sum);
 }
 cout <<min_sum<<endl;

 return 0;
}

Measured memory_bytes: 3132
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

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

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
const ll mod = 1e9 + 7;

const int N = 101;
const int K = 256;
ll fact[N];



ll dp[N][N][K];

int main(void){
  int n, k;
  cin >> n >> k;
  VI a(n);
  REP(i, 0, n) {
    cin >> a[i];
  }
  fact[0] = 1;
  REP(i, 1, N) {
    fact[i] = fact[i - 1] * i % mod;
  }
  dp[0][0][0] = 1;
  REP(i, 0, n) {
    REP(j, 0, i + 1) {
      REP(l, 0, K) {
	dp[i + 1][j][l] += dp[i][j][l];
	dp[i + 1][j][l] %= mod;
	dp[i + 1][j + 1][l] += dp[i][j][l ^ a[i]];
	dp[i + 1][j + 1][l] %= mod;
      }
    }
  }
  
  ll cnt = 0;
  REP(i, 0, n + 1) {
    cnt += dp[n][i][k] * fact[i] % mod;
    cnt %= mod;
  }
  cout << cnt << endl;
}


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

int main(){
	int N, M;
	cin >> N >> M;
	vector<int> city(N, 0);
	for(int i = 0; i < M; i++){
		int a, b;
		cin >> a >> b;
		city.at(a - 1) += 1;
		city.at(b - 1) += 1;
	}
	for(int i = 0; i < N; i++) cout << city.at(i) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n)    for(int i = 0; i < (n); ++i)
#define RREP(i,n)   for(int i = (n); i >= 0; --i)
#define FOR(i,m,n) for(int i = (m); i < (n); ++i)
#define SZ(x)       ( (int)(x).size() )
#define BIT(n)      ( 1LL << (n) )
#define EXIST(x)    ( (x).find()		!= (x).end() )
#define DEBUG(n)    cerr << #n << " : " << n << '\n';
#define PB  push_back
#define UB  upper_bound			//k <
#define LB  lower_bound			//k	<= 
#define F   first
#define S   second
#define INF 1.0e9


using namespace std;

typedef long long			ll;
typedef pair<int, int>		pii;
typedef pair<long			long, long long>   pll;
typedef vector<int>			vi;
typedef vector<double>		vd;
typedef vector<long long>   vll;

template<class T> void chmax(T &	a, const T & b){ if( a < b ) a = b; }
template<class T> void chmin(T &	a, const T & b){ if( a > b ) a = b; }

int r_up(const int a, const int b){ return (a + b - 1) / b; }

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

int main(){
  int n,k;cin>>n>>k;
  string s;cin>>s;
  s[k-1] -= ('A' -'a');
  cout<<s<<endl;
  return 0;
}


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

#define dump(...) cout<<"# "<<#__VA_ARGS__<<'='<<(__VA_ARGS__)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

using uint=unsigned;
using ll=long long;
using ull=unsigned long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vd=vector<double>;
using vvd=vector<vd>;
using vs=vector<string>;

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}

template<typename Tuple>
void print_tuple(ostream&,const Tuple&){}
template<typename Car,typename... Cdr,typename Tuple>
void print_tuple(ostream& os,const Tuple& t){
	print_tuple<Cdr...>(os,t);
	os<<(sizeof...(Cdr)?",":"")<<get<sizeof...(Cdr)>(t);
}
template<typename... Args>
ostream& operator<<(ostream& os,const tuple<Args...>& t){
	print_tuple<Args...>(os<<'(',t);
	return os<<')';
}

template<typename Ch,typename Tr,typename C>
basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>& os,const C& c){
	os<<'[';
	for(auto i=begin(c);i!=end(c);++i)
		os<<(i==begin(c)?"":" ")<<*i;
	return os<<']';
}

constexpr int INF=1e9;
constexpr int MOD=1e9+7;
constexpr double EPS=1e-9;

int main()
{
	for(ll n,x;cin>>n>>x && n|x;){
		ll g=__gcd(n,x);
		cout<<3*(n-g)<<endl;
	}
}


Measured memory_bytes: 256
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1111111111;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

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

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N;
	cin >> N;

	struct data { lint x, y, h; };
	vector<data> d(N);
	for (int i = 0; i < N; i++) cin >> d[i].x >> d[i].y >> d[i].h;

	for (int x = 0; x <= 100; x++) {
		for (int y = 0; y <= 100; y++) {
			
			data md = *min_element(d.begin(), d.end(),
				[&](data &l, data &r) {
				return l.h + abs(l.x - x) + abs(l.y - y) < r.h + abs(r.x - x) + abs(r.y - y);
			});
			lint ref = md.h + abs(md.x - x) + abs(md.y - y);

			if (all_of(d.begin(), d.end(), 
				[&](data &d) { return max(ref - abs(d.x - x) - abs(d.y - y), 0LL) == d.h; })) {

				cout << x << " " << y << " " << ref << "\n";
				return 0;
			}

		}
	}

	return -1;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N,X;
    cin >> N >> X;
    vector<int> L(N);
    for(int i=0; i<N; i++)
    {
        cin >> L.at(i);
    }
    int64_t count=0;
    int64_t sum=0;
    for(int i=0; i<N; i++)
    {
        sum+=L.at(i);
        if(sum<=X)
        {
            count++;
        }
    }
    cout << count+1<< endl; 
    
}


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;
use std::collections::BTreeSet;
use std::collections::HashMap;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .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")
}


fn main() {
    let n: u32 = read();
    let k: i32 = read();
    let ai: Vec<u32> = (0..n).map(|_| read()).collect();
    let uniq: BTreeSet<u32> = ai.iter().cloned().collect();

    let diff: i32 = uniq.len() as i32 - k;

    if diff <= 0 {
        println!("0")
    } else {
        let mut map = HashMap::new();
        for a in ai.iter() {
            if map.contains_key(a) {
                if let Some(x) = map.get_mut(a) {
                    *x += 1;
                }
            } else {
                map.insert(a, 1);
            }
        }
        let mut counts: Vec<u32> = map.values().cloned().collect();
        counts.sort();
        let res: u32 = counts.iter().take(diff as usize).sum();;
        println!("{}", res);
    }
}


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

using namespace std;

#define all(x) x.begin(), x.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define reps(i, m, n) for (int i = m; i <= n; ++i)

using i64 = long long;
using pii = pair<i64, i64>;

template<class A, class B>inline bool chmax(A &a, const B &b){return b > a ? a = b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b < a ? a = b,1 : 0;}

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod = int(1e9) + 7;

#define max 100010

bool isPrime[max];
int cum[max];

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

  isPrime[2] = true;
  for (int i = 3; i < max; i += 2) isPrime[i] = true;
  for (int i = 3; i * i < max; i += 2) {
    if (isPrime[i]) {
      for (int j = i * i; j < max; j += i) isPrime[j] = false;
    }
  }

  for (int i = 3; i < max; i += 2) {
    cum[i] = cum[i-2];
    if (isPrime[i] && isPrime[(i+1)/2]) ++cum[i];
  }

  int q;
  cin >> q;

  rep(i, q) {
    int l, r;
    cin >> l >> r;
    cout << cum[r] - cum[l-2] << "\n";
  }

  return 0;
}

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

#define ll long long
#define endl "\n"

void solve() {
  ll n;
  cin >> n;
  ll ans = 0;
  for (ll i = 1; i <= n; ++i)
    for (ll j = 1; j * i < n; ++j)
      ++ans;
  cout << ans << endl;
}

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
  return 0;
}

Measured memory_bytes: 3648
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main()
{
  int n,i,count=0;
  cin>>n;
  string s[n];
  for(i=0 ; i<n ; i++)
    cin>>s[i];
  sort(s,s+n);
  for(i=0 ; i<n ; i++)
  {
    if(!binary_search(s,s+i,s[i]))
      count++;
  }
  cout<<count;
  
}

Measured memory_bytes: 9852
#include <bits/stdc++.h> // Tomasz Nowak
using namespace std;     // XIII LO Szczecin
using LL = long long;    // Poland
#define FOR(i, l, r) for(int i = (l); i <= (r); ++i)
#define REP(i, n) FOR(i, 0, (n) - 1)
template<class T> int size(T &&x) {
	return int(x.size());
}
template<class A, class B> ostream& operator<<(ostream &out, const pair<A, B> &p) {
	return out << '(' << p.first << ", " << p.second << ')';
}
template<class T> auto operator<<(ostream &out, T &&x) -> decltype(x.begin(), out) {
	out << '{';
	for(auto it = x.begin(); it != x.end(); ++it)
		out << *it << (it == prev(x.end()) ? "" : ", ");
	return out << '}';
}
void dump() {}
template<class T, class... Args> void dump(T &&x, Args... args) {
	cerr << x << ";  ";
	dump(args...);
}
#ifdef DEBUG
  struct Nl{~Nl(){cerr << '\n';}};
# define debug(x...) cerr << (strcmp(#x, "") ? #x ":  " : ""), dump(x), Nl(), cerr << ""
#else
# define debug(...) 0 && cerr
#endif
mt19937_64 rng(0);
int rd(int l, int r) {
	return uniform_int_distribution<int>(l, r)(rng);
}
// end of templates

int n;
vector<vector<int>> dist, nonfree;

bool valid(int x, int y) {
	return 0 <= x and x < n and 0 <= y and y < n;
}

constexpr int sides = 4;
array<int, sides> dx = {0, 1, 0, -1},
				  dy = {1, 0, -1, 0};

void update(int x, int y) {
	int mn = n;
	REP(s, sides) {
		int xx = x + dx[s],
			yy = y + dy[s];
		if(valid(xx, yy))
			mn = min(mn, dist[xx][yy]);
		else
			mn = 0;
	}
	if(dist[x][y] > mn + nonfree[x][y]) {
		dist[x][y] = mn + nonfree[x][y];
		REP(s, sides) {
			int xx = x + dx[s], yy = y + dy[s];
			if(valid(xx, yy))
				update(xx, yy);
		}
	}
}

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

	cin >> n;
	dist.resize(n, vector<int>(n));
	REP(x, n)
		REP(y, n)
			dist[x][y] = min(min(x, n - 1 - x), min(y, n - 1 - y)) + 1;
	debug(dist);

	nonfree.resize(n, vector<int>(n, 1));

	LL answer = 0;
	REP(iter, n * n) {
		int p;
		cin >> p;
		--p;
		int x = p % n,
			y = p / n;
		debug(x, y);
		answer += dist[x][y] - 1;
		--nonfree[x][y];
		update(x, y);
		debug(dist);
	}
	cout << answer << '\n';
}


Measured memory_bytes: 20560
//
// Created by Tetsuya Shiota on 2019-03-30.
//

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<vector>
#include<map>
#include<set>
#include<cstdlib>
#include<string>
#include<sstream>

using namespace std;

int main(){
    int A, B, C;

    cin >> A >> B >> C;
    if(A==B && C == B){
        cout << "Yes" <<endl;
    }else{
        cout << "No"<<endl;
    }

    return 0;

}

Measured memory_bytes: 888
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <queue>
#include <vector>
#include <functional>
#include <map>
#include <set>
#include <cmath>
#include <string>
#define SIZE 200005
#define INF 1000000005LL

#include<iostream>

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

int n;
int A[SIZE];

int main(){
	string S,T;
	cin >> S >> T;
	int n = S.size();
	for(int i=0;i<n;i++){
		string A = S.substr(n-1);
		S.erase(n-1);
		S.insert(0,A);
		if(S==T){
			printf("Yes\n");
			return 0;
		}
		//cout << S << endl;
	}
	printf("No\n");
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include <vector>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
int a[12][12];
const int INF=1001001001;
int main(){
  int n,m,x;
  cin>>n>>m>>x;
  vector<int> c(n);
  rep(i,n){
    cin >> c[i];
    rep(j,m) cin>>a[i][j];
  }
  int ans=INF;
  rep(s,1<<n){ //シフト演算子で２進数のままn個シフトする つまり2のn乗
    int cost=0;
    vector<int> d(m);
    rep(i,n){
      if(s>>i&1){//sを1ビット下げると最下位ビットにくる　それと１の＆を取ることで　iビット目を取り出す
	cost+=c[i];
	rep(j,m) d[j]+= a[i][j];
      }
    }
    bool ok =true;
    rep(j,m) if(d[j]<x) ok=false;
    if(ok) ans=min(ans,cost);
  }
  if(ans==INF) cout<<-1<<endl;
     else cout<< ans <<endl;
 
  return 0;
}


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

using namespace std;

#define DUMP(x) std::cout << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()

using ll = std::int64_t;
using vint = std::vector<int>;
using vll = std::vector<ll>;
using pint = std::pair<int, int>;

constexpr std::int32_t INF = 1001001001;

void Main() {
    string s, t;
    cin >> s >> t;

    int ans = 0;
    rep(i, 3) {
        if (s[i] == t[i])++ans;
    }
    cout << ans << endl;

}

int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}



Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const int inf = 1e9;
int n;

int main(){
  cin>>n;
  vector<int> vec(n), depth(n);
  for(int i = 1; i < n; ++i){cin>>vec[i];vec[i]--;}
  for(int i = 1; i < n; ++i)depth[vec[i]]++;
  for(auto x : depth)cout<<x<<endl;
  
  
  return 0;
}


Measured memory_bytes: 4840
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>
 
#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")
 
using namespace std;
 
#define int long long
//typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;
 
const int INF=1e+9;
const double EPS=1e-9;
const int MOD=1000000007;
 
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

int gcd(int a,int b){
	while(a && b){
	if(a > b) a %= b;
	else b %= a;
	}
	return max(a,b);
}

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

signed main(){
	int n,l = 1;
	cin >> n;
	for(int i = 0;i < n;i++){
		int a;
		cin >> a;
		l = lcm(l,a);
	}
	cout << l << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		Set<String> set = new HashSet<>();
		for (int i = 0; i < N; i++) {
			set.add(sc.next());
		}
		System.out.println(set.size());
	}
}

Measured memory_bytes: 77988
#include <iostream>
#include <string>

int N;

int main(){

	std::cin >> N;

	int lower = 1, upper = N - 1, middle;
	int m0;
	std::string s0;
	std::cout << 0 << std::endl;
	std::cin >> s0;
	if(s0 == "Vacant"){
		return 0;
	}
	if(s0 == "Male"){
		m0 = 0;
	}
	else{
		m0 = 1;
	}
	while(lower != upper){
		middle = (lower + upper) / 2;
		std::string s;
		std::cout << middle << std::endl;
		std::cin >> s;

		if(s == "Vacant"){
			return 0;
		}
		if(s == "Male"){
			if((middle - m0) % 2 == 0){
				lower = middle + 1;
			}
			else{
				upper = middle - 1;
			}
		}
		else{
			if((middle - m0) % 2 == 1){
				lower = middle + 1;
			}
			else{
				upper = middle - 1;
			}
		}
	}
	std::string tmp;
	std::cout << lower << std::endl;
	std::cin >> tmp;	

	return 0;
}


Measured memory_bytes: 852
#pragma region
#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define reps(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; --i)
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define eb emplace_back
#define debug(x) cerr << #x << ": " << x << '\n'
#define INF 1e9
using namespace std;
template <class T = int>
T in()
{
  T x;
  cin >> x;
  return (x);
}

typedef long long ll;
template <class T>
bool chmax(T &a, const T &b)
{
  if (a < b)
  {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
  if (b < a)
  {
    a = b;
    return 1;
  }
  return 0;
}

#pragma endregion

int main()
{
  int n = in();

  switch (n % 10)
  {
  case 2:
  case 4:
  case 5:
  case 7:
  case 9:
    cout << "hon" << endl;
    break;
  case 0:
  case 1:
  case 6:
  case 8:
    cout << "pon" << endl;
    break;
  case 3:
    cout << "bon" << endl;
    break;
  }

  return 0;
}


Measured memory_bytes: 3596
n, m = list(map(int, input().split()))
a=[]
for i in range(n):
	a.append([int(j) for j in input().split()])
b = []
for i in range(m):
	b.append(int(input()))
for i in range(n):
	s = 0
	for j in range(m):
		s += a[i][j] * b[j]
	print(s)
	


Measured memory_bytes: 6008
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
typedef long long int ll;
int main(){
  int n;
  cin >>n;
  int p[n];
  for(int i=0;i<n;i++) cin >> p[i];
  sort(p,p+n);
  ll ans=p[n-1]/2;
  for(int i=0;i<n-1;i++) ans+=p[i];
  cout <<ans<<endl;
}


Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vvb> vvvb;
typedef vector<vvvb> vvvvb;
typedef vector<string> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<ll, ll> PL;
typedef vector<PL> vpl;
typedef vector<vector<PL>> vvpl;
const int INF = 1001001001;
const ll LINF = 1e17;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define RFOR(i, a, b) for(ll i = (a); i > b; i--)
#define rep(i, n) for(ll i = 0; i < n; i++)
#define rrep(i, n) for(ll i = n-1; i > -1; i--)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back
#define epb emplace_back
#define ALL(X) (X).begin(),(X).end()

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}

inline ll popcnt(ll x){return __builtin_popcountll((unsigned long long)x);};
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }




int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ll N, Q; cin >> N >> Q;
    vl A(N); rep(i, N) cin >> A[i];
    reverse(ALL(A));
    vl sum(N+1, 0), esum(N+1, 0);
    rep(i, N){
        sum[i+1] = sum[i] + A[i];
        esum[i+1] = esum[i] + (i%2 == 0 ? A[i] : 0);
    }
    vl th, val;
    for(ll i = 0; 2*i+1 < N; i++){
        th.pb((A[i+1]+A[2*i+2])/2+1);
        val.pb(sum[i+1] + esum[N]-esum[2*i+2]);
    }
    
    reverse(ALL(th)); reverse(ALL(val));
    rep(_, Q){
        ll x; cin >> x;
        ll idx = upper_bound(ALL(th), x) - th.begin();
        if(idx == 0) cout << sum[(N+1)/2] << endstr;
        else cout << val[idx-1] << endstr;
    }
    
    return 0;
}


Measured memory_bytes: 5108