akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    boolean result = false;
    for (int i = 1; i <= 9; i++) {
      if (a % i == 0) {
        int b = a / i;
        if (b >= 1 && b <= 9) {
          result = true;
          break;
        }
      }
    }
    System.out.println(result ? "Yes" : "No");
  }
}

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

using namespace std;

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

#define print(a) {for(auto xxxxx : (a)) cout << xxxxx << ' '; cout << '\n';}
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

ll next(){ll x; cin >> x;return x;}
const int maxn = 3e5 + 2, intf = 2e9;
const ll inf = 2e18, mod = 998244353;
const ld eps = 1e-9;


void solve(){
	int x , y , z; cin >> x >> y >> z;
	swap(x , y);
	swap(x , z);
	cout << x << ' ' << y << ' ' << z << '\n';
}

signed main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cout.precision(20);
    
    for (int t = 1; t--;) solve();

	return 0;
}
/*


*/



Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
const int inf=1e9+7;
const ll INF=1e18;

int main(){
    int n;cin>>n;
    map<int,int> b;
    int ma=0;
    int mi=inf;
    rep(i,n){
        int a;cin>>a;
        b[a]++;
        mi=min(mi,a);
        ma=max(ma,a);
    }
    int ans=0;
    rep2(i,mi,ma+1)ans=max(ans,b[i-1]+b[i]+b[i+1]);
    cout<<ans<<endl;
}

Measured memory_bytes: 4992
# C - Vacation
N = int(input())
A = []
for _ in range(N):
    a,b,c = map(int,input().split())
    A.append((a,b,c))
    
# 無限大の値
INF = 10**10

# DP テーブル (値と前に選んだ活動を保持)
# a (j = 0), b (j = 1), c (j = 2)に記録
dp = [[0]*3 for _ in range(100010)]

# DP テーブル全体を初期化
for i in range(100010):
    for j in range(3):
        dp[i][j] = -INF# 最大化問題
        
# 初期条件
dp[0][0],dp[0][1],dp[0][2] = 0,0,0
        
# v 日目以前に (v 日目以前の幸福度最大値を求める)
for v in range(1,N+1):
    # v-1 日目の活動
    for w in range(3):
        # v 日目の活動
        for k in range(3):
            # 前日と活動が同じならスルー
            if w == k:
                continue
            # v 日目の情報は A[v-1] であることに注意
            dp[v][k] = max(dp[v][k], dp[v-1][w] + A[v-1][k])

# N 日目以前の幸福度最大値を出力
ans = max(dp[N])            
print(ans)

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

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

	int ans = 0;
	vector<int> x(n);
	vector<int> cnt(100001);
	for (int i = 0; i < n; i++) {
		scanf("%d", &x[i]);
		cnt[x[i]]++;
	}

	vector<int> cnt2(m);
	vector<int> p(m);
	for (int i = 0; i <= 100000; i++) {
		cnt2[i % m] += cnt[i];
		p[i % m] += cnt[i] / 2;
	}

	for (int i = 0; i < m; i++) {
		int j = (m - i) % m;
		if (i != j) {
			if (cnt2[i] > cnt2[j]) {
				ans += cnt2[j];
				ans += min((cnt2[i] - cnt2[j]) / 2, p[i]);
			} else {
				ans += cnt2[i];
				ans += min((cnt2[j] - cnt2[i]) / 2, p[j]);
			}
			cnt2[i] = 0;
			cnt2[j] = 0;
			p[i] = 0;
			p[j] = 0;
		} else {
			ans += cnt2[i] / 2;
			cnt2[i] = 0;
		}
	}
	cout << ans << endl;
}

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

const int dx[] = {0, -1, 1, 0};
const int dy[] = {-1, 0, 0, 1};

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    LL X;
    cin >> X;

    vector<LP> v;
    LL t = 1;
    while(t * t * t * t * t <= 1e18) {
        LL tmp = t * t * t * t * t;
        v.pb(MP(t, tmp));
        v.pb(MP(-t, -tmp));
        ++t;

    }
    v.pb(MP(0, 0));

    for(int i = 0; i < v.size(); ++i) {
        for(int j = 0; j < v.size(); ++j) {
            if(v[i].S - v[j].S == X) {
                cout << v[i].F << " " << v[j].F << endl;
                return 0;

            }
        }
    }
    return 0;
}



Measured memory_bytes: 3784
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cctype>
using namespace std;

namespace zyt
{
	template<typename T>
	inline bool read(T &x)
	{
		char c;
		bool f = false;
		x = 0;
		do
			c = getchar();
		while (c != EOF && c != '-' && !isdigit(c));
		if (c == EOF)
			return false;
		if (c == '-')
			f = true, c = getchar();
		do
			x = x * 10 + c - '0', c = getchar();
		while (isdigit(c));
		if (f)
			x = -x;
		return true;
	}
	template<typename T>
	inline void write(T x)
	{
		static char buf[20];
		char *pos = buf;
		if (x < 0)
			putchar('-'), x = -x;
		do
			*pos++ = x % 10 + '0';
		while (x /= 10);
		while (pos > buf)
			putchar(*--pos);
	}
	typedef long long ll;
	const int N = 60, P = 1e9 + 7;
	int n, f[N][N], C[N][N];
	int work()
	{
		for (int i = 0; i < N; i++)
		{
			C[i][0] = 1;
			for (int j = 1; j <= i; j++)
				C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % P;
		}
		read(n);
		f[1][0] = f[1][1] = n;
		for (int i = 1; i <= n; i++)
			for (int j = 0; j <= i; j++)
			{
				for (int k = max(j, 1); i + k <= n; k++)
				{
					if ((k - j) & 1)
						continue;
					int tmp = (k - j) / 2;
					for (int a = 0; a <= k; a++)
						f[i + k][abs(a - tmp)] = 
							(f[i + k][abs(a - tmp)] + (ll)f[i][j] * C[n - i][k] % P * C[k][a]) % P;
				}
			}
		write(f[n][0]);
		return 0;
	}
}
int main()
{
	return zyt::work();
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i=0;i < (int)(n);i++)
int n;

void dfs(string s, char mx){
    if (s.size() == n){
        cout << s << endl;
    }
    else{
        for (char c = 'a';c <= mx;c++){
            dfs(s+c,((c == mx) ? char(c+1):mx));
        }
    }
}

int main(){
    cin >> n;
    dfs("",'a');
    return 0;
    
}

Measured memory_bytes: 1536
#include <iostream>
#include <vector>

int main() {
	int N, M, X;
	std::cin >> N >> M >> X;

	int leftCost = 0;
	int rightCost = 0;

	for(int i = 0; i < M; i++) {
		int A;
		std::cin >> A;

		// A[i] != A[j]
		if(A < X) {
			leftCost++;
		} else {
			rightCost++;
		}
	}

	printf("%d\n", (leftCost < rightCost ? leftCost : rightCost));

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fir first
#define sec second
#define mp std::make_pair
#define Pair std::pair<int, std::string>
#define Map std::map< std::string, int >
#define Vector std::vector<int>

typedef long long ll;
typedef unsigned long long ull;

const int N = 1e5 + 5;
const int MOD = 1e9 + 7;

inline int read() {
    int res = 0;
    char ch = getchar();
    for (; !isdigit(ch); ch = getchar());
    for (; isdigit(ch); ch = getchar()) res += ch - '0';
    return res;
}

struct Data {
    int ddl, val;

    Data() {}
    Data(int ddl, int val) : ddl(ddl), val(val) {}
    bool operator<(const Data &other) const {
        return ddl > other.ddl;
    }
} p[N];

int n, m;

int main() {
    std::cin >> n >> m;
    for (int i = 1; i <= n; i++) {
        int a, b;
        scanf("%d %d", &a, &b);
        p[i] = Data(m - a + 1, b);
    }
    std::sort(p + 1, p + n + 1);
    ll ans = 0;
    std::priority_queue<int> q;
    for (int i = m, j = 1; i >= 1; i--) {
        while (j <= n && p[j].ddl >= i) {
            q.push(p[j].val);
            j++;
        }
        if (!q.empty()) ans += q.top(), q.pop();
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 1660
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << 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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) 
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P) 
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) 
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s; }



string str;

int main() {
    while (cin >> str) {
        string res = "";
        for (int i = 0; i < str.size(); ++i) {
            int id = str[i] - 'A';
            int nid = (id + 23) % 26;
            char c = 'A' + nid;
            res += c;
        }
        cout << res << endl;
    }
    return 0;
}


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

using namespace std;

using ll = long long;

int N;

int main(){
    cin >> N;
    cin.ignore();

    ll sum = 0;
    for(int i = 1; i <= N - 1; i++){
        ll pls = N / i;
        if(N % i == 0) --pls; // C==0はカウントなし！
        sum += pls;
    }
    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 3624
#include<iostream>
using namespace std;
#include<cstdio>
#include<utility>
#include<vector>

int main()
{
	int i, j, n, m, from, to, cost;
	scanf("%d %d", &n, &m);

	int D[100][100];
	bool check[100][100];

	for(i = 0; i < n; i++){
		for(j = 0; j < n; j++){
			check[i][j] = false;
		}
	}

	for(i = 0; i < n; i++){ D[i][i] = 0; check[i][i] = true; }
	for(int k = 0; k < m; k++){
		scanf("%d %d %d", &from, &to, &cost);
		D[from][to] = cost;
		check[from][to] = true;
	}

	for(int mid = 0; mid < n; mid++){
		for(i = 0; i < n; i++){
			for(j = 0; j < n; j++){
				if(check[i][mid] && check[mid][j]){
					if(check[i][j]){
						if(D[i][j] > D[i][mid] + D[mid][j]){
							D[i][j] = D[i][mid] + D[mid][j];
						}
					}else{
						D[i][j] = D[i][mid] + D[mid][j];
						check[i][j] = true;
					}
				}
			}
		}
	}
	for(i = 0; i < n; i++){
		if(D[i][i] < 0){
			printf("NEGATIVE CYCLE\n"); break;
		}
	}
	if(i == n){
		for(i = 0; i < n; i++){
			for(j = 0; j < n; j++){
				if(check[i][j]){
					printf("%d", D[i][j]);
				}else{
					printf("INF");
				}
				if(j < n - 1){ printf(" "); }
			}
			printf("\n");
		}
	}
	return 0;
}

Measured memory_bytes: 1240
/*2019/10/02 */
/*template*/
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#define MOD 1000000007
#define MIN 999999999
#define MAX -999999999
typedef long long int ll;
typedef unsigned long long int ull;
void llswap(ll *x,ll *y){ll tmp;tmp=*x;*x=*y;*y=tmp;}
void swap(int *x,int *y){int tmp;tmp=*x;*x=*y;*y=tmp;}
void swap_c(char *x,char *y){char tmp;tmp=*x;*x=*y;*y=tmp;}
int rmax(int x,int y){return x>y?x:y;}
int rmin(int x,int y){return x>y?y:x;}
ll llrmax(ll x,ll y){return x>y?x:y;}
ll llrmin(ll x,ll y){return x>y?y:x;}
int asc(const void *a,const void *b){if(*(int*)a < *(int*)b)return -1;else if(*(int*)a == *(int*)b)return 0;else return 1;}
int desc(const void *a,const void *b){if(*(int*)a < *(int*)b)return 1;else if(*(int*)a == *(int*)b)return 0;else return -1;}
int llasc(const void *a,const void *b){if(*(ll*)a < *(ll*)b)return -1;else if(*(ll*)a == *(ll*)b)return 0;else return 1;}
int lldesc(const void *a,const void *b){if(*(ll*)a < *(ll*)b)return 1;else if(*(ll*)a == *(ll*)b)return 0;else return -1;}
int gcd(int x,int y){if(y==0)return x;return gcd(y,x%y);}
 
/*
int asc_t(const void *a,const void *b){if((pair_t*)a->d < (pair_t*)b->d)return -1;else if((pair_t*)a->d == (pair_t*)b->d)return 0;else return 1;}
int desc_t(const void *a,const void *b){if((pair_t*)a->d < (pair_t*)b->d)return 1;else if((pair_t*)a->d == (pair_t*)b->d)return 0;else return -1;}
*/

int main(){
    char s[200],t[200];
    scanf("%s",s);
    scanf("%s",t);

    for(int i=0;s[i+1]!='\0';i++){
        for(int j=i+1;s[j]!='\0';j++){
            if(s[i]>s[j]){
                swap_c(&s[i],&s[j]);
            }
        }
    }
    for(int i=0;t[i+1]!='\0';i++){
        for(int j=i+1;t[j]!='\0';j++){
            if(t[i]<t[j]){
                swap_c(&t[i],&t[j]);
            }
        }
    }
    
    printf("%s",strcmp(s,t)<0?"Yes\n":"No\n");
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<bitset>
#include<set>
#define N (200010)
#define P ()
#define M ()
#define inf (0x7f7f7f7f)
#define rg register int
#define Label puts("NAIVE")
#define spa print(' ')
#define ent print('\n')
#define rand() (((rand())<<(15))^(rand()))
#define file(s) freopen(s".in","r",stdin),freopen(s".out","w",stdout)
typedef long double ld;
typedef long long LL;
typedef unsigned long long ull;
using namespace std;
namespace fastIO1{
	inline char read(){
		static const int IN_LEN=1000000;
		static char buf[IN_LEN],*s,*t;
		return (s==t?t=(s=buf)+fread(buf,1,IN_LEN,stdin),(s==t?-1:*s++):*s++);
	}
	template<class T>
	inline void read(T &x){
		static bool iosig;
		static char c;
		for(iosig=false,c=read();!isdigit(c);c=read()){
			if(c=='-')iosig=true;
			if(c==-1)return;
		}
		for(x=0;isdigit(c);c=read())x=((x+(x<<2))<<1)+(c^'0');
		if(iosig)x=-x;
	}
	inline char readc(char &c){
		for(c=read();!isalpha(c)&&!isdigit(c);c=read())
		if(c==-1)return 0;
	}
	const int OUT_LEN = 10000000;
	char obuf[OUT_LEN],*ooh=obuf;
	inline void print(char c) {
		if(ooh==obuf+OUT_LEN)fwrite(obuf,1,OUT_LEN,stdout),ooh=obuf;
		*ooh++=c;
	}
	template<class T>
	inline void print(T x){
		static int buf[30],cnt;
		if(x==0)print('0');
		else{
			if(x<0)print('-'),x=-x;
			for(cnt=0;x;x/=10)buf[++cnt]=x%10+48;
			while(cnt)print((char)buf[cnt--]);
		}
	}
	inline void flush(){fwrite(obuf,1,ooh-obuf,stdout);}
}
namespace fastIO2{
	template<class T>
	inline void read(T &x){
		static bool iosig;
		static char c;
		for(iosig=false,c=getchar();!isdigit(c);c=getchar()){
			if(c=='-')iosig=true;
			if(c==-1)return;
		}
		for(x=0;isdigit(c);c=getchar())x=((x+(x<<2))<<1)+(c^'0');
		if(iosig)x=-x;
	}
}
using namespace fastIO1;
#define int long long
#define fi first
#define se second
#define mkp make_pair
int n,m,now,a[N]; pair<int,int> pos[N];
LL ans; vector<pair<pair<int,int>,pair<int,int> > >t,tmp;
vector<pair<int,int> > wk,pp;
int calc(vector<pair<int,int> > &a){
	LL sum=0,ans=0;
	for(int i=0,j=m-1;j<a.size();i++,j++)
	sum+=a[i].fi,ans+=sum*a[j].se;
	return ans;
}
signed main(){
	read(n),read(m),ans=n;
	for(int i=1;i<=n;i++)read(a[i]),pos[i]=mkp(a[i],i);
	sort(pos+1,pos+n+1);
	for(int p=1,val=0;p<=n||!t.empty();){
		if(t.empty())val=pos[p].fi;else val++;
		for(;pos[p].fi==val;p++)t.emplace_back(mkp(pos[p].se,pos[p].se),mkp(1,1));
		tmp.clear(),sort(t.begin(),t.end());
		for(int i=0,j=0;i<t.size();i=j+1){
			for(j=i;j+1<t.size()&&t[j+1].fi.fi==t[j].fi.se+1;j++);
			int len=j-i+1,cnt=len/m;
			if(cnt){
				wk.clear();
				for(int k=i;k<=j;k++)wk.push_back(t[k].se);
				ans+=calc(wk),wk.clear(),wk.resize(cnt),pp.clear();
				for(int k=1;k<=cnt;k++)
				pp.emplace_back(t[i].fi.fi+k-1,(k==cnt)?t[j].fi.se:t[i].fi.fi+k-1);
				for(int k=i;k<=j;k++){
					int l=k-i+1,r=j-k+1;
					if(l>=m)wk[l/m-1].se+=t[k].se.se;
					if(r>=m)wk[cnt-r/m].fi+=t[k].se.fi;
				}
				ans-=calc(wk);
				for(int k=0;k<pp.size();k++)tmp.emplace_back(pp[k],wk[k]);
			}
		}
		t=tmp;
	}
	cout<<ans;
}

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

int main(){
    int n,m,X,Y;
    cin>>n>>m>>X>>Y;
    int x[n],y[m];
    for(int i =0;i<n;i++)cin>>x[i];
    for(int i= 0;i<m;i++)cin>>y[i];
    sort(x,x+n);
    sort(y,y+m);
    if(x[n-1]>X)X = x[n-1];
    if(y[0]<Y)Y = y[0];
    if(Y>X)cout<<"No War"<<endl;
    else cout<<"War"<<endl;
}


Measured memory_bytes: 256
X,N = map(int,input().split())
p = list(map(int,input().split()))
if p.count(X) == 0:
    print(X)
else:
    for i in range(1,101):
        if p.count(X - i) == 0:
            print(X - i)
            break
        if p.count(X + i) == 0:
            print(X + i)
            break

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
int PAIR[6050];
string dp[6050];

int main() {
    //cout.precision(10);
    int N;
    string S;
    cin >> N >> S;
    S = "#" + S;
    queue<int> a, b;
    for(int i = 1; i <= 2*N; i++) {
        if(S[i] == 'a') a.push(i);
        else b.push(i);
    }
    for(int i = 1; i <= N; i++) {
        int A = a.front();
        int B = b.front();
        a.pop();
        b.pop();
        PAIR[A] = B;
        PAIR[B] = A;
    }
    for(int i = 1; i <= 2*N; i++) {
        //cerr << PAIR[i] << endl;
    }
    for(int index = 2*N; index >= 1; index--) {
        dp[index] = dp[index + 1];
        if(PAIR[index] < index) continue;
        if(S[index] == 'a') {
            string sub = "ab" + dp[PAIR[index] + 1];
            dp[index] = max(dp[index], sub);
            continue;
        }
        if(S[index] == 'b') {
            string sub = "b";
            int plus = 1;
            int sub_index = index + 1;
            for(; plus > 0; sub_index++) {
                if(S[sub_index] == 'b') {
                    sub += "b";
                    plus++;
                    continue;
                }
                if(sub_index < PAIR[index]) continue;
                sub += "a";
                plus--;
            }
            sub += dp[sub_index];
            dp[index] = max(dp[index], sub);
        }
    }
    cout << dp[1] << endl;
    return 0;
}


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

#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define FOR(i, a, b) for (int i = a; i <= (int)(b); i++)
#define FORD(i, a, b) for (int i = a; i >= (int)(b); i--)

#define SIZE_OF_ARRAY(array) (sizeof(array) / sizeof(array[0]))
using Lint = long long;
#define INF 1000000000000
#define MOD 1000000007 //10^9+7:合同式の法

#define ALL(x) (x).begin(), (x).end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

#define PB push_back
#define MP make_pair
using P = pair<int, int>;
using V = vector<double>;
using M = map<int, int>;
using S = set<int>;
#include <math.h>
#define COUT(x) cout << (x) << endl
#define SCOUT(x) cout << (x) << " "

#define DUMP(x) cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl


#include <iostream>
#include <vector>

using Graph = vector<vector<int>>;

// 深さ優先探索
vector<bool> seen;
void dfs(const Graph &G, int v) {
    seen[v] = true; // v を訪問済にする

    // v から行ける各頂点 next_v について
    for (auto next_v : G[v]) { 
        if (seen[next_v]) continue; // next_v が探索済だったらスルー
        dfs(G, next_v); // 再帰的に探索
    }
}

int main() {
    // 頂点数と辺数、s 
    int N, M; cin >> N >> M;

    // グラフ入力受取
    Graph G(N);
    for (int i = 0; i < M; ++i) {
        int a, b;
        cin >> a >> b;
        G[a-1].push_back(b-1);
        G[b-1].push_back(a-1);
    }

    // 頂点 s をスタートとした探索
    seen.assign(N, false); // 全頂点を「未訪問」に初期化
 int count =0;
  for(int v=0;v<N;++v){  
  	if(seen[v])continue;
    dfs(G, v);
    ++count;
  }
    COUT(count-1);
}

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

#define IOS                               \
	ios_base::sync_with_stdio(false); \
	cin.tie(0);                       \
	cout.tie(0);                      \
	cin.exceptions(cin.failbit);
#define int long long int //Comment when Unnecessary
#define ll long long
#define sz(a) (int)((a).size())
#define all(a) a.begin(), a.end()
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define trav(a, x) for (auto &a : x)
#define pii pair<int, int>
#define vi vector<int>
#define F first
#define S second
#define endl "\n" // Remove on Interactive

const int N = 300009;
const int mod = 1000000007;

void pre()
{
}

int32_t main()
{
	IOS;
	pre();
	int n, a, b;
	cin >> n >> a >> b;
	int itne = n / (a + b);
	int ans = a * itne;
	ans += min(a, n - (itne * (a + b)));
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
// ABC049A - 

#include <bits/stdc++.h>
using namespace std;

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

int main() {
	char c;
	cin >> c;
	if ((c == 'a')||(c == 'e')||(c == 'i')||(c == 'o')||(c == 'u')) {
		cout << "vowel" << endl;
	} else {
		cout << "consonant" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
import java.io.{BufferedOutputStream, BufferedReader, InputStreamReader, PrintWriter}

object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val out = new PrintWriter(new BufferedOutputStream(System.out))
    val Array(n, m) = in.readLine().split("\\s+").map(_.toInt)

    val vertices = Array.fill(n + 1)(0)

    for (i <- 0 until m) {
      in.readLine().split("\\s+").map(_.toInt) match {
        case Array(a, b) =>
          vertices(a) = (vertices(a) + 1) % 2
          vertices(b) = (vertices(b) + 1) % 2
      }
    }

    out.println(
      if (vertices.forall(_ == 0)) {
        "YES"
      } else {
        "NO"
      }
    )

    out.flush()
  }
}

Measured memory_bytes: 67576
#include <iostream>
#include <fstream>
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <numeric>
#include <functional>
#include <string> 
#include <vector>
#include <bitset>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define REP(i,n) for(int i = 0; i < int(n); i++)
#define REREP(i,n) for(int i = int(n - 1); i >= 0; i--)
#define FOR(i, m, n) for(int i = int(m);i < int(n);i++)
#define REFOR(i, m, n) for(int i = int(n - 1);i >= int(m);i--)
#define ALL(obj) (obj).begin(),(obj).end()

#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VD vector<double>
#define VVD vector<vector<double>>
#define VVVD vector<vector<vector<double>>>
#define VL vector<ll>
#define VVL vector<vector<ll>>
#define VVVL vector<vector<vector<ll>>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define VVVB vector<vector<vector<bool>>>
#define VS vector<string>
#define VVS vector<vector<string>>
#define VVVS vector<vector<vector<string>>>

#define PII pair<int,int>
#define PDD pair<double,double>
#define PLL pair<ll,ll>
#define VPII vector<pair<int,int>>
#define VVPII vector<vector<pair<int,int>>>
#define VVVPII vector<vector<vector<pair<int,int>>>>
#define VPLL vector<pair<ll,ll>>
#define VVPLL vector<vector<pair<ll,ll>>>
#define VVVPLL vector<vector<vector<pair<ll,ll>>>>

int main() {
	string S; cin >> S;
	int ans = 101;
	REP(i,26){
		char query = 'a' + i;
		VI cnt(100, 0);
		int k = 0;
		REP(j,S.size()){
			if(S[j] != query)cnt[k]++;
			else k++;
		}
		ans = min(ans, *max_element(ALL(cnt)));
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;


public class Main {

    public static void main(String[] args) {

    	Main main=new Main();

    	main.run();

    }

    void run() {

    	Scanner sc=new Scanner(System.in);
    	
    	int N=sc.nextInt();
    	int A=sc.nextInt();
    	
    	int result=N*N-A;
    	
    	System.out.println(result);
    }
}


Measured memory_bytes: 21844
import java.util.Scanner;

public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){

			int R = scan.nextInt();
			int G = scan.nextInt();
			int B = scan.nextInt();
			int N = scan.nextInt();


			int count = 0;

			for(int r = 0;R*r<=N;r++) {
				for(int g = 0;G*g<=N-R*r;g++) {
					int S = N-R*r-G*g;

					if(S>=0&&S%B==0) {
						//System.out.println(r+" "+g+" "+S/B);
						count++;
					}
				}
			}


			System.out.println(count);



		}


	}


}


Measured memory_bytes: 35892
#include<stdio.h>

int main(void)
{
  char s[3];
  int a,b,c=0;
  scanf("%s",s);

  for(int i=0;i<3;i++)
  {
    if(s[i]=='a'){
      a++;
    }
    else if(s[i]=='b'){
      b++;
    }
    else if(s[i]=='c'){
      c++;
    }
  }
  if(a==1&&b==1&&c==1){
    printf("Yes\n");
  }
  else{
    printf("No\n");
  }
  return 0;
}


Measured memory_bytes: 128
//includes
#include<iostream>
#include<vector>
#include<set>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<map>
#include<queue>
#include<iomanip>
#include<numeric>
#include<assert.h>
#include<cstring>
#include<unordered_map>
#include<bitset>


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

//macros and consts
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(),(a).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define FORE(i,a) for(auto &i : a)
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define accm accumulate
#define Fi first
#define Se second
#define INF 1e9
#define llINF (1LL<<60)
#define mINF -1e9
#define mllINF -(1LL<<60)
#define endl "\n"
#define CONT continue
#define BRK break
#define modulo(n, m) (((n)%(m)+(m))%m)

//shorter types
using namespace std;
using ll = long long;
using vi = std::vector<int>;
using vc = std::vector<char>;
using vll = std::vector<long long>;
using vs = std::vector<string>;
using Mi = map<int,int>;
using Mll = map<ll,ll>;
using UMi = unordered_map<int,int>;
using UMll = unordered_map<ll,ll>;
using Pi = pair<int,int>;
using Pll = pair<ll,ll>;
using vPi = vector<Pi>;
using vPll = vector<Pll>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<ll>>;
using vvc = vector<vector<char>>;
using vvs = vector<vector<string>>;
using pqgi = priority_queue<int,vector<int>,greater<int>>;
using pqsi = priority_queue<int,vector<int>,less<int>>;
using pqgll = priority_queue<int,vector<int>,greater<int>>;
using pssll = priority_queue<int,vector<int>,less<int>>;
template<class T>
using vec = vector<T>;
#define int long long

using Graph = vector<vector<int>>;
Graph g;
//here begins your code
signed main(){
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  int N,M;
  cin >> N >> M;
  g.resize(N);
  REP(i,M){
  	int a,b;
  	cin >> a >> b;
  	a--;
  	b--;
  	g[a].emplace_back(b);
  }
  int shortest = N + 1;
  vector<int> res;
  for(int s = 0; s < N; s++){
  	vector<int> dist(N,-1);
  	vector<int> prev(N,-1);
  	queue<int> que;
  	que.push(s);
  	dist[s] = 0;
  	while(!que.empty()){
  		auto v = que.front();
  		que.pop();
  		for(auto nv : g[v]){
  			if(dist[nv] == -1){
  				dist[nv] = dist[v] + 1;
  				prev[nv] = v;
  				que.push(nv);
  			}
  		}
  	}
  	for(int t = 0; t < N; t++){
  		if(t == s || dist[t] == -1) continue;
  		for(auto nt : g[t]){
  			if(nt == s){
  				vector<int> tmp({s});
  				int cur = t;
  				while(cur != s){
  					tmp.push_back(cur);
  					cur=prev[cur]; //recover path
  				}
  				if(shortest > tmp.size()){
  					shortest = tmp.size();
  					res = tmp;
  				}
  			}
  		}

  	}
  }


  if(shortest == N+1){
  	cout << -1 << endl;
  }
  else{
  	cout << res.size() << endl;
  	for(auto v : res){
  		cout << v + 1 << endl;
  	}
  }
  //check types
  //do not eb if you resize
  //resize before you access by idx
  return 0;
} 

Measured memory_bytes: 512
/// Containers Start
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
/// C Header Files
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <math.h>
#include <stdio.h>
/// Containers End

using namespace std;

/// Math Start
#define PI acos(-1.0)
#define Pi 3.141592653589793
#define EPS (1e-7)
#define INF (0x3f3f3f3f)
/// Math End

/// Extra Start
#define nn '\n'
#define pb push_back
#define ull unsigned long long
#define ll long long
#define MOD 1000000007
#define sz(a) int((a).size())
#define space " "
#define All(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
/// Extra End

#define rep(i, n) for (int i = 0; i < n; i++)
#define Cini(a)                                                                \
    int a;                                                                     \
    cin >> a;
#define Cinii(a, b)                                                            \
    int a, b;                                                                  \
    cin >> a >> b;
#define Ciniii(a, b, c)                                                        \
    int a, b, c;                                                               \
    cin >> a >> b >> c;
#define Cins(s)                                                                \
    string s;                                                                  \
    cin >> s;
#define Cinss(s1, s2)                                                          \
    string s1, s2;                                                             \
    cin >> s1 >> s2;
#define Cinc(c)                                                                \
    char c;                                                                    \
    cin >> c;
/// Functions End

/// Debug Start
#define deb(x) cout << #x << ": " << x << endl
#define deb2(x, y) cout << #x << ": " << x << '\t' << #y << ": " << y << endl;
#define deb3(x, y, z)                                                          \
    cout << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": "   \
         << z << endl;
/// Debug End

int dx[] = {-1, 0, 1, 0};
int dy[] = {0, -1, 0, 1};

/**>>>>>>>>>>>>>>>>>>> END <<<<<<<<<<<<<<<<<<**/

/// template

int isUnder(int T,int A){ // AがT以下で1,それ以外0
    if(A<=T) return 1;
    else return 0;
}

signed main(void) {
    cin.sync_with_stdio(false);
    cin.tie(0);
    Ciniii(N,A,B);
    cout << min(A,B) << " " << max(A+B-N,0) << nn;
    return 0;
}

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

int main() {
	int n; cin>>n;
	int a[n]; for(int i=0;i<n;i++) cin>>a[i];
	int lb=0,si=0,ub=n-1,sf=0;
	while(lb<=ub) {
		if(si<=sf) {
			si+=a[lb]; lb++;
		}
		else {
			sf+=a[ub]; ub--;
		}
	}
	if(si>=sf) cout<<si-sf<<endl;
	else cout<<sf-si<<endl;
	return 0;
}

Measured memory_bytes: 256
#pragma region _head

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<iomanip>
#include<queue>
#include<stack>
#include<numeric>
#include<utility>
#include<regex>

void Init() {
	std::cin.tie(0); std::ios::sync_with_stdio(false);
	struct Init_caller { Init_caller() { Init(); } }caller;
}

#pragma region _define

#define int LL
#define f(i,a,b) for(LL i=a;i<b;i++)
#define rep(i,n) for(LL i=0;i<n;i++)
#define f_vI(v,n) f(i,0,n)cin>>v[i]
#define f_v2I(v1,v2,n) f(i,0,n)cin>>v1[i]>>v2[i]
#define f_v3I(v1,v2,v3,n) f(i,0,n)cin>>v1[i]>>v2[i]>>v3[i]
#define f_vO(v,n) f(i,0,n)cout<<v[i]<<endl
#define ei else if
#define all(a) a.begin(),a.end()
#define size(s) ((LL)s.size())
#define F first
#define S second
#define check() cout<<"! ! !"
#define endl "\n"
#define _y() cout<<"Yes"<<endl
#define _Y() cout<<"YES"<<endl
#define _n() cout<<"No"<<endl
#define _N() cout<<"NO"<<endl
#define INT_INF 1<<29
#define LL_INF 1LL<<60
#define MOD 1000000007

#pragma endregion

#pragma region _using

using namespace std;

using LL = long long;
using st = string;
using vi = vector<LL>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vd = vector<double>;
using vvd = vector<vd>;
using vvvd = vector<vvd>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<st>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using qi = queue<LL>;
using qc = queue<char>;
using qs = queue<st>;
using si = stack<LL>;
using sc = stack<char>;
using ss = stack<st>;
using pi = pair<LL, LL>;
using ppi = pair<pi, LL>;
using mll = map<LL, LL>;
using mcl = map<char, LL>;
using vpi = vector<pi>;
using vppi = vector<ppi>;


#pragma endregion

struct edge {
	int from, to, cost;
};

void y_n(bool p) {
	p ? _y() : _n();
}

void Y_N(bool p) {
	p ? _Y() : _N();
}

LL vmax(vi v, LL n) {
	int MAX = 0;
	f(i, 0, n) {
		MAX = max(MAX, v[i]);
	}
	return MAX;
}

LL vmin(vi v, LL n) {
	int MIN = LL_INF;
	f(i, 0, n) {
		MIN = min(MIN, v[i]);
	}
	return MIN;
}

LL gcd(LL a, LL b) {
	LL r;
	while ((r = a % b) != 0) {
		a = b;
		b = r;
	}
	return b;
}
LL lcm(LL a, LL b) {
	return (a / gcd(a, b) * b);
}

//素数判定
bool is_prime(int n) {
	for (int i = 2; i*i <= n; i++) {
		if (n % i == 0) {
			return false;
		}
	}
	return true;
}

//エラトステネスの篩
void sieve(LL n) {
	vb s(n + 1, true);
	f(i, 2, n + 1) {
		for (int j = 2; i*j <= n; j++) {
			s[i*j] = false;
		}
	}
	cout << "2から" << n << "までの素数" << endl;
	f(i, 2, n + 1) {
		if (s[i]) {
			cout << i << " ";
		}
	}
}

//階乗計算
LL factorial(LL n) {
	LL a = 1, ret = 1;
	while (a < n) {
		a++;
		ret *= a;
		ret %= MOD;
	}
	return ret;
}


#pragma endregion 


/*****************************************************************************/

signed main() {
	int n;
	cin >> n;
	vi a(n);
	f_vI(a, n);
	int l = 0, r = 0, sum = 0;
	int ans = 0;
	for (l; l < n; l++) {
		while (r < n && ((sum^a[r]) == (sum + a[r]))) {
			sum += a[r];
			r++;
		}
		ans += r - l;
		if (l == r) {
			r++;
		}
		else {
			sum -= a[l];
		}
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 1792
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <iomanip>

using namespace std;

#define FAST       			ios_base :: sync_with_stdio(false); cin.tie(NULL); 
#define endl "\n"

typedef long long int  ll;


int main()
{
	FAST;
	int n;
	int arr[100];

	cin >> n;
	for(int i=0 ; i<n ; i++)
		cin >> arr[i];

	int sum = 0;
	for(int i=0 ; i<n ; i++)
		sum += arr[i];

	int m;
	cin >> m;
	while(m--)
	{
		int u,v;
		cin >> u >> v;
		cout << sum-arr[u-1]+v << "\n";
	}

	return 0;
}

Measured memory_bytes: 256
# coding=utf-8

###
### for atcorder program
###

import sys
import math

# math class
class mymath:
    ### pi
    pi = 3.14159265358979323846264338

    ### Prime Number
    def pnum_eratosthenes(self, n):
        ptable = [0 for i in range(n+1)]
        plist = []

        for i in range(2, n+1):
            if ptable[i]==0:
                plist.append(i)
                for j in range(i+i, n+1, i):
                    ptable[j] = 1
        return plist

    ### GCD
    def gcd(self, a, b):
        if b == 0:
            return a
        return self.gcd(b, a%b)

    ### LCM
    def lcm(self, a, b):
        return (a*b)//self.gcd(a,b)

    ### Mat Multiplication
    def mul(self, A, B):
        ans = []
        for a in A:
            c = 0
            for j, row in enumerate(a):
                c += row*B[j]
            ans.append(c)
        return ans

mymath = mymath()

### output class
class output:
    ### list
    def list(self, l):
        l = list(l)
        #print(" ", end="")
        for i, num in enumerate(l):
            print(num, end="")
            if i != len(l)-1:
                print(" ", end="")
        print()

output = output()

### input sample
#i = input()
#N = int(input())
#A, B, C = [x for x in input().split()]
#N, K = [int(x) for x in input().split()]
#inlist = [int(w) for w in input().split()]

#R = float(input())
#A.append(list(map(int,input().split())))

#for line in sys.stdin.readlines():
#    x, y = [int(temp) for temp in line.split()]

#abc list
#abc = [chr(ord('a') + i) for i in range(26)]

### output sample
#print("{0} {1} {2:.5f}".format(A//B, A%B, A/B))
#print("{0:.6f} {1:.6f}".format(R*R*math.pi,R*2*math.pi))
#print(" {}".format(i), end="")

def get_input():
    N = []
    while True:
        try:
            N.append(input())
            #N.append(int(input()))
        except EOFError:
            break
    return N

N = get_input()

for i in N:
    S, W, H = [x for x in i.split(',')]
    BMI = float(W) / (float(H) ** 2)
    if BMI >= 25:
        print(S)




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

int main()
{
	int n;
	string c_taro;
	string c_hanako;
	int s_taro = 0;
	int s_hanako = 0;
	int flag = 0;

	cin >> n;
	for (int i1 = 0; i1 < n; i1++)
	{
		flag = 0;
		cin >> c_taro;
		cin >> c_hanako;
		
		int i2 = 0;
		while (!(c_taro[i2] == '\0' && c_hanako[i2] == '\0'))
		{
			{
				if (c_taro[i2] == '\0')
				{
					s_hanako = s_hanako + 3;
					flag = 1;
					break;
				}
				else if (c_hanako[i2] == '\0')
				{
					s_taro = s_taro + 3;
					flag = 1;
					break;
				}
				if (c_taro[i2] != c_hanako[i2])
				{
					if (c_taro[i2] < c_hanako[i2])
					{
						s_hanako = s_hanako + 3;
						flag = 1;
						break;
					}
					else
					{
						s_taro = s_taro + 3;
						flag = 1;
						break;
					}
				}
				i2++;
			}
		}
		if (flag == 0)
		{
			s_hanako = s_hanako + 1;
			s_taro = s_taro + 1;
		}
	}

	cout << s_taro << ' ' << s_hanako << endl;
	return 0;
}

Measured memory_bytes: 3192
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		if ((n * m) % 2 != 0) {
			System.out.println("Odd");
		}
		if ((n * m) % 2 == 0)
			System.out.println("Even");

	}
}


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

typedef long long ll;

int main() {
    ll A,B,C;
    cin >> A >> B >> C;
    
    ll ans=0;
    
    if(B<C){
        ans += B*2;
        C -= B;
        B=0;
    }
    else {
        if(C!=0) {
            ans += (2*C-1);
            B -= (C-1);
        }
        ans += B;
        cout << ans << endl;
        return 0;
    }
    
    if(A<C){
        if(A!=0) {
            ans += (A+1);
            C -= (A+1);
        } else {
            ans++;
        }
        A=0;
    }
    else {
        ans += C;
    }
    
    cout << ans << endl;
    
    
}


Measured memory_bytes: 256
N = int(input())
A = [""] * N
for i in range(N):
	A[i] = input()
A.sort()

c, m = 1, [1, []]
for i in range(1, N):
	if A[i - 1] == A[i]:
		c += 1
	else:
		if m[0] == c:
			m[1].append(A[i - 1])
		elif m[0] < c:
			m[1].clear()
			m[1].append(A[i - 1])
			m[0] = c
		c = 1

if m[0] == c:
	m[1].append(A[-1])
elif m[0] < c:
	m[1].clear()
	m[1].append(A[-1])

for i in m[1]:
	print(i)

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

int main()
{
    char a;
    cin >> a;
    bool key;
    if (a == 'H')
    {
        key = true;
    }
    else
    {
        key = false;
    }
    cin >> a;
    if (key)
    {
        cout << a << endl;
    }
    else
    {
        if (a == 'H')
        {
            cout << 'D' << endl;
        }
        else
        {
            cout << 'H' << endl;
        }
    }
}

Measured memory_bytes: 3572
#include <iostream>

int main(int argc, char* argv[])
{
	int time = 0;
	std::cin >> time;

	int h = time / 60 / 60;
	int m = (time - h * 60 * 60) / 60;
	int s = time - h * 60 * 60 - m * 60;
	std::cout << h << ":" << m << ":" << s << std::endl;
	return 0;
}

Measured memory_bytes: 3100
#include <stdio.h>
#define N 100

int main(){
  int flag = 1;
  int i, j, k, b, n, con = 0;
  int a[N];

  scanf("%d", &b);

  for(i = 0; i < b; i++){
    scanf("%d", &a[i]);
  }
  i = 0;
  while(flag){
    flag = 0;
    for(j = b-1; j >= i+1; j--){
      if(a[j] < a[j-1]){
	n = a[j];
	a[j] = a[j-1];
	a[j-1] = n;
	flag = 1;
	con = con + 1;
      }
    }
    i++;
  }

  printf("%d", a[0]);
  for(k = 1; k < b; k++){
    printf(" %d", a[k]);
  }
  printf("\n%d\n", con);

  return 0;
}



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

int main(){
    string s;
    cin >> s;
    if(s.at(0)==s.at(1)&&s.at(1)==s.at(2)){
        cout << "No" << endl;
    }
    else{
        cout << "Yes" << endl;
    }
}

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

int main() {
    int a, b;
    cin >> a >> b;
    if(a>b) {
        cout << "a > b" << endl;
        return 0;
    }
    else if(a==b) {
        cout << "a == b" << endl;
        return 0;
    }
    else {
        cout << "a < b" << endl;
        return 0;
    }
}


Measured memory_bytes: 3080
"use strict";
function I(s,f){this._s=s.split("\n");this._c=0;this._l=0;this._f=f||Number}I.prototype.a=function(){var l=this._s[this._l];if(!l)return;var t=l.trim().split(" ");var a=t[this._c];this._c++;if(t.length===this._c){this._c=0;this._l++}return this._f(a)};I.prototype.l=function(){var l=this._s[this._l];if(!l)return;this._c=0;this._l++;return l.split(" ").map(this._f)};module.exports=I;

function main(input) {
  const o = new I(input);

  const N = o.a();
  const A = o.a();
  const B = o.a();
  const C = o.a();

  const l = [];
  for (let i=0;i<N;i++) {
    l.push(o.a()); 
  }


  let minMp = Infinity;
  for (let i=0;i<Math.pow(4, N);i++) {
    let cA = [];
    let cB = [];
    let cC = [];
  
    let str = i.toString(4);
    while(str.length < N) str = "0" + str;
    for (let k = 0;k<N;k++) {
      if (str[k] === "1") {
        cA.push(l[k]);
      } else if (str[k] === "2") {
        cB.push(l[k]);
      } else if (str[k] === "3") {
        cC.push(l[k]);
      }
    }

    let sA = cA.length > 0 ? cA.reduce((acc,cur) => acc + cur) : 0;
    let sB = cB.length > 0 ? cB.reduce((acc,cur) => acc + cur) : 0;
    let sC = cC.length > 0 ? cC.reduce((acc,cur) => acc + cur) : 0;

    if (sA > 0 && sB > 0 && sC > 0) {
      let mp = Math.abs(A - sA) + Math.abs(B - sB) + Math.abs(C - sC) + 10 * (Math.max(cA.length - 1, 0) + Math.max(cB.length - 1, 0) + Math.max(cC.length - 1, 0))
      if (mp < minMp) {
        minMp = mp;
      }
    }

  }
  console.log(minMp);

}


main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 10412
#include <iostream>
#include <string>

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    string a, b;
    cin >> a >> b;
    a += a;
    a.back() = '\0';
    if(a.find(b) != string::npos){
        cout << "Yes\n";
    }
    else{
        cout << "No\n";
    }
    return 0;
}


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

using namespace std;

int n, m, x[200005], ta, tb;

int main() {
	scanf("%d%d", &n, &m);
	while (m--) {
		scanf("%d%d", &ta, &tb);
		if ((ta == 1 && ((x[tb] |= 1) == 3)) || (tb == n && ((x[ta] |= 2) == 3))) {
			printf("POSSIBLE\n");
			return 0;
		}
	}
	printf("IMPOSSIBLE\n");
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

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

    bitset<30> b(0);
    rep(n,0,N){
        bitset<30> _b(0);
        int K; cin>>K;
        rep(k,0,K){
            int a; cin>>a;
            _b.set(a-1);
        }

        if(n==0) b|=_b;
        else b&=_b;
    }

    cout<<b.count()<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,a,b;
  string str;
  string x,y;
  vector<string> alf(26);
  
alf = {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"};
    
  cin >> n >> str;
  a = str.size();
  for ( int i = 0;i<str.size();++i){
   for (int j = 0;j<26;++j){
     x = str.at(i);
     y = alf.at(j);
          
    if (x == y){
      if (j+n>25){
        b = j+n-26;
      }
      else {
        b = j+n;
      }
    
      str.replace(i,1,alf.at(b));
      break;      
   }
  }
 
}
   cout << str << endl;
}

Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
const int inf = 1012345678;
int main() {
	int N;
	cin >> N;
	vector<int> A(N), D(N);
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
		while ((1 << D[i]) < A[i]) ++D[i];
	}
	int dl = D[0], dr = D[0] + 1;
	if ((1 << D[0]) == A[0]) dr = inf;
	for (int i = 1; i < N; ++i) {
		int nl = min(dl + abs(D[i - 1] - ((1 << D[i]) == A[i] ? D[i] : D[i] - 1)) + ((1 << D[i]) == A[i] ? 0 : 1), dr + abs((D[i - 1] - 1) - ((1 << D[i]) == A[i] ? D[i] : D[i] - 1)) + ((1 << D[i]) == A[i] ? 0 : 1));
		int nr = ((1 << D[i]) == A[i] ? inf : min(dl + abs(D[i - 1] - D[i]) + 1, dr + abs((D[i - 1] - 1) - D[i]) + 1));
		dl = nl;
		dr = nr;
	}
	int ans = min(dl + D[N - 1], dr + D[N - 1] - 1);
	cout << ans / 2 << endl;
	return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n, a[100010], q, k;
    cin >> n;
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    cin >> q;
    for(int i=0; i<q; i++){
        cin >> k;
        int left=0, right=n;
        bool tf=false;
        while(left<right){
            int mid=(left+right)/2;
            if(a[mid]==k){
                tf=true;
                break;
            }
            if(a[mid]<k){
                left=mid+1;
            }
            else if(a[mid]>k){
                right=mid;
            }
        }
        cout << (tf ? 1:0) << "\n";
        
    }
    
    return 0;
}



Measured memory_bytes: 3488