akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main {
    public static void main(String args[]) {
        int[][][] res = new int[4][3][10];

        for (int i = 0; i < 4; i++) {
            for (int j = 0; j < 3; j++) {
                for (int k = 0; k < 10; k++) {
                    res[i][j][k] = 0;
                }
            }
        }

        Scanner scn = new Scanner(System.in);
        int n = scn.nextInt();

        for (int l = 0; l < n; l++) {
            int b = scn.nextInt();
            int f = scn.nextInt();
            int r = scn.nextInt();
            int v = scn.nextInt();

            res[b - 1][f - 1][r - 1] = res[b - 1][f - 1][r - 1] + v;

        }

        for (int i = 0; i < 4; i++) {
            for (int j = 0; j < 3; j++) {
                String str = "";
                for (int k = 0; k < 10; k++) {
                    str = str + " " + res[i][j][k];
                }
                System.out.println(str);
            }
            if (i < 3) {
                System.out.println("####################");
            }
        }


        scn.close();

    }


}



Measured memory_bytes: 29472
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  string s;
  cin >> s;
  int P;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'p') P++;
  }
  cout << s.length() / 2 - P << endl;
  return 0;
}

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

int main(){
    long long N;
    cin >> N;
    double ans=0,b;
    for(int i=0;i<N;i++){
        double a;
        cin >> a;
        ans += 1/a;
    }
    b = 1/ans;

    printf("%.16f",b);

}

Measured memory_bytes: 256
#include<cstdio>
int main()
{
	int k,a,b,flg,i,n;
	flg=0;
	i=0;
	scanf("%d",&k);
	scanf("%d %d",&a,&b);
	while(1){
		i++;
		n=k*i;
		// printf("n=%d i=%d\n",n,i);
		if(n>=a&&n<=b){
			flg=1;
			break;
		}
		if(n>=b){
			flg=0;
			break;
		}
	}
	if(flg==1) printf("OK\n");
	else printf("NG\n");
	return 0;
}


Measured memory_bytes: 1632
#include<bits/stdc++.h>			
typedef long long ll;
#define pb push_back
#define mod 1000000007ll
const ll maxn = 9e18;
using namespace std;
const ll maxsize = 100000009;

 
void solve() {			
	ll a, b, ans;
	cin >> a >> b;
	for(int 	i = 1; i <= 1000; ++i) {
		if((ll)(i * 0.08) == a && (ll)(i * 0.1) == b) {
			cout << i << endl;	
			return;
			}
		}
		cout << -1 << endl;
}


	

int main() {
	ios_base :: sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cout.precision(35);
	solve();
	return 0;
}






Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1e9 + 7

template < typename T >
void printVector (const vector < T > & vec) {
	for (const T x : vec) {
		cout << x << " ";
	}
	cout << endl;
}

const ll INF = 1e18L + 5;

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

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

const int mx = 1e5 + 5;
vector < int > g[mx];
int in_degree[mx];
int dist[mx];
bool visited[mx];

void dfs (int s) {
	visited[s] = true;
	for (int u : g[s]) {
		dist[u] = max (dist[u], 1 + dist[s]);
		in_degree[u]--;
		if (in_degree[u] == 0) {
			dfs (u);
		}
	}
}

int main() {
	int n, m, x, y;
	scanf ("%d %d", &n, &m);
	while (m--) {
		scanf ("%d %d", &x, &y);
		g[x].push_back (y);
		in_degree[y]++;
	}
	for (int i = 1; i <= n; i++) {
		if (!visited[i] && in_degree[i] == 0) {
			dfs (i);
		}
	}
	int answer = 0;
	for (int i = 1; i <= n; i++) {
		max_self (answer, dist[i]);
	}
	cout << answer << endl;
	return 0;
}


Measured memory_bytes: 9728
import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
         int n = sc.nextInt();
         double arr[] = new double[n];
         for(int i=0;i<n;i++) arr[i] = sc.nextDouble();
         int m = (n+1)/2;
        double dp[][] = new double[n+1][m+1];
        for(int i=1;i<=n;i++) dp[i][0] = 1;
        for(int j=1;j<=m;j++) dp[0][j] = 0;
        dp[0][0] = 1;
        for(int i=1;i<=n;i++){
            for(int j=1;j<=m;j++){
                dp[i][j] =  arr[i-1] * dp[i-1][j-1] + (1 - arr[i-1]) * dp[i-1][j];
            }
        }

        System.out.print(dp[n][m]);
    }
}

Measured memory_bytes: 69980
/*
Wai u read my code xD
*/
#include <bits/stdc++.h>
#include <iomanip>
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vi vector <ll> 
#define qu queue <ll>
#define min_3(a,b,c) min(a,min(b,c))
#define max_3(a,b,c) max(a,max(b,c))
#define nout(ans) cout << (ans) << "\n"
#define sout(ans) cout << (ans) << " "
using namespace std;

bool compare(const pair<int, int>&i, const pair<int, int>&j)
{
    return i.second < j.second;
}


void solve()
{
    int k,x; cin >> k >> x;
    if (k*500<x) nout("No");
    else nout("Yes");
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int t = 1;
    //cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}

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

class TakoyakiFes
{
    static void Main(string[] args)
    {

        var number = int.Parse(Console.ReadLine());

        int[] takoyakiList = (Console.ReadLine().Split(' ')).Select(int.Parse).ToArray(); 

        var sum = 0;

        for (var i = 0; i < number - 1; i++)
        {
            for(var j = number -1 ;j > i; j--)
            {
                sum += takoyakiList[i]  * takoyakiList[j];           
            }
        }

        Console.WriteLine(sum);
    }
}

Measured memory_bytes: 13268
#include <iostream>

using namespace std;

int main(void)
{
	int n, k;
	int a;
	cin >> n >> k;
	for (int i = 0; i < n; i++){
		cin >> a;
	}


	n -= 1;
	if (n % (k - 1) == 0) cout << (n / (k - 1)) << endl;
	else cout << (n / (k - 1)) + 1 << endl;
	return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strings"
)

func main() {
	io := NewIo(os.Stdin, os.Stdout)
	defer io.Flush()
	s := io.Next()
	if s == "ABC" {
		io.Println("ARC")
	} else {
		io.Println("ABC")
	}
}

// Io is I/O object
type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

// NewIo returns a new Io instance
func NewIo(r io.Reader, w io.Writer) *Io {
	return &Io{
		reader: bufio.NewReader(r),
		writer: bufio.NewWriter(w),
	}
}

// Flush flushes writer
func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

// NextLine scans a line from stdin
func (io *Io) NextLine() string {
	var buffer []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

// Next return a word from stdin
func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

// Println is a wrapper of fmt.Fprintln
func (io *Io) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}


Measured memory_bytes: 1776
#include<bits/stdc++.h>
using namespace std;
int n,m,fa[100005],a[100005],b[100005],x,y;
long long s;
inline int read(){
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+ch-'0';ch=getchar();}
    return x*f;
}
int find(int r){return fa[r]?fa[r]=find(fa[r]):r;}
int main(){
	n=read(),m=read();
	if(m==n-1) return 0*puts("0");
	for(int i=1;i<=n;++i) a[i]=read(),s+=a[i];
	for(int i=1;i<=m;++i){
		x=read(),y=read();
		x=find(x+1),y=find(y+1);
		s-=max(a[x],a[y]);
		b[i]=max(a[x],a[y]);
		if(a[x]>a[y]) fa[x]=y;else fa[y]=x;
	}
	if(m<n-m-2) return 0*puts("Impossible");
	sort(b+1,b+m+1);
	for(int i=1;i<=n-m-2;++i) s+=b[i];
	printf("%lld",s);
}
//既然输入的都是树，并且要求加的边的点权最小，不妨将每一棵树考虑成一棵根节点值最小的树
//显然最优的情况就是把每一棵树的顶点和剩下最小的n-m-2个点连接
//用并查集维护根最小，先把所有点加入sum，每次加入边的时候找它们所在树的根都，把大的点从sum里删除并并入小的点所在的树 
//最后剩下的sum一定是所有树的根的和
//排序一下剩下的点，取最小的n-m-2个点计入sum即为答案 

Measured memory_bytes: 1408
// {{{ Template for Competitive Programming
// -std=c++14 -Wall -g -fsanitize=undefined -D_GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;

using vint = vector<int>;
using pint = pair<int, int>;

#define int long long
#define FOR(i, a, b)  for (int(i) = (a); (i) < (b); ++(i))
#define CFOR(i, a, b) for (int(i) = (a); (i) <= (b); ++(i))
#define RFOR(i, a, b) for (int(i) = (a); (i) >= (b); --(i))
#define rep(i, n) FOR((i), 0, (n))
#define crep(i, n) CFOR((i), 0, (n))
#define rrep(i, n) RFOR((i), (n), 0)
#define ALL(x) (x).begin(), (x).end()
#define SUM(x) accumulate(ALL(x), 0)

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

int ceil(int a, int b) { return (a + (b - 1)) / b; }
void print(vint v) { rep (i, v.size()) { cout << v[i]; if (i != v.size() - 1) { cout << ' '; } else { cout << endl; } } }

const int INF = 1'010'000'000'000'000'017LL;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
// }}}

const int MOD = 1e9 + 7;

signed main() {
	int n, m;
	cin >> n >> m;
	vector<bool> broken(n, false);
	vint dp(n+1);

	rep (i, m) {
		int b; cin >> b;
		broken[b] = true;
	}

	dp[0] = 1;
	dp[1] = 1;

	CFOR (i, 2, n) {
		int former = dp[i-1] % MOD, fformer = dp[i-2] % MOD;
		if (broken[i-1]) former = 0;
		if (broken[i-2]) fformer = 0;
		dp[i] = (former + fformer) % MOD;
	}

	cout << dp[n] << endl;
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
const int INF = 1e9;
const int EPS = 1e-9; 

int main() {
  int N, M;
  cin >> N;
  vector<int> p(N), q(N);
  for(int i = 0; i < N; ++i) {
    cin >> p.at(i);
    --p.at(i);
  }
  for(int i = 0; i < N; ++i) {
    cin >> q.at(i);
    --q.at(i);
  }
  
  map<vector<int>, int> ord;
  vector<int> v(N);
  for (int i = 0; i < N; ++i) v.at(i) = i; 
  
  int cnt = 0;
  do {
    ord[v] = cnt++;
  } while (next_permutation(v.begin(), v.end()));
  cout << abs(ord.at(p) - ord.at(q)) << endl;
}

Measured memory_bytes: 5248
n,t=map(int,input().split())
a=list(map(int,input().split()))
ans=0
T=-1
prev=-1
for i in range(n):
  v=a[i]
  if v<=T:
    T=v+t
  else:
    ans+=(T-prev)
    T=v+t
    prev=v
print(ans+T-prev)

Measured memory_bytes: 85328
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define SORT(x) sort((x).begin(),(x).end())
int main(void){
    
    int a,b,c,d,e,k;
    cin >>a >>b >>c >>d >>e >>k;
    
    if((a+k)>=e){
        cout <<"Yay!";
    }else{
        cout <<":(";
    }
    
    cout <<endl;

}

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

int main(){
  int n, count=0;
  cin >> n;
  int nums[101];
  for(int& a:nums)a=0;
  for(int i=0; i<n; i++){
    int d;
    cin >> d;
    if(nums[d]==0)count++;
    nums[d]++;
  }
  cout << count;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
   int i,j,k,l,n,b,f,r,v,a[4][3][10];
   scanf("%d",&n);
   for(i=0;i<4;i++){
      for(j=0;j<3;j++){
         for(k=0;k<10;k++){
            a[i][j][k]=0;
         }
      }
   }
   for(l=0;l<n;l++){
      scanf("%d %d %d %d",&b,&f,&r,&v);
      a[b-1][f-1][r-1]+=v;
   }
   for(i=0;i<4;i++){
      for(j=0;j<3;j++){
         for(k=0;k<10;k++){
            printf(" %d",a[i][j][k]);
         }
         printf("\n");
      }
      if(i!=3){
         printf("####################\n");
      }
   }
   return 0;
}

Measured memory_bytes: 612
import java.util.*;

class Main{
  public static void main(String[] args){
    try(Scanner sc = new Scanner(System.in)){
      int x = Integer.parseInt(sc.next());
      int a = Integer.parseInt(sc.next());
      int b = Integer.parseInt(sc.next());
      int money = x - a;
      System.out.println(money % b);
      //System.out.println(money - b * money / b);
    }
  }
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
#include <numeric>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep1(i,n) for (int i = 1; i <= n; ++i)
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline T intceil(T a, T b) { return (a + (b - 1)) / b; }
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
const long long MOD = 1e9+7;
#define precout(val) cout << std::fixed << std::setprecision(20) << val;
const string alphabet = "abcdefghijklmnopqrstuvwxyz";
const int dy[4] = { 0, 1, 0, -1 };
const int dx[4] = { 1, 0, -1, 0 };
static const double pi = 3.141592653589793;

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

  int n; cin >> n;
  if(n == 1) {
    cout << 1 << endl;
    return 0;
  }

  vector<int> x(n), y(n);
  rep(i, n) {
    cin >> x[i] >> y[i];
  }

  map<P, int> cnt;
  rep(k, n) {
    rep(l, n) {
      if(k == l) continue;
      ++cnt[make_pair(x[l] - x[k], y[l] - y[k])];
    }
  }

  int ans = n;
  rep(i, n) {
    rep(j, n) {
      if(i == j) continue;
      int dx = x[j] - x[i], dy = y[j] - y[i];

      chmin(ans, n - cnt[make_pair(dx, dy)]);
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 384
//Abhinav ---IIIT_A
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define f(i,x,n) for(int i=x;i<(int)n;++i)
#define vpii vector<pair<int,int>> 
ld pie=3.141592653589793238462643383279;
int mod=1e9+7;
int dx[]={-1,1,0,0};
int dy[]={0,0,1,-1};


int dig(int a){
  int r=0;
  while(a!=0){
    int xp=a%10;
    a/=10; if(xp==1) ++r;
  }
  return r;
}

int fact[2000005];
int infact[2000005];

int inv(int a){
  int y=mod-2;
  int r=1;
  while(y!=0){
    if(y&1){
      r*=a; r%=mod;
    }
    y/=2; a*=a; a%=mod;
  }
  return r;
}

int po(int a,int y){
  int r=1;
  while(y!=0){
    if(y&1){
      r*=a; r%=mod;
    }
    y/=2; a*=a; a%=mod;
  }
  return r; 
}

void facto(){
  fact[0]=1;
  f(i,1,2000005) {fact[i]=i*fact[i-1]; fact[i]%=mod;}
  f(i,0,2000005) infact[i]=inv(fact[i]); 
}

int nck (int n,int k){
  if(k<0 || k>n) return 0;
  int ret=fact[n]; ret*=infact[k]; ret%=mod;
  ret*=infact[n-k]; ret%=mod;
  return ret;
}
void q1(){
  string s; cin>>s;
  if(s>="a" && s<="z") cout<<"a";
  else cout<<"A";
}
void q2(){
  int n,k; cin>>n>>k;
  int a[n]; f(i,0,n) cin>>a[i];
  sort(a,a+n);
  int s=0;
  f(i,0,k)s+=a[i];
  cout<<s;
}
void q3(){
  string ret="";
  int a; cin>>a;
  while(a!=0){
    a--;
    ret+=(a%26 +'a');
    a/=26;
  }
  reverse(ret.begin(),ret.end());
  cout<<ret;
}
void q4(){
  int n; cin>>n;
   int a[100005]={0};
   int s=0;
  f(i,0,n){
    int x; cin>>x;
    s+=x;
    a[x]++;
  }
  int q; cin>>q;
  while(q--){
    int b,c; cin>>b>>c;
    s-=a[b]*b;
    s+=a[b]*c;
    a[c]+=a[b];
    a[b]=0;
    cout<<s<<"\n";
  }
 
}
void q5(){
  int n; cin>>n;
  int x=0;
  int a[n]; f(i,0,n){
    cin>>a[i];
    x^=a[i];
  } 
   f(i,0,n) cout<<(x^a[i])<<" ";
}
int32_t main(){
#ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
#endif
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  q3();
  return 0;
  facto();
  int k; cin>>k;
  string s; cin>>s;
  int l=k+s.size();
  int xp=s.size();
  // total = 26^l - those which do not contain subsequence
  // --- i= 0 to  xp-1 prefix present as subseqeunce and remaining have 25^(l-i)
  int ret=1;
  f(i,0,l){
    ret*=26; ret%=mod;
  }
  int sub=0;

  f(i,0,xp){
    // l choose i
    sub+= (nck(l,i)*po(25,l-i));
    sub%=mod; 
  }

  cout<<((ret-sub)%mod + mod) %mod <<"\n";
  return 0;
}


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

typedef long long lint;

#define MAXN 100005

using namespace std;

int n, m;
bool visit[MAXN];
int color[MAXN];
int head[MAXN], cnt;
int sumc[3], sume, sumn;
lint ans;
bool illegal;

struct data {
    int next, to, type;
    data(int next = 0, int to = 0, int type = 0):next(next), to(to), type(type) {}
}edge[MAXN << 1];

void connect(int u, int v, int w) {
    edge[++cnt] = data(head[u], v, w);
    head[u] = cnt;
}

int read() {
    char c = getchar();
    int x = 0;
    while (!isdigit(c))
        c = getchar();
    while (isdigit(c)) {
        x = (x << 3) + (x << 1) + c - '0';
        c = getchar();
    }
    return x;
}

void DFS(int u, int c) {
    ++sumn;
    visit[u] = true;
    ++sumc[color[u] = c];
    for (int i = head[u]; i; i = edge[i].next) {
        int v = edge[i].to, w = edge[i].type;
        sume += (w == 1);
        if (visit[v]) {
            if (color[v] != (c + w + 3) % 3)
                illegal = true;
            continue;
        }
        DFS(v, (c + w + 3) % 3);
    }
}

int main() {
    n = read();
    m = read();
    for (int i = 1; i <= m; ++i) {
        int u = read(), v = read();
        connect(u, v, 1);
        connect(v, u, -1);
    }
    for (int i = 1; i <= n; ++i)
        if (!visit[i]) {
            illegal = sume = sumn = 0;
            memset(sumc, 0, sizeof(sumc));
            DFS(i, 0);
            if (illegal)
                ans += 1ll * sumn * sumn;
            else if (!sumc[0] || !sumc[1] || !sumc[2])
                ans += sume;
            else
                for (int i = 0; i < 3; ++i)
                    for (int j = i + 1; j < 3; ++j)
                        ans += 1ll * sumc[i] * sumc[j];
        }
    printf("%lld\n", ans);
}


Measured memory_bytes: 6528
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intput(i) cout << i << endl
#define ll long long
#define stringput(s) cout << (string)(s) << endl

int main(){
   int a, b;
    cin >> a >> b;
    int ans ;
    if(a == b){
        ans = 2*a;
    }
    else if (a > b){
        ans = 2*a-1;
    }
    else{
        ans = 2*b -1;
    }
    cout << ans  << endl;
}

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

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
const int INF = 1e18;

using namespace std;


signed main() {
  int K, X;
  cin >> K >> X;
  
  if(K*500 >= X) Yes;
  else No;

  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
 
 int main()  {
 	char strng1[102] = "";
 	char strng2[102] = "";
 	scanf("%s %s", &strng1, &strng2 ) ;
 	printf("%s%s",strng2,strng1) ;
 	return 0 ;
 	
 }

Measured memory_bytes: 1684
from collections import deque

A = list(input())
B = list(input())
C = list(input())

CARDS = [deque(A),deque(B),deque(C)]
s_to_i = {"a":0,"b":1,"c":2}
turn = 0

while CARDS[turn]:
  nxt = CARDS[turn].popleft()
  turn = s_to_i[nxt]
  
if turn == 0:
  print("A")
elif turn == 1:
  print("B")
elif turn == 2:
  print("C")



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

int main(){
  int N;
  cin >> N;
  vector<int> L(N), R(N);
  int Ans=0;
  for(int i=0; i<N; i++){
    cin >> L.at(i) >> R.at(i);
    Ans+=R.at(i)-L.at(i)+1;
  }
  cout << Ans << endl;
}


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

int main(){
  int n;
  cin >> n;
  vector<int> x(n);
  for(int i=0;i<n;i++){
    cin >> x[i];
    if(x[i]%2==0) {
      if(x[i]%3!=0&&x[i]%5!=0){
        cout << "DENIED" << endl;
        return 0;
      }
      }
  }
  cout << "APPROVED" << endl;
  return 0;
}

Measured memory_bytes: 3628
import numpy as np
import itertools

abcd = input()
abcd = np.array([int(i) for i in abcd])

ops = np.array([
    [1, op1, op2, op3] for op1, op2, op3
    in itertools.product([1, -1], [1, -1], [1, -1])])

op_ans = []
for op in ops:
    if np.dot(abcd, op)==7:
        op_ans = op
        
ans = str(abcd[0])
for dig, op in zip(abcd[1:], op_ans[1:]):
    ans += '+' if op>0 else '-'
    ans += str(dig)
ans += '=7'

print(ans)

Measured memory_bytes: 20116
//by Top
#include <bits/stdc++.h>
     
#define f first
#define s second
#define int long long
#define ld long double
#define ull unsigned long long
#define pii pair <int, int>
#define pll pair <long, long>
#define mp make_pair
#define pb push_back
#define pf push_front
#define pp pop_back
#define rev reverse
#define all(s) s.begin(), s.end()
#define sz(s) (int)s.size()
#define forn(i, a, b) for (int i = a; i <= b; i++)
#define boost ios_base::sync_with_stdio(false); cin.tie(0),cout.tie(0);
#define nxtp next_permutation
#define pvtp prev_permutation
#define KZ return 
#define x1 x21212121
#define y1 y21212121
#define sqr(x) x * x 
 
const int inf = (1e9) + 1;
const int mod = 1e9 + 7;
const int maxn = 1e5 + 111;
     
using namespace std;

int n, q, k, dp[101][maxn], pref[101][maxn], a[maxn];

int get(int x, int l, int r){
	if (l <= 0)
		return pref[x][r];
	return pref[x][r] - pref[x][l - 1];
}

void solve(){
	cin >> n >> k;

	for (int i = 1; i <= n; i++)
		cin >> a[i];

	dp[0][0] = 1;
	for(int i = 0; i <= k; i++)
		pref[0][i] = 1;

	for (int i = 1; i <= n; i++){
		for (int j = 0; j <= k; j++){
			dp[i][j] += (get(i - 1, j - a[i], j) + mod) % mod; //cerr << dp[i][j] << " ";
			//cout << get(i, j - a[i], j) << j - a[i] << " " << j << endl;
			//return;
		}
		//cout << endl;
		pref[i][0] = dp[i][0];
		for (int j = 1; j <= k; j++)
			pref[i][j] = (pref[i][j - 1] + dp[i][j]) % mod;
	}

	cout << dp[n][k];
}

main(){
    boost;
	    
	q = 1;

	while (q--){
		solve();
	}
}


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

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

    return 0;
}


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

typedef long long ll;

#define p_ary(ary,a,b,i) do { cout << "["; for (int (i) = (a);(i) < (b);++(i)) cout << ary[(i)] << ((b)-1 == (i) ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

struct bipartite_matching {
private:
    int V;
    vector<vector<int>> G;
    vector<int> match;
    vector<bool> used;
public:
    bipartite_matching(int n) {
        V = n;
        G.resize(n);
        match.resize(n);
        used.resize(n);
    }

    void add_edge(int u,int v) {
        G[u].push_back(v);
        G[v].push_back(u);
    }

    bool dfs(int v) {
        used[v] = true;
        for (int& u : G[v]) {
            int w = match[u];
            if (w < 0 || (!used[w] && dfs(w))) {
                match[v] = u;
                match[u] = v;
                return true;
            }
        }
        return false;
    }

    int count() {
        int res = 0;
        match = vector<int>(V,-1);
        for (int v = 0;v < V;++v) if (match[v] < 0) {
            used = vector<bool>(V,false);
            if (dfs(v)) res++;
        }
        return res;
    }
};
int main() {
    int x,y,e;
    cin >> x >> y >> e;
    bipartite_matching m(x+y);
    for (int i = 0;i < e;++i) {
        int a,b;
        cin >> a >> b;
        m.add_edge(a,b+x);
    }
    cout << m.count() << endl;
    return 0;
}


Measured memory_bytes: 3276
#include <cstdio>
#include <algorithm>

using namespace std;

const int ma = 1000000000;

///割引された値を単位に考える。→　余りを最安値で買う。(2変数)
///3変数では不可。→　全探索。

int main()
{
    while( 1 )
    {
        int n;
        scanf( "%d\n", &n );
        if( n == 0 )break;
        int mini = ma, num_a, num_b, num_c, index;
        for( int a = 0; a <= n; a+= 200 )
        {
            for( int b = 0; b <= n; b+= 300 )
            {
                if( a + b > n )break;
                for( int c = 0; c <= n; c += 500 )
                {
                    if( a + b + c > n ) break;
                    if( a + b + c == n )
                    {
                        num_a = a / 200;
                        num_b = b / 300;
                        num_c = c / 500;
					    index = 380*(num_a%5)+550*(num_b%4)+850*(num_c%3)+304*(num_a - num_a%5)+1870*(num_b-num_b%4)/4+748*(num_c-num_c%3);
                        mini = min( mini, index );
                    }
                }
            }
        }
        printf( "%d\n", mini );
    }
    return 0;
}



Measured memory_bytes: 2636
/*
   Author: Shivam Shukla
*/
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pair<ll,ll> > vpll;
 
const int MOD=1e9+7;
const int MAX=1e5+5;
const double PI= acos(-1.0);
const long double EPS=1e-10;
const int64_t INF=1e18+10;
 
#define fastio() ios_base::sync_with_stdio(false);cin.tie(0), cout.tie(0)
#define trace(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vi vector<int>
#define vl vector<ll>
#define vs vector<str>
#define vc(x) vector<x>
#define mapll map<ll,ll>
#define mapib map<int,bool>
#define mapiv map<int,vector>
#define mapsi map<string,int>
#define rep(i,j,k) for(ll i=j;i<k;i++)
#define down(i,j,k) for(ll i=j;i>=k;i--)
#define repa(i,n) for(ll i=0;i<n;i++)
#define dowa(i,n) for(ll i=n;i>=0;i--)
#define reps(i,j,k,s) for(ll i=j;i<k;i+=s)
#define downs(i,j,k,s) for(ll i=j;i>=k;i-=s)
#define trv(i,x) for(auto i:x)
#define pb push_back
#define eb emplace_back
#define sz(x) (int)x.size()
#define ff first
#define ss second
#define str string 
#define dub double
#define pqmax priority_queue<ll>
#define pqmin priority_queue<ll,vl,greater<ll> >
 
template<typename t> t lcm(t a, t b) {return (a*b)/__gcd(a,b);}
template<typename t> t gcd(t a, t b) {return __gcd(a,b);}
template<typename t> t mul_mod(t a, t b, t m){t res=((a%m)*(b%m)%m); return res;}
template<typename t> t add_mod(t a, t b, t m){t res=((a%m)+(b%m))%m; return res;}
template<typename t> t pow_mod(t a,t b,t m) {t res=1;while(b){if(b&1) res=mul_mod(res,a,m);a=mul_mod(a,a,m), b>>=1;} return res%m;}
template<typename t> vc(t) num_vec(t num) {t res; while (num) res.pb(num%10), num/=10; return res;}
template<typename t> t vec_num(t vec) {t res=0; ll mul=1; repa(i,sz(vec)) res=vec[i]*mul, mul*=10; return res;}
 

int32_t main(int argc,char** argv){
	fastio();
	auto tstart= clock();
 
    double r; cin >> r;
    cout << (2.0 * PI * r) << endl;  
  
    cerr<<setprecision(2)<<fixed<<"Time elapsed: "<<(double)(clock() - tstart)/CLOCKS_PER_SEC<<endl; 
    return 0; 
}

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

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)1e9+7

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
  int n, s = 0, t = 0;
  cin >> n;
  rep(i, 0, n) {
    int a;
    cin >> a;
    if(a % 4 == 0) s++;
    else if(a % 2 == 0) t++;
  }
  if(t > 1) n -= t - 1;
  n -= s;
  if(n <= s + 1) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define forn for(int i=0;i<n;i++)
#define pb push_back
#define pob pop.back()
int main()
{
  int d;
  cin>>d;
  if(d==25) puts("Christmas");
 else if(d==24) puts("Christmas Eve");
 else  if(d==23) puts("Christmas Eve Eve");
  else if(d==22) puts("Christmas Eve Eve Eve");
  return 0;
  
    
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = 1; i <= n; i++)
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
using P = pair <int, int>;
 
ll MOD = 1000000007;
ll INF =1<<29;
 
int main(){
    string s;
    cin >> s;
    
    for(int bit=0;bit<(1<<3);++bit){
        int ans = s[0]-'0';
        vector<char>t(3);
        for(int i = 0 ; i <= 2;++i){
            if(bit&(1<<i)){
                ans += s[i+1]-'0';
                t[i] = '+';
            }
            else {ans -=s[i+1]-'0';
             t[i]= '-';}
              
        }
        if(ans==7){
            cout << s[0] <<t[0]<<s[1]<<t[1]<<s[2]<<t[2]<<s[3]<<'='<<'7' <<endl;
            return 0;
        }
    }
}


Measured memory_bytes: 256
#![allow(dead_code, unused_variables, unused_imports)]
use proconio::marker::Chars;
use proconio::{fastout, input};
use std::cmp::{max, min};
use std::collections::{HashMap, HashSet};

#[fastout]
fn main() {
    input!{
        n:usize,
        mut a:[usize;n],
    }
    let b = a.clone();
    a.sort();
    let n_max = a[n-1];
    let next = a[n-2];

    for e in b{
        if e != n_max{
            println!("{}",n_max);
        }else{
            println!("{}",next);
        }
    }
}   


Measured memory_bytes: 7228