akhauriyash/Code-Regression huggingface dataset:
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize,
        s: chars,
        k: usize1
    }
    let c = s[k];
    for a in s {
        if a == c {
            print!("{}", c);
        } else {
            print!("*");
        }
    }
    println!("");
}


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

typedef long long ll;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll LINF = 1e18;
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define MP make_pair
#define F first
#define S second
#define PB push_back
#define dump(x)  cout << #x << " = " << (x) << endl;	// debug
#define SZ(x) ((ll)(x).size())
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (ll i = (a); i >= (b); i--)
#define ps(s) cout << #s << endl;
#define pv(v) cout << (v) << endl;
#define pvd(v) cout << setprecision(16) << (v) << endl;
#define ALL(a)  (a).begin(),(a).end()
#define RANGE(a, left, right)  (a).begin()+(left),(a).begin()+(right)	// left to (right-1)


int main() {
	int m1, d1, m2, d2;
	cin >> m1 >> d1 >> m2 >> d2;
	if (m1 == m2) {
		ps(0)
	}
	else {
		ps(1)
	}
	return 0;
}

Measured memory_bytes: 3608
#include<stdio.h>


void to_time(int min,int* time){
	time[2]=min%60;
	time[1]=(min%3600-min%60)/60;
	time[0]=min/3600;
}
int main(){
	int h,m,s;
	int now,all=2*3600;
	while(1){
		int ans[3],ans3[3];
		scanf("%d %d %d",&h,&m,&s);
		if(h==-1)break;
		now=h*3600+m*60+s;
		to_time(all-now,ans);
		to_time(3*(all-now),ans3);
		printf("%02d:%02d:%02d\n",ans[0],ans[1],ans[2]);
		printf("%02d:%02d:%02d\n",ans3[0],ans3[1],ans3[2]);
	}
	return 0;
}

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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

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

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; }

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

int dist_A[100100] = {0};
int dist_T[100100] = {0};

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

  int N, u, v;

  cin >> N >> u >> v;
  u--;
  v--;
  vector<vector<int>> G(N);

  int A, B;
  for(int i = 0; i < N-1; i++){
    cin >> A >> B;
    A--;
    B--;
    G[A].push_back(B);
    G[B].push_back(A);
  }

  for(int i = 0; i < N; i++){
    dist_A[i] = -1;
    dist_T[i] = -1;
  }

  //高橋
  dist_T[u] = 0;
  queue<int> que;
  que.push(u);
  while(!que.empty()){
    int tv = que.front();
    que.pop();

    for(int nv : G[tv]){
      if(dist_T[nv] != -1) continue;

      dist_T[nv] = dist_T[tv] + 1;
      que.push(nv);
    }
  }

  dist_A[v] = 0;
  queue<int> queA;
  queA.push(v);
  while(!queA.empty()){
    int tu = queA.front();
    queA.pop();

    for(int nv : G[tu]){
      if(dist_A[nv] != -1) continue;

      dist_A[nv] = dist_A[tu] + 1;
      queA.push(nv);
    }
  }

  queue<int> qn;
  qn.push(u);

  int ans = 0;
  vector<bool> visit(N);
  for(int i = 0; i < N; i++){
    visit[i] = false;
  }
  if(dist_T[u] < dist_A[u]){
    chmax(ans, dist_A[u]);
  }

  while(!qn.empty()){
    int now = qn.front();
    visit[now] = true;
    qn.pop();

    for(int nv : G[now]){
      if(visit[nv]) continue;

      if(dist_T[nv] < dist_A[nv]){
        chmax(ans, dist_A[nv]);
        qn.push(nv);
      }
    }
  }

  if(G[u].size()== 1 && G[u][0] == v){
    cout << 0 << endl;
  }else if(ans == 0){//行ける場所が無い
    cout << 1 << endl;
  }else{
    cout << ans - 1 << endl;  
  }

  return 0;
}


Measured memory_bytes: 6656
#include <iostream>
#include <math.h>
#include <string>
#include <stdio.h>
#include <algorithm>

using namespace std;

int main()
{
	int a, b,kotae=0;
	int keta1, keta2;
	cin >> a >> b;
	if (a < b)
	{
		keta1 = 1;
		for (int i = 0; i < b; i++)
		{
			kotae += a * keta1;
			keta1 *= 10;
		}
	}
	else
	{
		keta1 = 1;
		for (int i = 0; i < a; i++)
		{
			kotae += b * keta1;
			keta1 *= 10;
		}
	}
	cout << kotae << endl;
	return 0;
}


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

int main(){
	int N, h, sum=0, ans=0;
	vector<int>H;
	cin >> N;
	for (int i=0; i<N; i++){
		cin >> h;
		H.push_back(h);
	}
	for (int i=1; i<N; i++){
		for (int j=0; j<i; j++){
			if(H[j] > H[i]){
				sum += 1;
		}
			}
		if (sum == 0){
			ans += 1;	
		}
		sum = 0;
	}
	ans += 1;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	//input
	int X;
	cin >> X;

	//calculation
	int output = 0;
	int num, rem;

	num = X / 500;
	rem = X % 500;
	output += num * 1000;

	num = rem / 5;
	output += num * 5;

	//output
	cout << output << endl;


	return 0;
}


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

typedef long long ll;

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

#define vl vector<ll>
#define pll pair<ll,ll>

#define DEBUG(x) cout<<#x<<": "<<x<<endl

using namespace std;
/*}}}*/

int main() {
  ll a,b,c,k;
  cin >> a >> b >> c >> k;
  bool frag = false;
  REP(i,k){
    if(a>=b) b*=2;
    else if(b>=c) c*=2;
  }
  if(a< b && b < c) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3616
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <string>

using namespace std;

const int mod = 1e9 + 7;

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

	vector<int> a(n, 0);
	long long sum = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		sum += a[i];
	}
	sum %= mod;

	long long ans = 0;
	for (int i = 0; i < n; i++) {
		sum -= a[i];
		if (sum < 0) {
			sum += mod;
		}
		ans += (a[i] * sum) % mod;
		ans %= mod;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3664
using System;
using System.Collections.Generic;
using System.Linq;

class E
{
	static void Main()
	{
		var n = int.Parse(Console.ReadLine());
		var a = new List<int>[n + 1];
		for (int i = 1; i <= n; i++) a[i] = Console.ReadLine().Split().Select(int.Parse).ToList();

		var q = new List<int[]>();
		var found = new bool[n + 1];
		Action<int> find = i =>
		{
			if (found[i] || !a[i].Any()) return;
			var j = a[i][0];
			if (a[j][0] != i) return;
			found[j] = true;
			q.Add(new[] { i, j });
		};

		for (int i = 1; i <= n; i++) find(i);
		var c = 0;
		for (; q.Any(); c++)
		{
			var ps = q.ToArray();
			q.Clear();
			Array.Clear(found, 1, n);
			foreach (var p in ps) foreach (var i in p) a[i].RemoveAt(0);
			foreach (var p in ps) foreach (var i in p) find(i);
		}
		Console.WriteLine(a.Any(l => l?.Count > 0) ? -1 : c);
	}
}


Measured memory_bytes: 39324
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
// #include <set>
// #include <cmath>
// #include <map>
// #include <iomanip>

// #define MOD 1000000007

using namespace std;
// typedef unsigned long long ull;
// typedef long long ll;

// void p() {
//     cout << "\n";
// }
// template<class Head, class... Body>
// void p(Head head, Body... body) {
//     cout << head << ",";
//     p(body...);
// }

// template<typename T>
// ostream& operator<<(ostream& os, const vector<T>& v) {
//     os << "[";
//     for (const auto i : v) {
//         os << i << " ";
//     }
//     os << "]";
//     return os;
// }
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "[";
    for (int i=0; i < v.size(); i++) {
        os << (char)(i+'a') << ":" << v[i] << ", ";
    }
    os << "]";
    return os;
}

int main(int argc, char const *argv[]) {
    int n;
    cin >> n;
    vector<string> S(n);
    for (int i = 0; i < n; ++i) {
        cin >> S[i];
    }

    vector<int> counts(26, 0);
    for (int j = 0; j < S[0].length(); ++j) {
        counts[S[0][j] - 'a'] += 1;
    }
    // cout << counts << endl;
    for (int i = 1; i < n; ++i) {
        vector<int> c(26, 0);
        for (int j = 0; j < S[i].length(); ++j) {
            c[S[i][j] - 'a'] += 1;
        }
        for (int j = 0; j < 26; ++j) {
            counts[j] = min(counts[j], c[j]);
        }
        // cout << i << " " << counts << endl;
    }

    string ans;
    for (int i = 0; i < 26; ++i) {
        for (int j = 0; j < counts[i]; j++) {
            ans += (char)(i+'a');
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
/*
Twenty years from now you will be more disappointed by the things that you didn't do than by the ones you did do. 
So throw off the bowlines. Sail away from the safe harbor. Catch the trade winds in your sails. Explore. Dream. Discover."
- Unknown
*/
 
#include <bits/stdc++.h>
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <algorithm>
#include <math.h>
#include <map>
#include <cstdlib>
 
#define INF 1e9
 
using namespace std;
 
 
int main(){
 
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    double x, y;
    cin >> x >> y;

    double a = (4*x - y)/2;
    double b = (y - 2*x)/2;

    //cout << a << " " << b << "\n";
    if(a >= 0 && b >= 0 && !(a-floor(a)) && !(b-floor(b)))cout << "Yes\n";
    else cout << "No\n";

    return 0;
}

Measured memory_bytes: 3812
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n,m,k = map(int, input().split())
class UnionFindTree:
    def __init__(self, n):
        self.n = n
        self.parent = list(range(n))
        self.size = [1] * n

    def root(self, i):
        inter = set()
        while self.parent[i]!=i:
            inter.add(i)
            i = self.parent[i]
        r = i
        for i in inter:
            self.parent[i] = r
        return r

    def connect(self, i, j):
        if i==j:
            return
        ri = self.root(i)
        rj = self.root(j)
        if ri==rj:
            return
        if self.size[ri]<self.size[rj]:
            self.parent[ri] = rj
            self.size[rj] += self.size[ri]
        else:
            self.parent[rj] = ri
            self.size[ri] += self.size[rj]
    
uf = UnionFindTree(n)
ns = [[] for _ in range(n)]
for i in range(m):
    a,b = map(lambda x: int(x)-1, input().split())
    uf.connect(a,b)
    ns[a].append(b)
    ns[b].append(a)

for i in range(k):
    c,d = map(lambda x: int(x)-1, input().split())
    ns[c].append(d)
    ns[d].append(c)
    
ans = [None]*n
for i in range(n):
    r = uf.root(i)
    s = uf.size[r]
    v = 0
    for j in ns[i]:
        if r==uf.root(j):
            v += 1
    ans[i] = s - v - 1
write(" ".join(map(str, ans)))

Measured memory_bytes: 115400
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<stdarg.h>
#include<malloc.h>

int judge(double x[8]);
void shuffle(double x[8]);

int main()
{
	int i;
	double x[8];

	while(scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf",&x[0],&x[1],&x[2],&x[3],&x[4],&x[5],&x[6],&x[7]) != EOF){

		for(i=0; i<4; i++){
			if(judge(x) == 1){
				printf("NO\n");
				break;
			}
			shuffle(x);
		}
		if(judge(x) == -1)
			printf("YES\n");

	}
	return 0;
}

int judge(double x[8])
{
	double x1, y1, x2, y2, x3, y3, xp, yp, buf;

	x1=x[0]; y1=x[1]; x2=x[2]; y2=x[3]; x3=x[4]; y3=x[5]; xp=x[6]; yp=x[7];

	if(x1>x2){
		buf = x1;	x1 = x2;	x2 = buf;
		buf = y1;	y1 = y2;	y2 = buf;
	}
	if(x2>x3){
		buf = x2;	x2 = x3;	x3 = buf;
		buf = y2;	y2 = y3;	y3 = buf;
	}
	if(x1>x2){
		buf = x1;	x1 = x2;	x2 = buf;
		buf = y1;	y1 = y2;	y2 = buf;
	}

	if(x1==x2){
		if(y1>y2){
			buf = x1;	x1 = x2;	x2 = buf;
			buf = y1;	y1 = y2;	y2 = buf;
		}
	}
	if(x2==x3){
		if(y2<y3){
			buf = x2;	x2 = x3;	x3 = buf;
			buf = y2;	y2 = y3;	y3 = buf;
		}
	}

	if(x1==x2){
		if(x1<xp){
			if(yp > (((xp-x1)*(y3-y1))/(x3-x1)+y1)){
				if(yp < (((xp-x2)*(y3-y2))/(x3-x2)+y2)){
					return 1;
				}
			}
		}
	} else if(x2==x3){
		if(x2>xp){
			if(yp > (((xp-x1)*(y3-y1))/(x3-x1)+y1)){
				if(yp < (((xp-x1)*(y2-y1))/(x2-x1)+y1)){
					return 1;
				}
			}
		}
	}

	if(y2 > ((x2-x1)*(y3-y1))/(x3-x1)+y1){
		if(yp < (((xp-x1)*(y2-y1))/(x2-x1)+y1)){
			if(yp < (((xp-x2)*(y3-y2))/(x3-x2)+y2)){
				if(yp > (((xp-x1)*(y3-y1))/(x3-x1)+y1)){
					return 1;
				}
			}
		}
	} else {
		if(yp < (((xp-x1)*(y3-y1))/(x3-x1)+y1)){
			if(yp > (((xp-x1)*(y2-y1))/(x2-x1)+y1)){
				if(yp > (((xp-x2)*(y3-y2))/(x3-x2)+y2)){
					return 1;
				}
			}
		}
	}
	return -1;
}

void shuffle(double x[8])
{
	double bufx, bufy;
	bufx=x[6]; bufy=x[7];
	x[6]=x[4]; x[7]=x[5];
	x[4]=x[2]; x[5]=x[3];
	x[2]=x[0]; x[3]=x[1];
	x[0]=bufx; x[1]=bufy;

	return;
}

Measured memory_bytes: 608
var main = function main(input) {
    var args = input.split('\n')
    var N = +args[0]
    var A = args[1].split(' ')
    var count = 0
    
    while (1) {
        var allEven = A.some(function(x) {
            return +x % 2 !== 0
        })
        if (!allEven) {
            count++
            A = A.map(function (x) {
                return +x / 2
            })
        } else break;
    }
    
    console.log(count)
}
 
main(require('fs').readFileSync('/dev/stdin', 'utf-8'))


Measured memory_bytes: 7372
S = input()
Ssl = S[2:-1]
Srp = S.replace("A", "")
Srp = Srp.replace("C", "")
cnt = Ssl.count("C")
if S[0] == "A" and cnt == 1 and Srp.islower():
    print("AC")
else:
    print("WA")

Measured memory_bytes: 9068
def main():
    n = int(input())
    num_list = []
    for _ in range(2):
        num_list.append(list(map(int,input().split())))

    ans = 0

    for i in range(n):
        point = 0
        tmp = num_list[0][0]
        for j in range(n):
            if i == j:
                point = 1
                tmp += num_list[point][j]
            else:
                tmp += num_list[point][j+1-point]
        ans = max(ans, tmp)

    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 38512
#include<stdio.h>
int main(void)
{
	int a,b,c;
	int x;
	scanf("%d %d %d",&a,&b,&c);
	x=b/a;
	if(x<=c){
		printf("%d\n",x);
	}
	else{
		printf("%d\n",c);
	}
	return 0;
}


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

int main(){
	int count = 0;
	double x[100],y[100];
	double a, b, c, d, e, f;
	while(cin >> a >> b >> e >> c >> d >> f){
		x[count] = (e*d-b*f)/(a*d-b*c);
		y[count] = (a*f-e*c)/(a*d-b*c);
		if(x[count] == -0){
			x[count] = 0;
		}
		if(y[count] == -0){
			y[count] = 0;
		}
		count++;
	}
	for(int i = 0; i < count; i++){
		cout << fixed << setprecision(3) << x[i] << " " << y[i] << endl;
	}
}

Measured memory_bytes: 1288
#include<stdio.h>
char M[515][515];
int X[515][515];
int main() {
	int n, m, i, j, k; scanf("%d%d", &n, &m);
	for (i = 0; i < n; i++)for (j = 0; j < m; j++)scanf(" %c", &M[i][j]);
	for (i = 0; i < n; i++) { for (j = 0; j < m; j++)printf("%c", (j == 0 || (j!=m-1&&i % 2 == 0) || M[i][j] == '#') ? '#' : '.'); puts(""); }
	puts("");
	for (i = 0; i < n; i++) { for (j = 0; j < m; j++)printf("%c", (j == m - 1 || (j!=0&&i % 2 == 1) || M[i][j] == '#') ? '#' : '.'); puts(""); }
	return 0;
}

Measured memory_bytes: 896
#include <stdio.h>
#include <assert.h>
int n,i,j,x,a[10][10],list[200][3],size;
void push(int x,int y,int s){list[size][0]=i;list[size][1]=j;list[size][2]=s;size++;}

int check(int x,int y,int s){
	int d;
	if(s<3 && (x<1 || x>9 || y<1 || y>9)) return 0;
	if(s==3 && (x<2 || x>8 || y<2 || y>8)) return 0;
	d=a[x][y];
	if(a[x-1][y]<d)d=a[x-1][y];
	if(a[x+1][y]<d)d=a[x+1][y];
	if(a[x][y-1]<d)d=a[x][y-1];
	if(a[x][y+1]<d)d=a[x][y+1];
	if(s==1 || d==0)return d;
	if(a[x-1][y-1]<d)d=a[x-1][y-1];
	if(a[x+1][y+1]<d)d=a[x+1][y+1];
	if(a[x+1][y-1]<d)d=a[x+1][y-1];
	if(a[x-1][y+1]<d)d=a[x-1][y+1];
	if(s==2 || d==0)return d;
	if(a[x-2][y]<d)d=a[x-2][y];
	if(a[x+2][y]<d)d=a[x+2][y];
	if(a[x][y-2]<d)d=a[x][y-2];
	if(a[x][y+2]<d)d=a[x][y+2];
	return d;
}

void draw(int x,int y,int s,int d){
	if(size==3 && (x<2 || x>8 || y<2 || y>8)) return;
	a[x][y]+=d;
	a[x-1][y]+=d;
	a[x+1][y]+=d;
	a[x][y-1]+=d;
	a[x][y+1]+=d;
	if(s==1)return;
	a[x-1][y-1]+=d;
	a[x+1][y+1]+=d;
	a[x+1][y-1]+=d;
	a[x-1][y+1]+=d;
	if(s==2)return;
	a[x-2][y]+=d;
	a[x+2][y]+=d;
	a[x][y-2]+=d;
	a[x][y+2]+=d;
}

int search(int nn,int from){
	int i,x,y,s,t;
	for(i=from;i>=0;i--){
		x=list[i][0];y=list[i][1];s=list[i][2];
		//if(a[x][y]==0 && a[x+1][y]>0)return 0;
		if(x<8){
		if(s<3 && a[x+2][y]>0)return 0;
		if(y==1 && a[x+2][y-1]>0)return 0;
		}
		if(y==1 && s<2 && a[x+1][y-1]>0)return 0;
        if(y==8 && s<2 && a[x+1][y+1]>0)return 0;
		t=check(x,y,s);
		if(t>0){
			draw(x,y,s,-t);
			for(;t>0;t--){
				if(s==1 && a[x+1][y+1]>0 && check(x-1,y+1,3)==0){draw(x,y,s,+1); if(t>1)continue; else return 0;}
				if(nn-t>0){
					if(search(nn-t,i-1)>0){goto answer;}
				}else{
					int p,q;
					for(p=0;p<10;p++)for(q=0;q<10;q++){{if(a[p][q]!=0)goto miss;}}
					goto answer;
					miss:;
				}
				draw(x,y,s,+1);
			}
		}
	}
	return 0;

	answer:
	for(;t>0;t--)printf("%d %d %d\n",y,x,s);
	return 1;
}

int main(void){
	scanf("%d",&n);size=0;
	for(i=0;i<10;i++){for(j=0;j<10;j++){scanf("%d",&a[i][j]);}}
	for(i=1;i<9;i++){
		for(j=1;j<9;j++){
			x=check(i,j,1); if(x==0)continue; push(i,j,1);
			x=check(i,j,2); if(x==0)continue; push(i,j,2);
			x=check(i,j,3); if(x==0)continue; push(i,j,3);
		}
	}
	search(n,size-1);
	return 0;
}

Measured memory_bytes: 600
using System;
using System.Linq;

public class Program
{
    static void Main()
    {
        string[] input = Console.ReadLine().Split(' ');
        int n = int.Parse(input[0]);
        int a = int.Parse(input[1]);
        int b = int.Parse(input[2]);
        char[] s = Console.ReadLine().ToCharArray();
        int cntJ = 0, cntF = 0;
        for (int i = 0; i < s.Length; i++)
        {
            if (s[i] == 'a' && cntJ + cntF < a + b)
            {
                cntJ++;
                Console.WriteLine("Yes");
            }
            else if (s[i] == 'b' && cntJ + cntF < a + b && cntF < b)
            {
                cntF++;
                Console.WriteLine("Yes");
            }
            else
                Console.WriteLine("No");

        }
    }
}


Measured memory_bytes: 15840
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
int main()
{
    int n;
    cin>>n;
    string str;
    cin>>str;
    int dp[n+1][n+1];
    for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=n;j++)
        dp[i][j]=0;
    }
    for(int i=1;i<=n;i++)
    dp[1][i]=1;
    for(int i=2;i<=n;i++)
    {
        for(int j=2;j<=n;j++)
        dp[i-1][j]=(0LL+dp[i-1][j]+dp[i-1][j-1])%mod;
        for(int j=1;j<=i;j++)
        {
            if(str[i-2]=='<')
            dp[i][j]=dp[i-1][j-1];
            else
            dp[i][j]=(0LL+dp[i-1][i-1]-dp[i-1][j-1]+mod)%mod;
        }
    }
    int ans=0;
    for(int i=1;i<=n;i++)
    ans=(0LL+ans+dp[n][i])%mod;
    cout<<(ans+mod)%mod<<"\n";
    return 0;
}

Measured memory_bytes: 35456
'use strict';
(function(stdin) {

  var inputs  = stdin.toString().trim().split('\n');
  var cols = inputs[0].split(' ');

  var min = parseInt(cols[0]);
  var max = parseInt(cols[1]);
  var num = parseInt(cols[2]);

  function isDivisable(diviser) {
    return num % diviser === 0;
  }

  var diviser = [];

  for(var i = min ; i < max+1 ; i++){
    if(isDivisable(i)){diviser.push(i);}
  }

  console.log(diviser.length);

}(require('fs').readFileSync('/dev/stdin', 'utf8')));

Measured memory_bytes: 15840
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)

	n := nextInt()
	sum := 0
	for i := 0; i < n; i++ {
		sum += nextInt()
	}

	fmt.Println(sum - n)
}

Measured memory_bytes: 640
#include <cstdio>
#include <utility>
#include <unordered_map>
using namespace std;

#define gcu getchar_unlocked
#define ii inline int in
#define is inline bool scan
ii(int c) {
	int n = 0;
	bool minus = false; if (c == '-') minus = true, c = gcu();
	do {n = 10 * n + (c - '0'), c = gcu();} while (c >= '0');
	//return n; }
	return minus ? -n : n; }
ii() {return in(gcu());}
is(int &n){int c=gcu();return c==EOF?false:(n=in(c),true);}
is(char &c){c=gcu();gcu();return c!=EOF;}
is(string &s){int c; s = "";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#undef ii
#define pcu putchar_unlocked
template <typename T>
void out(T n) {
	static char buf[20];
	char *p = buf;
	if(n < 0) pcu('-'), n *= -1;
	if (!n) *p++ = '0';
	else while (n) *p++ = n % 10 + '0', n /= 10;
	while (p != buf) pcu(*--p); }
void out(const char *s){while(*s)pcu(*s++);}
void out(char c){pcu(c);}
void out(string &s){for (char c: s) pcu(c);}
template <typename head, typename... tail>
void out(head&& h, tail&&... t){out(h);out(move(t)...);}
//template <typename T>
//void out(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);out('\n');}
#undef svo

typedef unsigned long ul;

int main() {
	unordered_map<ul, char> m = {{0x303, 'A'}, {0x1010101, 'B'}, {0xf, 'C'},
		{0x8181, 'D'}, {0x603, 'E'}, {0x20301, 'F'}, {0x183, 'G'}};
	do {
		ul n = 0;
		for (int i = 0; i < 8; i++) {
			for (int j = 0; j < 8; j++)
				n = (n << 1) + gcu() - '0';
			gcu();
		}
		out(m[n / (n & -n)], '\n');
	} while (gcu() == '\n');
}


Measured memory_bytes: 2480
#include <iostream>
using namespace std;
int main(void){
    int N,ans = 0;
    cin >> N;
    int A[2][N];
    for(int i = 0;i < 2;i++){
        for(int j = 0;j < N;j++){
            cin >> A[i][j];
        }
    }
    
    int up[N],down[N];
    up[0] = A[0][0];
    for(int i = 1;i < N;i++){
        up[i] = up[i - 1] + A[0][i];
    }
    
    down[0] = A[1][N - 1];
    for(int i = 1;i < N;i++){
        down[i] = down[i - 1] + A[1][N - i - 1];
    }
    
    for(int j = 0;j < N;j++){
        int x = up[j] + down[N - j - 1];
        ans = max(ans,x);
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 50;
 
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;
}
using namespace std;
 
void solve(){
	char s[15];
    string t="";
    scanf("%s",s);
    rep(i,4)t+=string{s[i]};
    t+=" ";
    for(int j=4;j<12;++j)t+=string{s[j]};
    cout<<t<<"\n";
}
 
 
signed main(){
	ios::sync_with_stdio(false);
        cin.tie(0);
	cout<<fixed<<setprecision(15);
	solve();
	return 0;
}

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

class UnionFindVerSize():
    def __init__(self, N):
        """ N個のノードのUnion-Find木を作成する """
        # 親の番号を格納する。自分が親だった場合は、自分の番号になり、それがそのグループの番号になる
        self._parent = [n for n in range(0, N)]
        # グループのサイズ（個数）
        self._size = [1] * N

    def find_root(self, x):
        """ xの木の根(xがどのグループか)を求める """
        if self._parent[x] == x: return x
        self._parent[x] = self.find_root(self._parent[x]) # 縮約
        return self._parent[x]

    def unite(self, x, y):
        """ xとyの属する集合を併合する """
        gx = self.find_root(x)
        gy = self.find_root(y)
        if gx == gy: return

        # 小さい方を大きい方に併合させる（木の偏りが減るので）
        if self._size[gx] < self._size[gy]:
            self._parent[gx] = gy
            self._size[gy] += self._size[gx]
        else:
            self._parent[gy] = gx
            self._size[gx] += self._size[gy]

    def get_size(self, x):
        """ xが属するグループのサイズ（個数）を返す """
        return self._size(self.find_root(x))

    def is_same_group(self, x, y):
        """ xとyが同じ集合に属するか否か """
        return self.find_root(x) == self.find_root(y)


def solve():
    """戦略
    □ □ □ □ □ □ □ □ □ □ □ □ □ □ □
    |_| |_| |_|     |_| | |_|_|_|
                    |___|
     1   2   3  4 5   6      7   

    上みたいなものを考えたらわかるが、答えはグループの数(=7)。

    Union-Findを使えばよい。

    """
    N, M = list(map(int, input().split()))
    X, Y, Z = [], [], []
    uf = UnionFindVerSize(N)
    for i in range(M):
        x, y, z = list(map(int, input().split()))
        x, y = x-1, y-1
        uf.unite(x, y)
    
    # 答えは、(グループの数) 
    ans = 0
    for i in range(N):
        if uf.find_root(i) == i:
            ans += 1
    
    print(ans)


if __name__ == "__main__":
    solve()


Measured memory_bytes: 7856
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String string = "";
        int[] arrays = new int[26];
        while(sc.hasNext()){
            string+=sc.nextLine();
        }
        for(int i = 0; i < string.length(); i++){
            int temp = string.charAt(i);
            if('A'<= temp && temp <= 'Z'){
                arrays[temp - 'A']++;
            }else if('a' <= temp && temp <= 'z'){
                arrays[temp - 'a']++;
            }
        }
        for(int i = 0; i < arrays.length; i++){
            System.out.println((char)('a' + i) + " : " + arrays[i]);
        }
    }
}

Measured memory_bytes: 17356
#include<bits/stdc++.h>
using namespace std;
#define MAX 100005
//#define MAXN 100005
#define pb push_back
#define mk make_pair
#define fi first
#define se second
#define mt make_tuple
#define eb emplace_back
#define INF 1e9
#define fu(i,a,n) for(i=a;i<=n;i++)
#define rep(i,n) for(i=0;i<n;i++)
#define sz(a) (int)(a.size())
typedef int kb;
typedef long long int ll;
typedef vector <ll> Vl;
typedef long double ld;
const int MOD = 1000000007;

ll modexp(ll a, ll b)
{
	ll res = 1;
	while(b)
	{
		if(b&1) res = (res*a)%MOD;
		a=(a*a)%MOD;
		b>>=1;
	}
	return res;
}
int a[MAX], mark[MAX];
ll fac[MAX], ifac[MAX], cal[MAX];
vector<ll> L3, L2, L1;
void pre()
{
	ll i;
	fac[0] = fac[1] = ifac[0] = ifac[1] = 1;
	for(i=2;i<MAX;++i)
	{
		fac[i] = (i*fac[i-1])%MOD;
		ifac[i] = modexp(fac[i],MOD-2);
		assert((fac[i]*ifac[i]%MOD) == 1);
	}
}
inline ll ncr(ll n, ll r)
{
	if(r > n) return 0;
	ll res = (ifac[r]*ifac[n-r])%MOD;
	res = (res*fac[n])%MOD;
	return res;
}
int main()
{
	pre();
	int n,i,l,l1,l2,l3,x,wx;
	cin>>n;
	for(i=1;i<=n+1;++i)
	{
		cin>>a[i];
		if(!mark[a[i]]) mark[a[i]] = i;
		else x = a[i], wx = i;
	}
	
	l1 = mark[x]-1;
	l2 = wx-mark[x]-1;
	l3 = n+1-wx;
	
	for(i=1;i<=n+1;++i)
		cal[i] = (ncr(n+1,i) - ncr(l1+l3,i-1) + MOD)%MOD;
	
	for(i=1;i<=n+1;++i)
		cout<<cal[i]<<endl;

	
	return 0;
}

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

using namespace std;

typedef long long ll;

int main()
{
    ll a , b;
    ll k;
    cin >> k >> a >> b;
    int flag=0;
    for(int i=a;i<=b;i++)
    {
        if(!(i%k))
        {
            flag =1;
            break;

        }
    }
    if(flag ) cout << "OK";
    else cout << "NG";

   return 0;
}//main


Measured memory_bytes: 3624
N=int(input())
a=input()
b=input()
c=input()

three_dif=0
two_same=0
all_same=0

for i in range(0,N):
    #３つとも違う
    #３つ中2つ同じ
    #3つ全て同じ
    if(a[i]==b[i] and b[i]==c[i]):
        all_same+=1
    elif(a[i]==b[i] or b[i]==c[i] or c[i]==a[i]):
        two_same+=1
    else:
        three_dif+=1
ans=two_same+2*three_dif
print(ans)

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

using namespace std;

int main()
{
    int N,X;
    cin >> N >> X;
    int x[100000];
    int y[100000];
    for(int i = 0; i < N; ++i) cin >> x[i];
    for(int i = 0; i < N; ++i) y[i] = abs(x[i] - X);
    sort(y,y+N);
    for(int D = y[0]; D >= 1; --D){
        bool canMove = true;
        for(int j = 0; j < N; ++j){
            if(y[j] % D != 0){
                canMove = false;
                break;
            }
        }
        if(canMove){
            cout << D << endl;
            return 0;
        }
    }

    return 0;
}



Measured memory_bytes: 1024
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>

std::string solve(int d, int t, int s)
{
  return d <= t * s ? "Yes" : "No";
}

int main()
{
  int d, t, s;
  std::cin >> d >> t >> s;

  std::cout << std::setprecision(20);
  std::cout << solve(d, t, s) << std::endl;
}


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

using namespace std;

int main()
{
    long long N;
    cin>>N;
    if(N==1){
        cout<<0<<endl;
    }else if(N==2){
        cout<<1<<endl;
    }else{
        cout<<((N-1)*N)/2<<endl;
    }

}

Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <map>
#include <queue>
#include <deque>

using namespace std;

int n, d;

long long points[10][10];

long long dist_in_second_degree(int first, int second) {
	long long res = 0;
	for (int i = 0; i < d; ++i)
		res += (points[first][i] - points[second][i]) * (points[first][i] - points[second][i]);
	return res;
}

bool is_it(long long number) {
	for (long long i = 1; i * i <= number; ++i) {
		if (i * i == number)
			return true;
	}
	return false;
}

int main() {
	cin >> n >> d;
	int res = 0;
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < d; ++j)
			cin >> points[i][j];
	}
	for (int i = 0; i < n - 1; ++i) {
		for (int j = i + 1; j < n; ++j) {
			if (is_it(dist_in_second_degree(i, j)))
				++res;
		}
	}
	cout << res;
}

Measured memory_bytes: 256
#include <cstdio>
using namespace std;
long long n, x, s, d, a[100005];
int main() {
	int i;
	scanf("%lld%lld%lld", &n, &x, &a[0]);
	if(a[0] > x) s = a[0]-x, a[0] = x;
	for(i=1; i<n; i++) {
		scanf("%lld", &a[i]);
		d = a[i] + a[i-1] - x;
		if(d > 0) a[i] -= d, s += d;
		if(a[i] < 0) a[i-1] += a[i], a[i] = 0;
	}
	printf("%lld", s);
	return 0;
}

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

#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 reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

void yes() { cout << "Yes" << endl; exit(0); }
void no() { cout << "No" << endl; exit(0); }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> void amax(T &x, T y) { x = max(x, y); }
template <typename T> void amin(T &x, T y) { x = min(x, y); }
template <typename T> T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { for (auto &x : v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

const int INF = 1001001001;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};

void solve() {
  int n, m;
  cin >> n >> m;
  set<int> se;
  for (int i = 1; i * i <= m; i++) {
    if (m % i == 0) {
      se.insert(i);
      se.insert(m / i);
    }
  }
  for (auto s : se) {
    if (s >= n) {
      cout << m / s << endl;
      return;
    }
  }
}


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

typedef long long lint;
typedef pair<int, int> P;
#define REP(i, x, n) for(int i = x ; i < n ; ++i)
#define rep(i, n) for(int i = 0 ; i < n ; ++i)
#define repr(i, n) for(int i = n - 1 ; i >= 0 ; --i)
#define ALL(x) (x).begin(), (x).end()
#define SORT(x) sort((x).begin(), (x).end())

const int IINF = 1e9 + 10;
const long long LLINF = (long long)1e18 + 10;
const long long MOD = (long long)1e9 + 7;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

int main(){
    int n, k;
    cin >> n >> k;
    vector<int> h(n);
    rep(i, n){
        cin >> h[i];
    }
    SORT(h);
    int ans = IINF;
    rep(i, n - k + 1){
        ans = min(ans, h[i + k - 1] - h[i]);
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
  int n,m; cin>>n>>m;
  ll ans = 0;
  ans += m * (m - 1)/2;
  ans += n * (n - 1)/2;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define print printf("==================\n")
#define ll long long
#define pi acos(-1.0)
#define eps 1e-16
#define max3(a,b,c) max(a,max(b,c))
const ll INF = 1 << 30;
typedef pair<ll, ll  > payar;
typedef struct
{
    ll  x, y;
} point;
priority_queue<payar, vector<payar>,  greater<payar> > pq; ///accending
vector< pair<ll,payar  > > vpp;
vector < payar >  vp;

ll n ;
int ara[100005][4];
ll dp[100005][4];
ll cal(int day, int itm)
{
    if(day>n)
    {
        return 0;
    }

    if(dp[day][itm]!=-1)
        return dp[day][itm];
    ll maxi = -1;
    if(day==1)
    {
   return   maxi = dp[day][itm]=max3( cal(day+1,1)+ara[day][1], cal(day+1,2)+ara[day][2], cal(day+1,3)+ara[day][3] );

    }
    for(int i = 1 ; i<=3 ; i++)
    {
            if(i==itm)
                continue;
            maxi=max( cal(day+1,i)+ara[day][i],maxi);


    }
    return dp[day][itm]=maxi;
}

int main()
{

    cin>>n;
    memset(dp,-1,sizeof dp);
    for(int i =  1 ; i<=n ; i++)
    {
        for(int j  = 1 ; j<= 3 ; j++)
        {
            cin>>ara[i][j];
        }
    }
    cout<<cal(1,1);



    return  0 ;
}


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

using namespace std;

const int N = 1e5 + 10;


vector<int> adj[N];
int nodes,edges;
int dist[N];
int in_deg[N];
vector<bool> visited(N,false);

int dfs(int src) {
    visited[src] = true;

    for(auto x : adj[src]) {
        dist[x] = max(dist[x], dist[src] + 1);
        in_deg[x]--;
        if(in_deg[x] == 0) {
            dfs(x);
        } 
    }
}   

int main() {

    cin >> nodes >> edges;

    for(int i = 0 ; i < edges ; i++) {
        int src, dst;
        cin >> src >> dst;
        adj[src].push_back(dst);
        in_deg[dst]++;
    }


    for(int i = 1 ; i <= nodes ; i++) {
        adj[0].push_back(i);
        in_deg[i]++;
    }


    dfs(0);

    int ans = *max_element(dist + 1, dist + nodes + 1);

    cout << ans - 1 << '\n';

    return 0;
}

Measured memory_bytes: 7928
from bisect import bisect
MAXN = 10000
P = [True]*MAXN
P[0] = P[1] = False
for i in xrange(int(MAXN**0.5)+1):
    if P[i]:
        for j in xrange(i+i,MAXN,i):
            P[j] = False
TP = filter(lambda i:P[i] and P[i-2], xrange(2,MAXN))
while True:
    n = int(raw_input())
    if n == 0:
        break
    m = TP[bisect(TP,n)-1]
    print m-2, m

Measured memory_bytes: 4596
import itertools
n, m, q = map(int, input().split())
X = [tuple(map(int, input().split())) for i in range(q)]
ans = 0
for A in itertools.combinations_with_replacement(range(m), n):
    tmp = 0
    for a, b, c, d in X:
        if A[b - 1] - A[a - 1] == c:
            tmp += d
    ans = max(ans, tmp)
print(ans)


Measured memory_bytes: 9188
n=int(input())
a=list(map(int,input().split()))
v=[0]*64
ans=0
mod=1000000007
zero=0
one=0

index=n-1
while index>=0:
	for k in range(61):
		one=v[k]
		zero=n-1-index-one
		tmp=1<<k
		if((a[index]&tmp)==0):
			ans=(ans+tmp*one)
		else:
			ans=(ans+tmp*zero)
			v[k]=v[k]+1
	index-=1

ans=ans%mod
print(ans)
print()

Measured memory_bytes: 122808
use std::process;
macro_rules! get {
      ($t:ty) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              line.trim().parse::<$t>().unwrap()
          }
      };
      ($($t:ty),*) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              let mut iter = line.split_whitespace();
              (
                  $(iter.next().unwrap().parse::<$t>().unwrap(),)*
              )
          }
      };
      ($t:ty; $n:expr) => {
          (0..$n).map(|_|
              get!($t)
          ).collect::<Vec<_>>()
      };
      ($($t:ty),*; $n:expr) => {
          (0..$n).map(|_|
              get!($($t),*)
          ).collect::<Vec<_>>()
      };
      ($t:ty ;;) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              line.split_whitespace()
                  .map(|t| t.parse::<$t>().unwrap())
                  .collect::<Vec<_>>()
          }
      };
      ($t:ty ;; $n:expr) => {
          (0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
      };
}
fn main() {
    let s = get!(String);
    for i in 0..s.len()-1 {
        if s.chars().nth(i).unwrap() == s.chars().nth(i+1).unwrap(){ println!("Bad");
            process::exit(0);
        }
    }
    println!("Good");

}


Measured memory_bytes: 4352
function Main(input) {

  console.log(input.trim() === 'ABC' ? 'ARC' : 'ABC');
    
}

// デバッグ用
function debug() {
  var input = document.getElementById("input").value;
  Main(input);
}

//* この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int main() {
    int n, a;
    int min_a = 1000000;
    int max_a = -1000000;
    long long sum = 0;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a;
        min_a = min(min_a, a);
        max_a = max(max_a, a);
        sum += a;
    }
    cout << min_a << " " << max_a << " " << sum << endl;
    return 0;
}

Measured memory_bytes: 3092
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(ll i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    FOR(h, 1, 3500)FOR(n, 1, 3500){
        if(4 * h * n - N * (h + n) <= 0) continue;
        if(N * h * n % (4 * h * n - N * (h + n)) == 0){
            ll w = N * h * n / (4 * h * n - N * (h + n));
            cout << h << " " << n << " " << w << "\n";
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 256
/*我是萌新*/
#include<iostream>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#include <iomanip> 
#include<map>
typedef long long ll;
const int mod = 1e9+7;
using namespace std;
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()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    ll t;
    while (cin >> t)
    {
        ll ans=0;
        for(ll i=1;i<=t;i++)
        {
            for(ll j=1;j<=t;j++)
            {
                for(ll k=1;k<=t;k++)
                {
                    ans+=gcd(i,gcd(j,k));
                }
            }
        }
        cout<<ans<<'\n';
    }
}



Measured memory_bytes: 3644
/*
AuThOr Gwj
*/
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
#define LL long long
#define IT iterator
#define PB push_back
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
#define FREO freopen("check.out","w",stdout)
#define rep(a,b) for(int a=0;a<b;++a)
#define KEEP while(1)
#define SRAND mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define random(a) rng()%a
#define ALL(a) a.begin(),a.end()
#define POB pop_back
#define ff fflush(stdout)
#define fastio ios::sync_with_stdio(false)
#define debug_pair(A) cerr<<A.FIR<<" "<<A.SEC<<endl;
#define biggest(A,B) A=max(A,B)
#define smallest(A,B) A=min(A,B)
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
typedef pair<mp,mp> superpair;
int n,k;
vector<LL> pos,neg,a1,a2;
const int MOD=1e9+7;
int main(){
	fastio;
	cin>>n>>k;
	if(n==k){
		LL tmp=1;
		rb(i,1,n){
			LL ai;
			cin>>ai;
			tmp*=ai;
			tmp%=MOD;
			tmp+=MOD;
			tmp%=MOD;
		}
		cout<<tmp<<endl;
		return 0;
	}
	rb(i,1,n){
		int ai;
		cin>>ai;
		if(ai<0)
			neg.PB(-ai);
		else{
			pos.PB(ai);
		}
	}	
	sort(ALL(pos));
	sort(ALL(neg));
	reverse(ALL(pos));
	reverse(ALL(neg));
	a1=pos;
	a2=neg;
	LL tmp=1;
	rep(i,pos.size()){
		pos[i]*=tmp;
		pos[i]%=MOD;
		tmp=pos[i];
	}
	tmp=1;
	rep(i,neg.size()){
		neg[i]*=tmp;
		neg[i]%=MOD;
		tmp=neg[i];
	}
	if((k&1)&&pos.empty()){
		
	reverse(ALL(a2));
	neg=a2;
	tmp=1;
	rep(i,neg.size()){
		neg[i]*=tmp;
		neg[i]%=MOD;
		tmp=neg[i];
	}
		cout<<MOD-neg[k-1]<<endl;
		return 0;//负数 
	}
	else{
		//正数
		LL res;
		bool ok=0;
		rb(i,0,neg.size()){
			if(i&1) continue;
			if(k-i<=pos.size()){
			if(i&&ok)
			if(a2[i-1]*a2[i-2]<a1[k-i]*a1[k-i+1]) break;
			if(i==0){
				res=pos[k-1];
			}
			else
			if(k-i-1>=0){
				res=pos[k-i-1]*neg[i-1]%MOD;
			}
			else{
				res=neg[i-1];
			}
				ok=1;
			} 
		} cout<<res<<endl;
	}
	return 0;
}


Measured memory_bytes: 6360
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#define ll long long
using namespace std;
const int M=1000000007;
template <std::uint_fast64_t Modulus> class modint {
  using u64 = std::uint_fast64_t;

public:
  u64 a;

  constexpr modint(const u64 x = 0) noexcept : a(x % Modulus) {}
  constexpr u64 &value() noexcept { return a; }
  constexpr const u64 &value() const noexcept { return a; }
  constexpr modint operator+(const modint rhs) const noexcept {
    return modint(*this) += rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept {
    return modint(*this) -= rhs;
  }
  constexpr modint operator*(const modint rhs) const noexcept {
    return modint(*this) *= rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept {
    return modint(*this) /= rhs;
  }
  constexpr modint &operator+=(const modint rhs) noexcept {
    a += rhs.a;
    if (a >= Modulus) {
      a -= Modulus;
    }
    return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept {
    if (a < rhs.a) {
      a += Modulus;
    }
    a -= rhs.a;
    return *this;
  }
  constexpr modint &operator*=(const modint rhs) noexcept {
    a = a * rhs.a % Modulus;
    return *this;
  }
  constexpr modint &operator/=(modint rhs) noexcept {
    u64 exp = Modulus - 2;
    while (exp) {
      if (exp % 2) {
        *this *= rhs;
      }
      rhs *= rhs;
      exp /= 2;
    }
    return *this;
  }
};

modint<M> f(int n){
    if(n==0) return 1;
    modint<M> x=f(n/2);
    x*=x;
    if(1==n%2) x*=2;
    return x;
}

modint<M> choose(int n,int k){
    modint<M> x=1,y=1;
    for(int i=0;i<k;i++){
        x*=n-i;
        y*=i+1;
    }
    return x/y;
}

int main(){
    using mint = modint<M>;
    int n,a,b;
    cin>>n>>a>>b;

    modint<M> ans=f(n);
    ans-=1;
    ans-=choose(n,a);
    ans-=choose(n,b);
    cout<<ans.a<<endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Text;

namespace CGL_2_A_ParallelOrthogonal
{
	class Program
	{
		static void Main ( string[] args )
		{
			int inputCount = int.Parse (Console.ReadLine ());

			StringBuilder output = new StringBuilder (inputCount * 2);

			for (int lp = 0; lp < inputCount; lp++)
			{
				int[] inputNum = Array.ConvertAll (Console.ReadLine ().Split (' '), int.Parse);

				Vector2 segment1 = new Vector2 (inputNum[0], inputNum[1]) - new Vector2 (inputNum[2], inputNum[3]);
				Vector2 segment2 = new Vector2 (inputNum[4], inputNum[5]) - new Vector2 (inputNum[6], inputNum[7]);

				if (Vector2.IsParallel (segment1, segment2))
				{
					output.Append (2);
				}
				else if (Vector2.IsOrthogonal (segment1, segment2))
				{
					output.Append (1);
				}
				else
				{
					output.Append (0);
				}

				output.AppendLine ();
			}

			Console.Write (output);
		}
	}

	class Vector2
	{
		public Vector2 ( decimal x, decimal y )
		{
			this.X = x;
			this.Y = y;
		}

		public decimal X { private set; get; }
		public decimal Y { private set; get; }

		public static Vector2 operator - ( Vector2 ob1, Vector2 ob2 )
		{
			return new Vector2 (ob1.X - ob2.X, ob1.Y - ob2.Y);
		}

		public decimal Length ()
		{
			return X * X + Y * Y;
		}
		public Vector2 Normalize ()
		{
			decimal length = this.Length ();
			return new Vector2 (X / length, Y / length);
		}
		public static decimal DotProduct ( Vector2 ob1, Vector2 ob2 )
		{
			return ob1.X * ob2.X + ob1.Y * ob2.Y;
		}
		public static decimal CrossProduct ( Vector2 ob1, Vector2 ob2 )
		{
			return ob1.X * ob2.Y - ob1.Y * ob2.X;
		}

		public static bool IsOrthogonal ( Vector2 ob1, Vector2 ob2 )
		{
			return DotProduct (ob1, ob2) == 0;
		}
		public static bool IsParallel ( Vector2 ob1, Vector2 ob2 )
		{
			return CrossProduct (ob1, ob2) == 0;
		}
	}
}
 

Measured memory_bytes: 9416
fun main(args: Array<String>) {
    val n = readLine()?.toInt() ?: return
    val b = readLine()?.split(" ")?.map(String::toLong) ?: return
    val a = Array(n) { 0L }
    0.until(n - 1).forEach { i ->
        if (i >= 1) {
            if (b[i - 1] < b[i]) {
                a[i] = b[i - 1]
            } else {
                a[i] = b[i]
            }
        } else {
            a[i] = b[i]
        }
    }
    println((a.sum() + b.last()).toString())
}

Measured memory_bytes: 37956
from collections import Counter


def number_of_color_types(today_color, ßyesterday_color,
                          day_before_yesterday_color):
    last_three_days_color_list = [
        today_color,
        ßyesterday_color,
        day_before_yesterday_color
    ]

    return len(Counter(last_three_days_color_list))


if __name__ == '__main__':
    today_color, yesterday_color, \
        day_before_yesterday_color = map(int, input().split())

    print(number_of_color_types(today_color,
                                yesterday_color, day_before_yesterday_color))


Measured memory_bytes: 3316