akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <list>
#include <set>
#include <stack>
#include <cctype>
#include <cmath>
#include <bitset>

using namespace std;
/* typedef */
typedef long long ll;
/* constant */
const int INF = 1 << 30;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
vector< vector<int> > V;
int N;
/* function */
void dfs(string s, char mc) {
    if (s.length() == N) {
        cout << s << '\n';
        return ;
    }
    for (char c = 'a'; c <= mc; c++) {
        dfs(s + c, ((c == mc) ? mc + 1 : mc));
    }
}
/* main */
int main(){
    cin >> N;
    dfs("", 'a');
}

Measured memory_bytes: 1536
#include<bits/stdc++.h>				//Written by ThiDaiLoc
using namespace std;				//Team Three Wolves
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<ll,pll> trp;
typedef vector<ll> vi;
typedef vector<pll> vp;

#define fu(i,a,b)   for(ll i=a;i<=b;i++)
#define f1(i,n)     for(ll i=1;i<=n;i++)
#define fs(i,s)     for(ll i=0;i+1<=s.length();i++)
#define fd(i,b,a)   for(ll i=b;i>=a;i--)
#define fuv(i,a)    for(ll i=0;i<a.size();i++)
#define fdv(i,a)    for(ll i=(ll)a.size()-1;i>=0;i--)
#define ms(a,x)     memset(a, x, sizeof a)
#define prec(n)     fixed<<setprecision(n)
#define uni(a)      (a).erase(unique(all(a)), (a).end())
#define pb(i)       push_back(i)
#define pob         pop_back()
#define sc(a)       cin>>a
#define sc2(a,b)    cin>>a>>b
#define sc3(a,b,c)  cin>>a>>b>>c
#define pr(a)       cout<<a<<endl
#define pr2(a,b)    cout<<a<<" "<<b<<endl
#define rpr(a)      return cout<<a<<endl,0
#define prY         cout<<"Yes"<<endl
#define prN         cout<<"No"<<endl
#define bit(n,i)    (((n)>>(i))&1)
#define lowb(a,n,x) lower_bound(a,a+n,x) -a
#define lowb2(a,x)  lower_bound(all(a),x) -a.begin()
#define all(x)      (x).begin(), (x).end()
#define sz(a)       (ll)a.size()
#define le(s)       (ll)s.length()		
#define re          return 	
#define	mp(a,b)     make_pair(a,b)
#define	mp3(a,b,c)  make_pair(a,make_pair(b,c))
#define se          second
#define fi          first 
#define sse         second.second
#define sfi         second.first
#define soA         sort(A+1,A+1+n)
#define so(A,n)     sort(A+1,A+1+n)
#define sov(v)      sort(all(v))
#define sovr(v)     sort(all(v),greater<ll>())
#define debug(x)    cerr << #x << " = " << x << endl
#define INPUT       freopen("locin.txt", "r", stdin)
#define OUTPUT      freopen("locout.txt", "w", stdout)
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline ll mnz(ll& a,ll b){return a=(a>b?b:a);}
inline ll mxz(ll& a,ll b){return a=(a<b?b:a);}
inline string toString(ll n) {stringstream ss; ss << n;return ss.str();}
double const eps = 1e-6;
ll const Base=1e9+7,oo=1e17,MAXN=1e6;


ll A[5][5];

ll Solves(){
	
	ll n,m,k,cnt=0,ans=0,x,y,q,c,sum=0,v,t;
	// PROCESS IN HERE
//	sc(n);
	//f1(i,n)sc(A[i]);
	f1(i,3)f1(j,3)sc(A[i][j]);
	sc(n);
	while(n--){
		sc(x);
		f1(i,3)f1(j,3)if(A[i][j]==x)A[i][j]=-1;
	}
	
	f1(i,3){
		c=1;
		f1(j,3){
			if(A[i][j]!=-1)c=0;
		}
		if(c)re prY,0;
	}
	f1(j,3){
		c=1;
		f1(i,3){
			if(A[i][j]!=-1)c=0;
		}
		if(c)re prY,0;
	}
	c=1;
	f1(i,3){
		//c=1;
		if(A[i][i]!=-1)c=0;
		
	}
	if(c)re prY,0;
	c=1;
	f1(i,3){
		//c=1;
		if(A[i][3-i+1]!=-1)c=0;
		
	}
	if(c)re prY,0;
	prN;
	re 0;
	// Hack it if you can :)
}

int main(){
	//INPUT;
	if(fopen("locin.txt", "r"))INPUT;
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	ll test=1;
//	sc(test);
	fu(T,1,test){
//		cout<<"Case #"<<T<<": ";
		Solves();
	} 		
}

Measured memory_bytes: 256
X = int(input())
for a in range(0, 10**3):
    for b in range(0, 10**3):
        if X == a**5 - b**5:
            print(a, b)
            exit()
        elif X == a**5 + b**5:
            print(a, -b)
            exit()
        elif X == -a**5 - (10**4 - b)**5:
            print(-a, 10**4 - b)
            exit()

Measured memory_bytes: 9072
using System;

public class Program
{
    static long n;
    static long m;
    static PriorityQueue queue;

    static string output;

    public static void Main(string[] args)
    {
        Input();
        Proc();
        Output();
    }

    static void Input()
    {
        string[] input = null;

        // スペース区切りの整数の入力(横、個別)
        input = Console.ReadLine().Split(' ');

        n = long.Parse(input[0]);
        m = long.Parse(input[1]);

        // スペース区切りの整数の入力(横、配列)
        input = Console.ReadLine().Split(' ');

        queue = new PriorityQueue();
        queue.Length = n;
        for (long idx = 0; idx < n; idx++)
        {
            queue.Push(long.Parse(input[idx]));
        }
    }

    static void Proc()
    {
        // 割引券の枚数分処理
        for (long i = 0; i < m; i++)
        {
            long money = queue.Pop();
            money /= 2;
            queue.Push(money);
        }
    }

    static void Output()
    {
        long money = 0;

        // 要素数分処理
        for (long i = 0; i < n; i++)
        {
            money += queue.Pop();
        }
        output = money.ToString();

        // 出力
        Console.WriteLine(output);
    }
}

class PriorityQueue
{
    private long[] _heap;
    private long _count;

    public long Length
    {
        get { return _heap.Length; }
        set { _heap = new long[value]; }
    }

    public void Push(long value)
    {
        // 追加先のidxを退避
        long idxCurrent = _count;

        // 末尾に値をセット
        _heap[_count] = value;
        _count++;

        // 既存の要素があれば入れ替え処理
        while (idxCurrent > 0)
        {
            long idxParent = (idxCurrent - 1) / 2;

            // 親要素が大きいなら、入れ替え中断
            if (_heap[idxCurrent] <= _heap[idxParent])
            {
                break;
            }

            // 入れ替えて親要素へ移動
            Swap(idxCurrent, idxParent);
            idxCurrent = idxParent;
        }
    }

    public long Pop()
    {
        // 先頭の値を退避
        long valueReturn = _heap[0];

        // 末尾の値を先頭に移動
        _heap[0] = _heap[_count - 1];
        _count--;

        // 入れ替え処理
        long idxCurrent = 0;
        long idxChild = 2 * idxCurrent + 1;
        while (idxChild < _count)
        {
            // 右の子要素が存在し、右の子要素の方が大きい
            if (idxChild < _count - 1 &&
                _heap[idxChild] < _heap[idxChild + 1])
            {
                idxChild++;
            }

            // 子要素が小さいなら、入れ替え中断
            if (_heap[idxCurrent] >= _heap[idxChild])
            {
                break;
            }

            // 入れ替えて子要素へ移動
            Swap(idxCurrent, idxChild);
            idxCurrent = idxChild;
            idxChild = 2 * idxCurrent + 1;
        }

        return valueReturn;
    }

    private void Swap(long idx1, long idx2)
    {
        long tmp = _heap[idx1];
        _heap[idx1] = _heap[idx2];
        _heap[idx2] = tmp;
    }
}

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

template <typename T>
inline T read(){
    T x=0,f=1;char c=getchar();
    while(!isdigit(c)){ if(c=='-') f=-f;c=getchar();}
    while(isdigit(c)){x=(x<<3)+(x<<1)+(c-48);c=getchar();}
    return x*f;
}

#define lint long long int
#define ulint unsigned lint
#define readint read<int>()
#define readlint read<lint>()
const lint inf=1e18+1e7,MAXN=1e2+1e1;

lint a[MAXN];
bool flag=false;
lint n,m=1000,x=0,p=1,now=inf,ans=0;

int main(void){

    // freopen("testdata.in","r",stdin);
    // freopen("testdata.out","w",stdout);

    scanf("%lld",&n);
    for(int i=1;i<=n;i++) a[i]=readint;
    while(p<=n){
        if(!flag){
            while(a[p]<=now && p<=n) now=min(now,a[p++]);
            x+=(m/now),m-=((m/now)*now),flag=true,now=0;
        }
        else{
            while(now<=a[p] && p<=n) now=max(now,a[p++]);
            m+=x*now,x=0,flag=false,now=inf;
        }
        ans=max(ans,m);
    }
    ans=max(ans,m+x*a[n]);
    printf("%lld\n",ans);

    return 0;
}

Measured memory_bytes: 3824
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n-1;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define INF 999999999
typedef pair<ll, ll> LP;

ll max(ll a, ll b){
	if (a>b) return a;
	else return b;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll a, b;
	cin >> a >> b;
	cout << max(a+b, max(2*a -1, 2*b-1)) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define maxn 100010
#define ll long long
struct arr
{
	ll x,y;
}a[maxn];
int n,i;
long long c,f[maxn]={0},g[maxn]={0},ans=0,sum=0;
int main()
{
	scanf("%d%lld",&n,&c);
	for (i=1;i<=n;i++)
		scanf("%lld%lld",&a[i].x,&a[i].y);
	for (i=1;i<=n;i++)
	{
		sum+=a[i].y;
		f[i]=sum-a[i].x*2LL;
	}
	sum=0;
	for (i=n;i>=1;i--)
	{
		sum+=a[i].y;
		g[i]=sum-(c-a[i].x)*2LL;
	}
	for (i=1;i<=n;i++)
		if (f[i]<f[i-1]) f[i]=f[i-1];
	for (i=n;i>=1;i--)
		if (g[i]<g[i+1]) g[i]=g[i+1];
	sum=0;
	for (i=1;i<=n;i++)
	{
		sum+=a[i].y;
		if (sum-a[i].x+g[i+1]>ans) ans=sum-a[i].x+g[i+1];
	}
	sum=0;
	for (i=n;i>=1;i--)
	{
		sum+=a[i].y;
		if (sum-c+a[i].x+f[i-1]>ans) ans=sum-c+a[i].x+f[i-1];
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 3456
#include <bits/stdc++.h>
using namespace std;
int n,k,l;
int g[2000100],d[2000100];
map<pair<int,int>,int>m;
inline int find(int x,int *p){
	if(p[x]==x)return x;
	else return p[x]=find(p[x],p);
}
inline int c(int x,int y,int *p){
	int px=find(x,p),py=find(y,p);
	if(px!=py){
		p[px]=py;
	}
}
int main(){
	cin>>n>>k>>l;
	for(int i=1;i<=n;i++){
		g[i]=i;
		d[i]=i;
	}
	for(int i=1;i<=k;i++){
		int x,y;
		cin>>x>>y;
		c(x,y,g);
	}
	for(int i=1;i<=l;i++){
		int x,y;
		cin>>x>>y;
		c(x,y,d);
	}
	for(int i=1;i<=n;i++){
        find(i,g);
        find(i,d);
    }
    for(int i=1;i<=n;i++)
        m[make_pair(g[i],d[i])]++;
    for(int i=1;i<=n;i++)cout<<m[make_pair(g[i],d[i])]<<" ";
    cout<<endl;
    return 0;
}

Measured memory_bytes: 16896
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <set>
#include <queue>
#include <map>
#include <numeric>
#include <functional>
#include <math.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

#define INF ((int)1e9)
#define INFLL ((ll)1e18)
#define MOD (1000000007LL)

ll lhs(ll a, ll b) {
    return a * a * a * a * a - b * b * b * b * b;
}

int main(int argc, const char * argv[]) {
    ios_base::sync_with_stdio(false);
    int X;
    cin >> X;
    vector<int> K;
    for (int n = 1; n * n <= X; ++n) {
        if (X%n == 0) {
            K.push_back(n);
            K.push_back(X/n);
        }
    }
    
    int Max = 1000;
    bool bEnd = false;
    for (int k : K) {
        for (int a = -Max; a <= Max; ++a) {
            if (lhs(a, a+k) == X) {
                cout << a << ' ' << a+k << endl;
                bEnd = true;
                break;
            }
        }
        if (bEnd) break;
        for (int a = -Max; a <= Max; ++a) {
            if (lhs(a, a-k) == X) {
                cout << a << ' ' << a-k << endl;
                bEnd = true;
                break;
            }
        }
        if (bEnd) break;
    }

    return 0;
}


Measured memory_bytes: 3660
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		try (Scanner sc = new Scanner(System.in)) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			int c = sc.nextInt();
			int x = sc.nextInt();
			
			int count = 0;
			for (int i = 0; i <= a; i++) {
				for (int j = 0; j <= b; j++) {
					for (int k = 0; k <= c; k++) {
						if (500 * i + 100 * j + 50 * k == x) {
							count ++;
						}
					}
				}
			}
			System.out.println(count);
		}

	}

}


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

fun PrintWriter.solve(sc: FastScanner) {
    val a = sc.nextLong()
    val b = sc.nextDouble()
    val c = (b * 1000).toLong() / 10
    println((a * c) / 100)
}

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

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

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

        return st.nextToken()
    }

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


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG2(x,y) cout<<#x<<
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    string s;
    cin>>s;
    string ans = "2018/01/" + s.substr(8,2);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstring>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <complex>
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define mset(a,i) memset(a,i,sizeof(a))
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define E 1e-6
#define INF 0x3f3f3f3f
void open(){freopen("data.txt","r",stdin);}
void out(){freopen("out.txt","w",stdout);}
const int maxn = 101010;
const int MOD = 1e9 + 7;

char maps[55][55];
int cnt[55][55];
int main()
{
    int h,w;
    scanf("%d%d",&h,&w);
    memset(cnt,0,sizeof(cnt));

    rep(i,1,h+1) scanf("%s",maps[i]+1);

    rep(i,1,h+1) rep(j,1,w+1){
        if(maps[i][j]=='#') cnt[i][j]=-1;
    }

    rep(i,1,h+1) rep(j,1,w+1){
        if(maps[i][j]=='#'){
            for(int dx = -1;dx<=1;dx++){
                for(int dy=-1;dy<=1;dy++){
                    int nx = i+dx;
                    int ny = j+dy;
                    if(nx<1||ny<1||nx>h||ny>w) continue;
                    if(cnt[nx][ny]!=-1) cnt[nx][ny]++;
                }
            }
        }
    }
    for(int i=1;i<=h;i++){
        for(int j=1;j<=w;j++){
            if(cnt[i][j]==-1) printf("#");
            else printf("%d",cnt[i][j]);
        }
        puts("");
    }
}


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

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

        Integer x = Integer.parseInt(st.nextToken());

        if (x<1200)
            System.out.println("ABC");
        else
            System.out.println("ARC");

    }


}


Measured memory_bytes: 21076
#include <iostream>
#include <vector>
#include <bitset>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
 
using namespace std;
typedef long long ll;
 
int main(){
  string s;
  cin >> s;

  if(s[2]==s[3] && s[4]==s[5]) cout << "Yes" << endl;
  else cout << "No" << endl;
    
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;

int main() {
	string a, b, c;

	cin >> a >> b >> c;
	auto ita = a.begin();
	auto itb = b.begin();
	auto itc = c.begin();

	char now = 'a';
	char winner;
	while (1) {
		if (now == 'a') {
			if (ita == a.end()) {
				winner = 'A';
				break;
			}
			now = *ita;
			ita++;
		} else if (now == 'b') {
			if (itb == b.end()) {
				winner = 'B';
				break;
			}
			now = *itb;
			itb++;
		} else {
			if (itc == c.end()) {
				winner = 'C';
				break;
			}
			now = *itc;
			itc++;
		}
	}

	cout << winner << endl;
	return 0;
}


Measured memory_bytes: 256
A, B, C = map(str, input().split())

D = 0
E = 0

if A == "5":
    D =D + 1

if A == "7":
    E =E + 1

if B == "5":
    D =D + 1

if B == "7":
    E =E + 1

if C == "5":
    D =D + 1

if C == "7":
    E =E + 1

if D == 2 and E == 1:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 8936
using System;
using System.Collections.Generic;
using System.Linq;

namespace GuessTheNumber
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ');

            int n = int.Parse(input[0]);
            int k = int.Parse(input[1]);
            int output = 0;
            bool loopOn = true;

            while(loopOn)
            {
                n /= k;
                output += 1;

                if(n <= 0)
                {
                    break;
                }
            }

            Console.WriteLine(output);

        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
//#define mod 10E9+7

int main(void) {
  int mod = 1e9+7;
  int n;
  cin >> n;
  vector<int> a(n); rep(i,n)cin>>a[i];
  sort(a.begin(),a.end());

  //あるか判定
  bool key = true;
  vector<int> b(n); rep(i,n) b[i] = abs(n+1-2*(i+1));
  sort(b.begin(),b.end());
  rep(i,n) {
    if(a[i] != b[i]) {key = false; break; }
  }
  if(key) {
    int r = n/2; long ans=1;
    rep(i,r) {
      ans *= 2;
      ans %= mod;
    }
    cout << ans << endl;
  }else {
    cout << 0 << endl;
  }
}

Measured memory_bytes: 3956
#include<iostream>

using namespace std;

int main(){
	int N; cin >> N;
	int A[100];
	for (int i= 0; i < N; i++){
		cin >> A[i];
	}
	int count = 0;
	for (int i = 0; i < N; i++){
		int min = A[i];
		int minj = i;
		bool flag = false;
		for ( int j = i+1; j < N; j++){
			if ( min > A[j]){
				min = A[j];
				minj = j;
				flag = true;
			}
		}
		if (flag){
			count++;
		}
		
		int tmp = A[i];
		A[i] = A[minj];
		A[minj] = tmp;
	}

	for ( int i = 0; i < N; i++){
		cout << A[i];
		if ( i != N-1){
			cout << " ";
		}
	}
	cout << endl;
	cout << count << endl;


return 0;
}

Measured memory_bytes: 3088
#include <iostream>
#include <vector>
#include <queue>
#include <string>
#include <climits>
#include <cstdio>
#include <set>

using namespace std;

const string note[] = {"C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"};

int main() {
    int N;
    cin >> N;
    //N = 1;

    while(N--) {
        int n, m;
        cin >> n >> m;

        vector<int> stairs;
        vector<int> music;
        for(int i = 0; i < n; ++i) {
            char buf[256];
            scanf(" %s", buf);
            for(int j = 0; j < 12; ++j) {
                if(note[j] == buf) {
                    stairs.push_back(j);
                    break;
                }
            }
        }
        for(int i = 0; i < m; ++i) {
            char buf[256];
            scanf(" %s", buf);
            for(int j = 0; j < 12; ++j) {
                if(note[j] == buf) {
                    music.push_back(j);
                    break;
                }
            }
        }

        bool ok = false;
        for(int start = n-2; start <= n-1; ++start) {
            if(start < 0) continue;
            int mpos = m-1;
            int pos = start;
            for(; mpos >= 0; --mpos) {
                if(stairs[pos] == music[mpos]) {
                    if(--pos < 0) goto next;
                }
                else if((stairs[pos]+1)%12 == music[mpos]) {
                    pos -= 2;
                    if(pos < 0) goto next;
                }
                else if((stairs[pos]+11)%12 == music[mpos]) {
                    pos += 1;
                    if(pos >= n) goto next;
                }
                else break;
            }
next:
            if(mpos <= 0 && pos == -1) {
                ok = true;
                break;
            }
        }
        cout << (ok ? "Yes" : "No") << endl;
    }
    return 0;
}

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

#define LL long long
#define hell 1000000007
#define PI acos(-1.0)



int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout << fixed << showpoint;
cout << setprecision(11);

LL n;cin>>n;

LL sv = 26, ct = 1, sm=26, tmp=0;
while(sm<n)
{
    sv = sv*26;
    tmp = sm;
    sm+=sv;

    ct+=1;
}
n--;
n-=tmp;
string ans;
sv = 1;
for(int i=0;i<ct-1;i++)
{
   sv*=26;
}
for(int i=0;i<ct;i++)
{
    for(int j=26;j>=1;j--)
    {
        if((j-1)*sv<=n)
        {
            char c = 'a'+j-1;
            ans.push_back(c);
            n-=(j-1)*sv;
            break;
        }
    }
    sv/=26;
}

cout<<ans;



return 0;
} 

Measured memory_bytes: 3632
#include<stdio.h>

#define N 200000
#define max(a,b) (((a)>(b))?(a):(b))
#define min(a,b) (((a)<(b))?(a):(b))
int main(){
  int n, i, minv, maxv;
  int A[N];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ) scanf("%d", &A[i]);
  
  maxv = -2000000000;
  minv = A[0];
  
  for (i= 1; i< n; i++){
    maxv = max(maxv, A[i]-minv);
    minv = min(minv, A[i]);
  }

  printf("%d\n",maxv);

  return 0;
}



Measured memory_bytes: 3464
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define pll pair<ll,ll>
#define pint pll
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  ll c=0;
  int q;
  cin >> q;
  priority_queue<ll> front;
  priority_queue<ll,vector<ll>,greater<ll>> back;
  ll frontSum=0,backSum=0;
  rep(_,q){
    int op;
    cin >> op;
    if(op==1){
      ll a,b;
      cin >> a >> b;
      c+=b;
      if(front.size()>back.size()){
        ll fr=front.top();
        if(fr<=a){
          back.push(a);
          backSum+=a;
        }else{
          frontSum-=front.top();
          front.pop();
          front.push(a);
          frontSum+=a;
          back.push(fr);
          backSum+=fr;
        }
      }else if(front.size()==0){
        front.push(a);
        frontSum+=a;
      }else{
        ll ba=back.top();
        if(ba>=a){
          front.push(a);
          frontSum+=a;
        }else{
          backSum-=back.top();
          back.pop();
          front.push(ba);
          frontSum+=ba;
          back.push(a);
          backSum+=a;
        }
      }
    }else{
      ll mid=front.top();
      ll x=(mid*(ll)front.size())-frontSum+backSum-(mid*(ll)back.size());
      cout << mid << ' ' << x+c << endl;
    }
  }
return 0;}

Measured memory_bytes: 3828
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(long long i=0;i<(long long)(n);i++)
#define N 200010


int main() {
	long long p[N];
	long long q[N];
	long long r[N];
	long long k;
	bool s[40];
	long long ss[40];
	long long n, a, b, c,d;
	long long x, y, z, ans;
	x = MOD - 2;
	f(i, 40) {
		if (x % 2 == 1)s[i] = true;
		else s[i] = false;
		x /= 2;
	}
	f(i, N) {
		ss[0] = i;
		f(j, 39)ss[j + 1] = (ss[j] * ss[j]) % MOD;
		r[i] = 1;
		f(j, 40)if (s[j])r[i] = (r[i] * ss[j]) % MOD;
	}
	scanf("%lld %lld %lld %lld", &n, &a, &b, &c);
	d = a + b;
	p[0] = 1;
	q[0] = 1;
	f(i, N-1) {
		p[i + 1] = (p[i] * a) % MOD;
		p[i + 1] = (p[i + 1] * r[d]) % MOD;
		q[i + 1] = (q[i] * b) % MOD;
		q[i + 1] = (q[i + 1] * r[d]) % MOD;
	}
	ans = 0;
	x = n;
	f(i, n) {
		y = (p[n - i] + q[n - i]) % MOD;
		y = (y*p[i]) % MOD;
		y = (y*q[i]) % MOD;
		y = (y*x) % MOD;
		ans = (ans + y) % MOD;
		if (i < (n - 1)) {
			x = (x*(n + i + 1)) % MOD;
			x = (x*r[i + 1]) % MOD;
		}
}
	ans = (ans * 100) % MOD;
	ans = (ans*r[d]) % MOD;
	printf("%lld\n", ans);


	return 0;
}

Measured memory_bytes: 4864
import itertools

def main():
    N,M = list(map(int,input().split(" ")))
    light_l = []
    switch_l = [i for i in range(1,N+1)]
    for _ in range(M):
        light_l.append( list(map(int,input().split(" ")))[1:])
    cheak_l = list(map(int,input().split(" ")))
    ans = 0

    for i in range(N+1):
        for switches in list(itertools.combinations(switch_l,i)):
            for j,light in enumerate(light_l):
                if(cheak_l[j] is not (len(set(switches)&set(light)))%2):
                    break
                if(j is len(light_l)-1):
                    ans += 1

    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <bits/stdc++.h> 
using namespace std; 
int N, A[3][3], b[10]; 
bool appear[3][3]; 
int main() { 
  for(int i = 0; i < 3; i++) { 
    for(int j = 0; j < 3; j++) cin >> A[i][j]; 
  } 
  cin >> N; 
  for(int i = 0; i < N; i++) cin >> b[i]; 
  for(int i = 0; i < N; i++) { 
    for(int j = 0; j < N; j++) { 
      appear[i][j] = false; 
      for(int k = 0; k < N; k++) { 
        if(A[i][j] == b[k]) appear[i][j] = true; 
      } 
    } 
  } 
  string ANS = "No"; 
  for(int i = 0; i < 3; i++) { 
    if(appear[i][0] and appear[i][1] and appear[i][2]) ANS = "Yes"; 
  } 
  for(int i = 0; i < 3; i++) { 
    if(appear[0][i] and appear[1][i] and appear[2][i]) ANS = "Yes"; 
  } 
  if(appear[0][0] and appear[1][1] and appear[2][2]) ANS = "Yes"; 
  if(appear[0][2] and appear[1][1] and appear[2][0]) ANS = "Yes"; 
  cout << ANS << endl; 
  return 0; 
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//F6編譯，右上三角形執行，ctrl+c強制停止執行  F5開啟exe
#define ll long long
#define maxn 200005
#define mod 998244353
using namespace std;

typedef pair<int, int> P;

int n;
deque<int> dq;

int main()
{
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        int now;
        scanf("%d", &now);
        bool ok = 0;
        int k;
        if (!dq.empty())
        {
            k = lower_bound(dq.begin(), dq.end(), now) - dq.begin();
            if (k - 1 >= 0)
                ok = 1;
        }
        if (!ok)
            dq.push_front(now);
        else
        {
            dq[k - 1] = now;
        }
    }
    printf("%d", dq.size());

    return 0;
}


Measured memory_bytes: 640
from sys import stdout
printn = lambda x: stdout.write(x)
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
DBG = True # and False
BIG = 999999999
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

n = inn()
for i in range(n+1):
    if int(i*1.08)==n:
        print(i)
        exit()
print(':(')


Measured memory_bytes: 39408
#pragma GCC target ("avx2")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("O3")
#include "bits/stdc++.h"
#include <unordered_set>
#include <unordered_map>
#include <random>
using namespace std;
typedef long long ll;
const ll MOD = 1'000'000'007LL; /*998'244'353LL;*/
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
const int dx[4]={ 1,0,-1,0 };
const int dy[4]={ 0,1,0,-1 };

int N;
ll L[100];

signed main(){
    cin >> N;
    rep(i, N) cin >> L[i];
    sort(L, L+N);

    int ans = 0;
    rep(i, N){
        rep(j, N){
            if(j <= i) continue;
            rep(k, N){
                if(k <= j) continue;
                if(L[i] == L[j]) continue;
                if(L[i] == L[k]) continue;
                if(L[j] == L[k]) continue;
                if(L[k] < L[i]+L[j]){
                    //cout << i << " " << j << " " << k << endl;
                    ans++;
                }
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3600
import java.util.*;
 
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    Set<Character> ODD_STEP = new HashSet<Character>();
    Set<Character> EVEN_STEP = new HashSet<Character>();
    String ODD_STEP_STR = "RUD";
    String EVEN_STEP_STR = "LUD";

    for(int i=0; i<3; i++){
        ODD_STEP.add(ODD_STEP_STR.charAt(i));
        EVEN_STEP.add(EVEN_STEP_STR.charAt(i));
    }


    
    int current_step = 0;
    String steps = sc.next();
    // "RUDLUDR"
    // System.out.println(steps);
    for(int i=0; i<steps.length();i++){
      char step = steps.charAt(i);
    //   System.out.println(step);
      if((i+1) % 2 == 0 && !EVEN_STEP.contains(step)){
        // System.out.println("EVEN but not " + step);
        break;
      }else if((i+1) % 2 != 0 && !ODD_STEP.contains(step)){
        // System.out.println("ODD but not " + step);
        break;
      }
      current_step++;
    }
    
    if(current_step == steps.length()){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll, ll> P;
using VP = vector<P>;
using VVP = vector<VP>;
using VI = vector<ll>;
using VVI = vector<VI>;
using VVVI = vector<VVI>;
const int inf = 1e9 + 7;
const ll INF = 1LL << 61;
const ll mod = 1e9 + 7;

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

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int i, j;
    int n;
    cin >> n;
    int a[n];
    VI v(101010,0);
    for(i=0;i<n;i++) cin >> a[i];
    for(i=0;i<n;i++) v[a[i]]++;
    ll gen = 0; 
    ll t = 0;
    for(i=0;i<101010;i++){
        if(v[i]>0){
             gen += v[i]-1;
             // chmax(t,v[i]-1);
        }
    }
    cout<<n-max(2*t,(gen+1)/2*2)<<endl;
}

Measured memory_bytes: 4516
//---------------------------------------------------------------
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#include<algorithm>
//---------------------------------------------------------------
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define SIZE 100005
#define INF 1e18
#define all(x) x.begin(),x.end()
#define fi first
#define se second
#define vec vector
using pint = pair<int,int>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
//---------------------------------------------------------------
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const double pi = acos(-1);
const int mod = 1000000007;
struct mint {
    int64_t x;
    mint(int64_t x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {if ((x += a.x) >= mod) x -= mod;return *this;}
    mint& operator-=(const mint a) {if ((x += mod-a.x) >= mod) x -= mod;return *this;}
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(int64_t t) const {if (!t) return 1;mint a = pow(t>>1);a *= a;if (t&1) a *= *this;return a;}
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) {return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
//---------------------------------------------------------------

//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓


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

    string s;
    string t;
    cin>>s>>t;
    vec<int> sc(26,-1),tc(26,-1);
    bool ok = 1;
    rep(i,t.size()){
        int S = s[i] - 'a';
        int T = t[i] - 'a';
        if(sc[S] != -1 || tc[T] != -1)if(sc[S] != T || tc[T] != S) ok = 0;
        sc[S] = T; tc[T] = S;
    }

    if(ok) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 3756
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
using namespace std;

int main() {
    int n;
    int m = 0;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        if(a[i] < 0) m += 1;
        a[i] = abs(a[i]);
    }

    sort(a.begin(), a.end());
    long long sum = 0;
    for(int i = 0; i < n; i++) {
        sum += a[i];
    }
    if(m % 2 == 1) {
        long long ans = sum - 2 * a[0];
        cout << ans << endl;
    } else {
        long long ans = sum;
        cout << ans << endl;
    }
}

Measured memory_bytes: 640
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {

    public static void main(String[] args) {
        FastScanner scanner = new FastScanner();
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int c = scanner.nextInt();

        boolean i = (a + b == c);
        boolean j = (a + c == b);
        boolean k = (b + c == a);


        if (i || j || k) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }


    }


    /// self liblary
    public static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;

        private boolean hasNextByte() {
            if (ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) {
                    return false;
                }
            }
            return true;
        }

        private int readByte() {
            if (hasNextByte()) return buffer[ptr++];
            else return -1;
        }

        private static boolean isPrintableChar(int c) {
            return 33 <= c && c <= 126;
        }

        public boolean hasNext() {
            while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
            return hasNextByte();
        }

        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while (isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }

        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while (true) {
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                } else if (b == -1 || !isPrintableChar(b)) {
                    return minus ? -n : n;
                } else {
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }

        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
            return (int) nl;
        }

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

}


Measured memory_bytes: 8020
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
using namespace std;
#define int long long int

signed main(){
    double l;
    cin >> l;
    double l3 = l/3.000000;
    double r = l3 * l3 * l3;
    cout << fixed;
    cout << setprecision(10) << r << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FOR(i,n) for(int i=0;i<n;i++)
#define SFOR(i,a,b) for(int i=a;i<b;i++)
#define F first
#define S second
#define INF INT_MAX
#define endl '\n'
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
int main(){
   cin.tie(0);
   ios::sync_with_stdio(false);
   int a,b,ans=0;
   float t,cnt=1;
   cin>>a>>b>>t;
   t+=0.5;
   for(cnt;cnt<=t;cnt+=1){
     if((int)cnt%a==0) ans+=b;
   }
   cout<<ans<<endl;
   return 0;
}


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

int main(){
  int n,x,ans,sumD;
  cin >> n >> x;
  ans = n;sumD = 0;
  vector<int> m(n);
  for(int i = 0;i < n;i++){
    cin >> m.at(i);
    sumD += m.at(i);
  }
  x -= sumD;
  sort(m.begin(),m.end());
  while(x >= 0){
    x -= m.at(0);
    if(x >= 0){
    ans++;
    }
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
X,K,D = gets.strip.split.map(&:to_i)
x = X
num = []
if X-K*D>=0 then
  puts (X-K*D).abs
elsif X+K*D<=0 then
  puts (X+K*D).abs
else
  if X>=0 then
    s = (X-K*D).abs.to_f/(2*D)
    sa = s.floor
    sb = s.ceil
    puts [(X-K*D+2*D*sa).abs,(X-K*D+2*D*sb).abs].min
  else
    t = (X+K*D).abs.to_f/(2*D)
    ta = t.floor
    tb = t.ceil
    puts [(X+K*D-2*D*ta).abs,(X+K*D-2*D*tb).abs].min
  end
end

Measured memory_bytes: 14248
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <map>
#include <set>
#include <bitset>
 
using namespace std;
 
#define IL inline
#define RE register
#define DB double
#define RT return
#define LL long long
#define INF 1e9+10
#define MAXN 1001000
#define MOD 1000000007
#define MAXM 1001000
#define FOR(i,a,b) for(RE int i=(a); i<=(b); i++)
#define FOR2(i,a,b) for(RE int i=(a); i>=(b); i--)
#define reset(a) memset(a,0,sizeof(a))
#define reset2(a) memset(a,50,sizeof(a)) 
#define lson(x) x<<1
#define rson(x) x<<1|1
#define pq priority_queue
#define P pair<int,int>
 
IL int read()
{
	RE int x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9'){x=x*10+(c-'0');c=getchar();}
	RT x*f;
} 
int main()
{
	RE int a=read(),b=read(),c=read();
	cout<<max(0,c-(a-b));
	RT 0;	
} 

Measured memory_bytes: 256
N = int(input())
a = [0]*N
b = [0]*N
c = [0]*N
for i in range(N):
    a[i],b[i],c[i] = map(int,input().split())

inf = -float('inf')
dp = [[inf] * N for _ in range(3)]
dp[0][0] = a[0]
dp[1][0] = b[0]
dp[2][0] = c[0]

for i in range(1,N):
    dp[0][i] = max(dp[1][i-1] + a[i],dp[2][i-1] + a[i])
    dp[1][i] = max(dp[0][i-1] + b[i],dp[2][i-1] + b[i])
    dp[2][i] = max(dp[0][i-1] + c[i],dp[1][i-1] + c[i])

print(max(dp[0][N-1],dp[1][N-1],dp[2][N-1]))


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

int main(void){
    long long N;
    long long ans;

    long long X, Y;

    cin >> N;

    ans = 0;
    for(int i = 1; i < N + 1; ++i){
        X =  i;
        Y = N / X;
        ans += Y*(Y + 1)*X / 2;
    }

    cout << ans << endl;
}

Measured memory_bytes: 3592
var
 s,sx:ansistring;
 i:longint;
begin
 readln(s);
 for i:=1 to length(s) do
  if s[i]='1' then sx:=sx+'1'
   else if s[i]='0' then sx:=sx+'0'
    else if s[i]='B' then 
     if sx<>'' then delete(sx,length(sx),1);
 writeln(sx);
end.

Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int _=2e5+5;
inline int read()
{
	char ch='!';int z=1,num=0;
	while(ch!='-'&&(ch<'0'||ch>'9'))ch=getchar();
	if(ch=='-')z=-1,ch=getchar();
	while(ch<='9'&&ch>='0')num=(num<<3)+(num<<1)+ch-'0',ch=getchar();
	return z*num;
}
int n,m,zhan[_],top;
char s[_];
struct ed{int to,next;}e[_<<1];
int cnt,head[_];
void link(int u,int v){e[++cnt]=(ed){v,head[u]};head[u]=cnt;}
bool del[_];
bool check(int u)
{
	bool f1=0,f2=0;
	for(int i=head[u];i;i=e[i].next)
		if(!del[e[i].to])
		{
			if(s[e[i].to]=='A')f1=1;
			else f2=1;
		}
	return f1&f2;
}
int main()
{
	n=read();m=read();
	scanf("%s",s+1);
	while(m--)
	{
		int u=read(),v=read();
		link(u,v);link(v,u);
	}
	for(int i=1;i<=n;++i)
	{
		if(check(i))continue;
		zhan[++top]=i;
		while(top)
		{
			int u=zhan[top--];
			if(del[u])continue;
			del[u]=1;
			for(int j=head[u];j;j=e[j].next)
				if(!del[e[j].to]&&!check(e[j].to))zhan[++top]=e[j].to;
		}
	}
	bool f=0;
	for(int i=1;i<=n;++i)if(!del[i]){f=1;break;}
	f?puts("Yes"):puts("No");
	return 0;
}


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

int main() {
  ll a,b,x;
  cin >> a >> b >> x;
  if (a==0) cout << b/x + 1 << endl;
  else cout << b/x - (a-1)/x << endl;
  return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
	"unsafe"
)

func main() {
	N := sc.nextInt()
	fmt.Println(int(math.Pow(float64(N), float64(3))))
}

var (
	sc scanner
)

func init() {
	sc = scanner{
		buf: make([]string, 0, 0),
		cur: 0,
		r:   bufio.NewReader(os.Stdin),
	}
}

type scanner struct {
	buf []string
	cur int
	r   *bufio.Reader
}

func (s *scanner) readln() {
	rbuf := make([]byte, 0, 0)
	for {
		line, prefix, err := s.r.ReadLine()
		if err != nil {
			panic(err)
		}
		rbuf = append(rbuf, line...)
		if prefix == false {
			break
		}
	}
	s.cur = 0
	s.buf = strings.Split(*(*string)(unsafe.Pointer(&rbuf)), " ")
}
func (s *scanner) isFull() bool {
	if s.cur == len(s.buf) {
		return true
	}
	return false
}
func (s *scanner) resetCur() {
	s.cur = 0
}
func (s *scanner) next() string {
	if s.cur == 0 {
		s.readln()
	}
	res := s.buf[s.cur]
	s.cur++
	if s.isFull() {
		s.resetCur()
	}
	return res
}
func (s *scanner) nexts() []string {
	s.readln()
	s.resetCur()
	return s.buf
}
func (s *scanner) nextInt() int {
	if s.cur == 0 {
		s.readln()
	}
	res, _ := strconv.Atoi(s.buf[s.cur])
	s.cur++
	if s.isFull() {
		s.resetCur()
	}
	return res
}
func (s *scanner) nextInts() []int {
	s.readln()
	res := make([]int, len(s.buf))
	for i := range s.buf {
		res[i], _ = strconv.Atoi(s.buf[i])
	}
	s.resetCur()
	return res
}
func (s *scanner) nextFloat() float64 {
	if s.cur == 0 {
		s.readln()
	}
	res, _ := strconv.ParseFloat(s.buf[s.cur],
		64)
	s.cur++
	if s.isFull() {
		s.resetCur()
	}
	return res
}
func (s *scanner) nextFloats() []float64 {
	s.readln()
	res := make([]float64, len(s.buf))
	for i := range s.buf {
		res[i], _ = strconv.ParseFloat(s.buf[i],
			64)
	}
	s.resetCur()
	return res
}
func digits(x int) int {
	return len(strconv.Itoa(x))
}
func powInt(x, p int) (result int) {
	result = 1
	for i := 0; i < p; i++ {
		result *= x
	}
	return
}
func max(x, y int) int {
	return int(math.Max(float64(x), float64(y)))
}
func min(x, y int) int {
	return int(math.Min(float64(x), float64(y)))
}
func abs(x int) int {
	return int(math.Abs(float64(x)))
}
func varDump(value ...interface{}) {
	for _, v := range value {
		fmt.Fprintf(os.Stderr, "%#v\n", v)
	}
}
func yes() {
	fmt.Println("Yes")
}
func no() {
	fmt.Println("No")
}

// Pair a
type Pair struct {
	first  int
	second int
}

// Queue a
type Queue struct {
	v []Pair
}

// Push for queue
func (q *Queue) Push(v Pair) {
	q.v = append(q.v, v)
}

// Pop for queue
func (q *Queue) Pop() Pair {
	r := q.v[0]
	q.v = q.v[1:]
	return r
}

// Front for queue
func (q Queue) Front() Pair {
	return q.v[0]
}

// Empty return true if empty
func (q Queue) Empty() bool {
	return len(q.v) == 0
}


Measured memory_bytes: 640
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstring>
#include <cstdio>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map> //pair is also included in this library
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define REP(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
#define fst first
#define snd second
#define MP make_pair //incase c++11 or later is not available

using namespace std;

typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//prefer define statement
//for reason that const int ver. of INF will raise a silly warning (unused variable)
#define INF (INT_MAX/3)
#define LIM_INF (INT_MAX)
//const int INF = INT_MAX/3;

/*------------------------------------------------------------------------------*/

int turn(const vector<VI>& o, int t, int r, int c){
  int res = 0;
  VI ov(r, 0);
  for(int i = t, cnt = 0; i != 0 && cnt < r; i = i >> 1, cnt++){
    if(i & 0b1){
      ov[cnt] = 1;
    }
  }
  REP(i, 0, c){
    int z = 0;
    REP(j, 0, r){
      if((o[i][j] + ov[j]) % 2 == 0){
        z++;
      }
    }
    res += (z > (r / 2) ? z : r - z);
  }
  return res;
}

int main(){
  while(1){
    int r, c;
    scanf("%d %d%*c", &r, &c);
    if(r == 0 && c == 0){
      break;
    }

    vector<VI> osb(c, VI(r));
    REP(i, 0, r){
      REP(j, 0, c){
        scanf("%d ", &osb[j][i]);
      }
    }

    int ma = -1;
    REP(i, 0, pow(2,r)){
      ma = max(ma, turn(osb, i, r, c));
    }
    printf("%d\n", ma);
  }
  return 0;
}

Measured memory_bytes: 3792
// C - ID

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

map<int, vector<int>> Y_list;
map<pair<int, int>, int> PY_to_idx;

int main() {
	int N, M;
	cin >> N >> M;

	for (int P=1; P<=N; P++) {
		Y_list[P] = vector<int>();
	}

	for (int i=0; i<M; i++) {
		int P, Y;
		cin >> P >> Y;
		Y_list[P].push_back(Y);
		PY_to_idx[make_pair(P, Y)] = i;
	}

	vector<string> ans(M);
	for (int P=1; P<=N; P++) {
		sort(Y_list[P].begin(), Y_list[P].end());

		for (int i=0; i<Y_list[P].size(); i++) {
			int Y = Y_list[P][i];
			char P_f[10], I_f[10];
			sprintf(P_f, "%06d", P);
			sprintf(I_f, "%06d", i+1);
			ans[PY_to_idx[make_pair(P, Y)]] = (string)P_f + (string)I_f;
		}
	}

	for (string a : ans) {
		cout << a << endl;
	}

	return 0;
}

Measured memory_bytes: 23352
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<string>

using namespace std;
int main(){
int R,P,Q;
cin >> P>>Q>>R;
int ans=1000;
ans=min(ans,P+Q);
ans=min(ans,P+R);
ans=min(ans,Q+R);
cout <<ans <<endl;


 return 0;
}

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

using namespace std;

int main()
{
	int n, a, b;
	cin >> n >> a >> b;
	char c;
	int ca = 0, cb = 0;
	for (int i = 0; i < n; i++)
	{
		cin >> c;
		if (c == 'c')
		{
			cout << "No\n";
		}
		else if (c == 'a')
		{
			if (ca + cb < a + b)
			{
				ca++;
				cout << "Yes\n";
			}
			else
			{
				cout << "No\n";
			}
		}
		else if (c == 'b')
		{
			if (ca + cb < a + b && cb < b)
			{
				cout << "Yes\n";
				cb++;
			}
			else
			{
				cout << "No\n";
			}
		}
	}
	return 0;
}



Measured memory_bytes: 640