akhauriyash/Code-Regression huggingface dataset:
package main

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

var sc *bufio.Scanner
var out *bufio.Writer

const INF = 1 << 30

func main() {
	sc = bufio.NewScanner(os.Stdin)
	//bytes, _ := ioutil.ReadFile("./stdin.txt")
	//sc = bufio.NewScanner(strings.NewReader(string(bytes)))
	out = bufio.NewWriter(os.Stdout)
	buf := make([]byte, 1<<20)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
	defer out.Flush()

	N, Q := nextInt(), nextInt()
	G := make([][]int, N+1)
	counter := make([]int, N+1)
	for i := 0; i < len(G); i++ {
		G[i] = []int{}
	}
	for i := 0; i < N-1; i++ {
		a, b := nextInt(), nextInt()
		G[a] = append(G[a], b)
		G[b] = append(G[b], a)
	}
	for i := 0; i < Q; i++ {
		p, x := nextInt(), nextInt()
		counter[p] += x
	}

	u := 1
	stack := append([]int{}, u)
	visited := make([]bool, N+1)
	visited[u] = true
	for len(stack) > 0 {
		u, stack = stack[len(stack)-1], stack[:len(stack)-1]
		for _, v := range G[u] {
			if visited[v] {
				continue
			}
			visited[v] = true
			counter[v] += counter[u]
			stack = append(stack, v)
		}
	}

	for i := 1; i <= N; i++ {
		fmt.Fprint(out, counter[i])
		if i == N {
			fmt.Fprintln(out, "")
		} else {
			fmt.Fprint(out, " ")
		}
	}
}

func next() string {
	sc.Scan()
	return sc.Text()
}
func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}
func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func cond(condition bool, t, f int) int {
	if condition {
		return t
	}
	return f
}
func abs(a int) int { return cond(a < 0, -a, a) }
func min(a ...int) int {
	ret := a[0]
	for i := 1; i < len(a); i++ {
		chmin(&ret, a[i])
	}
	return ret
}
func max(a ...int) int {
	ret := a[0]
	for i := 1; i < len(a); i++ {
		chmax(&ret, a[i])
	}
	return ret
}
func chmin(a *int, b int) { *a = cond(*a < b, *a, b) }
func chmax(a *int, b int) { *a = cond(*a > b, *a, b) }


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

using ll = long long;
using pii = pair<int, int>;
template <class T>
using v = vector<T>;
template <class T>
using vv = v<v<T>>;
#define ALL(c) (c).begin(), (c).end()

int main()
{
    int N;
    cin >> N;
    v<int> a(N);

    int tgt = 0;
    for (int i = 0; i < N; i++)
    {
        cin >> a[i];
        tgt += a[i];
    }

    tgt = round((double)tgt/N);

    ll ans = 0;
    for (int i = 0; i < N; i++)
        ans += (int)floor(pow(tgt-a[i],2));
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3688
H, W, K = map(int,input().split())
c_list = [[]]*H

for i in range(H):
    c_list[i] = input()
    c_list[i] = list(c_list[i])

ans = 0
for a in range(2 ** H):
    for b in range(2 ** W):
        black = 0
        for i in range(H):
            for j in range(W):
                if ((a >> i) & 1) and ((b >> j) & 1) and c_list[i][j] == str("#"):
                    black += 1
        if black == K:
            ans += 1

print(ans)

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

int main () {
    int n, k ;
    int x = 1 ;
    
    cin >> n >> k ;
    
    for ( int i = 0 ; i < n ; i++ ) {
        if( x*2 < x + k )
            x = x* 2 ;
        else
            x = x + k ;
    }
    
    cout << x << endl ;
    
    return 0 ;
}

Measured memory_bytes: 256
h, w = [int(i) for i in input().split()]
lst = []
for i in range(h):
    lst.append(input())

for i in range(h+2):
    if i == 0:
        print("#" * (w + 2))
for i in lst:
    ans = "#" + i + "#"
    print(ans)

print("#" * (w + 2))


Measured memory_bytes: 3060
n = int(input())
a = list(map(int, input().split()))
s = [0]
ans = 0
MOD = 1000000007
for i in range(0, n, 1):
    s.append((s[i] + a[i]) % MOD)

for i in range(0, n, 1):
    ans += ((s[n] - s[i + 1]) * a[i]) % MOD

print(ans % MOD)


Measured memory_bytes: 31256
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;
import java.util.stream.IntStream;

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

		long n = stdIn.nextInt();
		long k = stdIn.nextLong();

		Transporter transporter = new Transporter();
		IntStream.rangeClosed(1, (int) n).forEach(i -> transporter.add(i, stdIn.nextLong()));

		System.out.println(transporter.simulate(k));

		stdIn.close();
	}
}

class Transporter {
	private Map<Long, Long> map = new HashMap<>();

	public long simulate(long k) {
		List<Long> periods = period();

		//周期
		long lastNo = periods.get(periods.size()-1);
		long lastIndex = periods.size() -1;
		long firstIndex = getFirstIndex(periods, lastNo);
		long periodNo = lastIndex - firstIndex;

		long distFromPeriod = firstIndex;

		if(k <= distFromPeriod) {
			return move(1, k);
		}

		return move(lastNo, (k-distFromPeriod) % periodNo);

	}

	public long getFirstIndex(List<Long> periods, long no) {
		long index = 0;

		for (Long p : periods) {
			if(p == no) {
				return index;
			}
			index++;
		}
		return -1;

	}

	public long move(long init, long n) {
		for (long i = 0; i < n; i++) {
			init = get(init);
		}

		return init;
	}

	public void add(long start, long end) {
		map.put(start, end);
	}

	public long get(long no) {
		return map.get(no);
	}

	public List<Long> period() {
		List<Long> trajectory = new ArrayList<>();
		Set<Long> set = new LinkedHashSet<>();

		long current = 1;
		trajectory.add(current);
		set.add(current);

		while (true) {
			current = get(current);

			trajectory.add(current);

			if(set.contains(current)) {
				return trajectory;
			}

			set.add(current);

		}
	}
}

Measured memory_bytes: 96756
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define Rep(i, r, n) for (ll i = r; i < n; i++)
#define pb push_back
#define MOD 1000000007
#define INF 1000000000
#define EPS 0.0000000001
typedef long long ll;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    //---------------------------------------------
    
    ll n,k;
    cin>>n>>k;
    ll count=0;
    ll a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    vector<int> x(n);
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(a[i]>a[j]){
                x[i]++;
            }
        }
        //cout<<x[i]<<endl;
        count+=x[i];
        count%=MOD;
    }

    ll memo=0;
    for(int i=0;i<n-1;i++){
        for(int j=i+1;j<n;j++){
            if(a[i]<a[j]){
                memo++;
            }
        }
    }
    memo%=MOD;
    memo=(memo*k)%MOD;
    ll C=k*(k+1)/2;
    C%=MOD;
    ll ans=(C*count%MOD)-memo;
    if(ans<0){
        ans+=MOD;
    }


    //cout<<count<<endl;
    
    
    cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {

    private int h;
    private int w;
    private int k;
    private final long mod = 1_000_000_007L;
    
    public static void main(String[] args) {
	Main m = new Main();
	m.solve();
    }

    private void set() {
	try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
		String[] p = br.readLine().split(" ");
		h = Integer.parseInt(p[0]);
		w = Integer.parseInt(p[1]);
		k = Integer.parseInt(p[2]);
	} catch(IOException e) {
	    e.printStackTrace();
	}
    }
    
    private void solve() {
	set();
	long[][] a = new long[h+1][w+2];
	a[0][1] = 1;
	long[] f = new long[w+2];
	f[0] = 0; f[1] = f[2] = 1;
	for (int i=3;i<w+2;i++) f[i] = f[i-1] + f[i-2];
	for (int i=1;i<h+1;i++) for (int j=1;j<w+1;j++) a[i][j] = (f[j-1]*f[w-j+1]*a[i-1][j-1]%mod + f[j]*f[w-j+1]*a[i-1][j]%mod + f[j]*f[w-j]*a[i-1][j+1]%mod) % mod;
	System.out.println(a[h][k]);
    }

}

Measured memory_bytes: 22484
#include <stdio.h>

int main(void) {
  int pow2[10] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};
  int w, i, j, ans[10];

  while (scanf("%d", &w) != EOF) {
    for (i = 0; i < 10; i++)
      ans[i] = 0;
    j = 0;
    
    if (w == 0) putchar('\n');
    else {
      for (i = 9; i >= 0; i--) {
	if (w / pow2[i]) {
	  ans[j] = pow2[i];
	  w %= pow2[i];
	  j++;
	}
      }
      
      printf("%d", ans[j-1]);
      for (i = j - 2; i >= 0; i--)
	printf(" %d", ans[i]);
      putchar('\n');
    }
  }
  return 0;
}

Measured memory_bytes: 600
#include <stdio.h>
#define MAX 100000


int n;
int k;
int W[MAX];

int check(int P){
	int i=0;
	for(int j=0;j<k;j++){
		int s=0;
		while(s+W[i]<=P){
			s+=W[i];
			i++;
			if(i==n)return n;
		}
	}
	return i;
}

int solve(){
	int left =0;
	int right =100000*100000;
	int mid;
	
	while (right-left>1){
		mid=(left+right)/2;
		int v=check(mid);
		if(v>=n){
			right=mid;
		}else{
			left =mid;
		}
	}
	return right;
}

int main(void){
	scanf("%d",&n);
	scanf("%d",&k);
	
	for(int i=0;i<n;i++){
		scanf("%d",&W[i]);
	}
	
	int ans=solve();
	
	printf("%d\n",ans);
	return 0;
}


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

namespace _0060
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                string s = Console.ReadLine();
                if (string.IsNullOrEmpty(s)) break;
                int[] x = s.Split().Select(int.Parse).ToArray();
                List<int> list = new List<int>();
                for (int i = 1; i <= 10; i++) list.Add(i);
                for (int i = 0; i < 3; i++) list.Remove(x[i]);
                int ret = 0;
                foreach (var item in list)
                {
                    if (x[0] + x[1] + item <= 20) ret++;
                }
                Console.WriteLine(ret >= 4 ? "YES" : "NO");
            }
        }
    }
}


Measured memory_bytes: 9876
/***"In the name of Allah(swt), the most gracious, most merciful. Allah(swt) blesses with knowledge whom he wants."***/
/*** "ALHAMDULILLAH for Everything..." ***/
#include<bits/stdc++.h>
using namespace std;
#define  fastt       ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define  ll         long long
#define  debug      printf("Come here!")
#define  inf        1000000000000000000
#define  pb         push_back
#define  mp         make_pair
#define  sz(a)      a.size()
#define  mem(a,b)   memset(a,b,sizeof(a))
#define  clr(x)     x.clear()
#define  ff         first
#define  ss         second
#define  case(x)    cout << "Case " << x <<": "

#define  md         1000000007
#define  pi         acos(-1.0)
#define  cos(a)     cos(a*pi/180)
#define  sin(a)     sin(a*pi/180)
#define  tan(a)     tan(a*pi/180)
#define  cosi(a)    acos(a)/(pi/180)
#define  sini(a)    asin(a)/(pi/180)
#define  tani(a)    atan(a)/(pi/180)

#define  vl         vector <ll>
#define  vs         vector <string>
#define  vc         vector <char>
#define  vpll       vector < pair <ll, ll> >
#define  vpsl       vector < pair <string, ll> >
#define  vpls       vector < pair <ll, string> >
#define  pql        priority_queue<ll>
#define  minpql     priority_queue<ll,vector<ll>,greater<ll> >

#define  setbits(x)     __builtin_popcountll(x)
#define  zerobits(x)    __builtin_ctzll(x)

#define toll(a) atoll(a.c_str())
string tostr(ll a) {stringstream rr;rr<<a;return rr.str();}
ll pow(ll c,ll d){return d==0?:c*pow(c,d-1);}
ll gcd(ll a,ll b) {return b==0? a:gcd(b,a%b);}
ll lcm(ll a,ll b) {return ((a*b)/gcd(a,b));}

/* mpp.max_load_factor(0.25); mpp.reserve(1024); */
/* cout << fixed << setprecision(12);*/

int main()
{

    ll n, m, k, i, j, x, y, p=0, h, f=0;
    string s;
    cin>>n;
    cin>>s;
    for(i=0; i<s.size(); i++){
        if(s[i]=='R')p++;
    }
    for(i=p; i<s.size(); i++){
        if(s[i]=='R')f++;
    }
    cout<<f<<endl;
    return 0;
}



Measured memory_bytes: 3760
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x) x
#define rep(...) MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c) c.begin(),c.end()
#define mp make_pair
#define write(x) cout<<(x)<<"\n"
using namespace std; typedef long long ll;
typedef vector<int> vi; typedef vector<ll> vll; template<class T>using vv = vector<vector<T>>;
template<class T>vv<T> vvec(size_t n, size_t m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T>bool chmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
template<class T>bool chmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 28, MOD = int(1e9) + 7; constexpr ll LINF = 1ll << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); }; }aaaa;

int main() {
    int A, B;
    cin >> A >> B;
    const int K = 50;

    vector<string> grid(2 * K, string(2 * K, '.'));
    rep(h, K, 2 * K) {
        rep(w, 2 * K) grid[h][w] = '#';
    }
    A--;
    B--;

    for (int h = 0; h < K; h += 2) {
        for (int w = 0; w < 2 * K; w += 2) {
            if (B) B--, grid[h][w] = '#';
        }
    }
    for (int h = K + 1; h < 2 * K; h += 2) {
        for (int w = 0; w < 2 * K; w += 2) {
            if (A) A--, grid[h][w] = '.';
        }
    }

    cout << 2 * K << " " << 2 * K << endl;
    rep(h, 100) {
        write(grid[h]);
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
main()
{
   int i,j,k,l;
    while(cin>>l){
  int x[l];
  for(i=0;i<l;i++)cin>>x[i];
  k=0;
  j=1; int a=0,b=0;
  for(i=0;i<l;i++){
    if(x[i]==j){  a++;  j++;  }
  }
  k=l-a;
  if(a==0) cout<<"-1"<<endl;
  else cout<<k<<endl;
    } return 0;

}


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

using namespace std;
using ll = long long;
using vl = vector<ll>;
using pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0, xxx_rep_end = (n); i < xxx_rep_end; ++i)
#define all(x) (x).begin(), (x).end()

template <class T1, class T2>
inline void chmax(T1 &a, const T2 &b)
{
    if (a < b)
    {
        a = b;
    }
}
template <class T1, class T2>
inline void chmin(T1 &a, const T2 &b)
{
    if (a > b)
    {
        a = b;
    }
}

constexpr ll INF = 0x3f3f3f3f3f3f3f3fLL;

int main()
{
    ll N, D;
    cin >> N >> D;
    ll ans = 0;

    rep(i, N)
    {
        ll x, y;
        cin >> x >> y;
        if (x * x + y * y <= D * D)
        {
            ++ans;
        }
    }
    cout << ans << endl;
}

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

int main() {
    int N;
    cin >> N;
    string S;
    cin >> S;
    int cost[N] = {0};
    // leader: 0
    for (int i = 1; i < N; i++) {
        if (S[i] == 'E') cost[0]++;
    }
    int min_val = cost[0];
    for (int i = 1; i < N; i++) {
        cost[i] = cost[i-1];
        if (S[i-1] == 'W') cost[i]++;
        if (S[i] == 'E') cost[i]--;
        if (min_val > cost[i]) min_val = cost[i];
    }
    cout << min_val << endl;
    return 0;
}


Measured memory_bytes: 1796
#include<map>
#include<queue>
#include<string>
#include<iostream>
using namespace std;
int n,m,Max=0;
string S;
map<string,int>Count;
map<string,bool>vis;
queue<string>Q;
int main() {
	cin>>n;
	for(int i=1;i<=n;i++) {
		cin>>S;
		Count[S]++;
		if(!vis[S]) {
			Q.push(S);
			vis[S]=true;
		}
	}
	cin>>m;
	for(int i=1;i<=m;i++) {
		cin>>S;
		Count[S]--;
		if(!vis[S]) {
			Q.push(S);
			vis[S]=true;
		}
	}
	while(!Q.empty()) {
		string s=Q.front();Q.pop();
		if(Count[s]>Max) Max=Count[s];
	}
	printf("%d\n",Max);
}


Measured memory_bytes: 256
#include<stdio.h>

struct DICE {
		int data;
		struct DICE *N;
		struct DICE *E;
		struct DICE *S;
		struct DICE *W;
		struct DICE *B;
		};

struct DICE *turn(struct DICE *NOW,char com);
int dice_check(struct DICE *NOW,struct DICE *A);

int main(void){
struct DICE A[6],B[6],*NOW;
int i,up,front;

for(i=0;i<6;i++){
	scanf("%d",&A[i].data);
}
A[0].N=&A[4];
A[0].E=&A[2];
A[0].S=&A[1];
A[0].W=&A[3];
A[0].B=&A[5];

for(i=0;i<6;i++){
	scanf("%d",&B[i].data);
}
B[0].N=&B[4];
B[0].E=&B[2];
B[0].S=&B[1];
B[0].W=&B[3];
B[0].B=&B[5];

NOW=&B[0];
up=A[0].data;
front=A[0].S->data;

while(1){
for(i=0;i<4;i++){
if(NOW->S->data==front){break;}
    NOW=turn(NOW,'S');
}
if(i==4){NOW=turn(NOW,'E');}else{break;}
}
for(i=0;i<4;i++){
if(NOW->data==up){break;}
    NOW=turn(NOW,'E');
}
if(dice_check(NOW,&A[0])!=0){printf("Yes\n");}else{printf("No\n");}

return 0;
}

struct DICE *turn(struct DICE *NOW,char com){
	struct DICE *TEMP;
	TEMP=NOW;
	switch(com){
	case 'N':
		NOW=NOW->S;
		NOW->N=TEMP;
		NOW->S=TEMP->B;
		NOW->E=TEMP->E;
		NOW->W=TEMP->W;
		NOW->B=TEMP->N;
		break;
	case 'S':
		NOW=NOW->N;
		NOW->N=TEMP->B;
		NOW->S=TEMP;
		NOW->E=TEMP->E;
		NOW->W=TEMP->W;
		NOW->B=TEMP->S;
		break;
	case 'E':
		NOW=NOW->W;
		NOW->N=TEMP->N;
		NOW->S=TEMP->S;
		NOW->E=TEMP;
		NOW->W=TEMP->B;
		NOW->B=TEMP->E;
		break;
	case 'W':
		NOW=NOW->E;
		NOW->N=TEMP->N;
		NOW->S=TEMP->S;
		NOW->E=TEMP->B;
		NOW->W=TEMP;
		NOW->B=TEMP->W;
		break;
	}
	return(NOW);
}
int dice_check(struct DICE *NOW,struct DICE *A){

	if(NOW->data==A->data && NOW->S->data==A->S->data && NOW->N->data==A->N->data && NOW->E->data==A->E->data && NOW->W->data==A->W->data && NOW->B->data==A->B->data){return 1;}else{return 0;}

}

Measured memory_bytes: 580
N, M = map(int, input().split())
data = [input().split() for _ in range(M)]

anslist = [0]*(N+1)
wanslist = [0]*(N+1)
AC = 0
WA = 0
for i in range(M):
    if anslist[int(data[i][0])] == 1:
        continue
    else:
        if data[i][1] == "AC":
            anslist[int(data[i][0])] = 1
            AC += 1
        else:
            wanslist[int(data[i][0])] += 1

for i in range(1, N+1):
    if anslist[i] == 1:
        WA += wanslist[i]

print(AC, WA)


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

int Time[100005];

int main(){
    int N, C, K, ans = 0;
    cin >> N >> C >> K;
    for(int i=1; i<=N; i++){
        cin >> Time[i] ;
    }
    sort(Time + 1, Time + N + 1);
    for(int i=1; i<=N; i++){
        ans++;
        int temp = i;
        for(int j=temp+1; j<=temp+C-1; j++){
            if(j > N) break;
            if(Time[j] <= Time[temp]+K){
                i++;
            }
        }
    }
    cout << ans << endl;
}

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

using namespace std;
using ll = long long;

#define rep(i, a) for (int i = 0; (i) < (int) (a); (i)++)
#define reps(i, a, b) for (int i = (int) (a); (i) < (int) (b); (i)++)
#define rrep(i, a) for (int i = (int) a-1; (i) >= 0; (i)--)
#define rreps(i, a, b) for (int i = (int) (a)-1; (i) >= (int) (b); (i)--)
#define MP(a, b) make_pair((a), (b))
#define PB(a) push_back((a))
#define all(v) (v).begin(), (v).end()
#define PERM(v) next_permutation(all(v))
#define UNIQUE(v) sort(all(v));(v).erase(unique(all(v)), v.end())
#define CIN(type, x) type x;cin >> x
#define TRUE__  "Yes"
#define FALSE__ "No"
#define PRINT(f) if((f)){cout << (TRUE__) << endl;}else{cout << FALSE__ << endl;}
#define RS(N) resize(N)
#define CINV(v, N) do {\
	v.RS(N);\
	rep(i, N) cin >> v[i];\
} while (0);
#define RCINV(v, N) do {\
	v.RS(N);\
	rrep(i, N) cin >> v[i];\
} while (0);

#define MOD 1000000007

void init();
void solve();

signed main()
{
	init();
	solve();
}

vector<int> v;
int l;

void init()
{
	string s;
	cin >> s;
	l = s.length();
	v.RS(l);
	rep(i, l) {
		v[i] = s[i] == 'B';
	}
}

void solve()
{
	ll res = 0;
	ll b = 0;
	rep(i, l) {
		if (v[i] == 0) res += b;
		else b++;
	}
	cout << res << endl;
}




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

typedef long long ll;
#define rep(i, n) for (int i = 0; (i) < int(n); ++(i))

bool comp(const vector<int> &x, const vector<int> &y){
    return x[2] > y[2];
}

ll D[5];
int P [10]={0 ,0 ,0 ,0 ,0 ,0 ,1 ,1 ,1 ,2};
int Q [10]={1 ,1 ,1 ,2 ,2 ,3 ,2 ,2 ,3 ,3};
int R [10]={2 ,3 ,4 ,3 ,4 ,4 ,3 ,4 ,4 ,4};

int main(void){

    ll m=0, a=0, r=0, c=0, h=0;
    int n;
    cin >> n;
    rep(i, n){
        string tmp;
        cin >> tmp;
        switch (tmp[0]){
            case 'M':
                m++;
                break;
            case 'A':
                a++;
                break;
            case 'R':
                r++;
                break;
            case 'C':
                c++;
                break;
            case 'H':
                h++;
                break;
            default:
                break;
        }
    }

    ll ans = 0;
    D[0] = m;
    D[1] = a;
    D[2] = r;
    D[3] = c;
    D[4] = h;

    rep(d, 10){
        ans += D[P[d]]*D[Q[d]]*D[R[d]];
    }

    cout << ans << endl;


    return 0;
}

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

using namespace std;

int main(void) {
    int n;
    cin >> n;
    set<string> s;
    for(int i=0; i<n; ++i) {
        string temp;
        cin >> temp;
        s.insert(temp);
    }

    cout << s.size() << '\n';
}

Measured memory_bytes: 19108
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <stack>
#include <queue>
typedef long long ll;

using namespace std;

int main() {
    int n, d;
    cin >> n >> d;
    
    cout << (n / ((2 * d) + 1)) + (n % (((2 * d) + 1)) == 0 ? 0 : 1) << endl;
    
    return 0;
}



Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
using namespace std;
using LL = long long;

int n;
vector<int>s;

int main(void)
{
	cin >> n;
	int total = 0;
	for (int i = 0; i < n; ++i)
	{
		int ss; cin >> ss;
		s.push_back(ss);
		total += ss;
	}
	if (total % 10)
	{
		cout << total << endl;
		return 0;
	}
	int small = INT_MAX;
	for (int i = 0; i < n; ++i)
	{
		if (s[i] % 10)
		{
			small = min(small, s[i]);
		}
	}
	if (small == INT_MAX)
	{
		cout << 0 << endl;
	}
	else
	{
		cout << total - small << endl;
	}
	return 0;
}


Measured memory_bytes: 256
N = int(input())
S = input()
#N, M = map(int, input().split())
#A = list(map(lambda x: int(x)*(-1), input().split()))
#A = [int(input()) for i in range(N)]
#C = [list(map(int, input().split())) for i in range()]
R  =[]
G  =[]
B  =[]
for i, s in enumerate(S):
    if s == 'R':
        R.append(i)
    elif s == 'G':
        G.append(i)
    else:
        B.append(i)
answer = len(R)*len(G)*len(B)
hiku = 0

for i in range(1, (N-1)//2+1):
    #for j in range(N-i-i-2):
    j = 0
    while j + i*2 < N:
        if S[j] != S[j+i] and S[j+i] != S[j+i+i] and S[j] != S[j+i+i]:
            hiku += 1
        j+= 1
answer -= hiku
print(answer)


Measured memory_bytes: 9208
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <cstring>

#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))

static const int dy[4] = {0,1,0,-1};
static const int dx[4] = {1,0,-1,0};

using namespace std;

int main(){
    int a, b, c;

    cin >> a >> b;
    cin >> c;

    cout << (c/a)*b << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>

using namespace std;

int main(void) {
    string str;
    cin>>str;

    int sum = 0;
    for(int i = 0;i < str.size();i++) {
        if(str[i] == '1')
            sum++;
    }

    cout<<sum<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;

int counter = 0;

void ans(vector<int>& a, int n) {
  rep(i, n-1) cout << a[i] <<  " ";
  cout << a[n-1] << endl;
}

void bubbleSort(vector<int>& a, int n) {
  int flag = 1;
  while (flag) {
    flag = 0;
    FORR(j, n-1, 1) {
      if (a[j] < a[j-1]) {
        swap(a[j], a[j-1]);
        flag = 1;
        counter++;
      }
    }
  }
  ans(a, n);
}

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  bubbleSort(a, n);
  cout << counter << endl;
  return 0;
}


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

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
#define x first
#define y second

#ifdef LOCAL
#include "/Users/swad/Desktop/CP/debug.h"
#endif

const int N = int(3e3) + 10;
const int W = int(2e5) + 10;
const int MOD = int(1e9) + 7;

int h, w;
int n;
pii block[N];
ll inv[W], fact[W], ifact[W];
ll dp[N];

ll nCk(int n, int k) {
	if (k == 0 || k == n) return 1;
	return fact[n] * ifact[k] % MOD * ifact[n - k] % MOD;
}

int main() {
	#ifdef LOCAL
	freopen("in", "r", stdin);
	freopen("out", "w", stdout);
	#endif

	inv[1] = fact[0] = ifact[0] = 1;
	for (int i = 2; i < W; i++) inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD;
	for (int i = 1; i < W; i++) fact[i] = fact[i - 1] * i % MOD;
	for (int i = 1; i < W; i++) ifact[i] = ifact[i - 1] * inv[i] % MOD;

	scanf("%d %d %d", &h, &w, &n);
	for (int i = 1; i <= n; i++) scanf("%d %d", &block[i].x, &block[i].y);

	sort(block + 1, block + n + 1);
	ll ans = nCk(h - 1 + w - 1, h - 1);

	for (int i = 1; i <= n; i++) {
		dp[i] = nCk(block[i].x - 1 + block[i].y - 1, block[i].x - 1);
		for (int j = 1; j < i; j++) {
			if (block[j].y <= block[i].y) {
				dp[i] -= dp[j] * nCk(block[i].x - block[j].x + block[i].y - block[j].y, block[i].x - block[j].x) % MOD;
				if (dp[i] < 0) dp[i] += MOD;
			}
		}
		ans -= dp[i] * nCk(h - block[i].x + w - block[i].y, h - block[i].x) % MOD;
		if (ans < 0) ans += MOD;
	}

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

	return 0;
}

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

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

  vector<int> pos;
  vector<int> neg;
  vector<int> zero;
  for (int i = 0; i < n; ++i) {
    int t;
    cin >> t;
    (t == 0 ? zero : t < 0 ? neg : pos).push_back(t);
  }
  sort(pos.begin(), pos.end());
  sort(neg.begin(), neg.end());
  sort(zero.begin(), zero.end());

  constexpr int64_t limit = 1'000'000'000LL;
  int64_t left = -limit * limit;
  int64_t right = limit * limit + 1;
  while (left <= right) {
    int64_t lcnt = 0;
    int64_t ucnt = 0;
    auto mid = left + (right - left) / 2;

    if (mid == 0) {
      lcnt = neg.size() * pos.size();
      ucnt = lcnt;
      for (size_t i = 0; i < zero.size(); ++i) {
        ucnt += n - 1 - i;
      }
    } else if (mid < 0) {
      for (auto it = neg.begin(); it != neg.end(); ++it) {
        auto lit = lower_bound(pos.rbegin(), pos.rend(), mid / *it,
                               greater<int64_t>{});
        auto uit =
            lower_bound(lit, pos.rend(), (mid + 1) / *it, greater<int64_t>{});
        lcnt += lit - pos.rbegin();
        ucnt += uit - pos.rbegin();
      }
    } else {
      for (auto it = neg.rbegin(); it != neg.rend(); ++it) {
        auto lit =
            upper_bound(neg.rbegin(), it, (mid - 1) / *it, greater<int64_t>{});
        auto uit = upper_bound(lit, it, mid / *it, greater<int64_t>{});
        lcnt += pos.size() + lit - neg.rbegin();
        ucnt += pos.size() + uit - neg.rbegin();
      }
      for (size_t i = 0; i < zero.size(); ++i) {
        lcnt += n - 1 - i;
        ucnt += n - 1 - i;
      }
      for (auto it = pos.begin(); it != pos.end(); ++it) {
        auto lit = upper_bound(it + 1, pos.end(), (mid - 1) / *it);
        auto uit = upper_bound(lit, pos.end(), mid / *it);
        lcnt += lit - it - 1;
        ucnt += uit - it - 1;
      }
    }
    if (k <= lcnt) {
      right = mid;
    } else if (ucnt < k) {
      left = mid + 1;
    } else {
      cout << mid << endl;
      return;
    }
  }
  assert(false);
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  solve();
}

Measured memory_bytes: 1400
#include <cstdio>
// D - DivRem Number

using namespace std;

int main() {
    long long N,i,ans;

    scanf("%lld",&N);

    ans = 0;
    for (i = 1;i * i <= N;i++) {
        if (N % i == 0 && N / i - i > 1)
            ans += (N / i - 1);
    }

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

    return 0;
}


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

int main(){
	while(true){
		int M,T,P,R;
		cin>>M>>T>>P>>R;
		if(M==0&&T==0&&P==0&&R==0)
			break;
		int CP[50],TT[50],PT[50][10];
		for(int i=0;i<T;i++){
			CP[i]=TT[i]=0;
			for(int j=0;j<P;j++)
				PT[i][j]=0;
		}
		for(int i=0;i<R;i++){
			int m,t,p,j;
			cin>>m>>t>>p>>j;
			if(j==0){
				CP[t-1]++;
				TT[t-1] += (m+PT[t-1][p-1]);
			}else{
				PT[t-1][p-1] +=20;
			}
		}

		int tnow,tpre=-1;
		bool flg[50];
		for(int i=0;i<T;i++)
			flg[i]=false;
		for(int i=0;i<T;i++){
			tnow=-1;
			for(int j=0;j<T;j++){
				if(flg[j])
					continue;
				if(tnow==-1){
					tnow=j;
				}else{
					if(CP[j]>CP[tnow]||(CP[j]==CP[tnow]&&TT[j]<=TT[tnow])){
						tnow=j;
					}
				}
			}
		if(tpre!=-1){
			if(CP[tnow]==CP[tpre]&&TT[tnow]==TT[tpre])
				cout<<'=';
			else
				cout<<',';
		}
		cout << tnow+1;
			flg[tnow]=true;
			tpre=tnow;
		}
	cout<<endl;
	}
	return 0;
}



Measured memory_bytes: 3096
#include <iostream>
#include <algorithm>
#include <limits.h>
using namespace std;

#define Rep(i,n) for(int i = 0; i < n; ++i )
#define For(i,s,e) for(int i = s; i < e; ++i )
#define ll long long

long s;
long e[1000001] = {0};
long a[1000000] = {0};

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

	cin >> s;
	a[1]=s;
	e[s]=1;
	for( int i = 2; i < 1000000; ++i){
		long v = a[i-1];
		if( 0 == v % 2 ) a[i]=int(v/2);
		else a[i]=3*v+1;
		v = a[i];
		if( 0 < e[v] ){
			cout << i << endl;
			break;
		}
		else
			e[v]=1;			
	}
	return 0;
}

Measured memory_bytes: 2304
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define RFOR(i, start, end) for (int i = start; end <= i; i--)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1'000'000'007
#define INF32 1'050'000'000
#define INF64 4'000'000'000'000'000'000
using ll = long long;
using namespace std;
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;
}

long long factorial(int N) {
    // int 型だとたかだか N <= 12 まで
    // long long 型だと N <= 20 まで
    long long ans = 1;
    for (int i = 0; i < N; i++) {
        ans *= (i + 1);
        MOD(ans);
    }
    return ans;
}

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

    ll N;
    cin >> N;
    auto ans = factorial(N);

    std::cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 256
a,b,c,d = map(int, input().split())

if a <= b <= c:
    if abs(b-a) <= d and abs(c-b) <= d:
        print('Yes')
    else:
        print('No')
else:
    if abs(c-a) <= d:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 9172
#include<iostream>
#include<queue>
using namespace std;
int main(){
	long N,M,A,sum=0;
	priority_queue<int> que;
	cin>>N>>M;
	for(int i=0;i<N;i++){
		cin>>A;
		que.push(A);
	}
	for(int i=0;i<M;i++){
		A=que.top();
		que.pop();
		que.push(A>>1);
	}
	for(int i=0;i<N;i++){
		A=que.top();
		que.pop();
		sum+=A;
	}
	cout<<sum;
	return 0;
}

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

int main(){
  int a,b;
  cin >> a >> b;
  if(a == 1){
    a = 14;
  }
  if(b == 1){
    b = 14;
  }
  
  if(a == b){
    cout << "Draw" << endl;
  }
  else if(a > b){
    cout << "Alice" << endl;
  }
  else{
    cout << "Bob" << endl;
  }
}


Measured memory_bytes: 256
from math import floor, ceil, gcd

a,b,c,d = map(int, input().split())

if a%c == 0: c_m_min = a
else: c_m_min = a + c - a%c
c_m_max = b - b%c
c_cnt = (c_m_max - c_m_min)//c + 1
if c_m_min > b or c_m_max < a : c_cnt = 0

if a%d == 0: d_m_min = a
else: d_m_min = a + d - a%d
d_m_max = b - b%d
d_cnt = (d_m_max - d_m_min)//d + 1
if d_m_min > b or d_m_max < a : d_cnt = 0

cd = c*d//gcd(c,d)
if a%cd == 0: cd_m_min = a
else: cd_m_min = a + cd - a%cd
cd_m_max = b - b%cd
cd_cnt = (cd_m_max - cd_m_min)//cd + 1
if cd_m_min > b or cd_m_max < a : cd_cnt = 0


ans = b - a + 1 - c_cnt - d_cnt + cd_cnt
print(ans)

Measured memory_bytes: 62320
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define int int64_t
#define double long double
#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(v) v.begin(),v.end() 
using namespace std;
//using pr = pair<int, int>;
using tup  = tuple<int, int, int>;
using vec  = vector<int>;
using vvec = vector<vec>;

//プロトタイプ宣言

//グローバル変数
//const int INF = ;
//const int MAX_N = ;
//const int MAX_M = ;
//vvec dp(MAX_N, vec(MAX_M));

//関数：
/* メイン・プログラム */
signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	int n, a, b; cin >> n >> a >> b;
	int d = abs(a-b);
	int ans;
	if(d%2 == 0) ans = d/2;
	else {
		ans = min(b-1, n-a);
		int tp = min(a-1, n-b);
		ans = tp + 1 + (ans-tp-1)/2;
	}
	
	cout << ans << endl;
	return 0;
}

//std::string str;
//str = std::to_string(int i);
//bitset<3> s(N);
//int ans = (char)grid - '0';
//int id = lower_bound(all(arr), x) - arr.begin();
//cout << fixed << setprecision(10) << tld << endl;
//vector<int> sub(itr,itr+d); //イテレーターで部分数列(i=0...d)を指定
		
/*struct data {
	char *name;
	int age;
	int height;
	double weight;
};*/

/*string ans = w;
string &ref = ans;
rep(i, N) {
	ref[i] = arr[i];
}*/

/*map<int,int> mp;
for(auto p : mp) {
	ct += p.second*(p.second-1); }

map<int,int>::iterator itr;
for(itr = mp.begin(); itr != mp.end(); itr++) {
	ans += itr->second * (itr->second-1);
}*/


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

int main()
{
  int n;
  cin >> n;
  vector<int64_t> a(100001);
  int64_t sum = 0;
  for (int i = 0; i < n; i++) {
    int64_t t;
    cin >> t;
    a[t]++;
    sum += t;
  }
  int q;
  cin >> q;
  for (int i = 0; i < q; i++) {
    int64_t x, y;
    cin >> x >> y;
    sum += (y - x) * a[x];
    a[y] += a[x];
    a[x] = 0;
    cout << sum << endl;
  }
}


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

using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;
#define DEBUG freopen("in.txt", "r", stdin);

struct fastio {
    fastio() {
        ios::sync_with_stdio(false);
        cout << setprecision(10) << fixed;
        cin.tie(0);
    }
};

fastio _fast_io;

int Cnt, n, t, add, cnt[10];

int main() {
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> t;
        if (t >= 3200) {
            ++add;
            continue;
        }
        int o;
        if (t < 400) {
            o = 0;
        } else if (t < 800) {
            o = 1;
        } else if (t < 1200) {
            o = 2;
        } else if (t < 1600) {
            o = 3;
        } else if (t < 2000) {
            o = 4;
        } else if (t < 2400) {
            o = 5;
        } else if (t < 2800) {
            o = 6;
        } else if (t < 3200) {
            o = 7;
        }
        if (cnt[o]++ == 0) {
            ++Cnt;
        }
    }
    cout << max(1, Cnt) << ' ' << Cnt + add  << endl;
    return 0;
}


Measured memory_bytes: 3664
N = int( input())
T = list( map( int, input().split())) + [0]
V = list( map( int, input().split())) + [0]
now = 0
end = min( V[0], now + T[0])
ans = 0
for i in range(N):
    # print(i)
    t = T[i]
    v = V[i]
    end = min( v, now + t)
    plus = 0
    for j in range(i, N):
        end = min( end, V[j+1]+plus)
        plus += T[j+1]
    x, y = (end + t - now)/2, (end + t + now)/2
    # print(now, end,v,t,x,y)
    if y <= v:
        # print("T")
        # print((now+y)*x/2, (end+y)*(t-x)/2)
        ans += (now+y)*x/2 + (end+y)*(t-x)/2
        # print((now+y)*x/2 + (end+y)*(t-x)/2)
    else:
        # print("D")
        # print((v+now)*(v-now)/2, (v+end)*(v-end)/2, v*(end-2*v+t+now))
        ans += (v+now)*(v-now)/2 + (v+end)*(v-end)/2+v*(end-2*v+t+now)
        # print((v+now)*(v-now)/2 + (v+end)*(v-end)/2+v*(end-2*v+t+now))
    now = end
print(ans)

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

int main() {
	int x=0;
	int ans = 0;
	int N;
	cin >> N;
	string S;
	cin >> S;
	for (int i = 0; i < N; ++i){
		if (S[i] == 'I') x++;
		else if (S[i] == 'D') x--;
		if(ans<x) ans = x;
	}
	cout << ans << endl;
}

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

int main() { 
    ll n,m,k;
    std::cin >> n>>m>>k;
    vector<ll> a(n),b(m);
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
    }
    for (int i = 0; i < m; i++) {
        std::cin >> b[i];
    }
    ll now = 0;
    ll ans = 0;
    ll cur = 0;
    ll ind = 0;
    while(now<k&&ind<n){
        if(now+a[ind]<=k){
            now += a[ind];
            cur++;
            ind++;
            ans = max(ans,cur);
        }else{
            break;
        }
    }
    ind--;
    for (int i = 0; i < m; i++) {
        while(now+b[i]>k&&ind>=0){
            now -= a[ind];
            ind--;
            cur--;
        }
        if(ind==-1&&now+b[i]>k){
            break;
        }
        now += b[i];
        cur++;
        ans = max(ans,cur);
    }
    
    std::cout << ans << std::endl;
}

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

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main() {
  string S;
  cin >> S;
  
  int a = ctoi(S.at(0));
  int b = ctoi(S.at(1));
  int c = ctoi(S.at(2));
  int d = ctoi(S.at(3));
  
  if(a+b+c+d == 7){
    cout << a << '+' << b << '+' << c << '+' << d <<  "=7" << endl;
  }
  else if(a+b+c-d == 7){
    cout << a << '+' << b << '+' << c << '-' << d <<  "=7" << endl;
  }
  else if(a+b-c+d == 7){
    cout << a << '+' << b << '-' << c << '+' << d <<  "=7" << endl;
  }
  else if(a+b-c-d == 7){
    cout << a << '+' << b << '-' << c << '-' << d <<  "=7" << endl;
  }
  
  else if(a-b+c+d == 7){
    cout << a << '-' << b << '+' << c << '+' << d <<  "=7" << endl;
  }
  else if(a-b+c-d == 7){
    cout << a << '-' << b << '+' << c << '-' << d <<  "=7" << endl;
  }
  else if(a-b-c+d == 7){
    cout << a << '-' << b << '-' << c << '+' << d <<  "=7" << endl;
  }
  else if(a-b-c-d == 7){
    cout << a << '-' << b << '-' << c << '-' << d <<  "=7" << endl;
  }

  
}

Measured memory_bytes: 256
using System;

namespace AtCoder {
    class Program {
        static void Main (string[] args) {

            var s = Console.ReadLine ();
            //string[] sArray = s.Split (" ");
            string[] sArray = s.Split (new[]{" "},StringSplitOptions.None);
            char s1 = sArray[0][0];
            char s2 = sArray[1][0];
            char s3 = sArray[2][0];

            Console.WriteLine (s1.ToString () + s2.ToString () + s3.ToString ());
        }
    }
}


Measured memory_bytes: 13140
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define dbg(x) cerr << #x << ": " << x << endl

bool isprime(int n) {
  if(n < 2) return false;
  if(n == 2) return true;
  if(n % 2 == 0) return false;
  for(int i = 3; i < n; i += 2)
    if(n % i == 0) return false;
  return true;
}

int main() {
  int N;
  cin >> N;
  int cnt = 0;
  rep(i, N + 1) rep(j, i) rep(k, j) {
    if(i * j * k > N) continue;
    if(i % 2 == 1 && j % 2 == 1 && k % 2 == 1) {
      if(isprime(i) && isprime(j) && isprime(k)) {
        cnt++;
      }
    }
  }
  if(N >= 135) cnt++;
  if(N >= 189) cnt++;
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    
    int n;
    cin >> n;
    
    for (int i=0;i<n;i++){
    int a,b,c;
    cin >> a >> b >> c;
    
    if(c*c == a*a+b*b || a*a == b*b+c*c || b*b == a*a+c*c){
        cout << "YES" <<endl;

    }
    else {cout << "NO" <<endl;
    }
    
    }
    
}



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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pll;

#define endl "\n"

const ll INF = 1e15;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
const double PI = acos(-1.0);

mt19937 rng((int) chrono::steady_clock::now().time_since_epoch().count());

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

    string s, t;
    cin >> s >> t;;
    int n = (int) s.size();
    int ans = 0;
    for (int i = 0; i < n; ++i)
        ans += s[i] != t[i];
    cout << ans << endl;
}


Measured memory_bytes: 3884
#include <iostream>
#include <numeric>
#include <vector>
#include <math.h>
#include <map>
#include <algorithm>
#include <stdio.h>
#include <set>
#define mod 1000000007
using namespace std; 

long long Pow(long long a,long long n){ 
	if (n==0) return 1;
	if (n%2==1) return a*Pow(a,n-1)%mod;
	long long t=Pow(a,n/2)%mod;
	return t*t%mod;
}

long long nCr(long long n,long long m){ 
	long long q=1; 
	long long w=1;
	for (long long i=0;i<m;i++){
		q=q*(n-i)%mod;
		w=w*(i+1)%mod;
	}
	return q*Pow(w,mod-2)%mod;
}

int main(){
    long long n,a,b; cin >> n >> a >> b;
	long long ans=Pow(2,n)-1-nCr(n,a)-nCr(n,b);
	if (ans==0) cout << "0" << "\n";
	else cout << (ans%mod+mod)%mod << "\n";
}



Measured memory_bytes: 256
def check1(s):
    return s[0]=='A'

def check2(s):
    co=0
    for i in s[2:-1]:
        if i=='C':
            co+=1
    return co==1

def check3(s):
    ju=True
    for i in s:
        if i.isupper():
            if i!='A' and i!='C':
                ju=False
                break
    return ju

s=input()
if check1(s) and check2(s) and check3(s):
    print('AC')
else:
    print('WA')


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
typedef int64_t llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define ld PRId64
#define n_max 200
llong graph[n_max+1][n_max+1]={};

int main(){
    int n,m,R;
    cin >> n >> m >> R;
    vector<int> r;
    int ttmp;
    REP(i,R){
        cin >> ttmp;
        r.push_back(ttmp);
    }
    int a,b,c;
    REP(i,m){
        scanf("%d%d%d",&a,&b,&c);
        graph[a][b]=c;
        graph[b][a]=c;
    }
    FOR(i,1,n+1){
        FOR(j,1,n+1){
            if(i!=j and graph[i][j]==0) graph[i][j]=10000000000;
        }
    }
    FOR(i,1,n+1){
        FOR(j,1,n+1){
            FOR(k,1,n+1){
                graph[j][k]=min(graph[j][k] , graph[j][i] + graph[i][k]);
            }
        }
    }

    llong ans=10000000000;
    llong tmp=0;
    Sort(r);
    while(1){
        tmp=0;
        for(auto itr=r.begin(); itr!=r.end()-1;itr++) tmp+=graph[*itr][*(itr+1)];
        ans=min(ans,tmp);
        if(not next_permutation(r.begin(),r.end())) break;
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<cmath>
#include<iomanip>
using namespace std;
int main(){
    int n;
    int x[1000]={0};
    int y[1000]={0};
    double sum = 0.0;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>x[i];
    }
    for(int i=0;i<n;i++){
        cin>>y[i];
    }    
    for(int i=0;i<n;i++){
        sum+=fabs(x[i]-y[i]+0.0);
    }        
    cout<<fixed<<sum<<endl;
    sum=0.0;
    for(int i=0;i<n;i++){
        sum+=pow(x[i]-y[i]+0.0,2);
    }        
    cout<<fixed<<sqrt(sum)<<endl;
    sum=0.0;
    for(int i=0;i<n;i++){
        sum+=fabs(pow(x[i]-y[i]+0.0,3));
    }        
    cout<<fixed<<pow(sum,1.0/3.0)<<endl;
    sum=0.0;
    for(int i=0;i<n;i++){
        if (fabs(x[i]-y[i]+0.0)>sum) sum=fabs(x[i]-y[i]+0.0);
    }        
    cout<<fixed<<sum<<endl;
}


Measured memory_bytes: 3424
#include <math.h>
int i,n,x[1000],y[1000];
double t;
double Distance(int p);
main(){
    scanf("%d",&n);
    for(i=0;i<n;i++)scanf("%d",&x[i]);
    for(i=0;i<n;i++)scanf("%d",&y[i]);
    for(i=1;i<5;i++)printf("%lf\n",Distance(i));
}
double Distance(int p){
    int i;
    for(t=0,0,i=0;i<n;i++){
        if(p==4)t=t>abs(x[i]-y[i])?t:abs(x[i]-y[i]);
        else t+=pow(1.0*abs(x[i]-y[i]),p);
    }
    return p==4?t:pow(t,1.0/p);
}

Measured memory_bytes: 1988
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <list>
#include <ctime>
#include <sstream>
#include <queue>
#include <stack>
#include <bitset>
#include <numeric>
#include <cassert>
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;
#define FOR(x, b, e) for(int x=(b); x<=(e); ++x)
#define FORD(x, b, e) for(int x=((int)(b))-1; x>=(e); --x)
#define REP(x, n) for(int x=0; x<(n); ++x)
#define ALL(c) c.begin(),c.end()
#define sz(x) ((int)((x).size()))
#define pb push_back
#define st first
#define nd second
#define mp(x,y) make_pair(x,y)
typedef short int sint;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it) {
	*this << ((it != d.b) ? ", " : "") << *it;
  }
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

int main() {
	ios_base::sync_with_stdio(false);

	int a, b;
	cin >> a >> b;
	FOR(i, 1, 1000000) {
		int dx = i * 0.08;
		int dy = i * 0.1;
		if (dx == a && dy == b) {
			cout << i << endl;
			return 0;
		}
	}
	cout << -1 << endl;
	
}

Measured memory_bytes: 256
import numpy as np
S = input()
N = len(S)

answer0 = np.zeros(N, int)
answer1 = np.ones(N, int)
for i in range(N):
    if i % 2 == 1:
        answer0[i] = 1
        answer1[i] = 0

num0 = 0
num1 = 0
for i in range(N):
    if int(S[i]) != answer0[i]:
        num0 += 1
    if int(S[i]) != answer1[i]:
        num1 += 1
if num0 > num1:
    num = num1
else:
    num = num0
print(int(num))

Measured memory_bytes: 14284