akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define fast_io() ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define ii pair<int,int>
#define iii pair<pair<int,int>,int>
#define f(x,y,z) for(int x = y ; x <= z ; x++)
#define fs(arr,n) for(int i = 1 ; i <= n ; i++) cin >> arr[i];
#define fsm(arr,n,m) for(int i = 1 ; i <= n ; i++) for(int j = 1 ; j <= m ; j++) cin >> arr[i][j];
#define fp(arr,n) for(int i = 1 ; i <= n ; i++) cout << arr[i] << " ";
#define fpm(arr,n,m) for(int i = 1 ; i <= n ; i++){ for(int j = 1 ; j <= m ; j++) {cout << arr[i][j] << " ";} cout << "\n"}
#define N 100005
using namespace std;
int n,m,k;
map <iii,int> mapx;
int main() 
{
    fast_io();
    cin >> n >> m >> k;
    int say =0;
    while(1)
    {
        int a=0,b=0,c=0;
        if(n%2 == 1 ||  m%2 == 1 || k%2 == 1 )
            break;
        if( mapx[mp(mp(n,m),k)] == 1)
        {
			return cout << "-1",0;
		}
        mapx[mp(mp(n,m),k)] = 1;
        say++;
        b += n/2;
        c += n/2;
        
        a += m/2;
        c += m/2;
        
        a += k/2;
        b += k/2;
        n = a;
        m = b;
        k = c;
        //~ cout << n<< " " << m<< " "<< k << "\n";
        
        
    }
    cout << say;
    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=150;
//ここまでテンプレ
//素因数たち
int fact[SIZE]={};
//素因数分解
void func(int N){
	for(int i=2;i<=100;i++){
		while(N%i==0){
			N/=i;
			fact[i]++;
		}
	}
	return;
}
int main(){
	int N;
	cin>>N;
	for(int i=2;i<=N;i++)
		func(i);
	//DP[i][j]=iまでみて、約数がjこになる組み合わせの数
	ll DP[SIZE][SIZE]={};
	DP[0][1]=1;
	for(int i=0;i<100;i++){
		for(int j=0;j<100;j++){
			for(int k=0;k<100;k++){
				if(fact[i]>=k && j*(k+1)<100){
					DP[i+1][j*(k+1)]+=DP[i][j];
				}
			}
		}
	}
	cout<<DP[N][75]<<endl;
	return 0;
}

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

bool cmp(tuple<string, int, int> a, tuple<string, int, int> b) {
    if(get<0>(a) < get<0>(b)) return true;
    else if(get<0>(a) > get<0>(b)) return false;
    else {
        if(get<1>(a) > get<1>(b)) return true;
        else return false;
    }
}

int main() {
    int n;
    cin >> n;
    vector<tuple<string, int, int>> v;
    for(int i = 0; i < n; i++) {
        string s;
        int p;
        cin >> s >> p;
        v.push_back(make_tuple(s, p, i + 1));
    }

    sort(v.begin(), v.end(), cmp);

    for(auto x : v) cout << get<2>(x) << endl;

    return 0;
}

Measured memory_bytes: 384
n=int(input())
freq={}
for x in list(map(int,input().split())):
    if x not in freq:
        freq[x] = 1
    else:
        freq[x] += 1

s = []
ans = [0]
for i, v in sorted(list(freq.items()),reverse=True):
    if v >= 4:
        ans.append(i * i)
    if v >= 2:
        s.append(i)
        if len(s) == 2:
            ans.append(s[0] * s[1])

print(max(ans))


Measured memory_bytes: 21028
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

#define BR "\n"
#define SP " "
#define SHOW(x) for(int i = 0; i < x.size(); i++) { cout << x[i] << SP; } cout << BR;
#define SHOW2(x) for(int j = 0; j < x.size(); j++) { SHOW(x[j]); } cout << BR;

int main() {
  ll N, K;
  cin >> N >> K;

  vector<ll> A(N);

  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }

  ll ans = 0, X = 0;

  for (int j = 41; j >= 0; j--) {

    ll mask = 1LL << j;
    ll count1 = 0;
    for (int i = 0; i < N; i++) {
      count1 += 1 & (A[i] >> j);
    }
    ll count0 = N - count1;

    if ( count1 >= count0 ) {
      ans += mask * count1;

    } else if (X + mask <= K) {
      ans += mask * count0;
      X += mask;

    } else {
      ans += mask * count1;
      
    }
  }

  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi acos(-1.0)

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    cout << s[0] << s.size() - 2 << s[s.size() - 1] <<"\n";
    return 0;
}


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

typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
#define MP make_pair
#define PB push_back
#define X first
#define Y second

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())
#define FILL(a, value) memset(a, value, sizeof(a))
#define debug(a) cerr << #a << " = " << a << endl;

template<typename T> void setmax(T& x, T y) {x = max(x, y);}
template<typename T> void setmin(T& x, T y) {x = min(x, y);}

const double PI = acos(-1.0);
const LL INF = 1e9 + 47;
const LL LINF = INF * INF;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void bad()
{
	cout << "-1\n";
	exit(0);
}

const int N = 1 << 20;
const int M = 1000 * 1000 * 1000;
int n, m;
int e[N];
int d[N];
VI g[N];
map<int, VI> mp;
int ans[N];
char color[N];
char used[N];
bool now[N];
int cnt_dfs;

void dfs(int v, bool rev, int waga, char colir)
{
	cnt_dfs++;
	used[v] = !rev;
	if (!rev)color[v] = colir;
	for(auto I: g[v])
	{
		int i = e[I];
		if (now[i] && used[i] == rev)
		{
			if (!rev) ans[I >> 1] = waga;
			dfs(i, rev, waga, 3 - colir);
		}
	}
}

void solve(int waga, vector<int>& x)
{
	for(auto i: x) now[i] = true;
	for(auto i: x)
	{
		if (used[i]) continue;
		cnt_dfs = 0;
		dfs(i, false, waga, 1);
		if (cnt_dfs == 1) color[i] = 0;
	}
	
	for(auto i: x) if (color[i] == 0)
	{
		for(auto J: g[i])
		{
			int j = e[J];
			if (color[j] > 0)
			{
				color[i] = 3 - color[j];
				ans[J >> 1] = waga;
				break;
			}
		}
		
		if (!color[i]) bad();
	}
	
	for(auto i: x) if (used[i])
		dfs(i, true, -1, 1);
	for(auto i: x) now[i] = false;
}

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	
	cin >> n >> m;
	FOR(i, 0, n) cin >> d[i];
	FOR(i, 0, n) mp[d[i]].PB(i);
	
	FOR(i, 0, m)
	{
		int u, v;
		cin >> u >> v;
		--u; --v;
		e[i * 2] = v;
		e[i * 2 + 1] = u;
		g[u].PB(i * 2);
		g[v].PB(i * 2 + 1);
	}
	
	FOR(i, 0, m) ans[i] = INF;
	
	for(auto i: mp) solve(i.X, i.Y);
	
	FOR(i, 0, n) cout << (color[i] == 1 ? 'B' : 'W');
	cout << endl;
	FOR(i, 0, m) cout << min(M, ans[i]) << '\n';
	
	cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;
	return 0;
}



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

int main()
{
    int A, B, C, D;
    cin >> A >> B >> C >> D;

    int left = A + B;
    int right = C + D;

    if (left > right)
    {
        cout << "Left" << endl;
    }
    else if (left == right)
    {
        cout << "Balanced" << endl;
    }
    else
    {
        cout << "Right" << endl;
    }

    return 0;
}

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

def gcd(a, b):
  while b != 0:
    a, b = b, a % b
  return(a)

g = gcd(A, B)
div = []
for i in range(1, int(g ** 0.5) + 1):
  if g % i == 0:
    div.append(i)
    if g // i != i:
      div.append(g // i)

div.sort()
ans = []
while len(div) != 0:
  d = div.pop(0)
  if d == 1:
    ans.append(d)
    continue
  div_c = div.copy()
  for i in range(len(div_c)):
    if div_c[i] % d == 0:
      div.remove(div_c[i])
  ans.append(d)

print(len(ans))

Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,k,d=1;
    double ans;
    cin >> n >> k;

    for(int i=0;i<n;i++){
        int a,count=0;
        while(d<k){
            d *= 2;
            count++;
        }
        ans += 1/pow(2,count);
        d = i+2;
    }
    double t=ans/n;
    printf("%.10lf\n",t);
}

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

#define mp make_pair
#define eb emplace_back
#define ff first
#define ss second

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const int MAXN = 100;
//#define int long long
const int INF = 1e9;

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int n;
    cin >> n;
    ll sum = 0LL;
    vector<ll> a(n);
    for (int i = 0; i < n; i++) {
    	cin >> a[i];
    }

    sort(a.begin(), a.end());

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

    cout << sum << '\n';
    
    return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef pair <ll, ll> pll;

#define pb push_back
#define mp make_pair
#define all(_c) _c.begin(), _c.end()

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

    int n;
    cin >> n;

    int h[n];
    for (int i = 0; i < n; i++)
        cin >> h[i];
    
    vector <int> dp(n, 0);
    dp[1] = abs(h[1] - h[0]);

    for (int i = 2; i < n; i++)
        dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]));
    
    cout << dp[n - 1] << '\n';
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <cstdio>
#define int long long
using namespace std;

int calc1();
int calc2();
int calc3();

int index,mod;
bool ng = false;
string s;

int pow(int x,int y){
	if(y == 0) return 1;
	int ret = pow(x * x % mod,y / 2);
	if(y % 2) ret = ret * x % mod;
	return ret;
}

int inv(int x){
	if(x == 0) return ng = true;
	return pow(x,mod - 2);
}

int readInt(){
	int tmp = 0;
	while(s[index] >= '0' && s[index] <= '9') tmp = tmp * 10 + s[index++] - '0';
	return tmp % mod;
}

void readSpace(){
	if(index == s.length()) return;
	while(s[index] == ' ') index++;
}

int calc1(){
	readSpace();
	int ret = calc2() % mod;
	while(1){
		if(index == s.length()) return ret;
		else if(s[index] == '+'){
			index++;
			ret = (ret + calc2() % mod) % mod;
		}else if(s[index] == '-'){
			index++;
			ret = (ret + mod - calc2() % mod) % mod;
		}else return ret;
		readSpace();
	}
}

int calc2(){
	readSpace();
	int ret = calc3() % mod;
	while(1){
		if(index == s.length()) return ret;
		else if(s[index] == '*'){
			index++;
			ret = (ret * (calc3() % mod)) % mod;
		}else if(s[index] == '/'){
			index++;
			ret = (ret * inv(calc3() % mod)) % mod;
		}else return ret;
		readSpace();
	}
	return ret;
}

int calc3(){
	int ret = 0;
	readSpace();
	if(s[index] == '('){
		index++;
		ret = calc1();
		index++;
	}else {
		ret = readInt();
	}
	readSpace();
	return ret;
}

signed main(){
	while(1){
		mod = 100000;
		getline(cin,s);
		if(s == "0:") break;
		index = 0;
		ng = false;
		mod = readInt();
		index++;
		readSpace();
		int ans = calc1();
		if(ng) cout << "NG" << endl;
		else {
			string word = "";
			index = 0;
			readInt();
			index++;
			while(index < s.length()){
				if(s[index] != ' ') word += s[index];
				index++;
			}
			cout << word;
			printf(" = %lld (mod %lld)\n",ans,mod);
		}
	}
	return 0;
}

Measured memory_bytes: 3336
#include <bits/stdc++.h>
using namespace std;
 
int main() 
{
    bool flag = false;
    string S;
    cin >> S;
    if (S.find("a") != -1 && S.find("b") != -1 && S.find("c") != -1) {
        flag = true;
    }

    if (flag) {
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
def cumsum(a):
    s = 0
    sums = [0]
    for a_i in a:
        s+=a_i
        sums.append(s)
    return sums

n = int(input())

l1 = tuple(map(int,input().split()))
l2 = tuple(map(int,input().split()))[::-1]

cus1 = cumsum(l1)
cus2 = cumsum(l2)[::-1]

candidates = []
for i in range(n):
  t = cus1[i+1]+cus2[i]
  candidates.append(t)
  
print(max(candidates))

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<map>
using namespace std;
int main() {
  int n,a[100000]={},M=1000000005,b;
  cin >> n;
  for(int i=0; i<n; i++) {
    cin >> a[i];
  }
  sort(a,a+n);
  for(int i=0; i<n-1; i++) {
    if(M>=abs(a[n-1]/2-a[i])) {
      b=i;
      M=abs(a[n-1]/2-a[i]);
    }
  }
  cout << a[n-1] << " " << a[b] << endl;
}


Measured memory_bytes: 640
#include <iostream>
#include<algorithm>
using namespace std;
int main() {
    int N;
    cin>>N;
    int v[30],c[30];
    int sum=0;
    for(int i=0;i<N;++i)cin>>v[i];
    for(int i=0;i<N;++i)cin>>c[i];
    for(int i=0;i<N;++i)v[i]=v[i]-c[i];
    for(int i=0;i<N;++i){
        if(v[i]>0){
            sum+=v[i];
        }
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/dp/tasks/dp_d

#include <iostream>
#include <vector>
#include <array>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <algorithm>
#include <iomanip>

using namespace std;

struct Item {
	long long w;
	long long v;
};

int main (int argc, char* argv[]) {
	long long n, w;
	cin >> n >> w;

	vector<Item> items;
	for (long long i = 0; i < n; i++) {
		long long w, v;
		cin >> w >> v;
		items.emplace_back(Item { w, v });
	}

	vector<vector<long long>> dp(n + 1, vector<long long>(w + 1));
	for (long long i = 1; i < n + 1; i++) {
		const auto& c = items[i - 1];
		for (int j = 1; j <= w; j++) {
			dp[i][j] = max(dp[i - 1][j], j - c.w >= 0 ? dp[i - 1][j - c.w] + c.v : 0);
		}
	}

	cout << dp.back().back() << endl;
}


Measured memory_bytes: 80256
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(i, n) for(int i=0; i<=n; i++)
#define repr(i, n) for(int i=n; i>0; i--)
#define REPR(i, n) for(int i=n; i>=0; i--)
const ll INF = 1LL<<60;
const int INT_INF = 1e9;
const ll MOD = 1e9+7;
template<class T> void puts(T x) { std::cout << x << std::endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;

int main() {
    ll x; cin >> x;
    ll a = x / 11;
    ll b = x % 11;
    if (b == 0) cout << a * 2 << endl;
    else if (b <= 6) cout << a * 2 + 1 << endl;
    else cout << (a + 1) * 2 << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
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;}
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll digsz(ll x){if(x==0) return 1;else{ll ans=0;while(x){x/=10;ans++;}return ans;}}
ll digsum(ll x){ll sum=0;while(x){sum+=x%10;x/=10;}return sum;}
vector<ll> pw2(62,1);vector<ll> pw10(19,1);

int main(){
    ll N,K; cin>>N>>K;
    ll ans=0;
    ll M=(N*(N-1))/2-(N-1);
    
    if(M<K) cout<<-1<<endl;
    else{
        ll need=M-K; //減らす数
        
        cout<<(N-1)+need<<endl;
        FOR(i,2,N+1) cout<<1<<" "<<i<<endl;
        ll now=2;
        while(need>0){
            FOR(i,now+1,N+1){
                cout<<now<<" "<<i<<endl;
                need--;
                if(need==0) return 0;
            }
            now++;
        }
    }
}



Measured memory_bytes: 3596
N, M = [int(_) for _ in input().split()]

def calc(N, M):
    MODE = 10**9+7
    if N > M:
        N, M = M, N
    if M > N + 1:
        return 0
    r = 1
    for i in range(1, N + 1):
        r = (r * i) % MODE
    for i in range(1, M + 1):
        r = (r * i) % MODE
    if N == M:
        r = (r * 2) % MODE
    return r

print(calc(N, M))


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

void yes() { cout << "Yes" << endl; }

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

vector<ll> a, ans;
ll n;
vector<string> s;

void dfs(ll p) {
  if (p == n) {
    yes();
    REP(i, n) { cout << (char)(ans[i] + 'A') << endl; }
    exit(0);
  }

  REP(i, 2) {
    ll plus = s[p][i] - 'A', minus = s[p][i ^ 1] - 'A';
    if (a[minus] == 0) {
      continue;
    }
    a[plus]++, a[minus]--;
    ans.push_back(plus);
    dfs(p + 1);
    ans.pop_back();
    a[plus]--, a[minus]++;
  }
}

int main() {
  cin >> n;
  a = vector<ll>(3, 0);
  REP(i, 3) { cin >> a[i]; }
  s = vector<string>(n);
  REP(i, n) { cin >> s[i]; }
  dfs(0);
  no();
}

Measured memory_bytes: 15132
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e6+10,inf=1e9;
int sum,ans,d,dp[maxn][2],n;
char s[maxn];

int main(){
    memset(dp,-1,sizeof(dp));
    scanf("%s",s+1);
    n=strlen(s+1);
    s[0]='0';
    dp[n][0]=s[n]-'0';
    dp[n][1]=10-dp[n][0];
    for(int i=n-1;i>=0;i--){
        d=s[i]-'0';
        dp[i][0]=min(dp[i+1][1]+d+1,dp[i+1][0]+d);
        dp[i][1]=min(dp[i+1][1]+9-d,dp[i+1][0]+10-d);
    }
    printf("%d\n",dp[0][0]);
}


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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}

int nextInt() { int x; scanf("%d", &x); return x;}
ll nextLong() { ll x; scanf("%lld", &x); return x;}

int main2() {
  int N = nextInt();
  set<int> S;
  REP(i, N) S.insert(nextInt());
  cout << (S.size() == N ? "YES" : "NO") << endl;
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}


Measured memory_bytes: 9600
n=int(input())
a=list(map(int, input().split()))
is_yes = True
a_m = {}
for a_i in a:
  if a_i in a_m:
    is_yes = False
    break
  a_m[a_i]=True
if is_yes:
  print("YES")
else:
  print("NO")

Measured memory_bytes: 32944
#include <stdio.h>
#include <math.h>
 
int main(void){
    int i,n,s[1000];
    double h,sum;
     
    while(1){
 
        scanf("%d",&n);
        if(!n) break;
         
        sum = 0;
        h = 0;
         
        for(i=0;i<n;i++){
            scanf("%d",&s[i]);
            sum += s[i];
        }
     
        sum /= n;
     
   //     printf("%lf ",sum);
         
        for(i=0;i<n;i++){
            h += pow(s[i]-sum, 2.0);
        }
             
        h /= n;
 
   //     printf("%lf ",h);
 
        printf("%lf\n",pow(h,1.0/2.0));
     
    }
     
    return 0;
}


Measured memory_bytes: 2144
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(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) {
    ITR(i,begin(v),end(v))os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) 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> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(0); ios::sync_with_stdio(false);
        cout << setprecision(15) << fixed;
        #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int n;
    cin >> n;
    vector<string> s(n);
    cin >> s;
    set<string> hist;
    auto solve = [&]() {
        char last = '*';
        REP(i, n) {
            if (CONTAIN(hist, s[i])) return false;
            hist.insert(s[i]);
            if (i > 0 && s[i][0] != last) return false;
            last = s[i].back();
        }
        return true;
    };
    cout << (solve() ? "Yes" : "No") << endl;
    return (0^_^0);
}



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

int main(void) {

    string S;
    cin >> S;

    int max_v = 0;
    for(uint8_t i = 0; i < S.size(); i++) {
        for(uint8_t j = i; j <= S.size(); j++) {
            string sub = S.substr(i,j);
            int tmp = 0;
            for(uint8_t k = 0; k < sub.size(); k++){
                if((sub[k] == 'A') || (sub[k] == 'T') || (sub[k] == 'C') || (sub[k] == 'G')) {
                    tmp++;
                } else {
                    break;
                }
            }
            max_v = max(max_v, tmp);
        }
    }

    cout << max_v << endl;
    return 0;

}



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

using namespace std;

long sums(long p){
  int sum=0;
  while(p!=0){
    sum += p%10;
    p/=10;
  }
  return sum;
}

int main(int argc,char* argv[]){
  int N,K;
  int A,step=1,count=1;
  cin >> N >> K;
  for(int i=0;i<N;i++) cin >> A;
  step += (K-1);
  if(step==N) {
    cout << "1" << endl;
      return 0;
  }else {
  while(true){
    step += (K-1);
    count++;
    if(step>=N) break;
  }
  cout << count << endl;
  
  return 0;
  }
}


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

using namespace std;

int main(void){
    vector<int> a(3, 0);
    int K;
    cin >> a[0] >> a[1] >> a[2] >> K;
    sort(a.begin(), a.end());
    
    for(int i=0; i<K; i++) 
        a[2] *= 2;
        
    cout << (a[0] + a[1] + a[2]) << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
int main () 
{
int n,i,j,k;
int p[200010];
double q[200010],r[200010];
double max=0.0;

scanf("%d %d",&n,&k);

for(i=0;i<n;i++)
{
    scanf("%d",&p[i]);
}

q[0]=0;

for(i=1;i<=n;i++)
{

    q[i] = (double)p[i-1]*(p[i-1]+1) / 2 /p[i-1] + q[i-1];
}

for(i=k;i<=n;i++)
{
    r[i] = q[i]-q[i-k];
}


for(j=k;j<=n;j++)
{
    if(max<r[j])
        max = r[j];
}

printf("%lf",max);
return 0;
}

Measured memory_bytes: 4096
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <tuple>
#include <vector>

using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;

#define INF (1e9)

int N;

int main() {
    cin >> N;

    int A, B = INF;
    int ans = 0;
    for (int i = 0; i < N; i++) {
        cin >> A;
        if (A <= B) ans++;
        B = min(A, B);
    }

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


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
#define uid(a, b) uniform_int_distribution<int>(a, b)(rng)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
#define db cout << " HERE " << endl;
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 2000001;
int main() {
	string a , b;
	cin >> b >> a;
	int ab = sz(b)-sz(a);
	int ans = 0;
	F0R(i,ab+1) {
		string k = "";
		FOR(j,i,i+sz(a)) {
			k+=b[j];
		}
		int dw = 0;
		F0R(j,sz(a)) {
		if(a[j]==k[j])
		dw++;
		}
		ans = max(ans,dw);
	}
	cout << sz(a)-ans ;
}
// template by benq


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
using ull = unsigned long long;

int main() {
    string S;
    cin >> S;
    
    int s0=0, s1=0;
    for (int i=0; i<S.size(); i++) {
        if (i%2==0) {
            if (S[i] == '0') s1++;
            else s0++;
        } else {
            if (S[i] == '0') s0++;
            else s1++;
        }
    }

    cout << min(s0, s1) << endl;

    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++) 
#define rep(i,n); for(int i = 0; i < (n); i++)
#define chmin(a,b) if((a)>(b)) (a)=(b); 
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={0,1,0,-1,1,-1,-1,1};
int dy[]={1,0,-1,0,1,1,-1,-1};
const int MOD = 1e9+7;
const int INF = 1e10+10;

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

signed main(){
  int n,m;
  cin>>n>>m;
  vi ans(n,-1);

  rep(i,m){
    int x,y;
    cin>>x>>y;
    x--;
    // s[i]=x;c[i]==y;
    if(n>1&&x==0&&y==0){
      cout<<-1<<endl;
      // cout<<"0xx"<<endl;
      return 0;
    }
    if(ans[x]==y) continue;
    else if(ans[x]==-1) ans[x]=y;
    else{
      cout<<-1<<endl;
      return 0;
    } 
  }

  if(ans[0]==-1) ans[0]=1;
  if(n>1) {if(ans[1]==-1) ans[1]=0;}
  if(n>2) {if(ans[2]==-1) ans[2]=0;}
  if(n==1&&m==0) ans[0]=0;
  rep(i,n) cout<<ans[i];
  cout<<endl;

  return 0;
}

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

using namespace std;

int main() {
	int n; cin >> n;
	long long ans = 0;
	for (int i = 1; i <= n; i++ ) 
		if (i % 3 && i % 5) ans += i;
	cout << ans << endl;
	return 0; 
} 

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
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; }

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, r;
  cin >> n >> r;
  if (n < 10)
    r += 100*(10-n);
  cout << r << endl;
  return 0;
}

Measured memory_bytes: 256
def turtle(x, y):
    tmp = y - 2 * x
    if tmp >= 0 and tmp % 2 == 0:
        return True
    else:
        return False


def crane(x, y):
    tmp = 4 * x - y
    if tmp >= 0 and tmp % 2 == 0:
        return True
    else:
        return False


x, y = map(int, input().split(" "))

if turtle(x, y) and crane(x, y):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 9044
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 9999999

using namespace std;

typedef pair<int, int> P;

int dy[4] = { 0,0,1,-1 };
int dx[4] = { 1,-1,0,0 };
int main() {
	int n;
	cin >> n;
	map<string, int>blue;
	map<string, int>red;
	REP(i, n) {
		string a;
		cin >> a;
		blue[a]++;
	}
	int m;
	cin >> m;
	REP(i, m) {
		string b;
		cin >> b;
		red[b]++;
	}
	int ans = 0;
	for (auto a : blue) {
		if (a.second > red[a.first])ans =max(ans,a.second - red[a.first]);
	}
	cout << ans;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int func(int count,int bused,int q,int sum){
	if(count==0){
		return sum==q?1:0;
	}
	int res = 0;
	for(int i=bused+1;i<=9;++i){
		res += func(count-1,i,q,sum+i);
	}
	return res;
}
bool func2(){
	int a,b;
	cin>>a>>b;
	if(a==0&&b==0){
		return false;
	}
	cout<<func(a,-1,b,0)<<endl;
	return true;
}
int main(){
	while(func2());
	return 0;
}


Measured memory_bytes: 3020
#include <iostream>

using namespace std;

void call(int n)
{
  for (int i = 1; i <= n; i++) {
    int x = i;
    if (!(x % 3) || ((x % 10) == 3)) {
      cout << " " << i;
      continue;
    }
    while (x / 10) {
      x /= 10;
      if ((x % 10) == 3) {
        cout << " " << i;
        break;
      }
    }
  }
  cout << endl;
}

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

  call(n);
}



Measured memory_bytes: 3120
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp():
    '''
    一つの整数
    '''
    return int(input())
def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))
def inpl_str():
    '''
    一行に複数の文字
    '''
    return list(input().split())

n, k = inpl()
ans = 0
for i in range(k, n + 2):
    left = (i - 1) * i // 2
    right = (n - i + 1 + n) * i // 2
    tmp = right - left + 1
    ans+=tmp
print(ans%(10**9+7))

Measured memory_bytes: 10548
#include<bits/stdc++.h>
using namespace std;
#define MAX_V 10000
int V,cmp[MAX_V];
vector<int> G[MAX_V],rG[MAX_V],vs;
bool used[MAX_V];
void addedge(int from,int to){
  G[from].push_back(to);
  rG[to].push_back(from);
} 
void dfs(int v){
  used[v]=1;
  for(int i=0;i<G[v].size();i++)
    if(!used[G[v][i]])dfs(G[v][i]);
  vs.push_back(v);
}
void rdfs(int v,int k){
  used[v]=1;
  cmp[v]=k;
  for(int i=0;i<rG[v].size();i++)
    if(!used[rG[v][i]])rdfs(rG[v][i],k);
}
int scc(){
  memset(used,0,sizeof(used));
  vs.clear();
  for(int v=0;v<V;v++)
    if(!used[v])dfs(v);
  memset(used,0,sizeof(used));
  int k=0;
  for(int i=vs.size()-1;i>=0;i--)
    if(!used[vs[i]])rdfs(vs[i],k++);
  return k;
}
int main(){
  int e;
  cin>>V>>e;
  while(e--){
    int p1,p2;
    cin>>p1>>p2;
    addedge(p1,p2);
  }
  scc();
  cin>>e;
  while(e--){
    int p1,p2;
    cin>>p1>>p2;
    if(cmp[p1]==cmp[p2])cout<<1<<endl;
    else cout<<0<<endl;
  }
}

Measured memory_bytes: 4700
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	int N, K, s = 1;
	cin >> N >> K;
	for (int i = 0; i < N; i++) {
		s = min(s * 2, s + K);
	}
	cout << s << endl;
	return 0;
}

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

LL poww[35],a,b,c,d,ans;

int main()
{
	int T;
	poww[0]=1;
	for(int i=1;i<=30;++i) poww[i]=poww[i-1]*3;
	scanf("%d",&T);
	while(T--) {
		int flag=1;
		scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
		a--,b--,c--,d--,ans=0;
		for(int k=30;k>=0;--k) {
			LL sx=a/poww[k],sy=b/poww[k],tx=c/poww[k],ty=d/poww[k];
			if(sx!=tx&&sy!=ty) break;
			if(sx==tx&&sx%3==1&&abs(sy-ty)>1) {
				LL xl=a/poww[k]*poww[k]-1,xr=xl+poww[k]+1;
				LL dy=abs(b-d),dx=min(abs(xl-a)+abs(xl-c),abs(xr-a)+abs(xr-c));
				ans=dx+dy;
				flag=0;
				break;
			}
			if(sy==ty&&sy%3==1&&abs(sx-tx)>1) {
				LL yl=b/poww[k]*poww[k]-1,yr=yl+poww[k]+1;
				LL dx=abs(a-c),dy=min(abs(yl-b)+abs(yl-d),abs(yr-b)+abs(yr-d));
				ans=dx+dy;
				flag=0;
				break;
			}
		}
		if(flag)
			printf("%lld\n",abs(a-c)+abs(b-d));
		else 
			printf("%lld\n",ans);
	}
}

Measured memory_bytes: 384
n = int(input())
# 文字列内の文字を辞書順ソートしたリストを辞書順ソート
strings = sorted([''.join(sorted(list(input()))) for i in range(n)])
strings.append('XXXXXXXXXX')

ans = 0
s = 0
for i in range(1,n+1) :
    if strings[i] == strings[i-1] :
        s += 1
    else:
        s += 1
        ans += s * (s - 1)
        s = 0
print(int(ans/2))

Measured memory_bytes: 58712
#include<iostream>
#include<algorithm>
#include<string>
#include<sstream>
#include<iomanip>
#include<limits>
#include<deque>
#include<map>
#include<list>
#include<set>
#include <unordered_set>
#include<vector>
#include<cmath>
#include<cstdio>
#include<memory>
#include<bitset>

using namespace std;

int saidaikouyakusuu_gcd(int a, int b) {
	if (a < b) {
		int tmp = a;
		a = b;
		b = tmp;
	}
	while (b) {
		int m = a % b;
		a = b;
		b = m;
	}
	return a;
}

int main(void) {
	int n; cin >> n;
	int a[n];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}

	for (int i = 0; i < n - 1; i++) {
		a[i+1]=saidaikouyakusuu_gcd(a[i], a[i + 1]);
		a[i] = a[i + 1];
	}

	cout << a[n - 1] << endl;

	return 0;
}

Measured memory_bytes: 640
n,m=map(int,input().split())
r=[[] for x in range(n)]
for c in range(m):
    a,b=map(int,input().split())
    r[a-1].append(b-1)
    r[b-1].append(a-1)
s=[-1]*n
s[0]=0
u=[0]
k=1
for c in range(10**5):
    v=[]
    for d in u:
        for e in r[d]:
            if s[e]==-1:
                s[e]=d
                k+=1
                v.append(e)
    if k>n-1:
        break
    u=v
print('Yes')
for c in s[1:]:
    print(c+1)

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

int main(){
	while(1){
		int n;
		cin>>n;
		if(n==0){
			break;
		}
		int len[40];
		for(int i=0;i<n;i++){
			string w;
			cin>>w;
			len[i]=w.size();
		}
		for(int i=0;i<n;i++){
			bool flg=false;
			int sta=0;
			int sum=0;
			for(int j=i;j<n;j++){
				sum+=len[j];
				if(sum==5||sum==12||sum==17||sum==24||sum==31){
					sta++;
				}
				if(sta==5){
					flg=true;
					break;
				}else if(sum>=31){
					break;
				}
			}
			if(flg){
				cout<<i+1<<endl;
				break;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 3216
#ifdef LOCAL111
	#define _GLIBCXX_DEBUG
#else
	#define NDEBUG
#endif
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
const int INF = 1e9;
using namespace std;
template<typename T, typename U> ostream& operator<< (ostream& os, const pair<T,U>& p) { cout << '(' << p.first << ' ' << p.second << ')'; return os; }

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#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(i,0,n)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#ifdef LOCAL111
	#define DEBUG(x) cout<<#x<<": "<<(x)<<endl
	template<typename T> void dpite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
#else
	#define DEBUG(x) true
	template<typename T> void dpite(T a, T b){ return; }
#endif
#define F first
#define S second
#define SNP string::npos
#define WRC(hoge) cout << "Case #" << (hoge)+1 << ": "
template<typename T> void pite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}

typedef long long int LL;
typedef unsigned long long ULL;
typedef pair<int,int> P;

void ios_init(){
	//cout.setf(ios::fixed);
	//cout.precision(12);
#ifdef LOCAL111
	return;
#endif
	ios::sync_with_stdio(false); cin.tie(0);	
}

int main()
{
	ios_init();
	int n,T;
	while(cin >> n >> T) {
		vector<LL> t(n);
		REP(i,n) cin >> t[i];
		LL ans = t.back()-t[0]+T;
		REP(i,n-1){
			if(t[i+1]-t[i] >= T){
				ans -= t[i+1]-t[i]-T;
			}
		}
		cout << ans << endl;
	}	
	return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
    #define ll long long
    #define rep(i,a,b) for(i=a;i<b;i++)
    #define pb push_back
    #define all(v) v.begin(),v.end()
    #define F first
    #define S second
    #define CLR(a) memset((a),0,sizeof(a))
    #define mp make_pair
    #define hell 1000000007

    using namespace std;
     //int g[105][105];
    //vector < int > wt(100004);
   // vector < int > a;
    //vector < int > v(30500);
    //int cst[102][100005];
    //int ansr[100005];
 //ll int sum,x=0,c=0,n,m,flag=0,a1,a2,flag1=0,flag2=0;
    //vector < vector < int > > adj(5000, vector < int > (5000));
 //int  dp[1000006];
   // int level[500];

    void solve()
    {
         ll int i,j=0,r=200,p,q,y=0,ans=0,d,h,flag=0,n,m;
         string s;
         cin>>s;
         rep(i,1,4){
         if(s[i]==s[i-1]) {
            cout<<"Bad"; return;}
         }
         cout<<"Good";

    }



    int main()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
        int t=1;
        //cin>>t;
        while(t--)
        solve();
    }

       /*

  void bfs( int i , int j)
       {
           vis[i][j]= true;
         queue < int > que;
         que.push(k);
         while(!que.empty())
         {
            int x= que.front();
            que.pop();
             for ( int i=1;i<=n;i++)
             {
                 if((!g[1][n] and g[x][i] ) or (g[1][n] and ! g[x][i]))
                 {
                   if(!vis[i])
                   {
                       que.push(i);
                       level[i]=level[x]+1;
                       vis[i]= true;
                   }
                 }
             }
         }
       }

      ll int por(ll int a,ll int b)
         {
            ll int k=1;
            while(b>0)
            {
                if(b%2) k=k*a,k%=hell;
                b/=2;
                a*=a; a%=hell;
            }
            return k;
         } */


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
using namespace std;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;

int n,cnt;
int a[500000];
//llじゃなくて大丈夫か？
int main(){
  int a,b,c,d;cin>>a>>b>>c>>d;
  cout << a+(b/2) << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
  int i, n, x;
  char c;
  int judge = 0, judge2 = 0, judge3 = 0, judge4 = 0;

  scanf("%d", &n);

  for(i = 0; i < n; i++) {
    scanf(" %c %d", &c, &x);
    if(i == 0 && c == ')') judge2 = 1;
    if(i == n - 1 && c == '(') judge3 = 1; 
    if(c == '(') judge += x;
    else {
      judge -= x;
      if(judge < 0) judge4 = 1;
    }
  }

  if(judge == 0 && judge2 == 0 && judge3 == 0 && judge4 == 0) printf("YES\n");
  else printf("NO\n");

  return 0;
}

Measured memory_bytes: 580
#include <iostream>
using namespace std;
int main(){
	int n,state=0,cnt=0;
	string s;
	cin>>n>>s;
	for(int i=0;i<n;i++){
		switch(state){
		case 0:if(s[i]=='A'){
				state++;
			}
			break;
		case 1:if(s[i]=='B'){
				state++;
			} else if(s[i]!='A') {
				state=0;
			}
			break;
		case 2:if(s[i]=='C'){
				cnt++;
				state=0;
			} else if(s[i]=='A') {
				state=1;
			} else {
				state=0;
			}
		}
	}
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)

using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int r; cin >> r;
  cout << r * r << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)
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; }
int main(){
    stack<ll> st;
    char s[256];
    while(scanf("%s", s) != EOF){
        if(s[0]=='+'){
            ll a=st.top();
            st.pop();
            ll b=st.top();
            st.pop();
            st.push(a+b);
        }else if(s[0]=='*'){
            ll a=st.top();
            st.pop();
            ll b=st.top();
            st.pop();
            st.push(a*b);
        }else if(s[0]=='-'){
            ll a=st.top();
            st.pop();
            ll b=st.top();
            st.pop();
            st.push(b-a);
        }else{
            st.push(stoll(s));
        }
    }
    cout<<st.top()<<endl;
    return 0;
}


Measured memory_bytes: 3296
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
//#define INF 810114514
//#define PI 3.141592653589
typedef pair<int,int> PP;
typedef long long ll;
#define int ll
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE do { cout << "No" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl


signed main(void){
    int H,N;
    int A[1514],B[1514];
    int maxA=0;
    cin >> H >> N;
    for(int i=0;i<N;i++){
        cin >> A[i] >> B[i];
        maxA=max(maxA,A[i]);
    }
    //dp[i]=体力がちょうどiのモンスターを倒すのに必要な魔力の最小値
    //もしそのような魔力が存在しない場合、INF
    //INFは10^9くらいあれば足りると思う(適当)
    int dp[20000];
    //H+maxAくらいあれば足りる
    for(int i=0;i<20000;i++){dp[i]=INF;}
    dp[0]=0;
    //体力が0のモンスターを倒すのに必要な魔力は0
    //iは小さい順に決定することができる
    //なぜなら、i<jのとき決定したdp[j]の値はdp[i]に影響しないから
    for(int i=0;i<H;i++){
        //dp[H]から配る遷移は、必ずdp[H]より大きい値を配ることになるので、不要
        //よってH-1までやればOK
        //dp[i]の値はこの時点で確定する
        if(dp[i]==INF)continue;
        for(int j=0;j<N;j++){
            //いわゆる配るDP
            dp[i+A[j]]=min(dp[i+A[j]],dp[i]+B[j]);
        }
    }
    
    //これで答えはdp[H]であるかというと、そうとは限らない
    //なぜなら、dp[H+1]に行くコストがdp[H]に行くコストより安いかもしれないから
    //今回は「与えるダメージがH以上」で条件を達成することができる
    //なので、H以上のdpについて精査して、最もコストが低いものが答えである
    int Ans=INF;
    for(int i=H;i<20000;i++){
        Ans=min(Ans,dp[i]);
    }
    cout << Ans << endl;
    return 0;
}



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

int main() {
  int n;
  cin >> n;
  if (n % 1111 == 0 || n / 10 % 111 == 0 || n % 1000 % 111 == 0 ) {
    cout << "Yes";
  } else {
    cout << "No";
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<algorithm>
#include<iterator>
#include<sstream>
#include<iomanip>
#include<map>
#include<queue>
#include<deque>
#include<fstream>

#define rep(i, n) for (ll i = 0; i < n; i++) 
#define rrep(i, n) for(ll i = n-1; i>=0; i--)
#define range(i, n, m) for (ll i = n; i < m; i++) 
#define rrange(i, n, m) for (ll i = n - 1; i => m; i--) 
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vp vector<pair<ll, ll> >
#define vvp vector<vector<pair<ll, ll> > >
#define First first
#define Second second.first
#define Third second.second
//#define MOD 998244353

typedef long long int ll;
typedef unsigned long long int ull;

using namespace std;

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

ll mydiv(ll a, ll b);
ll modpow(ll a);

ll mydiv(ll a, ll b) {
	a = a % MOD;
	return (a * (modpow(b) % MOD)) % MOD;
}


ll modpow(ll a) {
	ll b = MOD - 2;
	ll res = 1;
	while (b > 0) {
		if (b & 1) res = res * a % MOD;
		a = a * a % MOD;
		b >>= 1;
	}
	return res % MOD;

}


inline ll nCr(ll n, ll r) {
	if (n < r)return 0;
	ll bunbo = 1;
	ll bunsi = 1;
	//ll ret = 0;
	for (ll i = 1; i <= r; i++) {
		bunbo = (bunbo * (n - i + 1)) % MOD;
		bunsi = (bunsi * i) % MOD;
		//ret = (ret + (n - i + 1) / i) % MOD;

	}

	return mydiv(bunbo, bunsi);

}

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


	ll N, K;
	cin >> N >> K;

	vl O(K,0);

	vvl DP(N - K + 5, vector<ll>(K+5));

	DP[0][0] = 1;
	DP[0][1] = 1;
	rep(i, N - K+1) {
		rep(k, K+1) {
			DP[i + 1][k + 1] = (DP[i + 1][k] + DP[i][k + 1]) % MOD;
		}
	}

	vl A(DP[N - K]);




	rep(i, K) {
		if (N - K - i + 1 < 0) {
			O[i] = 0;
			continue;
		}
		O[i] = (DP[N-K-i+1][i + 2] * nCr(K - 1, i)) % MOD;
	}

	rep(i, K) {
		cout << O[i] << endl;
	}
	


	return 0;
}



Measured memory_bytes: 8064
import math
import string


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//math.factorial(n-r)*math.factorial(r)


n, k = map(int, input().split())
cnt = 0
while(n > 0):
    n //= k
    #print(n)
    cnt += 1
print(cnt)


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

int main() {

	int n;
	scanf("%d", &n);
	vector<long long>  luca(100);
	luca[0] = 2;
	luca[1] = 1;
	for(int i =2; i < n + 1; i++) {
		luca[i] = luca[i - 2] + luca[i - 1];
	}
	printf("%lld\n", luca[n]);
}

Measured memory_bytes: 256
n = int(input())
h = [int(i) for i in input().split()]
h.reverse()

ans = 'Yes'
for i in range(1, n):
    if h[i] > h[i - 1] + 1:
        ans = 'No'
        break
    if h[i] == h[i - 1] + 1:
        h[i] -= 1

print(ans)


Measured memory_bytes: 14252
#include <bits/stdc++.h>
using namespace std;
#define ll long long int

ll sum(ll a, ll b){
    ll count=0;
    count=(b-a+1)*(a+b)/2;
    return count;
}
int main(void){
    ll N=0,M=0;
    cin >> N >>M;
    ll s=0;
    
    for(ll i=M;i<=N+1;i++){
        s+=(sum(N+1-i,N)-sum(0,i-1)+1);
    }
    
    
    cout << s%1000000007 << endl;
}

Measured memory_bytes: 3608
#include <iostream>
#include <numeric>
#include <math.h>
#include <algorithm>
#include <float.h>
#include <limits>
#include <vector> 
#include <string.h>
#include <iomanip>

#define rep(i,a,n) for(ll int (i) = (a);(i) < (n);(i)++)
#define urep(i,a,n) for(ll int (i) = (a);(i) > (n);(i)--)
#define MOD 1000000007
#define INF 2147483647
#define ll long long
#define asort(a) sort(a.begin(),a.end());//昇順ソート
#define usort(a) sort(a.rbegin(),a.rend());//降順ソート

using namespace::std;

int jo(ll int a, ll int b){//累乗
    ll int num=1;
    rep(i,0,b) num=num*a;
    return num;
}
char tobig(char s){//char大文字化
  return (s-0x20);
}
char tolow(char s){//char小文字化
  return (s+0x20);
}
int ctoi(char a){//char->int
  if('0'<=a&&a<='9') return (a-'0');
  return -1;
}

int gcd(ll int a,ll int b) {//最大公約数
  if(a<b) return gcd(b,a);
  int c;
  while ((c=a%b)) {
    a=b;
    b=c;
  }
  return b;
}
int lcm(ll int a,ll int b){//最小公倍数
 return (a*b)/gcd(a,b);
}


int main(){
  int A,B,C; cin>>A>>B>>C;
  if(A==B&&B==C) cout<<"Yes";
  else cout<<"No";
}




// vector<vector<int>> 変数名(左の個数, vector<int>(右の個数));

//cout<<fixed<<setprecision(n);  //小数点n桁まで表示

//  vector<pair<int,int>> data(N);  //2つのデータを格納、.first/.secondで参照
// pairのソートはfirst優先の昇順


Measured memory_bytes: 256