akhauriyash/Code-Regression huggingface dataset:
# -*- coding: utf-8 -*-
def inpl(): return list(map(int, input().split()))
H, W = inpl()

A = [inpl() for _ in range(H)]

order = []
move = False
for i, h in enumerate(range(H)):
    direction = 1 - 2*(h%2==1)
    for j, w in enumerate(range(W)[::direction]):
        value = A[h][w] %2
        if move == value:
            if move:
                move = False
        else:
            if not move:
                move = True
            if j == W-1 and i == H-1:
                pass
            elif j == W-1:
                order.append([h+1, w+1, h+2, w+1])
            else:
                order.append([h+1, w+1, h+1, w+1+direction ])
            if not move:
                move = False

print(len(order))
for o in order:
    print(*o)

Measured memory_bytes: 30244
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<limits.h>
#include<math.h>


int main(void){
    int N;
    scanf("%d", &N);
    int *a = (int*)malloc(N * sizeof(int));
    int i, j, temp;
    int sum = 0;
    for(i=0; i<N; i++) {
        scanf("%d", &a[i]);
        sum += a[i];
    }
    
    for (i = 0; i < (N - 1); i++) {
        for (j = (N - 1); j > i; j--) {
            if (a[j-1] < a[j]) {
                temp = a[j-1];
                a[j-1] = a[j];
                a[j] = temp;
            }
        }
    }
    int bb = 0;
    for(i=0; i < N; i++) {
        if( i % 2 != 0) {
            bb += a[i];
        }
    }
    printf("%d\n", sum - 2 * bb);

    free(a);

    return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <string.h>
int a[11][331];
bool e[10];
void m(int d, int s){
    for(int i=0;i<10;i++){
        if(e[i])continue;
        a[d][s+d*i]++;
        if(d<10){
            e[i]=true;
            m(d+1,s+d*i);
            e[i]=false;
        }
    }
}
int main(void){
    memset(a,0,sizeof(a));
    memset(e,0,sizeof(e));
    m(1,0);
    int n,s;
    while(~scanf("%d%d",&n,&s)){
        if(n<0||n>10||s<0||s>330)puts("0");
        else printf("%d\n",a[n][s]);
    }
    return 0;
}

Measured memory_bytes: 1056
#include <iostream>
#include <vector>
#include <cstdlib>
#include <ctime>
using namespace std;

int main(){
	srand(time(NULL));
	int N,tmp,good = 0;
	cin >> N;
	for(int i = 0 ; i < N ; i++){
		int win = 0;
		for(int j = 0 ; j < N ; j++){
			char c;
			cin >> c;
			if( c == 'o') win++;
		}	
		if( win == N-1 ){
			good = i+1;
		}
	}
	if( good != 0 ){
		for(int i = 0 ; i < 1000 ; i++){
			cout << good << endl;
			cin >> tmp;
		}
	}else{
		for(int i = 0 ; i < 1000 ; i++){
			cout << rand()%N + 1 << endl;
			cin >> tmp;
		}
	}
}

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

int x1,y1,x2,y2,x3,y3,xk,yk,xs,ys,n;

int isin(double x1,double y1,double x2,double y2,double x3,double y3,double xp,double yp){

	double ax,ay,bx,by,cx,cy,a,b;

	ax=x2-x1; ay=y2-y1;
	bx=x3-x1; by=y3-y1;
	cx=xp-x1; cy=yp-y1;

	if(by!=0){
		a=(cx*by-cy*bx)/(ax*by-ay*bx);
		b=(cy-a*ay)/by;
	}
	else{
		a=cy/ay;
		b=(cx-a*ax)/bx;
	}

	if(a>=0 && b>=0 && a+b<=1)return 1; else return 0;
}

int main(){
	for(scanf("%d",&n);n>0;n--){
		scanf("%d %d %d %d %d %d %d %d %d %d",&x1,&y1,&x2,&y2,&x3,&y3,&xk,&yk,&xs,&ys);
		if(isin(x1,y1,x2,y2,x3,y3,xk,yk)!=isin(x1,y1,x2,y2,x3,y3,xs,ys))printf("OK\n"); else printf("NG\n");
	}
	return 0;
}

Measured memory_bytes: 584
#include <vector>
#include <iostream>
using namespace std;
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;

int main() {

	int n; cin >> n;
	vector<long long > cnt(n + 1, 0);

	for (int i = 1; i <= n; i++) {
		for (int j = i; j <= n; j += i) cnt[j]++;
	}
	long long  ans = 0;
	for (int i = 1; i <= n; i++) {
		ans += (i * cnt[i]);
	}

	cout << ans;

	return 0;
}

Measured memory_bytes: 81336
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * Built using CHelper plug-in Actual solution is at the top
 */

public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Task solver = new Task();
		solver.solve(1, in, out);
		out.close();
	}

	static class Task {
		public void solve(int testNumber, InputReader in, PrintWriter out) {
			int x = in.nextInt();
			out.println(x < 1200 ? "ABC" : "ARC");
		}
	}

	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		
		public char nextChar() {
			return next().charAt(0);
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

	}
}


Measured memory_bytes: 21076
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize("-Ofast")
#include <bits/stdc++.h>
using namespace std;

typedef int in;
#define int long long
#define f first
#define s second
#define pb push_back
#define pp push
#define RETURN exit(0)
#define pow(x,y) (int)(pow(x,y))
#define ceil(x) (int)(ceil(x))
#ifndef ONLINE_JUDGE
#define debug(x) cout<<x<<endl;
#else
#define debug(x) 42
#endif
const int MAX=1e4;
const int MOD=1e9+7;
const int MAAX=1e18;
const long double EPS=1e-6;
const int N=1e5+10;
int power(int x,int y)
{
    if (y == 0)
        return 1;
    int a=power(x,y/2);
    if (y % 2 == 0)
        return a * a % MOD;
    else
        return x * a * a % MOD;
}
bool check(int x){

}
int binary(int x,int y){
    int s=x,e=y,mid;
    while(s<e){
        mid=ceil((s+e)/2.0);
        if(check(mid))
            s=mid;
        else
            e=mid-1;
    }
    return s;
}
vector<int> primes;
bool visted[N+5];
void sieve(){
    visted[0]=visted[1]=1;
    for(int i=2;i*i<=N;i++){
        if(visted[i]==0){
            primes.pb(i);
            for(int j=i*i;j<=N;j+=i){
                visted[i]=1;
            }
        }
    }
    for(int i=sqrt(N)+1;i<=N;i++){
        if(visted[i]==0)
            primes.pb(i);
    }
    return;
}

int arr[200010];

in main()
{
    //freopen("in.in","r",stdin);
    //freopen("out.out","w",stdout);
    int tc=1;
    //scanf("%lld",&tc);
    //sieve();
    while(tc--)
    {
        int n,mx=-1,mxx=-1,cou=0;
        cin>>n;
        for(int i=0;i<n;i++){
            cin>>arr[i];
            if(mx==arr[i])
                cou++;
            if(mx<arr[i]){
                cou=1;
                mx=arr[i];
            }
        }
        for(int i=0;i<n;i++){
            if(mx!=arr[i]||cou-1){
                mxx=max(mxx,arr[i]);
            }
        }
        for(int i=0;i<n;i++){
            if(arr[i]!=mx||cou-1){
                cout<<mx<<endl;
            }
            else{
                cout<<mxx<<endl;
            }
        }
    }
    ///matensa4 tegarab el sample w te7ot el freopen w te3mel SCANF
    RETURN;
}


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

int main() {
  int ans=0,n=0;
  string N;
  cin >> N;

  for(int i=0;i<N.size();i++){
    n=N.at(i)-'0';
    ans+=n;
    ans%=9;
  }

  if(ans){
    cout << "No" << endl;
  }else{
    cout << "Yes" << endl;
  }

  return 0;
}

Measured memory_bytes: 3712
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>

#define int long long
 
#define rep(i, n) for (int i = 0; i < (n); i++)
#define itrep(i, a) for (auto i = (a).begin(); i != (a).end(); i++)
#define REP(i, a, n) for (int i = (a); i <= (n); i++)
#define all(a) (a).begin(), (a).end()
 
using namespace std;

int N, Z, W;
vector<int> a;

int memo[2][2010];

int dfs(int player, int pos) {
	if (memo[player][pos + 1] != -1) return memo[player][pos + 1];
	int ret;

	if (player == 0) {
		int teki = pos == -1 ? W : a[pos];
		ret = 0;
		REP(i, pos + 1, N - 2) {
			ret = max(ret, dfs(1, i));
		}
		ret = max(ret, abs(a[N - 1] - teki));
	} else {
		int teki = pos == -1 ? Z : a[pos];
		ret = INT_MAX;
		REP(i, pos + 1, N - 2) {
			ret = min(ret, dfs(0, i));
		}
		ret = min(ret, abs(a[N - 1] - teki));
	}

	memo[player][pos + 1] = ret;
	return ret;
}

signed main() {
	cin >> N >> Z >> W;

	rep(i, 2) rep(j, 2005) memo[i][j] = -1;

	a.resize(N);
	rep(i, N) cin >> a[i];

	cout << dfs(0, -1) << endl;

	return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s, t;
    cin >> s;
    cin >> t;
    if( s == t )
    {
        cout << "Yes";
        return 0;
    }
    int temp, j = 1;
    for(int i = 0; i < s.size(); i++)
    {
        if(t[0] == s[i])
        {
            temp = i;
            //找到s中的某个字符与t的第一个字符相等
            while(s[(temp+1)%s.size()] ==  t[j])
            {
                temp++;
                j++;
            }
            if(j == t.size())
            {
                cout << "Yes";
                return 0;
            }
        }
    }
    cout << "No";
    return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (n, k) = readLine()!!.trim().split(' ').map { it.toLong() }
    val dic = Array (100005) { 0L }
    for (i in 0 until n) {
        val (a, b) = readLine()!!.trim().split(' ').map { it.toLong() }
        dic[a.toInt()] += b
    }
    var m = 0L
    for (i in 1 until 100005) {
        if (m + dic[i] < k) {
            m += dic[i]
        } else {
            println(i)
            break
        }
    }
}


Measured memory_bytes: 58192
// ------------------------------------
// Date:2018/ 2/22
// Problem:ABC 043 ChildrenAndCandies a.cpp
//
// ------------------------------------

#include <bits/stdc++.h>

using namespace std;

#define EACH(i,a) for (auto&& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()

using ll = long long;

int main()
{
  int N;
  cin >> N;
  cout << N*(N+1)/2 << endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <climits>
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stack>
#include <algorithm>
#include <random>
#include <iomanip>
#include <unordered_map>
#include <map>
#include <queue>
#include <functional>
#include <numeric>
#include <chrono>
#include <cstdlib>
using ll = long long;
using namespace std;

const ll MOD = 1e9 + 7;
//const double EPS = 1e(-12);
const double pi = acos(-1);
typedef pair<int, int> P;
#define REP(i, n) for (int(i) = 0; (i) < (n); ++(i))
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define EPS 1e-4
#define OUTPUT(i) (cout << (ll)i << endl)
#define ALL(a) ((a).begin(), (a).end())

bool operator<(const pair<ll, ll> &a, const pair<ll, ll> &b)
{

    if (a.first == b.first)
        return a.second < b.second;

    return a.first < b.first;
}

ll s[100010];
ll t[100010];
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    //cout << fixed << setprecision(7);

    int A, B, Q;
    cin >> A >> B >> Q;

    for (int i = 0; i < A; ++i)
    {
        cin >> s[i];
    }
    s[A] = 100000000000;
    for (int i = 0; i < B; ++i)
    {
        cin >> t[i];
    }
    t[B] = 100000000000;

    for (int i = 0; i < Q; ++i)
    {
        ll x;
        cin >> x;

        ll t1 = lower_bound(s, s + A + 1, x) - s;

        ll t2 = lower_bound(t, t + B + 1, x) - t;

        if (t1 == A && t2 == B)
        {
            cout << x - min(s[t1 - 1], t[t2 - 1]) << endl;
        }
        else
        {
            if (t1 == 0 && t2 == 0)
            {
                cout << max(s[t1], t[t2]) - x << endl;
            }
            else if (t1 == 0)
            {

                cout << min({abs(x - s[t1]) + abs(s[t1] - t[t2]), abs(x - s[t1]) + abs(s[t1] - t[t2 - 1]),
                             abs(x - t[t2]) + abs(t[t2] - s[t1]), abs(x - t[t2 - 1]) + abs(t[t2 - 1] - s[t1])})
                     << endl;
            }
            else if (t2 == 0)
            {
                cout << min({abs(x - s[t1]) + abs(s[t1] - t[t2]), abs(x - s[t1 - 1]) + abs(s[t1 - 1] - t[t2]),
                             abs(x - t[t2]) + abs(t[t2] - s[t1]), abs(x - t[t2]) + abs(t[t2] - s[t1 - 1])})
                     << endl;
            }
            else
            {
                cout << min({abs(x - s[t1]) + abs(s[t1] - t[t2]), abs(x - s[t1]) + abs(s[t1] - t[t2 - 1]),
                             abs(x - t[t2]) + abs(t[t2] - s[t1]), abs(x - t[t2 - 1]) + abs(t[t2 - 1] - s[t1]),
                             abs(x - s[t1 - 1]) + abs(s[t1 - 1] - t[t2]), abs(x - s[t1 - 1]) + abs(s[t1 - 1] - t[t2 - 1]),
                             abs(x - t[t2]) + abs(t[t2] - s[t1 - 1]), abs(x - t[t2 - 1]) + abs(t[t2 - 1] - s[t1 - 1])})
                     << endl;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 2944
import java.util.*;
import java.io.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        char[] s = sc.next().toCharArray();
        int ans = 0;
        int i = 0;
        for(char c : s){
            if(i % 2 == 0 && c == 'p'){
                ans--;
            }else if(i % 2 == 1 && c == 'g'){
                ans++;
            }
            i++;
        }
        System.out.println(ans);
    }
    
    public static void printArr(int[][] arr, int h, int w){
        for(int i = 0; i < h; i++){
            for(int j = 0; j < w; j++){
                System.out.print(arr[i][j] + " ");
            }
            System.out.println();
        }
        return;
    }
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public double nextDouble() {
         return Double.parseDouble(next());
    }
    
    public String[] nextArray(int n) {
        String[] a = new String[n];
        for (int i = 0; i < n; i++)
            a[i] = next();
        return a;
    }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    } 
}


Measured memory_bytes: 28448
import math
from scipy.optimize import fmin
EPS = 10**-8


class P2():
    def __init__(self, x, y):
        self.x = x
        self.y = y
        self.norm2 = (self.x**2 + self.y**2)**0.5

    def __add__(self, other):
        return P2(self.x + other.x, self.y + other.y)

    def __sub__(self, other):
        return P2(self.x - other.x, self.y - other.y)

    def smul(self, a):
        return P2(self.x * a, self.y * a)

    def dot(self, other):
        return self.x * other.x + self.y * other.y

    def det(self, other):
        return self.x * other.y - self.y * other.x


n = int(input())
p = [P2(*map(int, input().split())) for _ in range(n)]

dist = [[(p[i] - p[j]).norm2 for j in range(n)] for i in range(n)]


def func(cp):
    cp = P2(*cp)
    return max((cp - pi).norm2 for pi in p)


res_cp = fmin(func, [500, 500], disp=False)
ans = func(res_cp)
print(ans)


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

int f(int nzd,int g)
{
    int g1=__gcd(nzd,g);
    return nzd/g1*g;
}

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n,nzd,ime=0;
    double nzd1,ime1;
    cin >> n;
    vector<int> v(n,0);
    cin >> v[0];
    nzd=v[0];
    for (int i=1;i<n;i++)
    {
        cin >> v[i];
        nzd=f(nzd,v[i]);
    }
    for (int i=0;i<n;i++)
        ime+=(nzd/v[i]);
    nzd1=(double)nzd;
    ime1=(double)ime;
    cout << fixed << showpoint << (nzd1/ime1);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long a, b, c;
    cin >> a >> b >> c;
    if(c-a-b < 0){
        cout << "No" << endl;
        return 0;
    }
    if(4 * a * b >= (c - a - b) * (c-a-b)){
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;
    return 0;
}

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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> p(N);
  for(int i = 0; i < N; i++) {
    cin >> p[i];
  }
  sort(p.begin(), p.end());
  int ans = 0;
  for (int i = 0; i < K; i++) {
    ans += p[i];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3596
#include "bits/stdc++.h"

#define REP(i,x,y) for(int i=(x);i<(y);i++)
#define RREP(i,x,y) for(int i=(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
// #define int long long

using namespace std;

// conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#else
#define eprintf(...) 42
#define dump(x) 42
#define debug(x) 42
#endif

typedef long long ll;

const ll MOD = 1e9 + 7;

void solve(int R, int G, int B, int N) {
    int answer = 0;
    for (int i=0; i<=N/R; i++) {
        for (int j=0; j<=N/G; j++) {
            if (i*R+j*G > N) break;
            if ((N - i*R - j*G) % B == 0) answer++;
        }
    }

    cout << answer << '\n';

    return;
}

signed main() {
    int R, G, B, N;
    cin >> R >> G >> B >> N;
    
    solve(R, G, B, N);
    
    return 0;
}



Measured memory_bytes: 256
/**********************************************************************
   File hoge.cpp
   Author  harunaya
   Date   2020-03-04(Wed)
   note
**********************************************************************/

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(x) (x).begin(), (x).end()
//#define PI(acos(-1))
using namespace std;
typedef long long ll;

int main() {
  // 入力を整数型と認識する
  // ÷100で上二桁, %100で下二桁を求めることができる
  // 上二桁が12以下かつ00でない, そして下二桁が00以上ならflag1=true
  // 上二桁が00以上, 下二桁が12以下で00でないならflag2=true
  // flag1=true, flag2=false -> MMYY
  // flag1=false, flag2=true -> YYMM
  // flag1=true, flag2=true -> AMBIGUOUS
  // flag1=false, flag2=false -> NA

  int number, res, rem;
  cin >> number;
  bool flag1 = false, flag2 = false;

  res = number / 100; //上二桁
  rem = number % 100; //下二桁

  if (res <= 12 && res != 0) {
    if (rem >= 0) {
      flag1 = true;
    }
  }
  if (rem <= 12 && rem != 0) {
    if (res >= 0) {
      flag2 = true;
    }
  }

  if (flag1 == true && flag2 == false) cout << "MMYY" << endl;
  if (flag2 == true && flag1 == false) cout << "YYMM" << endl;
  if (flag1 == true && flag2 == true) cout << "AMBIGUOUS" << endl;
  if (flag1 == false && flag2 == false)  cout << "NA" << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
 
 int main(){
  int n,i,j,k,N,K;
 
  scanf("%d",&n);
  int Adj[n+1][n+1];
  for(i=1; i<=n; i++)
    for(j=1; j<=n; j++)
      Adj[i][j]=0;
             
  for(i=1; i<=n; i++){
    scanf("%d",&N);
    scanf("%d",&k);
 
    for(j=1; j<=k; j++){
      scanf("%d",&K);
      Adj[N][K]=1;
    }
  }
  for(i=1; i<=n; i++){
    for(j=1; j<=n; j++){
      if(j==n)   printf("%d\n",Adj[i][j]);
      else printf("%d ",Adj[i][j]);
    }
  }
  return 0;
}

Measured memory_bytes: 636
#include<bits/stdc++.h>
const int N=2e5+5;
char c1[N],c2[N];
int n,i,m,x;
long long ans;
int main(){
	scanf("%s",c1+1);n=strlen(c1+1);
	for(i=1;i<=n;++i)if(c1[i]=='C' && c2[m]=='B')c2[m]='D';else c2[++m]=c1[i];
	for(i=1;i<=m;++i)if(c2[i]=='B' || c2[i]=='C')x=0;else
		if(c2[i]=='A')++x;else ans+=x;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 640
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n,k,q;cin>>n>>k>>q;
  vector<int>S(n,k-q);
  rep(i,q){
    int x;cin>>x;
    x--;
    S[x]++;
  }
  rep(i,n){
  //  cout<<i<<" "<<S[i]<<endl;
    if(S[i]>0){
      cout<<"Yes"<<endl;
    }else{cout<<"No"<<endl;}
  }
}

Measured memory_bytes: 1024
n = int(input())
a = [int(x) for x in input().split()]
q = int(input())
from collections import Counter
f = Counter(a)
t = sum(a)

for i in range(q):
    b, c = map(int, input().split())
    t += (c - b) * f[b]
    f[c] += f[b]
    f[b] = 0
    print(t)


Measured memory_bytes: 24148
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b)  for(int i=(a),i##formax=(b);i< i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formin=(b);i>=i##formin;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max((x),(y))
#define mins(x,y) x=min((x),(y))
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define all(a) ((a).begin()),((a).end())
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define bit(n) (1LL<<(n))
typedef long long ll;
typedef __int128_t lll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T>ostream& operator<<(ostream&o,V<T>&v){for(T&t:v)o<<t<<",";return o<<endl;}
template<class T>void uniq(V<T>&v){sort(all(v));v.erase(unique(all(v)), v.end());}

lll gcd(lll a,lll b,lll&x,lll&y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return(x%m+m)%m;}
ll modPow(lll a,lll n,ll m){lll p=1;for(;n;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return p;}
//V<ll>F,R;void setF(int n,int mod){F=R=V<ll>(++n);F[0]=1;FOR(i,1,n)F[i]=F[i-1]*i%mod;R[n-1]=modInv(F[n-1],mod);FORR(i,n-1,1)R[i-1]=R[i]*i%mod;}
//ll comb(int a,int b,int m){return a<b||b<0?0:F[a]*R[b]%m*R[a-b]%m;}

const int IINF = 1e9;
const ll LINF = 1e18;
const int MOD = 1e9+7; //99844353;
const int N = 1e5;
void YN(bool z){cout << (z ? "YES" : "NO") << endl; exit(0);}
int n;
ll c[N];
V<int> e[N];
ll dfs(int a, int p){
  if(sz(e[a])==1) return c[a];
  ll s = 0, ma = -1;
  for(int b:e[a]) if(p!=b){
    ll t = dfs(b, a);
    s += t;
    maxs(ma, t);
  }
  if(c[a]<max(ma, s-s/2) || s<c[a]){
    cout << "NO" << endl;
    exit(0);
  }
  return c[a]*2-s;
}
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  FOR(i, 0, n) cin >> c[i];
  FOR(i, 0, n-1){
    int a, b;
    cin >> a >> b;
    a--; b--;
    e[a].pb(b);
    e[b].pb(a);
  }
  if(n==2) YN(c[0]==c[1]);
  FOR(i, 0, n) if(sz(e[i])>1) YN(!dfs(i, -1));
}

Measured memory_bytes: 13184
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
# include <unordered_map>
# include <numeric>
# include <complex>
# include <bitset>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
typedef pair<LL, LL> P;
constexpr int INF = 2000000000;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
constexpr long long MMOD = 500000004;
const double PI = acos(-1);
int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
# define ALL(x)      (x).begin(),(x).end()
# define UNIQ(c)     (c).erase(unique(ALL((c))), end((c)))
# define mp          make_pair
# define eb          emplace_back
# define FOR(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 INIT        std::ios::sync_with_stdio(false);std::cin.tie(0)

constexpr int MAX_N = 20;
constexpr int MAX_M = 20;
constexpr int MOD = 100000;
constexpr char JOI[] = "JOI";

int n, m;
char field[MAX_M][MAX_N];
int dp[2][1 << MAX_N][2];//dp[current or next][直前N文字（前の一列）に"JO"があるか][直前の文字が"J"なのかどうか]

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

	std::cin >> m >> n;

	for (int i = 0; i < m; ++i) {
		for (int j = 0; j < n; ++j) {
			std::cin >> field[i][j];
		}
	}

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

	int crt = 0, nxt = 1;

	for (int i = 0; i < m; ++i) {
		for (int j = 0; j < n; ++j) {
			for (int k = 0; k < (1 << MAX_N); k++)for (int l = 0; l < 2; l++)dp[nxt][k][l] = 0;


			for (int bit = 0; bit < (1 << n); ++bit) {
				for (int f = 0; f < 2; ++f) {//直前の文字が'J'なのかどうか
					if (dp[crt][bit][f] > 0) {//そもそも、存在しない場合は処理しない
						for (int k = 0; k < 3; ++k) {//文字を三通り当てはめる、但し'?'の時は三通り全て当てはめる
							if (field[i][j] != '?' && field[i][j] != JOI[k]) {
								continue;
							}//文字が今回調べるべきでないとき
							if (bit >> j & 1 && JOI[k] == 'I') {
								continue;
							}//「良い旗」ができてしまったとき

							int nbit = bit & ~(1 << j);//現在の位置のJOのbitを消去する
							int nf = JOI[k] == 'J';//次のfを求める

							if (JOI[k] == 'O' && f == 1) {
								nbit |= 1 << (j - 1);
							}//JOができた時は次のビットにそれを適応する

							dp[nxt][nbit][nf] += dp[crt][bit][f];
							if (dp[nxt][nbit][nf] > MOD) {
								dp[nxt][nbit][nf] -= MOD;
							}
						}
					}
				}
			}

			std::swap(crt, nxt);
		}
		for (int bit = 0; bit < (1 << n); ++bit) {
			dp[crt][bit][0] += dp[crt][bit][1];
			if (dp[crt][bit][0] >= MOD) {
				dp[crt][bit][0] -= MOD;
			}

			dp[crt][bit][1] = 0;
		}//行が変わるとき、前のますが'J'であることはなくなるので、それを処理する。
	}
	int ans = 1;//余事象
	for (int i = 0; i < m; ++i) {
		for (int j = 0; j < n; ++j) {
			if (field[i][j] == '?') {
				ans = (ans * 3) % MOD;
			}
		}
	}

	for (int bit = 0; bit < 1 << n; ++bit) {
		ans = (ans + MOD - dp[crt][bit][0]) % MOD;
	}

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


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

int f(int h, int m){
	return h * 60 + m;
}

int main(){
	string s;
	cin >> s;
	int n = s.size();
	int d = 0, pd = 0;
	for(int i = 0; i < n; i++){
		if(s[i] == '?'){
			s[i] = 'D';
		}
	}

	cout << s << endl;
}

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

// 最小公倍数を求める
int euqlid (int a, int b){
  int temp;
  temp = a % b;
  if(temp == 0)return b;
  return euqlid(b,temp);
}
ll conbination(ll a,ll b){
  ll u = 1;
  ll d = 1;
  while(b != 0){
    u *= a;
    d *= b;
    a--;
    b--;
  }
  return u / d;
}
int fact(int n){
  if(n == 1)return 1;
  return n * fact(n-1);
  }

int n, m, q;
vector<int> a, b, c, d;
int ans = 0;

void dfs(vector<int> A){
  if(A.size() == n+1){
    int now = 0;
    rep(i,q){
      if(A[b[i]] - A[a[i]] == c[i])now += d[i];
    }
    ans = max(now,ans);
  }

  A.push_back(A.back());
  while(A.back() <= m){
    dfs(A);
    A.back()++;
  }
}


int main(){
  int n,k;
  cin >> n >> k;
  int sum = 0;
  int sunuke[n];
  rep(i,n){
    sunuke[i] = 0;
  }
  rep(i,k){
    int d;
    cin >> d;
    rep(i,d){
      int a;
      cin >> a;
      sunuke[a-1] = 1;
    }
  }
  rep(i,n){
    if(sunuke[i] == 0)sum++;
  }
  cout << sum << endl;
}



Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N;
    cin >>N;
    vector<int>vec(N-1);
    for(int i=0;i<N-1;i++){
        cin >> vec.at(i);
    }
    reverse(vec.begin(),vec.end());
    int count=0;
    for(int i=0;i<N-1;i++){
        if(i==0){
           count += vec.at(0);
           continue;
        }
            count +=min(vec.at(i-1),vec.at(i));
        }
    
            count += vec.at(N-2);
        cout << count <<endl;
}

Measured memory_bytes: 3600
#include <stdio.h>
#include <string.h>
#include <algorithm>

bool road[8][8];
int main()
{
	memset(road, 0, sizeof(bool) * 64);
	int n, m;
	scanf("%d%d", &n, &m);
	for (int i = 0; i < m; i++) {
		int a, b;
		scanf("%d%d", &a, &b);
		road[a - 1][b - 1] = true;
		road[b - 1][a - 1] = true;
	}

	int buf[8];
	for (int i = 0; i < n; i++) {
		buf[i] = i;
	}

	int cnt = 0;
	do {
		bool f = true;
		for (int i = 0; i < n-1; i++) {
			if (!road[buf[i]][buf[i + 1]]) {
				f = false;
				break;
			}
		}
		if (f) {
			cnt++;
		}
	} while (std::next_permutation(&buf[1], &buf[n]));
	printf("%d\n", cnt);
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#ifdef _DEBUG
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
#else
#define debug(x)
#endif
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr double PI = 3.141592653589793238462643383279;
ll getDigit(ll x) {
  return x == 0 ? 1 : log10(x) + 1;
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

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

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

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

signed main() {
  ll N, M;
  cin >> N >> M;

  map<ll, ll> m;
  rep(i, N) {
    ll a;
    cin >> a;
    m[a]++;
  }

  rep(i, M) {
    ll b, c;
    cin >> b >> c;
    m[c] += b;
  }

  ll sum = 0;
  ll count = 0;

  map<ll, ll>::reverse_iterator i = m.rbegin();
  for (; i != m.rend(); ++i) {
    ll a = i->first;
    ll b = i->second;
    if (count + b < N) {
      sum += a * b;
      count += b;
    } else {
      ll cosu = N - count;
      sum += a * cosu;
      COUT(sum);
      return 0;
    }
  }

  return 0;
}

Measured memory_bytes: 12800
#include <stdio.h>
#include <stack>
#include <math.h>

using namespace std;

struct Team{
	int id,score,order;
};

int main(){

	int N,limit,a,b,a_score,b_score,rank;

	scanf("%d",&N);
	Team team[N+1];
	int result[N+1];

	for(int i = 1; i <= N; i++){
		team[i].score = 0;
		team[i].id = i;
	}

	limit = N*(N-1)/2;

	for(int i = 0; i < limit; i++){
		scanf("%d %d %d %d",&a,&b,&a_score,&b_score);

		if(a_score > b_score){
			team[a].score += 3;
		}else if(a_score < b_score){
			team[b].score += 3;
		}else{ //a_score == b_score
			team[a].score += 1;
			team[b].score += 1;
		}
	}

	for(int i = 2; i <= N; i++){
		for(int k = N; k >= i; k--){
			if(team[k].score > team[k-1].score)swap(team[k],team[k-1]);
		}
	}

	rank = 1;
	team[1].order = rank;
	for(int i = 2; i <= N; i++){
		if(team[i].score == team[i-1].score)team[i].order = rank;
		else{
			team[i].order = i;
			rank = i;
		}
	}

	for(int i = 1; i <= N; i++){
		result[team[i].id] = team[i].order;
	}

	for(int i = 1; i <= N; i++)printf("%d\n",result[i]);


    return 0;
}

Measured memory_bytes: 2728
use std::cmp;
use std::fmt::Debug;
use std::str::FromStr;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where
    T: FromStr,
    <T as FromStr>::Err: Debug,
{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim()
        .split_whitespace()
        .map(|c| T::from_str(c).unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_as_string() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn go_next(cur: usize, m: usize) -> usize {
    return (cur * cur) % m;
}

// returns (start, length before loop, loop length)
fn detect_loop(s: usize, m: usize) -> (usize, usize, usize) {
    let mut cur_cost = 0;
    let dummy = std::usize::MAX;
    let mut last_visited: Vec<usize> = vec![dummy; m];
    last_visited[s] = cur_cost;
    let mut cur = s;

    while last_visited[go_next(cur, m)] == dummy {
        cur_cost += 1;
        cur = go_next(cur, m);
        last_visited[cur] = cur_cost;
    }

    let loop_len = cur_cost + 1 - last_visited[go_next(cur, m)];
    return (go_next(cur, m), cur_cost + 1 - loop_len, loop_len);
}

fn calc_score(s: usize, len: usize, m: usize) -> usize {
    let mut score = 0;
    let mut cur = s;
    for _ in 0..len {
        score += cur;
        cur = go_next(cur, m);
    }

    return score;
}

fn main() {
    let line: Vec<usize> = read_as_vec::<usize>();
    let (n, x, m) = (line[0], line[1], line[2]);

    let (loop_entry, till_loop, loop_len) = detect_loop(x, m);
    dbg!(loop_entry, till_loop, loop_len);
    if n <= till_loop {
        println!("{}", calc_score(x, n, m));
        return;
    }

    // score before loop;
    let mut score = calc_score(x, till_loop, m);

    // calculate score loop * #loop;
    let rest = n - till_loop;
    score += rest / loop_len * calc_score(loop_entry, loop_len, m);

    let rest = rest % loop_len;

    score += calc_score(loop_entry, rest, m);

    println!("{}", score);
}


Measured memory_bytes: 2772
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Contest
{
	class Program
	{
		static void Main()
		{
            var S = Console.ReadLine();
            for (S = S.Substring(0, S.Length - 2); !string.IsNullOrEmpty(S); S = S.Substring(0, S.Length - 2))
            {
                if (S.Substring(0, S.Length / 2) == S.Substring(S.Length / 2, S.Length / 2))
                {
                    Console.WriteLine(S.Length);
                    break;
                }
            }
#if DEBUG
            Console.ReadKey();
#endif
		}
	}
}

Measured memory_bytes: 11092
#include<bits/stdc++.h>
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define ri(x) scanf("%d",&(x))
#define ri2(x,y) scanf("%d %d",&(x),&(y))
#define ri3(x,y,z) scanf("%d %d %d",&(x),&(y),&(z))
#define rll(x) scanf("%lld",&(x))
#define rll2(x,y) scanf("%lld %lld",&(x),&(y))
#define rll3(x,y,z) scanf("%lld %lld %lld",&(x),&(y),&(z))
#define gc(x) ((x) = getchar())
using namespace::std;

const long double PI = acos(-1);
const long long MOD = 1000000000 +7;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<ll,pll> tll;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<tll> vtll;
typedef vector<string> vs;
typedef set<int> si;
typedef set<ii> sii;
typedef set<iii> siii;

ll gcd(ll a, ll b){ return b==0?a:gcd(b,a%b);}

ll add(ll a, ll b, ll m = MOD){
	if(a >= m) a %= m;
	if(b >= m) b %= m;
	if(a < 0) a += m;
	if(b < 0) b += m;
	ll res = a+b;
	if(res >= m or res <= -m) res %= m;
	if(res < 0) res += m;
	return res;
}

ll mul(ll a, ll b, ll m = MOD){
	if(a >= m) a %= m;
	if(b >= m) b %= m;
	if(a < 0) a += m;
	if(b < 0) b += m;
	ll res = a*b;
	if(res >= m or res <= -m) res %= m;
	if(res < 0) res += m;
	return res;
}

ll pow_mod(ll a, ll b, ll m = MOD){
	ll res = 1LL;
	a = a%m;
	while(b){
		if(b&1) res = mul(res,a,m);
		b >>= 1;
		a = mul(a,a,m);
	}
	return res;
}

ll fastexp(ll a, ll b){
	ll res = 1LL;
	while(b){
		if(b&1) res = res*a;
		b >>= 1;
		a *= a;
	}
	return res;
}

int gcdExtendido(int a, int b, int *x, int *y){
	if(a == 0){
		*x = 0;
		*y = 1;
		return b;
	}
	int x1, y1;
	int gcd = gcdExtendido(b%a,a,&x1,&y1);
	
	*x = y1-(b/a)*x1;
	*y = x1;
	return gcd;
}

int modInverso(int a, int m){
	int x, y;
	int g = gcdExtendido(a,m,&x,&y);
	if(g!=1) return -1;
	else return (x%m + m)%m;
}

/****************************************
*************P*L*A*N*T*I*L*L*A************
*****************************************/

const int N = 1000+5;

int n;
int w[N];
int s[N];
int v[N];

int main(){
	ri(n);
	int maximum = 0;
	for(int i=1; i<=n; i++){
		ri3(w[i], s[i], v[i]);
		maximum = max(maximum, s[i] + w[i]);
	}
	vi p(n);
	iota(all(p),1);
	vector<long long> memo(maximum + 1, 0LL);
	sort(all(p), [&](int i, int j){
		return w[i] + s[i] < w[j] + s[j];
	});
	for(int i : p){
		for(int j = min(maximum - w[i], s[i]); j >= 0; j--){
			memo[j + w[i]] = max(memo[j + w[i]], memo[j] + v[i]);
		}
	}
	printf("%lld\n",*max_element(all(memo)));
	return 0;
}

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

using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<ll, ll> pii;

#define REP(a,b,c) for(ll (a)=(b);(a)<(c);(a)++)
#define PER(a,b,c) for(ll (a)=(b);(a)>=(c);(a)--)

int main(){
    int a, b;
    cin >> a;
    cin >> b;
    cout << 6-a-b << endl;

    return 0;
}


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

const int N = 10000;
int ans[N+5];

int main(){
    for (int x = 1; x <= 100; ++x){
        for (int y = 1; y <= 100; ++y){
            for (int z = 1; z <= 100; ++z){
                int t = x*x + y*y + z*z + x*y + y*z + z*x;
                if (t <= N) ++ans[t];
            }
        }
    }
    int n; scanf("%d", &n);
    for (int i = 1; i <= n; ++i){
        printf("%d\n", ans[i]);
    }
    return 0;
}


Measured memory_bytes: 3760
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define INIT(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define INIT2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define LINY "YES\n"
#define Liny "Yes\n"
#define LINN "NO\n"
#define Linn "No\n"
#define umap unordered_map
//cout << setfill('0') << right << setw(4) << 12; // "0012"

ll min(ll x,ll y){return (x<y ? x:y);}
ll max(ll x,ll y){return (x>y ? x:y);}
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a*b /gcd(a,b);}


int main(){
  ld a,b,c; cin>>a>>b>>c;
  ld x = c-a-b;
  if(x<=0){cout << Linn; return 0;}
  x /= 2;
  x *= x;
  ld y = a*b;
  cout << (x>y? Liny:Linn);
}


Measured memory_bytes: 256
res_list = [[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],
            [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],
            [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],
            [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]]

n = int(input())

for i in range(n):
    io_rec = list(map(int, input().split(" ")))
    bld_num = io_rec[0] - 1
    floor_num = io_rec[1] - 1
    room_num = io_rec[2] - 1
    io_headcnt = io_rec[3]
    res_list[bld_num][floor_num][room_num] += io_headcnt


for i in range(4):
    if i:
        print("#" * 20)
    bld = res_list[i]
    for j in bld:
        floor_str = map(str, j)
        print(" " + " ".join(floor_str))

Measured memory_bytes: 7736
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

fn main() {
    let v: Vec<usize> = read_vec();
    let (h, w) = (v[0], v[1]);

    let mut grid: Vec<Vec<bool>> = vec![vec![false; h]; w];
    for hi in 0..h {
        let column: Vec<i32> = read_vec();
        for wi in 0..column.len() {
            grid[wi][hi] = column[wi] % 2 == 1;
        }
    }

    let mut manip: Vec<(usize, usize, usize, usize)> = Vec::new();

    let mut prev = (600, 600);

    for hi in 0..h {
        if hi % 2 == 0 {
            for wi in 0..w {
                if prev == (600, 600) {
                    prev = (0, 0);
                    continue;
                }
                let (p_wi, p_hi) = prev;

                if grid[p_wi][p_hi] {
                    manip.push((p_wi + 1, p_hi + 1, wi + 1, hi + 1));
                    grid[p_wi][p_hi] = !grid[p_wi][p_hi];
                    grid[wi][hi] = !grid[wi][hi];
                }
                prev = (wi, hi);
            }
        } else {
            for wi in (0..w).rev() {
                let (p_wi, p_hi) = prev;
                if grid[p_wi][p_hi] {
                    manip.push((p_wi + 1, p_hi + 1, wi + 1, hi + 1));
                    grid[p_wi][p_hi] = !grid[p_wi][p_hi];
                    grid[wi][hi] = !grid[wi][hi];
                }
                prev = (wi, hi);
            }
        }
    }

    println!("{0}", manip.len());
    for m in manip {
        println!("{0} {1} {2} {3}", m.1, m.0, m.3, m.2);
    }
}


Measured memory_bytes: 11256
#include <bits/stdc++.h>
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while (ch<'0'||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do { (t*=10)+=ch-'0'; ch=getchar(); } while ('0'<=ch&&ch<='9'); t*=f;
}
typedef long long ll;
int n,W,V,ans;
int w[110],v[110];
ll dp[110][100010];
void update(ll &x,ll y) {
	if (x>y) x=y;
}
int main() {
	//freopen("1.txt","r",stdin);
	read(n); read(W);
	for (int i=1;i<=n;i++) read(w[i]),read(v[i]),V+=v[i];
	for (int i=0;i<=n;i++)
	for (int j=0;j<=V;j++) dp[i][j]=W+1;
	dp[0][0]=0;
	for (int i=1;i<=n;i++)
	for (int j=0;j<=V;j++) {
		dp[i][j]=dp[i-1][j];
		if (j>=v[i]) update(dp[i][j],dp[i-1][j-v[i]]+w[i]);
		update(dp[i][j],W+1);
	}
	for (int j=0;j<=V;j++)
		if (dp[n][j]<=W) ans=max(ans,j);
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 80128
#include<cstdio>
#include<vector>

using namespace std;

bool step(int K, int id, vector<long long> &vec){
	int cnt = 0;
	for(int i = 0; i < vec.size(); ++i){
		bool flg = (vec[i] >> id) & 1;
		if(flg) cnt++;
	}
	if(cnt >= K){
		for(int i = 0; i < vec.size(); ++i){
			if(!((vec[i] >> id) & 1)){
				vec[i] = 0;
			}
		}
		return true;
	}else{
		return false;
	}
}

int N;
int A[1010];
int K;

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

long long solve(){
	vector<long long> vec;
	for(int i = 0; i < N; ++i){
		long long x = 0;
		for(int j = i; j < N; ++j){
			x += A[j];
			vec.push_back(x);
		}
	}
	long long ans = 0;
	for(int i = 42; i >= 0; --i){
		bool flg = step(K, i, vec);
		if(flg) ans |= (1ll << i);
	}
	return ans;
}

int main(){
	input();
	long long ans = solve();
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 6384
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();
		int c = sc.nextInt();
		if(a+b >= c) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		sc.close();
	}
}


Measured memory_bytes: 22868
from collections import Counter
N = int(input())
D = list(map(int, input().split()))
M = int(input())
T = list(map(int, input().split()))

cd = Counter(D)
ct = Counter(T)
ans = 'YES'
for i in ct.keys():
    if cd[i] < ct[i]:
        ans = 'NO'
        break
print(ans)


Measured memory_bytes: 57048
#include<bits/stdc++.h>
#include<cctype>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define all(v) (v).begin(),(v).end()
typedef long long int ll;
#define pi 3.1415926535897932384
#define E9 1000000000
#define eps 1e-4
#define pii pair<int,int> 


int main(){
  int n; cin >> n;
  list<int> L;

  string s; int x;
  rep(i,n){
    // scanf("%s%x",s,&x);
    cin >> s;
    if (s=="insert"){
      // scanf("%d",&x);
      cin >> x;
      L.push_front(x);
    }
    else if (s=="delete"){
      cin >> x;
      // scanf("%d",&x);
      for (auto iter=L.begin(); iter!=L.end();++iter){
        if (*iter==x){
          L.erase(iter);
          break;
        }
      }
    }
    else if (s=="deleteFirst"){
      L.pop_front();
    }
    else if (s=="deleteLast"){
      L.pop_back();
    }

  }

  for (auto iter=L.begin(); iter!=L.end();++iter){
    if (iter!=L.begin()) cout << " "; 
    cout << *iter;
  }
  cout << endl;
  
  return 0;
}



Measured memory_bytes: 34392
// Learn more about F# at http://fsharp.org
// See the 'F# Tutorial' project for more help.
open System

[<EntryPoint>]
let main argv =

    let inputs = stdin.ReadLine().Split(' ') |> Array.map int

    let age = inputs.[0]
    let fee = inputs.[1]

    if age >= 13 then
        printfn "%d" fee
    elif age >= 6 && age <= 12 then
        printfn "%d" (fee/2)
    else
        printfn "0"

    0 // return an integer exit code


Measured memory_bytes: 13532