akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

using ll = long long;

#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define debug_1(x1) cerr << #x1 << ": " << x1 << endl
#define debug_2(x1, x2) \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define debug_3(x1, x2, x3)                                               \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << endl
#define debug_4(x1, x2, x3, x4)                                           \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << ", " #x4 << ": " << x4 << endl
#define debug_5(x1, x2, x3, x4, x5)                                       \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#define debug(...)                                                      \
  CHOOSE((__VA_ARGS__, debug_5, debug_4, debug_3, debug_2, debug_1, ~)) \
  (__VA_ARGS__)
#define check(s) cerr << s << endl

#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 all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define unique(v) v.erase(unique(v.begin(), v.end()), v.end());

vector<int> dx = {0, 1, 0, -1};
vector<int> dy = {1, 0, -1, 0};

const ll LINF = 2e18;
const int INF = 1e9;

// UnionFind
// coding: https://youtu.be/TdR816rqc3s?t=726
// comment: https://youtu.be/TdR816rqc3s?t=6822
struct UnionFind {
  vector<int> d;
  UnionFind(int n = 0) : d(n, -1) {}
  int find(int x) {
    if (d[x] < 0) return x;
    return d[x] = find(d[x]);
  }
  bool unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) return false;
    if (d[x] > d[y]) swap(x, y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x, int y) { return find(x) == find(y); }
  int size(int x) { return -d[find(x)]; }
};

void solve(ll N, ll M, std::vector<ll> a, std::vector<ll> b) {
  ll ans = 0;
  rep(i, M) {
    UnionFind uf = UnionFind(N);
    rep(j, M) {
      if (i != j) uf.unite(a.at(j), b.at(j));
    }

    ll cnt = 0;
    rep(j, N) {
      if (uf.d.at(j) < 0) cnt++;
    }
    if (cnt >= 2) ans++;
  }

  cout << ans << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  ll N;
  scanf("%lld", &N);
  ll M;
  scanf("%lld", &M);
  std::vector<ll> a(M);
  std::vector<ll> b(M);
  for (int i = 0; i < M; i++) {
    scanf("%lld", &a[i]);
    scanf("%lld", &b[i]);
    --a.at(i);
    --b.at(i);
  }
  solve(N, M, std::move(a), std::move(b));
  return 0;
}


Measured memory_bytes: 3704
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define ll long long int
using namespace std;
const int N= 1e5;


int main(){ 
    fast;
    ll n, t;
    cin >> n >> t;
    ll an = 1;
    while(n--){
      an = min(2 * an, an + t);
    }
    cout << an;

    return 0;
}


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

using namespace std;

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

const int MAX = 1e5+10;

int N, L, Q;
int x[MAX];
int dp[MAX][22];

int main() {

  cin >> N;
  REP (i, N) cin >> x[i+1];
  cin >> L >> Q;

  REP (i, 20) dp[N+1][i] = dp[N][i] = N+1;
  for (int i = N-1; i >= 1; i--) {
    int lo = i+1, hi = N+1;
    while (hi-lo > 1) {
      int mid = (hi+lo)/2;
      if (x[mid]-x[i] <= L) lo = mid;
      else hi = mid;
    }
    dp[i][0] = lo;
    for (int j = 1; j < 20; j++) {
      dp[i][j] = dp[dp[i][j-1]][j-1];
    }
  }

  REP (q, Q) {
    int a, b;
    cin >> a >> b;
    if (a > b) swap(a, b);

    int ans = 0;
    for (int i = 19; i >= 0; i--) {
      if (dp[a][i] <= b) {
        ans += (1<<i);
        a = dp[a][i];
        if (a == b) break;
      }
    }
    if (a < b) ans++;
    cout << ans << endl;
  }

}

Measured memory_bytes: 9856
let () = Scanf.scanf "%d\n" @@ fun n ->
  let array = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun a -> a in
  Printf.printf "%d\n" @@
  Array.fold_left (fun acc a ->
    if a = 0 || acc = 0
    then 0
    else if acc = -1
    then -1
    else if acc <= 1000000000000000000 / a
    then acc * a
    else -1) 1 array

Measured memory_bytes: 6696
class UnionSet:
    def __init__(self, nmax: int) -> None:
        self.size = [1] * nmax
        self.id = [i for i in range(nmax)]

    def root(self, i: int) -> int:
        while (i != self.id[i]):
            self.id[i] = self.id[self.id[i]]
            i = self.id[i]
        return i

    def connected(self, p: int, q: int) -> bool:
        return self.root(p) == self.root(q)

    def unite(self, p: int, q: int) -> None:
        i, j = self.root(p), self.root(q)
        if (i == j):
            return
        if self.size[i] < self.size[j]:
            self.id[i] = j
            self.size[j] += self.size[i]
        else:
            self.id[j] = i
            self.size[i] += self.size[j]


if __name__ == "__main__":
    n, q = map(int, input().split())

    u = UnionSet(n)
    for _ in range(q):
        op, x, y = map(lambda x: int(x), input().split())
        if (0 == op):
            u.unite(x, y)
        else:
            print(f"{1 if u.connected(x, y) else 0}")



Measured memory_bytes: 6056
#include<iostream>
using namespace std;
int main(){
	int n;
	cin>>n;
	for(int i = 1;i<=9;i++){
		if(n/i >= 1 && n/i<=9 && n/i*i == n){
			
			cout<<"Yes\n";return 0;
		}
	}
	cout<<"No\n";
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

		int H = sc.nextInt();
		int W = sc.nextInt();
		int h = sc.nextInt();
		int w = sc.nextInt();

		System.out.println((H - h) * (W - w));
	}
}


Measured memory_bytes: 23892
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower

using namespace std;

int my_abs(int num) {
    if (num > 0)
        return num;
    else
        return -num;
}

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

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

int main() {
    long long N;
    cin >> N;
    vector<long long> retu(N);
    for (int i = 0; i < N; i++) {
        cin >> retu.at(i);
    }
    string S = "Yes";
    for (int j = N - 1; j > 0; j--) {
        if (retu.at(j - 1) - retu.at(j) >= 2) {
            S = "No";
        }
        else if (retu.at(j - 1) - retu.at(j) == 1) {
            retu.at(j - 1)--;
        }
    }

    cout << S << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
  int sx,sy,tx,ty;
  cin >> sx >> sy >> tx >> ty;
  string ans;
  int zyoge=abs(ty-sy);
  int sayu=abs(tx-sx);
  char rl,ud;
  //1
  if(tx-sx>=0){
    rl='R';
  }else{
    rl='L';
  }
  if(ty-sy>=0){
    ud='U';
  }else{
    ud='D';
  }
  int i,j;
  for(i=0;i<zyoge;i++){
    ans=ans+ud;
  }
  for(j=0;j<sayu;j++){
    ans+=rl;
  }
  //2
  if(tx-sx>=0){
    rl='L';
  }else{
    rl='R';
  }
  if(ty-sy>=0){
    ud='D';
  }else{
    ud='U';
  }
  for(i=0;i<zyoge;i++){
    ans=ans+ud;
  }
  for(j=0;j<sayu;j++){
    ans+=rl;
  }
  //3
  if(tx-sx>=0){
    rl='R';
    ans+='D';
  }else{
    rl='L';
    ans+='D';
  }
  if(ty-sy>=0){
    ud='U';
  }else{
    ud='D';
  }
  for(j=0;j<sayu+1;j++){
    ans+=rl;
  }
  for(i=0;i<zyoge+1;i++){
    ans=ans+ud;
  }
  //4
  if(tx-sx>=0){
    ans+='L';
    rl='L';
    ans+='U';
  }else{
    ans+='R';
    rl='R';
    ans+='U';
  }
  if(ty-sy>=0){
    ud='D';
  }else{
    ud='U';
  }
  for(j=0;j<sayu+1;j++){
    ans+=rl;
  }
  for(i=0;i<zyoge+1;i++){
    ans=ans+ud;
  }
   if(tx-sx>=0){
    ans+='R';
  }else{
    ans+='L';
  }
  cout << ans;
}

Measured memory_bytes: 3692
#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#include <ext/pb_ds/assoc_container.hpp>

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace __gnu_pbds;
#define lli long long int
#define ulli unsigned long long int
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define pf pop_front()
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define max3(a,b,c) max(a,max(b,c))
#define loopl(i,a,b) for(lli i=a;i<b;i++) 
#define loop(i,a,b) for(int i=a;i<b;i++)
#define mod 1000000007
#define mo 998244353
#define inf 1000000000000000
#define lld long double
#define pll pair<long long int,long long int>
#define vll vector<lli>
#define eps 0.000001
#define ms 16
#define endl '\n'

 
using namespace std ;
 
#define N 100005

typedef tree<lli,null_type,less<lli>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;

int main()
{  
/////////////////////////////////////
    
    fastio;

    lli n,m;
    cin>>n>>m;

    lli dp[n+1]={0};

    lli a[m];
    loopl(i,0,m) cin>>a[i];

    lli ptr=0;

    dp[0] = 1;
    if(a[0] == 1)
    {
        dp[1] = 0;
        ptr++;
    }

    else
    {
        dp[1]=1;
    }

    loopl(i,2,n+1)
    {
        if(ptr<m && a[ptr] ==i) {ptr++;continue;}

        else
            dp[i] = (dp[i-1]+dp[i-2])%mod;
    }

    cout<<dp[n];


}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll N;
struct Node {
  ll x, y;
  Node() = default;
  Node(int a, int b) : x(a), y(b) {}
  friend bool operator<(const Node& n1, const Node& n2) {
    if (n1.x != n2.x) return n1.x < n2.x;
    return n1.y < n2.y;
  }
};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> N;
  vector<Node> v(N);

  int vmin = INT_MAX;
  int imin = -1;
  int vmax = INT_MIN;
  int imax = -1;
  for (int i = 0; i < N; ++i) {
    int x, y;
    cin >> x >> y;
    if (x > y) swap(x, y);
    v[i].x = x;
    v[i].y = y;
  }

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

  for (int i = 0; i < N; ++i) {
    int x = v[i].x;
    int y = v[i].y;
    if (vmin > x) {
      vmin = x;
      imin = i;
    }

    if (vmax < y) {
      vmax = y;
      imax = i;
    }
  }

  ll ret = 1LL << 62;
  const ll rmin = vmin;
  // if bmax = vmax;
  ll bmax = vmax;

  ll rmax = rmin;
  ll bmin = bmax;

  for (auto& n : v) {
    rmax = max(rmax, n.x);
    bmin = min(bmin, n.y);
  }

  ret = min(ret, (rmax - rmin) * (bmax - bmin));
  // if rmax = vmax;
  rmax = vmax;

  multiset<int> st;
  vector<Node> bv;
  for (int i = 0; i < N; ++i) {
    if (i != imin && i != imax) {
      bv.push_back(v[i]);
      st.insert(v[i].x);
    }
  }
  st.insert(v[imin].y);
  st.insert(v[imax].x);

  bmin = *st.begin();
  bmax = *st.rbegin();
  ret = min(ret, (rmax - rmin) * (bmax - bmin));
  for (int i = 0; i < bv.size(); ++i) {
    auto const& c = bv[i];
    if (c.x > *st.begin()) break;
    st.erase(st.find(c.x));
    st.insert(c.y);
    bmin = *st.begin();
    bmax = *st.rbegin();

    ret = min(ret, (rmax - rmin) * (bmax - bmin));
  }

  cout << ret << endl;
}

Measured memory_bytes: 16876
class abc_159:
    
    def __init__(self):
        pass
    
    def A(self):
        NM=list(map(int,input().split()))
        print(int((NM[0]*(NM[0]-1))/2 + (NM[1]*(NM[1]-1))/2))
    
    def B(self):
       pass
    
    def C(self):
        pass
        
    def D(self):
        pass
    
    def E(self):
        pass
    
    def F(self):
        pass
    
    
if __name__=='__main__':
    obj=abc_159()
    obj.A()
    

Measured memory_bytes: 38384
/* C++14 (Clang 3.8.0) for AtCoder */

#include <iostream>
#include <vector>
#include <string>
// #include <cmath>
// #include <math.h>
// #include <map>
// #include <algorithm>

namespace AtCoder {
	using Str = std::vector<std::string>;
	using Num = std::vector<int>;
	using BigNum = std::vector<double>;

	class Ans {
	public:
		void showResult(void);
		void increment(void);
		void increment(double);
		void decrement(void);
		void decrement(double);
		double getResult(void);
	private:
		double result;
	};
	void Ans::showResult(void) {
		printf("%.0lf\n", this->result);
	}
	void AtCoder::Ans::increment(void) {
		this->result++;
	}
	void AtCoder::Ans::increment(double value) {
		this->result += value;
	}
	void AtCoder::Ans::decrement(void) {
		this->result--;
	}
	void AtCoder::Ans::decrement(double value) {
		this->result -= value;
	}
	double AtCoder::Ans::getResult(void) {
		return this->result;
	}

	void input(Str* str) {
		str->clear();
		std::string buf = "", row = "";
		std::getline(std::cin, buf);
		for (unsigned int i = 0; i < buf.size(); i++) {
			if (' ' == buf[i]) {
				str->push_back(row);
				row = "";
			} else {
				row += buf[i];
			}
		}
		str->push_back(row);
	}
	void input(Num* num) {
		num->clear();
		std::string buf = "", row = "";
		std::getline(std::cin, buf);
		for (unsigned int i = 0; i < buf.size(); i++) {
			if (' ' == buf[i]) {
				num->push_back(std::atoi(row.c_str()));
				row = "";
			} else {
				row += buf[i];
			}
		}
		num->push_back(std::atoi(row.c_str()));
	}
	void input(BigNum* num) {
		num->clear();
		std::string buf = "", row = "";
		std::getline(std::cin, buf);
		for (unsigned int i = 0; i < buf.size(); i++) {
			if (' ' == buf[i]) {
				num->push_back(std::atof(row.c_str()));
				row = "";
			} else {
				row += buf[i];
			}
		}
		num->push_back(std::atof(row.c_str()));
	}
	void exp(std::string* str,  Str* newStr) {
		std::string pre = *str;
		newStr->clear();
		for (unsigned int i = 0; i < pre.length(); i++) {
			newStr->push_back(pre.substr(i, 1));
		}
	}
	void reverse(std::vector<std::string>* vec) {
		std::reverse(vec->begin(), vec->end());
	}
}

int main(void) {

	AtCoder::Str s, r;
	AtCoder::input(&s);

	AtCoder::exp(&s[0], &s);

	r = s;
	AtCoder::reverse(&r);

	int ans = 0;
	const int max = (s.size() / 2);
	for (int i = 0; i < max; i++) {
		if (s[i] != r[i]) {
			ans++;
		}
	}

	printf("%d\n", ans);

	return 0;
}


Measured memory_bytes: 256
import sys
stdin = sys.stdin

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n = ni()
a = []
b = []
for _ in range(n):
    ai,bi = li()
    a.append(ai)
    b.append(bi)
    
a = a[::-1]
b = b[::-1]

ans = 0

for ai,bi in zip(a,b):
    if (ans + ai) % bi == 0:
        continue
    
    else:
        ans += (bi - (ans+ai)%bi)
    
print(ans)

Measured memory_bytes: 11868
/*BISMILLAH
THE WHITE WOLF
NO DREAM IS TOO BIG AND NO DREAMER IS TOO SMALL*/

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<long long> vll;
typedef vector<int> vi;

#define io ios_base::sync_with_stdio(false)
#define pb push_back
#define eb emplace_back
#define mod   1000000000
#define PI 2*acos(0.0)
#define dbg(a) cout<<#a<<" ->->->-> "<<a<<"\n"
int dirx[] = {1, -1,0, 0}, diry[] = {0, 0, 1, -1};

ll bigmod(ll x, ll p)
{
    ll res = 1;
    while(p)
    {
        if(p&1)
            res = (res*x)%mod;
        x = (x*x)%mod;
        p >>= 1;
    }
    return res;
}



//=============================================ASIFAZAD==============================================//


int32_t main()
{
    io;
    string s;
    cin>>s;
    deque<char> inp;
    for(auto x: s) inp.pb(x);

    bool cur = 0;
    int q;
    cin>>q;
    while(q--)
    {
        int ck;
        cin>>ck;
        if(ck == 1)
            cur ^= 1;
        else
        {
            int f;
            char c;
            cin>>f>>c;
            if(cur)
                f = (f == 1? 2:1);
            if(f == 1)
                inp.push_front(c);
            else
                inp.push_back(c);
        }
    }
    if(cur)
        reverse(inp.begin(), inp.end());
    for(auto x: inp) cout<<x;
    return 0;
}


Measured memory_bytes: 3984
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <bitset>
#include <utility>
#include <cstring>
#include <numeric>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pair<int,int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
#define rep(i,n) for(int i=0;i<n;i++)
#define repll(i,n) for(long long int i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define P 1000000007
#define STI(s) atoi(s.c_str())//string to int
#define mp(p,q) make_pair(p,q)
#define Sort(a) sort(a.begin(),a.end())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int INF = INT_MAX;
const long long LLINF = 1LL<<60;
template <typename T_char>
char ToUpper (char cX) { return toupper(cX); }
//g++ -std=c++1z temp.cpp
//./a.exe
ll digit(ll a){
    ll count = 0;
    for (ll i = 0; i < a; i++)
    {   if (a == 0)
        {
            break;
        }else
        {
            a = a/10;
            count++;
        }
    }
    return count;
}
//桁数のカウント
//pow(x,n) == x^n
//sum = accumulate(v.begin(),v.end(),0);
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a,   b) * b;}



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

ll n,sum = 0;
cin >> n;

rep(i,n+1){
    if(i % 3 == 0 || i % 5 == 0){
        
    }else{
        sum += i;
    }
}
cout << sum << endl;

//////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 3668
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <cerrno>
#include <cfenv>
#include <cstring>
#include <bitset>

using namespace std;
int main()
{
    string S;
    cin >> S;
    int i = 0;
    while (S[i])
    {
        S[i] = 'x';
        i++;
    }

    cout << S;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(int i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(int i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())

bool cmp(const pair<ll, ll> &a, const pair<ll, ll> &b) {
    return a.first > b.first;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll N, M;
    cin >> N >> M;
    map<ll, ll> card;
    vector<pair<ll, ll>> vc;
    ll ans = 0, cnt = 0;
    
    rep(i, N) {
        ll a;
        cin >> a;
        card[a]++;
    }
    
    rep(i, M) {
        ll b, c;
        cin >> b >> c;
        card[c] += b;
    }
    
    for (auto u : card) {
        vc.push_back(pair<ll, ll>(u.first, u.second));
    }
    
    sort(all(vc), cmp);
    
    rep(i, sz(vc)) {
        int cc = min(vc[i].second, N - cnt);
        ans += cc * vc[i].first;
        cnt += cc;
    }
    
    cout << ans << endl;
    return 0;
}

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

from collections import defaultdict

s = defaultdict()
for i in ["a", "b", "c"]:
    s[i] = list(input())

turn = "a"
while True:
    if s[turn]:
        turn = s[turn].pop(0)
    else:
        break

ans = turn.upper()
print(ans)


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

int N, M;
vector<int> G[100001];
int dp[100001];

int rec(int v) {
    if (dp[v] != -1) return dp[v];
    int res = 0;
    for (auto nv : G[v]) {
        res = max(res, rec(nv) + 1);
    }
    return dp[v] = res;
}

int main() {
    cin >> N >> M;
    for (int i = 0; i < M; i++) {
        int x, y;
        cin >> x >> y;
        x--;
        y--;
        G[x].push_back(y);
    }

    fill(dp, dp + N, -1);
    int res = 0;
    for (int i = 0; i < N; i++) {
        res = max(res, rec(i));
    }
    cout << res << endl;
}

Measured memory_bytes: 8192
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Math;

namespace CSharpSpiral {
    class Program {
        static void Main(string[] args) {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
			new Program().Solve(new ConsoleInput(
#if DEBUG
			new StreamReader("../../../inputData.txt")
#else
			Console.In
#endif
			, ','));
            Console.Out.Flush();
        }
		public void Solve(ConsoleInput cin) {
			int[] count = new int[4];
			while(!cin.isEOF) {
				var datum = cin.ReadStrArray(2)[1];
				switch(datum[0]) {
					case 'B':
						count[1]++;break;
					case 'O':
						count[3]++;break;
					default:
						if(datum.Length > 1) count[2]++;
						else count[0]++;
						break;
				}
			}
			Console.WriteLine(count.Join("\n"));
		}

	}
	static class ExtendClass {
		public static string Join<T>(this IEnumerable<T> X, string separator = " ") => string.Join(separator, X);
		
	}
	class ConsoleInput {
		private readonly TextReader _stream;
		private readonly char _separator = ' ';
		private readonly Queue<string> inputStream;
		public ConsoleInput(TextReader stream, char separator = ' ') {
			this._separator = separator;
			this._stream = stream;
			inputStream = new Queue<string>();
		}
		public string Read {
			get {
				if(inputStream.Count != 0) return inputStream.Dequeue();
				string[] tmp = _stream.ReadLine().Split(_separator);
				for(int i = 0; i < tmp.Length; ++i)
					inputStream.Enqueue(tmp[i]);
				return inputStream.Dequeue();
			}
		}
		public string ReadLine { get { return _stream.ReadLine(); } }
		public int ReadInt { get { return int.Parse(Read); } }
		public long ReadLong { get { return long.Parse(Read); } }
		public double ReadDouble { get { return double.Parse(Read); } }
		public string[] ReadStrArray(long N) {
			var ret = new string[N];
			for(long i = 0; i < N; ++i)
				ret[i] = Read;
			return ret;
		}
		public int[] ReadIntArray(long N) { var ret = new int[N]; for(long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
		public long[] ReadLongArray(long N) { var ret = new long[N]; for(long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
		public double[] ReadDoubleArray(long N) { var ret = new double[N]; for(long i = 0; i < N; ++i) ret[i] = ReadDouble; return ret; }
		public bool isEOF {
			get { return _stream.Peek() == -1; }
		}
	}

}



Measured memory_bytes: 16284
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <algorithm>

using namespace std;

// Returns 1 if the i-th bit of x is set, 0 otherwise.
#define BIT_SET(x, i) (((x) & (1<<(i))) != 0)
// Sets the i-th bit of x to 1
#define SET_BIT(x, i) ((x) | (1<<(i)))
// Sets the i-th bit of x to 0
#define UNSET_BIT(x, i) ((x) & ~(1<<(i)))

class Task {
    public:
        void solve(istream& in, ostream& out) {
        	int N;
        	in >> N;
        	vector<int> v(1<<N);
        	for (int j = 0; j < 1 << N; j++)
        		in >> v[j];
        	out << fight(0, (1<<N) - 1, v) << endl;
        }

        int fight(int l, int r, vector<int>& v) {
        	if (l == r) {
        		return v[l];
        	}
        	else {
        		int lw = fight(l, l + (r-l)/2, v);
        		int rw = fight(l + (r-l)/2 + 1, r, v);
        		if (lw == rw)
        			return lw;
        		return max(lw, rw) - min(lw, rw);
        	}
        }
} task;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    task.solve(in, out);
    return 0;
}

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

int main(){
  vector<int> n(3);
  for(int i=0;i<3;i++){
    cin >> n.at(i);
  }
    
    sort(n.begin(),n.end());
    cout << 10*n.at(2)+n.at(1)+n.at(0) << endl;
}

Measured memory_bytes: 256
import string
from collections import Counter

lines = ''
try:
    while True:
        s = input()
        lines += s.lower()
except:
    ans = Counter([c for c in lines if c.isalpha()])

    for k in string.ascii_lowercase:
        if k in ans:
            print(f'{k} : {ans[k]}')
        else:
            print(f'{k} : 0')



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

int main()
{
    int n;
    cin >> n;
    vector<int> l(n), r(n);
    int answer = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> l.at(i) >> r.at(i);
        answer += r.at(i) - l.at(i) + 1;
    }
    cout << answer << endl;
}

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

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

	if(a < b){
		cout << "a < b" << endl;
	}

	if(a > b){
		cout << "a > b" << endl;
	}

	if(a == b){
		cout << "a == b" << endl;
	}

	return 0;
}

Measured memory_bytes: 1156
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt();
		if(k>=1800) {
			System.out.println(1);
		}
		else if(k>=1600) {
			System.out.println(2);
		}
		else if(k>=1400) {
			System.out.println(3);
		}
		else if(k>=1200) {
			System.out.println(4);
		}
		else if(k>=1000) {
			System.out.println(5);
		}
		else if(k>=800) {
			System.out.println(6);
		}
		else if(k>=600) {
			System.out.println(7);
		}
		else if(k>=400) {
			System.out.println(8);
		}
	}

}


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

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


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <math.h>
#include <limits>

template <typename T>
void vc(T t) {
    std::cout << t << " ";
}

template<typename T, typename... Args>
void vc(T t, Args... args) {
// recursive variadic function
    std::cout << t << " ";
    vc(args...) ;
}

const int N = 1;
int a[N];
void once() {
  int a, b, c, d;
  std::cin >> a >> b >> c >> d;
  bool flag = false;
  while (a > 0 && c > 0) {
    if (flag) {
      a -= d;
      flag = false;
    } else {
      c -= b;
      flag = true;
    }
  }
  if (a <= 0) {
    std::cout << "No" << std::endl;
  } else {
    std::cout << "Yes" << std::endl;
  }
}

int
main() {
  int n = 1;
  std::ios::sync_with_stdio(false);
  // std::cin >> n;
  while (n--) {
    once();
  }
}

Measured memory_bytes: 3660
#include<stdio.h>
#include<string.h>
int f(char a[75],char b[75]){
  int la=strlen(a),lb=strlen(b);
  if(la>lb)return 1;
  if(la<lb)return -1;
  return strcmp(a,b);
}
int main(){
  int w,h,i,j;
  char s[75][75][2]={0};
  while(scanf("%d %d",&w,&h),w||h){
    char d[75][75][75]={0};
    char max[75]={0}; 
    for(i=1;i<=h;i++){
      for(j=1;j<=w;j++)scanf(" %c",&s[i][j][0]);
    }
    for(i=1;i<=h;i++){
      for(j=1;j<=w;j++){
	if(f(d[i-1][j],d[i][j-1])<0)strcpy(d[i][j],d[i][j-1]);
	else                        strcpy(d[i][j],d[i-1][j]);
	strcat(d[i][j],s[i][j]);
	if('A'<=s[i][j][0]&&s[i][j][0]<='Z'||d[i][j][0]=='0')d[i][j][0]=0;
	if(f(max,d[i][j])<0)strcpy(max,d[i][j]);
      }
    }
    printf("%s\n",max);
  }
  return 0;
}

Measured memory_bytes: 1036
import java.util.Scanner;
public class Main{ 
public static void main(String[] args) {
   Scanner sc = new Scanner(System.in);
      int a = sc.nextInt();
      int b = sc.nextInt();
      System.out.println(a*b+" "+(a+a+b+b));
		 sc.close();

 
    }
}


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

typedef long long int ll;
typedef vector<int> vi;			typedef vector<ll> vl;
typedef vector<vi> vvi; 		typedef vector<vl> vvl;
typedef pair<int, int> 	pii;	typedef pair<ll, ll> pll;
typedef vector<pii> vii; 		typedef vector<pll> vll;
typedef map<int,int> mii;
typedef vector<char> vc;
typedef vector<bool> vb;
#define endl '\n'
#define forn(i,n) for(int i=0;i<n;i++)
#define rforn(i,n) for(int i=n-1;i>=0;i--)
#define forne(i,n) for(int i=1;i<=n;i++)
#define rforne(i,n) for(int i=n;i>=1;i--)
#define forse(i,s,e) for(int i=s;i<e;i++)
#define rforse(i,s,e) for(int i=e-1;i>=s;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll)x.size()
#define MOD 1000000007
#define F first
#define S second
#define pb push_back
#define in insert
#define mp(a, b) make_pair(a, b)
#define fill(a,x) memset(a,x,sizeof a);
#define trav(a,x) for(auto &a:x)
#define min3(a, b, c) min(min(a, b), c)
#define min4(a, b, c, d) min(min(a, b), min(c, d))
#define max3(a, b, c) max(max(a, b), c)
#define max4(a, b, c, d) max(max(a, b), max(c, d))
#define INF INT_MAX
#ifdef KARAN
	#include "../../trace.h"
#else
    #define trace(args...)
#endif

ll modpow(ll a, ll b, ll m = MOD){a %= m; ll res = 1; 
	while (b) {if (b & 1)res = (res * a) % m; a = (a * a) % m; b >>= 1;} return res;}
ll bpow(ll a, ll b){ll res = 1; while (b) {if (b & 1)res = res * a; a = a * a; b >>= 1;} return res;}
ll modinv(ll a, ll m = MOD) {return modpow(a, m - 2, m);}
void graph(vvi &adj, int m) {int x, y; forn(i, m){cin>>x>>y; adj[--x].pb(--y); adj[y].pb(x);}}

void solve(){
	int a, b, c, d;
	cin>>a>>b>>c>>d;
	int t1 = (a+d-1)/d;
	int t2 = (c+b-1)/b;
	if(t2<=t1)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	#ifdef KARAN
		freopen("inp.txt", "r", stdin);
    	freopen("out.txt", "w", stdout);
    	freopen("err.txt", "w", stderr);
	#endif
	int t=1;
	// cin>>t;
	while(t--)
		solve();
}

Measured memory_bytes: 3656
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int t = Integer.parseInt(sc.next());
        NavigableMap<Integer, Integer> map = new TreeMap<>();
        int min = Integer.MAX_VALUE;
        for (int i = 0; i < n; i++) {
            int a = Integer.parseInt(sc.next());
            min = Math.min(min, a);
            int temp = a - min;
            map.merge(temp, 1, Integer::sum);
        }
        System.out.println(map.lastEntry().getValue());
    }
}

Measured memory_bytes: 51092
#pragma comment(linker, "/STACK:128777216")

#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <sstream>
 
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
 
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <string.h>
 
#include <memory.h>
#include <cassert>
#include <time.h>
 
using namespace std;
 
#define forn(i,n) for (int i = 0; i < (int)(n); i++)
#define fornd(i, n) for (int i = (int)(n) - 1; i >= 0; i--)
#define forab(i,a,b) for (int i = (int)(a); i <= (int)(b); i++)
#define forabd(i, b, a) for (int i = (int)(b); i >= (int)(a); i--)
#define forit(i, a) for (__typeof((a).begin()) i = (a).begin(); i != (a).end(); i++)
 
#define _(a, val) memset (a, val, sizeof (a))
#define sz(a) (int)((a).size())
#define pb push_back
#define mp make_pair
#define all(v) (v).begin(), (v).end()
 
typedef long long lint;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vii;
 
const lint LINF = 1000000000000000000LL;
const int INF = 1000000000;
const long double eps = 1e-9;
const long double PI = 3.1415926535897932384626433832795l;
 
#ifdef MY_DEBUG
#define dbgx( x ) { cerr << #x << " = " << x << endl; }
#define dbg( ... ) { fprintf(stderr, __VA_ARGS__); fflush(stderr); }
#else
#define dbgx( x ) {  } 
#define dbg( ... ) {  } 
#endif
 
void prepare(string s)
{
#ifdef MY_DEBUG
    freopen ("input.txt", "r", stdin);
    // freopen ("output.txt", "w", stdout);
#else
    if (s.length() != 0)
    {
        freopen ((s + ".in").c_str(), "r", stdin);
        freopen ((s + ".out").c_str(), "w", stdout);
    }
#endif
}

int a, b, h, m;

void read() {
  scanf("%d %d %d %d", &a, &b, &h, &m);
}

void solve() {
  ld alp1 = PI*m / 30;
  ld alp2 = 2*PI*(h*60 + m) / 12 / 60;
  ld alp = fabs(alp1 - alp2);
  if (alp > PI) {
    alp = 2*PI - alp;
  }

  double ans = sqrt(a*a + b*b -2*a*b*cos(alp));
  printf("%.12f\n", ans);
}

int main() {
	prepare("");
    read();
    solve();

    return 0;
}


Measured memory_bytes: 4188
#include <iostream>
#include <deque>
#include <utility>
#define llint long long

using namespace std;
typedef pair<llint, llint> P;

llint n, c;
llint h[200005];
llint dp[200005];
deque<P> deq;

llint calc(P p, llint x){
	return p.first * x + p.second;
}

bool check(P p1, P p2, P p3)
{
	llint a1 = p1.first, b1 = p1.second;
	llint a2 = p2.first, b2 = p2.second;
	llint a3 = p3.first, b3 = p3.second;
	
	return (a2-a1)*(b3-b2) >= (b2-b1)*(a3-a2);
}

int main(void)
{
	cin >> n >> c;
	for(int i = 1; i <= n; i++) cin >> h[i];
	
	deq.push_back(make_pair(-2*h[1], h[1]*h[1]));
	for(int i = 2; i <= n; i++){
		while(deq.size() >= 2 && calc(deq[0], h[i]) >= calc(deq[1], h[i])) deq.pop_front();
		dp[i] = calc(deq.front(), h[i]) + h[i]*h[i] + c;
		
		P nx = make_pair(-2*h[i], dp[i]+h[i]*h[i]);
		while(deq.size() >= 2 && check(deq[(int)deq.size()-2], deq[(int)deq.size()-1], nx)) deq.pop_back();
		deq.push_back(nx);
	}
	
	cout << dp[n] << endl;
	return 0;
}

Measured memory_bytes: 5632
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
typedef long long ll;
//#define P pair<ll,ll>
#define FOR(I,A,B) for(int I = int(A); I < int(B); ++I)
#define FORR(I,A,B) for(int I = int((B)-1); I >= int(A); --I)
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define REV(x) (reverse(x.begin(),x.end())) //reverse
#define TO(x,t,f) ((x)?(t):(f))
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define FILV(x,a) fill(x.begin(),x.end(),a)
#define FILA(ar,N,a) fill(ar,ar+N,a)
#define NEXTP(x) next_permutation(x.begin(),x.end())
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define pb push_back
#define pri(aa) cout<<(aa)<<endl
#define mp(x,y) make_pair(x,y)
#define fi first
#define se second
const ll INF=1e18+7;
const ll MOD=1e9+7;



int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	ll N;
	cin >> N;
	string s;
	cin >> s;
	s = 'x'+s+'x';
	vector<ll> b(N+2,0),w(N+2,0);
	if(s[1]=='#')b[1] = 1;
	if(s[N]=='.')w[N]=1;
	FOR(i,2,N+2){
		b[i] = b[i-1] + (s[i]=='#');
	}
	FORR(i,0,N){
		w[i] = w[i+1] + (s[i]=='.');
	}
	ll ans = 1000000000;
	FOR(i,0,N+1){
		ans = min(ans,w[i+1]+b[i]);
	}
	cout << ans << endl;
}

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

int main(){
    int A,B,C;
    cin>>A>>B>>C;
    
    int count=0;
    
    if(A+B>=C){
        count+=B+C;
        cout<<count<<endl;
        return 0;
    }else if(A+B<C){
        count+=(A+B+1)+B;
        cout<<count<<endl;
        return 0;
    }
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

const int inf = INT_MAX;
const int MOD = 1000000007;
const long long INF = LLONG_MAX;

// -------------------------------------------------------

ll X;

int main() {
  cin >> X;

  ll sum = 0;
  repe(i, 1, X) {
    sum += i;
    if (sum >= X) {
      cout << i;
      return 0;
    }
  }
}


Measured memory_bytes: 3592
S = input().rstrip()
op = ['+', '-']
for op1 in op:
    for op2 in op:
        for op3 in op:
            res = 0
            try:
                func = S[0] + op1 + S[1] + op2 + S[2] + op3 + S[3]
                res = eval(func)
            except:
                pass
            if res == 7:
                print(func + '=7')
                exit()


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

int main() {
	int n;
	pair<int, int>a[100], b[100];
	cin >> n;
	int inf = 300;
	for (int i = 0; i < n; i++) {
		cin >> a[i].second >> a[i].first;
	}
	for (int i = 0; i < n; i++) {
		cin >> b[i].first >> b[i].second;
	}
	sort(a, a + n, greater<pair<int, int>>());
	sort(b, b + n);
	int s;
	for (int i = 0; i < n; i++) {
		s = a[i].second;
		a[i].second = a[i].first;
		a[i].first = s;
	}
	int ans = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (b[i].first > a[j].first&&b[i].second > a[j].second) {
				ans++;
				a[j].first = a[j].second = inf;
				break;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

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

const int N = 4*6;

int n;
int x[N], y[N], r[N], c[N], over[N];
char memo[1<<N];

bool intersects(int x1, int y1, int r1, int x2, int y2, int r2) {
  int x = x2 - x1, y = y2 - y1, r = r1 + r2;
  return x*x + y*y < r*r;
}

int calc(int used) {
  if (memo[used] != -1) { return memo[used]; }
  int ret = 0;
  for (int i = 0; i < n; ++i) {
    if (used & (1 << i)) { continue; }
    if (over[i] & ~used) { continue; }
    for (int j = i+1; j < n; ++j) {
      if (used & (1 << j)) { continue; }
      if (over[j] & ~used) { continue; }
      if (c[i] != c[j]) { continue; }
      ret = max(ret, calc(used | (1 << i) | (1 << j)) + 2);
    }
  }
  return memo[used] = ret;
}

int main() {
  while (scanf("%d", &n), n) {
    memset(memo, -1, sizeof(memo));
    for (int i = 0; i < n; ++i) {
      scanf("%d%d%d%d", x+i, y+i, r+i, c+i);
    }
    for (int i = 0; i < n; ++i) {
      over[i] = 0;
      for (int j = 0; j < i; ++j) {
        if (intersects(x[i], y[i], r[i], x[j], y[j], r[j])) {
          over[i] |= 1 << j;
        }
      }
    }
    printf("%d\n", calc(0));
  }
}

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

int main() {
	int Y, X;
	cin >> X >> Y;
	if (X < 4 && Y < 4) {
		if (X + Y == 2) cout << 1000000 << endl;
		if (X + Y == 3)cout << 500000 << endl;
		if (X + Y == 4)cout << 400000 << endl;
		if (X + Y == 5)cout << 300000 << endl;
		if (X + Y == 6)cout << 200000 << endl;
	}
	if (X < 4 && Y>3) {
		if (X == 1)cout << 300000 << endl;
		if (X == 2)cout << 200000 << endl;
		if (X == 3)cout << 100000 << endl;
	}
	if (X > 3 && Y < 4) {
		if (Y == 1)cout << 300000 << endl;
		if (Y== 2)cout << 200000 << endl;
		if (Y == 3)cout << 100000 << endl;

	}
	if(X>3&&Y>3)cout << 0 << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <tuple>
#include <time.h>
using namespace std;
typedef long long ll;

int main() {
    ll n, k;
    cin >> n >> k;
    if (n < 2 * k - 1) {
        cout << -1 << endl;
        return 0;
    }

    ll a[n + 5], b[n + 5], c[n + 5], t = (n + 1) / 2;
    ll q = 2 * n - 1, r = 3 * n - 1, p = r - t - q;
    for (int i = 0; i < n; i++) {
        a[i] = p;
        b[i] = q;
        c[i] = r;
        p++;
        q -= 2;
        r--;
        if (p >= q) {
            if (n % 2 == 1) {
                p = 0;
                q = r - t;
            }
            else {
                p = 0;
                q = r - t - 1;
            }
        }
    }

    for (int i = 0; i < n; i++) {
        cout << a[i] + k << " " << b[i] + k << " " << c[i] + k << endl;
    }
}

Measured memory_bytes: 4608
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

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

    vector <int> height(n + 1, 0);
    for(int i = 1; i <= n; i++)
        scanf("%d",&height[i]);

    vector <int> cost(n + 1);
    cost[2] = abs(height[2] - height[1]);
    for(int i = 3; i <= n; i++)
        cost[i] = min(cost[i - 1] + abs(height[i] - height[i - 1]),
                              cost[i - 2] + abs(height[i] - height[i - 2]));

    printf("%d",cost[n]);
    return 0;
}

Measured memory_bytes: 1024
S=gets.chomp

arr = Array.new(S.length,0)

i = 0
s = S
loop do
  idx = s.index('L',i)
  count = idx - i
  arr[idx] += count/2
  arr[idx-1] += count/2+(count%2)
  i = s.index('R',idx)
  break if i.nil?
end

i = 0
s = S.reverse
arr= arr.reverse
loop do
  idx = s.index('R',i)
  count = idx - i
  arr[idx] += count/2
  arr[idx-1] += count/2+(count%2)
  i = s.index('L',idx)
  break if i.nil?
end

puts arr.reverse.join(' ')



Measured memory_bytes: 4860
#!/usr/bin/env python
# coding: utf-8

# In[12]:


import collections


# In[10]:


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


# In[30]:


ans = 0
mydict = {}
for i in range(N):
    tmp = "".join(sorted(s[i]))
    if tmp not in mydict:
        mydict[tmp] = 1
    else:
        ans += mydict[tmp]
        mydict[tmp] += 1
print(ans)



Measured memory_bytes: 29604
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define PI 3.141592653589793
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, a, n) for (int i = a; i < (n); i++)
#define rrep(i, n, k) for (int i = (n); i >= (k); i--);
#define all(x) (x).begin(), (x).end()
#define vi vector<int>
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>vector<T> make_vector(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto make_vector(size_t a, Ts... ts){return vector<decltype(make_vector<T>(ts...))>(a, make_vector<T>(ts...));}
const int MOD = 1e9 + 7;
const int INF = 9e18;

struct info {
    int start, end, len;
};

signed main() {
    int L;
    cin >> L;
    int count = 0;
    for (int i = 0; i <= 20; i++) {
        if ((L - 1) >= ((1<<i) - 1)) count = i;
    }
    int base = (1<<count);
    int N = count + 1;
    vector<info> ans;
    {
        int temp = 1;
        int add = (1<<(count-1));
        while (add != 0) {
            ans.push_back({temp, temp + 1, add});
            ans.push_back({temp, temp + 1, 0});
            temp++;
            add = (add>>1);
        }
    }
    {
        auto temp = bitset<20>(L - base);
        int sum = base;
        for (int i = N - 1; i >= 0; i--) {
            if (temp[i]) {
                ans.push_back({1, N - i, sum});
                sum += (1<<i);
            }
        }
    }


    cout << N << " " << ans.size() << endl;
    for (int i = 0; i < ans.size(); i++) {
        auto now = ans[i];
        cout << now.start << " " << now.end << " " << now.len << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <stack>
#include <cstdlib>
#include <queue>
#include <vector>
#include <set>
#include <stdio.h>
#include <cstdio>
using namespace std;
int p[10000];
int root(int a) {
	if (p[a] == a) return a;
	return (p[a] = root(p[a]));
}
void unite(int a,int b){
	p[root(a)] = root(b);
}
void same(int a ,int b){
	if (root(a) == root(b)) cout << "1" <<endl;
	else cout << "0" << endl;
}
int main() {
	int n, q, com,x,y;
	cin >> n >> q;
	for(int i = 0;i<n;i++){
		p[i]=i;
	}
	for (int i=0 ;i<q;i++){
		cin >> com;
		if (com == 0){
			cin >> x >> y;
			unite(x,y);
		}
		else {
			cin >> x >> y;
			same(x,y);
		}
	}
}

Measured memory_bytes: 1312
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
/* #include <regex> */

using namespace std;

/* g++ -g -std=c++11 */

/* freopen("input.txt", "rt", stdin); */
/* freopen("output.txt", "wt", stdout); */

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#define FOR(i,a,b)      for (int i=(a); i < (b); ++i)
#define FORR(i,a,b)     for (int i=(a); i > (b); --i)
#define FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

const int maxn = 2e5+5;
LL A[maxn], dp[maxn];

void checkf(deque<int>& Q, const int i)
{
    while (Q.size() > 1) {
        const int k = Q[0];
        const int j = Q[1];
        if (dp[j]-dp[k] + A[j]*A[j]-A[k]*A[k] < 2*A[i]*(A[j]-A[k]))
            Q.pop_front();
        else
            break;
    }
}

void checke(deque<int>& Q, const int h)
{
    while (Q.size() > 1) {
        const int n = Q.size();
        const int j = Q[n-1];
        const int k = Q[n-2];
        const LL a = (dp[h]-dp[j] + A[h]*A[h]-A[j]*A[j]) * (A[j]-A[k]);
        const LL b = (dp[j]-dp[k] + A[j]*A[j]-A[k]*A[k]) * (A[h]-A[j]);
        if (a < b)
            Q.pop_back();
        else
            break;
    }
    Q.push_back(h);
}

int main()
{
#ifdef foo_
    freopen("foo", "rt", stdin);
#endif
    ios::sync_with_stdio(false);
    int n; LL c;
    while (cin >> n >> c) {
        FOR(i,0,n)
            cin >> A[i];
        deque<int> Q; Q.push_back(0); dp[0] = 0;
        FOR(i,1,n) {
            checkf(Q,i);
            const int x = Q.front();
            dp[i] = (A[i]-A[x])*(A[i]-A[x]) + c + dp[x];
            checke(Q,i);
        }
        cout << dp[n-1] << endl;
    }
    return 0;
}


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

typedef long long ll;
const int N = 2000006;

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	
	string s;
	cin>>s;
	int n = s.size();
	
	for(int i=0;i<n;i++){
		cout<<'x';
	}
	
	return 0;
}


Measured memory_bytes: 3652
main(i,n){
  for(a[0]=a[1]=1,a[2]=2,i=3;i<31;i++)a[i]=a[i-1]+a[i-2]+a[i-3];
  for(;scanf("%d",&n),n;printf("%d\n",(a[n]+3649)/3650));
  return 0;
}

Measured memory_bytes: 0