akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define f(i,a,n) for(i=a;i<n;i++)
#define rf(i,a,n) for(i=a;i>=n;i--)
#define ll long long
#define pii pair<int,int>
#define pll pair<long long,long long>
#define vi vector<int>
#define vll vector<long long>
#define umii unordered_map<int,int>
#define umci unordered_map<char,int>
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define F first
#define S second
#define all(v) begin(v),end(v)
#define mkp make_pair
#define M 1000000007
#define TakeInput freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);freopen("error.txt","w",stderr);


using namespace std;
int main()
{
	#ifndef ONLINE_JUDGE
	//TakeInput
	#endif
	fast;
	int i,j;
	string a,b,ta,tb;
	cin >> a >> b;
	ta=a;
	tb=b;
	f(i,0,stoi(a)-1)
		tb += b;
	f(i,0,stoi(b)-1)
		ta += a;
	if (ta < tb)
		cout << ta;
	else
		cout << tb;
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static Atcoder;
using System.Threading.Tasks;
using System.ComponentModel;

public class Hello
{

    public static void Main()
    {
        string s = Console.ReadLine();
        string t = Console.ReadLine();
        string box = "";
        for (int i = 0; i < s.Length; i++)
        {
            for (int j = 0; j < t.Length; j++)
            {
                if (s[i] == t[j])
                {
                    box = new string((t.Skip(j).Take(t.Length - j).ToArray()));
                    box += new string(t.Take(j).ToArray());
                    if (box == s) {
                        Console.WriteLine("Yes");
                        return;
                    }
                }
            }
        }
        Console.WriteLine("No");
    }
}


public class Atcoder
{
    static void Swap<T>(ref T a, ref T b)
    {
        var t = a;
        a = b;
        b = t;
    }
    public static int LCM(int a, int b)
    {
        int c = a * b;
        if (a < b) Swap(ref a, ref b);
        int d = a % b;
        while (d != 0)
        {
            a = b;
            b = d;
            d = a % b;
        }
        return c / b;
    }
    public static string strReverce(string s)
    {
        return new string(s.Reverse().ToArray());
    }
    public static int intRead()
    {
        return int.Parse(Console.ReadLine());
    }
    public static bool IsPrime(int n)
    {
        if (n < 2) return false;
        if (n == 2) return true;
        if (n % 2 == 0) return false;

        //double sqrtNum = Math.Sqrt(n);
        for (int i = 3; i < n; i += 2)
        {
            if (n % i == 0) return false;
        }
        return true;
    }
    public static string[] SpRead(char c)
    {
        return Console.ReadLine().Split(c);
    }
    public static int[] SpIntRead(char c)
    {
        return Console.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();
    }

}


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

int main() {
  int A, B;
  cin >> A >> B;
  
  if (13 <= A){
    cout << B << endl;
  }else if (6 <= A){
    cout << B/2 <<endl;
  }else{
    cout << 0 << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a, b;
	cin >> a >> b;
	if(a == 1) a = 14;
	if(b == 1) b = 14;
	if(a<b) cout << "Bob" << endl;
	else if(b<a) cout << "Alice" << endl;
	else cout << "Draw" << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int n = sc.nextInt();
		// スペース区切りの整数の入力
		String s = sc.next();

		int c = 0;

		for ( int i=0; i<n-2; i++ ) {
			String t = s.substring(i,i+3);
			if (t.equals("ABC")) {
				c++;
			}
		}
		// 出力
		System.out.println(c);
	}
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	// cout<<setprecision(10)<<fixed;
	int n, x, l;
	cin>>n>>x;
	int now=0;
	REP(i, n){
		cin>>l;
		now+=l;
		if(now>x){
			cout<<i+1<<'\n';
			return 0;
		}
	}
	cout<<n+1<<'\n';
	return 0;
}


Measured memory_bytes: 256
def proc(a, b, op):
    if op == '+':
        return a + b
    if op == '-':
        return a - b
    if op == '*':
        return a * b
    if op == '/':
        return a // b
  
while True:
    a, op, b = input().split()
    if op == '?':
        break
    print(proc(int(a), int(b), op))

Measured memory_bytes: 7708
#include <bits/stdc++.h>
using namespace std;
int main () {
    int N;
    cin >> N;
    map<string, int> m;
    int k = 0;
    for (int i = 0; i < N; i++) {
        string S;
        cin >> S;
        m[S]++;
        k = max(k, m[S]);
    }
    for (auto x: m) {
        if (x.second == k) {
            cout << x.first << endl;
        }
    }
}

Measured memory_bytes: 25216
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define INF 1000000000
#define mod 1000000007
using ll=long long;
const ll LINF=1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
// ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    int k,q;cin>>k>>q;
    vector<ll> d(k);
    rep(i,k) cin>>d[i];

    while(q--){
        ll n,x,m;cin>>n>>x>>m;
        vector<ll> e(k);
        ll sum=0;
        rep(i,k){
            e[i]=d[i]%m;
            sum+=e[i];
        }

        ll a1=0,a2=0;

        ll t=(n-1)/k;
        ll las=t*sum+x;
        rep(i,(n-1)%k) las+=e[i];
        a1=las/m-x/m;// マタギ

        rep(i,k){
            if(e[i]==0) a2+=t;
        }
        rep(i,(n-1)%k){
            if(e[i]==0) a2++;
        }
        cout<<n-1-a1-a2<<endl;
    }

    return 0;
}


Measured memory_bytes: 384
import math
a, b, h, m = map(int, input().split())

theta = abs((h*30 + 0.5*m) -6 * m)

theta = min(theta, 360-theta)

raji = math.radians(theta)

tmp = 2*a*b*math.cos(raji)

ans = a**2 + b**2 - tmp
ans = math.sqrt(ans)

print(ans)

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

int main(){
    int d,r;
    cin>>d>>r;
    r/=100;
    vector<int> p(d+1),c(d+1);
    for(int i=1; i<=d; i++){
        cin>>p[i]>>c[i];
        c[i]/=100;
    }
    int ans=1000;
    for(int i=0; i<1<<d; i++){
        int q = 0;
        int g = r;
        vector<int> used(d+1,0);
        for(int j=1; j<=d; j++){
            if((i>>(j-1))&1){
                q+=p[j];
                g-=j*p[j]+c[j];
                used[j]=1;
            }
        }
        if(g<=0){
            ans=min(ans,q);
            continue;
        }
        int maxpt = d;
        for(int pt = d; pt > 0; pt--){
            if(!used[pt]){
                maxpt=pt;
                break;
            }
        }
        if(maxpt*p[maxpt]<g) continue;
        q+=1+(g-1)/maxpt;
        ans=min(ans,q);
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

mat = {}
vec = {}

n, m = map(int, raw_input().split())
for i in range(1, n+1):
    list = map(int, raw_input().split())
    for j in range(1, m+1):
        mat[(i, j)] = list[j-1]

for i in range(1, m+1):
    vec[i] = input()

for i in range(1, n+1):
    c = 0
    for j in range(1, m+1):
        c += mat[(i, j)]*vec[j]
    print c

Measured memory_bytes: 7828
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

int main(void)
{
    int N,K;
    cin >> N >> K;
    int ans = 0;
    REP(i, N){
        int a;
        cin >> a;
        if(a >= K) ans++;
    }
    pr(ans);
}

Measured memory_bytes: 764
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

int n;
string c;

int solve(string s)
{
    if(s.size() == n){
        string t = s + c;
        reverse(s.begin(), s.end());
        t += s;

        int a = atoi(t.c_str());
        for(int i=2; i*i<=a; ++i){
            if(a % i == 0)
                return -1;
        }
        return a;
    }

    for(char i='9'; i>='0'; --i){
        if(s.empty() && i == '0')
            continue;
        int ret = solve(s + i);
        if(ret != -1)
            return ret;
    }

    return -1;
}

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

    if(c[0] == '-'){
        if(n == 1)
            cout << 11 << endl;
        else
            cout << string(2*n, '9') << endl;
        return 0;
    }

    int ret = solve("");
    if(ret == -1){
        string s = string(n, '9') + c + string(n, '9');
        cout << s << endl;
    }else{
        cout << ret << endl;
    }

    return 0;
}

Measured memory_bytes: 1224
h, w = map(int, input().split())
n = int(input())
a = list(map(int, input().split()))

ans = [[0 for _ in range(w)] for _ in range(h)]

cnt = 0
for i in range(n):
    for j in range(a[i]):
        r = cnt // w
        c = (r % 2) * (w - 1) + (-1)**(r % 2) * (cnt % w)
        ans[r][c] = i + 1
        cnt += 1

for ls in ans:
    print(' '.join(list(map(str, ls))))

Measured memory_bytes: 40944
//
//  1137.cpp
//  
//
//  Created by Minote Tomoki on 2015/06/04.
//
//

#include <iostream>
#include <string>
#include <cstdlib>

using namespace std;

int mcxi2num(string mcxi) {
    int a=1;
    int result=0;
    for(int i=0;i<mcxi.length();i++) {
        if(mcxi.at(i) >= '2' && mcxi.at(i) <= '9' ) {
            a = mcxi.at(i)-'0';
        }
        else if(mcxi.at(i) == 'm') {
            result += a * 1000;
            a=1;
        }
        else if(mcxi.at(i) == 'c') {
            result += a * 100;
            a=1;
        }
        else if(mcxi.at(i) == 'x') {
            result += a * 10;
            a=1;
        }
        else if(mcxi.at(i) == 'i') {
            result += a * 1;
        }
    }
    
    
    return result;
}

string num2mcxi(int num) {
    int m = num/1000;
    int c = num/100%10;
    int x = num/10%10;
    int i = num%10;
    
    string result{};
    
    
    if(m>=2) {
        result+=(char)(m+'0');
    }
    
    if(m>0) {
        result+="m";
    }
    
    if(c>=2) {
        result+=(char)(c+'0');
    }
    
    if(c>0) {
        result+="c";
    }
    
    if(x>=2) {
        result+=(char)(x+'0');
    }
    
    if(x>0) {
        result+="x";
    }
    
    if(i>=2) {
        result+=(char)(i+'0');
    }
    
    if(i>0) {
        result+="i";
    }
    
    return result;
}

int main(void) {
    int n;
    string s1,s2;
    
    cin >> n;
    for(int i=0;i<n;i++) {
        cin >> s1 >> s2;
        
        cout << num2mcxi(mcxi2num(s1)+mcxi2num(s2)) << endl;
    }
    
    return 0;
}

Measured memory_bytes: 1204
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <bitset>
#include <math.h>
#include <iomanip>
#include <queue>
#define inp(X) cin >> X
#define out(X) cout << X << endl
#define out16(X) cout << setprecision(16) << X << endl
#define rep(i,n) for(int i=0;i<n;i++ )
#define rep2(i,f,n) for(int i=f;i<n;i++ )
#define MAX(A) *max_element(A.begin(),A.end())
#define MIN(A) *min_element(A.begin(),A.end())
#define SORT(A) sort(A.begin(),A.end())
#define REV(A) reverse(A.begin(),A.end())
typedef long long int ll;
using vi = std::vector<int>;
using vvi = std::vector<std::vector<int>>;
using vd = std::vector<double>;
using vvd = std::vector<std::vector<double>>;
using vll = std::vector<ll>;
using vvll = std::vector<std::vector<ll>>;
using namespace std;
#define MOD 1000000007
#define INF 1000000001
#define LL_INF 1001001001001001001

ll gcd(ll x, ll y){
	if(y==0) return x;
	return gcd(y,x%y);
}

bool bfs(vector<vector<int>> g, vector<int> &dist, int sv){
	queue<int> q;
	q.push(sv);
	dist[sv]=0;
	while(!q.empty()){
		int now = q.front(); q.pop();
		for(auto v : g[now]){
			if(dist[v]!=-1) continue;
			dist[v] = dist[now]+1;
			q.push(v);
		}
	}
}

int main(void) {
	int n,m; cin >> n >> m;
	vvi job(m);
	rep(i,n){
		int a,b; cin >> a >> b;
		--a;
		if(a<m) job[a].push_back(b);
	}
	int ans = 0;
	priority_queue<int> q;
	rep(i,m){
		for(int jb: job[i]) q.push(jb);
		if(!q.empty()){
			int mny = q.top(); q.pop();
			ans += mny;
		}
	}
	out(ans);
}

Measured memory_bytes: 5504
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define DEBUGP(val) cerr << #val << "=" << val << "\n"

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;


// This solution is written after the author read the editorial.
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a, b;
  cin >> a >> b;
  vector<VI> d(a, VI(b));
  REP(i, 0, a) {
    REP(j, 0, b) {
      cin >> d[i][j];
    }
  }
  vector<VI> f(101, VI(101, 0));
  REP(i, 0, a) {
    REP(j, 0, b) {
      REP(v, 0, 101) {
	REP(w, 0, 101) {
	  f[v][w] = max(f[v][w], d[i][j] - (i + 1) * v - (j + 1) * w);
	}
      }
    }
  }
  vector<VI> nd(a, VI(b, 1e8));
  REP(i, 0, a) {
    REP(j, 0, b) {
      REP(v, 0, 101) {
	REP(w, 0, 101) {
	  nd[i][j] = min(nd[i][j], f[v][w] + (i + 1) * v + (j + 1) * w);
	}
      }
    }
  }
  bool ok = true;
  if (nd != d) {
    ok = false;
  }
  if (ok) {
    REP(i, 0, 101) {
      REP(j, 0, 101) {
	if (f[i][j] < 0 || f[i][j] > 100) {
	  ok = false;
	}
      }
    }
  }
  if (ok) {
    cout << "Possible\n";
    int n = 202;
    int m = 101 * 101 + 2 * 100;
    cout << n << " " << m << "\n";
    REP(i, 0, 100) {
      cout << i + 1 << " " << i + 2 << " X\n";
    }
    REP(i, 0, 100) {
      cout << i + 103 << " " << i + 102 << " Y\n";
    }
    REP(i, 0, 101) {
      REP(j, 0, 101) {
	cout << i + 1 << " " << j + 102 << " " << f[i][j] << "\n";
      }
    }
    cout << 1 << " " << 102 << "\n";
  } else {
    cout << "Impossible\n";
  }
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
inline ll read(){
    ll res=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-f;ch=getchar();}
    while(ch>='0'&&ch<='9'){res=(res<<3)+(res<<1)+ch-'0';ch=getchar();}
    return res*f;
}
void write(ll x){
    if(x<0) putchar('-'),x=-x;
    if(x>9) write(x/10);
    putchar(x%10|'0');
}
signed main(){
    int a=read(),b=read();
    if(a>=10||b>=10||a<1||b<1) {
        cout<<"-1"<<endl;
        return 0;
    }
    else cout<<a*b<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] arya = new int[n];
        int[] aryb = new int[n];
        int[] aryc = new int[n];
        for(int i = 0; i < n; i++) {
            arya[i] = Integer.parseInt(sc.next());
            aryb[i] = Integer.parseInt(sc.next());
            aryc[i] = Integer.parseInt(sc.next());
        }
        long[][] dp = new long[n + 1][3];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < 3; j++) {
                for (int k = 0; k < 3; k++) {
                    if (j == k) {
                        continue;
                    }
                    long temp = 0;
                    if (k == 0) {
                        temp = arya[i];
                    } else if (k == 1) {
                        temp = aryb[i];
                    } else {
                        temp = aryc[i];
                    }
                    dp[i + 1][k] = Math.max(dp[i + 1][k], dp[i][j] + temp);
                }
            }
        }
        long ans = 0;
        for (int i = 0; i < 3; i++) {
            ans = Math.max(ans, dp[n][i]);
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 63460
#include <iostream>
#include <stdio.h>
using namespace std;

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


	return 0;
}

Measured memory_bytes: 3088
#[allow(unused_macros)]
macro_rules! get {
    ([$t:ty] ; $n:expr) => {
        (0..$n)
        .map(|_| get!([$t])).collect::<Vec<_>>()
    };
    ($($t:ty),+ ; $n:expr) => {
        (0..$n).map(|_| get!($($t),+)).collect::<Vec<_>>()
    };
    ([$t:ty]) => {
        rl().split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect::<Vec<$t>>()
    };
    ($t:ty) => {
        rl().parse::<$t>().unwrap()
    };
    ($($t:ty),*) => {
        {
            let line =rl();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap()),*)
        }
    };
}
fn rl() -> String {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    line.trim().to_string()
}

fn main() {
    let (a, b, c, x, y) = get!(usize, usize, usize, usize, usize);
    let ab = c * 2;
    let mut ans = 0;
    if ab <= a + b {
        if x < y {
            ans += ab * x;
            let rest = y - x;
            if ab <= b {
                ans += ab * rest;
            } else {
                ans += b * rest;
            }
        } else if y < x {
            ans = ab * y;
            let rest = x - y;
            if ab <= a {
                ans += ab * rest;
            } else {
                ans += a * rest;
            }
        } else {
            //x == y
            ans = ab * x;
        }
    } else {
        ans += a * x;
        ans += b * y;
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;


bool isAllSame(char* str) {
    int l = strlen(str);
    for (int i = 0; i < l; i++) {
        if (str[i] != str[0]) {
            return false;
        }
    }
    return true;
}


int main(void){
    char str[124];

    cin >> str;

    int number[26];
    int l = strlen(str);

    for (int i = 0; i < 26; i++) {
        number[i] = strlen(str) + 10;
    }

    if(isAllSame(str)) {
        printf("0\n");
        return 0;
    }

    for (int i = 0; i < 26; i++) {
        char buff[124];
        for (int j = 0; j < l+1; j++) {
            buff[j] = str[j];
        }

        for (int m = 0; m < l-1; m++) {
            for (int k = 0; k < strlen(buff); k++) {
                if (buff[k+1] == 'a'+i) {
                    buff[k] = 'a'+i;
                }
            }

            buff[strlen(buff)-1] = '\0';

            if(isAllSame(buff)) {
                if (number[i] > m+1) {
                    number[i] = m+1;
                    continue;
                }
            } 
            
        }
    }
    int min = strlen(str)+10;

    for (int i = 0; i < 26; i++) {
        if (number[i] != 0 && min > number[i]) {
            min = number[i];
        }
    }

    printf("%d\n", min);
    return 0;
}


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

int main(void) {
    int64_t N;
    string S;
    char color,lastcolor = 0; 
    int64_t sum = 0;
    cin >> N >> S;
    

    for(int i=0;i<N;i++) {
        color = S[i];
        if(color != lastcolor) {
            sum++;
        }
        lastcolor = color;
    }

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


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define debug(var) do{cout << #var << " : "; view(var);}while(0)
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
template<class T> void view(T e) {cout << e << endl;}
template<class T> void view(const vector<T> &v) {for(const auto &e : v){cout << e << " ";} cout << endl;}
template<class T> void view(const vector<vector<T>> &vv) {for(const auto &v : vv){view(v);}}
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1<<31;
const ll inf_l = 1LL<<61;
const int MAX = 1e5;

int main() {
    int n; cin >> n;
    vint p(n);
    rep(i,n) cin >> p[i];
    vint ans_a(n), ans_b(n);
    rep(i,n) {
        ans_a[i] = n * (i+1);
        ans_b[i] = n * (n-i);
    }
    rep(i,n) {
        ans_b[p[i]-1] += i;
    }
    rep(i,n) printf("%d%s",ans_a[i],i==n-1?"\n":" ");
    rep(i,n) printf("%d%s",ans_b[i],i==n-1?"\n":" ");
}

Measured memory_bytes: 3964
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include <queue>
#include <utility>
#include <map>
using namespace std;

int main() {
    int N, ans=0, max = 0;
    cin >> N;
    for (int i = 0; i < N; i++) {
        int p;
        cin >> p;
        if (p > max)max = p;
        ans += p;
    }

    cout << ans - max/2 << endl;

}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Arrays;
import java.util.Calendar;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int H = scan.nextInt();
        int W = scan.nextInt();
        int h = scan.nextInt();
        int w = scan.nextInt();

        int All = H * W;

        int kasanari = (H-h) * (W - w);

        

        System.out.println(kasanari);
    }
}

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

using namespace std;

const int MAXN = 100100;

vector<int> edges[MAXN];

int dfs(int i = 0, int par = 0)
{
	int sol = 0;
	for (int j: edges[i]) if (j != par)
	{
		sol ^= dfs(j, i) + 1;
	}
	
	return sol;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	
	int n, i;
	int a, b;
	
	cin>>n;
	
	for (i = 1; i < n; ++i)
	{
		cin>>a>>b;
		--a, --b;
		edges[a].push_back(b);
		edges[b].push_back(a);
	}
	
	cout<<(dfs() ? "Alice" : "Bob")<<'\n';
}


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

int main() {
  string S;
  cin>>S;
  vector<int> p;
  int a=1,Z=0;
  int N=S.size();
  for(int i=1;i<N;i++){
    if(S.at(i)==S.at(i-1)){
      a++;
    }
    else{
      p.push_back(a);
      a=1;
    }
  }
  p.push_back(a);
  int M=p.size(),A=0;
  for(int i=0;i<M;i++){
    Z=max(Z,p[i]);
  }
  for(int i=2;i<M;i++){
    A+=p[i-2];
    Z=max(Z,min(A+p[i-1],N-A));
  }
  cout<<Z<<endl;
}



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

#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--)

typedef long long ll;
typedef unsigned long long ull;

const int INF = 1000000000;

int main(){
   string s;
   cin  >> s;
   int Max = 0;
   int tmp = 0;
   for(int i=0;i<s.size();i++){
      if(s[i] == 'A' or s[i] == 'C' or s[i] == 'G' or s[i] == 'T'){
         tmp++;
      }else{
         Max = max(tmp,Max);
         tmp = 0;
      }
   }
   Max = max(tmp,Max);
   cout << Max;
   return 0;
}

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

int main() {
  vector<int> vec(3);
  cin >> vec[0] >> vec[1] >> vec[2];
  
  sort(vec.begin(), vec.end());
  
  if(vec[0] == 5 && vec[1] == 5 && vec[2] == 7) {
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define fast_io() ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)
using namespace std;
int32_t main() {
    fast_io();
    int k;
    cin >> k;
    int res = 0;
    for (int i = 1; i <= k; i++)
    {
        for (int j = 1; j <= k; j++)
        {
            for (int l = 1; l <= k; l++)
            {
                int v = __gcd(i, j);
                v = __gcd(v, l);
                res += v;
            }
        }
    }
    cout << res << "\n";
    return 0;
}

Measured memory_bytes: 3588
# coding: utf-8

from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
import math
import string
import itertools
import fractions
import heapq
import collections
import re
import array
import bisect

def array2d(d1, d2, init = None):
    return [[init for _ in range(d2)] for _ in range(d1)]

a = int(input())
b = int(input())
h = int(input())

print((a + b) * h // 2)


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

using namespace std;

typedef long long int li;
typedef long double ld;
typedef vector<li> vi;
typedef pair<li,li> pi;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define B begin()
#define E end()
#define f(i,l,r) for(li i=l;i<=r;++i)
#define fr(i,l,r) for(li i=l;i>=r;--i)
#define u_map unordered_map
#define endl "\n"

li fastpow(li base,li exp,li M) 
{
    li res=1;
    while(exp>0) {
        if(exp&1)
            res=(res*base)%M;

        base=(base*base)%M;
        exp>>=1;
    }
    return res;
}

vi par,sz,vis,dis;
vector<vi> graph;
vector<vector<pair<li,li>>> wgraph;

void init(li n)
{
    par.resize(n);
    sz.resize(n);
    wgraph.resize(n);
    dis.resize(n);
    vis.resize(n);
    graph.resize(n);

    f(i,0,n-1)
    {
        par[i]=i;
        sz[i]=1;
        dis[i]=1e18;
    }
}

li root(li a)
{
    while(a!=par[a])
    {
        par[a]=par[par[a]];
        a=par[a];
    }

    return a;
}

void unio(li a,li b)
{
    li r_a=root(a);
    li r_b=root(b);

    if(par[r_a]!=r_b)
    { 
        if(sz[r_a]<sz[r_b])
        {
            par[r_a]=par[r_b];
            sz[r_b]+=sz[r_a];
            sz[r_a]=0;
        }
        else
        {
            par[r_b]=par[r_a];
            sz[r_a]+=sz[r_b];
            sz[r_b]=0;
        }
    }
}

int main()
{    
    

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

    li n,k;

    cin>>n>>k;

    li tp=0;

    while(pow(k,tp)<=n)
    {   
        tp++;
    }

    cout<<tp;

    return 0;
}

Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main(){
    
    int W,H,x,y,r;
    cin >> W >> H >> x >> y >> r;
    
    
    if((0 <= x-r)&&(x+r <= W)){
        if((0 <= y-r)&&(y+r <= H)){
            cout << "Yes" << endl;
        }
        else{
            cout << "No" << endl;
        }
    }
    else{
        cout << "No" << endl;
    }
    
    
    
    
    
    
    
    
    
}


Measured memory_bytes: 3104
#include <iostream>

int main() {
int H, W;
do{
std::cin >> H >> W;
if(!(H == 0 && W == 0)) {

for(int i = 0; i < H; i++){
for(int j = 0; j < W; j++){
if(i % 2 == 0 && j % 2 == 0){std::cout << '#';}
else if(i % 2 == 0 && j % 2 == 1){std::cout << '.';}
else if(i % 2 == 1 && j % 2 == 0){std::cout << '.';}
else if(i % 2 == 1 && j % 2 == 1){std::cout << '#';}

}
std::cout << std::endl;
}
std::cout << std::endl;
}
} while(!(H ==0 && W == 0));
}

Measured memory_bytes: 3080
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define fi first
#define se second
#define sz(x) (int)(x).size()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T &a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U &u,const V... v){for(auto &e:u)fill_v<T>(e,v...);}

const int mod = 1000000007;

struct mint {
    long long x;
    mint(long long x=0) : x((x % mod + mod) % mod) {}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(long long t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
bool operator==(const mint& a, const mint& b) { return a.x == b.x;}

struct combination {
    vector<mint> fact, ifact;
    combination(int n) : fact(n+1), ifact(n+1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1] * i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i] * i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n] * ifact[k] * ifact[n-k];
    }
    mint p(int n, int k) { return fact[n] * ifact[n-k];}
} c(1000005);
// combination c(max);
// mint c(n, k)

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

    int n, m;
    cin >> n >> m;
    mint ans = 0;
    for (int i = 0; i <= n; ++i) {
        mint now = c(n, i) * c.p(m-i, n-i);
        if (i&1) now *= -1;
        ans += now;
    }
    ans *= c.p(m, n);
    cout << ans << endl;
}


Measured memory_bytes: 18640
# -*- coding: utf-8 -*-
"""
Created on Sat Sep 15 23:36:39 2018

@author: Yuki
"""

N, x = map(int, input().split())
A = sorted([int(i) for i in input().split()])


cnt=0
res=0
for i in range(0,N):
    cnt += A[i]
    if cnt > x:
        res = i
        break
    elif cnt == x:
        res = i+1
        break
    if i == N-1 and cnt < x:
        res = N-1
if A[0] > x:
    res=0
print(res)

Measured memory_bytes: 3064
//#include <bits/stdc++.h>
#include <stack>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
	//入力
	long a[100000], b[100000],x[100000];
	double N, M, ans,T,X;
	cin >> T >> X;
	//処理
	ans = T / X;
	//出力
	cout << ans << endl;
}

Measured memory_bytes: 256
n = int(input())
al = list(map(int, input().split()))

count = 0
for a in al:
    if a % 2 == 0:
        if a % 3 == 0 or a % 5 == 0:
            count += 1
    else:
        count += 1

if count == n:
    print('APPROVED')
else:
    print('DENIED')

Measured memory_bytes: 3060
#include<iostream>
using namespace std;
int main(){
    int x,y;
    while(1){
        cin>>x>>y;
        if(x==0&&y==0){
            break;
        }
        else if(x>y){
            cout<<y<<" "<<x<<endl;
        }
        else{
            cout<<x<<" "<<y<<endl;
        }
    }
    return 0;
}


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

map<int,vector<int>> P;
set<string> RT;
vector<bool> ans;
int count1=0;
void prog(int a,vector<bool>T){
    T.at(a-1)=true;
    if(T==ans){
        count1++;
        return;
    }
    for(int i:P.at(a)){
        if(T.at(i-1))continue;
      prog(i,T);
    }
}

int main (){
    int N,M;
    cin >> N >> M;
    for(int i=0;i<M;i++){
        int j,k;
        cin >> j >> k;
        P[j].push_back(k);
        P[k].push_back(j);
    }
    
    
    ans=vector<bool>(N,true);
    
    prog(1,vector<bool>(N,false));
    
    
    cout << count1 << endl;
    
}


Measured memory_bytes: 3568
w,a,b = map(int,input().split())
aw = a + w
bw = b + w
if a == bw or b == aw or a == b:
    print(0)
elif a < b < aw or b < a < bw:
    print(0)
else:
    if aw < b:
        print(b-aw)
    if bw < a:
        print(a-bw)

Measured memory_bytes: 9024
N = int(input())
p = list(map(int, input().split()))

P = sorted(p)

count = 0

for i in range(N):
    if p[i] == P[i]:
        count += 1
    else:
        continue

if count == N-2 or count == N:
    print('YES')
else:
    print('NO')


Measured memory_bytes: 38256
#include<map>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#define LL long long
using namespace std;
const LL mod=1e9+7;
map<LL,LL> f;
LL n;
LL dfs(LL x)
{
	if(x<0) return 0;
	if(x==0) return 1;
	if(f.count(x)) return f[x];
	f[x]=(dfs(x>>1)+dfs((x-1)>>1)+dfs((x-2)>>1))%mod;
	return f[x];
}
int main()
{
	scanf("%lld",&n);
	printf("%lld",dfs(n));
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
vector<int>G;
int cnt;
int arr[10000005];
void insertSort(int arr[],int n,int g)
{
    for(int i=g;i<n;i++)
    {
        int v=arr[i];
        int j=i-g;
        while(j>=0&&arr[j]>v)
        {
            arr[j+g]=arr[j];
            j-=g;
            cnt++;
        }
        arr[j+g]=v;
    }
}

void ShellSort(int arr[],int n)
{
    cnt=0;
    for(int i=G.size()-1;i>=0;--i)
    {
        insertSort(arr,n,G[i]);
    }
}

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

    for(int h=1;h<=n;h=3*h+1)G.push_back(h);
    cout<<G.size()<<endl;
    for(int i=G.size()-1;i>=0;--i)
    {
        cout<<G[i];
        if(i)cout<<' ';
    }
    cout<<endl;
    ShellSort(arr,n);
    cout<<cnt<<endl;
    for(int i=0;i<n;i++)
    {
        if(i)cout<<' ';
        cout<<arr[i];
    }
    cout<<endl;

    return 0;
}



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

typedef long long int ll;
#define rep(i,n) for (int i = 0; i < (n); i++)
const ll mod = 1000000007;

int main() {
    int n;
    cin >> n;
    int ans = 0;
    rep(i,n) {
        if ((1 <= i+1 && i+1 <= 9) || (100 <= i+1 && i+1 <= 999) || (10000 <= i+1 && i+1 <= 99999)) ans++;
    }
    cout << ans << endl;
}


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

typedef long long ll;
using namespace std;
template<class T> inline void chmax(T &a, const T &b) {if(a < b) a = b;}
template<class T> inline void chmin(T &a, const T &b) {if(a > b) a = b;}
const long long INF = 1LL<<60;

const ll MAXN = (ll)1e5+10;
const ll DIV = (ll)1e9+7;
// ll dp[MAXN][MAXN];

ll dp[MAXN];
vector<int> A;
void Update(int i) {
   ll dp1[MAXN];
   dp1[0] = dp[0];
   rep(j,MAXN-1) {
      dp1[j+1] = dp1[j] + dp[j+1];
      if (j-A[i]>=0) dp1[j+1] -= dp[j-A[i]];
      dp1[j+1] = (DIV+dp1[j+1])%DIV;
   }
   // rep(j,4) cout<<i<<" "<<dp1[j]<<endl;
   swap(dp,dp1);
   return;
}


int main(void) {
   ll N,K;
   cin>>N>>K;
   A.resize(N);
   rep(i,N) cin>>A[i];
   memset(dp,0,sizeof(dp));
   dp[0] = 1;
   rep(i,N) Update(i);
   cout<<dp[K]%DIV<<endl;


   return 0;
}

Measured memory_bytes: 1792
function getLines(input){
	return input.split("\n").map((s)=>s.trim())
}
function parseLine(line){
	return line.split(" ").map((s)=>s.trim());
}
function parseLineToInt(line){
	return line.split(" ").map((s)=>parseInt(s.trim()));
}
// parameter "input" gets all data
function Main(input) {
	// the first line is assigned to input[0], the second line is assigned to input[1] similarly.	
	input = parseLine(input)[0];
	console.log((input[2]==input[3] && input[4]==input[5])?'Yes':'No');
}
// Don't edit this line!
Main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 22212
#include <stdio.h>

// 配列の要素を順番に出力
void trace(int A[], int N) {
	int i;
	for (i = 0; i < N; i++) {
		if (i > 0) 
			printf(" ");
		printf("%d", A[i]);
	}
	printf("\n");
}

// 挿入ソート
void insertionSort(int A[], int N) {
	int j, i, v;
	for (i = 1; i < N; i++) {
		v = A[i];
		j = i-1;
		while (j >= 0 && A[j] > v) {
			A[j+1] = A[j];
			j--;
		}
		A[j+1] = v;
		trace(A, N);
	}
}

int main(int argc, char const *argv[])
{
	int N, i;
	int A[100];

	scanf("%d", &N);
	for (i = 0; i < N; i++) 
		scanf("%d", &A[i]);
	trace(A, N);
	insertionSort(A, N);
	return 0;
}

Measured memory_bytes: 604
n = int(input())
s = input()
t = input()
ans = 1
i = 0
while i <= n-1:
    if s[i] == t[i]:
        if i == 0:
            ans *= 3
        else:
            if before == "yoko":
                pass
            else:
                ans *= 2
        i += 1
        before = "tate"

    else:
        if i == 0:
            ans *= 6
        else:
            if before == "yoko":
                ans *= 3
            else:
                ans *= 2
        i += 2
        before = "yoko"
    ans %= 1000000007
print(ans)


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

 using namespace std;

 void answer(int x, int y) {
   for (int i = x; i < y; i++) {
     cout << i << " ";
   }
   cout << y << endl;
 }

 int main() {
   int K, X;
   cin >> K >> X;

   if (X - K + 1 < -100000) answer(-100000, X + K -1);

   else if (100000 < X + K - 1) answer(X - K + 1, 100000);

   else answer(X - K + 1, X + K - 1);

}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

void stronglyConnectedComponents(
    const vector<vector<int> >& edges, vector<int>& indexConvert,
    vector<vector<int> >& nodesOut)
{
    const int n = edges.size();
    vector<int> num(n, -1), low(n, -1);
    vector<bool> isStk(n, false);
    stack<int> stk;
    int cnt = -1;
    nodesOut.clear();

    for(int i=0; i<n; ++i){
        stack<pair<int, unsigned> > arg;
        arg.push(make_pair(i, 0));

        while(!arg.empty()){
            int v = arg.top().first;
            unsigned j = arg.top().second;
            arg.pop();

            if(j == 0){
                if(num[v] != -1)
                    continue;
                num[v] = low[v] = ++ cnt;
                stk.push(v);
                isStk[v] = true;
            }
            else{
                int w = edges[v][j-1];
                if(isStk[w])
                    low[v] = min(low[v], low[w]);
            }

            if(j < edges[v].size()){
                arg.push(make_pair(v, j + 1));
                int w = edges[v][j];
                arg.push(make_pair(w, 0));
            }
            else if(low[v] == num[v]){
                nodesOut.push_back(vector<int>());
                for(;;){
                    int w = stk.top();
                    stk.pop();
                    isStk[w] = false;
                    nodesOut.back().push_back(w);
                    if(v == w)
                        break;
                }
            }
        }
    }

    reverse(nodesOut.begin(), nodesOut.end()); // DAG???????????????????????¢?????????
    const int m = nodesOut.size();
    indexConvert.resize(n);
    for(int i=0; i<m; ++i){
        for(unsigned j=0; j<nodesOut[i].size(); ++j)
            indexConvert[nodesOut[i][j]] = i;
    }
}

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

    vector<vector<int> > edges(200);
    for(int i=0; i<n; ++i){
        int u, d;
        string s;
        cin >> u >> s >> d;
        -- u;
        -- d;
        if(s == "wait")
            edges[u].push_back(d+100);
        else
            edges[d+100].push_back(u);
    }

    vector<int> indexConvert;
    vector<vector<int> > nodesOut;
    stronglyConnectedComponents(edges, indexConvert, nodesOut);
    if(nodesOut.size() == 200)
        cout << 0 << endl;
    else
        cout << 1 << endl;

    return 0;
}

Measured memory_bytes: 3216
#include <bits/stdc++.h>
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long ll; 
typedef long double ld;
typedef pair<ll, ll> pll;

const ll N = 2e5 + 30, Mod = 1e9 + 7;
const ll SQ = 330;

ll a[N];
int main () {
    ios::sync_with_stdio(0), cin.tie(0);
    ll n, m;
    cin >> n >> m;
    ll s = 0;
    for (int i = 0; i < n; i ++) {
    	cin >> a[i];
    	s += a[i];
	}
	sort(a, a + n);
	reverse(a, a + n);
	for (int i = 0; i < m; i ++) {
		if (a[i] * 4 * m < s) return cout << "No", 0;
	}
	cout << "Yes";
    return (0);
}

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

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    
    if ((a == b || b == c || c == a) && !(a == b && b == c))
        cout << "Yes";
    else
        cout << "No";
}

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

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

using namespace std;
using ll=long long;

const int INF = 100000000;


int main() {
    ll a, b, c, k;
    cin >> a >> b >> c >> k;

    if (a>=k){
        cout << k;
    }else if (a + b >= k) {
        cout << a;
        return 0;
    } else {
        cout << a - (k - a - b);
    }
    return 0;
}

Measured memory_bytes: 3636
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include<unordered_map>
#include<unordered_set>	
using namespace std;
typedef long long ll;
#define bay_bay return 0;
#define fori(n) for(int i=0;i<n;++i)
#define for1(n) for(int i=1;i<=n;i+=3)
#define all(v) ((v).begin()), ((v).end())	
#define sz(v) v.size()
#define endl "\n"
constexpr auto EPS = 1e-9;
#define ff fflush(stdout);
clock_t T;
#define ctime cerr << "Time : " << double(clock() - T) / CLOCKS_PER_SEC << endl
void GOAT()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#else
#endif
}
ll m;
ll a[1000005];
int pos = 0;
void solve(ll x)
{
	if (x > 1e10) return;
	pos++;
	a[pos] = x;
	int last = x % 10;
	if (last == 0) {
		solve(x * 10 + 0); 
		solve(x * 10 + 1); 
	}
	else if (last == 9) {
		solve(x * 10 + 8); 
		solve(x * 10 + 9);
	}
	else { solve(x * 10 + last - 1);
	solve(x * 10 + last);
	solve(x * 10 + last + 1);
	}
}
int main()
{
	//GOAT();	
	cin >> m;
	for (ll i = 1; i <= 9; i++)
		solve(i);
	sort(a,a+pos+1);
	cout << a[m] << endl;


}

Measured memory_bytes: 1792
# -*- coding: utf-8 -*-
n = int(input())
a = list(map(int, input().split()))
result = [0]*n
xor_sum = 0
for ai in a:
    xor_sum = xor_sum ^ ai
    # print(str(xor_sum) + " : " + str(bin(xor_sum)))

for i in range(n):
    result[i] = str(xor_sum ^ a[i])
    # print(str(result[i]) + " : " )

print(" ".join(result))

Measured memory_bytes: 101408
import java.util.*;

public class Main {

    public static void main(String[] args)
    {
        //変数
        int count=0;
        boolean sw=false;
        int max=Integer.MIN_VALUE;
        int min=Integer.MAX_VALUE;
        String answer=null;
        List<Integer> list1=new ArrayList<>();
        List<Integer> list2=new ArrayList<>();
        int array1[]=new int[5];
        int array2[]=new int[5];

        //入力
        Scanner sc=new Scanner(System.in);
        int A=sc.nextInt();
        int B=sc.nextInt();
        int C=sc.nextInt();
        //処理
        if(C>A && B>C)
        {
            answer="Yes";
        }
        else if(C>B && A>C)
        {
            answer="Yes";
        }
        else
        {
            answer="No";
        }
        //Collections.sort(a);
        //System.out.println(Arrays.toString(list1.toArray()));
        //System.out.println(Arrays.toString(array1));
		//System.out.println(Arrays.deepToString(a));
        System.out.println(answer);
    }
}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,L,R;
string S,T;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

typedef vector<P> vp;
typedef vector<vp> matP;


int main() {
    cin>>N>>H>>W;
    vec r(N), c(N), a(N);
    rep(i,N) cin>>r[i]>>c[i]>>a[i];
    vec ord(N,0);
    rep(i,N) ord[i] = i;
    sort(ord.begin(), ord.end(),[&](ll x, ll y){
        return a[x] > a[y];
    });
    class union_find{
            vector<long> parent, tree_size;
        public:
            union_find(unsigned long _n) : parent(_n), tree_size(_n, 1){
                for(unsigned long i = 0; i < _n; ++i)parent[i] = i;
            }
            ll find(ll x){
                while(parent[x] != x)x = parent[x] = parent[parent[x]];
                return x;
            }
            void merge(ll a, ll b){
                a = find(a);
                b = find(b);
                if (a != b) {
                    if (tree_size[a] < tree_size[b])swap(a, b);
                    tree_size[a] += tree_size[b];
                    parent[b] = a;
                    return;
                }
            }
    	    bool same(ll a, ll b){
    	        a = find(a);
    	        b = find(b);
    	        return a == b;
    	    }
        };
    //uf.mergeのように使う
    //ufはMAX_N+1でとるか、代入時に0-indexedにする
    union_find uf(H + W + 1); //代入はh,H + w
    //H + Wは、そのグループはつなげないという証明
    ll ans = 0;
    rep(i,N){
        ll index = ord[i];
        //cout<<i<<' '<<ans<<endl;
        if(uf.same(r[index] - 1, H + W) && uf.same(H + c[index] - 1, H + W)) continue;
        if(uf.same(r[index] - 1, H + c[index] - 1)) {
            uf.merge(r[index] - 1, H + W);
            uf.merge(H + c[index] - 1, H + W);
        }else{
            uf.merge(r[index] - 1, H + c[index] - 1);
        }
        ans += a[index];
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 6528