akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int main(void)
{
	int a[6],i,b;
	for(i=1;i<=5;i++){
		scanf("%d",&a[i]);
		if(a[i]==0){
		b=i;
		}
	}	printf("%d\n",b);
		return 0;
}
	

Measured memory_bytes: 1736
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define read(a) scanf("%d", &a)
#define readl(a) scanf("%lld", &a)
#define reads(a) scanf("%s", a)
#define readf(a) scanf("%lf", &a)
#define readc(a) scanf("%c", &a)
#define debug(a, b) printf("%s = %d\n", a, b)
#define debug1(a, i, b) printf("%s[%d] = %d", a, i, b)
#define show(a) putchar(a)
#define pb emplace_back
#define mk make_pair
#define _rand mt19937 RAND(time(0))
#define REP(i,a,n) for(int i=a;i<=n;++i)
#define mem(a) memset(a, 0, sizeof(a))
#define Buff ios::sync_with_stdio(false)
typedef long long ll;
typedef long long LL;
typedef int Int;
typedef double db;
using namespace std;
const int INF = 1e9 + 7;
const int N = 2e5 + 7;
const int M = 5e6 + 7;
char s[N];
ll dp[N];
signed main()
{
    int n, p;
    read(n); read(p);
    reads(s + 1);

    ll ans = 0;
    if(p == 2 || p == 5)
    {
        for(int i = n; i; i--)
            if((s[i]-'0') % p == 0)
                ans += 1ll*i;
    }
    else
    {
        ll d = 1, x = 0;
        for(int i = n; i; i--)
        {
            x += (s[i]-'0') * d;
            x %= p;

            d *= 10;
            d %= p;

            ans += dp[x];
            dp[x]++;
            if(x == 0) ans++;
        }
    }
    printf("%lld\n", ans);
    return 0;
}
/**

**/



Measured memory_bytes: 512
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := getScanner(fp)

	writer := bufio.NewWriter(os.Stdout)

	n := getNextInt(scanner)
	im := IntMap{}
	for i := 0; i < n; i++ {
		a := getNextInt(scanner)
		im.increment(a)
	}

	ans := 0
	for k, v := range im {
		if k > v {
			ans += v
			continue
		}
		ans += v - k
	}
	fmt.Fprintln(writer, ans)

	writer.Flush()
}

// IntMap ...
type IntMap map[int]int

func (m IntMap) get(key int) int {
	if _, ok := m[key]; ok {
		return m[key]
	}
	return 0
}
func (m IntMap) increment(key int) {
	if _, ok := m[key]; ok == false {
		m[key] = 0
	}
	m[key]++
}


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

stack<int> array1,array2;
int Balls[10];

bool DFS(int number,stack<int> s1,stack<int> s2){
  if(number > 9) return true;
  if(s1.top() < Balls[number]){
    s1.push(Balls[number]);
    if(DFS(number+1,s1,s2)){
      return true;
    }
    s1.pop();
  }
  if(s2.top() < Balls[number]){
    s2.push(Balls[number]);
    if(DFS(number+1,s1,s2)){
      return true;
    }
    s2.pop();
  }
  return false;
  /*if(number > 9) return;
  if(firstarray){
    if(array1.top() < Balls[number]){
      array1.push(Balls[number]);
      DFS(number+1,false);
      DFS(number+1,true);
    }
    else if(second){
      return;
    }
    else{
      DFS(number,false,true);
    }
  }
  else{
    if(array2.top() < Balls[number]){
      array2.push(Balls[number]);
      DFS(number+1,false);
      DFS(number+1,true);
    }
    else if(second){
      return;
    }
    else{
      DFS(number,true,true);
    }
  }*/
}

int main(){

    int N;

    cin >> N;

    for(int i=0;i<N;i++){
      for(int i=0;i<10;i++){
        cin >> Balls[i];
      }
      array1.push(0);
      array2.push(0);

      if(DFS(0,array1,array2)){
        cout << "YES" << endl;
      }
      else{
        cout << "NO" << endl;
      }
      while (!array1.empty()) {
        array1.pop();
      }
      while (!array2.empty()) {
        array2.pop();
      }
    }
    return 0;
}

Measured memory_bytes: 3108
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
using namespace std;
using ll = long long;
const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2>& p) { os << p.first << " " << p.second; return os; }
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) { for(int i = 0; i < (int) v.size(); i++) os << v[i] << (i + 1 != v.size() ? " " : ""); return os; }

double get_distance(vector<pair<int, int>> &v)
{
    double res = 0.0;
    for(int i = 0; i < v.size() - 1; i++)
    {
        double a = v[i].first - v[i + 1].first;
        double b = v[i].second - v[i + 1].second;
        res += sqrt(a * a + b * b);
    }
    return res;
}

void solve()
{
    cout << fixed << setprecision(10);
    int n; cin >> n;
    vector<pair<int, int>> v;
    for(int i = 0; i < n; i++)
    {
        int x, y; cin >> x >> y;
        v.push_back(make_pair(x, y));
    }
    sort(v.begin(), v.end());
    double ans = 0.0;
    int cnt = 0;
    do
    {
        ans += get_distance(v);
        cnt++;
    } while (next_permutation(v.begin(), v.end()));
    cout << ans / cnt << endl;
}

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <vector>

using namespace std;
typedef long long ll;

bool S[100][100];
int Count[100][100];

int main()
{
	int H, W;
	
	scanf("%d %d", &H, &W);
	
	for(int i = 0; i < H; i++){
		char c[256];
		scanf("%s", c);
		for(int j = 0; j < W; j++){
			if(c[j] == '.')
			{
				S[i][j] = true;
			}else{
				S[i][j] = false;
			}
			Count[i][j] = 10000;
		}
	}
	
	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			int result = 10000;
			
			if(i > 0){
				if(S[i-1][j] != S[i][j]){
					result = min(result, Count[i-1][j] +1);
				}
				else{
					result = min(result, Count[i-1][j]);
				}
			}
			if(j > 0){
				if(S[i][j-1] != S[i][j]){
					result = min(result, Count[i][j-1]+1);
				}
				else{
					result = min(result, Count[i][j-1]);
				}
			}
			
			if(i == 0 && j == 0){
				result = S[i][j] ? 0 : 1;
			}
			
			Count[i][j] = result;
		}
	}
	
	int ans = (Count[H-1][W-1]+1) / 2;
	
	printf("%d\n", ans);
	
	
	return 0;
}

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

using namespace std;

int n;
string s;
int a[100010];

inline int ret(string s){
	if(s=="Male")
		return -1;
	else
		if(s=="Female")
			return 1;
		else
			return 0;
}

int main(){
	cin>>n;
	cout<<0<<endl;
	cout.flush();

	cin>>s;
	if(ret(s)==0)return 0;

	a[0]=ret(s);
	int l=0,r=n-1;
	while(l+1<r){
		int mid=(l+r)>>1;
		cout<<mid<<endl;
		cout.flush();

		cin>>s;
		if(ret(s)==0)return 0;
		a[mid]=ret(s);

		if((mid-l)%2==0 && a[mid]==a[l] || (mid-l)%2==1 && a[mid]+a[l]==0){
			l=mid;
		}else{
			r=mid-1;
		}
	}

	cout<<r<<endl;
	cout.flush();

	return 0;
}

Measured memory_bytes: 852
# Square869120Contest #4 B - Buildings are Colorful!　

import sys

N, K = map(int, sys.stdin.readline().strip().split())
a = list(map(int, sys.stdin.readline().strip().split()))


def dfs(height=a[0], cost=0, target=K, can_see=1, i=1):
    if can_see == target:
        return cost

    # 端まで探索したとき
    if i == len(a):
        return float('inf')

    # 建物 i を選ばない場合
    if height >= a[i]:
        cost1 = dfs(height=height, cost=cost, target=K, can_see=can_see, i=i + 1)
    else:
        cost1 = dfs(height=a[i], cost=cost, target=K, can_see=can_see + 1, i=i + 1)
    # print('cost1', cost1, 'can_see', can_see, 'i', i)

    # 建物　i を選んだ場合
    cost += max(0, height + 1 - a[i])
    can_see += 1
    height = max(a[i], height + 1)
    cost2 = dfs(height=height, cost=cost, target=K, can_see=can_see, i=i + 1)
    # print('cost2', cost2)

    return min(cost1, cost2)


print(dfs(a[0], cost=0, target=K, can_see=1, i=1))


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int n, k;
  int ar[1002];
  cin >> n >> k;
  for(int i=0;i<=n-1;i++)
  {
    cin >> ar[i];
  }
  sort(ar,ar+n);
  int tot=0;
  for(int i=0;i<=k-1;i++)
  {
    tot=tot+ar[i];
  }
  cout << tot << endl;
  return 0;
}
    

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define all(v) (v).begin(),(v).end()
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vii vector<pii>
#define MOD 1000000007
#define PI acos(-1)
#define eps (1e-8)
#define INF ((int)1e18)
//ifstream cinn("in.in");ofstream coutt("out.out");


signed main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    int n,x,t;cin>>n>>x>>t;
    int ans=0;
    while(n>=x){
        ans+=t;
        n-=x;
    }
    cout<<ans+(n?t:0);
}

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

int main(){
  string S;
  cin >> S;
  int L=S.size();
  set<char> A;
  for(int i=0; i<L; i++){
    A.insert(S.at(i));
  }
  int Ans=0;
  for(char c:{'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'}){
    if(A.count(c)==0){
      Ans=1;
      cout << c << endl;
      break;
    }
  }
  if(Ans==0){
    cout << "None" << endl;
  }
}


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

int main() {
  int N;
  cin >> N;
  vector<int> d(N);
  rep(i, N) cin >> d.at(i);

  sort(d.begin(), d.end());
  d.erase(unique(d.begin(), d.end()), d.end());
  cout <<  d.size() << endl;
}



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

using namespace std;

struct graph{
  vector<int> node;
  vector<vector<int>> children;
  
  graph(int n) : node(n, -1), children(n){
    //pass
  }
};

int find_path(int v, struct graph &g){
  if(g.node[v] != -1) return g.node[v];
  
  int len = 0;
  for(int c : g.children[v]) len = max(len, find_path(c, g) + 1);
  
  return g.node[v] = len;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n, m;
  cin >> n >> m;
  
  struct graph g(n);
  
  for(int i = 0; i < m; i++){
    int x, y;
    cin >> x >> y;
    g.children[x - 1].push_back(y - 1);
  }
  
  int len = 0;
  for(int i = 0; i < n; i++) len = max(len, find_path(i, g));
  
  cout << len << endl;
  
  return 0;
}

Measured memory_bytes: 8192
#include<bits/stdc++.h>
#define ll long long
#define pii_ pair<int,int>
#define mp_ make_pair
#define pb push_back
#define fi first
#define se second
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define show1(a) cout<<#a<<" = "<<a<<endl
#define show2(a,b) cout<<#a<<" = "<<a<<"; "<<#b<<" = "<<b<<endl
using namespace std;
const ll INF = 1LL<<60;
const int inf = 1<<30;
const int maxn = 2e5+5;
const ll M = 998244353;
inline void fastio() {ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);}
ll n,m,k,fac[maxn];
ll qpow(ll a,ll b) {ll s=1;while(b){if(b&1)s=(s*a)%M;a=(a*a)%M;b>>=1;} return s;}
ll C(ll a,ll b)
{
    return 1LL*fac[a]*qpow(fac[b],M-2)%M*qpow(fac[a-b],M-2)%M;
}
int main()
{
    fastio();
    cin>>n>>m>>k;
    fac[0] = 1;
    rep(i,1,n) fac[i]=fac[i-1]*i%M;
    ll ans = 0;
    rep(i,0,k){
        ans = (ans+qpow(m-1,n-i-1)*C(n-1,i)%M)%M;
    }
    cout<<ans*m%M<<endl;
    return 0;
}


Measured memory_bytes: 5156
// 失敗するからこそ そこから立ち向かって行く強さがあってそんな強さが本当の強さだと私は思うから
#ifdef DAIJOBU
#include "/home/v-o_o-v/deb.h"
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#include <bits/stdc++.h>
#define deb(x...)
#endif 

using namespace std;

#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef long long lint;
typedef double ld;

void a();void b();void c();void d();void e();void f();

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

	// a();
	// b();
	c();
	// d();
	// e();
	// f();
	return 0;
}

void a(){
	string s;
	cin >> s;
	if(s == "ABC")puts("ARC");
	else puts("ABC");
}

void b(){
	int n, k;
	cin >> n >> k;
	vi adj[1500];
	forn(i, k){
		int d;
		cin >> d;
		forn(j, d){
			int x;
			cin >> x;
			adj[x].pb(i);
		}
	}
	int c = 0;
	for1(i, n){
		if(adj[i].size() == 0)c++;
	}
	cout << c;
}

void c(){
	vi adj[100050];
	int n, m;
	cin >> n >> m;
	vi ht(n + 1);
	for1(i, n)cin >> ht[i];
	forn(i, m){
		int a, b;
		cin >> a >> b;
		adj[a].pb(b);
		adj[b].pb(a);
	}
	int c = 0;
	for1(i, n){
		bool ok = true;
		for(auto j:adj[i]){
			if(ht[i] <= ht[j])ok = false;
		}
		if(ok)c++;
	}
	cout << c;
}

void d(){

}

void e(){

}

void f(){

}


Measured memory_bytes: 8780
import math

N=int(input())
A,B=map(int,input().split( ))
P=list(map(int,input().split( )))

# N=7
# A,B=5,15
# P=[1,10,16,2,7,20,12]

# N=8
# A,B=3,8
# P=[5,5,5,10,10,10,15,20]

# N=3
# A,B=5,6
# P=[5,6,10]

PA=[i for i in P if i<=A]
PB=[i for i in P if i>A and i<=B]
PC=[i for i in P if i>B]

# print(PA)
# print(PB)
# print(PC)
m=min(len(PA),len(PB),len(PC))

print(m)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
const int N=305;
int n,m,k,tot,a[N][N];
char s[N][N];
int main()
{
    scanf("%d%d%d",&n,&m,&k);
    for(int i=1;i<=n;i++)
        scanf("%s",s[i]+1);
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)
        if(s[i][j]=='#')
    {
        a[i][j]=++tot;
        for(int k=i+1;k<=n&&s[k][j]=='.';k++)
            a[k][j]=a[k-1][j];
    }
    for(int i=n;i>=1;i--)
        for(int j=1;j<=m;j++)
        if(!a[i][j])
        a[i][j]=a[i+1][j];
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)
        if(!a[i][j])
        a[i][j]=a[i][j-1];
    for(int i=1;i<=n;i++)
        for(int j=m;j>=1;j--)
        if(!a[i][j])
        a[i][j]=a[i][j+1];
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)
        printf(j==m?"%d\n":"%d ",a[i][j]);
}


Measured memory_bytes: 4280
#include <iostream>
#define REP(i, a, n) for(int i = (a); i < (n); i++)
using namespace std;
typedef long long ll;

int N, F, S, D[31][50];
ll dp[31][50];

int main(void) {
  while(cin >> N, N) {
    REP(i, 0, 31) REP(j, 0, N) D[i][j] = 0;
    REP(i, 0, N) {
      cin >> F;
      REP(j, 0, F) {
        cin >> S;
        D[S][i] = 1;
      }
    }

    REP(i, 0, 31) REP(j, 0, N) dp[i][j] = 0;
    REP(i, 0, N) dp[0][i] = (1LL << i);

    int ans = -1;
    REP(i, 1, 31) {
      REP(j, 0, N) dp[i][j] = dp[i - 1][j];
      REP(j, 0, N) REP(k, 0, N) {
        if(D[i][j] == 1 && D[i][k] == 1) {
          dp[i][j] |= dp[i - 1][k];
        }
      }
      REP(j, 0, N) if(dp[i][j] == (1LL << N) - 1) {
        ans = i;
        goto ANS;
      }
    }

ANS: cout << ans << endl;
  }
  return 0;
}

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

int main(){
	// sengen
	int r,d,x;
	// nyuryoku
	cin >> r >> d >> x;
	// keisan
	for(int i=1;i<=10;i++){
		x = r*x - d;
		cout << x << endl;
	}
	// syutsuryoku
}

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

namespace DPC2019A2
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split();
            int N = int.Parse(input[0]);//ボール
            int K = int.Parse(input[1]);//人数

            int ans = 0;
            //ifと入力しTabキーを２回押して展開する
            if (K == 1)
            {
                ans = 0;//独り占めするので差はない。
            }
            else
            {
                ans = N - K;
            }
            //cwと入力してTabキーを２回押して展開する
            Console.WriteLine(ans);
            //実行するときはデバッグ→デバッグなしで開始
        }
    }
}


Measured memory_bytes: 11092
#include<bits/stdc++.h> 
//#define <- プログラムの文字列を置換する
//typedef <- 新しい型に名前を付けるためのキーワード

using namespace std;

#define MAX_N 100000

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

const double PI = 3.141592653589793;
const long long MOD = 1e9 + 7;
const long long INF = 1e15;
const int INF_INT = 1e9;

int main(){
    string s;
    cin >> s;
    if(s[0] == '9' || s[1] == '9') cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(v) v.begin(), v.end()
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL);
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
int main(){
    fastIO
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n,k;
    vec h(200001);
    cin>>n>>k;
    rep(i,n) cin>>h[i];
    if(n==k){
        cout<<0;return 0;
    }
    ll dp[301][301]={0},inf=1e18,ans=inf;
    rep(i,n)rep(j,n+1) dp[i][j]=inf;
    rep(i,n) dp[i][1]=h[i];
    rep(i,n)rep(j,n)rep(k,i) dp[i][j+1]=min(dp[i][j+1],dp[k][j]+max((ll)0,h[i]-h[k]));
    rep(i,n) ans=min(ans,dp[i][n-k]);
    cout<<ans<<"\n";
}

Measured memory_bytes: 2560
//inspired from https://codeforces.com/contest/1100/problem/F

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
#define  st first
#define  nd second
void debug_out() { cerr << endl; }
template<class T> ostream& prnt(ostream& out, T v) { out << v.size() << '\n'; for(auto e : v) out << e << ' '; return out;}
template<class T> ostream& operator<<(ostream& out, vector <T> v) { return prnt(out, v); }
template<class T> ostream& operator<<(ostream& out, set <T> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, map <T1, T2> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, pair<T1, T2> p) { return out << '(' << p.st << ' ' << p.nd << ')'; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}

#define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__)
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(int _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!\n"

#define MAXN  1000000000
#define MOD   1000000007
#define int long long
template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef cc_hash_table<int, int, hash<int > > ht;


int32_t main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  int s;
  cin>>s;
  //b*h
  //let h=1
  int t=ceil(sqrt(s));
  while(t*t<s){
    t++;
  }
  cout<<0<<" "<<0<<" "<<t<<" "<<1<<" "<<((t*t)-s)<<" "<<t;
  return 0;
}


Measured memory_bytes: 256
import Data.List (sort)
import Control.Applicative ((<$>))
import Control.Monad (replicateM_)

main = do
  n <- readLn
  replicateM_ n $ putStrLn =<< show.(\x -> maxNum x - minNum x)<$>getLine
maxNum :: String -> Int
maxNum = read.reverse.sort

minNum :: String -> Int
minNum = read.sort

Measured memory_bytes: 3664
a = map(int, raw_input().split())
x = a[2] - a[0]
y = a[3] - a[1]
x3 = a[2] - y
y3 = a[3] + x
x4 = x3 - x
y4 = y3 - y
print x3, y3, x4, y4

Measured memory_bytes: 2568
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
ans = 0
for i in range(n):
    if a[i] > b[i]:
        ans += b[i]
    else:
        ans += a[i]
        if b[i]-a[i] > a[i+1]:
            ans += a[i+1]
            a[i+1] = 0
        else:
            ans += b[i]-a[i]
            a[i+1] -= b[i]-a[i]
print(ans)


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

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

    vector<int> ans(N+1,0);

    int tmp;
    for(int x=1;x<=100;x++){
        for(int y=1;y<=100;y++){
            for(int z=1;z<=100;z++){
                tmp=x*x+y*y+z*z+x*y+x*z+y*z;
                if(tmp<=N){
                    ans[tmp]++;
                }
            }
        }
    }

    for(int i=1;i<=N;i++){
        cout<<ans[i]<<endl;
    }

    return 0;
}

Measured memory_bytes: 3528
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
#define vec(s) vector
;
#define vvec(s) vector<vector
> ;
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli,lli> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YN(x) cout<<(bool x?"Yes":"No")<<endl;
#define out(s) cout<<s<<endl;
#define pb(s) push_back(s);
#define sp " ";
#define INF 10000000000
#define all(s) s.begin(),s.end()
void vout(vector<int> v){
    for(int i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
int main(){
    lli n,k,s;
    cin>>n>>k>>s;
    vi ans(n,1);
    rep(i,n){
        if(i<k){
            ans[i]=s;
        }
        else{
            if(s!=1000000000){
                ans[i]=s+1;
            }
        }
    }
    rep(i,n){
        if(i!=n-1)
        cout<<ans[i]<<" ";
        else cout<<ans[i]<<endl;
    }
}

Measured memory_bytes: 2048
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cassert>
#define bogo_sort std::sort
#define bozo_sort std::stable_sort
#define alles(obj) obj.begin(), obj.end()
#define elif else if
#define unless(flg) if(!(flg))
#define elless(flg) else if(!(flg))
#define echo std::cout <<
#define read std::cin >>
#define endl std::endl
#define fin << '\n'
#define bash push_back
#define makePair std::make_pair
#define _ << ' ' <<
// type-define
#define Stack std::stack
#define Queue std::queue
#define Set std::set
#define PQueue std::priority_queue
#define Vector std::vector
#define Pair std::pair
#define Map std::map
#define HashMap std::unordered_map
#define Greater std::greater
using String = std::string;
using llong = long long;
using boolean = bool;
using Pii = Pair<int, int>;
using Vi = Vector<int>;
using Vii = Vector<Pii>;
// utils
constexpr int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
constexpr int INF = 0x3f3f3f3f;
constexpr llong LINF = 0x3f3f3f3f3f3f3f3fLL;

namespace {
    template<class A, class B> A power ( llong x, llong n, llong mod ) {
        llong ans = 1;
        while ( n > 0 ) {
            if ( n & 1 ) ans = ( ans * x ) % mod;
            x = ( x * x ) % mod;
            n >>= 1;
        }
        return ans;
    }
    template<class A, class B> A power ( A x, B n ) { return power( x, n, 1000000007 ); }
    template<class A> A gcd ( A x, A y ) { return x % y ? gcd( y, x % y ) : y; }
    template<class A, class B> A lcm ( A x, B y ) { return ( x / gcd(x, y) * y ); }
    template<class A> inline A abs ( A n ) { return ( n < 0 ) ? -n : n; }
    template<class A, class B> inline bool chmax ( A &a, const B &b ) { return b > a ? a = b, true : false; }
    template<class A, class B> inline bool chmin ( A &a, const B &b ) { return b < a ? a = b, true : false; }
    boolean isMovable ( int x, int y, int w, int h ) {
        return ( x >= 0 && y >= 0 && x < w && y < h );
    }
}

namespace Rlyeh {

    HashMap<String, int> m;

    signed call_of_Cthulhu( signed datum ) {

        int n;
        read n;
        String s;
        read s;
        m[s]++;
        for ( int i = 1; i < n; i++ ) {
            String t;
            read t;
            if ( t[0] != s[s.size()-1] || m[t] ) {
                echo "No" fin;
                return 0;
            }
            m[t]++;
            s = t;
        }
        echo "Yes" fin;

        return 0;
    }
}
signed main(){std::cin.tie(0); std::ios::sync_with_stdio(false); int main_result = Rlyeh::call_of_Cthulhu(114514); return 0;}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#include<unordered_map>
#pragma warning(disable:4996)
using namespace std;

const int My_Inf=2147483647;
const long long int My_LInf=9223372036854775807;
int aa[1000000];
bool isprime(long long int a) {
	if (a == 1 || a == 0)return false;
	for (long long int i = 2; i*i <= a; ++i) {
		if ((a%i)) {
		}
		else {
			return false;
		}
	}
	return true;
}
int main() {
	for (int i = 0; i < 1000000; ++i) {
		aa[i] = isprime(i);
	}
	while (1) {
		int m, a, b; cin >> m >> a >> b;
		if (!m)break;

		int ans=0;
		int p;
		int q;

		for (int i = 2; i < sqrt(m)+2; ++i) {
			if (!aa[i])continue;
			for (int j = i; j < m/i+2; ++j) {

				if (i*j <= m&& aa[j]) {
					if (double(a) / b <= double(i) / j + 1e-8) {
						if (ans < i*j) {
							ans = i*j;
							p = i;
							q = j;
						}
					}
				}
			}
		}
		cout << p <<" "<< q << endl;
	}
	return 0;
}

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

int main() {
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    bool Chokudai_turn = true;
    while(A > 0 && C > 0) {
        if(Chokudai_turn) {
            C -= B;
        }
        else {
            A -= D;
        }
        //cout << "A: " << A << " C: " << C << endl;
        Chokudai_turn = !Chokudai_turn;
    }
    if(A <= 0) cout << "No" << endl;
    else cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3596
#define NDEBUG
NDEBUG


#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cstring>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <memory>
#include <queue>
#include <random>


#define forn(t, i, n) for (t i = 0; i < (n); ++i)

#define rforn(t, i, n) for (t i = (n) - 1; i >= 0; --i)


using namespace std;

// TC_REMOVE_BEGIN
/// caide keep
bool __hack = std::ios::sync_with_stdio(false);
/// caide keep
auto __hack1 = cin.tie(nullptr);
// TC_REMOVE_END

template<class T>
inline T mn(T arg) {
    return arg;
}


template<class T, class... Args>
inline bool rmn(T &to, Args... args) {
    auto v = mn(args...);
    if (to > v) {
        to = v;
        return true;
    }
    return false;
}


// Section with adoption of array and vector algorithms.


namespace template_util {
    

    constexpr int bytecount(uint64_t x) {
        return x ? 1 + bytecount(x >> 8) : 0;
    }

    template<int N>
    struct bytetype {
        
    };

    
    /// caide keep
    template<uint64_t N>
    struct minimal_uint : bytetype<bytecount(N)> {
    };
}


template<class T>
T next(istream& in) {
    T ret;
    in >> ret;
    return ret;
}


void solve(istream& in, ostream& out) {
    int n = next<int>(in);
    int m = next<int>(in);
    vector<vector<int>> edges(n);
    forn (int, i, m) {
        int u = next<int>(in) - 1;
        int v = next<int>(in) - 1;
        edges[u].push_back(v);
    }
    vector<double> p(n), e(n);
    p[0] = 1.0;
    forn (int, i, n) {
        double add = p[i] / edges[i].size();
        for (int j : edges[i]) {
            p[j] += add;
        }
    }
    rforn (int, i, n - 1) {
        for (int j : edges[i]) {
            e[i] += e[j];
        }
        e[i] = e[i] / edges[i].size() + 1;
    }
    double ans = e[0];
    forn (int, i, n) {
        int cnt = edges[i].size();
        if (cnt > 1) {
            for (int j : edges[i]) {
                rmn(ans, e[0] + p[i] * ((e[i] - 1 - e[j]) / (cnt - 1)));
            }
        }
    }
    out << setprecision(11) << ans << "\n";
}


int main() {
  solve(cin, cout);
  return 0;
}



Measured memory_bytes: 1408
#include <stdio.h>
#include <stdlib.h>
int main(void) {
int N,K;
int count =0;
scanf("%d %d",&N,&K);
int arr[N];
for (int i=0;i<N;i++){
    scanf("%d",&arr[i]);
    if (arr[i]>=K) count++;
}
printf("%d",count);
 return EXIT_SUCCESS;
}


Measured memory_bytes: 512
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
using namespace std;
typedef long long ll;
int a[200005];
bool compare(int a,int b){
    return a>b;
}
int main(){
    int n,k,x;
    cin>>n>>k;
    memset(a,0,sizeof(a));
    for(int i=0;i<n;i++){
        cin>>x;
        a[x]++;
    }
    int ans=0;
    sort(a,a+n,compare);
    for(int i=k;i<=n;i++){
        ans+=a[i];
    }
    cout<<ans<<endl;
    return 0;
}

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

int main() {
  int a, b, c, d, e, f;
  cin >> a >> b >> c >> d >> e >> f;
  double per = (double)((double)e / (double)(100 + e));
  double mx = 0.0000000000;
  int ans_all = 0, ans_satou = 0;
  set<int> water;
  set<int> satou;
  for (int i = 0; i <= 30; i++){
    for (int j = 0; j <= 15; j++){
      if(i == 0 && j == 0) continue;
      if(100 * a * i + 100 * b * j > f) continue;
      water.insert(100 * a * i + 100 * b * j);
    }
  }
  for (int i = 0; c * i <= f; i++){
    for (int j = 0; d * j <= f; j++){
      if (c * i + d * j > f) continue;
      satou.insert(c * i + d * j);
    }
  }
  for(auto i : water){
    for(auto j :satou){
      if(i + j <= f){
        if((double)((double)j / (double)(i + j)) <= per){
          if (mx <= (double)((double)j / (double)(i + j))){
            ans_satou = j;
            ans_all = i + j;
            mx = (double)((double)j / (double)(i + j));
          }
        }
      }
    }
  }
  cout << ans_all << " " << ans_satou << endl;
}

Measured memory_bytes: 384
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<algorithm>
#include<ctime>
#include<map>
using namespace std;
inline int read()
{
	int kkk=0,x=1;
	char c=getchar();
	while((c<'0' || c>'9') && c!='-')
		c=getchar();
	if(c=='-')
		c=getchar(),x=-1;
	while(c>='0' && c<='9')
		kkk=(kkk<<3)+(kkk<<1)+(c-'0'),c=getchar();
	return kkk*x;
}
int n,len[200001],ans,F;
map<int,int> Q;
inline int check(int lim)
{
	Q.clear();
	for(register int i=2;i<=n;++i)
		if(len[i]<=len[i-1])
		{
			while(!Q.empty())
			{
				int zone=Q.rbegin()->first;
				if(zone>len[i])
					Q.erase(zone);
				else
					break;
			}
			int mem=len[i];
			while(Q[mem]+1==lim)
			{
				Q.erase(mem);
				--mem;
			}
			if(!mem)
				return 0;
			Q[mem]+=1;
		}
	return 1;
}
int main()
{
	n=read();
	for(register int i=1;i<=n;++i)
	{
		len[i]=read();
		if(len[i]<=len[i-1])
			F=1;
	}
	if(!F)
	{
		puts("1");
		return 0;
	}
	int l=2,r=n;
	while(l<=r)
	{
		int mid=(l+r)/2;
		if(check(mid))
			ans=mid,r=mid-1;
		else
			l=mid+1;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
using namespace std;
int par[100010];
int rnk[100010];

// 初期化
void init(int n) {
    for (int i = 0; i < n; i++) {
        par[i] = i;
        rnk[i] = 0;
    }
}

// 親探し
int find(int x) {
    if (par[x] == x) return x;
    else return par[x] = find(par[x]);
}

// 併合
void unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) return;
    if (rnk[x] < rnk[y]) par[x] = y;
    else {
        par[y] = x;
        if (rnk[x] == rnk[y]) rnk[x]++;
    }
}

// 同じ木にあるか
bool same(int x, int y) {
    return find(x) == find(y);
}

int main(){
    int n, m;
    cin >> n >> m;
    init(n);
    for (int i = 0; i < m; i++) {
        int x, y, z;
        cin >> x >> y >> z;
        x--;  y--;
        unite(x, y);
    }
    for (int i = 0; i < n; i++) find(i);
    
    bool p[100010] = {};
    for (int i = 0; i < n; i++) {
        p[find(i)] = true;
    }
    int ans = 0;
    for (int i = 0; i < n; i++) if (p[i]) ans++;
    cout << ans<< endl;
    
    
}


Measured memory_bytes: 1152
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
int main()
{
    int n;
    cin >> n;
    vector<ll> v;
    for(int i = 0;i < n;i++)
    {
        ll a;
        cin >> a;
        v.push_back(a);
        if(a == 0)
        {
            cout << "0\n";
            return 0;
        }
    }
    ll ans = 1;
    for(int i = 0;i < n;i++)
    {
        if(v[i] <= 1000000000000000000 / ans)
        {
            ans *= v[i];
        }
        else
        {
            cout << "-1\n";
            return 0;
        }
    }
    cout << ans << "\n";

    return 0;
}

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

int main()
{
    int i,x=0,a;
    char b[5];
    scanf("%s",b);
    if(b[0]==b[1]&&b[1]==b[2]) x=1;
    if(b[1]==b[2]&&b[3]==b[2]) x=1;
    x==1?printf("Yes\n"):printf("No\n");
    return 0;
}


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

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

            double output = 0;

            A = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();

            for (int i = 0; i < N; i++)
            {
                output += (double)1 / A[i];
                
            }

            Console.WriteLine(1 / output);
        }
    }
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;


// ref : https://atcoder.jp/contests/jsc2019-qual/submissions/16521703

int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    string t;
    char c = 'W';
    rep(i, 2 * n){
        if (s[i] != c){
            t += 'L';
            if (c == 'W') c = 'B';
            else c = 'W';
        }
        else {
            t += 'R';
            if (c == 'W') c = 'B';
            else c = 'W';
        }
    }
    
   int cnt = 0;
    rep(i, 2 * n) cnt += (t[i] == 'L');
    if (cnt != n) {
        cout << 0 << endl;
        return 0;
    }
    
    ll ans = 1;
    ll l = 0;
    rep(i, 2 * n){
        if (t[i] == 'L'){
            l++;
        }
        else {
            ans *= l;
            ans %= MOD;
            l--;
        }
    }

    for(ll i = 1; i <= n; i++){
        ans *= i;
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}


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

typedef long long int LL;
typedef long long int LLint;
typedef pair<int,int> intpair;
typedef pair<bool,bool> boolpair;
typedef pair<string,string> strpair;
typedef pair<LL,LL> LLpair;
typedef pair<double,double> doublepair;
typedef pair<float,float> floatpair;
typedef vector<int> intvector;
typedef vector<bool> boolvector;
typedef vector<string> strvector;
typedef vector<LL> LLvector;
typedef vector<double> doublevector;
typedef vector<float> floatvector;
#define wait(sec) usleep((sec) * 1000000)
#define ED return 0;
#define TEST cout << "OK" << endl;
#define UP(a,b) ((a+(b-1))/b)
#define SORT(vec) sort(vec.begin(),vec.end());
#define DOUBLECHANGE(count) cout << setprecision(count);
#define REV(vec) reverse(vec.begin(),vec.end());
#define ipow(x,y) LL(pow(x,y))
#define INF 999999999
const long long mod = 1000000007;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    int total = 0;
    int K;
    int next = 0;
    for(int i = 1;true;i++){
        total += i;
        if(total == N){
            cout << "Yes" << endl;
            K = i;
            break;
        }
        else if(total > N){
            cout << "No" << endl;
            ED
        }
    }
    next = K+1;
    vector<vector<int>> vec (K+1,vector<int> (K));
    for(int i = 0;i < K+1;i++){
        if(i == 0){
            for(int j = 0;j < K;j++){
                vec[0][j] = j + 1;
            }
        }
        else{
            for(int j = 0;j < K;j++){
                if(j < i){
                    vec[i][j] = vec[j][i-1];
                }
                else{
                    vec[i][j] = next;
                    next++;
                }
            }
        }
    }

    cout << K+1 << endl;
    for(int i = 0;i < K+1;i++){
        cout << K << " ";
        for(int j = 0;j < K;j++){
            cout << vec[i][j] << " ";
        }
        cout << endl;
    }
}

Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
int masatoy();
int main(){
    int a;int x[4];
    cin>>a;
    x[0]=a/1000;a%=1000;x[1]=a/100;a%=100;x[2]=a/10;x[3]=a%10;
    if(x[0]+x[1]+x[2]+x[3]==7)cout<<x[0]<<"+"<<x[1]<<"+"<<x[2]<<"+"<<x[3]<<"="<<7<<endl;
     else if(x[0]+x[1]+x[2]-x[3]==7)cout<<x[0]<<"+"<<x[1]<<"+"<<x[2]<<"-"<<x[3]<<"="<<7<<endl;
      else if(x[0]+x[1]-x[2]+x[3]==7)cout<<x[0]<<"+"<<x[1]<<"-"<<x[2]<<"+"<<x[3]<<"="<<7<<endl;
       else if(x[0]-x[1]+x[2]+x[3]==7)cout<<x[0]<<"-"<<x[1]<<"+"<<x[2]<<"+"<<x[3]<<"="<<7<<endl;
        else if(x[0]+x[1]-x[2]-x[3]==7)cout<<x[0]<<"+"<<x[1]<<"-"<<x[2]<<"-"<<x[3]<<"="<<7<<endl;
         else if(x[0]-x[1]-x[2]+x[3]==7)cout<<x[0]<<"-"<<x[1]<<"-"<<x[2]<<"+"<<x[3]<<"="<<7<<endl;
          else if(x[0]-x[1]+x[2]-x[3]==7)cout<<x[0]<<"-"<<x[1]<<"+"<<x[2]<<"-"<<x[3]<<"="<<7<<endl;
           else if(x[0]-x[1]-x[2]-x[3]==7)cout<<x[0]<<"-"<<x[1]<<"-"<<x[2]<<"-"<<x[3]<<"="<<7<<endl;
}

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

using namespace std;

const int maxn = 100010;
const int mod = 998244353;
const int inv2 = (mod + 1) / 2;

int n, base, ans;

int qpow(int x, int y) {
	int ret = 1;
	while (y) {
		if (y & 1) ret = 1LL * ret * x % mod;
		x = 1LL * x * x % mod;
		y >>= 1;
	}
	return ret;
}

struct Graph {
	int m;
	int tag[maxn], vis[maxn], l[maxn], sg[maxn], e;
	struct Edge {
		int v, x;
	} E[maxn];
	inline void addEdge(int u, int v) {
		E[e].v = v, E[e].x = l[u], l[u] = e++;
	}
	int sum[1<<17];
	void dfs(int u) {
		vis[u] = 1;
		for (int p = l[u]; p >= 0; p = E[p].x) {
			int v = E[p].v;
			if (!vis[v]) {
				dfs(v);
			}
		}
		for (int p = l[u]; p >= 0; p = E[p].x) {
			int v = E[p].v;
			tag[sg[v]] = 1;
		}
		for (int i = 0; i <= n; i++) {
			if (!tag[i]) {
				sg[u] = i;
				break;
			}
		}
		for (int p = l[u]; p >= 0; p = E[p].x) {
			int v = E[p].v;
			tag[sg[v]] = 0;
		}
	}
	void read() {
		scanf("%d", &m);
		for (int i = 1; i <= m; i++) {
			int u, v; scanf("%d%d", &u, &v);
			if (u > v) swap(u, v);
			addEdge(u, v);
		}
	}
	void init() {
		memset(l, -1, sizeof(l));
	}
	void solve() {
		for (int i = 1; i <= n; i++) {
			if (!vis[i]) {
				dfs(i);
			}
			(sum[sg[i]] += qpow(base, i)) %= mod;
		}
	}
} G1, G2, G3;

void fwt(int *a, int l, int r) {
	if (l == r) return;
	int m = (l + r) >> 1;
	fwt(a, l, m), fwt(a, m+1, r);
	for (int i = 0; i <= m-l; i++) {
		int v1 = (a[l+i] + a[m+1+i]) % mod, v2 = (a[l+i] + mod - a[m+1+i]) % mod;
		a[l+i] = v1, a[m+1+i] = v2;
	}
}

void ifwt(int *a, int l, int r) {
	if (l == r) return;
	int m = (l + r) >> 1;
	ifwt(a, l, m), ifwt(a, m+1, r);
	for (int i = 0; i <= m-l; i++) {
		int v1 = (a[l+i] + a[m+1+i]) % mod, v2 = (a[l+i] + mod - a[m+1+i]) % mod;
		a[l+i] = 1LL * inv2 * v1 % mod, a[m+1+i] = 1LL * inv2 * v2 % mod;
	}
}

int res[1<<17];

int main() {
	scanf("%d", &n);
	G1.init(), G2.init(), G3.init();
	G1.read(), G2.read(), G3.read();
	base = qpow(10, 18);
	G1.solve(), G2.solve(), G3.solve();
	fwt(G1.sum, 0, (1<<17)-1), fwt(G2.sum, 0, (1<<17)-1), fwt(G3.sum, 0, (1<<17)-1);
	for (int i = 0; i < (1<<17); i++) res[i] = 1LL * G1.sum[i] * G2.sum[i] % mod * G3.sum[i] % mod;
	ifwt(res, 0, (1<<17)-1);
	printf("%d\n", res[0]);
	return 0;
}

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

int main() {
    string s;
    cin >> s;
    unsigned long long ans = 0;
    int w = 0;
    for(string::reverse_iterator rit = s.rbegin(); rit != s.rend(); ++rit){
        if(*rit == 'W') w++;
        else ans += w;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 640
# import sys
# sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]


def solve():
    n = II()
    A = LI()
    # print([bin(a) for a in A])
    mod = 1000000007
    ans = 0
    for i in range(0, 61):
        # i桁目が1の個数を数える
        x = 0
        for a in A:
            if (a >> i) & 1:
                x += 1
        y = n - x       # i桁目が0の個数
        # print(i, x, y)
        # XORなので x*y 通りの組み合わせ
        ans = ans + pow(2, i) * x * y % mod
    print(ans % mod)



if __name__ == '__main__':
    solve()


Measured memory_bytes: 42156
from collections import deque
import sys

sys.setrecursionlimit(10**7)
input = sys.stdin.readline


def main():
    N, M = [int(v) for v in input().split()]

    net = [[] for _ in range(N)]
    for _ in range(M):
        A, B = [int(v) - 1 for v in input().split()]
        net[A].append(B)
        net[B].append(A)

    arrow = [-1] * N

    def search():
        q = deque()
        q.append(0)

        closed = 1

        while q:
            e = q.popleft()
            for n in net[e]:
                if closed & (1 << n) == 0:
                    q.append(n)
                    arrow[n] = e
                    closed |= (1 << n)

        print('Yes')
        for i in arrow[1:]:
            print(i + 1)

    search()


main()


Measured memory_bytes: 34932
"""
順列全探索
"""
import itertools
n, m = map(int, input().split())
path = []
for _ in range(m) :
    a, b = map(int, input().split())
    path.append([a, b])

ans = 0
order_list = list(itertools.permutations(range(2,n+1)))
for order in order_list :
    now = 1
    for i in order :
        if [now,i] in path :
            now = i
        elif [i,now] in path :
            now = i
        else :
            break
    else :
        ans += 1
print(ans)


Measured memory_bytes: 9264
def main():
    arg = raw_input().split(" ")
    N = int(arg[0])
    M = int(arg[1])
    c_pattern = (M/2)

    if N < 1 or N > 10**12:
        return 0
    if M < 1 or M > 10**12:
        return 0

    if N == c_pattern:
        return N
    elif N < c_pattern:
        tmp = M - (N * 2)
        return N + (tmp / 4)
    elif N > c_pattern:
        return int(c_pattern)


print main()


Measured memory_bytes: 2568
MODE = "stdio"
require 'matrix'
line = Array.new

if(defined? MODE)
  line = STDIN.read.split("\n")
else
  tmp = "\
  5 9
  5 6
  10 44
  0 0
  ".split("\n")
  tmp.each{|s|
    line << s.strip
  }
end

n,x=[0,0]
i=0
while true
  n,x = line[i].split(" ").map(&:to_i)
  break if n==0 && x==0
  i += 1
  c =  [*1..n].combination(3)
  puts c.select{|a| a.inject(&:+)==x}.size
end

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

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define each(i, mp) for (auto &i : mp)

int main()
{
  ll x;
  cin >> x;
  ll money = 100;
  ll ans = 0;
  while (1)
  {
    ans++;
    money += money * 0.01;
    if (x <= money)
    {
      break;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3592
#include<cstdio>
using namespace std;
int a[10005];
int main()
{
	int n,k;
	scanf("%d%d",&n,&k);
	for(int i=1;i<=k;i++)
	{
		int d;
		scanf("%d",&d);
		for(int j=1;j<=d;j++)
		{
			int x;
			scanf("%d",&x);
			a[x]=1;
		}
	}
	int ans=0;
	for(int i=1;i<=n;i++)
	{
		if(a[i]==0)
		{
			ans++;
		}
	}
	printf("%d\n",ans);
	return 0;
} 

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

using namespace std;

int main()
{
    int a, b;
    cin >> a >> b;

    string winner;
    if (((a+11) % 13) > ((b+11) % 13)) winner = "Alice";
    else if (((a+11) % 13) < ((b+11) % 13)) winner = "Bob";
    else winner = "Draw";

    cout << winner << endl;
}

Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)
	log.SetFlags(log.Lshortfile)
	s := nextString()
	if s[0] != s[1] || s[1] != s[2] {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

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

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

var dy = []int{0, 1, 0, -1}
var dx = []int{1, 0, -1, 0}
var MAX = math.MaxInt32

func pow(a, b int) int {
	return int(math.Pow(float64(a), float64(b)))
}

func lcm(a, b int) int {
	return a * b / gcd(a, b)
}
func gcd(a, b int) int {
	if a < b {
		a, b = b, a
	}
	for b != 0 {
		a, b = b, a%b
	}
	return a
}
func max(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}
func min(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}
func sum(a []int) (r int) {
	for i := range a {
		r += a[i]
	}
	return r
}
func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

type Pair struct {
	a, b int
}

type Pairs []Pair

func (p Pairs) Len() int {
	return len(p)
}
func (p Pairs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p Pairs) Less(i, j int) bool {
	if p[i].a == p[j].a {
		return p[i].b < p[j].b
	}
	return p[i].a < p[j].a
}


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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define MOD 1000000007
#define cey ce("Yes")
#define cen ce("No")
#define ceY ce("YES")
#define ceN ce("NO")

vecl(S);
vecl(T);
int bin1( ll x, int size) {
	int l = 0, r = size;
	while (r-l>1) {
		int mid = (l + r) / 2;
		if (S[mid]>x) {
			r = mid;
		}
		else {
			l = mid;
		}
	}

	return l;
}

int bin2(ll x, int size) {
	int l = 0, r = size;
	while (r - l > 1) {
		int mid = (l + r) / 2;
		if (T[mid] > x) {
			r = mid;
		}
		else {
			l = mid;
		}
	}

	return l;
}

int main()
{
	int A, B, Q;

	cin >> A >> B >> Q;

	fx(A) {
		vecpl(S);
	}
	fx(B) {
		vecpl(T);
	}

	fy(Q) {
		ll x;
		cin >> x;
		int i = bin1( x, A);
		int j = bin2( x, B);
		ll ans = LLONG_MAX;
		for (int w = 0; w <= 1;w++) {
			if (i+w<0||i+w>=A) {
				continue;
			}
			for (int z = 0; z <= 1; z++) {
				if (j + z < 0 || j + z >= B) {
					continue;
				}
				ll s = S[i + w] - x, t = T[j + z] - x;
				ll ss = abs(s), tt = abs(t);
				if ((s>0&&t<0) || (t > 0&& s < 0)) {
					ans = min({ ans, ss * 2 + tt,tt * 2 + ss });
				}
				else {
					ans = min(ans,max(ss,tt));
				}

			}
		}
		ce(ans)
	}

    return 0;
}



Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int amount = s.nextInt();
		String slime = s.next();
		int total = 1;
		for(int i = 0; i < amount-1; i++) {
			if(slime.charAt(i) != slime.charAt(i+1)){
				total += 1;
			}
		}
		
		System.out.println(total);
	}
}


Measured memory_bytes: 25472