akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;
int main() {
    string s;
    cin >> s;
    int ll = (int)s.size();
    s = s + s + s;
    string t;
    cin >> t;
    for (int i = 0; i < s.size(); ++i) {
        for (int j = i; j < i + ll; ++j) {
            if (t[j - i] != s[j]) {
                break;
            }
            if (j == i + ll - 1) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using static System.Console;

class Program
{
    static void Main()
    {
        var N = int.Parse(ReadLine());
        var h = new int[N, 3];
        for (int i = 0; i < N; i++)
        {
            var abc = ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            (h[i, 0], h[i, 1], h[i, 2]) = (abc[0], abc[1], abc[2]);
        }

        void ChMin<T>(ref T min, T value) where T : IComparable { if (value.CompareTo(min) < 0) min = value; }
        void ChMax<T>(ref T max, T value) where T : IComparable { if (value.CompareTo(max) > 0) max = value; }

        var dp = new int[N, 3];
        for (int i = 0; i < 3; i++)
            dp[0, i] = h[0, i];

        for (int i = 1; i < N; i++)
        {
            for (int j = 0; j < 3; j++)
            {
                ChMax(ref dp[i, j], Math.Max(dp[i - 1, (j + 1) % 3], dp[i - 1, (j + 2) % 3]) + h[i, j]);
            }
        }

        var ans = Enumerable.Range(0, 3).Select(i => dp[N - 1, i]).Max();

        WriteLine(ans);
    }
}


Measured memory_bytes: 49144
n = int(input())
H = list(map(int, input().split())) + [10**9 + 7]
start = 0
end = 0
ans = 0
while(start != n):
    if H[start] < H[start+1]:
        cnt = start - end
        end = start + 1
        start += 1
        if cnt > ans:
            ans = cnt
        continue
    start += 1
print(ans)

Measured memory_bytes: 14252
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define INF (1LL<<59)
#define MV 200001
#define LMV 21
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define emp emplace
#define whoami(x) cerr<<#x<<" "<<x<<"\n";
#define mp make_pair
#define ins insert
#define sz size

void FLASH() {ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);}
void SETF() {cout.ios_base::setf(ios_base::fixed);}
void UNSETF() {cout.ios_base::unsetf(ios_base::fixed);}

typedef long long ll;
typedef long double ld;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef pair<PII, int> PPII;
typedef pair<PLL, ll> PPLL;
typedef map<int, int> MII;

const int MOD = 1000000007;

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

struct h_llint {
  static uint64_t splitmix64(uint64_t x) {    // http://xorshift.di.unimi.it/splitmix64.c
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};

struct h_pair{
  size_t operator()(const PLL&x)const{
    return hash<ll>()(((ll)x.ff)^(((ll)x.ss)<<32));
  }
};

typedef map<ll, ll> MLL;
typedef map<PII, int> MPII;
typedef map<PLL, ll> MPLL;
typedef set<int> SI;
typedef set<ll> SL;
//ordered_set = order_of_key(.)
//ordered_set = find_by_order(.)
typedef ordered_set<int> OSI;
typedef ordered_set<ll> OSL;
typedef ordered_multiset<int> MOSI;
typedef ordered_multiset<ll> MOSL;
typedef unordered_map<ll, int, h_llint> UMLI;
typedef unordered_map<ll, ll, h_llint> UMLL;
typedef unordered_map<PLL, int, h_pair> UMPI;
typedef unordered_map<PLL, ll, h_pair> UMPL;

int ar[MV];
ll arr[MV];

void solve(int T)
{
	ll n,k;
	cin>>n>>k;
	ll sdf = 0;
	for(ll i=k;i<=n+1;i++)
	{
		ll ms = ((i-1) * i)/2;
		ll mas = ((n+1) * n)/2 - ((i < n+1) ? ((n-i) * (n-i+1))/2 : 0);
		// cout<<(mas-ms+1)<<"\n";
		sdf = ((sdf%MOD) + ((mas - ms + 1)%MOD))%MOD;
	}
	cout<<sdf<<"\n";
	return;
}

int main(void)
{
	FLASH();
	int T;
	T = 1;

// #ifndef ONLINE_JUDGE
// 	time_t time_t1, time_t2;
// 	time_t1 = clock();
// #endif

	//cin>>T;
	while(T--)
	solve(T);

// #ifndef ONLINE_JUDGE
// 	time_t2 = clock();
// 	SETF();
// 	cout<<"Time taken: "<<setprecision(7)<<(time_t2 - time_t1)/(double)CLOCKS_PER_SEC<<"\n";
// 	UNSETF();
// #endif

	return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FASTIO ios::sync_with_stdio(false); cin.tie(nullptr)
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())

int main() {
	FASTIO;
	int n, t, x, ans=0;
	cin >> n >> t >> x;
	while(n > 0) {
	    n -= t;
	    ans += x;
	}
	cout << ans << endl;
}

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

#define rep(i, n) for(int (i) = 0; i < (n); ++(i))

using ll = long long int;
const ll MOD = 1e9 + 7;

int main() {
  ll A;
  double B;
  std::cin >> A >> B;

  std::cout << A * ll(B * 100 + 0.001) / 100 << '\n';
}


Measured memory_bytes: 3744
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
 
int main() {
    int i;
    int n;
    long h;
    long ht;
    int a = 0;
    int ans = 0;
    
    scanf("%d%ld", &n, &ht);
    for(i = 1; i < n; i++){
        scanf("%ld", &h);
        if(ht >= h){
            a++;
            if(a > ans) ans = a;
        }else{
            a = 0;
        }
        ht = h;
    }
    printf("%d\n", ans);
 
    return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = Integer.parseInt(sc.next());
        int B = Integer.parseInt(sc.next());
        int C = Integer.parseInt(sc.next());
        int D = Integer.parseInt(sc.next());
        int judge = A+B-C-D;
        if(judge > 0){
            System.out.println("Left");
        }else if(judge == 0){
            System.out.println("Balanced");
        }else{
            System.out.println("Right");
        }
    }  
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int x, y; cin>>x>>y;
  for (int i=0; i<=100; ++i){
    for (int j=0; j<=100; ++j){
      if (i + j == x && 2 * i + 4 * j == y) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define _USE_MATH_DEFINES
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)

using namespace std;

class Dice
{
public:
    int label[6];

    void in()
    {
        rep(i, 6) scanf("%d", &label[i]);
    }

    void rollS()
    {
        int tmp = label[0];
        label[0] = label[4];
        label[4] = label[5];
        label[5] = label[1];
        label[1] = tmp;
    }
    void rollN()
    {
        int tmp = label[0];
        label[0] = label[1];
        label[1] = label[5];
        label[5] = label[4];
        label[4] = tmp;
    }
    void rollE()
    {
        int tmp = label[0];
        label[0] = label[3];
        label[3] = label[5];
        label[5] = label[2];
        label[2] = tmp;
    }
    void rollW()
    {
        int tmp = label[0];
        label[0] = label[2];
        label[2] = label[5];
        label[5] = label[3];
        label[3] = tmp;
    }

    int ans(int d1, int d2)
    {
        if (label[2] == d2 || label[3] == d2)
            rollW();
        while (label[1] != d2)
            rollS();
        while (label[0] != d1)
            rollW();
        return label[2];
    }
};

int main()
{
    Dice d;
    d.in();
    int q;
    cin >> q;
    int d1[q], d2[q];
    rep(i, q)
    {
        cin >> d1[i] >> d2[i];
        printf("%d\n", d.ans(d1[i], d2[i]));
    }
}


Measured memory_bytes: 3196
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef long double D;
typedef complex<D> P;
#define F first
#define S second
const ll MOD=1000000007;
//const ll MOD=998244353;

template<typename T,typename U>istream & operator >> (istream &i,pair<T,U> &A){i>>A.F>>A.S; return i;}
template<typename T>istream & operator >> (istream &i,vector<T> &A){for(auto &I:A){i>>I;} return i;}
template<typename T,typename U>ostream & operator << (ostream &o,const pair<T,U> &A){o<<A.F<<" "<<A.S; return o;}
template<typename T>ostream & operator << (ostream &o,const vector<T> &A){ll i=A.size(); for(auto &I:A){o<<I<<(--i?" ":"");} return o;}


int main(){
  ll N,K;
  cin>>N>>K;
  vector<ll> A(N);
  cin>>A;
  ll ans=0;
  for(auto &I:A){
    if(I>=K){ans++;}
  }
  cout<<ans<<endl;
  
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repb(i,a,b) for(int i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define int long long
#define fi first
#define se second
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

double EPS=1e-10;
double add(double a,double b){
	if(abs(a+b)<EPS*(abs(a)+abs(b))) return 0;
	return a+b;
}
struct P{
	double x, y;
	P() {}
	P (double x, double y) : x(x), y(y) {}
	P operator + (P p){
		return P(add(x, p.x), add(y, p.y));
	} 
	P operator - (P p){
		return P(add(x, -p.x), add(y, -p.y));
	}
	P operator * (double d){
		return P(x * d, y * d);
	}
	double dot(P p){  //??????
		return add(x * p.x, y * p.y);
	}
	double det(P p){  //??????
		return add(x * p.y, -y * p.x);
	}
};
//???????????§??????
bool cmp_x(const P& p, const P& q){
	if(p.x != q.x) return p.x < q.x;
	return p.y < q.y;
}
//??????????±???????
vector<P> convex_hull(P* ps, int n){
	sort(ps, ps + n, cmp_x);
	int k = 0;  //?????????????????°
	vector<P> qs(n * 2);  //?§????????????????
	//?????´???????????????
	for(int i = 0; i < n; i++){
		while(k > 1 && (qs[k - 1] - qs[k - 2]).det(ps[i] - qs[k - 1]) <= 0) k--;
		qs[k++] = ps[i];
	}
	//?????´???????????????
	for(int i = n - 2, t = k; i >= 0; i--){
		while(k > t && (qs[k - 1] - qs[k - 2]).det(ps[i] - qs[k - 1]) <= 0) k--;
		qs[k++] = ps[i];
	}
	qs.resize(k - 1);
	return qs;
}

int n;
P ps[100];

signed main() {
	while(cin >> n && n){
		rep(i, 0, n){
			double x, y;
			char c;
			cin >> x >> c >> y;
			ps[i] = P(x, y);
		}
		vector<P> qs = convex_hull(ps, n);
		cout<< n - qs.size() <<endl;
	}
}

Measured memory_bytes: 1232
#pragma GCC optimize("O3")
#pragma GCC target("arch=corei7-avx")

#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <cassert>
#include <cmath>
#include <queue>
#include <ctime>

using namespace std;

#define REP(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define SZ(a) (int)(a).size()
#define ALL(a) (a).begin(), (a).end()

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

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

int main(){
	int m,d;
	while(true){
		cin >> m >> d;
		if(m == 0)break;
		int M = 1,D = 1;
		for(int i = 0; i < 366; i++){
			if(M == m && D == d){
				if(i % 7 == 0)cout << "Thursday" << endl;
				if(i % 7 == 1)cout << "Friday" << endl;
				if(i % 7 == 2)cout << "Saturday" << endl;
				if(i % 7 == 3)cout << "Sunday" << endl;
				if(i % 7 == 4)cout << "Monday" << endl;
				if(i % 7 == 5)cout << "Tuesday" << endl;
				if(i % 7 == 6)cout << "Wednesday" << endl;
			}
			D++;
			if((M == 1 || M == 3 || M == 5 || M == 7 || M == 8 || M == 10 || M == 12) && (D == 32)){
				M++;
				D = 1;
			}
			if((M == 4 || M == 6 || M == 9 || M == 11) && (D == 31)){
				M++;
				D = 1;
			}
			if(M == 2 && D == 30){
				M++;
				D = 1;
			}
		}
	}
	return 0;
}


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

int a[10];
int ans;

int main()
{
    for(int i=1;i<=4;i++)
    {
        scanf("%1d",&a[i]);
        if(a[i]==2) ans++;
    }
    printf("%d",ans);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cctype>
#include <string>
using namespace std;
int main(int argc, const char * argv[]) {
    char alpha;
    while(1){
        cin.get(alpha);  //cin.getで一行読み取り
        
        if(alpha=='\n') { //改行で終了
            break;
        }
        if(isalpha(alpha)){  //アルファベッドかどうか判定
            if(islower(alpha)) { //小文字の時↓
                cout << (char)toupper(alpha); //大文字を返す (char)で型指定
            }
            if(isupper(alpha)) { //大文字の時↓
                cout << (char)tolower(alpha); //小文字を返す
            }
        }else{
            cout << alpha; //アルファベッド以外の文字はそのまま出力
        }
    }
    cout << "\n";
    return 0;
}


Measured memory_bytes: 3012
#include<bits/stdc++.h>
#define MOD 1000000007
#define EPS (1e-10)
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;

int main() {
	int n; cin >> n;
	int cnt = 0;
	rep(i, n) {
		int a; cin >> a;
		for (int i = 2; i*i <= a; i++) {
			if (a%i == 0)goto g;
		}
		cnt++;
	g:;
	}
	cout << cnt << endl;
}

Measured memory_bytes: 3072
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int h = sc.nextInt();
		int w = sc.nextInt();
		char[][] grid = new char[h][w];
		for(int i = 0; i < h; i++){
		    String s = sc.next();
		    grid[i] = s.toCharArray();
		}
		
		// 計算
		int result = 0;
		int[][] dist = new int[h][w];
		for(int i = 0; i < h; i++){
		    Arrays.fill(dist[i], -1);
		}
		ArrayDeque<Integer> q = new ArrayDeque<Integer>();
		if(grid[0][0] == '#'){
		    dist[0][0] = 1;
		}else{
		    dist[0][0] = 0;
		}
		q.push(0);
		while(!q.isEmpty()){
		    int now = q.pop();
		    int i = now/w;
		    int j = now%w;
		    if(j+1 < w && (grid[i][j+1] == grid[i][j] || grid[i][j+1] == '.')){
		        if(dist[i][j+1] == -1){
		            dist[i][j+1] = dist[i][j];
		            q.push(now+1);
		        }else if(dist[i][j+1] > dist[i][j]){
		            dist[i][j+1] = dist[i][j];
		            q.push(now+1);
		        }
		    }
		    if(j+1 < w && grid[i][j+1] == '#' && grid[i][j] == '.'){
		        if(dist[i][j+1] == -1){
		            dist[i][j+1] = dist[i][j]+1;
		            q.push(now+1);
		        }else if(dist[i][j+1] > dist[i][j]+1){
		            dist[i][j+1] = dist[i][j]+1;
		            q.push(now+1);
		        }
		    }
		    if(i+1 < h && (grid[i+1][j] == grid[i][j] || grid[i+1][j] == '.')){
		        if(dist[i+1][j] == -1){
		            dist[i+1][j] = dist[i][j];
		            q.push(now+w);
		        }else if(dist[i+1][j] > dist[i][j]){
		            dist[i+1][j] = dist[i][j];
		            q.push(now+w);
		        }
		    }
		    if(i+1 < h && grid[i+1][j] == '#' && grid[i][j] == '.'){
		        if(dist[i+1][j] == -1){
		            dist[i+1][j] = dist[i][j]+1;
		            q.push(now+w);
		        }else if(dist[i+1][j] > dist[i][j]+1){
		            dist[i+1][j] = dist[i][j]+1;
		            q.push(now+w);
		        }
		    }
		}
		result = dist[h-1][w-1];
		//System.out.println(Arrays.deepToString(grid));
		//System.out.println(Arrays.deepToString(dist));
		
		// 出力
		System.out.println(result);
	}
	
}


Measured memory_bytes: 28268
#include <stdio.h>
int main(){
	int n=0,a=0,b=0,c=0,d[101]={0},i=0,j=0,cal=0,dollar=0,temp=0,x=0,y=0,z=1;
	scanf("%d%d%d%d",&n,&a,&b,&c);
	for(i=0;i<n;i++){
		scanf("%d",&d[i]);
	}
	for(i=0;i<n;i++){
		for(j=i;j<=n;j++){
			if(d[i]<=d[j]){
				temp=d[i];
				d[i]=d[j];
				d[j]=temp;
			}
		}
	}
	
	temp=c;
	for(i=0;i<n;i++){
		if(temp/(i*b+a)>(temp+d[i])/((i+1)*b+a))
			break;
		temp+=d[i];
	}
	printf("%d\n",temp/(i*b+a));
	return 0;
}


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

#define ll long long
#define ull unsigned long long
#define db long double
#define pb push_back
#define ppb pop_back
#define F first
#define S second
#define mp make_pair
#define all(x) (x).begin(), (x).end()

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <int> vi;
typedef vector <ll> vll;

typedef tree <pii, null_type, less <pii>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int N = 2e5 + 123, K = 30;
int n, a[N], b[N], c[N], d[N];

pii MOD = {1e9 + 7, 1e9 + 9};

struct Num {
	int x = 0, y = 0;
	Num(int a = 0) {
		x = a;
		y = a;
	}
	Num operator + (const Num & a) const {
		Num res;
		res.x = x + a.x;
		if (res.x >= MOD.F) {
			res.x -= MOD.F;
		}
		res.y = y + a.y;
		if (res.y >= MOD.S) {
			res.y -= MOD.S;
		}
		return res;
	}
	Num operator - (const Num & a) const {
		Num res;
		res.x = x - a.x;
		if (res.x < 0) {
			res.x += MOD.F;
		}
		res.y = y - a.y;
		if (res.y < 0) {
			res.y += MOD.S;
		}
		return res;
	}
	Num operator * (const Num & a) const {
		Num res;
		res.x = (ll)x * a.x % MOD.F;
		res.y = (ll)y * a.y % MOD.S;
		return res;
	}
	bool operator == (const Num & a) const {
		return x == a.x && y == a.y;
	}
};

Num p[N], hc[N], hd[N], hci[N];
int bad[N], val[N];

int main() {
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	
	p[0] = 1;
	for (int i = 1; i < N; i++) {
		p[i] = p[i - 1] * 2;
	}
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	for (int i = 1; i <= n; i++) {
		cin >> b[i];
	}
	for (int i = 0; i < K; i++) {
		//cout << "i " << i << '\n';
		for (int j = 1; j <= n; j++) {
			c[j] = (a[j] >> i & 1);
			hc[j] = hc[j - 1] + p[j] * c[j];
			hci[j] = hci[j - 1] + p[j] * (1 - c[j]);
			
			d[j] = (b[j] >> i & 1);
			hd[j] = hd[j - 1] + p[j] * d[j];
			//cout << c[j];
		}
		//cout << '\n';
		//for (int j = 1; j <= n; j++) {
			//cout << (1 - c[j]);
		//}
		//cout << '\n';
		//for (int j = 1; j <= n; j++) {
			//cout << d[j];
		//}
		//cout << '\n';
		for (int j = 0; j < n; j++) {
			if (hc[j] * p[n - j] == hd[n] - hd[n - j] && hc[n] - hc[j] == hd[n - j] * p[j]) {
				//cout << "good " << j << '\n';
				continue;
			}	else if (hci[j] * p[n - j] == hd[n] - hd[n - j] && hci[n] - hci[j] == hd[n - j] * p[j]) {
				val[j] |= (1 << i);
				//cout << "inv " << j << '\n';
			}	else {
				bad[j] = 1;
				//cout << "bad " << j << '\n';
			}
		}
	}
	for (int i = 0; i < n; i++) {
		if (!bad[i]) {
			cout << i << ' ' << val[i] << '\n';
		}
	}
}


Measured memory_bytes: 13824
#include <iostream>
#include<algorithm>
#include<sstream>
#include<cmath>
#include<vector>
#include<iomanip>
#include<map>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i = 0; i < n;i++)
int main(void) {
    int n, m,sum = 0;
    cin >> n;
    vector<int> t(n);rep(i, n) cin >> t[i];
    cin >> m;
    vector<int> p(m), x(m);rep(i, m)cin >> p[i] >> x[i];
    rep(i, n) sum += t[i];
    rep(i, m) {
        cout << sum - t[p[i] - 1] + x[i] << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5+5;

int main()
{
    int a, b, c;
    bool flag = 0;
    cin >> a >> b >> c;
    map<int, int> qq;
    int tem = a;
    if(a == c) flag = 1;
    while(!flag)
    {
        tem %= b;
        if(tem == c)
        {
            flag = 1;
        }
        if(qq[tem]) break;
        qq[tem] = 1;
        tem += a;
    }
    if(flag) puts("YES");
    else puts("NO");
    return 0;
}


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

int main() {
  int n;
  cin >> n;
  long long sum=0;
  vector<int> A(n);
  for (int i=0; i<n; i++) {
      int a;
      cin >>a;
      A.at(i)=a;
      sum+=a;
  }
  sort(A.begin(),A.end());
  cout << A.at(0) << " " << A.at(n-1) << " " << sum << endl;
}


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


int main()
{
    int k,n;
    cin>>k>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    int total =0;
    for(int i=1;i<n;i++)
    {
        total += a[i] - a[i-1];
    }
    total += a[0] + k-a[n-1];

    int m = INT_MIN;
    for(int i=1;i<n;i++)
    {
        m = max( m , a[i] - a[i-1]);
    }
    m = max( m , a[0] + k-a[n-1]);
    cout<<total - m;
}

Measured memory_bytes: 4388
import java.io.IOException
import java.lang.NumberFormatException
import java.lang.StringBuilder
import kotlin.math.max
import kotlin.math.pow

object AMain{
    fun solve(){
        val s = next()
        if(s.count { it == 'R' } == 3){
            println(3)
        }else if((s[0] == 'R' && s[1] == 'R') || (s[1] == 'R' && s[2] == 'R')){
            println(2)
        }else if(s.count {it == 'R'} >= 1){
            println(1)
        }else{
            println(0)
        }
    }





    // Scanner based on uwi-san's Java code
    val stream = System.`in`
    val buffer = ByteArray(1024)
    var ptr = 0
    var buflen = 0

    fun hasNextByte(): Boolean{
        if(ptr < buflen){
            return true
        }else{
            ptr = 0
            try{
                buflen = stream.read(buffer)
            }catch (e: IOException){
                e.printStackTrace()
            }
            if(buflen <= 0){
                return false
            }
        }
        return true
    }

    fun readByte() =
        if(hasNextByte()) buffer[ptr++]
        else -1

    fun isPrintableChar(c: Byte) = c in 33..126

    fun hasNext(): Boolean{
        while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++
        return hasNextByte()
    }

    fun next(): String{
        if(!hasNext()) throw NoSuchElementException()
        val sb = StringBuilder()
        var b = readByte()
        while(isPrintableChar(b)){
            sb.appendCodePoint(b.toInt())
            b = readByte()
        }
        return sb.toString()
    }

    fun nextLong(): Long{
        if(!hasNext()) throw NoSuchElementException()
        var n = 0L
        var minus = false
        var b = readByte()
        if(b == '-'.toByte()){
            minus = true
            b = readByte()
        }
        if(b !in '0'.toByte()..'9'.toByte())
            throw NumberFormatException()
        while(true){
            if(b in '0'.toByte()..'9'.toByte()){
                n *= 10
                n += b - '0'.toByte()
            }else if(!isPrintableChar(b)){
                return if(minus) -n else n
            }else{
                throw NumberFormatException()
            }
            b = readByte()
        }
    }

    fun nextInt(): Int{
        val n1 = nextLong()
        if(n1 !in Int.MIN_VALUE..Int.MAX_VALUE)
            throw NumberFormatException()
        return n1.toInt()
    }

    fun NextDouble() = next().toDouble()
}

fun main(){
    AMain.solve()
}



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

int main()
{
 int arr[5];
  for(int i=0;i<5;i++)
  {
    cin >> arr[i];
  }
  for(int j=0;j<5;j++)
  {
    if(arr[j]==0) cout << j+1 << endl;
  }
  
  
  return 0;
}

Measured memory_bytes: 3620
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>
#include <string>
#include <time.h>

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }

char S[112345];

int main() {

	scanf("%s", S);
	int N = strlen(S);
	S[N] = 'R';

	vector<pair<int, pair<int, int>>> Ans;
	int Ro = 0, Re = 0, Lo = 0, Le = 0;
	bool f = true;
	int RL = 0;
	rep(i, N) {
		if (f) {
			if (i % 2) Ro++;
			else Re++;
			if (S[i] == 'R' && S[i + 1] == 'L') {
				RL = i;
				f = false;
			}
		}
		else {
			if (i % 2) Lo++;
			else Le++;
			if (S[i] == 'L' && S[i + 1] == 'R') {
				if (RL % 2) {
					Ans.push_back({ RL,{Ro + Lo, Re + Le} });
				}
				else {
					Ans.push_back({ RL,{Re + Le, Ro + Lo} });
				}
				Ro = 0, Re = 0, Lo = 0, Le = 0;
				f = true;
			}
		}
	}

	int j = 0;
	rep(i, N) {
		if (j < Ans.size() && i == Ans[j].first) {
			printf("%d %d ", Ans[j].second.first, Ans[j].second.second);
			i++;
			j++;
		}
		else {
			printf("0 ");
		}
	}
	printf("\n");
	return 0;
}


Measured memory_bytes: 1276
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <queue>
#include <set>

#define rep(i,n) for(int i=0; i<(n); i++)

using namespace std;

set<string> s;
int trace[4];
bool used[10];

void dfs(int depth, int n, int k, vector<int>& num) {
    if (depth == k) {
        stringstream ss;
        rep(i,k)ss << num[trace[i]];
        s.insert(ss.str());
    } else {
        rep(i,n) {
            if (used[i])continue;
            used[i] = true;
            trace[depth] = i;
            dfs(depth + 1, n, k, num);
            used[i] = false;
        }
    }
}

int main() {
    int n,k;
    while(cin >> n >> k, n) {
        s.clear();
        vector<int> num(n);
        rep(i,n) cin >> num[i];
        dfs(0, n, k, num);
        cout << s.size() << endl;
    }
    return 0;
}

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

//#define int long long
#define MOD 1000000007

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
template <typename T>
void print(T x)
{
    std::cout << x << '\n';
}
typedef long long ll;

signed main()
{
    ll x;
    cin >> x;
    const double PI = 3.14159265358979323846;

    cout << 2.0 * x * PI << endl;
}


Measured memory_bytes: 3764
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		while(in.hasNext()) {
			int n = in.nextInt();
			int sum=0;
			for(int i=n;i<600;i+=n) {
				sum = sum+i*i*n;
			}
			System.out.println(sum);
		}
		in.close();
	}
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main() {
  int n, m, k, ans = 0;
  cin >> n >> m >> k;
  bool ok = false;
  rep(i, n + 1) rep(j, m + 1) if (i * (m - j) + j * (n - i) == k) ok = true;

  cout << (ok ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 256
a, b = map(int, input().split())
snowless = []
cnt = 0
ans = 0
for i in range(1, 1000):
    cnt += i
    snowless.append(cnt)

for j in range(snowless[-1]):
    if a + j in snowless and b + j in snowless:
        ans = j

print(ans)

Measured memory_bytes: 40716
#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please


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


	ll X, K, D;
	cin >> X >> K >> D;

	X = abs(X);

	ll shou = X / D;
	ll ikeru = min(shou, K);

	X -= ikeru * D;
	K -= ikeru;

	if (K % 2) {
		X = abs(X - D);
	}
	
	co(X);





	Would you please return 0;
}

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

using namespace std;

int main() {
    string str1;
    cin >> str1;
    string str2;
    cin >> str2;

    bool correct = true;

    if (str2.length()-str1.length()!=1){
        correct = false;
    }

    if (correct){
        for(int i=0; i<str1.length(); i++){
            if (str1.at(i)!=str2.at(i)){
                correct = false;
            }
        }
    }

    if (correct) {printf("Yes\n");}
    else {printf("No\n");}
    return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <algorithm>
#include <functional>

#include <map>

using namespace std;

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

	char A, B;
	cin >> A >> B;

	map<char, int> value_pair;
	value_pair['A'] = 10;
	value_pair['B'] = 11;
	value_pair['C'] = 12;
	value_pair['D'] = 13;
	value_pair['E'] = 14;
	value_pair['F'] = 15;

	if (value_pair[A] < value_pair[B])
	{
		cout << "<";
	}
	else if (value_pair[A] > value_pair[B])
	{
		cout << ">";
	}
	else
	{
		cout << "=";
	}

	return 0;
}


Measured memory_bytes: 3676
import sys
n,m=map(int,input().split())
l=[list(map(int,input().split())) for i in range(m)]
connection=[[] for i in range(n)]
for i in range(m):
  connection[l[i][0]-1].append((l[i][1]-1,l[i][2]))
  connection[l[i][1]-1].append((l[i][0]-1,-l[i][2]))

distance=[-999999999999]*n
visited=[-1]*n

def bfs(v):
  distance[v]=0
  next=[v]
  next2=set()
  visitct=0
  while len(next)!=0 and visitct!=n:
    for i in range(len(next)):
      if visited[next[i]]==-1:
        visited[next[i]]=1
        visitct+=1
        for j in range(len(connection[next[i]])):
          if visited[connection[next[i]][j][0]]==-1:
            distance[connection[next[i]][j][0]]=distance[next[i]]+connection[next[i]][j][1]
            next2.add(connection[next[i]][j][0])
    next=list(next2)
    next2=set()

for i in range(n):
  if distance[i]==-999999999999:
    bfs(i)

for i in range(m):
  if distance[l[i][1]-1]-distance[l[i][0]-1]!=l[i][2]:
    print('No')
    sys.exit()
print('Yes')

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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll x;
  cin >> x;
  int dp[100010];
  memset(dp,0,sizeof(dp));
  dp[0] = 1;
  rep(i,6){
    int add = 100 + i; 
    rep(j,100010){
      if(j+add < 100010 && dp[j] > 0 ) dp[j+add] = 1;
    }
  }
  if(dp[x]) cout << 1 << endl;
  else cout << 0 << endl;
  return 0;
}


Measured memory_bytes: 640
n = int(input())
h = list(map(int, input().split()))

min=1000

for i in range(0,n):
    u=min
    ren=h[i]
    while 1:
        if ren%(2**u)!=0:
            u=u-1
            min=u
        else:
            break
    
print(min) 


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

using namespace std;

int main(){
    int n, m;
    cin >> n >> m;
    int k[n];
    int a[n][m];
    for(int i = 0; i < n; i++){
        cin >> k[i];
        for(int j = 0; j < k[i]; j++){
            cin >> a[i][j];
        }
    }
    int like[m];
    fill(like, like + m, 0);
    for(int i = 0; i < n; i++){
        for(int j = 0; j < k[i]; j++){
            like[a[i][j]-1]++;
        }
        
    }
    int ans = 0;
    for(int i = 0; i < m; i++){
        if (like[i] == n) {
            ans++;
        }
    }
    cout << ans << '\n';
}

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


/*
全部やるとN＾２にさらに階乗を求める操作N^3になる？
n!/a!(n-a)!-n!/(a+1)!(n-a-1)!
=a+1-(n-a)=2a+1-n
これが正なら減少
a = (n-1)/2まで増加
よって最大値はn-1/2に近いものでとる
二分木探索?logN
全部に二分僕探索NlogN//ここ最大値以下の
最大値のみで二分僕探索
logN
階乗計算はしなくていい
ソートNlogN
大きいものからその半分に近いものを探していく

(n+1)!/a!(n+1-a)!-n!/a!(n-a)!
n+1-(n+1-a)
nが大きいほうがええんや

*/

#define max 2147483647

void merge(int *a,int left,int mid,int right){
        int n1 = mid - left;
        int n2 = right - mid;
        int L[n1+1],R[n2+1];
        int i;
        for(i=0;i<n1;i++){
            L[i] = a[left + i];
        }
        for(i=0;i<n2;i++){
            R[i] = a[mid + i];
        }
        L[n1]=max;
        R[n2]=max;
        int j=0,k=0;
        for(i=left;i<right;i++){
            if(L[j]<R[k]){
                a[i] = L[j];
                j++;
            }
            else{
                a[i] = R[k];
                k++;
            }
        }

}


void merge_sort(int *a,int left,int right){
    int middle;
    if(left + 1 < right){
        middle = (left + right)/2;
        merge_sort(a,left,middle);
        merge_sort(a,middle,right);
        merge(a,left,middle,right);
    }
}

//1 2 3 4 |5 6 7  key = 4.5
//left or left-1で一番大きくなる
int b_search(int *a,int size,double key){
    int left = 0,right = size;
    while(left<right){
        int mid = (left+right)/2;
        if(key == a[mid]){
            return mid;
        }
        else if(a[mid]<key){
            left = mid+1;
        }
        else{
            right = mid;
        }
    }
    return left;
}


int main(void){

    int n;
    scanf("%d",&n);
    int i,a[n];
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    merge_sort(a,0,n);
    int val = a[n-1];
    double b = ((double)val-1.0)/2.0;
    int nearest = b_search(a,n,b);
    if(nearest>0){
        if(fabs(b-a[nearest])>fabs(b-a[nearest-1])){
            nearest = nearest -1; 
        }
    }
    printf("%d %d\n",val,a[nearest]);

    return 0;
}

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

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
char a[4]={0};
for(int v=0;v<4;v++){
    cin>>a[v];
}

    if(a[0]==a[1]||a[1]==a[2]||a[2]==a[3]){
        cout<<"Bad";
    }
    else{
        cout<<"Good";
    }



    return 0;
}


Measured memory_bytes: 256
from math import factorial
n, m = map(int,input().split())
nn = factorial(n)
mm = factorial(m)
div = 10 ** 9 + 7
if abs(n - m) >= 2:
    print(0)
elif abs(n - m) == 1:
    print((nn * mm) % div)
else:
    print((2 * nn * mm) % div)

Measured memory_bytes: 5304
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use {
    proconio::{marker::*, *},
    std::{cmp::*, collections::*, mem::*},
};

#[fastout]
fn main() {
    input! {//
        n:usize,
        a:[f64;n],
    }
    //    mut  a:[f64;n],

    let mut b = vec![0i128; n];
    for i in 0..n {
        b[i] = (a[i] * 1e9 + 0.5f64) as i128;
    }
    let mut c = vec![];
    let mut tfs = vec![vec![0i64; 37]; 37];
    for &x in b.iter() {
        let mut two = 0;
        let mut five = 0;
        let mut y = x;
        while y % 2 == 0 {
            y /= 2;
            two += 1;
        }
        while y % 5 == 0 {
            y /= 5;
            five += 1;
        }

        if two >= 18 {
            two = 18;
        }
        if five >= 18 {
            five = 18;
        }
        c.push((two, five));
        tfs[two][five] += 1i64;
    }
    let mut ans = 0i64;
    for &(two, five) in c.iter() {
        for i in 0..19 {
            for j in 0..19 {
                if two + i >= 18 && five + j >= 18 {
                    ans += tfs[i][j];
                }
            }
        }
        if two + two >= 18 && five + five >= 18 {
            ans -= 1;
        }
    }
    println!("{}", ans / 2);
}

const eps: f64 = 1e-10;


Measured memory_bytes: 12652
#include <bits/stdc++.h>
using namespace std;
const int N=200005;
#define int long long
int n,m,v,p,pos,tmp;
int a[N],sum[N],t[N];

bool cmp(int x,int y)
{
	return x>y;
}

bool check(int x)
{
	//cout<<a[x]<<" "<<k<<" "<<tt<<endl;
	if(x<=p) return 1;
	int rest=v-(p-1)-(n-x+1);
	if(rest<0) rest=0;
	int choose=n-(p-1)-(n-x+1);
	int Sum=0;
	for(int i=1;i<=choose;i++) t[i]=a[i+p-1]-a[x],Sum+=t[i];
	//cout<<rest<<endl; for(int i=1;i<=choose;i++) cout<<t[i]<<" "; cout<<endl; cout<<endl;
	if(a[x]+m<a[p]) return 0;
	return Sum<=m*(choose-rest);
}

signed main() 
{
	scanf("%lld%lld%lld%lld",&n,&m,&v,&p);
	for(int i=1;i<=n;i++) scanf("%lld",&a[i]);
	sort(a+1,a+n+1,cmp);
	int now=1;
	for(int i=1;i<=n;i++)
	{
		sum[i]=sum[i-1]+a[i];
	}
	int l=p,r=n,mid,best;
	while(l<=r)
	{
		mid=(l+r)>>1;
		if(check(mid)) l=mid+1,best=mid;
		else r=mid-1;
	}
	cout<<best<<endl;
	return 0;
}


Measured memory_bytes: 5972
#include<stdio.h>
int main(){
    long long int n,i,j,c=0,temp;
    scanf("%lld",&n);
    long long int b[n],a[n];
    for(i=0;i<n;i++){
        scanf("%lld",&a[i]);
        b[i]=a[i];
    }
    for(i=0;i<n;i++){
        for(j=0;j<n-i-1;j++){
            if(a[j]>a[j+1]){
                temp=a[j];
                a[j]=a[j+1];
                a[j+1]=temp;
            }
        }
    }
    for(i=0;i<n;i++){
        if(a[i]!=b[i])
            c++;
    }
    if(c<=2)
        printf("YES");
    else
        printf("NO");}


Measured memory_bytes: 1736
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<string>
#include<utility>
#include<array>
#include<set>
#include <numeric>
#include <stdio.h>
#include <boost/math/common_factor_rt.hpp>
#define EPS (1e-7)
using namespace std;
#define ll long long


int main() {

	int N, X;
	cin >> N >> X;
	vector<int> x(N);
	
	for (auto i = 0; i < N; i++)
	{
		int temp,ans;
		cin >> temp;

		x[i] = abs(temp - X);

	}

	int ans = x[0];

	for (auto i = 0; i < N; i++)
	{
		ans = boost::math::gcd(x[i], ans);
	}


	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 640
import sys
input = sys.stdin.readline
from collections import *

N, M = map(int, input().split())
H = list(map(int, input().split()))
G = [[] for _ in range(N)]

for _ in range(M):
    A, B = map(int, input().split())
    G[A-1].append(B-1)
    G[B-1].append(A-1)
    
ans = 0

for v in range(N):
    flag = True
    
    for nv in G[v]:
        flag &= H[v]>H[nv]
    
    if flag:
        ans += 1

print(ans)

Measured memory_bytes: 89356
// AtCoder165 C

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>
#include <assert.h>
#include <string.h>
#include <memory.h>
#include <malloc.h>
#include <stdlib.h>
#include <ctype.h>

// qsortで用いる比較用関数．*a<*bならaが先になる．
int compare(const void* a, const void* b) {
    return *(int*)a - *(int*)b;
}

int revcompare(const void* a, const void* b) {
    return *(int*)b- *(int*)a;
}

int main() {
    int i,j;
    int n;

    scanf("%d", &n);

    //printf("%d\n", n%10);

    switch(n%10){
        case 2:
        case 4:
        case 5:
        case 7:
        case 9:
            printf("hon");
            break;
        case 0:
        case 1:
        case 6:
        case 8:
            printf("pon");
            break;
        case 3:
            printf("bon");
            break;
    }

    return 0;

}

Measured memory_bytes: 1732
n = int(input())
s = [""]*n

ac = 0
wa = 0
tle = 0
re = 0

for i in range(n):
    s[i] = str(input())
    if s[i] == "AC":
        ac += 1
    elif s[i] == "WA":
        wa += 1
    elif s[i] == "TLE":
        tle += 1
    else:
        re += 1

print("AC x " + str(ac))

print("WA x " + str(wa))

print("TLE x " + str(tle))

print("RE x " + str(re))

Measured memory_bytes: 16172
#include <iostream>
#include <fstream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <unordered_set>
#include <bitset>
#include <limits>
#include <algorithm>

#define MOD_BIG 1000000007
#define MOD_BIG2 998244353
using std::string;
using std::cin;
using std::cout;
using std::cerr;
using std::endl;
using ll = long long;
using pint = std::pair<int, int>;
using pll = std::pair<ll, ll>;
using std::vector;

#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)

//////////////////////////////////////


//////////////////////////////////////

int main() {
    
    int N;
    cin >> N;
    string S, T;
    cin >> S >> T;
    FOR(i, 0, N) {
        cout << S[i] << T[i];
    }
    cout << endl;
    
    return 0;
}


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

int main(){
	int n,i,a[105],b[105],c[105],maxx=0,t;
	cin>>n;
	a[0]=0;
	for(i=1;i<=n;i++){
		cin>>a[i];
		a[i]=a[i]+a[i-1];
	}
	
	for(i=1;i<=n;i++)
		cin>>b[i];
	b[n+1]=0;
	for(i=n;i>=1;i--){
		b[i]=b[i]+b[i+1];
		t=b[i]+a[i];
		if(t>maxx)maxx=t;
	}
	
	cout<<maxx<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
typedef long long ll;

int main(void) {
  ll i, j, n, now = 0;
  scanf("%lld", &n);
  for(i = 1; ; ++i) {
    now += i;
    if(now >= n) {
      ll a = now - n;
      for(j = 1; j <= i; ++j) if(a != j) printf("%lld\n", j);
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 128
N = int(input())
P = 0
res = []
stamina = 0

ls = input().split()
for i in range(0, len(ls)):
  ls[i] = int(ls[i])
  
for i in range(0, 100):
  P = P + 1
  for j in range(0, len(ls)):
  	stamina = stamina + (ls[j] - P)**2
  res.append(stamina)
  stamina = 0

print(min(res))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define inf 1000000000
#define md 1000000007
#define pb push_back
#define li 100005
#define lo long long
using namespace std;
int n,k,x;
int main(){
	scanf("%d %d",&k,&x);
	int bas=x-k+1;
	int son=k+x-1;
	for(int i=bas;i<=son;i++) printf("%d ",i);
	return 0;
}




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

int time, n;
int d[100], color[100];
int M[100][100];

void bfs(int s) {
    std::queue<int> Q;
    
    for (int i=0; i<100; i++){
        color[i] = 0;
        d[i] = -1;
    }
    
    color[s] = 1;
    d[s] = 0;
    Q.push(s);
    while (!Q.empty()) {
        int u = Q.front(); Q.pop();
        for (int i=0; i<n; i++) {
            if(M[u][i] && color[i] == 0) {
                color[i] = 1;
                d[i] = d[u]+1;
                Q.push(i);
            }
        }
        color[u] = 2;
    }
}

int main() {
    int u, k, v;
    scanf("%d", &n);
    
    for (int i=0; i<n; i++) {
        for (int j=0; j<n; j++) {
            M[i][j] = 0;
        }
    }
    
    for (int i=0; i<n; i++) {
        scanf("%d %d", &u, &k);
        for (int j=0; j<k; j++) {
            scanf("%d", &v);
            M[u-1][v-1] = 1;
        }
    }
    
    bfs(0);
    
    for (int i=0; i<n; i++) {
        printf("%d %d\n", i+1, d[i]);
    }
    return 0;
}


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

using namespace std;

int main(void){

  int n,N;
  string s;
  cin >> n;
  cin.ignore(); //無視

  while(n--){

    getline( cin , s );

    while( s.find("Hoshino",0 ) != string::npos ){
       N = s.find("Hoshino" , 0 ); 
      // 0文字目から文字を探す
      s.replace( N , 7 , "Hoshina");
      // 変数名.replace(最初(位置),文字数,文字列)
    }
    cout << s << endl;
  }
  return 0;
}

Measured memory_bytes: 1208
#include <iostream>
#include <vector>
#include <set>
#include <complex>
#include <algorithm>

using namespace std;


int main()
{
    int n;

    cin >> n;

    while(n!=0) {
        int ans=0;
        vector<pair<int,int> > colp;
        set<pair<int,int> > cols;

        int x,y,temp;

        for(int i=0; i<n; ++i) {
            cin >> x >> y;
            colp.push_back({x,y});
            cols.insert({x,y});
        }

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

        for(int i=0; i<n-1; ++i) {
            for(int j=i+1; j<n; ++j) {
                temp=(colp[i].first-colp[j].first)*(colp[i].first-colp[j].first)+(colp[i].second-colp[j].second)*(colp[i].second-colp[j].second);
                if(temp<ans) continue;

                complex<int> v[4];
                complex<int> rot(0,1);

                v[0]=complex<int>(colp[i].first,colp[i].second);
                v[1]=complex<int>(colp[j].first,colp[j].second);

                v[2]=v[0]+(v[1]-v[0])*rot;

                if(v[2].real()<0||v[2].imag()<0) continue;

                v[3]=v[1]+v[2]-v[0];
                if(v[3].real()<0||v[3].imag()<0) continue;

                if(cols.count({v[2].real(),v[2].imag()})!=0
                   && cols.count({v[3].real(),v[3].imag()})!=0) {
                    ans=temp;
                    continue;
                }

                rot=complex<int>(0,-1);

                v[2]=v[0]+(v[1]-v[0])*rot;

                if(v[2].real()<0||v[2].imag()<0) continue;

                v[3]=v[1]+v[2]-v[0];
                if(v[3].real()<0||v[3].imag()<0) continue;

                if(cols.count({v[2].real(),v[2].imag()})!=0
                   && cols.count({v[3].real(),v[3].imag()})!=0) {
                    ans=temp;
                }

            }
        }
        cout << ans << endl;
        cols.clear();
        colp.clear();
        cin >> n;
    }
    return 0;
}

Measured memory_bytes: 3216
#include <stdio.h>
#include<math.h>
int main(void) {
	 long long int K,A,B;
    	long long int C=1;
    long long int Y;
    scanf("%lld %lld %lld",&K,&A,&B);
        Y=K-A+1;

    if((B-A<=2)||K==1||(K+1-A)<=1){
    	C=C+K;
    }else{
    	C=A+(Y/2)*(B-A)+Y%2;
    }
    
    	printf("%lld\n",C);
    	return 0;
}

Measured memory_bytes: 128
#include <iostream>

const int N_MAX = 1e5 + 5;

using namespace std;

int H[N_MAX];

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

    cin >> H[0];
    H[0]--;
    for (int i = 1; i < N; i++) {
        cin >> H[i];

        if (H[i - 1] > H[i]) {
            cout << "No" << endl;
            return 0;
        }
        if (H[i - 1] < H[i]) H[i]--;
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 640
#57 C - Green Bin
import collections
N = int(input())
S = [sorted(input()) for _ in range(N)]
Ssrt = []
for s in S:
    s = ''.join(s)
    Ssrt.append(s)

cnt = collections.Counter(Ssrt)
ans = 0
for s in cnt.keys():
    if cnt[s] >= 2:
        ans += cnt[s]*(cnt[s]-1)//2
print(ans)

Measured memory_bytes: 154012
#include<stdio.h>
int main()
{
    int n,m,k,flag=0;
    scanf("%d%d",&n,&m);
    k=n+m;
    if(n%3==0||m%3==0||k%3==0)
        flag=1;
    if(flag==1)
        printf("Possible\n");
    else
        printf("Impossible\n");
    return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
#include <iostream>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <string>
#include<time.h>
using namespace std;
typedef unsigned long long ull;

int main(void) {
	int n, m, x, y;
	int a, b, a_m = -200, b_m = 200;
	cin >> n >> m >> x >> y;
	for (int i = 0; i < n; ++i) {
		cin >> a;
		if (a > a_m) {
			a_m = a;
		}
	}
	for (int i = 0; i < m; ++i) {
		cin >> b;
		if (b < b_m) {
			b_m = b;
		}
	}
	if (a_m < b_m && a_m<y && b_m>x) {
		cout << "No War";
		return 0;
	}
	cout << "War";
	return 0;
}

/*
*/

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] counts = getCounts(sc.next().toCharArray());
		for (int i = 1; i < n; i++) {
			merge(counts, getCounts(sc.next().toCharArray()));
		}
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < 26; i++) {
			for (int j = 0; j < counts[i]; j++) {
				sb.append((char)(i + 'a'));
			}
		}
		System.out.println(sb);
	}
	
	static void merge(int[] base, int[] next) {
		for (int i = 0; i < base.length; i++) {
			base[i] = Math.min(base[i], next[i]);
		}
	}
	
	static  int[] getCounts(char[] arr) {
		int[] counts = new int[26];
		for (char c : arr) {
			counts[c - 'a']++;
		}
		return counts;
	}
}


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

int main()
{
	char a;
	
	cin >> a;
	
	if (a=='A')
		cout << 'T';
	
	if (a=='T')
		cout << 'A';
		
	if (a=='C')
		cout << 'G';
	
	if (a=='G')
		cout << 'C';
	
	return 0;
}

Measured memory_bytes: 256