akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
ll MOD=1000000007;
ll mod=998244353;
int inf=1000000000;
ll INF=10000000000000000;
int main(){
    string s;
    cin >> s;
    ll h=s.size();
    vector<vector<ll>> a(2,vector<ll>(h,0));
    a.at(0).at(0)=1;a.at(1).at(0)=2;
    for (int i=1;i<h;i++){
        (a.at(0).at(i)+=a.at(0).at(i-1)*3)%=MOD;
        if (s.at(i)=='1'){
            (a.at(0).at(i)+=a.at(1).at(i-1))%=MOD;
            (a.at(1).at(i)+=a.at(1).at(i-1)*2)%=MOD;
        }
        else (a.at(1).at(i)+=a.at(1).at(i-1))%=MOD;
    }
    cout << (a.at(0).at(h-1)+a.at(1).at(h-1))%MOD << endl;
}

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

using namespace std;

#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define cl(x,v) memset((x), (v), sizeof(x))
#define db(x) cerr << #x << " == " << x << endl
#define dbs(x) cerr << x << endl
#define _ << ", " <<

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<int, pii> piii;
typedef pair<ll,ll> pll;
typedef pair<ll, pll> plll;
typedef vector<int> vi;
typedef vector <vi> vii;

const ld EPS = 1e-9, PI = acos(-1.);
const ll LINF = 0x3f3f3f3f3f3f3f3f;
const int INF = 0x3f3f3f3f, MOD = 1e9+7;
const int N = 1e5+5, M = 1e6+5;

ll n, s, w[N], v[N], wknap[M];

void call_dp(){};

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // memset
    for(int i=0;i<M;i++) wknap[i] = LINF;
    // input
    cin >> n >> s;
    for(int i=0;i<n;i++){
        cin >> w[i] >> v[i];
    }
    //itera por cada item e vai marcando quais valores a minha bolsa consegue atingir usando aquele item
    for(int i=0;i<n;i++){
        //percorre possiveis valores
        for(int j=N;j>=0;j--){
            wknap[j + v[i]] = min(w[i] + wknap[j], wknap[j+v[i]]);
            if(j == v[i]) wknap[v[i]] = min(w[i],wknap[v[i]]); 
        }
    }
    for(int j=N;j>=0;j--){
        if(wknap[j] <= s){
            cout << j << "\n";
            break;
        }
    }
    return 0;
}

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

int main(){
	int n,s,a;
	while(cin >> n >> s,n || s){
		int r[n];
		a = 0;
		for(int i = 0;i < n;++i){
			cin >> r[i];
		}
		sort(r,r+n,greater<int>());
		for(int i = 0;i < n;++i){
			if(r[i] > s) a += (n - (i + 1));
			else
				for(int j = i + 1;j < n;++j){
					if(r[i] + r[j] <= s) break;
					else ++a;
				}
		}
		cout << a << endl;
	}
	return 0;
}

Measured memory_bytes: 904
#include <vector>
#include <iostream>
using namespace std;
int main() {
    int n; cin >> n;
    vector<int> primes({2,3,5,7,11,13,17,19,23,29,31,37,41,43,47});
    int dp[100][100] = {};
    dp[0][1] = 1;
    for (int i = 0; i < primes.size(); i++) {
        int limit = 0, tmp = n;
        while (tmp > 0) { limit += tmp/primes[i]; tmp /= primes[i]; }
        for (int j = 0; j <= limit; j++) {
            if (75 % (j+1) != 0) continue;
            for (int d = 1; d <= 75/(j+1); d++) {
                dp[i+1][d*(j+1)] += dp[i][d];
            }
        }
    }
    cout << dp[primes.size()][75] << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;


class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.next());
    int ans[] = new int[n];
    int middle = n/2;
    ans[middle] = Integer.parseInt(sc.next());
    int diff = n%2 == 0? -1: 1;
    int j = 1;
	
    for(int i = 1; i < n; i++){
      ans[middle + j*diff] = Integer.parseInt(sc.next());
      diff *= -1;
      if(i > 1 && i % 2 == 0) j++;
    }
    
    StringBuilder line = new StringBuilder();
    for(int i = 0; i < n; i++) line.append(Integer.toString(ans[i]) + " ");
	System.out.println(line);
  } 
  
}

Measured memory_bytes: 65268
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

//// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\b.txt"

struct aa {
	int y;
	int x;
	int time;
};

int main() {
	while (1) {
		int N; cin >> N;
		if (!N)break;
		vector<vector<int>>walls(N, vector<int>(2));
		vector<vector<int>>memo(N, vector<int>(2, 10000));
		for (int y = 0; y < 2; ++y) {
			for (int i = 0; i < N; ++i) {
				cin >> walls[i][y];
			}
		}
		queue<aa>que;
		memo[0][0] = 0;
		que.push(aa{ 0,0,0 });
		que.push(aa{ 0,1,0 });
		memo[0][1] = 0;
		int ans = -1;
		while (!que.empty()) {
			auto atop(que.front());
			que.pop();
			if (atop.y == N - 1) {
				ans = atop.time;
				break;
			}
			while (walls[atop.y][atop.x] == 1 && walls[atop.y+1][atop.x] == 1) {
				atop.y++;
				if (atop.y == N - 1) {
					ans = atop.time;
					break;
				}
			}
			if (atop.y == N - 1) {
				ans = atop.time;
				break;
			}
			for (int dy = 0; dy <= 2; ++dy) {
				int ny = atop.y + dy;
				if (ny >= N)continue;
				int nx = !atop.x;
				while (walls[ny][nx] == 2) {
					ny--;
				}
				if (memo[ny][nx]>atop.time + 1) {
					memo[ny][nx] = atop.time + 1;
					que.push(aa{ ny,nx,atop.time + 1 });
				}
			}

		}
		if (ans == -1)cout << "NA" << endl;
		else cout << ans << endl;
		
	}
	return 0;
}

Measured memory_bytes: 3156
//C
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

//C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

//Others
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[8] = { -1,0,1,-1,1,-1,0,1 };
const int dy[8] = { 1,1,1,0,0,-1,-1,-1 };


//LOVE NyantakoGG	https://www.youtube.com/channel/UC6XdFs8T6Ei54O0FYl3PVVA


using namespace std;



int main() {
	int N, L;
	cin >> N >> L;
	vector<int>data(N);
	int af, be, check, ans;
	af = be = 0;
	check = INT_MAX;
	for (int i = 0; i < N; i++) {
		data[i] = L + i;
		be += data[i];
	}
	for (int i = 0; i < N; i++) {
		af = 0;
		for (int j = 0; j < N; j++) {
			if (i != j) {
				af += data[j];
			}
		}
		if (check > abs(be - af)) {
			check = abs(be - af);
			ans = af;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;

public class Program
{

    public void Proc()
    {
		int[] inpt = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();
		this.MaxNum = inpt[0];
		this.TreeNodes = new TreeNode[this.MaxNum];

		int roadCount = inpt[1];

		this.Items = Reader.ReadLine().Split(' ').Select(a => int.Parse(a) - 1).ToArray();
		for (int i = 0; i < roadCount; i++) {
			inpt = Reader.ReadLine().Split(' ').Select(a => int.Parse(a) - 1).ToArray();
			inpt.ToList().ForEach(a =>
			{
				if(TreeNodes[a] == null) {
					this.TreeNodes[a] = new TreeNode(a);
				}
			});
			if(TreeNodes[inpt[0]].GetRoot().ID == TreeNodes[inpt[1]].GetRoot().ID) {
				continue;
			}
			TreeNodes[inpt[0]].GetRoot().Add(this.TreeNodes[inpt[1]].GetRoot());
		}

		int[] Pos = new int[this.MaxNum];
		for (int i = 0; i < this.MaxNum; i++) {
			Pos[Items[i]] = i;
		}

		int ans = 0;
		for (int i = 0; i < Items.Length; i++) {
			if(Items[i] == i) {
				ans++;
				continue;
			}
			int idx1 = Pos[i];
			int idx2 = i;

			int num1 = i;
			int num2 = Items[idx2];

			if(TreeNodes[idx1] == null || TreeNodes[idx2] == null) {
				continue;
			}
			if(TreeNodes[idx1].GetRoot().ID == TreeNodes[idx2].GetRoot().ID) {
				ans++;
				Pos[num1] = idx2;
				Pos[num2] = idx1;
				Items[idx2] = num1;
				Items[idx1] = num2;
			}
		}
		Console.WriteLine(ans);
	}

	private int[] Items;

	private int MaxNum;
	private TreeNode[] TreeNodes;

	private class TreeNode {
		private TreeNode Root;
		public int ID;
		private List<TreeNode> Items = new List<TreeNode>();
		public TreeNode(int n) {
			this.ID = n;
			this.Root = this;
		}

		public void Add(TreeNode sub) {
			this.Items.Add(sub);
			sub.Root = this.GetRoot();
		}

		public TreeNode GetRoot() {
			if(this.Root == this.Root.Root) {
				return this.Root;
			}
			this.Root = this.Root.GetRoot();
			return this.Root;
		}
	}

    public class Reader
    {
        static StringReader sr;
        public static bool IsDebug = false;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (sr == null)
                {
                    sr = new StringReader(InputText.Trim());
                }
                return sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }
        private static string InputText = @"


10 8
5 3 6 8 7 10 9 1 2 4
3 1
4 1
5 9
2 5
6 5
3 5
8 9
7 9


";
    }

    public static void Main(string[] args)
    {
#if DEBUG
        Reader.IsDebug = true;
#endif
        Program prg = new Program();
        prg.Proc();
    }
}

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

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define pb push_back
#pragma GCC optimize ("-O3")

using namespace std;

// #define DEBUG_IS_VALID

#ifdef DEBUG_IS_VALID
#define DEB 1 
#else
#define DEB 0
#endif
#define DUMPOUT cout
#define dump(...) if(DEB) DUMPOUT<<"  "<<#__VA_ARGS__<<" :["<<__LINE__<<":"<<__FUNCTION__<<"]"<<endl<<"    "; if(DEB) dump_func(__VA_ARGS__)
template<typename T1,typename T2>ostream& operator << (ostream& os, pair<T1,T2> p){cout << "(" << p.first << ", " << p.second << ")"; return os;}
template<typename T>ostream& operator << (ostream& os, vector<T>& vec) { os << "{"; for (int i = 0; i<vec.size(); i++) os << vec[i] << (i + 1 == vec.size() ? "" : ", "); os << "}"; return os; }
template<typename T>ostream& operator << (ostream& os, set<T>& st){for(auto itr = st.begin(); itr != st.end(); itr++) cout << *itr << (next(itr)!=st.end() ? ", " : ""); cout << "}"; return os;}
template<typename T1,typename T2>ostream& operator << (ostream& os, map<T1,T2> mp){cout << "{"; for(auto itr = mp.begin(); itr != mp.end(); itr++) cout << "(" << (itr->first) << ", " << (itr->second) << ")" << (next(itr)!=mp.end() ? "," : ""); cout << "}"; return os; }

void dump_func(){DUMPOUT << endl;}
template <class Head, class... Tail>void dump_func(Head&& head, Tail&&... tail){ DUMPOUT << head; if (sizeof...(Tail) == 0) { DUMPOUT << " "; } else { DUMPOUT << ", "; } dump_func(std::move(tail)...);}
template<class T> inline bool chmax(T& a,T const& b){if(a>=b) return false; a=b; return true;}
template<class T> inline bool chmin(T& a,T const& b){if(a<=b) return false; a=b; return true;}
void _main();
int main(){ cin.tie(0); ios::sync_with_stdio(false); _main(); return 0;}

using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

const int mod=1e9+7,INF=1<<29;
const double EPS=1e-12,PI=3.1415926535897932384626;
const ll lmod = 1e9+7,LINF=1LL<<59; 

map<ll, ll> enumpr(ll n) {
    map<ll, ll> V;
    for (ll i = 2; 1LL * i*i <= n; i++) while (n%i == 0) V[i]++, n /= i;
    if (n>1) V[n]++;
    return V;
}

void _main() {
  ll N,P;
  cin >> N >> P ;
  auto mp = enumpr(P);
  ll ans = 1;
  dump(mp);
  for(auto p:mp){
    if(p.second>=N){
      ll t = 1LL;
      rep(j,ll(p.second)/N) t *= ll(p.first);
      ans *= t;
    }
  }
  cout << ans << endl;
}

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


int main() {
    int D;
    cin >> D;
    int n = 25 - D;
    cout << "Christmas";
    rep(i, n) cout << " " << "Eve";
    cout << endl;
}


Measured memory_bytes: 256
n,m=map(int,input().split())
d=[]
for i in range(1,int(m**0.5)+1):
  if m%i==0:
    d.append(i)
    d.append(m//i)
d.sort(reverse=True)
for i in d:
  if i*n<=m:
    print(i)
    exit()

Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC057A
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b, c;

            var word = Console.ReadLine().Split(' ');

            a = int.Parse(word[0]);
            b = int.Parse(word[1]);

            c = a + b;

            if (c < 24)
                Console.WriteLine(c);
            else
                Console.WriteLine(c - 24);

            Console.ReadKey();


        }
    }
}



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

#define min(a, b) ((a) > (b) ? (b) : (a))
#define max(a, b) ((a) > (b) ? (a) : (b))

long double kaijo(long double x) {
  long double y = 1;
  for(long double i = x;i > 0;i--) y *= i;
  return y;
}

long double combination(long double a) {
  return kaijo(a) / (2 * kaijo(a - 2));
}

long double kazu(long double a) {
  if(a > 2) {
    return combination(a);
  } else if(a == 2) {
    return 1;
  } else {
    return 0;
  }
}

int main(void) {
  long double i, j, k, l;
  int N, M;
  std::cin >> N >> M;
  printf("%llu\n", (unsigned long long)(kazu(N) + kazu(M) + 1E-14));
  return 0;
}


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

/*
TASK: cardgame
LANG: JAVA
 */
class Main {
    static int n , m , k;
    public static void main(String[] args) throws IOException {
        FastScanner in = new FastScanner(System.in); //new FileInputStream(new File("cardgame.in")));
        //PrintWriter out = new PrintWriter(new File("cardgame.out"));
        n = in.nextInt();
        m = in.nextInt();
        k = in.nextInt();
        for(int i = 0;i <= n; i++){
            for(int j = 0; j <= m; j++){
                if(i*(m-j) + j*(n-i) == k){
                    System.out.println("Yes");
                    return;
                }
            }
        }
        System.out.println("No");

    }

    private static class FastScanner {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public FastScanner(InputStream stream) {
            this.stream = stream;
        }

        int read() {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) return -1;
            }
            return buf[curChar++];
        }

        boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        boolean isEndline(int c) {
            return c == '\n' || c == '\r' || c == -1;
        }

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

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

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

        public String next() {
            int c = read();
            while (isSpaceChar(c)) c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public String nextLine() {
            int c = read();
            while (isEndline(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isEndline(c));
            return res.toString();
        }
    }
}


Measured memory_bytes: 22740
#include <stdio.h>

void time_conversion(int S, int *h, int *m, int *n)
{
    *h = S / (60 * 60);
    *m = (S - *h * 60 * 60) / 60;
    *n = S - (*h * 60 * 60 + *m * 60);
}

int main(void)
{
    int S, h, m, n;

    scanf("%d", &S);
    time_conversion(S, &h, &m, &n);
    printf("%d:%d:%d\n", h, m, n);

    return 0;
}



Measured memory_bytes: 2760
#ifdef __APPLE__
#include <iostream>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <iomanip>
#else
#include <bits/stdc++.h>
#endif

using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define tc(t) for (int tc=1; tc<=t; tc++)
typedef vector<int> VI;
typedef vector<long long int> VLLI;
typedef vector<pair<int, int> > VPI;
typedef long long ll;
typedef pair<int,int> PII;
typedef pair<ll, ll> PLL;
mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {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;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll modInverse (ll a) {ll p = mod - 2; return powmod(a, p);}
// head

int main() {
    int n;
    cin >> n;
    cout << setprecision(15) << (44*n)/(double)7.0 << "\n";
}



Measured memory_bytes: 3760
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef tree<pair<int,int> ,null_type,less<pair<int,int>>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;
typedef long long ll;
const int N = 1e5+10 , OO = 0x3f3f3f3f , mod = 1e9 + 7;

#define PI acos(-1) 
#define clr(arr,val) memset(arr , val , sizeof (arr))
#define loop(i,n) for(int i = 0;i < int(n);i++)
#define rloop(i,n) for(int i = int(n)-1;i >= 0;i--)
#define xloop(i,a,b) for(int i = int(a);i <= int(b);i++)
#define range(vec) for(auto &x : vec) cin >> x;
#define ALL(v) ((v).begin()) , ((v).end())
#define SZ(v)  ((int)((v).size()))
int dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
//int dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
//int dx[6]={2,1,-1,-2,-1,1};int dy[6]={0,1,1,0,-1,-1}; //Hexagonal Direction
 
char grid[1005][1005];
int n , m ;
int dp[1005][1005];

int main()
{
  //ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  
  scanf("%d %d", &n,  &m);
  for(int i = 0 ; i < n ; ++i)
    scanf("%s", grid[i]);

  memset(dp , 0 , sizeof dp);
  dp[0][0] = 1;
  for(int i = 0 ; i < n ; ++i){
    for(int j = 0 ; j < m ; ++j){
      if(i == 0 && j == 0)
        continue;
      if(grid[i][j] == '.')
        dp[i][j] = (dp[max(i-1 , 0)][j] + dp[i][max(j-1 , 0)]) % mod;
    }
  }
  printf("%d\n", dp[n-1][m-1]);

  return 0;
}

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

using namespace std;
#define ll long long
const int mod=1e9+7;
const int N=2e5+100;

ll qpow(ll x,ll n)
{
    ll sum=1;
    while(n){
       if(n&1) sum=sum*x%mod;
       x=x*x%mod;
       n>>=1;
    }
    return sum;
}
int main()
{
    ios::sync_with_stdio(0);

    ll n,x,t;
    cin>>n>>x>>t;
    ll k=n/x;
    if(n%x) k++;
    cout<<k*t<<endl;
    return 0;
}



Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define REP(i, a, n) for (int i = (a); i < (int)(n); ++i)
#define REPC(i, a, n) for (int i = (a); i <= (int)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init)                                          \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T> using VEC = std::vector<T>;
template <class T> using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail> void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T> ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec)
    os << v << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}

int main() {
  string s;
  cin >> s;
  map<char, int> m;
  for (auto c : s) {
    m[c]++;
  }
  bool out = false;
  REPC(i,'a','z'){
    if(m[i]==0){
      cout << (char)i << endl;
      out = true;
      break;
    }

  }
  if(!out)
    cout << "None" << endl;

  return 0;
}


Measured memory_bytes: 512
import sys

MOD = 10 ** 9 + 7

def make_table(size=10**6, p=MOD):
    fac = [None] * (size + 1)
    fac[0] = 1
    for i in range(size):
        fac[i+1] = fac[i] * (i + 1) % p
    ifac = [None] * (size + 1)
    ifac[size] = pow(fac[size], p-2, p)
    for i in range(size, 0, -1):
        ifac[i-1] = ifac[i] * i % p
    return fac, ifac

fac, ifac = make_table(2*10**5)

def comb(n, r, mod=MOD):
    if r > n or r < 0:
        return 0
    return fac[n] * ifac[r] % mod * ifac[n-r] % mod

n, *c = map(int, sys.stdin.read().split())

def main():
    c.sort(reverse=True)
    res = 0
    # for i in range(n):
    #     cnt = 0
    #     for d in range(1, n+1):
    #         for j in range(d):
    #             cnt += comb(i, j) * comb(n-i-1, d-j-1) * (d - j) % MOD
        
    #     res += c[i] * cnt
    #     res %= MOD
    for i in range(n):
        res += c[i] * (i + 2)
        res %= MOD
    return res * 4 ** (n - 1) % MOD

if __name__ == '__main__':
    ans = main()
    print(ans)

Measured memory_bytes: 41316
k = int(input())

count = 1
flag = 0
current = 7
for i in range(2000000):
	if current%k == 0:
		flag = 1
		break

	current *= 10
	current += 7
	current %= k
	count += 1

if flag == 1:
	print(count)

else:
	print(-1)


Measured memory_bytes: 63388
#include<iostream>
#include<cstdio>
#include<vector>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<set>
#define  endl '\n'
#define all(s) s.begin(),s.end()
#define lowbit(x) (x&-x)
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mem(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
#define pb push_back
#define PI acos(-1.0)
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int mod=1e9+7;
const double eps=1e-8;
const int inf=0x3f3f3f3f;
const int N=1e5+10;
int main()
{
	int n,m,q,k;
	cin>>n;
	string s;
	cin>>s;
	if(s.length()>n) cout<<s.substr(0,n)<<"...";
	else cout<<s;
}


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

int main() {
  int X, M, m = 0;
  cin >> X;
  for(int i = 1; i < 33; i++) {
    for(int j = 2; j < 11; j++) {
      if(pow(i,j) <= X) {
        m = pow(i,j);
        M = max(M,m);
      }
    }
  }
  cout << M << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
	int n,m;
	while(cin>>n>>m)
	{
		int a[100000]={0};
		int b[100000],c[100000];
		for(int i=0;i<m;i++)
		{
			cin>>b[i]>>c[i];
		}
		for(int i=0;i<m;i++)
		{
			a[b[i]]++;
			a[c[i]]++;
		}
		int flag=1;
		for(int i=0;i<n;i++)
		{
			if(a[i]%2!=0)
				flag=0;
		}
		if(flag==1)
			cout<<"YES\n";
		else
			cout<<"NO\n";
	}
}

Measured memory_bytes: 1408
#include<iostream>
#include<vector>
#include<numeric>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
int main()
{
    ll n,m;
    cin>>n>>m;
    vector<ll> a(m);
    rep(i,m)
    {
        cin>>a[i];
    }
    ll sum=accumulate(a.begin(),a.end(),0);
    ll ans=n-sum;
    if(sum>n)cout<<-1<<endl;
    else cout<<ans<<endl;
 
    return 0;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1000000007;
const LL LINF=1LL<<60;
const int INF=1<<30;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
 

vector<vector<LL>> nextIndex(int k,const string &s){
    int n = s.length();
    vector<vector<LL>> ret(n+1,vector<LL> (26,n));
    for (int i = n-1; i >= 0; i--) {
        for (int j = 0; j < 26; j++) ret[i][j] = ret[i+1][j];
        ret[i][s[i]-'a'] = (i+1)%k;
    }
    return ret;
}


int main(){
    string s,t;cin >> s >> t;
    vector<bool> a(26,false),b(26,false);
    for (int i = 0; i < s.length(); i++) {
        a[s[i]-'a']=true;
    }
    for (int i = 0; i < t.length(); i++) {
        b[t[i]-'a']=true;
    }
    for (int i = 0; i < 26; i++) {
        if(b[i]&&!a[i]){
            puts("-1");
            return 0;
        }
    }
    LL n = s.length();
    auto p = nextIndex(n,s+s);
    LL ans = 0;
    LL pos = 0;
    for (int i = 0; i < t.length(); i++) {
        LL nx = p[pos][t[i]-'a'];
        if(nx<=pos){
            ans += n -(pos-nx);
            pos = nx;
        }
        else{
            ans += nx - pos;
            pos = nx;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 49024
def solve(n,x):
    count = 0
    for i in range(1,n+1):
        for j in range(1,n+1):
            if i == j :
                continue
            for k in range(1,n+1):
                if j == k or i == k:
                    continue
                if i+j+k == x:
                    count += 1
    return count//6

while True:
    n,x = map(int,input().split())
    if n == x == 0:
        break;
    print(solve(n,x))

Measured memory_bytes: 7672
void main()
{
    int[] abc = readln.split.to!(int[]);
    int c = abc[2];

    abc.sort!"a < b";
    writeln(abc[1] == c ? "Yes" : "No");
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
typedef long long ll;
typedef pair<int, int> P;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, M;
  cin >> N >> M;
  int s[M], c[M];
  FOR(i,0,M) {
    cin >> s[i] >> c[i];
    // 右から何桁目か
    s[i] = N - s[i] + 1;
  }
  int mn = pow(10, N - 1);
  if (N == 1) {
    mn = 0;
  }
  int mx = pow(10, N) - 1;
  int ans = 2e9;
  FOR(i,0,10) {
    FOR(j,0,10) {
      FOR(k,0,10) {
        int x = i * 100 + j * 10 + k;
        if (x < mn || x > mx) {
          continue;
        }
        bool ok = true;
        FOR(m,0,M) {
          if (s[m] == 3 && c[m] != i) {
            ok = false;
            break;
          }
          if (s[m] == 2 && c[m] != j) {
            ok = false;
            break;
          }
          if (s[m] == 1 && c[m] != k) {
            ok = false;
            break;
          }
        }
        if (ok) {
          ans = min(ans, x);
        }
      }
    }
  }
  cout << (ans == 2e9 ? -1 : ans) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define N 100005
#define Ln 20
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define rep(i,n) for((i)=0;(i)<(n);(i)++)
#define repp(i,n) for((i)=n-1;(i)>=0;(i)--)
#define F first
#define S second

int n,q;
int co[N],w[N];
int p[Ln][N];
vector<pii> e[N];
int d[N],D[N];
map<int,pii> mem[N];
int num[N],dist[N];

struct ABC133F{};
struct Tourist{};
struct Rng_58{};
struct RadeWoosh
{
	int c,len,u,v,uv;
}R[N];
void dfs(int u)
{
	int i;
	rep(i,e[u].size())
	{
		int v=e[u][i].F;
		if(v==p[0][u]) continue;
		p[0][v]=u;
		d[v]=d[u]+1;
		D[v]=D[u]+w[e[u][i].S];
		dfs(v);
	}
}
int lca(int u,int v)
{
	int i;
	if(d[u]>d[v]) swap(u,v);
	repp(i,Ln)
		if(1<<i<=d[v]-d[u]) v=p[i][v];
	repp(i,Ln)
		if(p[i][u]!=p[i][v]) u=p[i][u],v=p[i][v];
	if(u==v) return u;
	return p[0][u];
}
void dfs2(int u)
{
	int i;
	for(map<int,pii>::iterator it=mem[u].begin();it!=mem[u].end();it++)
		it->S=mp(num[it->F],dist[it->F]);
	rep(i,e[u].size())
	{
		if(e[u][i].F==p[0][u]) continue;
		int v=e[u][i].S;
		num[co[v]]++;
		dist[co[v]]+=w[v];
		dfs2(e[u][i].first);
		num[co[v]]--;
		dist[co[v]]-=w[v];
	}
}

int main()
{
	
	int i,j,Tc;
	scanf("%d%d",&n,&q);
	rep(i,n-1)
	{
		int u,v;
		scanf("%d%d%d%d",&u,&v,&co[i],&w[i]);
		e[u].pb(mp(v,i));
		e[v].pb(mp(u,i));
	}
	dfs(1);
	rep(i,Ln)
	rep(j,N)
		if(i) p[i][j]=p[i-1][p[i-1][j]];
	
	rep(Tc,q)
	{
		int c,len,u,v,uv;
		scanf("%d%d%d%d",&c,&len,&u,&v);
		uv=lca(u,v);
		pii emp=mp(0,0);
		mem[u][c]=emp;
		mem[v][c]=emp;
		mem[uv][c]=emp;
		R[Tc].c=c; R[Tc].len=len;
		R[Tc].u=u; R[Tc].v=v; R[Tc].uv=uv;
	}
	dfs2(1);
	rep(Tc,q)
	{
		int c,len,u,v,uv;
		c=R[Tc].c; len=R[Tc].len;
		u=R[Tc].u; v=R[Tc].v; uv=R[Tc].uv;
		int A=D[u]+D[v]-2*D[uv];
		int B=mem[u][c].F+mem[v][c].F-2*mem[uv][c].F;
		int C=mem[u][c].S+mem[v][c].S-2*mem[uv][c].S;
		printf("%d\n",A+len*B-C);
	}
	
	return 0;
}

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

int main(){
  int n, x;
  cin >> n >> x;
  int a[n+1]={};

  for(int i = 1; i <= n; ++i){
    int b;
    cin >> b;
    a[i] = a[i-1] + b;
  }

  int cnt = 0;
  for(int i = 0; i <= n; ++i){
    if( a[i] > x ) break;
    cnt++;
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
using namespace std;

typedef long long ll;

#define INF 10e10
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
// 昇順sort
#define sorti(x) sort(x.begin(), x.end())
// 降順sort
#define sortd(x) sort(x.begin(), x.end(), std::greater<int>())

int main() {
  int h,w;
  cin >> h >> w;
  char maze[h][w];
  int c = 0;
  rep(i,h)rep(j,w) {
    cin >> maze[i][j];
    if (maze[i][j] == '#') {
      c++;
    }
  }

  if (h + w - 1 == c) {
    cout << "Possible" << endl;
  } else {
    cout << "Impossible" << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define ALL(vec) vec.begin(), vec.end()
#define rALL(vec) vec.rbegin(), vec.rend()
using namespace std;
using ll = long long;

int main() {
    int R;
    cin >> R;
    printf("%lf", 2*3.14159265*R);
    return 0;
}

Measured memory_bytes: 3752
#include <bits/stdc++.h>  // clang-format off
using Int = long long;
#define REP_(i, a_, b_, a, b, ...) for (Int i = (a), lim##i = (b); i < lim##i; i++)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
struct SetupIO { SetupIO() { std::cin.tie(nullptr), std::ios::sync_with_stdio(false), std::cout << std::fixed << std::setprecision(13); } } setup_io;
#ifndef dump
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Sat May 30 21:07:50 JST 2020
 **/

void no() {
    std::cout << -1 << std::endl;
    exit(0);
}
using pii = std::pair<Int, Int>;
signed main() {
    Int n;
    std::cin >> n;
    std::vector<Int> a(n + 1);
    REP(i, n + 1) std::cin >> a[i];
    std::vector<pii> dp(n + 1);
    dp.back() = {a.back(), a.back()};
    for (Int i = n - 1; i >= 0; i--) {
        dp[i].first = a[i] + (dp[i + 1].first + 1) / 2;
        dp[i].second = a[i] + dp[i + 1].second;
    }
    Int ans = 1, cur = 1;
    cur -= a[0];
    REP(i, 1, n + 1) {
        if (cur * 2 < dp[i].first || cur > dp[i].second) no();
        cur = std::min(dp[i].second, cur * 2);
        ans += cur;
        cur -= a[i];
    }
    if (cur != 0) no();
    std::cout << ans << std::endl;
}


Measured memory_bytes: 5952
import sys

import numpy as np
import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy, functools, random
from collections import deque, defaultdict, Counter
from heapq import heappush, heappop
from itertools import permutations, combinations, product, accumulate, groupby
from bisect import bisect_left, bisect_right, insort_left, insort_right
from operator import itemgetter as ig
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
INF = float("INF")
mod = 10 ** 9 + 7
"""dd = [(-1, 0), (0, 1), (1, 0), (0, -1)];
ddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)];
ddn9 = ddn + [(0, 0)]
for dx, dy in dd:
        nx = j + dx; ny = i + dy
            if 0 <= nx < w and 0 <= ny < h:"""

def wi(): return list(map(int, sys.stdin.readline().split()))
def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]  # WideIntPoint
def ws(): return sys.stdin.readline().split()
def si(): return int(sys.stdin.readline())  # SingleInt
def ss(): return input()
def hi(n): return [si() for _ in range(n)]
def hs(n): return [ss() for _ in range(n)]  # HeightString
def s_list(): return list(input())
def mi(n): return [wi() for _ in range(n)]  # MatrixInt
def mip(n): return [wip() for _ in range(n)]
def ms(n): return [ws() for _ in range(n)]
def num_grid(n): return [[int(i) for i in sys.stdin.readline().split()[0]] for _ in range(n)]  # NumberGrid
def grid(n): return [s_list() for _ in range(n)]


def main():

    n = int(input())
    xy = []
    for i in range(n):
        xy.append(list(map(int,input().split())))

    number = []
    for i in range(n):
        number.append(i)

    p = list(itertools.permutations(number))
    d = 0.0
    for p_1 in p:
        for i in range(n-1):
            p_1 = list(p_1)

            d += np.sqrt((xy[p_1[i]][0] - xy[p_1[i+1]][0])**2 + (xy[p_1[i]][1] - xy[p_1[i+1]][1])**2)
    ans = d/len(p)
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 21044
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define debug(x) cerr << "[debug] " << #x << ": " << x << endl;
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(i, v.size()) cerr << " " << v[i]; \
  cerr << endl;
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr double PI = 3.141592653589793238462643383279;
ll getDigit(ll x) {
  return x == 0 ? 1 : log10(x) + 1;
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

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

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

vll divisor(ll n) {
  vll ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  SORT(ret);
  return (ret);
}

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;
}

signed main() {
  init();
  ll A, B;
  cin >> A >> B;
  if (B % A == 0) {
    COUT(A + B);
  } else {
    COUT(B - A);
  }
  return 0;
}

Measured memory_bytes: 256
//include
//------------------------------------------
#include <bits/stdc++.h>
using namespace std;
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const long long INF = 1000000007;
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
// chmax chmin
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(void){
    int N; cin >> N;
    VI a(N); int mx=0; REP(i,N){cin >> a[i]; chmax(mx, a[i]);}
    map<int,int> m;
    REP(i,N){
        if(m.find(a[i]) == m.end()) m[a[i]] = 1;
        else m[a[i]]++;
    }
    int ans = 0;
    for(auto p : m){
        if(p.first > p.second) ans += p.second;
        else if(p.first < p.second) ans += p.second-p.first;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5120
#include <stdio.h>
#include <stdlib.h>
int cmp(int n)
{
    return (n*(n-1))/2;
}
int main()
{
   int N,M;
   scanf("%d%d",&N,&M);
   int num=0;
   if(N<=1 && M<=1)
   {
       num=0;


   }
   else if(N<=1 && M>1)
   {
       num=cmp(M);

   }
   else if(M<=1 && N>1)
   {
       num=cmp(N);
   }
   else
   {
       num=cmp(M)+cmp(N);
   }
   printf("%d",num);

    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;
using namespace std;
#define X 200010
int p[X],n,m,N;
void Unite(int a,int b){
	int x=a,y=b;
	while(p[x]!=x)x=p[x];
	while(p[y]!=y)y=p[y];
	while(a!=x){int t=p[a];p[a]=x,a=t;}
	while(b!=y){int t=p[b];p[b]=y,b=t;}
	p[x]=y;
}
int main(){
	cin>>n>>m;
	N=n+m;
	lol(i,N)p[i]=i;
	lol(i,n){
		int a;cin>>a;
		lol(j,a){
			int b;cin>>b;
			Unite(i,b+n-1);
		}
	}
	set<int> st;
	lol(i,n){
		int x=p[i];
		while(p[x]!=x)x=p[x];
		st.insert(x);
	}
	cout<<(st.size()==1?"YES":"NO")<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define FOR(i, m, n) for (ll i = m; i < (n); i++)
#define RFOR(i, m, n) for (ll i = (m - 1); i >= 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
//#define print(ele) cout << (ele) << "\n"
#define print10(ele) cout << fixed << setprecision(10) << (ele) << "\n"

using namespace std;
typedef long long ll;
typedef vector<int> ivec;
typedef vector<string> svec;
typedef vector<ll> lvec;

const int mod = 1e9 + 7;
const ll INF = 1000000000000000000LL;

void print() { cout << endl; }

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(tail) != 0) cout << " ";
  print(forward<Tail>(tail)...);
}

int main() {
  ll a, b, c, k;
  cin >> a >> b >> c >> k;
  ll ans = 0;
  if (a <= k) {
    ans += a;
    k -= a;
  } else {
    ans += k;
    k -= k;
  }

  if (b <= k) {
    k -= b;
  } else {
    k -= k;
  }
  if (c <= k) {
    ans -= c;
    k -= b;
  } else {
    ans -= k;
  }
  print(ans);
  return 0;
}

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    cin >> S;
    if (S.length() < 4) {
        cout << "No" << endl;
        return 0;
    }
    if (S.substr(0, 4) == "YAKI") cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
H = []
for _ in range(N):
    A, B = map(int,input().split())
    H.append((B, A))
H.sort()
t = 0
for i in range(N):
    B, A = H[i]
    t += A
    if B < t:
        print("No")
        break 
    if i == N - 1:
        print("Yes")

Measured memory_bytes: 29456
a=list(input())
b=list(input())
c=list(input())

turn='a'

while True:
    if turn=='a':
        try:
            turn=a.pop(0)
        except:
            break
    elif turn=='b':
        try:
            turn=b.pop(0)
        except:break
    else:
        try:
            turn=c.pop(0)
        except:
            break
        

print(turn.upper())


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

#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second

#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define minQueue priority_queue<ll,vector<ll>,greater<ll> > 
#define maxQueue priority_queue<ll,vector<ll>,less<ll> > 

#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define RFOR(i,a,b) for(ll i=a;i>b;i--)
#define FILL(a,b) memset((a),(b),sizeof((a)))
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));

#define deb1(x) cout<<#x<<" : "<<x<<endl;
#define deb2(x,y) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<endl;
#define deb3(x,y,z) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<"\t"<<#z<<" : "<<z<<endl;

#define MOD 1000000007
#define INF LONG_LONG_MAX
#define MINF LONG_LONG_MIN

int main()
{
    FAST;
    ll a,b,c;
    cin>>a>>b>>c;
    if(a==b && b==c)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
    return 0;
}

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

int main() {
    int a, b, c;
    cin >> a >> b >> c;

    set<int> abc;

    abc.insert(a);
    abc.insert(b);
    abc.insert(c);

    if (abc.size() == 2) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define all(x) x.begin(),x.end()
#define ln '\n'
const long double PI = acos(-1.0L);
const long long MOD = 1000000007LL;
// const long long MOD = 998244353LL;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
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 N; cin >> N;
    vector<int> x(N),y(N),t(N);
    rep(i,N) cin >> t[i] >> x[i] >> y[i];

    int cur = 0, xx = 0, yy = 0;
    rep(i,N) {
        int nx = x[i] - xx;
        int ny = y[i] - yy;
        int nn = t[i] - cur;
        if (abs(nx)+abs(ny) > nn) {
            cout << "No" << ln;
            return 0;
        }
        if ((abs(nx)+abs(ny))%2 != nn%2) {
            cout << "No" << ln;
            return 0;
        }
        xx = x[i];
        yy = y[i];
        cur = t[i];
    }

    cout << "Yes" << ln;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const int inf = 1e9;
double pi = 3.14159265359;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define per(i, b, a) for (int i = a - 1; i >= b; i--)
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dxx[8] = {1, 1, 1, 0, 0, -1, -1, -1}, dyy[8] = {-1, 0, 1, -1, 1, -1, 0, 1};

const int mod = 1e9 + 7;
ll modpow (ll a, ll b) {
    ll res = 1;
    while (b) {
        if (b & 1) res = res * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return res % mod;
}

int main() {
    int x, y;
    cin >> x >> y;
    ll ans = 1;
    if ((x + y) % 3 != 0) ans = 0;
    int n = (x + y) / 3;
    if (x < n || y < n) ans = 0;
    int nx = x - n, ny = y - n;
    rep (i, 0, nx + ny) {
        ans = ans * (i + 1) % mod;
        ll j = modpow (i + 1, mod - 2);
        // cout << j << " ";
        if (i < nx) ans = ans * j % mod;
        // cout << ans << " ";
        if (i < ny) ans = ans * j % mod;
        // cout << ans << "\n";
    }
    cout << ans << "\n";
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>

using std::cin;
using std::min;
using std::max;

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

    long rate_min, rate_tmp;
    cin >> rate_min >> rate_tmp;
    long range_max = rate_tmp - rate_min;
    rate_min = min(rate_min, rate_tmp);
    data_num -= 2;

    long range_tmp;
    while (data_num--) {
        cin >> rate_tmp;
        range_tmp = rate_tmp - rate_min;
        rate_min = min(rate_min, rate_tmp);
        range_max = max(range_max, range_tmp);
    }

    std::cout << range_max << std::endl;

    return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define zep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(int i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    
    string n; cin >> n;
    
    ll sm = 0;
    zep(i, 0, n.size()){
        sm += n[i] - '0';
    }

    print((sm % 9 == 0)? "Yes" : "No")

    return 0;
}

Measured memory_bytes: 3780
#include<bits/stdc++.h>
using namespace std;
char a[101];
int main()
{
	gets(a);
	int l=strlen(a),x=0,y=0;
	for(int i=0;i<=l;i++)
	{
		if(a[i]=='C') x=1;
		if(x==1&&a[i]=='F') y=1;
	}
	if(y==1)
	{
		cout<<"Yes"<<endl;
		return 0;
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256