akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<fstream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#include<list>
#include<unordered_map>
#include<random>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
// #define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll n,ans=0;
    string a,b,c;
    cin>>n>>a>>b>>c;
    rep(i,n){
        map<ll,ll> mp;
        mp[a[i]-'a']++;
        mp[b[i]-'a']++;
        mp[c[i]-'a']++;
        ans+=mp.size()-1;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <regex>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define sort(a)         sort((a).begin(), (a).end())
#define uniq(a)         SORT(a);(a).erase(unique((a).begin(), (a).end()), (a).end())
#define reverse(a)      reverse((a).begin(), (a).end())
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define YES()           cout << "YES" << endl
#define NO()            cout << "NO" << endl
#define Yes()           cout << "Yes" << endl
#define No()            cout << "No" << endl
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }

using namespace std;
using ll = long long;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7

void solve() {
  int a, b; cin >> a >> b;
  string s; cin >> s;
  for (int i = 0; i < s.size(); i++) {
    if (i == a) {
      if (s[i] != '-') {
        No();
        return;
      }
    } else if ('0' <= s[i] && s[i] <= '9') {
      // do nothing
    } else {
        No();
        return;
    }
  }
  Yes();
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


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

using namespace std;

struct edge {int to, cap, rev; };

vector<edge> G[202];
bool used[202];

void add_edge(int from, int to, int cap)
{
    G[from].push_back((edge){to, cap, G[to].size()});
    G[to].push_back((edge){from, 0, G[from].size() - 1});
}

int dfs(int v, int t, int f)
{
    if (v == t) return f;
    used[v] = true;
    for(int i = 0; i < G[v].size(); i++)
    {
        edge &e = G[v][i];
        if(!used[e.to] && e.cap > 0)
        {
            int d = dfs(e.to, t, min(f, e.cap));
            if(d > 0)
            {
                e.cap -=d;
                G[e.to][e.rev].cap += d;
                return d;
            }
        }
    }
    return 0;
}

int max_flow(int s, int t)
{
    int flow = 0;
    for(;;)
    {
        for(auto &e : used) e = 0;
        int f = dfs(s, t, INT32_MAX);
        if (f == 0) return flow;
        flow += f;
    }
}

int main() {
    int n;
    cin >> n;
    vector<pair<int, int>> red(n);
    vector<pair<int, int>> blue(n);
    for(int i = 0; i < n; i++)
    {
        int a, b;
        cin >> a >> b;
        red[i] = {a, b};
    }
    for(int i = 0; i < n; i++)
    {
        int c, d;
        cin >> c >> d;
        blue[i] = {c, d};
    }
    for(int i = 0; i < n; i++)
    {
        for(int j = 0; j < n; j++)
        {
            if(red[i].first < blue[j].first && red[i].second < blue[j].second)
            {
                add_edge(i + 1, j + 1 + n, 1);
            }
        }
    }
    //ソースからの辺を追加
    for(int i = 0; i < n; i++)
    {
        add_edge(0, i + 1, 1);
    }
    //シンクへの辺を追加
    for(int i = 0; i < n; i++)
    {
        add_edge(i + 1 + n, 201, 1);
    }
    cout << max_flow(0, 201) << endl;
    return 0;
}


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

int main()
{
  int n;
  string s;
  cin >> n >> s;
  n%=26;
  for(int i=0;i<s.size();++i){
    s.at(i)+=n;
    if(s.at(i)>90){
      s.at(i)-=26;
    }
    cout << s.at(i);
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define ALL(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define reps(i, m, n) for (ll i = m; i < n; i++)
#define repr(i, m, n) for (ll i = m; i >= n; i--)
#define de(x) cout << #x << "=" << x << endl;
template <class T> bool maxi(T &a, const T &b) {
    if (a < b) { a = b; return 1;} return 0;}
template <class T> bool mini(T &a, const T &b) {
    if (b < a) { a = b; return 1;} return 0;}
#define dame {cout<< "-1" <<"\n"; return;}
#define INF2 1000000000000000037
#define INF  1000000007
#define MOD  1000000007
using namespace std;
using ll = long long;
using ld = long double;
using P  = pair<ll,ll>;
//--GLOBAL---------------------------------

ll dp[100000];
//--MAIN-----------------------------------
void Main() {
    ll H,N; cin>>H>>N;

    vector<ll> A(N);
    vector<ll> B(N);
    rep(i,N) cin>>A[i]>>B[i];
    rep(i,100000) dp[i]=INF2;
    dp[0]=0;
    rep(i,H+1){
        rep(j,N){
            ll damage=i+A[j];
            ll cost=dp[i]+B[j];
            if(damage>H) damage=H;
            mini(dp[damage],cost);
        }
    }
    cout<< dp[H] <<"\n";
}

//--START----------------------------------
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}
//-----------------------------------------


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


void solve(long long N, long long K, std::vector<long long> A){
    map<ll, ll> ans;
    for(ll i=0; i< N; i++){
        if(!ans.count(A[i])){
            ans[A[i]] = 1;
        }
        else 
            ans[A[i]] ++;
    }
    vector<ll> p;
    map<ll, ll>::iterator it;
    for( it = ans.begin(); it != ans.end(); ++it){
        p.push_back(it->second);
    }
    sort(p.begin(), p.end());
    ll cnt = 0, n= ans.size()-K;
    for(ll i=0; i< n; i++){
        cnt += p[i];
    }
        
    cout << cnt << endl;


}

int main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, K, std::move(A));
    return 0;
}


Measured memory_bytes: 16500
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define ALL(x) (x).begin(), (x).end()
const long long INF = 1e18;
using namespace std;
typedef long long ll;
vector<ll> divisor(ll n) {
  vector<ll> ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

int main() {
  ll N;
  cin >> N;
  ll a[N];
  ll sum[N];
  vector<ll> ans;
  ll num = 0;
  REP(i, N) {
    cin >> a[i];
    sum[i] = 0;
  }
  FORR(i, N - 1, 0) {
    if (sum[i] % 2 == a[i]) {
    } else {
      num++;
      ans.push_back(i + 1);
      auto v = divisor((ll)(i + 1));
      for (auto x : v) {
        sum[x - 1]++;
      }
    }
  }
  cout << num << endl;
  for (auto x : ans) {
    cout << x << " ";
  }

  return 0;
}

Measured memory_bytes: 4980
#include <bits/stdc++.h>
#ifdef _WIN32
#include "debug.hpp"
#endif
using namespace std;

#define rep(i, N)  for(int i = 0; i < (N); i++)
#define reps(i, N) for(int i = 1; i <= (N); i++)
#define repr(i, N) for(int i = (N) - 1; i >= 0; i--)
#define pub push_back

template<typename T> 
void chmax(T &a, T b){ a = max(a, b); };
template<typename T> 
void chmin(T &a, T b){ a = min(a, b); };

typedef long long ll;
typedef pair<int, int> P;
const int INF = 100000000;
const ll LINF = 10000000000000000;
const int MOD = 1000000007;
const int dx[9] = { 0, 1,  0, -1, 1,  1, -1, -1, 0};
const int dy[9] = { 1, 0, -1,  0, 1, -1, -1,  1, 0};
//--------------------------------------//
int x, y;

void solve(){
	if(x == y) {
		cout << 0 <<endl;
		return;
	}
	if(x == 0 and y < 0){
		cout << abs(y) + 1 << endl;
		return;
	}
	else if(x == 0 and y > 0){
		cout << y << endl;
		return;
	}
	bool a = (x > 0);
	bool b = (y > 0);
	bool c = (abs(x) <= abs(y));
	int d = abs(abs(y) - abs(x));
	if((a and b and c) or !(a or b or c)){
		cout << d << endl;
	}
	else if((!a and !b and c) or (a and b and !c)){
		cout << d + 2 << endl;
	}
	else{
		cout << d + 1 << endl;
	}
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> x >> y;
		solve();
	return 0;
}


Measured memory_bytes: 256
def gcd(m, n):
    if n == 0:
        return m
    return gcd(n, m % n)


def m():
    n = int(input())
    a = list(map(int, input().split()))
    tmp = a[0]
    ans = 0
    modv = tmp
    for i in range(1, n):
        tmp = gcd(modv, a[i])
        modv = (modv*a[i] // tmp)
    for i in range(n):
        ans += (modv-1) % a[i]
    return ans
print(m())

Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define  MOD 1000000007
#define ff 10e16
ll power(ll x, ll y) 
{ 
    ll res = 1;
    x = x % MOD;
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % MOD;
            y = y>>1; 
        x = (x*x) % MOD;   
    } 
    return res; 
} 
ll mod(ll x)
{
	if(x<0)
	return -x;
	else
	return x;
}
int main()
{
	ll n;
	cin>>n;
	ll h[n];
	for(ll i=0;i<n;i++)
	{
		cin>>h[i];
	}
	ll dp[n]={0};
	dp[0]=0;
	dp[1]=mod(h[1]-h[0]);
	for(ll i=2;i<n;i++)
	{
		dp[i]=min((dp[i-2]+mod(h[i]-h[i-2])),(dp[i-1]+mod(h[i]-h[i-1])));
	}
	cout<<dp[n-1]<<endl;
}

Measured memory_bytes: 1792
import java.util.Arrays;
import java.util.Scanner;
import java.math.*;

class Main{
	static final int INF = 114514810;
	static int n, m;
	static Scanner sc = new Scanner(System.in);
	
	public static void main(String[] args){
		while(true){
			n = sc.nextInt();
			m = sc.nextInt();
			if(n == 0) return;
			
			solve();
		}
	}
	
	static void solve(){
		int[] point = new int[n+10];
		for(int i = 0; i < n+10; i++) point[i] = INF;
		
		for(int i = 0; i < n; i++){
			point[i] = sc.nextInt();
		}
		n++;
		point[n]=0;
		Arrays.sort(point);
		
		int[] enu = new int[n*n];
		for(int i = 0; i < n; i++){
			for(int j = 0; j < n; j++){
				enu[i*n+j] = point[i]+point[j];
			}
		}
		Arrays.sort(enu);
		
		int j = n*n-1, ans=0;
		for(int i = 0; i < n*n; i++){
			while(enu[i]+enu[j] > m && j > 0) j--;
			if(enu[i]+enu[j] <= m) ans = Math.max(ans, enu[i]+enu[j]);
		}
		
		System.out.println(ans);
	}
}

Measured memory_bytes: 58752
#include <bits//stdc++.h>
using namespace std;
int main(void){
    int a,b,c,i,j,ans;
    ans=0;
    string s;
    cin>>s;
    if(s[0]=='S')
    cout<<"Cloudy"<<endl;
    else if(s[0]=='C')
    cout<<"Rainy"<<endl;
    else
    cout<<"Sunny"<<endl;
    

    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define MOD 1000000007
using namespace std;
int main() {
    int n, m;
    cin >> n >> m;
    vector<vector<int>> edge(n);
    vector<int> h(n);
    for(int i = 0; i < n; i++) {
        cin >> h[i];
    }
    for(int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        edge[a].push_back(b);
        edge[b].push_back(a);
    }
    int ans = 0;
    for(int i = 0; i < n; i++) {
        int M = 0;
        for(auto e : edge[i]) {
            M = max(M, h[e]);
        }
        if(M < h[i]) {
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 8804
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip> // cout<<setprecision(n)
#include <functional> // std::function<void(ll)>
using namespace std;
#define All(v) (v).begin(),(v).end()
typedef long long ll;
const ll mod = 1000000007;
const ll inf = mod*mod;
const ll d5 = 114514;
const double EPS = 1e-10;
const double INF = 1e+10;
const double PI = acos(-1.0);
int main(){
    int a;
    string s;
    cin>>a>>s;
    if(a>=3200)cout<<s<<endl;
    else cout<<"red"<<endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python

a, b, x = map(int, input().split())

if a == b:
    if a%x == 0:
        print(1)
    else:
        print(0)
    exit()
if a%x == 0 and b%x == 0:
    ans = b//x - a//x + 1 
    print(ans)
    exit()
if a%x != 0 and b%x != 0:
    ans = b//x - a//x
    print(ans)
    exit()
if a%x == 0 and b%x != 0:
    ans = b//x - a//x + 1 
    print(ans)
    exit()
ans = b//x - a//x 
print(ans)


Measured memory_bytes: 9124
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
using namespace std;
#define testing 1
#define FOR(i,s,e) for(ll i = s; i <= (ll)e; ++i)
#define DEC(i,s,e) for(ll i = s; i >= (ll)e; --i)
#define IAMSPEED ios_base::sync_with_stdio(false); cin.tie(0);
#define db(x) cerr << #x << "=" << x << "\n"
#define db2(x, y) cerr << #x << "=" << x << " , " << #y << "=" << y << "\n"
#define db3(a,b,c) cerr<<#a<<"="<<a<<","<<#b<<"="<<b<<","<<#c<<"="<<c<<"\n"
#define dbv(v) cerr << #v << ":"; for (auto ite : v) cerr << ite << ' '; cerr <<"\n"
#define dbvp(v) cerr << #v << ":"; for (auto ite : v) cerr << "{"  << ite.f << ',' << ite.s << "} "; cerr << "\n"
#define dba(a,ss,ee) cerr << #a << ":"; FOR(ite,ss,ee) cerr << a[ite] << ' '; cerr << "\n"
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define ll long long 
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define f first
#define s second
#define reach cerr << "LINE: " << __LINE__ << "\n";
typedef pair <ll, ll> pi;
typedef tuple<ll,ll,ll> ti3;
string cts(char x) {string t(1,x); return t;}
ll rand(ll a, ll b) { return a + rng() % (b-a+1); }
const int MOD = 1e9 + 7;
const int inf = (int)1e9 + 500;
const long long oo = (ll)1e18 + 500;
template <typename T> void chmax(T& a, T b) { a = max(a, b); }
template <typename T> void chmin(T& a, T b) { a = min(a, b); }
const int MAXN = 1e5+5;
#if !testing
#define cerr if(0)cout
#endif
bool good[MAXN];
int A[MAXN];
int32_t main() 
{
	IAMSPEED
	int n,m; cin >> n >> m;
	FOR(i,1,n)good[i]=1;
	FOR(i,1,n) cin >> A[i];
	FOR(i,1,m) {
		int a,b; cin >> a >> b;
		if(A[a]>=A[b])good[b]=0;
		if(A[b]>=A[a])good[a]=0;
	}
	int ans = 0;
	FOR(i,1,n)ans+=good[i];
	cout<<ans;
}



Measured memory_bytes: 4152
N = int(input())

A = []
for i in range(1,N+1):
  a=list(input().split())
  a.append(str(i))
  A.append(a)

A.sort(key=lambda x: int(x[1]), reverse=True)
A.sort(key=lambda x: x[0])
#print(A)
for i in range(N):
  print(A[i][2])

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

using namespace std;

int main(void) {
	int num, i = 0, j = 0, ans;
	cin >> num;
	vector<int> d(num);
	for (; i < num; i++)
		scanf("%d", &d[i]);
	while (j < num - 1) {
		sort(d.begin(), d.end());
		while (d[j] == 0)
			j++;
		ans = d[j];
		for (i = j + 1; i < num; i++)
			d[i] %= ans;
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 640
import java.util.Scanner;
class Main{
	static Scanner sc;
	static boolean flg,h0flg;
	static long n0,n1,n2,x0,x1,x2;
	static String instr,substr0;
	public static void main(String[]args){
		sc=new Scanner(System.in);
		while(sc.hasNext()){
			instr=new String();
			n0=0L;n1=0L;n2=0L;
			x0=0L;x1=0L;x2=0L;
			instr=sc.next();
			flg=false;
			h0flg=false;
			substr0=instr.substring(0,instr.indexOf("+"));
			for(int i=0;i<substr0.length();i++){
				if(substr0.substring(i,i+1).equals("X")){
					x0=x0+(long)Math.pow(10,(substr0.length()-1-i));
					if(i==0 && substr0.length()>1){h0flg=true;}
				}else{
					n0=n0+(long)(Integer.parseInt(substr0.substring(i,i+1)))*(long)Math.pow(10,(substr0.length()-1-i));
				}
			}
			instr=instr.substring(instr.indexOf("+")+1,instr.length());
			substr0=instr.substring(0,instr.indexOf("="));
			
			for(int i=0;i<substr0.length();i++){
				if(substr0.substring(i,i+1).equals("X")){
					x1=x1+(long)Math.pow(10,(substr0.length()-1-i));
					if(i==0 && substr0.length()>1){h0flg=true;}
				}else{
					n1=n1+(long)(Integer.parseInt(substr0.substring(i,i+1)))*(long)Math.pow(10,(substr0.length()-1-i));
				}
			}	
			substr0=instr.substring(instr.indexOf("=")+1,instr.length());
			for(int i=0;i<substr0.length();i++){
				if(substr0.substring(i,i+1).equals("X")){
					x2=x2+(long)Math.pow(10,(substr0.length()-1-i));
					if(i==0 && substr0.length()>1){h0flg=true;}
				}else{
					n2=n2+(long)(Integer.parseInt(substr0.substring(i,i+1)))*(long)Math.pow(10,(substr0.length()-1-i));
				}
			}
			for(int i=0;i<10;i++){
				if(i*x0+n0+i*x1+n1==i*x2+n2){
					if(i>0 || (i==0 && h0flg==false)){
						System.out.println(i);
						flg=true;
					}
				}
			}
			if(flg==false){
				System.out.println("NA");
			}
		}
	}
}

Measured memory_bytes: 18212
# ＤＦＳ, パターン列挙_全探索用

n = int(input())

# DFS_start
stack = [0] # 初期化_ここでは'0'を設置
pre_ans = [] # パターン候補の器_初期化

while stack: # stackが空になるまでループ
    tmp = stack.pop() # パターンの候補を pop
    if tmp <= n: # パターンとしての条件を確認
        pre_ans.append(tmp) # 条件に合えば append
        x = tmp * 10 + 3 # パターンの候補を作成して...
        y = tmp * 10 + 5 # 〃
        z = tmp * 10 + 7 # 〃
        stack += [x, y, z]  # 積む
# DFS_end

ans = 0
for i in pre_ans: # 列挙したパターンを全探索
    if len(set(str(i))) == 3:
        ans += 1

print(ans)


'''
上記は パターンを列挙 → 全探索 だが、
実際には パターンを列挙 しながら 探索 が高効率

n = int(input())

stack = [0]
ans = 0
while stack:
    tmp = stack.pop()
    if tmp <= n:
        if len(set(str(tmp))) == 3:
            ans += 1
        x = tmp * 10 + 3
        y = tmp * 10 + 5
        z = tmp * 10 + 7
        stack += [x, y, z]

print(ans)

'''

Measured memory_bytes: 4468
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <sstream>
#include <cmath>
#include <functional>
#include <fstream>
#include <cstdlib>
typedef long long ll;
const int MOD = 1e9+7;


#define REP(i, N) for (int i = 0; i < (N); i++)
#define REPP(i, a, b) for (int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define VSORT(c) sort((c).begin(),(c).end())
#define SZ(x) ((int)(x).size())
//vvintを作る　マクロで　 #define vvint(N,M) vector<vector<int>>

using namespace std;


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

    int n;
    cin >> n;
    vector<pair<int,int> > A;

    pair<int,int> a;
    int tmp;
    for(int i = 0; i < n;i++){
        cin >> tmp;
        A.push_back(make_pair(tmp,i+1));
    }

    VSORT(A);
    for(int i = 0; i < n;i++){
        cout << A[i].second << " ";
    }
    

    return 0;
}

Measured memory_bytes: 1780
a = [list(map(int, input().split())) for _  in range(3)]
n = int(input())
#b = [list(map(int, input().split())) for _ in range(n)]

while n > 0:
    b = int(input())
    for i in range(3):
        for j in range(3):
            if b == a[i][j]:
                a[i][j] = "Yes"
    n -= 1
if a[0][0] == a[0][1] == a[0][2]:
    print("Yes")
elif a[1][0] == a[1][1] == a[1][2]:
    print("Yes")
elif a[2][0] == a[2][1] == a[2][2]:
    print("Yes")
elif a[0][0] == a[1][0] == a[2][0]:
    print("Yes")
elif a[0][1] == a[1][1] == a[2][1]:
    print("Yes")
elif a[0][2] == a[1][2] == a[2][2]:
    print("Yes")
elif a[0][0] == a[1][1] == a[2][2]:
    print("Yes")
elif a[0][2] == a[1][1] == a[2][0]:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3064
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
	//文字列から10進数に変換するときはparseIntを使います
	var x = parseInt(input[0], 10);

  var add;
  var now = 100;
  for(var i=0;;i++){
    if(now >= x) break;
    //add = parseInt(100*0.01);
    now += parseInt(now*0.01, 10);;
  }
	//出力
	console.log('%d', i);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 29948
use proconio::input;
use proconio::marker::Chars;

fn main() {
    input! {
        s: Chars
    }

    let mut ten = 1;
    let mut sum = 0;
    let mut cnt: Vec<u64> = vec![0; 2019];
    cnt[0] = 1;
    for i in (0..s.len()).rev() {
        let num = s[i].to_digit(10).unwrap() as u64;

        ten *= 10;
        ten %= 2019;
        sum += num * ten;
        sum %= 2019;

        cnt[sum as usize] += 1;
    }

    let mut ans: u64 = 0;
    for m in cnt {
        if m > 0 {
            ans += m * (m - 1) / 2;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 3044
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

A, B, Q = mi()

S = [ii() for _ in range(A)]
T = [ii() for _ in range(B)]

S_ = [S[0]] + S + [S[A-1]]
T_ = [T[0]] + T + [T[B-1]]

for _ in range(Q):
    f = ii()
    to_s = bisect.bisect_left(S, f)
    to_t = bisect.bisect_left(T, f)
    #ans_1 = ans_2 = 0
    #print(to_s, to_t)

    #ans_1 += abs(S_[to_s+1] - f)
    #ans_2 += abs(f - S_[to_s])
    #print(ans_1, ans_2)

    #ans_1 = min(ans_1 + abs(S_[to_s+1] - T_[to_t+1]), ans_1 + abs(S_[to_s+1] - T_[to_t]))
    #ans_2 = min(ans_2 + abs(S_[to_s] - T_[to_t+1]), ans_2 + abs(S_[to_s] - T_[to_t]))

    ans = min(abs(S_[to_s+1] - f) + abs(S_[to_s+1] - T_[to_t+1]), float('inf'))
    ans = min(abs(S_[to_s+1] - T_[to_t+1]) + abs(f- T_[to_t+1]), ans)
    ans = min(abs(S_[to_s+1] - f) + abs(S_[to_s+1] - T_[to_t]), ans)
    ans = min(abs(S_[to_s+1] - T_[to_t]) + abs(f- T_[to_t]), ans)
    ans = min(abs(S_[to_s] - f) + abs(S_[to_s] - T_[to_t+1]), ans)
    ans = min(abs(S_[to_s] - T_[to_t+1]) + abs(f- T_[to_t+1]), ans)
    ans = min(abs(S_[to_s] - f) + abs(S_[to_s] - T_[to_t]), ans)
    ans = min(abs(S_[to_s] - T_[to_t]) + abs(f- T_[to_t]), ans)
    print(ans)

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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf=1e9;
const int64_t inf64=1e18;
const double eps=1e-9;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

int64_t gcd(int64_t a,int64_t b){
	if(b==0) return a;
	return gcd(b,a%b);
}

int64_t lcm(int64_t a,int64_t b){
	return a/gcd(a,b)*b;
}

void solve(int n){
    map<int,vector<int>> x;
    rep(i,0,n){
        int d,t;
        cin >> d >> t;
        if(x.find(d)==x.end()) x[d].resize(d);
        rep(j,0,d){
            int a;
            cin >> a;
            x[d][(j-t+d)%d]+=a;
        }
    }

    for(;;){
        bool update=false;
        for(auto &p:x){
            for(auto &q:x){
                const int a=p.first,b=q.first;
                if(a==b) continue;
                const int c=lcm(a,b),d=gcd(a,b);
                if(d==1) continue;
                vector<int> v=x[c];
                if(v.empty()) v.resize(c);
                rep(i,0,c){
                    if(a!=c) v[i]+=p.second[i%a];
                    if(b!=c) v[i]+=q.second[i%b];
                }
                x.erase(a);
                x.erase(b);
                x[c]=v;

                update=true;
                break;
            }
            if(update) break;
        }
        if(!update) break;
    }

    int ans=0;
    for(auto &p:x){
        int ma=0;
        for(int a:p.second) ma=max(ma,a);
        ans+=ma;
    }
    cout << ans << endl;
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(10);
    for(;;){
        int n;
        cin >> n;
        if(!n) break;
        solve(n);
    }
    return 0;
}

Measured memory_bytes: 3352
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main()
{
    int h, w;
    cin >> h >> w;

    long long dif = 1e12;

    long long s1, s2, s3;

    for (long long i=1; i<=h; i++) {
        long long t = w/2;
        s1 = w * i;
        s2 = (h - i) * t;
        s3 = (h - i) * (w - t);
        dif = min(dif, max(max(s1, s2), s3) - min(min(s1, s2), s3));
    }

    for (long long i=1; i<=h; i++) {
        long long t = (h - i) / 2;
        s1 = w * i;
        s2 = w * t;
        s3 = w * (h - (i + t));
        dif = min(dif, max(max(s1, s2), s3) - min(min(s1, s2), s3));
    }

    for (long long i=1; i<=w; i++) {
        long long t = h/2;
        s1 = h * i;
        s2 = (w - i) * t;
        s3 = (w - i) * (h - t);
        dif = min(dif, max(max(s1, s2), s3) - min(min(s1, s2), s3));
    }

    for (long long i=1; i<=w; i++) {
        long long t = (w - i) / 2;
        s1 = h * i;
        s2 = h * t;
        s3 = h * (w - (i + t));
        dif = min(dif, max(max(s1, s2), s3) - min(min(s1, s2), s3));
    }

    cout << dif << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);

    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    double ans,d,t,s;
    cin>>d>>t>>s;
    ans=d/s;
    if(ans<=t)cout<<"Yes\n";
    else cout<<"No\n";
}


Measured memory_bytes: 3736
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

#define ull unsigned long long int
#define ll long long
#define vi vector<int>
#define mii map<int,int>
#define all(x) x.begin(),x.end()
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define pb push_back 
#define MOD 1e9+7
#define INF 0x3f3f3f3f
using namespace std;
int dx[]={-1,0,1,0}; 
int dy[]={0,1,0,-1};

int main()
{
long long x,n;
cin>>x>>n;
if(n==0)
{
    cout<<x<<endl;
    return 0 ; 
}
unordered_map<int,int> u ;
int num;
for(int i = 0 ;i<n ;i++)
{
    cin>>num;
    u[num]++;
}
long long ans = x;
bool flag =true;
int a = x,b = x;
while(flag)
{
    if(!u[a])
    {
        ans= a;
        flag = false;
        break;
    }
    a--;
    if(!u[b])
    {  ans = b;
        flag = false;
        break;
    }
    b++;
}
cout<<ans<<endl;
}


Measured memory_bytes: 3612
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    n <- getInt
    as <- getIntList
    bs <- getIntList
    cs <- getIntList
    print $ (sum bs) + (solve as cs)

solve [] _ = 0
solve [a] _ = 0
solve (a1 : a2 : as) cs | a2 - a1 == 1 = (cs !! (a1 - 1)) + solve (a2 : as) cs
                        | otherwise = solve (a2 : as) cs

Measured memory_bytes: 380
#include <iostream>
using namespace std;
#pragma warning (disable: 4996)

long long mod = 1000000007;
long long N, K, A[100009], B1, B2;

int main() {
	cin >> N >> K;
	for (int i = 0; i < N; i++) cin >> A[i];
	for (int i = 0; i < N; i++) {
		for (int j = i + 1; j < N; j++) {
			if (A[i] > A[j]) B1++;
		}
	}
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			if (A[i] > A[j]) B2++;
		}
	}
	long long C1 = K;
	long long C2 = K * (K - 1) / 2LL; C2 %= mod;
	cout << (B1*C1 + B2 * C2) % mod << endl;
	return 0;
}


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

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

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

std::vector<std::vector<int>> vec(4, std::vector<int>(4, 0));
int w = -1000;
int main() {
    for (int i = 1; i <= 3; i++) {
        std::cin >> vec[i][1] >> vec[i][2] >> vec[i][3];
    }
    for (int i = 2; i <= 3; i++) {
        w = -1000;
        for (int p = 1; p <= 3; p++) {
            if (w == -1000) {
                w = vec[i][p] - vec[i-1][p];
            }
            else {
                if (w != (vec[i][p]-vec[i-1][p])) {
                    std::cout << "No" << std::endl;
                    return 0;
                }
            }
        }
    }
    
    for (int i = 2; i <= 3; i++) {
        w = -1000;
        for (int p = 1; p <= 3; p++) {
            if (w == -1000) {
                w = vec[p][i] - vec[p][i-1];
            }
            else {
                if (w != (vec[p][i] - vec[p][i-1])) {
                    std::cout << "No" << std::endl;
                    return 0;
                }
            }
        }
    }
    std::cout << "Yes" << std::endl;
}


Measured memory_bytes: 256
n, k = gets.chomp.split.map(&:to_i)
pos_flag = Array.new(n,0)

k.times do
  d = gets.chomp.to_i
  if d == 1
    a = gets.to_i
#    p "d: #{d}, a: #{a}"
    pos_flag[a-1] = 1
  else
    a = gets.chomp.split.map(&:to_i)
    a.each do |i|
      pos_flag[i-1] = 1
#      p "d: #{d}, i-1: #{i-1}, flg: #{pos_flag}"
    end
  end
end

cnt = 0
(0...n).each do |i|
  cnt += 1 if pos_flag[i] == 0
end

p cnt

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

int a[100000];

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
		cin>>a[i];
	sort(a,a+n);
	int ans=0;
	ans+=(a[n-1]-a[0]);
	for(int i=1;i<=n-2;i++)
		ans+=abs(a[i]);
	cout<<ans<<'\n';
	int tmp1=a[n-1],tmp2=a[0];
	for(int i=1;i<n-1;i++)
		if(a[i]<=0){
			cout<<tmp1<<' '<<a[i]<<'\n';
			tmp1-=a[i];
		}
	for(int i=1;i<n-1;i++)
		if(a[i]>0){
			cout<<tmp2<<' '<<a[i]<<'\n';
			tmp2-=a[i];
		}
	cout<<tmp1<<' '<<tmp2<<'\n';
}


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

int main(){
    int n , m , i , ptflg = 1 ;
    cin >> n >> m ;
    vector<vector<int>> adj(n+1) ;
    for(i=0;i<m;++i){
        int t1 , t2 ; cin >> t1 >> t2 ;
        adj[t1].push_back(t2) ;
        adj[t2].push_back(t1) ;
    }
    vector<bool> vis(n+1,false) ;
    vector<int> pto1(n+1,-1) ;
    queue<int> que ;
    que.push(1) ;
    while(!que.empty()){
        int t3 = que.front() ;
        que.pop() ;
        for(i=0;i<adj[t3].size();++i){
            if(!vis[adj[t3][i]]){
                vis[adj[t3][i]] = true ;
                que.push(adj[t3][i]) ;
                pto1[adj[t3][i]] = t3 ;
            }
        }
    }
    for(i=2;i<=n;++i)
        if(pto1[i]==-1) ptflg = 0 ;
    if(ptflg==1){
        cout << "Yes\n" ;
        for(i=2;i<=n;++i) cout << pto1[i] << "\n" ;
    }
    else cout << "No\n" ;
    return 0 ;
}

Measured memory_bytes: 10180
n=int(input())
a=[]
ans=1
for i in range(n):
    b=int(input())
    a.append(b)
c=a[0]
if(c==2):
    print(ans)
else:
    while(c!=2):
        ans+=1
        c=a[c-1]
        if(ans>len(a)):
            print(-1)
            exit()
    print(ans)

Measured memory_bytes: 7084
#pragma region
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>
#include <list>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define all(x) x.begin(),x.end()
#pragma endregion


int main()
{
	int n, m, k; cin >> n >> m >> k;
	for (int i = 0; i <= n; ++i)for (int j = 0; j <= m; ++j)
	{
		if (i*m + j * n - 2*i * j == k)
		{
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <chrono>
#include <math.h>
using namespace std;

using lli = long long int;
using Vint = std::vector<int>;
using Vlli = std::vector<lli>;
using Wint = std::vector<Vint>;
using Wlli = std::vector<Vlli>;
using Vbool = std::vector<bool>;
using pii = std::pair<int, int>;
using pll = std::pair<lli, lli>;

constexpr int MOD = 1e9 + 7;
constexpr int INFi = 2e9 + 1;
constexpr lli INFl = (lli)(9e18) + 1;
const vector<pii> DXDY = {std::make_pair(1, 0), std::make_pair(-1, 0), std::make_pair(0, 1), std::make_pair(0, -1)};
constexpr char BR = '\n';

#define FOR(i, a, b) for(int (i) = (a); (i) < (b); (i)++)
#define FOReq(i, a, b) for(int (i) = (a); (i) <= (b); (i)++)
#define rFOR(i, a, b) for(int (i) = (b); (i) >= (a); i--)
#define FORstep(i, a, b, step) for(int (i) = (a); i < (b); i += (step))
#define REP(i, n) FOR(i, 0, n)
#define rREP(i, n) rFOR(i, 0, (n-1))
#define vREP(ele, vec) for(auto &(ele) : (vec))
#define vREPcopy(ele, vec) for(auto (ele) : (vec))
#define SORT(A) std::sort((A).begin(), (A).end())


template <class T> inline int argmin(vector<T> vec){return min_element(vec.begin(), vec.end()) - vec.begin();}
template <class T> inline int argmax(vector<T> vec){return max_element(vec.begin(), vec.end()) - vec.begin();}
template <class T> inline void chmax(T &a, T b){a = max(a, b);}
template <class T> inline void chmin(T &a, T b){a = min(a, b);}
inline int toInt(string &s){int res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
inline int toInt(const string s){int res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
inline long long int toLong(string &s){lli res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
inline long long int toLong(const string s){lli res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
template <class T> inline std::string toString(T n){
  if(n == 0) return "0";
  std::string res = "";
  if(n < 0){n = -n;while(n != 0){res += (char)(n % 10 + '0'); n /= 10;}
  std::reverse(res.begin(), res.end()); return '-' + res;}
  while(n != 0){res += (char)(n % 10 + '0'); n /= 10;} std::reverse(res.begin(), res.end()); return res;
}

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

int n, m, q, l, r;
Wint Data(501, Vint(501, 0));

int main(void){
  // Q ≤ 10^5の質問に答える -> Q(1), O(logM)で答えたい
  // N ≤ 500 => N^2 ≤ 2.5 * 10^5
  //
  cin >> n >> m >> q;
  REP(_, m){
    cin >> l >> r;
    Data[l-1][r-1]++;
  }
  REP(i, n) REP(j, n-1) Data[i][j+1] += Data[i][j];
  rREP(i, n-1) REP(j, n) Data[i][j] += Data[i+1][j];
  REP(_, q){
    cin >> l >> r;
    cout << Data[l-1][r-1] << BR;
  }
  return 0;
}

Measured memory_bytes: 1920
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

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

int int_sort( const void * a , const void * b ) {
  return strcmp(( char * )a , ( char * )b );
}

long long min(long long a,long long b){return a < b ? a : b;}
long long nCr(long long n,long long r)
{
    long long i,ret = 1;
    for (i = 0; i < min(n - r,r); i++)
    {
        ret *= n - i;
        ret /= i + 1;
    }
    return ret;
}

int main()
{
    int i,cnt = 1,n;
    char s[100000][11],buf[11];

    long long ans = 0;

    scanf("%d",&n);
    for (i = 0; i < n; i++)
    {
        scanf("%s",buf);
        qsort(buf,10,sizeof(char),asc);
        strcpy(s[i], buf);
    }
    qsort((void *)s,n,sizeof(s[0]),int_sort);
    for (i = 1; i < n; i++)
    {
        if(strcmp(s[i - 1], s[i]) == 0)cnt++;
        else
        {
            if(cnt != 1)
            {
                ans += nCr(cnt,2);
            }
            cnt = 1;
        }
    }
    if(cnt != 1)
    {
        ans += nCr(cnt,2);
    }
    cnt = 1;
    printf("%lld",ans);
}

Measured memory_bytes: 2300
import java.util.*;
import java.io.*;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		
		int n = scanner.nextInt();
		char[] S = new char[n];
		int[] A = new int[n];
		
		for (int i = 0; i < n; i ++) {
			S[i] = scanner.next().charAt(0);
			A[i] = scanner.nextInt();
		}
		
		scanner.close();
		
		char[] T = S.clone();
		int[] B = A.clone();
		
		quickSort(S, A, 0, n - 1);
		mergeSort(T, B, 0, n);
		
		if(Arrays.equals(A, B) && Arrays.equals(S, T)) {
			System.out.println("Stable");
		} else {
			System.out.println("Not stable");
		}
		
		for (int i = 0; i < n; i ++) {
			System.out.println(S[i] + " " + A[i]);
		}
	}
	
	public static int partition (char[] S, int[] A, int p, int r) {
		int x = A[r];
		int i = p - 1;
		
		for (int j = p; j < r; j++) {
			if (A[j] <= x) {
				i ++;
				char tempc = S[i];
				S[i] = S[j];
				S[j] = tempc;
				int temp = A[i];
				A[i] = A[j];
				A[j] = temp;
			}
		}

		char tempc = S[++ i];
		int temp = A[i];
		S[i] = S[r];
		A[i] = A[r];
		S[r] = tempc;
		A[r] = temp;

		return i;
	}

	public static void quickSort(char[] S, int[] A, int p, int r) {
		if (p < r) {
			int q = partition(S, A, p, r);
			quickSort(S, A, p, q - 1);
			quickSort(S, A, q + 1, r);
		}
	}

	public static int merge(char[] T, int[] A, int left, int mid, int right) {
		int count = 0;

		int n1 = mid - left;
		int n2 = right - mid;

		int[] L = new int[n1 + 1];
		char[] LT = new char[n1];
		int[] R = new int[n2 + 1];
		char[] RT = new char[n2];

		System.arraycopy(A, left, L, 0, n1);
		L[n1] = Integer.MAX_VALUE;
		System.arraycopy(T, left, LT, 0, n1);
		System.arraycopy(A, mid, R, 0, n2);
		R[n2] = Integer.MAX_VALUE;
		System.arraycopy(T, mid, RT, 0, n2);

		int i = 0;
		int j = 0;

		for (int k = left; k < right; k ++) {
			count ++;
			if (L[i] <= R[j]) {
				A[k] = L[i];
				T[k] = LT[i];
				i ++;
			} else {
				A[k] = R[j];
				T[k] = RT[j];
				j ++;
			}
		}

		return count;
	}

	public static int mergeSort(char[] T, int[] A, int left, int right) {
		int count = 0;

		if (left + 1 < right) {
			int mid = (left + right) / 2;
			count += mergeSort(T, A, left, mid);
			count += mergeSort(T, A, mid, right);
			count += merge(T, A, left, mid, right);
		}

		return count;
	}
} 



Measured memory_bytes: 109404
A = []
for _ in range(3):
    a = list(map(int, input().split()))
    A.append(a)

import numpy as np
A = np.array(A)

N = int(input())
B = []
for _ in range(N):
    B.append(int(input()))

ans = [[False] * 3 for _ in range(3)]
ans = np.array(ans)

for b in B:
    temp = (A == b)

    ans = np.logical_or(ans, temp)


if ans[0, :].all() or ans[1, :].all() or ans[2, :].all():
    print("Yes")

elif ans[:, 0].all() or ans[:, 1].all() or ans[:, 2].all():
    print("Yes")

elif ans[0, 0] and ans[1, 1] and ans[2, 2]:
    print("Yes")
elif ans[0, 2] and ans[1, 1] and ans[2, 0]:
    print("Yes")
else:
    print("No")




Measured memory_bytes: 12616
import java.util.Scanner;
 
public class Main{
    public static void main(String[] aaa){
        Scanner s = new Scanner(System.in);
        int[] count = new int[27];
        String st;
        char m;
        int i,j;
        while(s.hasNext()){
            st = s.next();
            for(i=0;i<st.length();i++){
                j=st.charAt(i);
                if(j-'a'>=0&&j-'a'<26)count[st.charAt(i)-'a']++;
                else if(j-'A'<26&&j-'A'>=0)count[st.charAt(i)-'A']++;
            }
        }
        for(i=0;i<26;i++){
            m = (char)('a'+i);
            System.out.println(m+" : "+count[i]);
        }
    }
}


Measured memory_bytes: 26232
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
 
#include <iostream>
#include <stdlib.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <assert.h>
#include <memory.h>
#include <time.h>
#include <bitset>
#include<iomanip>
 
#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = (l); i < (r); i++)
#define repb(i, r, l) for (int i = (r); i > (l); i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define pii pair<int,int>
#define pli pair<ll,int>
#define pll pair<ll,ll>
#define mp(a, b) make_pair(a, b)
#define mt(a,b,c) make_tuple(a,b,c)
#define rank qwertyuio
#define next dfghjk
#define plus fsghsf
#define minus ytryr
#define pb push_back
using namespace std;
 
inline bool setmin(int &x, int y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(int &x, int y) { return (y > x) ? x = y, 1 : 0; }
inline bool setmin(ll &x, ll y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(ll &x, ll y) { return (y > x) ? x = y, 1 : 0; }
 
const int N = 100000;
const int inf = (int)1e9 + 1;
const ll big = (ll)1e18 + 1;
const int P = 239;
const int P1 = 31;
const int P2 = 57;
const int mod = (int)1e9 + 7;
const int mod1 = (int)1e9 + 9;
const int mod2 = 998244353;
const int mod3 = (int)1e6+3;
const ld eps = 1e-12;
const double pi = atan2(0, -1);
const int ABC = 26;
int gcd(int a, int b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);  
      
} 
   
int main()
{
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);<<" "
    int n;
    cin>>n;
    int a[n];
    int i;
    int index=0;
    int max=-1;
    rep(i,0,n){
        cin>>a[i];
        if(a[i]==index+1){
            index++;
            if(index>max){
                max=index;
            }
        }
    }
    if(max>=0){
        cout<<n-max;
    }
    else{
        cout<<-1;
    }

    return 0;
             
    
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ll long long
using namespace std;
 
int main() {
  int n;
  cin >> n;
  double ans;
  if (n % 2 == 0) {
    ans = (double)(n / 2) / n;
  } else {
    ans = (double)(n / 2 + 1) / n;
  }

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

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


int main(){

  int n, t=0, h=0, i;
  char ta[100], ha[100];

  scanf("%d", &n);

  for(i=0;i<n;i++){
    scanf("%s %s", ta, ha);
    if(strcmp(ta, ha)>0) t+=3;
    else if(strcmp(ta, ha)<0) h+=3;
    else{
      t++;
      h++;
    }
  }

  printf("%d %d\n", t, h);


  return 0;
}







Measured memory_bytes: 2056
using System;

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        var h = int.Parse(Console.ReadLine().Trim());
        var w = int.Parse(Console.ReadLine().Trim());
        Console.WriteLine((n - h + 1) * (n - w + 1));
    }
}

Measured memory_bytes: 11092
#include <iostream>
#include <cstdio>
using namespace std;
int main(void){
    int S,h,m,s;
    cin >> S;
    h=S/3600;
    m=(S-h*3600)/60;
    s=S-h*3600-m*60;
    cout << h;
    cout << ":";
    cout << m;
    cout << ":";
    cout << s;
    cout << endl;
}


Measured memory_bytes: 3096
//In The Name Of God
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<string> vs;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef pair<double, double> dd;
typedef pair<dd, double> ddd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<dd> vdd;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ii> vii;
typedef vector<vii> vvii;

#define forn(i, n) for (int i = 0; i < n; i++)
#define forr(i, n) for (int i = n; i >= 0; i--)
#define forne(i, x, n) for (int i = x; i < n; i++)
#define forre(i, x, n) for (int i = n; i >= x; i--)
#define all(a) (a).begin(), (a).end()
#define inf 1000000000
#define eps 1e-9
mt19937 rng32(chrono::steady_clock::now().time_since_epoch().count());

const int maxn = 1e5 + 100;
int t[maxn];

int main() {
    ios::sync_with_stdio(0);
    int n, q; cin >> n >> q;
    string str; cin >> str;
    forne(i, 1, str.size()) {
        if (str[i] == 'C' && str[i - 1] == 'A')
            t[i + 1]++;
    }
    forne(i, 1, maxn) t[i] += t[i - 1];
    while (q--) {
        int l, r; cin >> l >> r;
        cout << t[r] - t[l] << endl;
    }


    return 0;
}


Measured memory_bytes: 1488
#include <bits/stdc++.h>
#define INF 100000000000
#define MOD 1000000007
#define ll long long int
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()




using namespace std;

int main(){
  ll A; 
  string B;
  cin>>A>>B;
  ll b0 = B[0] - '0';
  ll b1 = B[2] - '0';
  ll b2 = B[3] - '0';

  ll b = b2 + 10 * b1 + 100 * b0; // B * 100

  ll ans = A * b / 100;

  cout<<ans<<endl;
  
  //double B; cin>>A>>B;



  return 0;
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
#define LL long long
#define INF (1LL << 50)
using namespace std;
 
template<class T> inline
void read(T& x) {
	int f = 1; x = 0;
	char ch = getchar();
	while (ch < '0' || ch > '9')   {if (ch == '-') f = -1; ch = getchar();}
	while (ch >= '0' && ch <= '9') {x = x * 10 + ch - '0'; ch = getchar();}
	x *= f;
}
 
/*============ Header Template ============*/

const int N = 100000 + 5;

LL n, l, r, ll, rr, E, T;
int q[N], qq[N];
LL s[N], f[N];

LL calc(int x) {
	return f[x] - 2LL * s[x + 1] - s[x];
}

LL calc2(int x) {
	return calc(x) + T + 2LL * s[x + 1];
}

void add(int x) {
	while (l <= r && calc(q[r]) > calc(x)) r--; 
	q[++r] = x;
}

void add2(int x) {
	while (ll <= rr && calc2(qq[rr]) > calc2(x)) rr--;
	qq[++rr] = x;
}

int main() {
	read(n), read(E), read(T);
	for (int i = 1; i <= n; i++) read(s[i]);
	for (int i = 1; i <= n; i++) f[i] = INF; f[0] = 0;
	l = 1, r = 0;
	ll = 1, rr = 0;
	add2(0);
	for (int i = 1, j = 0; i <= n; i++) {
		while (2LL * (s[i] - s[j + 1]) >= T) add(j++);	
		if (l <= r) {
			int k = q[l];
			f[i] = 3LL * s[i] + calc(k);
		}
		while (ll <= rr && T - 2LL * (s[i] - s[qq[ll] + 1]) < 0) ll++;
		if (ll <= rr) {
			int k = qq[ll];
			f[i] = min(f[i], 3LL * s[i] + calc(k) + T - 2LL * (s[i] - s[k + 1]));
		}
		add2(i);
		//printf("%lld\n", f[i]);
	}
	cout << f[n] + E - s[n] << endl;
	return 0;
}

Measured memory_bytes: 2176
#include<cstdio>
#include<algorithm>
using namespace std;
int main(void)
{
	int k,x,a[10001],i,j,p,t,box;
	scanf("%d %d",&k,&x);
	a[0]=x; p=0; t=k*2-1; box=0;
	for(i=1;i<k;i++)	a[i]=x+i;
	for(i=k;i<t;i++){
		p++;
		a[i]=x-p;
	}
	for(i=0;i<t;i++){
		for(j=0;j<t;j++){
			if(a[i]<=a[j]){
				box=a[i];
				a[i]=a[j];
				a[j]=box;
			}
		}
	}
	for(i=0;i<t-1;i++)	printf("%d ",a[i]);
	printf("%d\n",a[t-1]);
	return 0;
}


Measured memory_bytes: 128