akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<P> vp;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << endl
const ll INF = 1e+9+7;
ll n,m,l;
string s,t;
ll d[200010],dp[550][550];

int main(){
  cin >> n;
  ll ans[550][550];
  rep(i,0,n){
    rep(j,0,n){
      cin >> dp[i][j];
      ans[i][j] = dp[i][j];
    }
  }
  m = 0;
  rep(k,0,n){
    rep(i,0,n){
      rep(j,0,n){
        if(dp[i][j] > dp[i][k] + dp[k][j]){
          m = -1;
        }else if(dp[i][j] == dp[i][k] + dp[k][j]){
          if(dp[i][k] != 0 && dp[k][j] != 0){
            ans[i][j] = 0;
          }
        }
      }
    }
  }
  if(m != -1){
    rep(i,0,n)rep(j,i+1,n)m += ans[i][j];
  }
  print(m);
  return 0;
}

Measured memory_bytes: 3712
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;

int a,b,c,d;
void input()
{
    cin>>a>>b>>c>>d;
}

void solve()
{
    while(1){
        if(c<=0){
            cout<<"Yes\n";
            break;
        }
        if(a<=0){
            cout<<"No\n";
            break;
        }

        c-=b;
        a-=d;
    }
}

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

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

using namespace std;

typedef long long ll;

ll ans[200005];

int main()
{
	int n, k;
	cin >> n >> k;
	for(int i=0;i<n;i++)
	{
		cin >> ans[i];	
	} 
	sort(ans, ans + n);
	if(n <= k)
	{
		cout << 0 << endl;
		return 0;
	}
	else
	{
		ll sum = 0;
		for(int i=0;i<n-k;i++)
			sum += ans[i];
		cout << sum << endl;
	}
	return 0;
} 

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstring> //memset
using namespace std;

int main()
{
	string S;

	cin >> S;

	bool bad = false;
	for (int i = 0; i < S.size(); i++) {
		if ((i+1) % 2 == 0) {
			//����
			if (S[i] == 'R') {
				bad = true;
				break;
			}
		}
		else {
			//�
			if (S[i] == 'L') {
				bad = true;
				break;
			}
		}
	}

	if (bad == true) {
		cout << "No" << endl;
	}
	else {
		cout << "Yes" << endl;
	}
}

//int main()
//{
//	string S;
//
//	cin >> S;
//
//	if (S == "Sunny")
//	{
//		cout << "Cloudy" << endl;
//	}
//	else if(S == "Cloudy")
//	{
//		cout << "Rainy" << endl;
//	}
//	else {
//		cout << "Sunny" << endl;
//	}
//}

Measured memory_bytes: 256
s = input()
s1 = int(s[0]+s[1])
s2 = int(s[2]+s[3])
if 1<=s1<=12 and 1<=s2<=12:
  print("AMBIGUOUS")
elif 0<=s1<=99 and 1<=s2<=12:
  print('YYMM')
elif 0<=s2<=99 and 1<=s1<=12:
  print('MMYY')
else:
  print('NA')


Measured memory_bytes: 2940
//#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast,no-stack-protector") 
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>


#define ll long long
#define ull unsigned long long
//#define int ll
#define ld long double
#define rep(i, l, r) for (int i = l; i < r; i++)
#define repb(i, r, l) for (int i = r; i > l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp(a, b) make_pair(a, b)
#define ret(a) {cout << a; exit(0);}

using namespace std;

mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

typedef pair < int , int > pii ;
typedef pair < long long  , long long > pll ;

const int N = 1e5 + 1 ;
int n , m;
string s;
int dp[N] , t[N << 2] , to[N];
void upd(int v , int tl , int tr , int pos){
	if(tl == tr)
		return void(t[v] = pos);
	int tm = (tl + tr) >> 1;
	if(pos <= tm)
		upd(v << 1, tl , tm , pos);
	else upd(v << 1|1 , tm + 1,  tr , pos);
	if(dp[t[v << 1]] > dp[t[v << 1|1]])
		t[v] = t[v << 1 | 1];
	else t[v] = t[v << 1];
}
int get(int v , int tl , int tr , int l , int r){
//	cerr << tl << ' ' << tr << '\n';
	if(l > r or l > tr or tl > r)
		return 0;
	if(l <= tl and tr <= r){
		return t[v];
	}
	int tm = (tl + tr) >> 1;
	int a = get(v << 1 , tl  , tm , l , r) , b = get(v << 1|1 , tm + 1, tr , l , r);
	if(dp[a] > dp[b])
		return b;
	return a;	
}
main(){
	scanf("%d%d" , &n , &m);
	cin >> s;
//	cout << s;
	n++;
	if(s[n-1] == '1')
		ret(-1);
	
	dp[0] = 1e9;
	dp[n] = 0;
	upd(1 , 1, n , n);

	for(int i = n - 1; i ; i--){
		dp[i] = 1e9;
        if(s[i - 1] == '0')
		    to[i] = get(1 , 1,  n , i + 1 , min(i + m,n)) , dp[i] = dp[to[i]] + 1;
		upd(1 , 1,  n , i);
    }

    if(dp[1] > n)
    	ret(-1);

    for(int i = 1 ; i != n ; ){
		cout << to[i] - i << ' ';     	
		i = to[i];
    }

	
}

Measured memory_bytes: 2432
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define mes(a) cout << (a) << endl
#define dmes(a, b) cout << (a) << " " << (b) << endl
#define re0 return 0
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define rSort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };
template <class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
struct io { io() { ios::sync_with_stdio(false); cin.tie(0); } };
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-9;


signed main(void) 
{
    ll n;
    cin >>n;
    string s;
    ll r = 0;
    cin >>s;
    rrep(i, n) { 
        if (s[i] != s[i-1]) {
            r++;
        }
    }
    mes(r);
    
   
}


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

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

H, N = MAP()
AB = []
for i in range(N):
    a, b = MAP()
    AB.append((a, b))

dp = [INF] * 20007
dp[0] = 0
for i in range(20007):
    for a, b in AB:
        if i-a >= 0:
            dp[i] = min(dp[i], dp[i-a] + b)
ans = min(dp[H:])
print(ans)


Measured memory_bytes: 41452
#include <iostream>

using namespace std;

int main() {
    int n;
    cin >> n;
    int d[n];
    for (int i = 0; i < n; i++) {
        cin >> d[i]; 
    }
    for (int i = 0; i < n; i++) {
        int c;
        cin >> c;
        d[i] -= c;
    }

    int ans = 0;
    for (int i = n - 1; i >= 0; i--) {
        if (d[i] > 0) {
            ans += d[i];
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define all(x) (x).begin(), (x).end()
#define MOD 1000000007
#define int long long
using ll = long long;
using namespace std;
const int INF = 1LL << 50;
using P       = pair<int, int>;

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

struct Setup {
    Setup() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} SETUP;

signed main() {
    int a, b, t;
    cin >> a >> b >> t;
    int ans = 0;
    rep(i, 1, t + 1) {
        if (i % a == 0) {
            ans += b;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 888
#include<stdio.h>
int main(){
  int a,b;
  scanf("%d%d",&a,&b);
  if(a < b){
    printf("a < b\n");
  }
  if(a > b)
    printf("a > b\n");
  if(a == b)
    printf("a == b\n");
  return 0;
}

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

int main() {
	int N, T, A;
	cin >>N>>T>>A;
	vector<int> H(N);
	for(int i=0;i<N;i++) {
		cin>>H[i];
	}

	float mdiff = 1000.0;
	int num = 0;
	for(int i=0;i<N;i++) {
		float u = (float)T - 0.006 * H[i];
		float d = abs(u - A);
		if(mdiff > d) {
			mdiff = d;
			num = i;
		}
	}

	cout << (num+1) << endl;

	return 0;
}


Measured memory_bytes: 888
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <stack>
#include <cmath>
#include <queue>
#include <numeric>


int main()
{
	std::string s, t;

	std::cin >> s >> t;

	std::reverse(t.begin(), t.end());

	if (s == t) {
		std::cout << "YES" << std::endl;
	}
	else {
		std::cout << "NO" << std::endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include<stack>
#include<sstream>
typedef long long ll;

#define pi 3.14159265358979323846
#define VI vector<int>
#define VLL vector<long long>
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()

using namespace std;

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

template<typename T>
T finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}

/*char r[4];
int yaju[4];
char op[3];
int sum = 0;
scanf("%s", r);
for (int i = 0;i < 4;i++) {
	yaju[i] = r[i] - '0';
}
*/
int main() {
	ll N; cin >> N;
	ll a = 0, b = 0, c = 0, d = 0;
	ll ans = 0;
	vector<string> S(N);
	for (int i = 0;i < N;i++) cin >> S[i];
	for(int i=0;i<N;i++){
	if (S[i] == "G")a++;
	if (S[i] == "P")b++;
	if (S[i] == "W")c++;
	if (S[i] == "Y")d++;
	}
	if (a > 0) ans++;
	if (b > 0) ans++;
	if (c > 0) ans++;
	if (d > 0) ans++;
	if (ans == 4) cout << "Four" << endl;
	else cout << "Three" << endl;
}

Measured memory_bytes: 256
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        final Scanner sc  = new Scanner(System.in);
        long          N   = sc.nextLong();
        int           ans = 0;
        long          q   = 2;
        int           e   = 1;
        long          div;

        if (N == 1) {
            System.out.println(0);
            return;
        }

        while (true) {
            div = (long) Math.pow(q, e);
            if (N % div == 0) {
                N /= div;
                ans++;
                e++;
                continue;
            }

            while (N % q == 0) {
                N /= q;
            }
            if (q == 2) {
                q++;
            } else {
                q += 2;
            }
            e = 1;
            
            if (q * q > N) {
                break;
            }
        }

        if (N != 1) {
            ans++;
        }

        System.out.println(ans);
    }
}


Measured memory_bytes: 35752
#include<stdio.h>
int main(){
    int a,b,c;
    int A = 0;
    
    scanf("%d %d %d",&a,&b,&c);
    int k;
    for(int i = a;i <= b;i++){
        k = c%i;
        if(k == 0){
            A++;
        }
    }
    printf("%d\n",A);
    return 0;
}


Measured memory_bytes: 2760
import sys
input = sys.stdin.readline
N = int(input())
red = [list(map(int,input().split())) for i in range(N)]
blue = [list(map(int,input().split())) for i in range(N)]

red.sort(key=lambda x : -x[1])
blue.sort()

ans = 0
red_used = [0 for _ in range(N)]
for b in blue :
    for i in range(N) :
        if b[0] > red[i][0] and b[1] > red[i][1] :
            if red_used[i] == 0 :
                ans += 1
                red_used[i] = 1
                break

print(ans)


Measured memory_bytes: 3064
import java.util.Scanner;

class Main {
	static int R,G,B,N;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		R = sc.nextInt();
		G = sc.nextInt();
		B = sc.nextInt();
		N = sc.nextInt();

		int count = 0;

		for (int i = 0; i <= N; ) {
			for (int j = 0; j <= N; ) {
				int t = i + j;
				if ( t > N) {
					break;
				}
				int tmp = N - (i + j);
				if (tmp >= 0 && tmp % B == 0) {
					count++;
				}
				j += G;
			}
			i += R;
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 21844
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdio>
#include <string>
#include <iomanip>
using namespace std;


int main() {
	string s;
	cin >> s;
	for (int i = 0; i < s.size(); ++i) {
		s[i] = 'x';
	}
	cout << s << endl;
}





Measured memory_bytes: 256
#include<cstdio>
#define MAX 10000
#define NIL -1

struct Node { int parent, left, right; };

Node T[MAX];
int n, D[MAX], H[MAX];

void setDepth(int u, int d) {
    if (u == NIL) return;
    D[u] = d;
    setDepth(T[u].left, d+1);
    setDepth(T[u].right, d+1);
}

int setHeight(int u) {
    int h1 = 0, h2 = 0;
    if (T[u].left != NIL)
      h1 = setHeight(T[u].left)+1;
    if (T[u].right != NIL)
      h2 = setHeight(T[u].right)+1;
    return H[u] = (h1 > h2 ? h1:h2);
}

int getSibling(int u) {
    if (T[u].parent == NIL) return NIL;
    if (T[T[u].parent].left != u && T[T[u].parent].left != NIL)
      return T[T[u].parent].left;
    if (T[T[u].parent].right != u && T[T[u].parent].right != NIL)
      return T[T[u].parent].right;
    return NIL;
}

void print(int u) {
    printf("node %d: ", u);
    printf("parent = %d, ", T[u].parent);
    printf("sibling = %d, ", getSibling(u));
    int deg = 0;
    if (T[u].left != NIL) deg++;
    if (T[u].right != NIL) deg++;
    
    printf("degree = %d, ", deg);
    printf("depth = %d, ", D[u]);
    printf("height = %d, ", H[u]);
    
    if (T[u].parent == NIL) {
        printf("root\n");
    } else if (T[u].left == NIL && T[u].right == NIL) {
        printf("leaf\n");
    } else {
        printf("internal node\n");
    }
}

int main() {
    int v, l, r, root = 0;
    scanf("%d", &n);
    
    for (int i = 0; i < n; i++) T[i].parent = NIL;
    
    for (int i = 0; i < n; i++) {
        scanf("%d %d %d", &v, &l, &r);
        T[v].left = l;
        T[v].right = r;
        if (l != NIL) T[l].parent = v;
        if (r != NIL) T[r].parent = v;
    }
    
    for (int i = 0; i < n; i++) if (T[i].parent == NIL) root = i;
    
    setDepth(root, 0);
    setHeight(root);
    
    for (int i = 0; i < n; i++) print(i);
    
    return 0;
}

Measured memory_bytes: 2760
#include <iostream>

int main(){
	int n;
	while(std::cin >> n, n){
		int max_p, max_d = 0;
		for(;n;n--){
			int p, d1, d2;
			std::cin >> p >> d1 >> d2;
			if(d1 + d2 > max_d)
				max_p = p, max_d = d1 + d2;
		}
		std::cout << max_p << " " << max_d << std::endl;
	}
}

Measured memory_bytes: 868
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <iostream>
#include <algorithm>

using namespace std;

typedef long long ll;
ll a[100];
int b[120];
int main(){
	int a,b;
	while(~scanf("%d %d", &a, &b)){
		int k = 1;
		int e = b;
		while(b >= 9){
			b = b / 10;
			k++;
		}
		int c = 1;
		for(int i = 0; i < k; i++)
			c = c * 10;
		int d = a * c + e;
		int f = (int)sqrt(d);
		if(f * f == d)
			printf("Yes\n");
		else
			printf("No\n");
	}
}

Measured memory_bytes: 256
import java.io.*;
 
class Main {
    public static void main(String[] args) {
        BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );
        try {
            int n = Integer.parseInt( kb.readLine() );
            
            int num, cnt = 0;
            int i, j;
            boolean isprime = true;
            for( i=0; i<n; i++ ) {
            	isprime = true;
            	num = Integer.parseInt( kb.readLine() );
            	for( j=2; (j*j)<=num; j+=1 ) {
            		if( 0 == num%j ) {
            			isprime = false;
            			break;
            		}
            	}
            	if( isprime ) {
            		cnt++;
            	}
            }
            
            System.out.println( cnt  );
             
            kb.close();
        } catch( IOException e ) {
            System.err.println( e );
        }
    }
}

Measured memory_bytes: 22716
#include <string.h>
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <istream>
#define INF 2147483647
#define LLINF 9223372036854775807
typedef long long ll;
using namespace std;
int main(){
	ll a,b,c,d,t;
	cin>>a>>b>>c>>d>>t;
	if(a>c)swap(a,c);
	if(t*(b-d)>=(c-a)){
		cout<<"YES"<<endl;
	}
	else cout<<"NO"<<endl;
	return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <cstdio>
#include <queue>
using namespace std;
string map[51];
int check[51][51];
queue<pair<int,int>> q;
int dx[4] = {0,0,-1,1};
int dy[4] = {1,-1,0,0};
int main(int argc, const char * argv[]) {
   
    
    int n,m;
    
    scanf("%d %d",&n,&m);
    
    for(int i=0;i<n;i++){
        cin >> map[i];
    }
    int cnt = 0;
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            if(map[i][j]=='.'){
                cnt++;
            }
        }
    }
    
    check[0][0]=1;
    q.push({0,0});
    
    while(!q.empty()){
        
        int x = q.front().first;
        int y = q.front().second;
        q.pop();
        if(x == n-1 && y==m-1) break;
        for(int k=0;k<4;k++){
            int nx = x + dx[k];
            int ny = y + dy[k];
            
            if( 0<=nx && nx< n && 0<=ny && ny<m){
                if(map[nx][ny]=='.' && check[nx][ny]==0){
                    q.push({nx,ny});
                    check[nx][ny] = check[x][y] + 1;
                }
            }
        }
    }
    
    int sz = check[n-1][m-1];
    
    if(sz==0) printf("-1\n");
    else printf("%d\n",cnt-sz);
    
    
    return 0;
}


Measured memory_bytes: 256
ls=['0','1','2','3','4','5','6','7','8','9']
a,b=[int(s) for s in input().split()]
S=input()
if S[a]=='-':
  for i in range(a):
    if not(S[i] in ls):
      print('No')
      break
  else:
    for j in range(b):
      if not(S[a+j+1] in ls):
        print('No')
        break
    else:
      print('Yes')
else:
  print('No')

Measured memory_bytes: 38256
N,K,Q=list(map(int,input().split()))
A=[int(input()) for _ in range (Q)]
B=[0 for _ in range (N)]
for i in range(Q):
    B[A[i]-1]+=1
C=sum(B)-K
for i in range(N):
    if C>=B[i]:
        print('No')
    else:
        print('Yes')

Measured memory_bytes: 8644
#include<iostream>
using namespace std;
int main()
{
    int a[5],i,s;
    for(i=0;i<5;i++)
    {
        cin>>a[i];
        if(a[i]==0)
        {
          s=i+1;
        }
    }
    cout<<s<<endl;
    return 0;
}


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

const int MAX = 2000000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(){
	int X,Y,x,y;
	long sum=0;
	cin>>X>>Y;
	if((2*Y-X)%3==0 && (2*X-Y)%3==0){
		x=(2*X-Y)/3;
		y=(2*Y-X)/3;
      	COMinit();
		sum+=COM(x+y,x)%MOD;
	}
	sum%=MOD;
	cout<<sum;
	return 0;
}

Measured memory_bytes: 47232
/*package whatever //do not write package name here */
/*package whatever //do not write package name here */

// Working program with FastReader 
import java.io.BufferedReader; 
import java.io.IOException; 
import java.io.InputStreamReader; 
import java.util.Scanner; 
import java.util.StringTokenizer; 

public class Main 
{ 
	static class FastReader 
	{ 
		BufferedReader br; 
		StringTokenizer st; 

		public FastReader() 
		{ 
			br = new BufferedReader(new
					InputStreamReader(System.in)); 
		} 

		String next() 
		{ 
			while (st == null || !st.hasMoreElements()) 
			{ 
				try
				{ 
					st = new StringTokenizer(br.readLine()); 
				} 
				catch (IOException e) 
				{ 
					e.printStackTrace(); 
				} 
			} 
			return st.nextToken(); 
		} 

		int nextInt() 
		{ 
			return Integer.parseInt(next()); 
		} 

		long nextLong() 
		{ 
			return Long.parseLong(next()); 
		} 

		double nextDouble() 
		{ 
			return Double.parseDouble(next()); 
		} 

		String nextLine() 
		{ 
			String str = ""; 
			try
			{ 
				str = br.readLine(); 
			} 
			catch (IOException e) 
			{ 
				e.printStackTrace(); 
			} 
			return str; 
		} 
	} 

	public static void main(String[] args) 
	{ 
		FastReader ob=new FastReader(); 
		String s = ob.next();
		for (int i=0;i<s.length() ; i++) {
		    System.out.print("x");
		}
	
	
	
	} 
} 


Measured memory_bytes: 20180
_ = gets
array = readline.split(' ').map(&:to_i)
sort_array = array.sort
count = 0
ans = 'YES'
array.each_with_index do |e, idx|
  if sort_array[idx] != e
    count += 1
  end

  if count == 3
    ans = 'NO'
    break
  end
end

puts ans

Measured memory_bytes: 1788
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
class Main {
    
    public static void main(String[] args) throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        int[] mountain=new int[10];
        for(int i=0;i<10;i++){
            mountain[i]=Integer.parseInt(br.readLine());
        }Arrays.sort(mountain);
        for(int i=0;i<3;i++){
            System.out.println(mountain[mountain.length-i-1]);
        }
    }
    
}

Measured memory_bytes: 24200
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long  ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)
static const ll LL_MAX = (ll)1 << 55;

int main()
{
	ll n, a, b;
	scanf("%lld%lld%lld", &n, &a, &b);

	ll ans = 0;
	ll x[100001] = {};
	repe(i, 1, n) {
		scanf("%lld", &x[i]);
		if (i >= 2) ans += min((x[i] - x[i - 1])*a, b);
	}
	printf("%lld", ans);
	return 0;
}

Measured memory_bytes: 1024
import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり


# 998244353 = 119*2**23

mod = 998244353
primitive_root = 3  # mod の原始根
roots = [pow(primitive_root,(mod-1) >> i,mod) for i in range(24)]
inv_roots = [pow(r,mod-2,mod) for r in roots]
# roots[i] = 1 の 2**i 乗根、inv_roots[i] = 1 の 2**i 乗根の逆元


# 順番は変わる

def ntt(A,n):
    for i in range(n):
        m = 1 << (n-i-1)
        for start in range(1 << i):
            w = 1
            start *= m*2
            for j in range(m):
                A[start+j],A[start+j+m] = (A[start+j]+A[start+j+m]) % mod,(A[start+j]-A[start+j+m])*w % mod
                w *= roots[n-i]
                w %= mod
    return A


def inv_ntt(A,n):
    for i in range(n):
        m = 1 << i
        for start in range(1 << (n-i-1)):
            w = 1
            start *= m*2
            for j in range(m):
                A[start+j],A[start+j+m] = (A[start+j]+A[start+j+m]*w) % mod,(A[start+j]-A[start+j+m]*w) % mod
                w *= inv_roots[i+1]
                w %= mod
    a = pow(2,n*(mod-2),mod)
    for i in range(1 << n):
        A[i] *= a
        A[i] %= mod
    return A


def convolution(A,B):
    a,b = len(A),len(B)
    deg = a+b-2
    n = deg.bit_length()
    N = 1 << n
    A += [0]*(N-a)  # A の次数を 2冪-1 にする
    B += [0]*(N-b)  # B の次数を 2冪-1 にする
    A = ntt(A,n)
    B = ntt(B,n)
    C = [(A[i]*B[i]) % mod for i in range(N)]
    C = inv_ntt(C,n)
    return C[:deg+1]


N,M = MI()
A,B = LI(),LI()
print(*convolution(A,B))


Measured memory_bytes: 199628
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <complex>

#include <string>
#include <sstream>
using namespace std;

typedef complex<double> P;

struct C {
  P p;
  double r;
  C(P p, double r) : p(p), r(r) {}
};

const double eps = 1e-10;
const double pi = acos(-1);


double equals(double a, double b) { return fabs(a-b) < eps; }

double dot(P a, P b) { return a.real()*b.real() + a.imag()*b.imag(); }
double norm(P a) { return dot(a,a); }
double abs(P a) { return sqrt(norm(a)); }

bool isIn(P p, C c) {
  double d = norm(p-c.p);
  double rr = c.r*c.r;
  return equals(d, rr) || d < rr;
}

P getRotateP(P a, double rad) {
  return P(a.real()*cos(rad) - a.imag()*sin(rad),
	   a.real()*sin(rad) + a.imag()*cos(rad));
}

int isIntersect(C a, C b) {
  double d = norm(a.p-b.p);
  double rpr = a.r + b.r;
  double rmr = a.r - b.r;
  rpr *= rpr; rmr *= rmr;
  if(equals(d,rpr)) return 1;//circumscribed
  if(equals(d,rmr)) return 1;//inscribed
  if(d > rpr) return 0;
  if(d < rmr) return 0;
  return 2;
}

vector<P> getCrossP(C a, C b) {
  vector<P> v;
  int num = isIntersect(a,b);
  P base = b.p - a.p;
  if(num == 1) {
    v.push_back(a.p + base*a.r/abs(b.p - a.p));
  } else if(num == 2) {
    double drad = acos((norm(base) + a.r*a.r - b.r*b.r)/(2.0*abs(base)*a.r));
    v.push_back(a.p + getRotateP(base, drad)*a.r/abs(base));
    v.push_back(a.p + getRotateP(base, drad)*a.r/abs(base));
  }
  return v;
}

vector<C> seal;
vector<P> ps;

void makeIP() {
  for(int i = 0; i < seal.size(); ++i) {
    for(int j = i+1; j < seal.size(); ++j) {
      vector<P> v = getCrossP(seal[i], seal[j]);
      for(int k = 0; k < v.size(); ++k) ps.push_back(v[k]);
    }
  }
}

int solve() {
  ps.clear();
  makeIP();
  for(int i = 0; i < seal.size(); ++i)
    ps.push_back(seal[i].p);

  int res = 1;
  for(int i = 0; i < ps.size(); ++i) {
    int cnt = 0;
    for(int j = 0; j < seal.size(); ++j) {
      if(isIn(ps[i], seal[j])) ++cnt;
    }
    res = max(res, cnt);
  }
  return res;
}

int main() {
  int n;
  while(cin >> n && n) {
    getchar();
    seal.clear();
    for(int i = 0; i < n; ++i) {
      string line;
      stringstream ss;
      getline(cin, line);
      replace(line.begin(), line.end(), ',', ' ');
      ss << line;
      P p;
      ss >> p.real() >> p.imag();
      seal.push_back(C(p, 1.0));
    }
    cout << solve() << endl;
  }
  return 0;
}

Measured memory_bytes: 0
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
c = 0
Acount = [0] * len(A)
Bcount = [0] * len(B)
count = 0
A = sorted(A, reverse=True)
B = sorted(B, reverse=True)
C = sorted(C, reverse=True)

for b in range(len(B)):
    Bcount[b] = count
    if c < len(C):
        while B[b] < C[c]:
            c += 1
            Bcount[b] += 1
            if c == len(C):
                break
        count = Bcount[b]
b = 0
count = 0
for a in range(len(A)):
    Acount[a] = count
    if b < len(B):
        while A[a] < B[b]:
            Acount[a] += Bcount[b]
            b += 1
            if b == len(B):
                break
        count = Acount[a]

print(sum(Acount))

Measured memory_bytes: 24980
#Union Find

#xの根を求める
def find(x):
    if par[x] < 0:
        return x
    else:
        tank = []
        while par[x] >= 0:
            tank.append(x)
            x = par[x]
        for elt in tank:
            par[elt] = x
        return x
#xとyの属する集合の併合
def unite(x,y):
    x = find(x)
    y = find(y)
    
    if x == y:
        return False
    else:
        #sizeの大きいほうがx
        if par[x] > par[y]:
            x,y = y,x
        par[x] += par[y]
        par[y] = x
        return True

#xとyが同じ集合に属するかの判定
def same(x,y):
    return find(x) == find(y)

#xが属する集合の個数
def size(x):
    return -par[find(x)]

#集合の数
def numb():
    l = len(par)
    num = 0
    for ij in range(l):
        if par[ij] < 0:
            num += 1
    return num

n, m = map(int, input().split())
ab = []
for i in range(m):
    ab.append(list(map(int, input().split())))
par = [-1]*(n+1)
for j in range(m):
    unite(ab[j][0], ab[j][1])

print(numb() - 2)




Measured memory_bytes: 28064
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rrep(i,n) for(ll i = 1; i <= (n); ++i)
#define drep(i,n) for(ll i = (n)-1; i >= 0; --i)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (ll)(x).size()
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
ll gcd(ll a,ll b){if(a%b==0){return b;}else{return(gcd(b,a%b));}}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const int INF=1e9;
const ll MX = 1e18;
const ll MOD=INF+7;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};
const double PI=acos(-1);
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
#define YN {puts("YES");}else{puts("NO");}
const ll MAX = 1000001;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {fac[0] = fac[1] = 1;finv[0] = finv[1] = 1;inv[1] = 1;for (ll i = 2; i < MAX; i++){fac[i] = fac[i - 1] * i % MOD;inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;finv[i] = finv[i - 1] * inv[i] % MOD;}}
long long COM(ll n, ll k){if (n < k) return 0;if (n < 0 || k < 0) return 0;return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;}
ll llpow(ll n,ll i){ll cnt=n;  for(ll j=0;j<i-1;j++){n*=cnt;}return n;}

int main() {
  ll s;
  cin>>s;
  v(ll) dp(s+1,1);
  dp[0]=0;
  dp[1]=0;
  dp[2]=0;
  for(ll i=3;i<=s;i++){
    ll cnt=i-3;
    for(ll j=3;cnt>=0;j++){
      dp[i]=(dp[i]+dp[i-j])%MOD;
      dp[i]%=MOD;
      if(dp[i]<0) dp[i]+=MOD;
      cnt--;
    }
  }
  cout<<dp[s]<<endl;
  return 0;
}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
template<class T>bool chmin(T&a,const T&b){return a>b?(a=b,true):false;}
template<class T>bool chmax(T&a,const T&b){return a<b?(a=b,true):false;}


int main2() {
  int N; cin >> N;
  string s; cin >> s;
  
  int c = 0;
  int mi = 0;
  REP(i, N) {
    if (s[i] == '(') c++; else c--;
    chmin(mi, c);
  }
  cout << string(-mi, '(');
  cout << s;
  cout << string(c - mi, ')');
  cout << endl;

  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws) main2();
  return 0;
}


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

int main() {
	int n; cin >> n;
	vector<int> a;

	int z;
	for (int i = 0; i < n; i++) {
		cin >> z; a.push_back(z);
	}

	sort(a.begin(), a.end(), greater<int>());

	int alice = 0;
	int bob = 0;
	for (int i = 0; i < a.size(); i++) {
		if (i % 2 == 0) alice += a[i];
		else bob += a[i];
	}

	cout << alice - bob << endl;

	return 0;
}

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

int u[1001][1001],n,h,m,I,a,t[1001],c[1001],S=1000;
char g;

int main(){
	while(cin>>n,n){
		a=0;
		memset(u,0,sizeof(u));memset(c,0,sizeof(c));
		rep(i,n){
			cin>>h>>g>>h>>h>>g>>m>>g>>I;
			m+=h*60;
			t[i]=m;
			u[I][i]+=g=='I'?1:-1;
		}
		rep(i,S)Rep(j,S)u[i][j]+=u[i][j-1];
		Rep(i,S)rep(j,S)if(u[i][j]&&u[0][j])c[i]+=t[j+1]-t[j];
		Rep(i,S)a=max(a,c[i]);
		cout<<a<<endl;
	}
}

Measured memory_bytes: 5088
/*
ID: vamaddu1
LANG: C++11
TASK: cowfood
*/

#define __USE_MINGW_ANSI_STDIO 0
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <stack>
#include <deque>
#include <string.h>
#include <sstream>
#include <bitset>
#include <math.h>
#include <assert.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
template <class T>
using ordered_set = __gnu_pbds::tree<T, __gnu_pbds::null_type, less<T>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>;
template <class T>
using ordered_multiset = __gnu_pbds::tree<T, __gnu_pbds::null_type, less_equal<T>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>;

#define PI atan2(0, -1)
#define epsilon 1e-9
#define INF 5000000000000000000
#define MOD 1000000007

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

int H, W, N;
pair<int, int> locs [3010];
long long f [200010], dp [3010];

long long fastExpo(long long b, long long e){
    if(e == 0) return 1;
    long long meme = fastExpo(b, e/2);
    meme *= meme; meme %= MOD;
    if(e%2){ meme *= b; meme %= MOD; }
    return meme;
}

long long wombo(int x, int y){ return (f[x+y]*fastExpo((f[x]*f[y])%MOD, MOD-2))%MOD; }

int main(){
    //freopen("sort.in", "r", stdin); freopen("sort.out", "w", stdout);
    ios_base::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(10);
    cin >> H >> W >> N; f[0] = 1;
    for(int i = 1; i <= H+W; i++) f[i] = (f[i-1]*(long long)i)%MOD;
    for(int i = 0; i < N; i++) cin >> locs[i].f >> locs[i].s;
    sort(locs, locs+N); locs[N++] = mp(H, W);
    for(int i = 0; i < N; i++){
        dp[i] = wombo(locs[i].f-1, locs[i].s-1);
        for(int j = 0; j < i; j++)
            if(locs[j].f <= locs[i].f && locs[j].s <= locs[i].s){
                dp[i] -= (wombo(locs[i].f-locs[j].f, locs[i].s-locs[j].s)*dp[j])%MOD;
                dp[i] = (dp[i]+MOD)%MOD;
            }
    }
    cout << dp[N-1] << '\n';
    return 0;
}

/******************************
Kateba ii dake no hanashi darou
Success is only a victory away
- No Game No Life Opening
******************************/


Measured memory_bytes: 1920
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  vector<double>money(N);
  vector<string>name(N);
  for(int i=0;i<N;i++){
    cin>>money.at(i)>>name.at(i);
  }
  for(int i=0;i<N;i++){
    if(name.at(i)=="BTC"){
      money.at(i)=money.at(i)*380000.0;
    }
    else{
    }
  }
  double count=0;
  for(int i=0;i<N;i++){
    count=count+money.at(i);
  }
  cout<<count<<endl;
}

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

int main() {
    int N,K;
    cin >> N >> K;
    
    int a = 1;
    for (int i; i<N; i++){
        if (a>K) a += K;
        else a *= 2;
    }
    
    cout << a << endl;
}


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

using namespace std;

#define ll long long
#define REP(i, n) for(int i=0; i < (int)(n); ++i)
#define REPR(i, n) for(int i=n; i>= 0; --i)
#define FOR(i, m, n) for(int i=m; i<n; ++i)

int main(){
    ll A, B, C;
    cin >> A >> B >> C;
    int flag = 0;
    FOR(i,1, 1000){
        if(A*i % B == C){
            cout << "YES" << endl;
            flag = 1;
            break;
        }
    }
    if(!flag)
        cout << "NO" <<endl;

    return 0;
}

Measured memory_bytes: 256
/* ex4_3
    nnasy */

#include <stdio.h>

// プロトタイプ宣言
int snowDepth(int shortTower, int tallTower);

int main(void) {
    // 宣言と入力
    int heightShort, heightTall, ans;
    scanf("%d%d", &heightShort, &heightTall);

    // 関数を使った計算と答えの出力
    ans = snowDepth(heightShort, heightTall);
    printf("%d\n", ans);

    return 0;
}

int snowDepth(int shortTower, int tallTower){
    // 宣言
    int dif, depth;

    // 雪の深さの計算
    dif = tallTower - shortTower;
    depth = dif*(dif-1)/2 -shortTower;
    
    return depth;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main (){
	string s;
	int a=0,b=0;
	cin>>s;
	int c=s.size();
	for(int i=0;i<c;i++){
		if(i%2==0){
			if(s[i]!='0')a++;
			}
		else{
			if(s[i]!='1')a++;
			}
		}
	for(int j=0;j<c;j++){
		if(j%2==0){
			if(s[j]!='1')b++;
			}
		else{
			if(s[j]!='0')b++;
			}
		}
	if(a>=b)cout<<b;
	else cout<<a;
	cout<<endl;
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;

int main()
{
	int n,a;
	vector<int>v;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a;
		v.push_back(a);
	}
	sort(v.begin(),v.end());
	cout<<v[(n-1)/2+1]-v[(n-1)/2]<<endl;
	return 0;
}

Measured memory_bytes: 892
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>

using namespace std;

typedef long long ll;

int main() {
    int n;
    cin >> n;
    vector<ll> a(3 * n);
    for (int i = 0; i < 3 * n; ++i) {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());
    ll sum = 0;
    int i = 1;
    while(i < 2 * n){
        sum += a[i];
        i += 2;
    }

    cout << sum << endl;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define md 1000000007
using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    long long n, i = 0, j= 0, k = 0, l = 0, m = 0, a = 0, b = 0, sum = 0, x = 0, y = 0, z = 0, c, p, r, s;
    cin >> n >> k;
    cin >> r >> s >> p;
    string str, res = "";
    cin >> str;
    for(i = 0; i < k; i++){
        if(str[i] == 'r'){
            sum += p;
            res.pb('p');
        }
        else if(str[i] == 's'){
            sum += r;
            res.pb('r');
        }
        else if(str[i] == 'p'){
            sum += s;
            res.pb('s');
        }
    }
    for(i = k; i < n; i++){
        if(str[i] == 'r'){
            if(res[i-k] != 'p'){
                sum += p;
                res.pb('p');
            }
            else{
                res.pb('x');
            }
        }
        else if(str[i] == 's'){
            if(res[i-k] != 'r'){
                sum += r;
                res.pb('r');
            }
            else{
                res.pb('x');
            }
        }
        else if(str[i] == 'p'){
            if(res[i-k] != 's'){
                sum += s;
                res.pb('s');
            }
            else{
                res.pb('x');
            }
        }
    }
    cout << sum;

    return 0;
}


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

int main() {
  int64_t x;
  cin >> x;
  
  
  int64_t a;
  int64_t b;
  int64_t c;
  a = 2;
  b = 1;  
  for(int64_t i=1; i<x; i++){
    c = a;
    a = b;
    b = a + c;
  }
  
    printf("%ld", b);  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    ll n;
    cin >> n;
    vector<ll> a(n);
    for(ll i = 0; i < n; i++){
        cin >> a[i];
    }
    ll now = 1;
    ll cnt = 0;
    bool k = false;
    while(cnt <= n){
        cnt++;
        now = a[now - 1];
        if(now == 2){
            k = true;
            break;
        }
    }
    cout << (k ? cnt : -1) << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>

#define forn(i,n) for(int i = 0;i<int(n);i++)
#define ll long long

using namespace std;

int main(){
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    set<string> a;
    ll n;
    cin>>n;
    forn(i,n){
        string tmp;
        cin>>tmp;
        a.insert(tmp);
    }
    cout<<a.size()<<endl;
}



Measured memory_bytes: 19184
# AGC003B - Simplified mahjong
def main():
    # split in subsequences when 0 appears -> sum up cur // 2
    N, *A = map(int, open(0).read().split())
    A.append(0)
    ans, cur = 0, 0
    for i in A:
        if i:
            cur += i
        else:
            ans += cur // 2
            cur = 0
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 14092
#include <stdio.h>

int main()
{
    int x[3000], y[3000];
    int i = 0;
    int j;

    do
    {
        scanf("%d %d", &x[i], &y[i]);
        i++;
    }while (!((x[i - 1] == 0) && (y[i - 1] == 0)));

    for (j = 0; (i - 1) != j; j++)
    {
        if (x[j] <= y[j])
        {
            printf ("%d %d\n", x[j], y[j]);
        }
        else if(x[j] > y[j])
        {
            printf ("%d %d\n", y[j] ,x[j]);
        }
    }
return 0;
}

Measured memory_bytes: 624
#include <bits/stdc++.h>
#define ll          long long int
#define uu          first
#define vv          second
#define pii         pair<int,int>
#define pll         pair<ll,ll>
#define tp          tuple<int,int,int>
#define fastio      ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;

const int N = 1e6 + 6;

int main()  {
    fastio;

    
    int n;
    cin>>n;
    vector<ll>x(n) , y(n);
    for(int  i=0 ; i < n ; i++ ) cin>>x[i]>>y[i];

    ll mnSum = INF, mxSum = -INF;
    for(int i =0 ; i < n ; i++ ) {
        mnSum = min(mnSum , x[i] + y[i]);
        mxSum = max(mxSum , x[i] + y[i]);
    }

    ll ans1 = mxSum - mnSum;

    ll mnDiff = INF , mxDiff = -INF;
    for(int i =0 ; i < n ; i++ ) {
        mnDiff = min(mnDiff , x[i] - y[i]);
        mxDiff = max(mxDiff , x[i] - y[i]);
    }

    ll ans2 = mxDiff - mnDiff;
    cout<<max(ans1 , ans2)<<'\n';
    return 0;


}

Measured memory_bytes: 6336
#include <bits/stdc++.h>
#define mem(a,b) memset(a,b,sizeof a);
#define rep(i,a,b) for(int i = a; i <= b; i++)
#define per(i,a,b) for(int i = a; i >= b; i--)
#define __ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
typedef long long ll;
typedef double db;
const db EPS = 1e-9;
const int N = 2000+10;
using namespace std;

void dbg() {cout << "\n";}
template<typename T, typename... A> void dbg(T a, A... x) {cout << a << ' '; dbg(x...);}
#define logs(x...) {cout << #x << " -> "; dbg(x);}

int st[2*N][25],n;
ll x,a[2*N],ans;

//数组范围为[0,len-1]
void init(){
    for(int i = 1; i <= 2*n; i++) st[i][0] = a[i];
    for(int j = 1; (1<<j) <= 2*n; j++){
        for(int i = 1; i + (1<<j) - 1 <= 2*n; i++)
            st[i][j] = min(st[i][j-1],st[i+(1<<(j-1))][j-1]);
    }
}

//求[l,r]之间的最小值
int query(int l,int r){
    int k = (int)(log((double)(r - l + 1)) / log(2.0));
    return min(st[l][k],st[r-(1<<k)+1][k]);
}


int main()
{
	scanf("%d%lld",&n,&x);
	rep(i,1,n) scanf("%lld",&a[i]);
	rep(i,n+1,2*n) a[i] = a[i-n];
 	init();
 	rep(i,1,n) ans += a[i];
 	rep(k,1,n){
 		ll tmp = (ll)k*x;
 		rep(i,1,n){
 			int x = i+n-k, y = i+n;
 			// logs(i,k,x,y);
 			tmp += query(x,y);
 		}
 		ans = min(ans,tmp);
 	}
 	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 640
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;


int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    --k;
    s[k] += 32;

    cout << s << "\n";

    return 0;
}

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

using namespace std;

int n;
string s;

void init() {
    cin >> s;
    n = s.length();
}

vector<int> v[100005];

bool ok() {
    if(s[0] == '0') return false;
    if(s[n-1] == '1') return false;
    for(int i = 0 ; i < n-1 ; i++) {
        if(s[i] == '1' && s[n-2-i] == '0') return false;
    }

    return true;
}

void solve() {
    if(!ok()) {
        cout << "-1\n";
    }
    else {
        int k = 0;
        for(int i = 0 ; i < n ; i++) k += (s[i] == '1');
        int id = k+2;

        int pre = 1, now = 2;
        for(int i = 1 ; i < n ; i++) {
            if(s[i] == '1') {
                int cnt = (i+1) - pre - 1;
                while(cnt > 0) { v[now].push_back(id++); cnt--; }
                pre = i+1;
                now++;
            }
        }

        for(int i = 1 ; i <= k ; i++) cout << i << ' ' << i+1 << '\n';
        for(int i = 1 ; i <= k+1 ; i++) {
            for(auto j : v[i]) cout << i << ' ' << j << '\n';
        }
    }
}

int main() {
    init();
    solve();
}


Measured memory_bytes: 4088
import java.util.Scanner;

public class Main {
    private static final int MOD = 1_000_000_007;
    private static final String YES = "Yes";
    private static final String NO = "No";

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

        int X = sc.nextInt();
        int Y = sc.nextInt();

        System.out.println(solve(X, Y) ? YES : NO);
    }

    private static boolean solve(int X, int Y) {
        if (2 * X <= Y && Y <= 4*X && Y%2 == 0) return true;

        return false;
    }
}

Measured memory_bytes: 35704
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define repr(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define ALL(a) (a).begin(), (a).end()
using ll = long long;
using Graph = vector<vector<int>>;
const ll mod = 1e9 + 7;
const ll INF = 1e9;
const ll LINF = 1LL << 60;

int main() {
  int n;
  cin >> n;
  while (n > 0) {
    int c = n % 10;
    if (c == 7) {
      cout << "Yes" << endl;
      return 0;
    }
    n /= 10;
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3636
// INCLUDE LIST
#include <cstdio>
#include <bitset>
#include <iostream>
#include <queue>
#include <stack>
#include <string>
#include <cstring>
#include <algorithm>
#include <map>
#include <set>
#include <list>
#include <vector>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <iomanip>
using namespace std;

int main() {
  int n, l[10000];
  int maks = -1;
  int indx = -1;
  
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> l[i];
    if (maks < l[i]) {
      maks = l[i];
      indx = i;
    }
  }
  
  int sum = 0;
  for (int i = 0; i < n; i++) {
    if (i == indx) continue;
    sum += l[i];
  }
  
  cout << ((maks < sum) ? "Yes" : "No") << endl;
  return 0;
}



Measured memory_bytes: 256