akhauriyash/Code-Regression huggingface dataset:
from collections import deque

alices = deque([c for c in input()])
bobs = deque([c for c in input()])
charlies = deque([c for c in input()])

turn = "a"
while True:
    if turn == "a":
        if len(alices) > 0:
            turn = alices.popleft()
        else:
            break
    elif turn == "b":
        if len(bobs) > 0:
            turn = bobs.popleft()
        else:
            break
    elif turn == "c":
        if len(charlies) > 0:
            turn = charlies.popleft()
        else:
            break
print(turn.upper())

Measured memory_bytes: 3316
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(){

    string s, p;
    int flg=0;
    cin >> s;
    cin >> p;
    s+=s;

    int cnt=0;
    int cnt2=0;

    for(int i=0; i<s.size(); i++){
        if(s[i] == p[cnt]){
            for(int j=0; j<p.size(); j++){
                if(s[i+j] == p[cnt] ){
                    flg = 1;
                    cnt2++;
                }else{
                    flg = 0;
                }
                cnt++;
            }
            if(flg == 1 && cnt2 == p.size()){
                break;
            }
            cnt=0;
            cnt2=0;
        }
        
    }    

    if(flg == 1){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 3204
#include <iostream>
#include<string>
#include <algorithm>
#include <queue>
#define NIL -1
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define MAX 10003
#define GREY 1
#define BLACK 0
#define WHITE 2
int main() {
	int n, a[101] = { 0 }; cin >> n; long long ma=0;
	REP(i, n) {
		cin >> a[i]; ma += a[i];
	}bool d = false;
	sort(a, a + n); 
	if (ma % 10 != 0) {
		cout << ma << endl; d = true;
	}
	else {
		for (int i = 0; i <= n; i++)
		{
			int z=ma - a[i];
			if (z % 10 != 0) {
				cout << z << endl; d = true; break;
			}
		}
	}
	if (d == false) {
		cout << "0" << endl;
	}
	return 0;
}


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

#define ASC(vec) vec.begin(), vec.end()    // 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend() // 降順ソート 例：sort(DESC(vec));
#define rep(i, n) for (int i = 0; i < (n); i++)
#define Rep(i, n) for (int i = 1; i < n; i++)
#define REP(i, vec) for (auto i = vec.begin(); i != vec.end(); ++i)

const int       mod = 1000000007;
const int       inf = (1 << 21);
const long long INF = 1LL << 60;

using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vii = vector<pair<int, int>>;
using vll = vector<pair<ll, ll>>;

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; }
template<class T>
T GCD(T a, T b) { if (b == 0) return a; else return GCD(b, a % b); }
template<class T>
T LCM(T a, T b) { return a / GCD(a, b) * b; }

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };

// ──────────────────────────────────────────────────────────────────

int main() {
	int a[5];
	rep(i, 5) {
		cin >> a[i];
		if (a[i] == 0) {
			cout << i + 1 << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 3580
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 1<<30
#define MOD 1000000007
#define mod 1000000007
#define REP(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define REPE(i, a, n) for (ll i = a; i <= (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<int,int>Pin;
typedef pair<ll,ll>Pll;
template<class T> using V=vector<T>;
long long GCD(long long a, long long b) {return b?GCD(b,a%b):a;}
long long LCM(long long a, long long b) {return a/GCD(a,b)*b;}
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
int ddx[8]={-1,0,1,0,1,1,-1,-1};
int ddy[8]={0,-1,0,1,1,-1,1,-1};
ll cmp(pair<ll,ll>a,pair<ll,ll> b){
        if(a.se!=b.se)
        return a.se<b.se;
        else
        return a.fi<b.fi;
}
//----------------------------------------------------------------------

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}


//----------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------  
    //ll begin_time=clock();
    //------------------------------
    ll n;cin>>n;
    ll ans=0;
    while(n--){
        ll a;cin>>a;
        if(IsPrime(a))ans++;
    }
    cout<<ans<<Endl;
    //-------------------------------  
    //ll end_time=clock();cout<<"time="<<end_time-begin_time<<"ms"<<endl;
    //-------------------------------
    return 0;
}
//----------------------------------------------------------------------















































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

int N, a[100006], b[100006], ans, A[2][2], B[2][2];
int main(){
	scanf("%d", &N);
	for (int i = 0; i < N / 2; i++) {
		int temp;
		scanf("%d", &temp);
		a[temp]++;
		scanf("%d", &temp);
		b[temp]++;
	}
	for (int i = 1; i < 100003; i++) {
		if (a[i] > A[0][0]) {
			A[1][0] = A[0][0];
			A[1][1] = A[0][1];
			A[0][0] = a[i];
			A[0][1] = i;
		} else if (a[i] > A[1][0]) {
			A[1][0] = a[i];
			A[1][1] = i;
		}
	}
	for (int i = 1; i < 100003; i++) {
		if (b[i] > B[0][0]) {
			B[1][0] = B[0][0];
			B[1][1] = B[0][1];
			B[0][0] = b[i];
			B[0][1] = i;
		} else if (b[i] > B[1][0]) {
			B[1][0] = b[i];
			B[1][1] = i;
		}
	}
	if (A[0][1] == B[0][1]) {
		ans = max(A[0][0] + B[1][0], A[1][0] + B[0][0]);
	} else {
		ans = A[0][0] + B[0][0];
	}
	printf("%d\n", N - ans);
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <sstream>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef vector <vector <int>> vii;
typedef vector <long long> vll;
typedef vector <string> vs;
typedef vector <char> vc;
typedef set <int> si;
typedef set <string> ss;
typedef queue <int> qi;
typedef queue <long long> qll;
typedef queue <string> qs;
typedef queue <char> qc;
typedef struct board board;
typedef pair <int, int> pi;
typedef pair <long long, long long> pll;
typedef pair <int, pair<int, int>> pii;

#define eb emplace_back
#define ppb pop_back
#define clr(a) a.clear()
#define F first
#define S second
#define mkp make_pair

#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()

#define left(x) x * 2
#define right(x) x * 2 + 1

#define meme(a, b, c) fill(a + 1, a + 1 + b, c)

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

#define move(s) s += "#"

#define fr(i, a, b) for (ll i = a; i <= b; ++ i)
#define rf(i, a, b) for (ll i = a; i >= b; -- i)

#define eprintf(...) fprintf(stderr, __VA_ARGS__);

void to_pray() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cerr << "Ready\n";
}

const int N = 4e6 + 10;
const int NN = 1e3 + 10;
const int NNN = 2e3 + 9;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const ll LLINF = 1e12 + 7;
const ll P = 53;
const int EPS = 1e-9 - 8;
const int vN = 2e4 + 10;
const int sz = (1 << 22) - 1;
const double PI = acos(-1);

int main () {
    to_pray();

    int a, b;
    cin >> a >> b;
    
    if (a <= 9 and b <= 9)
    	cout << a * b;
    else
    	cout << -1;
    
    cout << '\n';
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <cmath>
#include <limits>
#include <sstream>

using namespace std;

int main (void)
{
	long long a,b,c;

	long co = 0;

	cin >> a >> b >> c;

	for (long long i = a; i < b + 1; i++)
	{
		for (long long j = 0; j < 30000; j++)
		{
			if (i * j == c)
			{
				co += 1;
			}
		}
	}

	cout << co << endl;
}




Measured memory_bytes: 3088
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}


fn main() {
    input! {
        h: usize,
        w: usize,
        a: [String; h],
    }
    let s = vec!["#"; w + 2].join("");
    println!("{}", s);
    for sa in a {
        println!("#{}#", sa);
    }
    println!("{}", s);
} 


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

int main(){
  //入力
  int N;
  cin>>N;
  string S;
  cin>>S;
  int res=0;
  
  //累積和作る
  vector<int>W(N+1);
  vector<int>B(N+1);
  
  W.at(0)=0;
  B.at(0)=0;
  
  for(int i=0;i<N;i++){
    if(S.at(i)=='.'){
      W.at(i+1)=W.at(i)+1;
      B.at(i+1)=B.at(i);
    }
    else{
      W.at(i+1)=W.at(i);
      B.at(i+1)=B.at(i)+1;
    }
  }
  
  //全探索
  for(int i=0;i<N+1;i++){
    int count=0;
    count+=B.at(i);
    count+=W.at(N)-W.at(i);
      
    if(i==0)
      res=count;
    else
      res=min(res,count);
    
  }
  
  cout<<res;
}

Measured memory_bytes: 2180
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <sstream>
#include <set>
#include <map>
#include <iostream>
#include <utility>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <unordered_set>
#include <unordered_map>
#include <limits.h>
#include <cstring>
#include <tuple>
#include <cassert>
#include <numeric>
#include <iomanip>
using namespace std;
// type alias
typedef long long LL;
typedef pair< int , int > II;
typedef tuple< int, int, int > III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))

// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');

// debug cerr
#define TRACE true
#define dump(x) if(TRACE) { cerr << #x << " = " << (x) << endl; }
#define dump2(x,y) if(TRACE) { cerr << #x << " = " << (x) << ", " << #y << " = " << (y) << endl; }
#define dump3(x,y,z) if(TRACE) { cerr << #x << " = " << (x) << ", " << #y << " = " << (y) << ", " << #z << " = " << (z) << endl; }
#define dump4(x,y,z,a) if(TRACE) { cerr << #x << " = " << (x) << ", " << #y << " = " << (y) << ", " << #z << " = " << (z) << ", " << #a << " = " << (a) << endl; }
#define dumpf(args...) if(TRACE) { fprintf(stderr, ##args); putchar('\n'); }
#define dumpAR(ar) if(TRACE) { FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
template<class Iter> void dumpc(Iter begin, Iter end) { if (TRACE) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; } }

// $ cp-batch DiscountFare | diff DiscountFare.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address DiscountFare.cpp && ./a.out

/*
 
 1/20/2019
 
 15:30-
 
 */

int a,b;

void solve() {
  cout<<a+b/2<<endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;
  
  cin>>a>>b;
  solve();
  
  return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
#include<algorithm>
#include<deque>
#include<string>
using namespace std;

#include<cstdio>
#define r(i,n) for(int i=0;i<n;i++)

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

  cout<<a*b-a-b+1<<endl;

  
return 0;}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template < typename T > string tost( const T& n ) { ostringstream stm; stm << n; return stm.str();}
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;}
int const INF = 1001001001;

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

ll count2(ll c) {
    ll cnt = 0;
    while(c % 2 == 0) {
        c /= 2;
        cnt++;
    }
    return cnt;
}


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

int N,M; cin >> N >> M;
vl b(N);
bool ok = true;
rep(i,N) {
    cin >> b[i];
    b[i] /= 2;
}
rep(i,N-1) {
    if(count2(b[i]) != count2(b[i+1])) ok = false;
}

ll ans = 0;
if(ok) {
    ll cur = b[0];
    rep(i,N-1) {
        cur = lcm(cur, b[i+1]);
        if(cur > M) {
            cout << 0 << endl;
            exit(0);
        }
    }
    for(int j = 1; cur*j <= M; j = j + 2) {
        ans++;
    }
}
cout << ans << endl;
return 0;
}

Measured memory_bytes: 1024
//Gaurav Singh (saintpopo)
#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;

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

#define ii pair<ll,ll>;
#define vi vector<int>;
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define endl "\n"
#define fbo find_by_order
#define ook order_of_key
#define sz(x) (int)x.size()
#define all(x) x.begin(),x.end()
#define fo(i,a,b) for(int i = a; i < b; i++)
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;

void io_set() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}
 
int main(){
    IOS
    //io_set();
    ll n, l, r, s=0;
    cin >> n;
    while(n--){
        cin >> l >> r;
        s += (r-l)+1;
    }
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256
#input
N, M = map(int, input().split())
L = [[] for _ in range(N)]
for i in range(M):
    x, y = input().split()
    x = int(x)
    L[x-1].append(y)

#output
point = 0
penalty = 0
for i in range(N):
    if not "AC" in L[i]:
        continue
    else:
        for j in range(len(L[i])):
            if L[i][j] == "WA":
                penalty += 1
            else:
                point += 1
                break

print(point, penalty, sep = " ")


Measured memory_bytes: 20272
#include <iostream>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <string>
#include <set>
#include <iomanip>
#include <map>
#define REP(i,n) for (int i=0;i<(n);++i)
using namespace std;
using ll = long long;

int main(){
    ll l, r, ans = 2018;
    cin >> l >> r;

    if((r - l) > 2500){
        cout << 0 << endl;
        return 0;
    }

    for(ll i = l; i < r; ++i){
        for(ll j = i + 1; j <= r; ++j){
            ans = min(ans, (i * j) % 2019);
        }
    }
    cout << ans << endl;
    return 0;
}


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

ll n;
int main(){
    cin>>n;
    if(n%2==1) cout<<0<<endl;
    else{
        ll ans=0;
        ll cur=2*5;
        while(n/cur!=0){
            ans+=n/cur;
            cur*=5;
        }
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#ifdef BUILT_LOCAL

#include "niklib.h"

#endif

#include <iostream>
#include <utility>
#include <numeric>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <string>
#include <cstdio>
#include <cstring>
#include <map>
#include <cmath>
#include <set>
#include <list>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
constexpr ll mod = 1000000007;

typedef long long num;

#define bs(n) (1ll<<(ll)(n))
#define rep(i, n) for(ll (i) = 0;(i) < (n);(i)++)
#define rrep(i, n) for(ll (i) = 1;(i) <= (n);(i)++)

int v[1010][1010], f[1010][1010][2];

int lcs2(string &a, string &b) {
    memset(v, 0, sizeof(int[1010][1010]));
    memset(f, 0, sizeof(int[1010][1010][2]));
    int n = a.length(), m = b.length(), ri = 0, rj = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (a[i] == b[j] && v[i + 1][j + 1] < v[i][j] + 1) {
                v[i + 1][j + 1] = v[i][j] + 1;
                f[i + 1][j + 1][0] = i;
                f[i + 1][j + 1][1] = j;
            }
            if (v[i + 1][j] < v[i][j]) {
                v[i + 1][j] = v[i][j];
                f[i + 1][j][0] = i;
                f[i + 1][j][1] = j;
            }
            if (v[i][j + 1] < v[i][j]) {
                v[i][j + 1] = v[i][j];
                f[i][j + 1][0] = i;
                f[i][j + 1][1] = j;
            }
        }
    }
    for (int i = 0; i <= n; i++)
        for (int j = 0; j <= m; j++)
            if (v[ri][rj] < v[i][j]) {
                ri = i;
                rj = j;
            }
    string ret;
    int rn = v[ri][rj];
    while (ri != 0 && rj != 0) {
        if (f[ri][rj][0] == ri - 1 && f[ri][rj][1] == rj - 1) {
            ret.push_back(a[ri]);
        }
        int rii = f[ri][rj][0];
        int rjj = f[ri][rj][1];
        ri = rii;
        rj = rjj;
    }
    return rn;
}


int main() {
    int q;
    cin >> q;
    string a, b;
    rep(i, q) {
        cin >> a >> b;
        cout << lcs2(a, b) << endl;
    }
}



Measured memory_bytes: 15124
def main():
    n = int(input())
    robot = [None]*n
    for i in range(n):
        x, arm = map(int, input().split())
        robot[i] = [x - arm, x + arm]
    robot.sort(key=lambda x: x[1])
    ans = 0
    x = -1 * (10)**9
    for i in range(n):
        if x <= robot[i][0]:
            ans += 1
            x = robot[i][1]
    print(ans)

if __name__ == "__main__":
    main()

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

int main()
{
	char a[60],b[60];
	int la,lb;
	
	scanf("%s%s",a,b);
	la = strlen(a);
	lb = strlen(b);
	if(la>lb)
	{
		for(int i = 0;i < la;i++)
		{
			if(i<la) printf("%c",a[i]);
			if(i<lb) printf("%c",b[i]);
		}
	}
	else
	{
		for(int i = 0;i < la;i++)
		{
			if(i<la) printf("%c",a[i]);
			if(i<lb) printf("%c",b[i]);
		}
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
typedef long long   ll;
#define pb                push_back
#define mp                make_pair
#define all(a)            (a).begin(), (a).end()
#define clr(a,h)          memset(a, (h), sizeof(a))
#define mem(a,h)          memset(a, (h), sizeof(a))
#define fi first
#define se second
#define por(a,b) (((a%MOD) * (b%MOD))%MOD)
#define forg(i, b, e, c)    for (ll i = (ll)b; i < (ll)e; i+=c)
#define forr(i, b, e)    for (ll i = b; i < e; i++)
 
 
using namespace std;
//using namespace __gnu_pbds;
typedef double lldb;
typedef pair<ll, ll>  ii;
typedef pair<ii, ll>  iii;
typedef vector<ll>     vi;
typedef vector<vi>     vvi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
//typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
const ll INF = 1e9;
const double PI = acos(-1);
#define tam 120000
#define offset 
const ll MOD= 1e9+7;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
vector<int> g[tam];
int h[tam];
int  main()
{
    ios::sync_with_stdio(false);cin.tie(0);
    int n,k;
    cin>>n>>k;
    forr(i,1,n+1)
    cin>>h[i];
    int iz,der;

    forr(i,0,k)
    {
        cin>>iz>>der;
        g[iz].pb(der);
        g[der].pb(iz);
    }
    int tot=0;
    forr(i,1,n+1)
    {
        bool nop=0;
        for(int v:g[i])
        {
            if (h[i]<=h[v])
                nop=1;
        }
        tot+=!nop;
    }
    cout<<tot<<endl;
}
// PLUS ULTRA!
    


Measured memory_bytes: 9656
#include <bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define eps 1e-9

typedef long long ll;

using namespace std;

const ll inf = 1e18;
const ll mod = 1e9+7;
const int N = 1e5+5;
//int a[N];

int main()

{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

    int a, b, ans = 0, tmp = 1;

    cin >> a >> b;

    while (true) {

        if (tmp >= b) break;
        tmp--;
        tmp += a;
        ans++;
    }

    cout << ans;

    return 0;
}


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

ll f(ll b, ll n) {
	if (n < b)return n;
	return f(b, n / b) + n%b;
}
int main() {
	ll n, s; scanf("%lld%lld", &n, &s);
	if (n == s) {
		printf("%lld\n", n + 1); return 0;
	}
	for (ll i = 2; i*i <= n; i++) {//nをi進表記
		if (f(i, n) == s) {
			printf("%lld\n", i); return 0;
		}
	}
	ll Min = LLONG_MAX;
	for (ll i = 1; i*i < n; i++) {//上位桁を固定
		ll b = (n - (s - i)) / i;
		if (b > 1 && f(b, n) == s)Min = min(Min, b);
	}
	printf("%lld\n", Min == LLONG_MAX ? -1 : Min);
}

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

#define FOR(a, b, c) for(int a = b; a <= c; ++a)
#define FORW(a, b, c) for(int a = b; a >= c; --a)
#define fi first
#define se second
#define pb push_back
#define int long long

typedef pair<int, int> ii;
typedef pair<int, ii> iii;

const int N = 3e3 + 100;
const int oo = 1e8;
const int mod = 1e9 + 7;

int n;

signed main()  {
//    freopen("test.inp", "r", stdin);
//    freopen("test.out", "w", stdout);
    ios_base::sync_with_stdio(false); cout.tie(0);
    string s; cin >> s;
    if(s[2] == s[3] && s[4] == s[5]) cout << "Yes";
    else cout << "No";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define debug(x) cerr << #x << ": " << x << '\n';
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n; cin >> n;
  ll s = 0;
  vector <ll> vec(n+2);
  for (int i = 1; i <= n; ++i) {
    cin >> vec[i];
  }
  vec[0] = 0; vec[n+1] = 0;
  for (int i = 0; i <= n; ++i) {
    s += abs(vec[i] - vec[i+1]);
  }
  for (int i = 1; i <= n; ++i) {
    cout << s + abs(vec[i-1] - vec[i+1]) - ( abs(vec[i-1]-vec[i]) + abs(vec[i]-vec[i+1])) << '\n';
  }
}


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

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

    int M = (N / 1) % 10;
    string ans = "";

    if (M == 2 || M == 4 || M == 5 || M == 7 || M == 9) {
        cout << "hon" << endl; 
    }
    else if (M == 0 || M == 1 || M == 6 || M == 8) {
        cout << "pon" << endl;
    }
    else {
        cout << "bon" << endl;
    }
}

Measured memory_bytes: 3624
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class APayment {
public:
    void solve(std::istream& cin, std::ostream& cout) {
        int N;
        cin >> N;
        int cur = 0;
        while (cur < N) {
            cur += 1000;
        }
        cout << cur - N << endl;
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    APayment solver;
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 3612
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#include <bits/stdc++.h>
using namespace std;

const double TL = 1.5 * CLOCKS_PER_SEC;
mt19937 rng((unsigned int) chrono::steady_clock::now().time_since_epoch().count());
#define clr(x, y) memset(x, y, sizeof(x))
#define forn(i, n) for (int i = 0; i < n; i++)
#define LL long long

const int inf = 1e9;

char s[10];

int main() {
  //auto start_clock = clock();
#ifdef LOCAL
  freopen("in", "r", stdin);
#endif
  int a = 0, b = 0;
  scanf("%s", s);
  for(int i = 0; i < 3; i++) {
    if(s[i] == 'A') a += 1;
    else b += 1;
  }
  if(a > 0 && b > 0) puts("Yes");
  else puts("No");

  return 0;
}

Measured memory_bytes: 256
n = int(input())
A = [[0 for _ in range(n)] for _ in range(n)]
for _ in range(n):
    tmp_u = list(map(int, input().split()))
    vs = tmp_u[2:]
    for v in vs: 
        A[tmp_u[0]-1][v-1] = 1
       
for i in range(n):
    tmp_A = A[i]
    tmp_A = map(str, tmp_A)
    tmp_A = ' '.join(tmp_A)
    print(tmp_A)

Measured memory_bytes: 7796
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main(void) {
    int n, m, r;
    cin >> n >> m >> r;
    vi vr(r);
    rep(i,r) cin >> vr[i], vr[i]--;

    int dp[200][200];
    rep(i,200)rep(j,200) dp[i][j] = INF;
    rep(i,200) dp[i][i] = 0;

    rep(i,m){
        int a, b, c;
        cin >> a >> b >> c;
        a--,b--;
        dp[a][b] = c;
        dp[b][a] = c;
    }

    rep(k,n)rep(i,n)rep(j,n)
        dp[i][j] = min(dp[i][j], dp[i][k]+dp[k][j]);


    vi ord(r);
    rep(i,r) ord[i] = i;

    int ans = INF;

    do{

        int tmp = 0;

        rep(i,r-1)
            tmp += dp[vr[ord[i]]][vr[ord[i+1]]];

        ans = min(ans, tmp);



    }while(next_permutation(all(ord)));

    cout << ans << endl;
}


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

typedef long long ll;
using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, a, b, c, d;
    cin >> n >> a >> b >> c >> d;
    string s;
    cin >> s;
    bool ans = true;
    if (c < d) {
        for (int i = b; i < d; i++) {
            if (s[i] == '#' && s[i - 1] == '#') {
                ans = false;
                break;
            }
        }
        for (int i = a; i < c; i++) {
            if (s[i] == '#' && s[i - 1] == '#') {
                ans = false;
                break;
            }
        }
        if (ans) cout << "Yes" << endl;
        else cout << "No" << endl;
        return 0;
    }
    for (int i = b; i < d; i++) {
        if (s[i] == '#' && s[i - 1] == '#') {
            ans = false;
            break;
        }
    }
    if (!ans) {
        cout << "No" << endl;
        return 0;
    }
    for (int i = a; i < c; i++) {
        if (s[i] == '#' && s[i - 1] == '#') {
            ans = false;
            break;
        }
    }
    bool has2 = false;
    if (c < b) has2 = true;
    else {
        for (int i = b - 1; i < d; i++) {
            if (s[i] == '.' && s[i - 1] == '.' && s[i + 1] == '.') {
                has2 = true;
                break;
            }
        }
    }
    if (ans && has2) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 592
n = int(input())
S = list(map(int,input().split()))
q = int(input())
T = list(map(int,input().split()))


def is_ok(vector, key, middle):
    if vector[middle] <= key:
        return True
    else:
        return False

def meguru_bisect(ng, ok):
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(S, t, mid):
            ok = mid
        else:
            ng = mid
    return ok

ans = 0
for t in T:
    ind = meguru_bisect(n,0)
    if S[ind] == t:
        ans += 1
print(ans)


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

using namespace std;

#define frei(i,a,b) for (int i = (a), _b = (b); i <= _b; i++)
#define fred(i,a,b) for (int i = (a), _b = (b); i >= _b; i--)
#define fri(i,n) for (int i = 0, _n = (n); i < _n; i++)
#define frd(i,n) for (int i = (n) - 1; i >= 0; i--)
#define foreach(it, ar) for ( typeof(ar.begin()) it = ar.begin(); it != ar.end(); it++ )

#define uint64 unsigned long long
#define int64 long long
#define all(ar) ar.begin(), ar.end()
#define pb push_back
#define pf push_front
#define mp make_pair
#define ff first
#define ss second
#define pr pair

#define BIT(n) (1<<(n))
#define AND(a,b) ((a) & (b))
#define OR(a,b) ((a) | (b))
#define XOR(a,b) ((a) ^ (b))
#define sqr(x) ((x) * (x))

typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef vector<pii> vii;
typedef vector<int> vi;

#define PI 3.1415926535897932385
#define INF 1000111222
#define eps 1e-7
#define maxN 5005

void add_slef(int &a, int b, int mod = 0) {
    a += b;
    if(mod > 0 && a >= mod) a -= mod;
}

void sub_slef(int &a, int b, int mod = 0) {
    a -= b;
    if(mod > 0 && a < 0) a += mod;
}

int mul(int a, int b, int mod = 0) {
    return (int64)a*b%mod;
}

vector<string> split(string s, string del) {
        vector<string> ans;
        if(s.size() == 0) {
            return ans;
        }
        size_t pos = 0;
        while((pos = s.find(del)) != string::npos) {
            string str = s.substr(0, pos);
            ans.push_back(str);
            s.erase(0, pos + del.size());
        }
        return ans;
}

const int mod = 1e9 + 7;
int n;
struct M {
    vector<vector<int>> t;
    M() {
        t.resize(n, vector<int>(n));
    }
    M operator*(const M &b) const {
        M c = M();
        for(int i = 0; i < n; i++) {
            for(int j = 0; j < n; j++) {
                for(int k = 0; k < n; k++) {
                    add_slef(c.t[i][j], mul(t[i][k], b.t[k][j], mod), mod);
                }
            }
        }
        return c;
    }
};

int main(int argc, char const *argv[])
{
    /* code */
    int64 k;
    cin >> n >> k;
    vector<vector<int>>can(n, vector<int>(n));
    for(int i = 0; i < n; i++) {
        for(int j = 0; j < n; j++) {
            cin >> can[i][j];
        }
    }
    M answer = M();
    M m = M();
    m.t = can;
    for(int i = 0; i < n; i++) answer.t[i][i] = 1;
    //cout << "Hello " << endl;
    while(k) {
        if(k%2) {
            answer = answer*m;
        }
        m = m*m;
        k = k/2;
    }
    int total = 0;
    for(int i = 0; i < n; i++) {
        for(int j = 0; j < n; j++) {
            add_slef(total, answer.t[i][j], mod);
        }
    }
    cout << total << endl;
    /* vector<int> dp(n,1);
    for(int64 step = 0; step < k; step++) {
        vector<int> new_dp(n);
        for(int i = 0; i < n; i++) {
            for(int j = 0; j < n; j++) {
                if(can[i][j]) {
                    add_slef(new_dp[j], dp[i], mod);
                }
            }
        }
        dp = new_dp;
    }
    int ans = 0;
    for(int i = 0; i < n; i++) ans += dp[i];
    cout << ans << endl;*/
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
#define fastcall __attribute__((optimize("-O3")))
#define IL  __inline__ __attribute__((always_inline))
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n;
int now;
deque <int> q;
template <class T>
IL void _read(T &u)
{
    u = 0;
    char t = getchar();
    while (!isdigit(t)) t = getchar();
    while (isdigit(t))
    {
        u = u * 10 + t - '0';
        t = getchar();
    }
}
template <class T>
inline void print(T x)
{
    if(x < 0)
    {
        putchar('-');
        x = -x;
    }
    if(x > 9)
        print(x / 10);
    putchar(x % 10 + '0');
}
inline void solve(ll n)
{
	if(n == 1) return;
	if(n & 1) solve(n - 1), q.push_front(++now);
	else solve(n / 2), q.push_back(++now);
}
int main()
{
	_read(n);
	solve(++n);
	print(now << 1);
	putchar('\n');
	while(!q.empty())
		print(q.front()), q.pop_front(), putchar(' ');
	for(int i = 1; i <= now; ++i)
		print(i), putchar(' ');
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	int n, m;
	cin >> n >> m;
	
	vector<bool> ok(n + 1, true);
	for(int i = 0; i < m; ++i) {
		int a;
		cin >> a;
		
		ok[a] = false;
	}
	
	vector<ll> dp(1e5 + 10, 0);
	dp[0] = 1;
	
	for(int i = 0; i < n; ++i) {
		if( ok[i + 1] ) { 
			dp[i + 1] += dp[i];
			dp[i + 1] %= MOD;
		}
		
		if( ok[i + 2] ) { 
			dp[i + 2] += dp[i];
			dp[i + 2] %= MOD;
		}
	}
	
	cout << dp[n] << endl;
	
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w",stdout);
    #endif


    int k,a,b;
    cin>>k>>a>>b;
    int flag = 0;
    for(int i = a ; i<=b ; i++){
        if(i%k == 0){
            flag = 1;
            break;
        }
    }

    if(flag){
        cout<<"OK"<<endl;
    }else{
        cout<<"NG"<<endl;
    }
}

Measured memory_bytes: 3652
/* The original problem can be seen in
** http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_2_B
*/
#include <cstdio>

void printArray(int A[], int N) {
    for (int i = 0; i < N; i++) {
        if (i != N-1) {
            printf("%d ", A[i]);
        } else {
            printf("%d", A[i]);
        }
    }
    printf("\n");
}

void bubbleSort(int A[], int N) {
    int swappedCount = 0;
    for (int i = 0; i < N-1; i++) {
        int minj = i;
        for (int j = i; j < N; j++) {
            if (A[j] < A[minj]) {
                minj = j;
            }
        }
        if (minj != i) {
            int tmp = A[i];
            A[i] = A[minj];
            A[minj] = tmp;
            swappedCount++;
        }
    }
    printArray(A, N);
    printf("%d\n", swappedCount);
}

int main() {
    int N;
    int A[100];

    scanf("%d", &N);
    for (int i = 0; i < N; i++) {
        int input;
        scanf("%d", &input);
        A[i] = input;
    }
    bubbleSort(A, N);
}

Measured memory_bytes: 1032
a = list(input())
even_number = [x for x in range(0,101,2)]
tmp_list = []
tmp_set = set(a)

tmp_list = [a.count(x) for x in tmp_set]
if all(x % 2 == 0 for x in tmp_list) == True:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9116
/*                        ______
 _______   /\     |``\   |        |  /
    |     /  \    |__/   |____    |/
    |    / _ _\   |  \   |        |\
    |   /      \  |   \  |______  |  \

            Dept. of CSE
        Comilla  University

*/
#include<bits/stdc++.h>
#define pi 2*acos(0.0)
#define ll long long
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Node struct node
#define spc " "
#define  E  2.71828182845904523536
#define pb push_back
#define pp pop_back
#define valid(nx,ny) nx>=0 && nx<n && ny>=0 && ny<m
#define ee endl
#define pii pair<int,int>
#define infinity 10000000000000000
#define mod 1000000007
int fx[]={0,0,+1,-1};
int fy[]={+1,-1,0,0};

using namespace std;
///check n=1;
///check corner case;
const int maX=1e5+1;
vector<ll>Graph[maX],cost[maX];
ll visit[maX];
ll x[10];
ll y[10];

int main()
{
    ll n,i,j,cc=0;
    cin>>n;
    pair<pair<string,ll>,ll>ara[n];
    for(i=0;i<n;i++){
        string str;
        cin>>str>>j;
        ara[i]=make_pair(make_pair(str,-j),i+1);
    }
    sort(ara,ara+n);
    for(auto it : ara){
        cout<<it.second<<endl;
    }
return 0;
}


Measured memory_bytes: 4992
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef pair<int, int>P;
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
typedef vector<vector<ll>> mat;
typedef vector<int> vec;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
const ll mod = 1000000007;
const ll INF = mod * mod;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
ll qp(ll a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };

void solve() {
    ll a, b, c, d, n, k, x;
    string s, t;
    ll ans = 0;
    double dans = 0;
    string sans = "Good";

    cin  >> s;
    if(s[0] == s[1] || s[1] == s[2] || s[2] == s[3]) sans = "Bad";



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

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    solve();
    // stop
        return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long  long
int main()
{
    ll n;
    cin>>n;
    ll i,a[n];
    for(i=0;i<n;i++)
    cin>>a[i];
    ll dp[n];
    dp[0] = 0;
    dp[1] = abs(a[1]-a[0]);
    for(i=2;i<n;i++)
    dp[i] = min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
    cout<< dp[n-1];
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1000000010
#define EPS 1e-9
#define fst first
#define scd second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  string s,t;
  cin>>s>>t;
  cout<<t+s<<endl;

  return 0;
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int Maxn=100005;
int n,sz[Maxn],id[Maxn];
ll d[Maxn],sum;
vector<pair<int,int>>edge;
vector<int>son[Maxn];
void dfs1(int x,int dis=0){
    sum+=dis;
    for(int y:son[x])
        dfs1(y,dis+1);
}
void dfs2(int x,ll sum){
    if(sum!=d[x]){
        cout<<"-1\n";
        exit(0);
    }
    for(int y:son[x])
        dfs2(y,sum+n-2*sz[y]);
}
int main(){
    scanf("%d",&n);
    map<ll,int>Map;
    for(int i=1;i<=n;i++)scanf("%lld",&d[i]),Map[d[i]]=i;
    for(int i=1;i<=n;i++)id[i]=i;
    sort(id+1,id+n+1,[](int x,int y){return d[x]>d[y];});
    for(int i=1;i<n;i++){
        int x=id[i];
        sz[x]+=1;
        ll v=d[x]-n+2*sz[x];
        int y=Map[v];
        if(!y){
            cout<<"-1\n";
            return 0;
        }
        sz[y]+=sz[x];
        son[y].push_back(x);
        edge.emplace_back(x,y);
    }
    dfs1(id[n]);
    dfs2(id[n],sum);
    for(auto i:edge)
        cout<<i.first<<" "<<i.second<<"\n";
    return 0;
}

Measured memory_bytes: 17012
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define req(i,n) for(int i = 1;i <=n;i++)
#define pai 3.14159265358979323846
const int INF = 1001001001;
typedef long long ll;
int A[3][3], N;
bool punched[3][3];
bool ok[3][3];
using Graph = vector<vector<int>>;
vector<vector<int>> field;
vector<bool> seen;

const int MOD = 1000000007;
typedef pair<int,int> P;

//最大公約数
int gcd(int a,int b){
	if (a%b == 0){
		return b;
	}
	else{
		return gcd(b,a%b);
	}

}

//最小公倍数
int lcm(int a,int b){
	return a /gcd(a,b) * b;
}

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




int main() {
  ll n;
  cin >> n;
  //char c[26]={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};
  string s;
  int cnt = 0;
  while (n>0){
  if ((n%26)==0) {
    s += char(26+96);
    n /= 26;
    n -= 1;
  }
  //  else if (n%27==0&&cnt) {
  //   s +=s[cnt-1];
  //  }
  else {
    s += char((n%26)+96);
    
  n /= 26;
  }
  cnt++;
  }
  reverse(s.begin(),s.end());
  cout << s << endl;
  //cout << char(97) << endl;
}

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

int h, w;
int step[50][50] = {};
char s[50][50];
int x[4] = {1, 0, -1, 0};
int y[4] = {0, 1, 0, -1};

void bfs()
{
    queue<pii> q;
    q.push(pii(0, 0));
    s[0][0] = '#';
    while (!q.empty())
    {
        pii t = q.front();
        q.pop();

        rep(i, 4)
        {
            int nx = t.first + x[i], ny = t.second + y[i];
            if (!(0 <= nx && nx < h && 0 <= ny && ny < w))
                continue;
            if (s[nx][ny] == '.')
            {
                step[nx][ny] = step[t.first][t.second] + 1;
                s[nx][ny] = '#';
                q.push(pii(nx, ny));
            }
        }
    }
}

int main()
{
    int cnt = 0;

    cin >> h >> w;

    rep(i, h)
    {
        rep(j, w)
        {
            cin >> s[i][j];
            if (s[i][j] == '.')
                cnt++;
        }
    }

    bfs();

    if (step[h - 1][w - 1] == 0)
        OP(-1);
    else
        OP(cnt - step[h - 1][w - 1] - 1);

    return 0;
}

Measured memory_bytes: 256
import sys
import math

sys.setrecursionlimit(1000)
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def LIST(): return [int(x) for x in input().split()]
MOD = 10**9 + 7

sx, sy, tx, ty = LIST()
dx = tx - sx
dy = ty - sy

trace = ""

# 1
trace += 'R' * dx
trace += 'U' * dy

# 2
trace += 'L' * dx
trace += 'D' * dy

# 3
trace += 'D'
trace += 'R' * (dx + 1)
trace += 'U' * (dy + 1)
trace += 'L'

# 2
trace += 'U'
trace += 'L' * (dx + 1)
trace += 'D' * (dy + 1)
trace += 'R'

print(trace)


Measured memory_bytes: 3064