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

public class Main {
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		int b,c,d,e,f;
		int j=in.nextInt();
		int[] a = new int[j+1];
		int sum = 0;
		for(int i = 0;i < j;i++){
			sum = sum + i;
		}
		for(int i = 0;i <= j;i++){
			a[i] = 0;
		}
		for(int i = 0;i < sum;i++){
			b=in.nextInt();
			c=in.nextInt();
			d=in.nextInt();
			e=in.nextInt();
			if(d < e)a[c]+=3;
			else if(d > e) a[b]+=3;
			else {
				a[b]++;
				a[c]++;
			}
		}
		for(int i = 1;i <= j;i++){
			f = 1;
			for(int s = 1;s <= j;s++){
				if(a[i] < a[s]){
					f++;
				}
			}
			System.out.println(f);
		}
	}
}

Measured memory_bytes: 41884
use proconio::{
   fastout, input,
   marker::{Bytes, Chars, Isize1, Usize1},
};

#[fastout]
fn main() {
   input! {
      t:Chars
   }
   for i in 0..t.len() {
      if t[i] == '?' {
         print!("D");
      } else {
         print!("{}", t[i]);
      }
   }
   println!("");
}


Measured memory_bytes: 3112
#include <stdio.h>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;

int cmp(long long oo,long long xx){
    return oo>xx;
}
long long n,m,v,p;
long long a[100010];

bool check(long long k){
    if (a[k]>=a[p]) return true;
    long long tmp=a[k]+m;
    if (tmp<a[p]) return false;
    long long tot=m*p;

    for (long long i=k+1;i<=n;++i) tot+=m;
    if (tot>=m*v) return true;

    for (long long i=p;i<k;++i){
        tot += (tmp-a[i]);
        if (tot>=m*v) return true;
    }
    return false;

}

int main()
{

    scanf("%lld%lld%lld%lld",&n,&m,&v,&p);
    for (int i=1;i<=n;++i)
        scanf("%lld",&a[i]);
    sort(a+1,a+n+1,cmp);
    long long ans=0,ll=1,rr=n;
    while (ll<=rr){
        long long mid=(ll+rr)/2;
        if (check(mid)){
            ans=mid;ll=mid+1;
        }
        else rr=mid-1;
    }
    printf("%lld\n",ans);

}


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

#define Fast cin.tie(0), ios::sync_with_stdio(0)
#define All(x) x.begin(), x.end()
#define louisfghbvc int t; cin >> t; while(t--)
#define sz(x) (int)(x).size()
using namespace std;
typedef long long LL;
typedef pair<LL, LL> ii;
typedef vector<LL> vi;

template<typename T> istream& operator>>(istream &is, vector<T> &v) { for(auto &it : v) is >> it; return is; }
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { os << '{'; string sep = ""; for(const auto &x : v) os << sep << x, sep = ", "; return os << '}'; }
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }

void dbg_out() { cerr << "\n"; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }

const int N = 2e5+5;
int p[N];

int find(int x){
    return p[x] < 0 ? x : p[x] = find(p[x]);
}

void solve(){
    int n, m, a, b;
    cin >> n >> m;
    memset(p, -1, sizeof p);

    for(int i = 0; i < m; ++i){
        cin >> a >> b;
        int pa = find(a), pb = find(b);
        if(pa != pb){
            p[pa] += p[pb];
            p[pb] = pa;
        }
    }

    int mx = 0;
    for(int i = 1; i <= n; ++i){
        mx = max(mx, -p[find(i)]);
    }
    cout << mx << "\n";
}

int main()
{
    Fast;
    //louisfghbvc{
        solve();
    //}
    return 0;
}


Measured memory_bytes: 5360
use proconio::*;
use std::collections::*;

#[fastout]
fn main() {
    input! {
        mut n: usize,
    }

    let mut a = vec![];
    for i in 2.. {
        if i * i > n {
            break;
        }
        let mut cnt = 0;
        while n % i == 0 {
            n /= i;
            cnt += 1;
        }
        a.push(cnt);
    }
    if n > 1 {
        a.push(1);
    }
    let mut ans = 0;
    for d in a {
        let mut t = 0;
        for i in 1.. {
            if i * (i + 1) / 2 <= d {
                t = i;
            } else {
                break;
            }
        }
        ans += t;
    }

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


Measured memory_bytes: 6052
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define irep(i,a,b) for(typeof(i) i = (a); i < (b); ++i)
#define itrep(it,c) for(auto it = (c).begin(); it != (c).end(); ++it)


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

	int N;
	cin >> N;
	switch (N % 10) {
	case 0:
	case 1:
	case 6:
	case 8:
		cout << "pon" << endl;
		break;
	case 3:
		cout << "bon" << endl;
		break;
	default:
		cout << "hon" << endl;
		break;
	}
	return(0);
}


Measured memory_bytes: 3640
N,D=map(int,input().split())
X=[list(map(int,input().split())) for i in range(N)]
ans=0
for t in range(N-1):
    for s in range(t+1,N):
        count=0
        for x in range(D):
            count+=(X[t][x]-X[s][x])**2
        Z=count**(1/2)
        if Z.is_integer()==True:
            ans+=1
print(ans)
            

Measured memory_bytes: 3064
<?php
    $hp = trim(fgets(STDIN));

    $atack_count = atack($hp, 1);
    echo $atack_count . PHP_EOL;
    
    function atack($hp, $k)
    {
        if ($hp == 1) {
            return 2 ** ($k - 1);
        }

        return 2 ** ($k - 1) + atack(floor($hp / 2), $k + 1);
    }

Measured memory_bytes: 4604
n = int(input())

ans = 0
for i in range(1, n+1):
    l = [] 
    for j in range(1, i+1):
        if i % j == 0:
            l.append(j)

    if len(l) == 8 and i % 2 == 1:
        ans += 1

print(ans)

Measured memory_bytes: 3060
#include <iostream>

class Dice {
    public:
        int* label;
        Dice() {
            label = new int[7];
        };
        ~Dice() {
            delete[] label;
        }
        void turn_dice(char c) {
           
            if(c == 'S') {
               int w = label[5];
               label[5] = label[6];
               label[6] = label[2];
               label[2] = label[1];
               label[1] = w;
            }
            else if(c == 'E') {
                int w = label[4];
                label[4] = label[6];
                label[6] = label[3];
                label[3] = label[1];
                label[1] = w;
            }
            else if(c == 'N') {
                int w = label[2];
                label[2] = label[6];
                label[6] = label[5];
                label[5] = label[1];
                label[1] = w;
            }
            else if(c == 'W') {
                int w = label[3];
                label[3] = label[6];
                label[6] = label[4];
                label[4] = label[1];
                label[1] = w;
            }
        };
};
bool same(Dice& dice1, Dice& dice2) {
    for(int i = 1; i <= 6; i++) {
        dice1.turn_dice('S');
        for(int j = 1; j <= 4; j++) {
            dice1.turn_dice('E');
            if(dice1.label[1] == dice2.label[1]&&
               dice1.label[2] == dice2.label[2]&&
               dice1.label[3] == dice2.label[3]&&
               dice1.label[4] == dice2.label[4]&&
               dice1.label[5] == dice2.label[5]&&
               dice1.label[6] == dice2.label[6]) {
                return true;
            }
        }
    }
    dice1.turn_dice('E');
    dice1.turn_dice('N');
    for (int k = 1; k <= 4; k++) {
        dice1.turn_dice('E');
        if(dice1.label[1] == dice2.label[1]&&
           dice1.label[2] == dice2.label[2]&&
           dice1.label[3] == dice2.label[3]&&
           dice1.label[4] == dice2.label[4]&&
           dice1.label[5] == dice2.label[5]&&
           dice1.label[6] == dice2.label[6]) {
            return true;
        }
    }
    dice1.turn_dice('N');
    dice1.turn_dice('N');
    for (int k = 1; k <= 4; k++) {
        dice1.turn_dice('E');
        if(dice1.label[1] == dice2.label[1]&&
           dice1.label[2] == dice2.label[2]&&
           dice1.label[3] == dice2.label[3]&&
           dice1.label[4] == dice2.label[4]&&
           dice1.label[5] == dice2.label[5]&&
           dice1.label[6] == dice2.label[6]) {
            return true;
        }
    }
    return false;
}


int main() {
    int n;
    bool flag = false;
    Dice* dices; 
    std::cin >> n;
    dices = new Dice[n];
    for(int j = 0; j <= n-1; j++) {
        for(int k = 1;k <= 6; k++) {
            std::cin >> dices[j].label[k];
        }
    }
    for(int i = 0; i <= n-2; i++) {
        for(int j = i+1; j <= n-1; j++) {
            if(same(dices[i], dices[j])) {
                flag = true;
            }
        }
    }
    if(flag) {
        std::cout << "No" << std::endl;
    }
    else {
        std::cout << "Yes" << std::endl;
    }
    delete[] dices;
    return 0;
}



Measured memory_bytes: 3104
import java.util.*;
import java.lang.*;
import java.math.*;

public class Main {
	Scanner sc = new Scanner(System.in);

	class cake implements Comparable<cake>{
		int w;
		int d;
		int s;

		cake a;
		cake b;

		cake(int w, int d) {
			this.w = w;
			this.d = d;
			this.s = w * d;
		}

		void cut(int si) {
			int[] wd = { w , d  };
			int oz = 0;
			while (si - wd[oz] >= 0) {
				si -= wd[oz];
				oz = oz ^ 1;
			}
			if (oz == 0) {
				if ( w -si>si) {
					a = new cake(si, d);
					b = new cake(w - si, d);
				} else {
					b = new cake(si, d);
					a = new cake(w - si, d);
				}
			} else {
				if (si < d - si) {
					a = new cake(w, si);
					b = new cake(w, d - si);
				} else {
					b = new cake(w, si);
					a = new cake(w, d - si);
				}
			}
		}

		@Override
		public int compareTo(cake arg0) {
			return this.s - arg0.s;
		}
		
		public String toString(){
			return this.w+" " + this.d;
		}
	}

	void run() {
		for (;;) {
			int n = sc.nextInt();
			int w = sc.nextInt();
			int d = sc.nextInt();

			if ((n | w | d) == 0) {
				break;
			}

			LinkedList<cake> ck = new LinkedList<cake>();
			cake root = new cake(w,d);
			ck.add(root);
			for(int i =0 ; i < n ; i++){
				int p = sc.nextInt()-1;
				int si = sc.nextInt();
				
				cake t = ck.get(p);
				ck.remove(p);
				t.cut(si);
				
				ck.add(t.a);
				ck.add(t.b);
			/*	
				System.out.println("--");
				for(int q = 0; q < ck.size();q++){
					System.out.println(ck.get(q).toString());
				}
				*/
			}
			cake[] arr = ck.toArray(new cake[0]);
			Arrays.sort(arr);
			for(int i = 0 ; i < arr.length; i++){
				if(i != 0){
					System.out.print(" ");
				}
				System.out.print(arr[i].s);
			}
			System.out.println();
		}
	}

	public static void main(String[] args) {
		Main m = new Main();
		m.run();
	}
}

Measured memory_bytes: 13000
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <array>
#include <utility>
#include <queue>
#include <tuple>
#include <map>
#include <cctype>
#include <math.h>
using namespace std;
using ll = long long;
using VI = vector<int>;


bool check(int d, int m) {
    if (d % 10 >= 2 && d / 10 >= 2 && (d % 10) * (d / 10) == m) {
        return true;
    }
    else {
        return false;
    }
}

int main()
{
    int m, d;
    cin >> m >> d;
    int ans = 0;
    for (int i = 1; i <= m; i++) {
        for (int j = 1; j <= d; j++) {
            if (check(j, i)) {
                ans++;
            }
        }
    }
    cout << ans << endl;


    return 0;
}


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

int main() {
	int	N, sw = 0;
	cin >> N;
	int p[N];
	for(int i = 0;i < N;i++){
      cin >> p[i];
      if(p[i] != i + 1) sw++;
    }
	if(sw == 0 || sw == 2) cout << "YES";
	else cout << "NO";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
ll INF = 1e9;
ll MOD = 1e9+7;
ll mod_pow(ll x, ll n)
{
    ll res = 1;
    while(n > 0)
    {
        if(n & 1) res = res * x % MOD;
        x = x * x % MOD;
        n >>= 1;
    }
    return res;
}
ll add(ll &a, ll b)
{
    a = (a+b)%MOD;
}
int main()
{
    int n;
    cin >> n;
    vector<ll> a(n);
    for(int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    vector<vector<ll>> xs(n+1, vector<ll>(65));
    for(int i = n-1; i >= 0; i--)
    {
        for(int j = 0; j < 60; j++)
        {
            if(a[i] >> j & 1)
            {
                xs[i][j] = xs[i+1][j] + 1;
            }
            else
            {
                xs[i][j] = xs[i+1][j];
            }
        }
    }
    vector<ll> ex(60);
    for(int i = 0; i < 60; i++)
    {
        ex[i] = mod_pow(2, i);
    }
    ll ans = 0;
    for(int i = 0; i < n; i++)
    {
        for(int j = 0; j < 60; j++)
        {
            if(a[i] >> j & 1)
            {
                add(ans, ex[j] * (n-1-i - xs[i+1][j]) % MOD);
            }
            else
            {
                add(ans, ex[j] * xs[i+1][j] % MOD);
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 166400
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		ArrayList<Double> x = new ArrayList<Double>();
		ArrayList<Double> y = new ArrayList<Double>();
		double g_x = 0.0;
		double g_y = 0.0;
		try {
			while (true) {
				String in[] = sc.nextLine().split(",");
				x.add(Double.parseDouble(in[0]));
				y.add(Double.parseDouble(in[1]));
				g_x += x.get(x.size() - 1);
				g_y += y.get(y.size() - 1);
			}
		} catch (Exception e) {
		}
		g_x /= x.size();
		g_y /= y.size();
		double s = 0.0;
		for (int i = 0; i < x.size(); i++) {
			double a = dist(x.get(i), y.get(i), g_x, g_y);
			double b = dist(x.get((i + 1) % x.size()),
					y.get((i + 1) % y.size()), g_x, g_y);
			double c = dist(x.get(i), y.get(i), x.get((i + 1) % x.size()),
					y.get((i + 1) % y.size()));
			double z = (a + b + c) / 2;
			s += Math.sqrt(z * (z - a) * (z - b) * (z - c));
		}
		System.out.println(s);
	}

	static double dist(double x1, double y1, double x2, double y2) {
		return Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
	}
}

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


/*高速化*/
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")


/* define */
#define ALL(V) (V).begine(),(V).end()
#define SORT(V) sort(ALL(V))
#define REV(V) reverse(ALL(V))
#define RSORT(V) SORT(V);REV(V)
#define SZ(x) ((int)(x).size())
#define rep(i,n) for(int i = 0;i < (int)(n);++i)
#define Rep(i,n) for(int i = 1;i <= (int)(n);++i)
#define Mod(n) n % 1000000007


/* 最大値と最小値に置き換える */
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;}


/* 型定義 */
typedef vector<int> vi;
typedef long long ll;
using Graph = vector<vi>;


/* 定数 */
const double PI = 3.141592;
const double e = 2.6;
const long long Inf = 1LL << 60;
const long long mInf = -Inf;


void calc()
{
    int AATk,AHp,BAtk,BHp;
    cin >> AHp >> AATk >> BHp >> BAtk;
    while(true)
    {
        BHp -= AATk;
        if(BHp <= 0)
        {
            cout << "Yes\n";
            return;
        }
        AHp -= BAtk;
        if(AHp <= 0)
        {
            cout << "No\n";
            return;
        }
    }
}


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

Measured memory_bytes: 3688
import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		Integer[] d = new Integer[N];
		for(int i = 0;i < N;i++) {
			d[i] = sc.nextInt();
		}
		Arrays.sort(d,Collections.reverseOrder());
		int max = d[0];
		int count = 1;
		for(int k = 1;k < N;k++) {
			if(max > d[k]) {
				max = d[k];
				count++;
			}
		}
		System.out.println(count);
		sc.close();
	}

}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef set<int> si;
typedef map<string, int> msi;
typedef long long ll;
const ll INF = 1e18L + 1;

bool comp(ii p1, ii p2)
{
  return (p1.first + p1.second) < (p2.first + p2.second);
}

int main()
{
  int N;
  cin >> N;
  vector<ii> pos(N);
  rep(i, N)
  {
    int a, b;
    cin >> a >> b;
    pos[i] = make_pair(a, b);
  }
  sort(pos.begin(), pos.end(), comp);

  int rightMost = pos[0].first + pos[0].second;
  int ans = N;
  for (int i = 1; i < N; i++)
  {
    if (pos[i].first - pos[i].second < rightMost)
    {
      ans--;
    }
    else
    {
      rightMost = pos[i].first + pos[i].second;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(x) (x).begin(),(x).end()
#define dup(x,y) (((x)+(y)-1)/(y))
#define sz(x) (int)(x).size()
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main(){
    int a, b;
    cin >> a >> b;
    if(a <= 5) cout << 0 << endl;
    else if(a <= 12) cout << b/2 << endl;
    else cout << b << endl;

}

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

int n;
vector<int> w;
vector<vector<int>> dp;

int rec(int l, int r)
{
  if (~dp.at(l).at(r))
  {
    return dp.at(l).at(r);
  }
  if (l == r)
  {
    return dp.at(l).at(r) = 0;
  }
  if (l + 1 == r)
  {
    if (abs(w.at(l) - w.at(r)) <= 1)
    {
      return dp.at(l).at(r) = 2;
    }
    return dp.at(l).at(r) = 0;
  }
  int tmp = 0;
  if (abs(w.at(l) - w.at(r)) <= 1 && rec(l + 1, r - 1) == r - l - 1)
  {
    tmp = r - l + 1;
  }
  for (int m = l; m < r; m++)
  {
    tmp = max(tmp, rec(l, m) + rec(m + 1, r));
  }
  return dp.at(l).at(r) = tmp;
}

int main()
{
  vector<int> ans;
  while (1)
  {
    cin >> n;
    if (!n)
    {
      break;
    }
    w.resize(n);
    for (int i = 0; i < n; i++)
    {
      cin >> w.at(i);
    }
    dp.resize(n, vector<int>(n));
    dp.assign(n, vector<int>(n, -1));
    ans.push_back(rec(0, n - 1));
  }
  for (int i = 0; i < ans.size(); i++)
  {
    cout << ans.at(i) << endl;
  }
}


Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi   = vector<int>;
using vll  = vector<ll>;
using vc   = vector<char>;
using vvll  = vector<vll>;
using vvi  = vector<vi>;
using vvc  = vector<vc>;
using vb   = vector<bool>;
using vvb  = vector<vb>;
using pii  = pair<int,int>;
using vpii = vector<pii>;
using posteriority_queue = priority_queue<int, vi, greater<int>>;


int main() {
    ll a, b, c, d; cin >> a >> b >> c >> d;
    ll tmp1, tmp2, tmp3, tmp4, ans;
    tmp1 = a * c;
    tmp2 = a * d;
    tmp3 = b * c;
    tmp4 = b * d;

    ans = max(max(tmp1, tmp2), max(tmp3, tmp4));
    cout << ans << endl;
}


Measured memory_bytes: 3640
a = list(map(int,input().split()))

sum = 0
a_3 = a[3]
a_0 = a[0]
a_1 = a[1]
a_2 = a[2]


if a_3 <= a_0:
    print (a_3)
    
elif a_3 > a_0 and a_3 <= (a_0 + a_1):
    print (a_0)
    
else:
    sum = a_0 - (a_3 - a_0 - a_1)
    print(sum)

Measured memory_bytes: 9128
#include<cstdio>
#include<cmath>
#define ri register int
#define rc register char
#define ll long long int
#define rl register long long int
#define in inline
#define gc getchar
in ll read()
{
	rl x=0,p=1;
	rc ch=gc();
	while(ch<'0' || ch>'9')
	{
		if(ch=='-')
		{
			p=-1;
		}
		ch=gc();
	}
	while(ch>='0' && ch<='9')
	{
		x=x*10+ch-'0',ch=gc();
	}
	return x*p;
}
ll a,b,c;
int main()
{
	a=read(),b=read(),c=read();
	if(a+b>=c)
	{
		puts("No");
	}
	else
	{
		ll d=(c-a-b)*(c-a-b);
		if(4*a*b<d)
		{
			puts("Yes");
		}
		else
		{
			puts("No");
		}
	}
	return 0;
}

Measured memory_bytes: 256
// "bits/stdc++.h" {{{
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <sstream>
#include <numeric>
#include <array>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <cassert>
#include <cctype>
#include <cfloat>
#include <climits>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <limits>
#include <typeinfo>
#include <initializer_list>
#include <bitset>
#include <chrono>
#include <functional>
#include <tuple>
#include <typeindex>
#include <utility>
#include <string>
#include <regex>
// }}}

// Begin {{{
using namespace std;

#define all(x) x.begin(), x.end()
#define rep(i, n) for (i64 i = 0; i < (n); ++i)
#define reps(i, s, n) for (i64 i = (s); i <= (n); ++i)
#define VAR(Type, ...) Type __VA_ARGS__; IN(__VA_ARGS__)
#define Float(x) OUTN(fixed, setprecision(x));

using i64 = int_fast64_t;
using pii = pair<i64, i64>;

template <class A, class B>
inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }

template <class A, class B>
inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

// IN
void IN() {}
template <class Head, class... Tail>
void IN(Head&& head, Tail&&... tail) {
  cin >> head;
  IN(forward<Tail>(tail)...);
}

// OUTS
void OUTS() {}
template <class Head, class... Tail>
void OUTS(Head&& head, Tail&&... tail) {
  cout << head << " \n"[sizeof...(tail)==0];
  OUTS(forward<Tail>(tail)...);
}

template <class T>
void OUTS(vector<T> &vec) { for (auto &e : vec) cout << e << " \n"[&e==&vec.back()]; }

template <class T>
void OUTS(vector<vector<T>> &df) { for (auto &vec : df) OUTS(vec); }

// OUTL
void OUTL() {}
template <class Head, class... Tail>
void OUTL(Head&& head, Tail&&... tail) {
  cout << head << "\n";
  OUTL(forward<Tail>(tail)...);
}

template <class T>
void OUTL(vector<T> &vec) { for (auto &e : vec) cout << e << "\n"; }

// OUTN
void OUTN() {}
template <class Head, class... Tail>
void OUTN(Head&& head, Tail&&... tail) {
  cout << head;
  OUTN(forward<Tail>(tail)...);
}

template <class T>
void OUTN(vector<T> &vec) { for (auto &e : vec) cout << e; }
// }}} End

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

  VAR(string, s);

  i64 res = 0;
  string t = "BW";
  for (int i = 0; i < s.length() - 1; ++i) {
    if (s.substr(i, 2) == t) ++res;
  }

  reverse(all(s));

  for (int i = 0; i < s.length() - 1; ++i) {
    if (s.substr(i, 2) == t) ++res;
  }

  OUTL(res);

  return 0;
}


Measured memory_bytes: 512
n = int(input())
A = list(map(int, input().split()))
m = min(A)
cnt = 0
while max(A) >= n:
  temp = 0
  for i in range(n):
    t = (A[i]+1)//(n+1)
    temp += t
    A[i] -= t*(n+1)
  for i in range(n):
    A[i] += temp
  cnt += temp
print(cnt)

Measured memory_bytes: 9204
// eddy1021
#include <bits/stdc++.h>
using namespace std;
typedef double D;
typedef long double LD;
typedef long long ll;
typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL,LL> PLL;
typedef pair<LD,LD> Pt;
typedef tuple<int,int,int> tiii;
typedef tuple<LL,LL,LL> tlll;
#define mod9 1000000009ll
#define mod7 1000000007ll
#define INF  1023456789ll
#define INF16 10000000000000000ll
#define FI first
#define SE second
#define X FI
#define Y SE
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define eps 1e-9
#define SZ(x) (int)(x).size()
#define ALL(x) (x).begin(), (x).end()
#ifndef ONLINE_JUDGE
#define debug(...) printf(__VA_ARGS__)
#else 
#define debug(...)
#endif
inline ll getint(){
  ll _x=0,_tmp=1; char _tc=getchar();    
  while( (_tc<'0'||_tc>'9')&&_tc!='-' ) _tc=getchar();
  if( _tc == '-' ) _tc=getchar() , _tmp = -1;
  while(_tc>='0'&&_tc<='9') _x*=10,_x+=(_tc-'0'),_tc=getchar();
  return _x*_tmp;
}
inline ll add( ll _x , ll _y , ll _mod = mod7 ){
  ll _ = _x + _y;
  if( _ >= _mod ) _ -= _mod;
  return _;
}
inline ll sub( ll _x , ll _y , ll _mod = mod7 ){
  ll _ = _x - _y;
  if( _ < 0 ) _ += _mod;
  return _;
}
inline ll mul( ll _x , ll _y , ll _mod = mod7 ){
  ll _ = _x * _y;
  if( _ >= _mod ) _ %= _mod;
  return _;
}
ll mypow( ll _a , ll _x , ll _mod ){
  if( _x == 0 ) return 1ll;
  ll _tmp = mypow( _a , _x / 2 , _mod );
  _tmp = mul( _tmp , _tmp , _mod );
  if( _x & 1 ) _tmp = mul( _tmp , _a , _mod );
  return _tmp;
}
ll mymul( ll _a , ll _x , ll _mod ){
  if( _x == 0 ) return 0ll;
  ll _tmp = mymul( _a , _x / 2 , _mod );
  _tmp = add( _tmp , _tmp , _mod );
  if( _x & 1 ) _tmp = add( _tmp , _a , _mod );
  return _tmp;
}
inline bool equal( D _x ,  D _y ){
  return _x > _y - eps && _x < _y + eps;
}
int __ = 1 , _cs;
/*********default*********/
void build(){

}
bool d[ 10 ];
int n , k;
void init(){
  n = getint();
  k = getint();
  for( int i = 0 ; i < k ; i ++ )
    d[ getint() ] = true;
}
inline bool okay( int x ){
  int tmp = x;
  if( tmp == 0 ) return !d[ 0 ];
  while( tmp ){
    if( d[ tmp % 10 ] ) return false;
    tmp /= 10;
  }
  return true;
}
void solve(){
  while( !okay( n ) ) n ++;
  printf( "%d\n" , n );
}
int main(){
  build();
  //__ = getint();
  while( __ -- ){
    init();
    solve();
  }
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
	int K, N, A[1000000] = { 0 }, max = 0;
	scanf("%d%d", &K, &N);
	for (int i = 0; i < N; i++)scanf("%d", &A[i]);
	for (int i = 0; i < N-1 ; i++) if (A[i + 1] - A[i] > max) {
		max = A[i + 1] - A[i];
	}
	if (K - A[N - 1] + A[0] > max)max = K - A[N-1] + A[0];
	printf("%d", K - max);
	return 0;
}

Measured memory_bytes: 4096
#include <stdio.h>

int
main(void)
{
        char c;
        int zero[2] = { 0 };
        int one[2] = { 0 };
        int index = 0;

        while (scanf("%c", &c) != EOF) {
                if (c == '0')
                        zero[index]++;
                else if (c == '1')
                        one[index]++;
                else
                        break;

                index ^= 1;
        }

        int max_zero = (zero[0] >= zero[1]) ? zero[0] : zero[1];
        int max_zero_index = (zero[0] >= zero[1]) ? 0 : 1;
        int max_one = (one[0] >= one[1]) ? one[0] : one[1];
        int max_one_index = (one[0] >= one[1]) ? 0 : 1;

        if (max_zero >= max_one) {
                index = max_zero_index ^ 1;
                printf("%d", zero[index] + one[max_zero_index]);
        } else {
                index = max_one_index ^ 1;
                printf("%d", one[index] + zero[max_one_index]);
        }

        return 0;
}


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

int n,m;
int a[100048];

namespace DSU
{
	int pre[100048];
	inline void init() {for (register int i=1;i<=n;i++) pre[i]=i;}
	inline int find_anc(int x) {if (pre[x]!=x) pre[x]=find_anc(pre[x]); return pre[x];}
	inline void update(int x,int y) {x=find_anc(x);y=find_anc(y);pre[x]=y;}
}

int main ()
{
	int i,x,y;
	scanf("%d%d",&n,&m);
	for (i=1;i<=n;i++) scanf("%d",&a[i]);
	DSU::init();
	for (i=1;i<=m;i++)
	{
		scanf("%d%d",&x,&y);
		DSU::update(x,y);
	}
	int ans=0;
	for (i=1;i<=n;i++) if (DSU::find_anc(i)==DSU::find_anc(a[i])) ans++;
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 1024
import java.util.*;
public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[]P = new int[N];
    int[]sin = new int[N];
    
    int cou = 0;
    for(int i=0; i<N; i++) {		
    	P[i] = sc.nextInt();
    	sin[i] = P[i]; 
    }
    Arrays.sort(sin);
    
    for(int i=0; i<N; i++) {
    if(P[i]!=sin[i]) {
    		cou++;
    	}
    }
      if(cou<=2){
        System.out.println("YES");
      }else{
        System.out.println("NO");        
      }
      }
}

Measured memory_bytes: 35712
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back

void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}

void No(){
	cout<<"No"<<endl;
	exit(0);
}

int main(){
  int N;
  cin>>N;
  bool ok;
  ll seq1[60];
  
  rep(i,N){
    seq1[i]=i+1;
  }
  
  ll seq2[60];
  
  rep(i,N){
    cin>>seq2[i];
  }
  ok=true;
  rep(i,N){
      if(seq1[i]!=seq2[i])
        ok=false;
  }
  if(ok)
    cout<<"YES"<<endl;
  
  if(!ok){
      
        
        
  rep(i,N-1){
    for(int j=i+1;j<N;j++){
      ok=true;
      swap(seq2[i],seq2[j]);
      rep(k,N){
        if(seq1[k]!=seq2[k])
          ok=false;
      }
      if(ok){
        cout<<"YES"<<endl;
        break;
      }
      swap(seq2[i],seq2[j]);
    }
    if(ok)
      break;
  }
    
  }
  if(!ok)
    cout<<"NO"<<endl;
}
    



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

if m==0:
    print(0,0)
    import sys
    sys.exit()

p=[list(input().split()) for _ in range(m)]
correct=set([p[i][0] for i in range(m) if p[i][1]=='AC'])

sum_wa=0
data=[0]*n

for i in range(m):
    if p[i][0] in correct and data[int(p[i][0])-1]==0:
        if p[i][1]=='WA':
            sum_wa+=1
        else:
            data[int(p[i][0])-1]=1

print(sum(data),sum_wa)

Measured memory_bytes: 37260
#include "stdio.h"
#include <iostream>
int main (){
 int number = -1;
 while (number < 0 || number>100) {
  //printf ("Please input the number of the children\n");
  scanf ("%d",&number);
  if (number > 100 || number < 0) {
   //printf("Please check the number you input\n");
  }
 }
 int sum = 0;
 for (int i = 0; i < number; i++) {
  sum = sum + i + 1;
 }
 //printf("The number of candies needed is");
 printf("%d", sum);
 return 0;
 }

Measured memory_bytes: 256
S = input()
N = len(S)

from collections import Counter
chars = [chr(i) for i in range(ord('a'), ord('z')+1)]

def check(arr):
    e = arr[0]
    return len(arr) == arr.count(e)


ans = float('inf')
for c in chars:
    SL = list(S)
    cnt = 0
    while not check(SL):
        for i, si in enumerate(SL):
            if i == 0:
                continue
            if si == c:
                SL[i-1] = c
        SL = SL[:-1]
        cnt += 1
        # print(SL)
    ans = min(ans, cnt)

print(ans)

Measured memory_bytes: 3444
N, D = map(int, input().split())
X = [0] * N
Y = [0] * N
cnt = 0
for i in range(N):
    x, y = map(int, input().split())
    X[i] = x
    Y[i] = y
    if x ** 2 + y ** 2 <= D ** 2:
        cnt += 1
print(cnt)

Measured memory_bytes: 24624
import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)
INF = 10**30

def main():
    n = int(input().strip())
    if n == 0:
        print(0)
        return
    ans = ''
    c = 0
    while n != 1:
        c += 1
        s, a = divmod(n, -2)
        # print(s, a)
        if a == -1:
            s += 1
            a = 1
        ans += str(a)
        n = s
    ans += '1'
    print(''.join(reversed(ans)))

if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
int main(){
  int c[9];string ans="No";
  for(int i=0;i<9;i++)cin>>c[i];
  if(c[0]+c[4]==c[1]+c[3]){
    if(c[1]+c[5]==c[2]+c[4]){
      if(c[3]+c[7]==c[4]+c[6]){
        if(c[4]+c[8]==c[5]+c[7]){
          ans="Yes";
        }
      }
    }
  }
  cout<<ans;     
}

Measured memory_bytes: 256
def main():
    week = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"]
    s = input()
    indx = week.index(s)
    diff = 7 - indx
    if diff == 0:
        diff = 7
    print(diff)


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
#include <iostream>
#include <cmath>

using namespace std;

typedef long long ll;
#define x first
#define y second
#define mp make_pair

const int MAXN = (int)2e5;
int n;
ll a[MAXN + 5];

int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n;
ll ostalo = 0;
for(int i = 0 ; i < n ; ++i){
	cin >> a[i];
	ostalo += a[i];
}
ll sol = ostalo;
ll sad = 0;
for(int i = 0 ; i < n ; ++i){
	ostalo -= a[i];
	sad += a[i];
	sol = min(sol, abs(sad - ostalo));
}
cout << sol << endl;

return 0;
}



Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
const long long INF = 1e15;

ll n;
vector<long long> a;

long long solve(ll x){
  ll ret = 0;
  for(ll i = 0; i < n; i++) ret += (a[i]+x-1)/x-1;
  return ret;
}

int main(){
  ll k;
  cin >> n >> k;
  a.resize(n);
  for(ll i = 0; i < n; i++) cin >> a[i];
  ll right = 1e9+1,left = 0,mid;
  sort(a.begin(),a.end(),greater<int>());
  if(k == 0){
    cout << a[0] << endl;
    return 0;
  }
  while(right-left > 1){
    mid = (right+left)/2;

    ll cnt = solve(mid);
    //cout << mid << " " << cnt << " " << left << " " << right << endl;
    if(cnt > k) left = mid;
    else right = mid;
  }
  cout << right << endl;
  return 0;
}

Measured memory_bytes: 4748
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define sz(a) (int)a.size()
#define de(a) cout<<#a<<" = "<<a<<endl
#define dd(a) cout<<#a<<" = "<<a<<" "
#define all(a) a.begin(), a.end()
#define pw(x) (1ll<<(x))
typedef long long ll;
typedef double db;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int P = 1e9 + 7;
inline int add(int a, int b) {if((a += b) >= P) a -= P; return a;}
inline int sub(int a, int b) {if((a -= b) < 0) a += P; return a;}
inline int mul(int a, int b) {return 1ll * a * b % P;}
inline int kpow(int a, int b) {int r=1;for(;b;b>>=1,a=mul(a,a)) {if(b&1)r=mul(r,a);}return r;}
//----
int a, b, c;
int main(){
	scanf("%d%d%d", &a, &b, &c);
	int o, e;o = e = 0;
	o += a & 1;
	o += b & 1;
	o += c & 1;
	e += !(a & 1);
	e += !(b & 1);
	e += !(c & 1);
	int ans = 0;
	if(o == 2 || e == 2) {
		ans = 1;
		if(o == 2) {
			if(a & 1) a++;
			if(b & 1) b++;
			if(c & 1) c++;
		} else {
			if(a % 2 == 0) a++;
			if(b % 2 == 0) b++;
			if(c % 2 == 0) c++;
		}
	}
	int t = max(a, max(b, c));
	ans += (t - a) / 2 + (t - b) / 2 + (t - c) / 2;
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<vector>
#include<string>
#include<queue>
#include<set>
#include<map>
#include<algorithm>
#include<functional>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll, int> plli;
typedef pair<int, pii> pipii;
typedef vector<vector<int> > mati;
typedef vector<vector<double> > matd;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)

template <typename T>
void vec_print(vector<T> VEC){
  REP(i, VEC.size()){
    cout << VEC[i] << " ";
  }
  cout << "\n";
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  REP(i, MAT.size()){
    REP(j, MAT[i].size()){
      cout << MAT[i][j] << " ";
    }
    cout << "\n";
  }
};

template <typename CLASS1, typename CLASS2>
class HOGE{
  public:
    CLASS1 key;
    CLASS2 value;
    HOGE(void){
      return;
    };
    HOGE(CLASS1 key, CLASS2 value){
      this->key = key;
      this->value = value;
    };
    ~HOGE(void){
      return;
    };

    void print(void){
      cout << "key : " << key << ", value : " << value << "\n";
      return;
    };
    
    bool operator==(const HOGE &obj){
      return (this->value == obj.value);
    };
    bool operator<(const HOGE &obj){
      return (this->value < obj.value);
    };
    bool operator>(const HOGE &obj){
      return (this->value > obj.value);
    };
};

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;
constexpr ll MOD = (ll)((1E+9)+7);

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  vll a(3), b(3);
  vll c(4, 0);
  REP(i, 3){
    cin >> a[i] >> b[i];
    c[a[i]-1]++;
    c[b[i]-1]++;
  }

  ll c_max = 0;
  REP(i, 4){
    c_max = max(c_max, c[i]);
  }

  if(c_max>=3){
    cout << "NO\n";
  }else{
    cout << "YES\n";
  }

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define itn int
#define REP(i, n) for (ll i = 0; i < n; i++)
#define IREP(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define all(v) v.begin(), v.end()
#define pb(a) push_back(a)
#define SENTINEL 2000000000
#define NIL -1
using namespace std;
typedef long long ll;

const ll MAX = 510000;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
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;}
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
typedef long long ll;
class UnionFind
{
public:
    vector<ll> par; // 各元の親を表す配列
    vector<ll> siz; // 素集合のサイズを表す配列(1 で初期化)

    // Constructor
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1)
    {
        for (ll i = 0; i < sz_; ++i)
            par[i] = i; // 初期では親は自分自身
    }
    void init(ll sz_)
    {
        par.resize(sz_);
        siz.assign(sz_, 1);
        for (ll i = 0; i < sz_; ++i)
            par[i] = i; // 初期では親は自分自身
    }

    // Member Function
    // Find
    ll root(ll x)
    { // 根の検索
        while (par[x] != x)
        {
            x = par[x] = par[par[x]]; // x の親の親を x の親とする
        }
        return x;
    }

    // Union(Unite, Merge)
    bool merge(ll x, ll y)
    {
        x = root(x);
        y = root(y);
        if (x == y)
            return false;
        // merge technique（データ構造をマージするテク．小を大にくっつける）
        if (siz[x] < siz[y])
            swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y)
    { // 連結判定
        return root(x) == root(y);
    }

    ll size(ll x)
    { // 素集合のサイズ
        return siz[root(x)];
    }
};
int main()
{
    int n,m;
    cin >> n >> m;
    UnionFind uf(n);
    uf.init(n);
    set<int> pa;
    REP(i,m){
        int a,b;
        cin >> a >> b;
        a--;b--;
        uf.merge(a,b);
    }
    REP(i,n){
        pa.insert(i);
    }
    ll ans=0;
    for(auto& i:pa){
        chmax(ans,uf.size(i));
    }
    cout << ans << endl;
}


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

using namespace std;

int main(){
    string input;
    cin >> input;

    for(int i=0; i<input.size(); i++){
        if(i+1<input.size() and input[i+1] == input[i]){
            cout << i+1 << " " << i+2;
            return 0;
        }

        if(i+2<input.size() and input[i+2] == input[i]){
            cout << i+1 << " " << i+3;
            return 0;
        }
    }

    cout << "-1 -1";

}






Measured memory_bytes: 512
import collections
n = int(input())
v = list(map(int,input().split()))
ve = [v[2*i] for i in range(n//2)]
vo = [v[2*i + 1] for i in range(n//2)]
Cve = collections.Counter(ve)
Cvo = collections.Counter(vo)
Cve1 = Cve.most_common()[0]
Cvo1 = Cvo.most_common()[0]
if len(Cve) == 1 and len(Cvo) == 1: #eo両方1種類
    if Cve1[0] == Cvo1[0]: ans = n//2 #eo top同じ
    else: ans = 0 #eo異なる
elif len(Cve) == 1 and len(Cvo) > 1: #eのみ1種類
    Cvo2 = Cvo.most_common()[1]
    if Cve1[0] == Cvo1[0]: ans = n//2 - Cvo2[1] #eo top同じ
    else: ans = n//2 - Cvo1[1] #eo top異なる
elif len(Cve) > 1 and len(Cvo) == 1: #oのみ1種類
    Cve2 = Cve.most_common()[1]
    if Cve1[0] == Cvo1[0]: ans = n//2 - Cve2[1] #eo top同じ
    else: ans = n//2 - Cve1[1] #eo top異なる
else:
    Cve2 = Cve.most_common()[1]
    Cvo2 = Cvo.most_common()[1]
    if Cve1[0] != Cvo1[0]: ans = n - Cve1[1] - Cvo1[1] #top異なる
    if Cve1[0] == Cvo1[0]:
        if Cve1[1] < Cvo1[1]: ans = n - Cve2[1] - Cvo1[1]
        elif Cve2[1] > Cvo2[1] : ans = n - Cve2[1] - Cvo1[1]
        else: ans = n - Cve1[1] - Cvo2[1]
print(ans)

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

int main() {
    string s;
    cin >> s;
    for (int i=0;i<(s.size()-1)/2; i++) {
        if (s[i] != s[s.size() -1 - i]) {
            printf("No\n"); return 0;
        }
    }

    string sub = s.substr(0,(s.size() -1)/2);
    if(sub.size() == 1) {
        printf("Yes\n");
        return 0;
    } else if (sub.size() == 2) {
        if (sub[0] == sub[1]) { printf("Yes\n"); return 0; }
        else { printf("No\n"); return 0; }
    }
    
    for (int i=0;i<(sub.size()+1)/2;i++) {
        if (sub[i] != sub[sub.size() -1 -i]) { printf("No\n"); return 0; }
    }
    printf("Yes\n");
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[22][12];
int n,d;
const int N=1e8+5;
bool mark[N];
int prim[N];
int cnt;
void initial()
{
    cnt=0;
    for (int i=2 ; i<N ; ++i)
    {
        if (!mark[i])
            prim[cnt++]=i;
        for (int j=0 ; j<cnt && i*prim[j]<N ; ++j)
        {
            mark[i*prim[j]]=1;
            if (!(i%prim[j]))
                break;
        }
    }
}
int coutt(int i,int j)
{
	long long sum=0;
	for(int ii=0;ii<d;ii++)
	{
		sum+=(a[i][ii]-a[j][ii])*(a[i][ii]-a[j][ii]);
	}
//	cout<<i<<' '<<j<<' '<<sqrt(sum)<<endl;
	int qq=0;
	while(sum>=prim[qq])
	{
		while(sum%prim[qq]==0)
		{
			
			if(sum%(prim[qq]*prim[qq])==0) 
			{
//				qq++;
				sum/=(prim[qq]*prim[qq]);
//				continue;
			}
			else return 0;
		}
//		if()
//		else 
		qq++;
	}
	return 1;
//	if(sum-sqrt(sum)*sqrt(sum)==0) return 0;
//	else return 0;
//	
	
}
int main()
{
	
	cin>>n>>d;
//	printf("n=%d d=%d\n",n,d);
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<d;j++)
		{
//			scanf("%d",&a[i][j]);
			cin>>a[i][j];
		}
	}
//	getchar();
//	getchar();
//	for(int i=0;i<n;i++)
//	{
//		for(int j=0;j<d;j++)
//		{
////			printf("%d%c",a[i][j],i==n-1?'\n':' ');
//			cout<<a[i][j];
//			
//		}
//		cout<<endl;
//	}
	initial();
	int summ=0;
	for(int i=0;i<n-1;i++)
	{
		for(int j=i+1;j<n;j++)
		{
			if(coutt(i,j)==1) 
			{
			summ++;
//			cout<<i<<' '<<j<<endl;
			}
		}
	}
	cout<<summ<<endl;
	
}


Measured memory_bytes: 122112
#include <iostream>

using namespace std;

int main()
{
    int a,b,cost;
    cin>>a>>b;
    if(a >= 13)
    {
        cost = b;
    }
    else if (a<13 && a>= 6)
    {
        cost = b/2;
    }else
    {
        cost = 0;
    }
    cout<<cost<<endl;
    return 0;
}


Measured memory_bytes: 256
program name
    implicit none
    integer(4):: n,i,ans
    character(200):: s

    read*, s(:)
    n = len_trim(s)
    ans = 0
    do i=1,n/2-1
        if (s(1:i) == s(i+1:2*i)) ans=max(ans,i)
    end do
    print*, ans*2
end program name

Measured memory_bytes: 256
function Main(input) {
	var data = input.split("\n")
	var n = parseInt(data[0]);
    var num = data[1].split(" ").map((n) => parseInt(n, 10));
    num.unshift(num[0])
    num.push(num[n-1])
    var sum = 0;
    
    for(var i=0; i < n; i++){
    	sum += Math.min(num[i],num[i+1]);
    }
    console.log(sum)
}
 
// Don't edit this line!
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include <bits/stdc++.h>
#define int long long
using namespace std;

int n,cnt=0;
int head[200005],c[200005];

struct edge
{
	int next;
	int to;
	int dis;
}e[500005];

inline void add_edge(int u,int v,int w)
{
	cnt++;
	e[cnt].to=v;
	e[cnt].dis=w;
	e[cnt].next=head[u];
	head[u]=cnt;
}

inline void dfs(int now,int fath,int dis)
{
	if (dis%2==1)  c[now]=(c[1]+1)%2;
	for (int i=head[now];i;i=e[i].next)
	{
		if (e[i].to!=fath)  dfs(e[i].to,now,dis+e[i].dis);
	}
}

signed main()
{
	cin>>n;
	for (int i=1;i<n;i++)
	{
		int u,v,w;
		cin>>u>>v>>w;
		add_edge(u,v,w);
		add_edge(v,u,w);
	}
	dfs(1,0,0);
	
	for (int i=1;i<=n;i++)  cout<<c[i]<<' ';
	cout<<endl;
	
	return 0;
}

Measured memory_bytes: 12032
#076-C
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
s=S()
t=S()
rest=False
ii=0
for i in range(len(s)-len(t)+1):
    for j in range(len(t)):
        if s[i+j]!=t[j] and s[i+j]!="?":
            break
    else:
        rest=True
        ii=i
if rest:
    for j in range(len(t)):
        s[ii+j]=t[j]
    for i in range(len(s)):
        if s[i]=="?":
            s[i]="a"
    for i in range(len(s)):
        print(s[i],end="")
else:
    print("UNRESTORABLE")

Measured memory_bytes: 3064
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int main(){
    int N; R(N);
    string s;
    R(s);
    REP(i,SZ(s)){
        int v=s[i]-'A';
        v=(v+N)%26;
        s[i]='A'+v;
    }
    W(s);
    return 0;
}


Measured memory_bytes: 384