akhauriyash/Code-Regression huggingface dataset:
x = input()
numberList = x.split(" ")
result = 1

oneCount = numberList.count("1")
sevenCount = numberList.count("7")
nineCount = numberList.count("9")
fourCount = numberList.count("4")

if oneCount == 0 or sevenCount == 0 or nineCount == 0 or fourCount == 0 :
    result = 0
if oneCount > 1 or sevenCount > 1 or nineCount > 1 or fourCount > 1 :
    result = 0
    
if result == 1:
    print("YES")
else :
    print("NO")

Measured memory_bytes: 3064
import java.util.*;
/**
 * Main
 */
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		int b = sc.nextInt();
		if(a <= b){
			String x = "";
			for(int i = 0 ; i<b ; i++){
				x = x + Integer.toString(a);
			}
			System.out.println(x);
		}else{
			String x = "";
			for(int i = 0 ; i<a ; i++){
				x = x + Integer.toString(b);
			}
			System.out.println(x);
		}
	}
};


Measured memory_bytes: 21844
#include "bits/stdc++.h"
using namespace std;


int main()
{
	double n, k;
	cin >> n >> k;

	double ans = 0;
	for (double i = 1; i <= n; i++) {
		double i_temp = i;
		double cnt = 0;
		while (i_temp < k) {
			i_temp *= 2;
			cnt++;
		}
		ans += ((double)1 / n) * pow((double)0.5, cnt);
	}

	cout << fixed << setprecision(12) << ans << endl;
}



Measured memory_bytes: 256
s=input()
s1=int(s[:2])
s2=int(s[2:4])
if s1>12 :
  if s2>0 :
    if s2<=12 :
      print("YYMM")
    else :
      print("NA")
  else :
    print("NA")
elif s1>0:
  if s2>0 :
    if s2<=12 :
      print("AMBIGUOUS")
    else :
      print("MMYY")
  else :
    print("MMYY")
else :
  if s2>0 :
    if s2<=12 :
      print("YYMM")
    else :
      print("NA")
  else :
    print("NA")

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

using namespace std;

using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;

using _loop_int = 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 CHMIN(a,b) (a)=min((a),(b))
#define CHMAX(a,b) (a)=max((a),(b))
#define ALL(v) (v).begin(),(v).end()

#define DEBUG(x) cerr<<#x<<": "<<(x)<<endl
#define DEBUG_VEC(v) cerr<<#v<<": ";REP(__i,(v).size())cerr<<((v)[__i])<<", ";cerr<<endl

const ll MOD = 1000000007ll;

int main(){
    int a,p;
    cin>>a>>p;
    cout<<((3*a+p)/2)<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <stack>
#include <climits>

using namespace std;

#define rep(i,n,m) for(int i=n; i<=m; i++)
#define per(i,n,m) for(int i=n; i>=m; i--)
#define printi(x) printf("%d ", x)
#define printiln(x) printf("%d\n", x)
#define printiarray(a,n) for(int i=0; i<n-1; i++){printf("%d ", a[i]);} printf("%d\n", a[n-1])
#define scani(x) scanf("%d", &x)
#define scaniarray(a,n) for(int i=0; i<n; i++){scanf("%d", &a[i]);}
#define scans(str) scanf("%s",str)
#define scanc(ch) scanf("%c", &ch)

int main() {
    //INPUT
    int n, q;
    
    scani(n);
    int S[n];
    scaniarray(S,n);
    
    scani(q);
    int T[q];
    scaniarray(T,q);
    
    //SEARCH
    int count = 0;
    rep(i,0,q-1) {
        rep(j,0,n-1) {
            if(T[i] == S[j]) {
                count++;
                break;
            }
        }
    }
    
    
    
    //OUTPUT
    printiln(count);
    
    
    
    return 0;
}


Measured memory_bytes: 2736
from collections import Counter
import sys
input = sys.stdin.readline

n = int(input())
a = list(map(int, input().split()))
q = int(input())
bc = [list(map(int, input().split())) for _ in range(q)]

ans = sum(a)
a = Counter(a)
for b, c in bc:
    ans = ans + (c - b) * a[b]
    a[c] += a[b]
    a[b] = 0
    print(ans)
    

Measured memory_bytes: 39372
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  ll n;
  R n;
  if(n==1) pr("Hello World");
  else {
    int x,y;
    cin >> x >> y;
    pr(x+y);
  }
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


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

class Program
{
    static void Main()
    {
        var a = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int n = a[0], m = a[1];
        a = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var min = new int[n][];
        var max = new int[n][];
        for (int i = 0; i < n; i++)
        {
            min[i] = new int[m];
            max[i] = new int[m];
            min[i][0] = max[i][0] = a[i];
            for (int j = 1; j < m; j++)
            {
                min[i][j] = Math.Min(min[i][j - 1], a[(i + j) % n]);
                max[i][j] = Math.Max(max[i][j - 1], a[(i + j) % n]);
            }
        }
        int sum = 0;
        for (int i = 0, c = 0; c == 0 || i % n > 0; i = (i + m) % n, ++c)
        {
            sum += max[i][m - 1] - min[i][m - 1];
        }
        Console.WriteLine(sum);
    }
}

Measured memory_bytes: 17796
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

typedef long long int int64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

void run(void){
  int n,m,a,b;
  scanf("%d%d%d%d",&n,&m,&a,&b);
  int x[100],y[100];
  int i;
  for(i=0;i<n;i++) scanf("%d",x+i);
  for(i=0;i<m;i++) scanf("%d",y+i);
  for(i=a+1;i<=b;i++){
    int j;
    for(j=0;j<n;j++) if(x[j]>=i) break;
    if(j<n) continue;
    for(j=0;j<m;j++) if(y[j]<i) break;
    if(j<m) continue;
    printf("No War\n");
    return;
  }
  printf("War\n");
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 128
N=int(input())
a=input()
d=[a]
for x in range(N-1):
  b=input()
  if b not in d:
    d.append(b)
    if a[len(a)-1]==b[0]:
      a=b
      if x==N-2:
        print("Yes")
    else:
      print("No")
      break
  else:
    print("No")
    break

Measured memory_bytes: 62436
#include <iostream>
#include <string>
#include <algorithm>
#include <sstream>
#include <cstdio>
#include <cassert>

using namespace std;

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

int main(void)
{
	string n;
	while (cin >> n && n != "0000"){
		if (count(n.begin(), n.end(), n[0]) == 4){
			cout << "NA" << endl;
			continue;
		}
		// assert(n != "0000");

		int tmp = toInt(n);
		char str[128];
		sprintf(str, "%04d", tmp);
		n = string(str);
		int cnt = 0;
		while (n != "6174"){
			if (count(n.begin(), n.end(), n[0]) == 4){
				cout << "NA" << endl;
				goto END;
			}
			string L = n; sort(L.rbegin(), L.rend());
			string S = n; sort(S.begin(), S.end());
			// cout << n << " " << L << " " << S << endl;
			int tmp = toInt(L) - toInt(S);
			char str[128];
			sprintf(str, "%04d", tmp);
			n = string(str);
			cnt++;
		}
		cout << cnt << endl;
		END:;
	}

	return 0;
}

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

using namespace std;

int main(int, char**) {
        int n, m;
        cin >> n >> m;
        vector<long long> hs(n, 0);
        vector<int> good(n, 1);
        for (int i=0; i<n; i++) {
                long long h;
                cin >> h;
                hs.at(i) = h;
        }
        for (int i=0; i<m; i++) {
                int a, b;
                cin >> a >> b;
                a--; b--;
                if (hs[a] > hs[b]) {
                        good[b] = 0;
                } else if (hs[b] > hs[a]) {
                        good[a] = 0;
                } else {
                        good[a] = 0;
                        good[b] = 0;
                }
        }
        int count = 0;
        for (int i=0; i<n; i++) {
                count += good[i];
        }
        cout << count << endl;
        return 0;
}


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

void Main() {
  std::string s, c;
  std::cin >> s >> c;

  int ans = 0;
  for (int i = 0; i < 3; i++) {
    if (s[i] == c[i]) ans++;
  }

  std::cout << ans << std::endl;
}

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

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

int main() {
	string s;
	cin >> s;
	string k = "Heisei";
	string ymd = s.substr(0,4) + s.substr(5,2) + s.substr(8,2);
	int a = stoi(ymd);
	if(a > 20190500)
	{
		k = "TBD";
	}
	cout << k << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
 
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define VSORT(v) sort(v.begin(), v.end())
#define SORT(v, n) sort(v, v+n)
#define VREV(v,n) reverse(v,v+n)
#define REV(v,n) reverse(v,v+n)
#define vi vector<int>
#define pf push_front
#define pb push_back

template<class T, size_t N> size_t countof(const T (&array)[N]) { return N; }
template <class T> void chmin(T&a,const T&b) { a = min(a,b); }
template <class T> void chmax(T&a,const T&b) { a = max(a,b); }
 
void print(){cout<<"\n";}
template <class Head, class... Tail>
void print(Head&& h,Tail&&... t){ 
	if(sizeof...(t)==0)
		cout<<h;
	else
		cout<<h<<' ';
	print(move(t)...);
}

void mprint(auto *matrix,auto N){
	REP(i,N) cout<<matrix<<(i!=N-1?' ':'\n');
	return;
}

const double EPS =1e-9;
const int INF =2e+9;
const ll INFL =9e+18;
const long MOD =1e+9+7;
#define PI 3.14159265258979

#define P pair<int,int>
#define Pll pair<ll,ll>
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

inline int in(){int x; cin>>x; return x;}

struct UnionFind{
	vector<int> par; //データiが属する親の番号
	vector<int> sizes; //根ノードiの木に含まれるデータの数

	// 最初は全てのデータiがグループiに存在するものとして初期化
	UnionFind(int n):par(n),sizes(n, 1){
		REP(i,n) par[i] = i;
	}

	// 根を張り替えながら再帰的に根ノードを探す
	int find(int x){
		if(x==par[x]) return x;
		return par[x]=find(par[x]);
	}

	// 2つのデータx, yが属する木をマージする
	void unite(int x, int y) {
		// データの根ノードを得る
		x = find(x);
		y = find(y);

		// 既に同じ木に属しているならマージしない
		if (x == y) return;

		// xの木がyの木より大きくなるようにする
		if (sizes[x] < sizes[y]) swap(x, y);

		// xがyの親になるように連結する
		par[y] = x;
		sizes[x] += sizes[y];
		sizes[y] = 0;  // sizes[y]は無意味な値となるため
	}

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

	// データxが含まれる木の大きさを返す
	int size(int x) {
		return sizes[find(x)];
	}
};
int gcd(int n,int m){
	if(m>n) return gcd(m,n);
	if(m==0) return n;
	else return gcd(m,n%m); 
}

int main(void){
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	int tem,max=-INF,result=0,K;
	REP(i,3){
		cin>>tem;
		chmax(max,tem);
		result+=tem;
	}
	cin>>K;
	print(result+max*pow(2,K)-max);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii=pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c),end(c)
#define rall(c) rbegin(c),rend(c)
#define fore(x,c) for(auto &&x:c)
#define rep(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define rrep(i, a, n) for(int i=(int)(n-1);i>=a;--i)
#define sz(c) ((int)c.size())
#define contains(c,x) (c.find(x)!=end(c))
#define inseg(l,x,r) ((l)<=(x)&&(x)<(r))
#define dump(...)
#define pb push_back
#define _ 0
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(nullptr); ios::sync_with_stdio(0);
        cout << setprecision(15) << fixed;
        // #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

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

signed main() {
    int N;
    cin >> N;
    vi A(N);
    cin >> A;
    vi L, R;
    L = R = A;
    rep(i, 1, N) L[i] = gcd(A[i], L[i - 1]);
    rrep(i, 0, N - 1) R[i] = gcd(A[i], R[i + 1]);

    int ans = 0;
    rep(i, 0, N) {
        int l = i > 0 ? L[i - 1] : 0;
        int r = i < N - 1 ? R[i + 1] : 0;
        chmax(ans, gcd(l, r));
    }
    cout << ans << endl;
    return (0^_^0);
}



Measured memory_bytes: 2560
S = input()

N = len(S)
ans = 'No'

# 文字列strの反転は、str[::-1]である
if S == S[::-1] and S[:(N-1)//2] == S[:(N-1)//2][::-1] and S[(N+1)//2:] == S[(N+1)//2:][::-1]:
  ans = 'Yes'
  
print(ans)

Measured memory_bytes: 9004
n = int(input())
XY = [list(map(int, input().split())) for _ in range(n)]
mod = sum(XY[0])%2
for x, y in XY:
    if mod != (x+y)%2:
        print(-1)
        exit()
m = 33-mod
print(m)
D = [2**i for i in range(31, -1, -1)]
if mod == 0:
    D.append(1)
print(" ".join(map(str, D)))
for x, y in XY:
    w = " "
    for d in D:
        if x-y >= 0 and x+y >= 0:
            w += "R"
            x -= d
        elif x-y < 0 and x+y >= 0:
            w += "U"
            y -= d
        elif x-y >= 0 and x+y < 0:
            w += "D"
            y += d
        else:
            w += "L"
            x += d
    print(w)

Measured memory_bytes: 3316
import java.util.Scanner;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author rn-sshawish
 */
public class Main{
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int a = input.nextInt();
        int b = input.nextInt();
        long sum =0;
        for (int i = 1; i <= n; i++) {
            if (checkDigitSum(i, a, b)) {
                sum+= i;
            }
        }
        System.out.println(sum);
    }
    
    public static boolean checkDigitSum (int number, int a, int b){
        int sum = 0;
            while (number > 9) {
                sum+= number % 10;
                number = number / 10;
            }
            if (number > 0) {
                sum+= number;
            }
            if (sum >=a  && sum <= b) {
                return true;
            }else{
                return false;
            }
    }
}


Measured memory_bytes: 22100
#https://atcoder.jp/contests/abc068/tasks/abc068_b
N = int(input())
count = 0
for _ in range(N):
    if N == 1:
        print(2**count)
        break  
    N //= 2
    count += 1
    if N ==1:
        print(2**count) 
        break

Measured memory_bytes: 3060
//xtwakioi! xtwddYnoi(双重含义)!
#include <bits/stdc++.h>
#define ri register
#define int long long
#define E (n+1)
using namespace std; const int N=200010;
inline int read()
{
    int s=0, w=1; ri char ch=getchar();
    while(ch<'0'||ch>'9') { if(ch=='-') w=-1; ch=getchar(); }
    while(ch>='0'&&ch<='9') s=(s<<3)+(s<<1)+(ch^48), ch=getchar();
    return s*w;
}
int n,m,dis[N],book[N];
int head[N],maxE;
struct Edge { int nxt,to,rdis; }e[N<<1];
inline void Add(int u,int v,int w) { e[++maxE].nxt=head[u]; head[u]=maxE; e[maxE].to=v; e[maxE].rdis=w; }
signed main()
{
    n=read(), m=read();
    for(ri int i=1;i<=m;i++)
    {
        int u,v,w;
        u=read(), v=read(), w=read();
        Add(u,v,-w);
    }
    queue<int> Q;
    for(ri int i=1;i<=n;i++) dis[i]=1e18;
    dis[1]=0;
    for(ri int k=1;k<n;k++)
    {
        for(ri int i=1;i<=n;i++)
        {
            for(ri int j=head[i];j;j=e[j].nxt)
            {
                int v=e[j].to;
                if(dis[i]==1e18) continue;
                if(dis[v]>dis[i]+e[j].rdis)
                dis[v]=dis[i]+e[j].rdis;
            }
        }
    }

    for(ri int k=1;k<=n;k++)
    for(ri int i=1;i<=n;i++)
    {
        for(ri int j=head[i];j;j=e[j].nxt)
        {
            int v=e[j].to;
            if(dis[i]==1e18) continue;
            if(dis[v]>dis[i]+e[j].rdis)
            {
                dis[v]=dis[i]+e[j].rdis;
                book[v]=1;
            }
            if(book[i]) book[v]=1;
        }
    }

    if(book[n]) { puts("inf"); }
    else printf("%lld\n",-dis[n]);

    return 0;
}

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

using namespace std;

int main() {
    int N, k = 0,a,b,res = 0;
    cin >> N;
    for(auto i = 0; i < N; ++i)
    {
        std::cin >> a >> b;
        if(a==b){
            k++;
            res += (k==3);
        }
        else k = 0;
    }
    if (res) cout << "Yes" << std::endl;
    else cout << "No" << std::endl;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
using lint     = long long;
const lint inf = 1LL << 60;
const lint mod = 1000000007;

struct UnionFind {
    vector<int> rank, parent, size;

    // +1 for 1-indexed nodes
    UnionFind(int n) : rank(n + 1, 0), parent(n + 1), size(n + 1, 1) {
        iota(parent.begin(), parent.end(), 0); // parent is itself
    }
    int root(int x) {
        if (x != parent[x]) {
            parent[x] = root(parent[x]);
        }
        return parent[x];
    }
    bool isSame(int x, int y) { return root(x) == root(y); }
    bool unite(int x, int y) { return link(root(x), root(y)); }
    bool link(int x, int y) {
        if (x == y)
            return false;
        if (rank[x] > rank[y]) {
            parent[y] = x;
            size[x] += size[y];
        } else {
            parent[x] = y;
            size[y] += size[x];
            if (rank[x] == rank[y]) {
                rank[y]++;
            }
        }
        return true;
    }
    int getSize(int x) { return size[root(x)]; }
};

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    lint n, m, q;
    cin >> n >> m >> q;
    UnionFind uf(n);
    lint one = n;
    vector<pair<int, int>> two;
    for (int i = 0; i < q; ++i) {
        int u, v, c;
        cin >> u >> v >> c;
        if (c == 0) {
            if (uf.unite(u, v))
                one--;
        } else {
            two.emplace_back(u, v);
        }
    }
    if (m == n - 1) {
        if (two.size() == 0)
            cout << "Yes"
                 << "\n";
        else
            cout << "No"
                 << "\n";
        return 0;
    }
    for (auto &p : two) {
        if (uf.isSame(p.first, p.second)) {
            cout << "No"
                 << "\n";
            return 0;
        }
    }
    lint maxi = n - one + one * (one - 1) / 2;
    if (m <= maxi) {
        cout << "Yes"
             << "\n";
    } else {
        cout << "No"
             << "\n";
    }
    return 0;
}

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

class union_find {
	vector<int> par;
public:
	union_find(int n) : par(n, -1) {}
	int find(int a) {
		return par[a] < 0 ? a : par[a] = find(par[a]);
	}
	bool same(int a, int b) {
		return find(a) == find(b);
	}
	void unite(int a, int b) {
		a = find(a);
		b = find(b);
		if (a == b) return;
		if (par[a] < par[b]) {
			par[a] += par[b];
			par[b] = a;
		}
		else {
			par[b] += par[a];
			par[a] = b;
		}
	}
	int size(int a) {
		return -par[find(a)];
	}
};

int main()
{
	int N;
	cin >> N;
	vector<int> A(N), B(N);
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	map<int, int> ids;
	for (int i = 0; i < N; i++) {
		cin >> B[i];
		ids[B[i]] = i;
	}
	auto as = A;
	auto bs = B;
	sort(as.begin(), as.end());
	sort(bs.begin(), bs.end());
	bool ng = false;
	for (int i = 0; i < N; i++) {
		if (as[i] > bs[i]) {
			ng = true;
			break;
		}
	}
	if (ng) {
		puts("No");
		return 0;
	}
	bool ok = false;
	for (int i = 0; i < N; i++) {
		if (lower_bound(bs.begin(), bs.end(), as[i]) - bs.begin() < i) {
			ok = true;
		}
	}
	if (ok) {
		puts("Yes");
		return 0;
	}
	union_find uf(N);
	for (int i = 0; i < N; i++) {
		int id = ids[bs[lower_bound(bs.begin(), bs.end(), A[i]) - bs.begin()]];
		uf.unite(i, id);
	}
	puts(uf.size(0) == N ? "No" : "Yes");
	return 0;
}


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

int main() {
  long long N , A , B ;
  cin >> N >> A >> B ;
  
  if(N<=A+B){
    if(N<=A){
      cout << N << endl;
    }
    else{
    cout<< A <<endl;
    }
  }
  
  if(N>A+B){
    long long r=N%(A+B);
    long long m=min(A,r);
    cout << ((N/(A+B))*A)+m << endl;
  }
}

Measured memory_bytes: 256
def gcm (a,b)
  result = a
  k = 0
  n = b
  loop do 
    k = result%n
    result = n
    n = k
    break if k==0
  end 
  return result
end

def lcm (a,b)
  g = gcm(a,b)
  return a*b/g
end

N = gets.to_i
t = N.times.map{gets.to_i}

l = t[0]
(N-1).times{|i|
  l = lcm(l, t[i+1])
}

puts l

Measured memory_bytes: 1788
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<bitset>
#include<cstdio>
#include<cmath>
#include<deque>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<string>
#include<tuple>
#include<utility>
#include<vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
typedef vector<vector<int>> vvi;

#define rep(i, a, n)  for(int i=a; i<n; i++)
#define REP(i, n)  for(int i=0; i<(int)(n); i++)
#define REPS(i, n)  for(int i=1; i<=(int)(n); i++)
#define PER(i, n) for(int i=(int)(n)-1; i>= 0; i--)
#define PERS(i, n)  for(int i=(int)(n); i>0; i--)
#define FOR(i, c) for(__typeof((c).begin()) i = (c).begin(); i!=(c).end(); i++)
#define RFOR(i, c)  for(__typeof((c).rbegin()) i=(c).rbegin(); i!=(c).end(); i++)
#define ALL(container)  (container).begin(), (container).end()
#define RALL(container) (container).rbegin(), (container).rend()
#define SZ(container) (container).size()
#define FILL0(n)  setfill('0') << right << setw(n)
#define mp(a, b)  make_pair(a, b)
#define toLower(c)  c+0x20
#define toUpper(c)  c-0x20
#define pb  push_back
#define eb  emplace_back

const int INF = 1e9;
const long long LLINF = 1e18;
const int MOD = 1000000007;

int main(){
  int N, K; cin >> N >> K;
  vi h(N);
  REP(i, N) cin >> h[i];
  sort(ALL(h));
  int p;
  REP(i, N) {
    p = i;
    if(h[i]>=K) {
      p--;
      break;
    }
  }
  p++;
  cout << N-p << endl;
  return 0;
}


Measured memory_bytes: 640
import sys

def main():
    N = int(sys.stdin.readline())
    p = list(map(int, input().split()))
    count = 0
    for i, n in enumerate(p, 1):
        if i == n:
            count += 1
            if len(p) != i:
                p[i - 1], p[i] = p[i], p[i - 1]
    print(count)

if __name__ == '__main__':
    main()


Measured memory_bytes: 14008
x = int(input())
ctr_A = 0
ctr_B = 0

for idx in range(x):
    A,B = input().split()
    
    xSw_OK = False
    if len(A) > len(B):
        xLoop = len(A)
    else:
        xLoop = len(B)
    
    for y in range(xLoop):
        if A[y:y+1] == B[y:y+1]:
            True
        elif A[y:y+1] > B[y:y+1]:
            xSw_OK = True
            ctr_A += 3
        else:
            xSw_OK = True
            ctr_B += 3
        if xSw_OK == True:
            break
    if xSw_OK == False:
        ctr_A += 1
        ctr_B += 1

print(ctr_A,ctr_B)


Measured memory_bytes: 5592
/*
ID: Aman Raj
LANG: C++
TASK: money
*/
#include<iostream>
#include <stdio.h>
//#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
#include<math.h>
typedef  long long int ll;
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val
//Â
using namespace std;
using namespace __gnu_pbds;
//Â
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
//#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
//#define flush fflush(stdout)
#define primeDEN 727999983
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#include <fstream>
// find_by_order()  // order_of_key
typedef tree<
	int,
	null_type,
	less<int>,
	rb_tree_tag,
	tree_order_statistics_node_update>
	ordered_set;
  //# define mod 1e9+7
   ll gcd(ll a,ll b)
   {
       if(a==0)return b;
       return gcd(b%a,a);
   }
//Â

ll power1(ll a, ll b)//a raised to power b
   {  if(b<=0) return 1; if(b==1) return a;
       ll c=power1(a,b/2);
        c*=c;c%=mod;if(b%2==1) c*=a;c%=mod;
        return c;
   }
   ll mi(ll a,ll m)
   { ll c= power1(a,m-2);

     return c;
   }
int main()
{    ifstream fin("money.in");
     ofstream fout("money.out");

     ll n;cin>>n;
      vector<double> v(n);
       for(ll i=0;i<n;i++)cin>>v[i];
       sort(all(v));
       double a=v[0];
       for(auto x:v)
       {
           a=(x+a)/2;
       }
       cout<<setprecision(12)<<fixed;
       cout<<a;

      return 0;
}


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

using namespace std;

int main(){
    int a,b;

    cin >> a >> b;

    if( a%3==0 || b%3==0 || (a+b)%3==0) cout << "Possible" << endl;
    else cout << "Impossible" << endl;

    return 0;
}


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

int main(){
  string o,e;
  cin >> o >> e;
  int n = max(o.size(),e.size());
  
  rep(i,e.size()){
    cout << o.at(i) << e.at(i);
  }
  if(o.size() == e.size() + 1) cout << o.at(o.size()-1);
  cout << endl;
}


Measured memory_bytes: 256
r=0
while r==0:
        l=""
        i=map(int,raw_input().split())
        if i[0]==i[1]==0:
                break
        while 0 < i[1]:
                l=l+"#"
                i[1]=i[1]-1
        while 0 < i[0]:
                print l
                i[0]=i[0]-1
        print

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define debug(x) cerr << #x << ": " << x << '\n'

typedef long long int ll;
typedef pair<int, int> P;

const long long INF = 3e18 + 12;
const int inf = 1e9;

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

  int n;
  cin >> n;

  vector<int> v(n), va(n);
  rep(i, n) {
    cin >> v[i];
    va[i] = v[i];
  }

  sort(all(v), greater<int>());

  sort(all(va));

  int dp[120];
  int dpp[120];
  dp[0] = 0;
  dpp[0] = 0;

  rep(i, n) {
    int ddd = dpp[i] + va[i];
    dpp[i + 1] = max((dpp[i] % 10 == 0 ? 0 : dpp[i]), (ddd % 10 == 0 ? 0 : ddd));

    debug(dpp[i]);
  }

  rep(i, n) {
    int dd = dp[i] + v[i];
    dp[i + 1] = max((dp[i] % 10 == 0 ? 0 : dp[i]), (dd % 10 == 0 ? 0 : dd));

    debug(dp[i]);
  }

  int sum = 0;
  rep(i, n) {
    sum += v[i];
  }
  int a = 0;

  rep(i, n) {
    if (va[i] % 10 != 0) {
      a = va[i];
      break;
    }
  }
  int b = max(max(dp[n], dpp[n]), ((sum - a) % 10 == 0 ? 0 : sum - a));

  int bb = (sum % 10 == 0 ? 0 : sum);

  cout << max(b, bb) << endl;

  return 0;
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#define ll long long
using namespace std;
int A[1000010], n;

int main() {
    cin >> n;
    for (int i = 0; i < n; ++i) {
        scanf("%d", &A[i]);
    }
    int q, k, sum = 0;
    cin >> q;
    for (int j = 0; j < q; ++j) {
        scanf("%d", &k);
        if (*lower_bound(A, A + n, k) == k)
            sum++;
    }
    cout << sum << endl;
    return 0;
}

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

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

  int x,n;
  cin >> x >> n;

  set<int> st;
  rep(i,n) {
    int p;
    cin >> p;
    st.insert(p);
  }

  int ans = 1e9;
  int min_diff = 1e9;
  for (int i = -1000; i <= 1000; i++) {
    if(st.count(i)) continue;

    if(abs(i - x) < min_diff) {
      ans = i;
      min_diff = abs(i - x);
    }
  }
  cout << ans << '\n';
}


Measured memory_bytes: 3636
// Problem : 
// 			A - Rainy Season
// 			
// 		
// Contest : AtCoder - AtCoder Beginner Contest 175
// URL : https://atcoder.jp/contests/abc175/tasks/abc175_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
using namespace std;
#define X first
#define Y second
#define endl '\n'
#define pb push_back
#define int long long
#define vi vector<int>
#define mii map<int, int>
#define pii pair<int, int>
#define all(x) (x).begin(), (x).end()
#define fill(a,b) memset(a, b, sizeof(a))
#define setbits(x) __builtin_popcountll(x)
#define rep(i,x,y) for(int i=(int)x; i<y; i++)
#define px(a) for(auto x: a) cout<<x<<" "; cout<<endl;
#define pxy(a,n,m) rep(i,0,n) {rep(j,0,m) cout<<a[i][j]<<" "; cout<<endl;}

//--------------------------------------------//

const long long MOD=LLONG_MAX;
void solve()
{
	string s;
	cin>>s;
	int t=0,ans=0;
	rep(i,0,s.length()){
		if(s[i]=='R') t++;
		else{
			ans=max(ans,t);
			t=0;
		}
	}
	ans=max(ans,t);
	cout<<ans<<endl;
}
int32_t main()
{	
	std::ios::sync_with_stdio(false); 
	cin.tie(NULL);
	cout.tie(NULL);
	int t=1; 
	//cin>>t;
	while(t--) solve();
}

Measured memory_bytes: 3644
#include <iostream>

int main(){
  int A[3][3];
  for(int i = 0; i < 3; ++i){
    for(int j = 0; j < 3; ++j){
      std::cin >> A[i][j];
    }
  }
  int N;
  std::cin >> N;
  for(int i = 0; i < N; ++i){
    int b;
    std::cin >> b;
    for(int j = 0; j < 3; ++j){
      for(int k = 0; k < 3; ++k){
        if(A[j][k] == b){
          A[j][k] = 0;
        }
      }
    }
  }

  for(int i = 0; i < 3; ++i){
    if(A[0][i] + A[1][i] + A[2][i] == 0){
      std::cout << "Yes" << std::endl;
      return 0;
    }
    if(A[i][0] + A[i][1] + A[i][2] == 0){
      std::cout << "Yes" << std::endl;
      return 0;
    }
  }
  if(A[0][0] + A[1][1] + A[2][2] == 0){
    std::cout << "Yes" << std::endl;
    return 0;
  }
  if(A[0][2] + A[1][1] + A[2][0] == 0){
    std::cout << "Yes" << std::endl;
    return 0;
  }
  std::cout << "No" << std::endl;
  return 0;
}

Measured memory_bytes: 256
using System;

    class Program {
    static void Main(string[] args) {
        int N = int.Parse(Console.ReadLine());
        int count = 0;
        double JPYs = 0;
        double BTCs = 0;

        while (true) {
            ++count;
            if (count > N) break;

            string[] str = Console.ReadLine().Split(' ');
            double x = double.Parse(str[0]);
            string y = str[1];

            if(y == "JPY") {
                JPYs += x;
            }else if(y == "BTC") {
                BTCs += x;
            }
        }
        
        Console.WriteLine(JPYs + (BTCs * 380000.0));
    }

     
    }


Measured memory_bytes: 13268
def exception_handling(N: int, A: list)->list:
    sorted_A = sorted(A)
    return [sorted_A[-1] if a != sorted_A[-1] else sorted_A[-2] for a in A]


if __name__ == "__main__":
    N = int(input())
    A = [int(input()) for _ in range(N)]
    ans = exception_handling(N, A)
    for a in ans:
        print(a)


Measured memory_bytes: 14752
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
#define endl '\n'
#define pb push_back
#define fi first
#define se second
#define PI acos(-1)
#define all(c) (c).begin(),(c).end()
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define TRACE
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

int modpow(int x, int n, int m) {
	x %= m;
	int res = 1;
	while(n > 0) {
		if(n & 1)
			res = res * x % m;
		x = x * x % m;
		n >>= 1;
	}
	return res;
}

const ll inf = 2e18;
const int mod = 1e9 + 7;
const int N = 1e5 + 10;

signed main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	srand(chrono::steady_clock::now().time_since_epoch().count());
	#ifndef ONLINE_JUDGE
		// freopen("input.txt", "r", stdin);
		// freopen("output.txt", "w", stdout);
	#endif

	int n, k, s;
	cin >> n >> k >> s;
	for(int i = 0; i < k; i++) {
		cout << s << " ";
	}
	int cur = 1000000000;
	if(s == 1000000000) {
		cur = 1000000000 - 1;
	}
	for(int i = k; i < n; i++) {
		cout << cur << " ";
	}

	return 0;
}

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

public class ABC
{
    //          long[] sp = Console.ReadLine().Split().Select(long .Parse).ToArray();
    //          int[] sp = Console.ReadLine().Split().Select(int.Parse).ToArray();
    //          int N =  int.Parse(Console.ReadLine());
    public static void Main()
    {
        int N = int.Parse(Console.ReadLine());
        int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int[] b = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int[] c = Console.ReadLine().Split().Select(int.Parse).ToArray();

        int previous = -20;
        long output = 0;
        for (int i = 0; i < N; i++)
        {
            int now = a[i];
            if (previous + 1 == now)
            {
                output += c[previous - 1];
            }
            output += b[a[i] - 1];
            previous = now;
        }
        Console.WriteLine(output);
    }

}






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

#define ull unsigned long long int
#define ll long long int
#define vll vector<ll>
#define vi vector<int>
#define pll pair<long long, long long>
#define vpll vector < pair<long long,long long> >
#define itr vll::iterator
#define all(c) c.begin(),c.end()
#define pb push_back
#define f first
#define s second
#define mod 1000000007
#define inf 1000000000000000001

#define rep(i, n)      for(ll i = 0; i <  n; ++i)
#define repA(i, a, n)  for(ll i = a; i <= n; ++i)
#define repD(i, a, n)  for(ll i = a; i >= n; --i)

using namespace std;

bool func(const pll &a, const pll &b){
    return a.s < b.s;
}

ll power(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 modInverse(ll a){return power(a,mod-2);}

void solve(){
    string s, t;
    cin >> s >> t;
    rep(i, s.length()) if(s[i] != t[i]){ cout << "No"; return;}
    cout << "Yes";
}
    

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

    int t = 1, tmp = 0;
    // cin >> t;
    while(t--){
        // cout << "Case #" << ++tmp << ": ";
        solve();
        if(t) cout << "\n";
    }
    cerr << "Time : " << (double)clock() / (double)CLOCKS_PER_SEC << "s\n";
    return 0;
}

Measured memory_bytes: 3764
<?php
$n=trim(fgets(STDIN));
$a=array(1,27,703,18279,475255,12356631,321272407,8353082583,217180147159,5646683826135,146813779479511,3817158266467287);
$i=0;
while($a[$i]<=$n){
  if($a[$i]==$n){
    echo str_repeat('a',$i+1);
    exit;
  }
  ++$i;
}
$ans=str_repeat('a',$i);
--$i;
$abc='abcdefghijklmnopqrstuvwxyz';
$n-=$a[$i];
while($n>0){
  $r=$n%26;
  $n=($n-$r)/26;
  $ans[$i]=$abc[$r];
  --$i;
}
echo "$ans\n";

Measured memory_bytes: 16088
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define per(i, a, b) for(int i = (b) - 1; i >= (a); --i)
#define de(x) cout << #x << " = " << x << endl
#define dd(x) cout << #x << " = " << x << " "
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define pw(x) (1ll << (x))
#define endl '\n'
typedef long long ll;
typedef double db;
typedef vector<int> vi;
typedef pair<int, int> pii;

int main() {
	std::ios::sync_with_stdio(0);
	std::cin.tie(0);
	ll n; cin >> n;
	int ans = 0;
	rep(i, 2, 1e6 + 7) if(n % i == 0) {
		int cnt = 0;
		while(n % i == 0) n /= i, ++cnt;
		int now = 1;
		while(cnt >= now) {
			++ans;
			cnt -= now;
			now++;
		}
	}
	if(n != 1) ++ans;
	cout << ans << endl;
	return 0;
}


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

#define DEBUG 0
 

int main() {
    long long N,D;

    cin >> N >> D;

    vector <long long> X(N);
    vector <long long> Y(N);

    for(int i = 0;i < N ;i++){
        cin >> X.at(i) >> Y.at(i);
    }

    int counter = 0;

    for(int i = 0; i < N; i++){
        #if DEBUG
            cout << X.at(i) * X.at(i) + Y.at(i) * Y.at(i) << endl;
        #endif
        
        if(X.at(i) * X.at(i) + Y.at(i) * Y.at(i) <= D * D){
            counter++;
        }
    }

    cout << counter << endl;



  


    return 0;
}




Measured memory_bytes: 6424
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000009
#define ll long long
#define mp make_pair
#define pb push_back
#define nl printf("\n")
#define ff first
#define ss second
#define set0(a) memset ((a), 0 , sizeof(a))
#define set1(a) memset((a),-1,sizeof (a))
#define pi pair<int, int>
#define ps pair<string, string>
#define pl pair<long, long>
#define pll pair<long long, long long>
#define vll vector<long long>
#define vl vector<long>
#define vi vector<int>
#define vs vector<string>
#define vps vector< ps >
#define vpi vector< pi >
#define vpl vector< pl >
#define vpll vector< pll >
#define flash  ios_base::sync_with_stdio(false); cin.tie(NULL);
#define tc(t,T) for(long long t=0;t<T;t++)
#define rep(i,s,n,d) for(long long i=s;i<n;i=i+d)
const int todx[] = { -2, -2, -1, -1,  1,  1,  2,  2 };
const int tody[] = { -1,  1, -2,  2, -2,  2, -1,  1 };
bool sortbysec(const pll &a,
              const pll &b)
{
    return (a.second < b.second);
}
/*bool cxp pair<ll, pll> &a,
              const pair<ll, pll> &b)
{
    return (a.ff < b.ff);
}*/

void func(void)
{
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
}
ll gcd(ll a,ll b){
    if(b==0)return a;
    else return gcd(b,a%b);
}
void printStack(stack<string> s){
    if(s.empty())return;

    string x=s.top();
    s.pop();
    printStack(s);
    cout<<x;
    s.push(x);

}


ll binaryexp(ll n,ll p){

    if(p==0) return 1;
    if(p%2==0) return binaryexp((n%mod)*(n%mod),p/2);
    else return ((n%mod)*binaryexp(((n%mod)*(n%mod))%mod,(p-1)/2)%mod);

}

#define meax 10000001
vll spf(meax,0);
void siv(){
    spf[1]=1;

   for(ll i=2;i<meax;i++)spf[i]=i;

   for(ll i=4;i<meax;i+=2){
        spf[i]=2;
    }
    for(ll i=3;i*i<meax;i++){
        if(spf[i]==i){
            for(ll j=i*i;j<meax;j+=i){
                if(spf[j]==j){
                    spf[j]=i;
                }
            }
        }
    }
}
ll n,m;
vi graph[200007];
int visited[200007];
int count1[2000007];
int max1=0;
void bfs(int i,int c){
    queue<int> q;
    q.push(i);
    visited[i]=c;
    count1[c]++;
    while(!q.empty()){
        int d=q.front();
        q.pop();
        for(auto x: graph[d]){
            if(visited[x]==0){
                q.push(x);
                visited[x]=c;
                  count1[c]++;
            }
        }
    }
    max1=max(count1[c],max1);

}
int main(){
    cin>>n>>m;
    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        graph[a].pb(b);
        graph[b].pb(a);
    }
    int c=1;
    for(int i=1;i<=n;i++){
        if(visited[i]==0){
            bfs(i,c);
            c++;
        }
    }
    cout<<max1<<endl;
}


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

#define ll long long
#define debug(x) cerr << "\n" \
                      << #x << ": " << x << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define all(x) (x).begin(), (x).end()
#define int long long
#define INF 1e9
#define pii pair<int, int>
#define pt(xx) cout << "\n" \
                    << xx << "\n"
#define debugv(x, n)               \
    cout << "\n"                   \
         << #x << ": ";            \
    rep(i, n) cout << x[i] << " "; \
    cout << endl
#define debug2d(x, m, n)            \
    cout << "\n"                    \
         << #x << " is: \n";        \
    for (int i = 0; i < m; ++i)     \
    {                               \
        for (int j = 0; j < n; ++j) \
        {                           \
            cout << x[i][j] << " "; \
        }                           \
        cout << endl;               \
    }
#define nl cout << endl

#define MOD 1000000007

int N, K,L;
int ans;

/* 
int gcd(int m, int n){
    int tmp;
    while (m%n !)
}
*/
int gcd(int a, int b) {
  if(a < b) return gcd(b, a);
  int r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

int lcm(int m, int n){
    return (m*n)/gcd(m,n);
}

int cnt(int n, int c, int d, int l){
    int rt = 0;
    rt += n/c;
    rt += n/d;
    rt -= n/l;
    return (n-rt);
}

signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    //==============================================

    cin>>N;

    vector<int> a(N);
    vector<int> b(N);
    vector<pair<int,int>> A(N);
    rep(i,N){
        cin>>a[i]>>b[i];
        A[i].first = b[i];
        A[i].second = a[i];
    }

    sort(all(A));

    int t = 0;

    ans = 1;
    rep(i,N){
        t += A[i].second;
        if (t > A[i].first) ans = 0;
    }

    


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


    //cout<<ans<<endl;

    


    return 0;
}

Measured memory_bytes: 6528
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back

void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
    ll N, A, B; cin >> N >> A >> B;
    if(A > B) {
        cout << 0 << endl;
        return 0;
    }
    if(N == 1 && A != B) {
        cout << 0 << endl;
        return 0;
    }
    cout << (B * (N - 1) + A) - ((A * (N - 1)) + B) + 1 << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include <stdlib.h>

int main(){
  
  int n,x,i1,i2,i3,i,q,cnt[100];
for(i=0;i<100;i++){
  scanf("%d%d",&n,&x);
  if(n+x==0){break;}
  cnt[i]=0;
  i1=3;i2=2;i3=1;

  for(i2=2;i2<n;i2++){
	  i3=1;
	  i1=x-i2-i3;
	  while(i1>n && i2>i3)
	  {i1--;i3++;}
	  if(i1*i2*i3==0){continue;}
	  if(i1<=i2 || i2<=i3 || i1<=i3){continue;}
	  if(i1+i2+i3==x)
	  {
		  do{cnt[i]++;i1--;i3++;
		  }
		while(i1>i2 && i2>i3);
		
	  }
  }
}
  for(q=0;q<i;q++){
	printf("%d\n",cnt[q]);
  }
  return 0;
}

Measured memory_bytes: 600
N = int(input())
people = {}
for i in range(N):
	ai, bi = map(int, input().split())
	people[ai] = bi
 
max_key = max([(k,v) for k,v in people.items()])[0]
min_key = max([(k,v) for k,v in people.items()])[0]
range_key = max_key - min_key + 1
 
count = people[max_key] + min_key -1 + range_key
print(count)


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

const int mxN = (int)(1e5 + 10);

int main(){
	int N;
	cin >> N;
	int A[mxN];
	int B[mxN];
	for (int i = 1; i <= N; i++) {
		cin >> A[i];
		B[A[i]] = i;
	}
	for (int i = 1; i <= N; i++){
		cout << B[i] << " ";
	}
}

Measured memory_bytes: 1536
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>

namespace adaptor = boost::adaptors;

void solve()
{
    int64_t  N, X, T;
    std::cin >> N >> X >> T;
    int64_t ans;
    if (N % X == 0) ans = N / X;
    else ans = N / X + 1;
    ans *= T;

    std::cout << ans << std::endl;
}

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


Measured memory_bytes: 3636
n = raw_input()

aset = set(n)

alphabets = set("abcdefghijklmnopqrstuvwxyz")

while True:
    if len(n) == 0:
        print -1
        break

    c = n[-1]
    if c == 'z':
        n = n[:-1]
        continue

    if len(aset) != 26:
        print n + min(list(alphabets - aset))
        break

    _next = chr(ord(c)+1)
    n = n[:-1]+_next
    if len(list(set(n))) == len(n):
        print n
        break




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


int main()
{
    ios_base::sync_with_stdio(false);
    long long int a,b,c;
    cin>>a>>b;
    if(b<a)
        swap(a,b);
    for(int i=1;;i++)
    {
        c=a*i;
        if(c%b==0)
        {
            cout<<c<<"\n";
            break;
        }
    }

    return 0;
}


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

const int N = 1010;
const int MOD = 1e9 + 7;
int dp[N][N], n, m;

inline int add(int a, int b) { if ((a += b) >= MOD) a -= MOD; return a; }

int main() {
   ios_base::sync_with_stdio(0);
   cin.tie(0);
   cin >> n >> m;
   dp[0][1] = 1;
   for (int i = 1; i <= n; ++i) {
      for (int j = 1; j <= m; ++j) {
         char c;
         cin >> c;
         if (c == '.')
            dp[i][j] = add(dp[i][j], add(dp[i - 1][j], dp[i][j - 1]));
         
      }
   }
   cout << dp[n][m] << '\n';
   return 0;
}

Measured memory_bytes: 4224