akhauriyash/Code-Regression huggingface dataset:
#include "iostream"
#include "algorithm"
#include "cstring"
#include "cstdio"
#include "cmath"
#include "vector"
#include "map"
#include "set"
#include "queue"
using namespace std;
#define MAXN 200016
//#define int long long
#define rep(i, a, b) for (int i = (a), i##end = (b); i <= i##end; ++i)
#define per(i, a, b) for (int i = (a), i##end = (b); i >= i##end; --i)
#define pii pair<int,int>
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
int n , m , k;
int A[MAXN];
bool apl( char* s , int l ) {
    for( int i = 0 ; i < l ; ++ i ) {
        if( s[i] != s[l - i - 1] ) return false;
    }
    return true;
}
char str[MAXN];
void solve( ) {
    cin >> str;
    int n = strlen( str );
    if( apl( str , n ) && apl( str , (n - 1) / 2 ) && apl( str + ( n + 3 ) / 2 - 1 , ( n - ( n + 3 ) / 2 ) + 1 )) puts("Yes");
    else puts("No");
}
signed main() {
//    int T;cin >> T;while( T-- ) solve();
    solve();
}


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

int main(){
    
    long long int n,k;
    cin >> n >> k;
    
    long long int ans=0;
    for(long long int i=k; i<=n+1; i++){
        ans+=i*n-i*i+i+1;
        //cout << ans << endl;
        if(ans>=1000000007) ans%=1000000007;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3596
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
#include <sstream>
#include <set>
#include <queue>
#include <stack>
#include <cctype>
#include <map>
#include <climits>
#include <bitset>
using namespace std;
int main(){
	ios::sync_with_stdio(false);
	long long iSqrt,iNum;
	string sNum1, sNum2;
	stringstream ssStringStream;
	while (cin >> sNum1 >> sNum2){
		sNum1 += sNum2;
		ssStringStream << sNum1;
		ssStringStream >> iNum;
		iSqrt = int(sqrt(iNum));
		if (iSqrt*iSqrt == iNum)
			cout << "Yes\n";
		else
			cout << "No\n";
		ssStringStream.clear();
	}
	endapp:
	//system("pause > nul");
	return 0;
}

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

for i in range(M):
  p, s = input().split()
  
  if s == "AC":
    AC[int(p)-1] = 1
  elif s == "WA" and AC[int(p)-1] < 1:
    WA[int(p)-1] += 1

resWA = map(lambda x, y: x*y, AC, WA)    

print(sum(AC), sum(resWA))


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

int main() {
    int n;
    cin >> n;
    vector<int> odd;
    vector<int> even;
    rep(i, n) {
        int v;
        cin >> v;
        if (i % 2 == 0)
            even.push_back(v);
        else
            odd.push_back(v);
    }

    vector<int> oddNum(100001, 0);
    vector<int> evenNum(100001, 0);
    rep(i, n/ 2) {
        oddNum[odd[i]] += 1;
        evenNum[even[i]] += 1;
    }

    vector<int>::iterator oddMax1Itr = max_element(oddNum.begin(), oddNum.end());
    size_t oddMax1Idx = distance(oddNum.begin(), oddMax1Itr);
    int tmp = oddNum[oddMax1Idx];
    oddNum[oddMax1Idx] = -1;
    vector<int>::iterator oddMax2Itr = max_element(oddNum.begin(), oddNum.end());
    size_t oddMax2Idx = distance(oddNum.begin(), oddMax2Itr);
    oddNum[oddMax1Idx] = tmp;

    vector<int>::iterator evenMax1Itr = max_element(evenNum.begin(), evenNum.end());
    size_t evenMax1Idx = distance(evenNum.begin(), evenMax1Itr);
    tmp = evenNum[evenMax1Idx];
    evenNum[evenMax1Idx] = -1;
    vector<int>::iterator evenMax2Itr = max_element(evenNum.begin(), evenNum.end());
    size_t evenMax2Idx = distance(evenNum.begin(), evenMax2Itr);
    evenNum[evenMax1Idx] = tmp;

    ll ans = 0LL;
    if (oddMax1Idx != evenMax1Idx)
    {
        ans = n - oddNum[oddMax1Idx] - evenNum[evenMax1Idx];
    } else {
        // if (oddNum[oddMax2Idx] > evenNum[oddMax2Idx]) {
        //     ans = n - oddNum[oddMax2Idx] - evenNum[evenMax1Idx];
        // } else {
        //     ans = n - oddNum[oddMax1Idx] - evenNum[evenMax2Idx];
        // }
        ll cnd1 = n - oddNum[oddMax2Idx] - evenNum[evenMax1Idx];
        ll cnd2 = n - oddNum[oddMax1Idx] - evenNum[evenMax2Idx];
        ans = (cnd1 < cnd2) ? cnd1 : cnd2;
    }

    cout << ans << endl;
}


Measured memory_bytes: 1660
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
using namespace std;
int main(int argc, char *argv[])
{
	string s;
	cin>>s;
	if(s.length()==2)
		cout<<s<<endl;
	else
		cout<<s[2]<<s[1]<<s[0]<<endl;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
g = [[] for _ in range(n ** 2)]
inv = [0] * (n ** 2)
for i in range(n):
    a = list(map(lambda x: int(x)-1, input().split()))
    for j in range(n - 2):
        p, q = min(i, a[j]), max(i, a[j])
        r, s = min(i, a[j + 1]), max(i, a[j + 1])
        g[p * n + q].append(r * n + s)
        inv[r * n + s] += 1
s = []
for i in range(n):
    for j in range(i + 1, n):
        if inv[i * n + j] == 0:
            s.append(i * n + j)
d = [0] * (n ** 2)
while s:
    p = s.pop()
    for node in g[p]:
        d[node] = max(d[node], d[p] + 1)
        inv[node] -= 1
        if inv[node] == 0:
            s.append(node)
for i in range(n):
    for j in range(i + 1, n):
        if inv[i * n + j] > 0:
            print(-1)
            exit(0)
print(max(d) + 1)


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

using namespace std;
using ll=long long;
using vi=vector<int>;
using vl=vector<ll>;
using vs=vector<string>;
using li=list<int>;
using lil=list<ll>;
using lis=list<string>;
using fli=forward_list<int>;
using fll=forward_list<ll>;
using fls=forward_list<string>;
using si=stack<int>;
using sl=stack<ll>;
using ss=stack<string>;
using qi=queue<int>;
using ql=queue<ll>;
using qs=queue<string>;
using pqi=priority_queue<int>;
using pql=priority_queue<ll>;
using pqs=priority_queue<string>;
using dqi=deque<int>;
using dql=deque<ll>;
using dqs=deque<string>;

#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, a, n) for(int i = (n); i < (a); i++)
#define repr(i, n) for(int i = (n); i >= 0; i--)
#define repr2(i, a, n) for(int i = (n); i >= (a); i--)

template<typename T,typename U>
void Inparray(T &f,U n){
  for(int i=0;i<n;i++) cin>>f[i];
}

template<typename T,typename U>
void Printarray(T f,U n){
  for(int i=0;i<n;i++) i!=n ? cout<<f[i]<<" " : cout<<f[i];
}

template<typename T,typename U>
void Printarray2(T f,U n){
  for(int i=0;i<n;i++) cout<<f[i]<<endl;
}

void flagfunc(bool flag,string A,string B){
  flag ? cout<<A<<endl : cout<<B<<endl;
}

void flag2func(bool flag){
  flag ? cout<<"Yes"<<endl : cout<<"No"<<endl;
}

void flag3func(bool flag){
  flag ? cout<<"YES"<<endl : cout<<"NO"<<endl;
}

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  int x,y;cin>>x>>y;cout<<x+y/2<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//typedef pair<ll, ll> P;
typedef pair<double, double> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<int> &o) {
    int a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;


int main() {

    ll n, k;
    cin >> n >> k;

    vector<ll> numbers(n);
    rep(i, n) cin >> numbers[i];

    vector<ll> f(200000 + 1, -1), l(200000 + 1, -1);
    vector<ll> ne(n);

    rep(i, n) {
        ne[i] = i;
        if (f[numbers[i]] == -1) {
            f[numbers[i]] = l[numbers[i]] = i;
        } else {
            ne[l[numbers[i]]] = i;
            l[numbers[i]] = i;
        }
    }

    rep(i, 200000 + 1) if (l[i] > -1) ne[l[i]] = f[i];
    int index = 0, cnt = 1;
    while (true) {
        int next = ne[index];
        if (next <= index) cnt++;
        index = (next + 1) % n;
        if (index == 0) break;
    }

    k %= cnt;


    {
        ll index = 0, cnt = 0;
        while (cnt < k - 1) {
            int next = ne[index];
            if (next <= index) cnt++;
            index = (next + 1) % n;
            if (index == 0) break;
        }
        vector<ll> ans;
        while (index < n) {
            if (ne[index] <= index) {
                ans.push_back(numbers[index]);
                index++;
            } else {
                index = ne[index] + 1;
            }
        }
        rep(i, ans.size()) {
            if (i) cout << ' ';
            cout << ans[i];
        }
        cout << endl;
    }



}

Measured memory_bytes: 9456
/*input
10
aabbbbaaca
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<long long, null_type, less_equal<long long>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
using ll = long long;
using ld = long double;
using pii = pair<ll,ll>;
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
const ll INF64=4e15;
const int INF=0x3f3f3f3f;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld eps=1e-9;
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
ll mult(ll a,ll b){
    return ((a%MOD)*(b%MOD))%MOD;
}
ll mypow(ll a,ll b){
    if(b<=0) return 1;
    ll res=1LL;
    while(b){
        if(b&1) res=mult(res,a);
        a=mult(a,a);
        b>>=1;
    }
    return res;
}
const ll maxn=6*1e4+5;
const ll maxlg=__lg(maxn)+2;
int a[maxn];
int main(){
    int n;
    string a;
    cin>>n>>a;
    char prev=a[0];
    int cnt=1;
    REP(i,n){
        if(a[i]!=prev){
            ++cnt;
        }
        prev=a[i];
    }
    cout<<cnt;
}


Measured memory_bytes: 512
#include<stdio.h>
int main(){
  char s[3];
  gets(s);
  if(s[1]!=s[2] && s[0]==s[1] && s[2]==s[3]){
    printf("Yes");
  }
  else if(s[1]!=s[2] && s[0]==s[2] && s[1]==s[3]){
    printf("Yes");
  }
    else if(s[0]==s[3]&&s[1]==s[2]&&s[0]!=s[1]){
    printf("Yes");
  }
  else printf("No");
  
  return 0;

}

Measured memory_bytes: 128
import java.util.Scanner;

class Solve{
	public int plus[];
	public int ans[];
	public int count;
	public void printans(int a,int b,int i) { 
		if(b == 0) ;
		//If computer finds answer, stop.
		else {
			count++;
			if(a < plus.length) {
				printans(a + 1,b - plus[a],i);
				printans(a + 1,b,i);
			}
		}
	}
}

class Main{
	public static void main(String[] args) 	{
		Scanner sc = new Scanner(System.in);
		Solve sv = new Solve();
		//prepare facts
		int num = sc.nextInt();
		sv.plus = new int[num];
		for(int i = 0;i < num;i++) {
			sv.plus[i] = sc.nextInt();
		}
		//prepare answers
		int ansnum = sc.nextInt();
		sv.ans = new int[ansnum];
		for(int i = 0;i < ansnum;i++) {
			sv.ans[i] = sc.nextInt();
		}
		//print yes or no
		for(int i = 0;i < ansnum;i++) {
			sv.count = 0;
			sv.printans(0,sv.ans[i],i);
			if(sv.count == Math.pow(2,sv.plus.length + 1) - 1) System.out.printf("no\n");
			else System.out.printf("yes\n");
		}
		sc.close();
	}
}


Measured memory_bytes: 26780
n, x, y = map(int, input().split())
dist = []
for i in range(n + 1):
    dist.append([0] * (n + 1))
for i in range(1, n + 1):
    dist[i][x] = abs(x - i)
    dist[x][i] = abs(x - i)
    dist[i][y] = abs(y - i)
    dist[y][i] = abs(y - i)
for i in range(1, n + 1):
    for j in range(i, n + 1):
        dist[i][j] = min(j - i, dist[i][x] + dist[x][j], dist[i][x] + 1 + dist[y][j])
        dist[j][i] = min(j - i, dist[i][x] + dist[x][j], dist[i][x] + 1 + dist[y][j])
ans = [0] * (n + 1)
for i in range(1, n + 1):
    for j in range(1, n + 1):
        ans[dist[i][j]] -= -1
for i in ans[1: n]: print(i // 2)

Measured memory_bytes: 78300
X = int(input())

numberOfPowers = set([1])

for i in range(2, 33):
    j = 2
    while True:
        numberOfPowers.add(i**j)
        j += 1
        if (i ** j > 1000):
            break

ans = 0
for i in sorted(numberOfPowers):
    if i > X:
        break
    ans = i

print(ans)


Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repf(i, a, b) for(ll i = (a); i < (b) ; i++ )
const ll mo = 1000000007;
const ll INF = 1LL << 60; //MAX 9223372036854775807
ll ans = 0;

int main()
{
ll n,x;
cin >> n>>x;
ll t[n] = {};
rep(i, n){
    cin >> t[i];
}
ll now=0;
rep(i,n+1){
    if(now<=x)ans++;
    now+=t[i];
}

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

Measured memory_bytes: 256
n,k,q = map(int,input().split())
list_a = [k-q]*n

#b_list = list(map(int,input().split()))
#print(" ".join(map(str,c_list)))

for i in range(q):
    a = int(input())
    list_a[a-1] += 1
for i in range(n):
    if list_a[i] > 0:
        print("Yes")
    else:
        print("No")

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

using namespace std;

#define endl "\n"
typedef long long int ll;

inline void fastio(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
inline void setPrecision(int n){cout.precision(n);}

//DEBUG
#define dbg(x) cerr<<(#x)<<": "<<x<<endl
#define dbgV(x) cerr<<(#x)<<": "; for(auto it: x) cerr<<it<<" "; cerr<<endl;
#define dbgS(x) cerr<<(#x)<<": "; for(auto it: x) cerr<<it<<" "; cerr<<endl;
#define dbgM(x) cerr<<(#x)<<": "; for(auto it: x) cerr<<"["<<it.f<<", "<<it.s<<"] "; cerr<<endl;
#define dbg2D(x) cerr<<(#x)<<": \n"; for(auto y: x) { for(auto it: y) cerr<<it<<" "; cerr<<endl; } cerr<<endl;
#define dbgA(x, n) cerr<<(#x)<<": "; for(int i=0;i<n;++i) cerr<<x[i]<<" "; cerr<<endl;
#define dbgVP(x) cerr<<(#x)<<": "; for(auto it: x) cerr<<"["<<it.f<<", "<<it.s<<"] "; cerr<<endl;

ll INF = 1e10;
int MOD = 1e9+7;

double dp[301][301][301];
int n;

double solve(int x, int y, int z){
    if(x<0 || y<0 || z<0) return 0;
    if(x==0 && y==0 && z==0) return 0;
    if(dp[x][y][z] > 0) return dp[x][y][z];
    double probx = (double)x/n;
    double proby = (double)y/n;
    double probz = (double)z/n;
    double prob0 = 1-(probx+proby+probz);
    dp[x][y][z] = (1+probx*solve(x-1,y,z)+proby*solve(x+1,y-1,z)+probz*solve(x,y+1,z-1))/(1-prob0);
    return dp[x][y][z];
}

int main(){
    #ifndef ONLINE_JUDGE
        freopen("debug.txt", "w", stderr);
    #endif
    fastio();
    setPrecision(10);
    cin>>n;
    int x,y,z;
    x=y=z=0;
    for(int i=0;i<n;++i){
        int temp; cin>>temp;
        x += temp==1;
        y += temp==2;
        z += temp==3;
    }
    memset(dp, -1, sizeof(dp));
    cout<<solve(x,y,z);
    return 0;
}


Measured memory_bytes: 216920
#include <bits/stdc++.h>
#define REP(i, a, b) for (long long i = a; i <= b; ++i)
#define ll long long
using namespace std;

ll n, ans;

inline ll read(){                                       //快读 
    ll s = 0, w = 1;
    char ch = getchar();
    for (; ch < '0' || ch > '9'; ch = getchar()) w *= ch == '-' ? -1 : 1;
    for (; ch >= '0' && ch <= '9'; ch = getchar()) s = s * 10 + ch - '0';
    return s * w;
}

inline ll gcd(ll a, ll b){                              //求最大公约数 
    if (a < b) swap(a, b);
    if (b == 0) return a;
    return gcd(b, a % b);
}

inline void work(){
    n = read();                                         //输入n，同题目中的k 
    REP(i, 1, n)                                        //同题目中的a
        REP(j, 1, n)                                    //同题目中的b 
            REP(k, 1, n){                               //同题目中的c 
                if (min(i, min(j, k)) == 1) ans++;      //如果其中一个数为1则最大公约数为1 
                else if (i == j && j == k) ans += i;    //如果3个数相等最大公约数就是i 
                    else ans += gcd(i, gcd(j, k));      //同题目中的公式 
            }
    printf("%lld\n", ans);                              //输出答案 
}

int main(){
    work();
    return 0;
}

Measured memory_bytes: 3696
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <queue>
#include <vector>
#include <functional>
#include <map>
#include <set>
#include <cmath>
#include <string>
#define SIZE 100005
#define INF 1000000005LL
#define MOD 1000000007

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

int N;
ll A[SIZE];
bool T[SIZE*2];

int main()
{
	scanf("%d",&N);
	ll sum1=0,sum2=0;
	priority_queue<ll,vector<ll>,greater<ll> > pque;
	vector<ll> vec;
	ll a;
	for(int i=0;i<N;i++){
		scanf("%lld",&a);
		pque.push(a);
		sum1 += a;
	}
	for(int i=0;i<N;i++){
		scanf("%lld",&a);
		A[i] = a;
		vec.push_back(a);
	}
	for(int i=0;i<N;i++){
		scanf("%lld",&a);
		vec.push_back(a);
	}
	sort(vec.begin(),vec.end());
	for(int i=0;i<N;i++){
		sum2 += vec[i];
	}
	ll K = sum1-sum2;
	ll max2 = vec[N-1];
	int maxnum = N-1;
	for(int i=0;i<N;i++){
		//A[i]を操作する
		pque.push(A[i]);
		ll min1 = pque.top();
		pque.pop();
		sum1 += (A[i]-min1);

		//A[i]が小さい順何番目か
		int num = lower_bound(vec.begin(),vec.end(),A[i])-vec.begin();
		T[num] = true;
		if(A[i] <= max2){//sum2変更あり
			sum2 -= A[i];
			while(1){
				maxnum++;
				if(!T[maxnum])break; //消されていない
			}
			sum2 += vec[maxnum];
			max2 = vec[maxnum];
		}
		K = max(K,sum1-sum2);
	}
	printf("%lld\n",K);

	return 0;
}


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

int main() {
    int A, B;
    cin >> A >> B;
    if(A<=5){
        B = 0;
    }
    else if(A>=5 && A<13){
        B = B/2;
    }
    cout << B << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner((System.in));
		long x = sc.nextLong();
        long ans = 0;
        
        ans = (x / 11) * 2;
		
        if (x % 11 > 6) {
            ans += 2;
        } else if (x % 11 > 0) {
            ans += 1;
        }
		System.out.println(ans);

		sc.close();
	}
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<LL,LL> PL;

const int MOD=1000000007;
int INF=100100100;
int main(){
  LL a,b,k;cin>>a>>b>>k;
  if(a>=k)cout<<a-k<<" "<<b<<endl;
  else cout<<0<<" "<<max((LL)0,a+b-k)<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ll a,b,c,k;
	cin>>a>>b>>c>>k;
	ll ans=0;
	if(k>=a){
		ans=a;
		k-=a;
	}else{
		ans=k;
		k=0;
	}
	if(k>=b){
		k-=b;
	}else{
		k=0;
	}
	if(k>=c){
		ans-=c;
		k-=c;
	}else{
		ans-=k;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3528
package main

import (
	"bufio"
	"fmt"
	"os"
)

var sc = bufio.NewScanner(os.Stdin)

func b2i(a []byte) (n int) {
	for _, v := range a {
		n = n*10 + int(v-48)
	}
	return
}

func r() int {
	sc.Scan()
	b := sc.Bytes()
	if b[0] == 45 {
		return -b2i(b[1:])
	} else {
		return b2i(b)
	}
}

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func main() {
	sc.Split(bufio.ScanWords)
	n, m := r(), r()
	x, y := make([][]int, n), make([][]int, m)
	for i := 0; i < n; i++ {
		x[i] = []int{r(), r()}
	}
	for i := 0; i < m; i++ {
		y[i] = []int{r(), r()}
	}

	var ans, min int
	for _, v := range x {
		min = int(^uint(0) >> 1)
		for j, w := range y {
			if t := abs(v[0]-w[0]) + abs(v[1]-w[1]); t < min {
				min = t
				ans = j
			}
		}
		fmt.Println(ans + 1)
	}
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  set<string> D;
  for (int i = 0; i < n; i++){
    string q;
    cin >> q;
    if (q == "insert"){
      string str;
      cin >> str;
      D.insert(str);
    }
    if (q == "find"){
      string str;
      cin >> str;
      if (D.count(str)){
        cout << "yes" << endl;
      } else {
        cout << "no" << endl;
      }
    }
  }
}


Measured memory_bytes: 32188
#include <iostream>


int main(){
	int a = 0, b = 0, c = 0;

	scanf("%d %d %d", &a, &b, &c);

	if (a < b && b < c){
		std::cout << "Yes" << std::endl;
	}else{
		std::cout << "No" << std::endl;
	}

	return 0;
}

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

int main(){
    int i,sum,f,a = 1;
    cin >> f;

    for(i = 0;i < 9;i++){
        sum += (f / a) % 10;
        a *= 10;
    }
    if(f % sum == 0)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int a[1000];
int main()
{
    int n,q;
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>a[i];
    cin>>q;
    for(int i=0;i<q;i++)
    {
        int m,j,l,r,ans;
        cin>>m;cin>>l;cin>>r;
        ans=a[l];
        for(j=l+1;j<r;j++)
        {
            if(m==1? ans<a[j]:ans>a[j])
                ans=a[j];
        }
        cout<<ans<<endl;
    }
    return 0;
}



Measured memory_bytes: 3100
A,B = map(int,input().split())
S = list(input())

ok = True
for i in range(A+B+1):
  s = S[i]
  if i == A and s != '-':
    ok = False
    break
  
  if i != A and s == '-':
    ok = False
    break
    
if ok:
  print("Yes")
else:
  print("No")
    
  


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

int main(){
    int n, cnt = 0;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    for(int i = 0; i < n; i++){
        int minj = i;
        for(int j = i; j < n; j++){
            if(a[j] < a[minj]){
                minj = j;
            }
        }
        if(minj != i){
            swap(a[minj], a[i]);
            cnt++;
        }
    }
    for(int i = 0; i < n; i++){
        if(i > 0) cout << ' ';
        cout << a[i];
    }
    cout << endl << cnt << endl;
    return 0;
}



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

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		Obj[] arr = new Obj[n];
		for (int i = 0; i < n; i++) {
			Obj o = new Obj();
			o.i = i + 1;
			o.s = sc.next();
			o.p = sc.nextInt();
			arr[i] = o;
		}
		sc.close();

		Arrays.sort(arr, (o1, o2) -> {
			if (!o1.s.equals(o2.s)) {
				return o1.s.compareTo(o2.s);
			} else {
				return o2.p - o1.p;
			}
		});

		for (Obj o : arr) {
			System.out.println(o.i);
		}
	}

	static class Obj {
		String s;
		int i, p;
	}
}


Measured memory_bytes: 26836
#define MOD_TYPE 1

#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
/*
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
using multiInt = boost::multiprecision::cpp_int;
using lld = boost::multiprecision::cpp_dec_float_100;
*/
/*
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
*/
using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

constexpr ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
constexpr int INF = (int)1e9;
constexpr ll LINF = (ll)4e18;
constexpr ld PI = acos(-1.0);
constexpr ld EPS = 1e-11;
constexpr int Dx[] = {0, 0, -1, 1, -1, 1, -1, 1, 0};
constexpr int Dy[] = {1, -1, 0, 0, -1, -1, 1, 1, 0};

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define REPI(i, m, n) for (int i = m; i < (int)(n); ++i)
#define repi(i, n) REPI(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << "\n"
#define Yes(n) cout << ((n) ? "Yes" : "No") << "\n"
#define possible(n) cout << ((n) ? "possible" : "impossible") << "\n"
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << "\n"
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << "\n"
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << "\n";

inline void init_main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(30) << setiosflags(ios::fixed);
}
template <typename T>
inline bool chmin(T &a, T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
inline bool chmax(T &a, T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
inline ll CEIL(ll a, ll b)
{
  return (a + b - 1) / b;
}
template <typename A, size_t N, typename T>
inline void Fill(A (&array)[N], const T &val)
{
  fill((T *)array, (T *)(array + N), val);
}
#pragma endregion

int main()
{
  init_main();

  int n, m;
  cin >> n >> m;
  vector<int> E[100010];
  int h[100010];
  rep(i, n) cin >> h[i];
  rep(i, m)
  {
    int a, b;
    cin >> a >> b;
    a--, b--;
    E[a].push_back(b);
    E[b].push_back(a);
  }
  int cnt = 0;
  rep(i, n)
  {
    bool good = true;
    for (auto to : E[i])
    {
      if (h[to] >= h[i])
      {
        good = false;
        break;
      }
    }
    cnt += good;
  }
  cout << cnt << "\n";
  return 0;
}


Measured memory_bytes: 9120
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) { for(const auto &e : xs) cout << e << " "; cout << "\n"; }
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")
#define vc vector
#define Mini(a, x) a = min(a, x)
#define Maxi(a, x) a = max(a, x)

// constexpr int MOD = 1e9+7;
#include <functional>

int main(void){
    Cin(int, n, q);
    vc<vc<int>> t(n, vc<int>());
    Rep(n-1){
        Cin(int, a, b);
        a--, b--;
        t[a].push_back(b);
        t[b].push_back(a);
    }
    vc<int> c(n);
    Rep(q){
        Cin(int, p, x);
        p--;
        c[p] += x;
    }
    // Couts(c);
    
    vc<int> ans(n, -1);
    
    function<void(int, int)> dfs = [&](int e, int d){
        ans[e] = d + c[e];
        for(int i : t[e]){
            if(ans[i] == -1) dfs(i, ans[e]);
        }
    };
    dfs(0, 0);
    
    Couts(ans);
}


Measured memory_bytes: 27392
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>
using namespace std;
int n,h[101010];
int main()
{
	cin>>n;
	int mx=0;
	for(int i=0;i<n;i++)
	{
		cin>>h[i];
	}
	for(int i=0;i<n;i++)
	{
		if(i==0)
		{
			mx=max(mx,h[i]);
			continue;
		}
		if(h[i]>mx)
		{
			h[i]-=1;
		}
		else if(h[i]<mx)
		{
			cout<<"No"<<endl;
			return 0;
		}
		mx=max(mx,h[i]);
	}
	cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
#include <memory>
using namespace std;
#define DEB(variable) cout << #variable << '=' << variable << endl

#define FOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(long long int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

using llint = long long int;

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr long long int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;

int main(){

    llint h;
    cin>>h;
    llint result=0,enemynum=1;
    while(h!=0){
        h/=2;
        result+=enemynum;
        enemynum*=2;
    }
    cout<<result<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
long long const mod = 1e9+7;
int main(void){
    int n;
    string s;
    cin >> n >> s;
    int lft = 0;
    long long ans = 1;
    for(int i=0;i<n*2;i++){
        if((s[i] == 'B') == (i%2 == 1)){
            if(lft == 0){
                ans = 0;
                break;
            }
            ans *= lft--;
            ans %= mod;
        }else{
            lft++;
        }
    }
    if(lft != 0) ans = 0;
    else for(int i=2;i<=n;i++) ans = ans*i%mod;
    cout << ans << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
//---------------------------
using namespace std;
//---------------------------
#define REP(i,n) for(int i = 0; i < (n); i++)
#define P(x) cout << (x) << "\n"

#define MOD 1000000007 // 1e9+7
#define PI 3.1415926525
#define ll long long int // 10^18
#define INF 1000000001 // 1e9+1

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

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

  // ifstream in("input.txt");
  // cin.rdbuf(in.rdbuf());

  int n;string s;cin>>n>>s;
  ll cnt=0,maxn=0;
  REP(i,n){
    if(s[i]=='I'){
      cnt++;
    }else{
      cnt--;
    }
    maxn=max(maxn, cnt);
  }
  P(maxn);
  return 0;
}


Measured memory_bytes: 256
n, m, l = map(int, input().split())

A = []
B = []
C = []
inner = []
x = 0

for i in range(n):
    a = input().split()
    A.append(a)
    
for i in range(m):
    b = input().split()
    B.append(b)
    
for i in range(n):
    for j in range(l):
        for k in range(m):
            x += int(A[i][k]) * int(B[k][j])
            
        inner.append(x)
        x = 0
    
    C.append(inner)
    inner = []

for i in C:
    print(" ".join(map(str, i)))


Measured memory_bytes: 7396
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;cin>>s;
    long long start,goal;
    long long ans=0;
    for(int i=0;i<s.length();i++){
        if(s[i]=='A'){
            start=i;
            break;
        }
    }
    for(int i=s.length();i>0;i--){
        if(s[i]=='Z'){
            goal=i;
            break;
        }
    }
    cout<<goal-start+1<<endl;
}

Measured memory_bytes: 640
/* Aditya0412 */
#include <bits/stdc++.h>
using namespace std; 
typedef long long int ll;
#define pb push_back 
#define ve vector
#define vii vector < int >
#define vll vector < ll > 
#define pii pair < int , int >
#define pll pair < ll , ll >
#define vpl vector < pll >
#define fi first
#define all(a)      (a).begin(),(a).end()
#define si(x)       (int)((x).size())
#define debug(x)    cout<<#x<<" is "<<(x)<<endl;cout.flush();  
#define se second 
#define endl        '\n'
#define f(i,a,b)    for(int i=a;i<b;i++)
#define mem(a,x)          memset(a,x,sizeof(a))

// const ll mod=998244353;
const ll mod = 1000000000+7;
const ll N=1000000+6;
#define M_PI           3.14159265358979323846



// === Debug macro starts here ===

int recur_depth = 0;
#ifdef DEBUG
#define dbg(x) {++recur_depth; auto x_=x; --recur_depth; cerr<<string(recur_depth, '\t')<<"\e[91m"<<__func__<<":"<<__LINE__<<"\t"<<#x<<" = "<<x_<<"\e[39m"<<endl;}
#else
#define dbg(x)
#endif
template<typename Ostream, typename Cont>
typename enable_if<is_same<Ostream,ostream>::value, Ostream&>::type operator<<(Ostream& os,  const Cont& v){
    os<<"[";
    for(auto& x:v){os<<x<<", ";}
    return os<<"]";
}
template<typename Ostream, typename ...Ts>
Ostream& operator<<(Ostream& os,  const pair<Ts...>& p){
    return os<<"{"<<p.first<<", "<<p.second<<"}";
}

// === Debug macro ends here ===


void inp(ll *arr,ll n)
{
  for(int i=0;i<n;i++)
    cin>>arr[i];
}
void inp_mat(ll *arr,ll n,ll m)
{
    for(int i=0;i<n;i++)
      for(int j=0;j<m;j++)
        {
          ll x;cin>>x;
          *((arr+i*m) + j)=x;
        }
}
// syntax for inp_mat inp_mat((ll *)arr,n,m);
// int x2[]={+1,-1,+0,+0};
// int y2[]={+0,+0,+1,-1};
// int x2[]={+0,+0,+1,-1,-1,+1,-1,+1};
// int y2[]={-1,+1,+0,+0,+1,+1,-1,-1};
// int x2[]={-2,-2,-1,-1,+1,+1,+2,+2};
// int y2[]={-1,+1,-2,+2,-2,+2,-1,+1};
int main() 
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //  #ifndef ONLINE_JUDGEc
    //   freopen ("INPUT.txt" , "r" , stdin);
    //   freopen ("OUTPUT.txt", "w" , stdout);
    // #endif 
    int t=1;
    // cin>>t;
    while(t--)
    {
      ll x;cin>>x;
      if(x>=30)
      cout<<"Yes\n";
      else
      {
        cout<<"No";
      }
      
    }    
} 

Measured memory_bytes: 3644
#include<iostream>
using namespace std;
int a,b,k;
int main(){
	bool flag=0;
	cin>>k>>a>>b;
	int i=a;
	while(i<=b){
		if(i%k==0)flag=1;
		i++;
	}
	if(flag)cout<<"OK"<<endl;
	else cout<<"NG";
	return 0;
} 

Measured memory_bytes: 3632
#include<stdio.h>
int main(){
	int n,s;
	while(scanf("%d %d",&n,&s)!=EOF){
		if(n==0&&s==0)break;
		int ans=0;
 		for(int a=1;a<n && 3*a<=s;a++){
			for(int b=a+1; b<n && a+2*b<=s;b++){
				int c=s-a-b;
				if(c<=b)break;
				if(n<c)continue;
 				ans++;
			}
		}
		printf("%d\n",ans);
	}
}


Measured memory_bytes: 2032
N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]
b = any(all(A[i+k][j+l]==B[k][l] for k in range(M) for l in range(M)) for i in range(N-M+1) for j in range(N-M+1))
print("YNeos"[not b::2])

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define repp(i, m, n) for(int i = m; i < n; i++)
#define reps(i, n) for(int i = 1; i <= n; i++)
const int    INF = 100000000;
const double EPS = 1e-10;
const int    MOD = 1000000007;
using namespace std;
typedef long long ll;
typedef pair<int, int> pai;
typedef pair<ll,ll> pal;



int main()
{
	int n;
	int x[510];
	pai y[510];
	cin >> n;
	y[0]=make_pair(0, 0);
	reps(i, n)
	{
		cin >> x[i];
		y[i]=make_pair(x[i], i);
	}
	sort(y, y+n+1);
	int sum1[510], sum2[510];
	sum1[0]=0;
	sum2[n+1]=0;
	int muri=0;
	reps(i, n)
	{
		sum1[i]=sum1[i-1]+y[i].second;
		sum2[n+1-i]=sum2[n+2-i]+(n-y[n+1-i].second+1);
		if(sum1[i]>y[i].first) muri=1;
		if(sum2[n+1-i]>n*n+1-y[n+1-i].first) muri=1;
	}
	if(muri==1) cout << "No" << endl;
	else
	{
		cout << "Yes" << endl;
		int zaiko[510];
		reps(i, n) zaiko[i]=n;
		queue<int> q1, q2;
		reps(i, n)
		{
			rep(j, y[i].second-1) q1.push(y[i].second);
			rep(j, n-y[i].second) q2.push(y[i].second);
		}
		int a[250010];
		int cnt=1;
		reps(i, n*n)
		{
			if(i!=1) cout << ' ';
			if((cnt<=n)&&(i==y[cnt].first))
			{
				cout << y[cnt].second;
				cnt++;
			}
			else if(!q1.empty())
			{
				cout << q1.front();
				q1.pop();
			}
			else
			{
				cout << q2.front();
				q2.pop();
			}
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 2176
#include <cstdio>
#include <string>
#include <iostream>

using namespace std;

void SolveA()
{
	string s;
	cin >> s;

	const char *ss = s.c_str();

	int bee = 0;
	for (int i = 0; i < s.length(); i++)
	{
		if (ss[i] == '1')
		{
			bee++;
		}
	}

	printf("%d\n", bee);
}

int main()
{
	SolveA();
}



Measured memory_bytes: 256
import bisect
import collections

N = int(input())
A = [int(input()) for _ in range(N)]

C = collections.deque()

for a in A:
    p = bisect.bisect_left(C, a)
    if p == 0:
        C.appendleft(a)
    else:
        C[p - 1] = a

print(len(C))


Measured memory_bytes: 8060
//#include<bits/stdc++.h>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<map>
#include<queue>
#include<stack>
#include<set>
#include<unordered_map>
#include<bitset>
using namespace std;
#define int long long
#define ll long long
#define str string
#define db double
#define ac() cout<<"Yes"<<endl
#define wa()  cout<<"No"<<endl
#define ddd cout<<"---debug---"<<endl;
#define ff(a,b) for(signed long long (a)=1;(a)<=(b);(a)++)
#define fff(a,b) for(signed long long (a)=0;(a)<(b);(a)++)
#define re readdd()
#define pr(a) printtt(a)
#define pee puts("");
#define eee putchar(' ');
#define pss(a) push_back(a)
#define ps(a) push(a)
#define SZ(x) x.size()
#define epp empty()
#define all(x) x.begin(),x.end()
typedef vector<int> VE;
int gcd(int a,int b){return b==0?a:gcd(b,a%b);}//
int ppow(int a,int b,int mod){a%=mod;//
int ans=1%mod;while(b){if(b&1)ans=(long long)ans*a%mod;
a=(long long)a*a%mod;b>>=1;}return ans;}
int readdd(){int x=0,f=1;char c=getchar();//
while(!isdigit(c)&&c!='-')c=getchar();
if(c=='-')f=-1,c=getchar();
while(isdigit(c))x=x*10+c-'0',c=getchar();
return f*x;}
void printtt(int x){if(x<0)putchar('-'),x=-x;
if(x>=10)printtt(x/10);putchar(x%10+'0');}
bool addd(int a,int b){return a>b;};
//
const int maxm=1e5+5;
int a[4][4];
int b[4][4]={0};
int r[4]={0},c[4]={0};
signed main(){
    ff(i,3)ff(j,3)a[i][j]=re;
    int n=re;
    ff(xx,n){
        int x=re;
        ff(i,3)ff(j,3){
            if(a[i][j]==x)b[i][j]=1;
        }
    }
    ff(i,3)ff(j,3){
        if(b[i][j]){
            r[i]++;
            c[j]++;
        }
    }
    int ok=0;
    ff(i,3)if(r[i]==3||c[i]==3){
        ok=1;
        break;
    }
    int f=0;
    ff(i,3){
        f+=b[i][i];
    }
    if(f==3)ok=1;
    f=0;
    ff(i,3){
        f+=b[i][4-i];
    }
    if(f==3)ok=1;
    if(ok)puts("Yes");
    else puts("No");
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;

#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i <= b; i++)
#define revrep(i, s, e) for (int i = s-1; i > e; i--)
#define revrrep(i, s, e) for (int i = s-1; i >= e; i--)
#define all(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))

int main()
{
    int N, K, ans = 0; cin >> N >> K;
    vector<int> length;
    rep (i, 0, N) {
        int in; cin >> in;
        length.push_back(in);
    }

    sort(length.begin(), length.end());
    reverse(length.begin(), length.end());
    rep (i, 0, K) ans += length[i];
    cout << ans << endl;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    N,T=map(int,input().split())
    ans=INF
    for _ in range(N):
        c,t=map(int,input().split())
        if t<=T:
            ans=min(ans,c)
    print(ans if ans!=INF else 'TLE')

if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
N, K = list(map(int, input().split()))
A = list(map(lambda x: int(x) - 1, input().split()))

seen = []
now = 0
while True:
    seen.append(now)
    to = A[now]
    A[now] = 'seen'
    if to == 'seen':
        break
    else:
        now = to

loop_s = seen.index(now)
loop_end = seen.index(now, loop_s + 1)
size = loop_end - loop_s

if K <= loop_s:
    print(seen[K] + 1)
else:
    print(seen[loop_s +(K - loop_s) % size] + 1)

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

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

    string s;  cin >> s;
    int ans = 0;
    rep(i, s.size()){
        if(s[i] == '?') s[i] = 'D';
    }
    cout << s << endl;
}

Measured memory_bytes: 3788
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum, k, q;

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

  cin >> a >> b;
  rep(i, 10000) {
    ans = i;
    tmp = ans * 8 / 100;
    if (tmp != a) continue;
    tmp = ans / 10;
    if (tmp != b) continue;
    Cout(ans);
    return 0;
  }
  Cout(-1);
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> p_ll;
typedef vector<pair<ll, ll>> vec_p; //vector<pair<ll, ll>> pairs(n) ,pairs.at(i) = make_pair(i*i, i)

const ll MOD = pow(10, 9) + 7;
const ll LLINF = pow(2, 61) - 1;
const int INF = pow(2, 30) - 1;


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

  ll N;
  cin >>N;
  ll flag = 0;

  vector<ll> vec(N);

  for (ll i = 0; i < N; i++) {
    cin >>vec.at(i);
  }

  for (ll i = 0; i < N; i++) {
    if(vec.at(i)%2==0){
      if (vec.at(i) % 6 == 0||vec.at(i)%10==0){
        continue;
      }
      else{
        flag = 1;
        break;
      }
    }
    else{
      continue;
    }
  }
  if (flag == 1){
    cout << "DENIED" << endl;
  }
  else{
    cout << "APPROVED" << endl;
  }
}

Measured memory_bytes: 256
using System;
using System.Linq;

    class Program
    {
        static void Main(string[] args)
        {
            Console.ReadLine();
            var Hs = Console.ReadLine().Split(' ').Select(s=>int.Parse(s)).ToList();
            var count = 0;
            var max = 0;
            for(var i = 0;i<Hs.Count;i++)
            {
                if (max > Hs[i]) continue;
                max = Hs[i];
                count++;
            }
            Console.WriteLine(count);
        }
    }

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

using namespace std;

int main()
{
  string s;
  cin >> s;
  if(s[0]=='Y' and s[1]=='A' and s[2]=='K' and s[3]=='I')
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<queue>
#include<utility>
#include<cstring>
#include<stack>
#include<algorithm>
#include<cmath>
#include<iostream>
#define INF 2147483647
#define REP(i,n) for(int i=0;i<(int)(n);i++)
int dx[4] = {1,0,0,-1};
int dy[4] = {0,1,-1,0};
using namespace std;
int main()
{
  long long int count = 0,a,c;
  int N,A[100001],B[100001],C[100001];
  cin >> N;
  REP(i,N) cin >> A[i];
  REP(i,N) cin >> B[i];
  REP(i,N) cin >> C[i];
  sort(A,A+N);
  sort(B,B+N);
  sort(C,C+N);
  REP(i,N){
    a = lower_bound(A,A+N,B[i]) - A;
    c = N + C - upper_bound(C,C+N,B[i]);
    count += a*c;
  }
  printf("%lld\n",count);
  return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug{
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c &) { ris; }
#endif
};
#define imie(x) " [" << #x ": " << (x) << "] "

const int nax = 1e6 + 5;
char sl[nax];
int main() {
	scanf("%s", sl);
	if((sl[0] == sl[(int) strlen(sl) - 1]) ^ (strlen(sl)%2==0)) puts("Second");
	else puts("First");
}


Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

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

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

    vector<int> broken(n+1);
    rep(i, m) {
        int a;
        cin >> a;
        broken[a] = 1;
    }

    vector<int> dp(n+1);
    dp[0] = 1;
    dp[1] = 1;
    if(broken[1]) {
        dp[1] = 0;
    }

    for(int i = 2; i <= n; i++) {
        if(broken[i]) {
            continue;
        }

        dp[i] = dp[i-1] + dp[i-2];
        dp[i] %= mod;
    }

    cout << dp[n] << endl;
    return 0;
}

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



int main(){
  long long A,B,C;
  long long K;
  long long sum=0;
  cin>>A>>B>>C>>K;
  if(K>0){
    if(K>=A){
      sum+=A;
      K-=A;
    }else{
      sum+=K;
      K-=K;
    }
  }
  if(K>0){
    if(K>=B){
      K-=B;
    }else{
      K-=K;
    }
  }
  if(K>0){
    if(K>=C){
      sum-=C;
      K-=C;
    }else{
      sum-=K;
      K-=K;
    }
  }
  cout<<sum;
}


Measured memory_bytes: 3632