akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

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

  int diff = a + b - (c + d);

  if (diff == 0){
    cout << "Balanced" << endl;
  } else if (diff > 0){
    cout << "Left" << endl;
  } else {
    cout << "Right" << endl;
  }
}


Measured memory_bytes: 256
import java.util.Scanner;


public class Main{
    public static void main(String[] args) {
            Scanner scanner = new Scanner(System.in);
            char[] ch = new char[1200];
            int n = 0;
            while(scanner.hasNextLine()){
                String line = scanner.nextLine();
                line = line.toLowerCase();
                for(int i = 0; i < line.length(); i++){
                    ch[i + n] = line.charAt(i);
                }
                n += line.length(); 
            }
            int[] al = new int[26];
            for(int j = 0; j < 26; j++){
                al[j] = 0;
            }
            for(int j =0; j < n; j++){
                for(int k = 0; k < 26;k++){
                    if((int)ch[j] - (k + 97) == 0){
                        al[k] ++;
                    }
                }
            }
            for(int j = 0; j < 26; j++){
                System.out.printf("%c : %d\n",(97 + j),al[j]);
            }
            scanner.close();
        
    }
}


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

typedef long long int ll;

struct tri
{
  int w, s;
  ll v;
  tri(int w, int s, ll v)
    : w(w), s(s), v(v) {}
  bool operator<(const tri& t) const
  {
    return w + s < t.w + t.s;
  }
};

const int MAX = 1111;
ll dp[MAX][MAX*20+1];

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(0),cout.tie(0);
  int n;
  cin >> n;
  vector<tri> a;
  for(int i=1;i<=n;++i)
  {
    int w, s, v;
    cin >> w >> s >> v;
    a.emplace_back(w, s, v);
  }
  
  sort(a.begin(), a.end());
  
  for(int i=0;i<(int)a.size();++i)
  {
    for(int w=0;w<MAX*20+1;++w)
    {
      if(w <= a[i].s)
        dp[i+1][w+a[i].w] = max(dp[i+1][w+a[i].w], dp[i][w] + a[i].v);
      dp[i+1][w] = max(dp[i+1][w], dp[i][w]);
    }
  }
  
  ll ans = 0;
  for(int i=0;i<MAX*20+1;++i)
    ans = max(ans, dp[n][i]);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 174208
#include<iostream>
using namespace std;
int main()
{
	int N, K, P;
	cin >> N;
	for (int n = 1; n <= N; n++)
	{
		cin >> K >> P;
		if (K < P) { cout << K << endl; }
		else
		{
			if (K%P == 0) { cout << P << endl; }
			else { cout << K%P << endl; }
		}

	}

	return 0;
}

Measured memory_bytes: 1164
// In the name of God

#include <bits/stdc++.h>

using namespace std;

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

	map<string, int> mp;

	int n;
	cin >> n;
	while(n--) {
		string s;
		cin >> s;
		mp[s]++;
	}

	cout << "AC x " << mp["AC"] << "\n";
	cout << "WA x " << mp["WA"] << "\n";
	cout << "TLE x " << mp["TLE"] << "\n";
	cout << "RE x " << mp["RE"] << "\n";

	return 0;
}


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

using namespace std;

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

const int INF10=100000001,ID_MAX=20;
const long mod=1e9+7;
const long long INF18=1e18+1;

struct edge{
    int to;
    long cost;
};

void sort2array(double *a,long *b,long n){
    for(int i=0;i<n;i++){
        b[i]=i;
    }
    sort(b,b+n,[a](long i,long j)->bool {return a[i]<a[j];} );
}
//bを何回足せばaを超えるか(O(a/b))
int wtover(int a,int b){
    if(a%b>0)return (a/b)+1;
    else return a/b;
}
int bi_e[ID_MAX]={0};
//2進数表示したときの最高桁(O(log n))
int bi_max(long n){
    int m=0;
    for(m;(1<<m)<=n;m++);m=m-1;
    return m;
}
//bi_eに二進数表示したやつを代入(O(log^2 n))
void bi_exs(long n){
    memset(bi_e,0,sizeof(bi_e));
    if(n<(1<<ID_MAX)){
        for(int i=0;n>0;n=(n>>1),i++)bi_e[i]=n&1;
    }
}
//x^n mod m (nが負の時は０)(O(log n))
long myPow(long x, long n, long m){
  if(n<0)return 0;
  if(n == 0)
    return 1;
  if(n % 2 == 0)
    return myPow(x * x % m, n / 2, m);
  else
    return x * myPow(x, n - 1, m) % m;
}
//mのn分割数(O(nm))のmod
int divNum(int n,int m){
    long long d[n+1][m+1];
    rep(j,n+1){
        d[j][0]=1;
    }
    rep(j,m){
        d[0][j+1]=0;
    }
    for(int j=1;j<=n;j++){
        for(int k=1;k<=m;k++){
            if(j>k)d[j][k]=d[j-1][k];
            else d[j][k]=(d[j-1][k]+d[j][k-j])%mod;
        }
    }
    return d[n][m];
}

int main(){
    int i;
    //入力
    string s,t;
    cin>>s;
    cin>>t;
    //処理

    //出力
    if(s.size()!=t.size()-1){
        cout<<"No"<<endl;
            return 0;
    }
    rep(i,s.size()){
        if(s[i]!=t[i]){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
}

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


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

  cin >> a >> b >> c;
  if (a == b) cout << c << endl;
  else if (a == c) cout << b << endl;
  else if (b == c) cout << a << endl;
  
  return 0;
}


Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))

cumA=[]
cumB=[]
tmpA=0
tmpB=0

totalB=sum(B)
totalarr=[]
for i in range(N):
    tmpA+=A[i]
    totalarr.append(tmpA+totalB-tmpB)
    tmpB+=B[i]

print(max(totalarr))

Measured memory_bytes: 3064
# include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
typedef long long ll;
set<char>SET;
bool valid(string s){
    for(int i=1;i<s.size();i++){
        if(s[i]!=s[i-1]) return false;
    }
    return true;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s;cin>>s;
    string ori=s;
    int mini=1e9;
    for(char isi:s){
        SET.insert(isi);
    }
    for(auto isi:SET){
        string temp;
        s=ori;
        int ans=0;
        while(!valid(s)){
            temp="";
            for(int i=0;i<(int)s.size()-1;i++){
                if(s[i]==isi || s[i+1]==isi) temp+=isi;
                else temp+=s[i];
            }
            ans++;
            s=temp;
        }
        mini=min(ans,mini);
    }
    cout<<mini<<endl;

}

Measured memory_bytes: 256
h,n = gets.chomp.split.map(&:to_i)

ab = []
n.times do
  a,b = gets.chomp.split.map(&:to_i)
  ab.push [a,b]
end

dp = Array.new(h + 1,  10**100 )

1.upto(h) do |hp|
  ab.each do |damage,cost|
    tmp_cost = hp <= damage ? cost : dp[hp - damage] + cost
    dp[hp] = tmp_cost if tmp_cost < dp[hp]
  end
end

p dp.last


Measured memory_bytes: 2172
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner Ent = new Scanner(System.in);
        int casos = Ent.nextInt();
        long arr[] = new long[casos];
        for (int i = 0; i < casos; i++) {
            arr[i] = Ent.nextLong();
        }
        int saltosM = 0;
        int saltosA = 0;
        for (int i = 1; i < casos; i++) {
            if (arr[i - 1] >= arr[i]) {
                saltosA++;
            } else {
                if (saltosM < saltosA) {
                    saltosM = saltosA;
                }
                saltosA = 0;
            }
        }
        if (saltosA > saltosM) {
            saltosM = saltosA;
        }
        System.out.println(saltosM);
    }
}

Measured memory_bytes: 55712
package main

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

func getNextLine(scanner *bufio.Reader) string {
	var buffer string
	for {
		line, isPrefix, _ := scanner.ReadLine()
		buffer += string(line)
		if isPrefix == false {
			break
		}
	}
	return buffer
}

func getIntList(scanner *bufio.Reader) []int {
	list := strings.Split(getNextLine(scanner), " ")
	l := len(list)
	result := make([]int, l)
	for i := 0; i < l; i++ {
		result[i], _ = strconv.Atoi(list[i])
	}
	return result
}

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

	scanner := bufio.NewReader(fp)
	writer := bufio.NewWriter(os.Stdout)

	var n int
	fmt.Sscan(getNextLine(scanner), &n)
	cards := make([]Card, n)
	cards2 := make([]Card, n)
	aa := strings.Split(getNextLine(scanner), " ")

	for i := 0; i < n; i++ {
		cards[i].suit = rune(aa[i][0])
		cards[i].value, _ = strconv.Atoi(aa[i][1:])
		cards2[i].suit = rune(aa[i][0])
		cards2[i].value, _ = strconv.Atoi(aa[i][1:])
	}

	bubleSort(cards, n)
	printCards(cards, n, writer)
	fmt.Fprintln(writer, "Stable")

	selectionSort(cards2, n)
	printCards(cards2, n, writer)
	stable := "Stable"
	for i := 0; i < n; i++ {
		if cards[i].suit != cards2[i].suit || cards[i].value != cards2[i].value {
			stable = "Not stable"
			break
		}
	}
	fmt.Fprintln(writer, stable)
	writer.Flush()
}

type Card struct {
	suit  rune
	value int
}

func bubleSort(cards []Card, n int) {
	for i := 0; i < n; i++ {
		for j := n - 1; j > i; j-- {
			if cards[j].value < cards[j-1].value {
				cards[j], cards[j-1] = cards[j-1], cards[j]
			}
		}
	}
}
func selectionSort(cards []Card, n int) {
	for i := 0; i < n; i++ {
		minj := i
		for j := i; j < n; j++ {
			if cards[minj].value > cards[j].value {
				minj = j
			}
		}
		if minj != i {
			cards[i], cards[minj] = cards[minj], cards[i]
		}
	}
}

func printCards(cards []Card, n int, writer *bufio.Writer) {
	for i := 0; i < n; i++ {
		fmt.Fprintf(writer, "%c", cards[i].suit)
		fmt.Fprintf(writer, "%d", cards[i].value)
		if i < n-1 {
			fmt.Fprint(writer, " ")
		}
	}
	fmt.Fprintln(writer, "")
}



Measured memory_bytes: 1168
import java.math.BigInteger;
import java.util.Scanner;

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

        int N = sc.nextInt();
        BigInteger[] A = new BigInteger[N];

        for (int i = 0; i < N; i++) {
            A[i] = BigInteger.valueOf(sc.nextLong());

            if (A[i].equals(BigInteger.ZERO)) {
                System.out.println(0);
                return;
            }
        }

        BigInteger max = BigInteger.valueOf((long) Math.pow(10, 18));
        BigInteger res = BigInteger.ONE;

        for (int i = 0; i < N; i++) {
            if (res.multiply(A[i]).compareTo(max) == 1){
                System.out.println(-1);
                return;
            }

            res = res.multiply(A[i]);
        }

        System.out.println(res);

    }
}


Measured memory_bytes: 64000
import java.io.PrintWriter
import java.util.*

val pw = PrintWriter(System.out)
val sc = Scanner(System.`in`)

var N = 0
var M = 0
var X = 0

fun main(args: Array<String>) {
    val(n, m, x) = nextListOfInt()
    N = n; M = m; X = x
    val fig = Array(n){ nextListOfInt() }
    val und = Array(m){x}
    abc167c(fig, und)
}

fun abc167c(fig :Array<List<Int>>, und :Array<Int>) {
    var sum = 0
    val sums = mutableListOf<Int>()
    fun solve(i:Int){
        if(und.all{ it <= 0}) sums.add(sum)
        if(i == N) return
        solve(i+1)
        for(j in 0 until M){
            und[j] = und[j] - fig[i][j + 1]
        }
        sum += fig[i][0]
        solve(i+1)
        for(j in 0 until M){
            und[j] = und[j] + fig[i][j + 1]
        }
        sum -= fig[i][0]
    }
    solve(0)
    if(sums.isNotEmpty()) println(sums.min()) else print("-1")
}


fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextListOfString() = next().split(" ")
fun nextListOfInt() = nextListOfString().map { it.toInt() }
fun nextListOfLong() = nextListOfString().map { it.toLong() }
fun nextListOfDouble() = nextListOfString().map { it.toDouble() }



Measured memory_bytes: 43580
#include <iostream>
#include <algorithm>
#include <climits>

using namespace std;

typedef long long ll;

const ll INF = LLONG_MAX;

int main() {
	ll n, f[100][10], p[100][11],ans = -INF;
	cin >> n;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 10; j++)
			cin >> f[i][j];
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j <= 10; j++)
			cin >> p[i][j];
	}
	for (int i = (1 << 10) - 1; i > 0; i--) {
		int cnt[100]{};
		for (int j = 0; j < 10; j++) {
			if (i & 1 << j) {
				for (int k = 0; k < n; k++) {
					if (f[k][j])cnt[k]++;
				}
			}
		}
		ll sum = 0;
		for (int k = 0; k < n; k++) {
			sum += p[k][cnt[k]];
		}
		ans = max(ans, sum);
	}
	
	cout << ans << endl;
	return 0;
}

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

using namespace std;

int main(int argc, char* argv[]) {
  long N, M;
  cin >> N >> M;

  vector<string> a(N);
  for (int i = 0; i < N; ++i)
    cin >> a[i];

  vector<string> b(M);
  for (int i = 0; i < M; ++i)
    cin >> b[i];

  for (int i = 0; i < N - M + 1; ++i) {
    for (int j = 0; j < N - M + 1; ++j) {
      bool match = false;
      for (int k = 0; k < M; ++k) {
        if (a[i + k].substr(j, M) == b[k])
          match = true;
        else {
          match = false;
          break;
        }
      }
      if (match) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }

  cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 256
program main
  implicit none
  integer i, a1, a2, a3
  read(*, *) a1, a2, a3
  !read(*, *) (L(i), i = 1,N)
  if (a1 + a2 + a3 > 21) then
    write(*, *) 'bust'
  else
    write(*, *) 'win'
  end if
end program main

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
using lint     = long long;
const lint inf = 1LL << 60;
const lint mod = 1000000007;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    double r;
    cin >> r;
    double pi = acos(-1);
    cout << fixed << setprecision(10) << 2.0 * pi * r << "\n";
    return 0;
}

Measured memory_bytes: 3804
#include <iostream>

using namespace std;

int  a[100][100] = {0};
int  b[100][100] = {0};
long c[100][100] = {0};

int main(int argc, const char * argv[])
{
	int n, m, l;
	cin >> n >> m >> l;

	// read
	for(int i = 0; i < n; ++i)
	{
		for(int k = 0; k < m; ++k)
		{
			cin >> a[i][k];
		}
	}
	for(int k = 0; k < m; ++k)
	{
		for(int j = 0; j < l; ++j)
		{
			cin >> b[k][j];
		}
	}

	// calculate
	for(int i = 0; i < n; ++i)
	{
		for(int j = 0; j < l; ++j)
		{
			for(int k = 0; k < m; ++k)
			{
				c[i][j] += a[i][k] * b[k][j];
			}
		}
	}

	// write
	for(int i = 0; i < n; ++i)
	{
		for(int j = 0; j < l; ++j)
		{
			cout << c[i][j];
			if(j != l - 1)
			{
				cout << " ";
			}
			else
			{
				cout << endl;
			}
		}
	}
	
    return 0;
}

Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main() {
    int n;
    string s;
    cin >> n >> s;
    int a[10];
    int b[10][10];
    int c[10][10][10];
    rep(i,10) a[i]=0;
    rep(i,10) rep(j,10) b[i][j]=0;
    rep(i,10) rep(j,10) rep(k,10) c[i][j][k]=0;
    rep(i,n){
        int e=s[i]-'0';
        rep(j,10){
            rep(k,10){
                if (b[j][k]==1) c[j][k][e]=1;
            }
        }
        rep(j,10){
            if (a[j]==1) b[j][e]=1;
        }
        a[e]=1;
    }
    int ans=0;
    rep(i,10) rep(j,10) rep(k,10) {
        if(c[i][j][k]==1) ans++;
    }
    cout << ans << endl;
}


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

typedef long long ll;
#define rep(i,n) for( int (i)=0; (i)<(n); ++(i) )
#define rpv(d) for(auto& v:d)
#define co(n) cout << (n) << endl;
#define cn(n) cin >> n;
#define all(x) (x).begin(), (x).end()

int main(){
  int n;cin>>n;
  int t_=0,x_=0,y_=0;
  rep(i,n){
    int t,x,y;
    cin>>t>>x>>y;
    if (abs(x-x_)+abs(y-y_)>t-t_||(x+x_+y+y_+t+t_)%2){
      puts("No");return 0;
    }
    t_=t;x_=x;y_=y;
  }
  puts("Yes");
}

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

int main(){
	int n;
	int a[210];
	cin >> n;
	rep(i,n) cin >> a[i];
	int ans=0;
	while(true){
		bool exist_odd = false;
		rep(i,n){
			if(a[i]%2!=0){
				exist_odd = true;
			}
		}
		if(exist_odd) break;
		rep(i,n) a[i]/=2;
		++ans;
	}
	cout << ans << endl;
	return 0;
} 

Measured memory_bytes: 256
H,W=map(int,input().split())
board=[input() for _ in range(H)]

def transpose(b):
  L,C=len(b),len(b[0])
  ret=[]
  for c in range(C):
    s=''
    for l in range(L):
      s+=b[l][c]
    ret.append(s)
  return ret

tmp=transpose(board)
ans=[]
for l in tmp:
  if '#' in l:
    ans.append(l)

tmp=transpose(ans)
ans=[]
for l in tmp:
  if '#' in l:
    print(l)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(){
	int a, b, t, time = 0, ans=0;
	cin >> a >> b >> t;
	time = a;
	while(time <= t){
		ans += b;
		time += a;
	}
	cout << ans << endl;
	return 0;
}

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

int main() {
	int x, n;
	cin >> n >> x;
	while (x != 0 || n != 0) {
		int ans = 0;
		for (int i = 1; i <= n;i++) {
			for (int j = i+1; j <= n; j++) {
				for (int k = j+1; k <= n; k++) {
					if (i + j + k == x )
						ans++;
				}
			}
		}
		cout << ans << endl;
		cin >> n >> x;
	}

}


Measured memory_bytes: 3084
using System;
namespace ITP1_3_B
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] x = new int[10000];
            int i, j;
            for(i = 0; i < 10000; i++)
            {
                x[i] = int.Parse(Console.ReadLine());
                if(x[i] == 0)
                {
                    break;
                }
            }
            for(j = 0; j < 10000; j++)
            {
                    Console.WriteLine("Case {0}: {1}", j + 1, x[j]);
            }
        }
    }
}


Measured memory_bytes: 17908
#include <iostream>
#include <vector>
#include <iomanip>
#include <cmath>
using namespace  std;

struct StPnt
{
  double m_nx;
  double m_ny;

  StPnt() :
    m_nx(0), m_ny(0)
  { }
  StPnt(double nx, double ny) :
    m_nx(nx), m_ny(ny)
  { }

  ~StPnt() { }
};

void fnInput(int &rnRcSiz)
{
  cin >> rnRcSiz;
}

void fnKochCrv( const StPnt &cnroPnt1, const StPnt &cnroPnt2, vector<StPnt> &rvoRtnPnt)
{
  const double PI = 3.141592;

  StPnt aoPnt[5];
  aoPnt[0] = cnroPnt1;
  aoPnt[1].m_nx = (2 * cnroPnt1.m_nx + cnroPnt2.m_nx) / 3;
  aoPnt[1].m_ny = (2 * cnroPnt1.m_ny + cnroPnt2.m_ny) / 3;
  aoPnt[3].m_nx = (cnroPnt1.m_nx + 2 * cnroPnt2.m_nx) / 3;
  aoPnt[3].m_ny = (cnroPnt1.m_ny + 2 * cnroPnt2.m_ny) / 3;

  double nRad = 60 * PI / 180; 
  aoPnt[2].m_nx = (aoPnt[3].m_nx - aoPnt[1].m_nx) * cos(nRad) - (aoPnt[3].m_ny - aoPnt[1].m_ny) * sin(nRad);
  aoPnt[2].m_nx += aoPnt[1].m_nx;
  aoPnt[2].m_ny = (aoPnt[3].m_nx - aoPnt[1].m_nx) * sin(nRad) + (aoPnt[3].m_ny - aoPnt[1].m_ny) * cos(nRad);
  aoPnt[2].m_ny += aoPnt[1].m_ny;

  aoPnt[4] = cnroPnt2;

  for (int i = 0; i < 5; i++)
    rvoRtnPnt[i] = aoPnt[i];
}

void fnKochCtl(int nRcSiz, vector<vector<StPnt>> &rvvoPnt)
{
  StPnt oPntB(0.0, 0.0);
  StPnt oPntE(100.0, 0.0);

  rvvoPnt.resize(7);
  rvvoPnt[0].clear();
  rvvoPnt[0].push_back(oPntB);
  rvvoPnt[0].push_back(oPntE);

  for (int nRc = 0; nRc < nRcSiz; nRc++)
  {
    rvvoPnt[nRc + 1].clear();
    rvvoPnt[nRc + 1].push_back(oPntB);
    for (int i = 0; i < rvvoPnt[nRc].size() - 1; i++)
    {
      StPnt oPnt1 = rvvoPnt[nRc][i];
      StPnt oPnt2 = rvvoPnt[nRc][i + 1];
      vector<StPnt> voRtnPnt(5);

      fnKochCrv(oPnt1, oPnt2, voRtnPnt);
      for (int j = 1; j < 5; j++)
        rvvoPnt[nRc + 1].push_back(voRtnPnt[j]);
    }
  }
}

void fnResult(int nRcSiz, const vector<vector<StPnt>> &cnrvvoPnt)
{
  for (int i = 0; i < cnrvvoPnt[nRcSiz].size(); i++)
    cout << cnrvvoPnt[nRcSiz][i].m_nx << " " << cnrvvoPnt[nRcSiz][i].m_ny << endl;
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(8);

  int nRcSiz;
  vector<vector<StPnt>> vvoPnt;

  fnInput(nRcSiz);
  fnKochCtl(nRcSiz, vvoPnt);

  fnResult(nRcSiz, vvoPnt);

  return 0;
}

Measured memory_bytes: 1388
var n:longint;
    i,j:longint;
    a,c:array[0..250,0..20]of longint;
    v:array[0..20]of boolean;
    max:int64;
procedure check;
var i,j,ans,ci:longint;
begin
  ans:=0;
  for i:=1 to n do
  begin
    ci:=0;
    for j:=1 to 10 do
    if (v[j]) then inc(ci,a[i,j]);
    inc(ans,c[i,ci]);
  end;
  if ans>max then max:=ans;
end;
procedure dfs(dep:longint;last:longint);
var i:longint;
begin
  if dep>0 then check;
  for i:=last+1 to 10 do
  begin
    v[i]:=true;
    dfs(dep+1,i);
    v[i]:=false;
  end;
end;
begin
  read(n);
  max:=-maxlongint;
  for i:=1 to n do
    for j:=1 to 10 do
    read(a[i,j]);
  for i:=1 to n do
    for j:=0 to 10 do
    read(c[i,j]);
  dfs(0,0);
  writeln(max);
end.


Measured memory_bytes: 128
import math
import sys
x1,y1,x2,y2 = map(int,input().split())
x3 = x2 - (y2 - y1)
y3 = y2 + (x2 - x1)
x4 = x3 - (x2 - x1)
y4 = y3 - (y2 - y1)
print(x3,y3,x4,y4)




Measured memory_bytes: 2940
#include <bits/stdc++.h>
    #define fio() ios_base::sync_with_stdio(false); cin.tie(NULL)
    #define int long long
    #define MOD 998244353
    using namespace std;
    const int N = 300005;
     
    string s;
    int dp[200006][2];
    int solve(int i, int b)
    {
     
     
        int j = b;
        if(i==s.size())
            return 0;
     
        if(dp[i][b]!=-1)
            return dp[i][b];
        
        if(b==0)
        {
            dp[i][j] = 0;
            if(i!=s.size()-1)
                dp[i][j] = 1+solve(i+2, 1);
            if(s[i]!=s[i-1])
                dp[i][j] = max(dp[i][j], 1+solve(i+1, 0));
        }
     
        if(b==1)
            dp[i][j] = 1 + solve(i+1, 0);
     
        //cout << i << " " << b << " " << dp[i][b] << endl;
        return dp[i][j];
    }
    int32_t main()
    {
        fio();
        cin>>s;
        if(s.size()==1)
            return 1;
        for(int i=0; i<s.size(); i++)
            dp[i][0] = -1, dp[i][1] = -1;
        cout << 1+ max(solve(1, 0), solve(2, 1)); 
    }

Measured memory_bytes: 7828
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
//
int main(){
    int dep[] = {1, 6, 9, 36, 81, 216, 729, 1296, 6561, 7776, 46656, 59049};
    int dp[100001];
    for(int i = 1; i < 100001; i++){
        int mn = INT_MAX;
        for(int j = 0; j < 12; j++){
            if(i < dep[j]) break;
            mn = min(mn, dp[i - dep[j]] + 1);
        }
        dp[i] = mn;
    }
    int n;
    cin >> n;
    cout << dp[n] << endl;
}

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

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

string s;

bool reach(int p, int g){
  for(int i=p; i<g; i++){
    if(s.at(i)=='#'&&s.at(i+1)=='#') return false;
  }
  return true;
}

bool over(int b, int c){
  if(s.at(b-1)=='.'&&s.at(b+1)=='.') return true;
  if(s.at(c-1)=='.'&&s.at(c+1)=='.') return true;
  
  for(int i=b; i<c-1; i++){
    if(s.at(i)=='.'&&s.at(i+1)=='.'&&s.at(i+2)=='.') return true;
  }
  return false;
}

int main(){
  int n,a,b,c,d;
  cin >>n>>a>>b>>c>>d;
  a--; b--; c--; d--;

  cin >> s;
  if(c<d){
    if(reach(a,c)&&reach(b,d)) cout<<"Yes";
    else cout<<"No";
  }else{
    if(reach(a,c)&&reach(b,d)&&over(b,d)) cout<<"Yes";
    else cout<<"No";
  }
}

Measured memory_bytes: 3756
#include <iostream>

char c[10][10];

int main()
{
    int h, w, k;
    scanf("%d %d %d", &h, &w, &k);
    int t = 0;
    for (int i = 0; i < h; i++)
    {
        for (int j = 0; j < w; j++)
        {
            scanf(" %c", &c[i][j]);
            if (c[i][j] == '#') t++;
        }
    }
    int s = 0;
    for (int i = 0; i < (1 << h); i++)
    {
        for (int j = 0; j < (1 << w); j++)
        {
            int r = t;
            for (int x = 0; x < h; x++)
            {
                for (int y = 0; y < w; y++)
                {
                    if (c[x][y] == '#')
                    {
                        if (((1 << x) & i) || ((1 << y) & j))
                        {
                            r--;
                        }
                    }
                }
            }
            if (r == k) s++;
        }
    }
    printf("%d\n", s);
    return 0;
}

Measured memory_bytes: 3828
#include<cstdio>
#include<cstring>
#include<string>

using namespace std;

char w[27];
int flag[27];
int vis;

int main()
{
	scanf("%s",w);
	int len = strlen(w);
	for(int i = 0;i < len;i++){
		flag[w[i]-'a' + 1] ++;
	}
	for(int i = 1;i <= 26;i++){
		if(flag[i] != 1 && flag[i] != 0) vis = 1;
	}
	if(vis == 1) printf("no\n");
	else printf("yes\n");
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep0(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define mREP(i,a,b) for (int i = a; i > (b); --i)
#define all(x) (x).begin(),(x).end()
const int INF = 1000000007;
typedef long long ll;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; } 
int main(){
  ll a;cin >> a;
  for(ll i = sqrt(a); i > 0; i--){
    if(a % i == 0){
      cout << i + (a / i) - 2 << endl;
      return 0;
    }
  }
  return 0;
}


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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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

const ll INF = 1e15;
const ll MOD = 1e9+7;
const ll LINF = 1e18;


signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  double a; cin>>a;
  double ans=2*a*PI;
  cout<<std::setprecision(10)<<ans<<endl;
}

Measured memory_bytes: 3804
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>
using ll = long long;

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define reps(i,x) for(ll i=1;i<=(ll)(x);i++)
#define rrep(i,x) for(ll i=((ll)(x)-1);i>=0;i--)
#define rreps(i,x) for(ll i=(ll)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007 
using namespace std;
ll q[31];
ll r[31];
int main() {
    int a, b, c;
    cin >> a >> b >> c;
    if(a==b && b==c && c==a) cout << "Yes";
    else cout << "No";
    cout << endl;
}



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

int main() {
    int r, g, b;
    cin >> r >> g >> b;
    int a;
    a = r * 100 + g * 10 + b;
    a %= 4;
    if(a == 0){
        cout << "YES" << endl;
    }
    else if( a != 0){
        cout << "NO" << endl;
    }

}


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

int main(void){
    int a,b,c,d,ans;
    scanf("%d %d %d %d",&a,&b,&c,&d);
    if(b<c||d<a)ans=0;
    else{
        if(a<=c&&d<=b){
            ans=d-c;
        }
        else if(c<=a&&b<=d){
            ans=b-a;
        }
        else if(a<=c&&c<=b){
            ans=b-c;
        }
        else if(a<=d&&d<=b){
            ans=d-a;
        }
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 128
import sys
input = sys.stdin.readline


def read():
    H, W = map(int, input().strip().split())
    N = int(input().strip())
    A = list(map(int, input().strip().split()))
    return H, W, N, A


def solve(H, W, N, A):
    X = []
    for i in range(N):
        X.extend([i+1] * A[i])
    for i in range(H):
        if i % 2 == 1:
            line = X[W*i:W*(i+1)][::-1]
        else:
            line = X[W*i:W*(i+1)]
        print(' '.join(map(str, line)))


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))


Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,d,e;
  cin>>a>>b>>c>>d>>e;
  if(a==0) cout<<"1"<<endl;
  else if(b==0) cout<<"2"<<endl;
  else if(c==0) cout<<"3"<<endl;
  else if(d==0) cout<<"4"<<endl;
  else if(e==0) cout<<"5"<<endl;
}


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

using namespace std;

using int64 = long long;

class Range {
 private:
  struct RI {
    int x; int step;
    int operator*() { return x; }
    bool operator!=(RI& o){ return x < o.x; }
    void operator++(){ x += step; }
  };
  RI l, r;
 public:
  Range(int r) : l({0, 1}), r({r, 1}) {}
  Range(int l, int r, int step=1) : l({l, step}),r({r, step}) {}
  RI& begin(){ return l; } RI& end() { return r; }
};

Range InclusiveRange(int l, int r) { return Range(l, r + 1); }

vector<int> ReadIntVector(int n) {
  vector<int> xs(n);
  for (int i = 0; i < n; i++) cin >> xs[i];
  return xs;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  
  int n, x;
  cin >> n >> x;
  vector<int> ls = ReadIntVector(n);

  int current = 0;
  int count = 1;
  for (int i : Range(n)) {
    current += ls[i];
    if (current <= x) count++;
  }
  cout << count << endl;
}


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

score = [list(map(lambda x: int(x) - 1 , input().split())) for _ in range(int(n*(n-1)/2))]

points = [0 for _ in range(n)]

for a,b,c,d in score:
    if c > d:
        points[a] += 3
    elif c < d:
        points[b] += 3
    else:
        points[a] += 1
        points[b] += 1

rank = sorted(points)
rank.reverse()

for p in points: 
    print(rank.index(p) + 1)

Measured memory_bytes: 7500
H,W,N = map(int,input().split())
sr,sc = map(int,input().split())
S = input().strip()
T = input().strip()
cur = sc
flag=0
for i in range(N):
    if S[i]=="R":
        cur += 1
        if cur>W:
            flag = 1
            break
    if cur>1 and T[i]=="L":
        cur -= 1
cur = sc
for i in range(N):
    if S[i]=="L":
        cur -= 1
        if cur<1:
            flag = 1
            break
    if cur<W and T[i]=="R":
        cur += 1
cur = sr
for i in range(N):
    if S[i]=="U":
        cur -= 1
        if cur<1:
            flag = 1
            break
    if cur<H and T[i]=="D":
        cur += 1
cur = sr
for i in range(N):
    if S[i]=="D":
        cur += 1
        if cur>H:
            flag = 1
            break
    if cur>1 and T[i]=="U":
        cur -= 1
if flag==1:
    print("NO")
else:
    print("YES")

Measured memory_bytes: 3788
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <iostream>
using namespace std;
typedef long long ll;
ll a, b, c, i, j, k, n, m;
ll arr[100005];
int main() {
	cin >> n;
	j = 0;
	for (i = 0; i < n; i++)
	{
		cin >> a;
		if (i % 2 == 0)
		{
			if (a % 2 == 1)
				j++;
		}
	}
	cout << j;
	return 0;
}

Measured memory_bytes: 3164
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
 
const int N=405;
const int MOD=1e9+7;
 
int n, c;
int a[N], b[N];
int cache[N][N], cache2[N][N];
 
int pow(int a, int b, int m)
{
	int ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}

int dp2(int idx, int c)
{
	int &ans=cache2[idx][c];
	if(ans!=-1)
		return ans;
	ans=0;
	for(int cur=a[idx];cur<=b[idx];cur++)
		ans+=pow(cur, c, MOD);
	ans%=MOD;
	return ans;
}
 
 
int dp(int idx, int remc)
{
	if(idx==n+1)
		return (remc==0);
	int &ans=cache[idx][remc];
	if(ans!=-1)
		return ans;
	ans=0;
	for(int c=0;c<=remc;c++)
	{
		ans+=dp(idx+1, remc-c) * dp2(idx, c);
		ans%=MOD;
	}
	return ans;
}
 
int32_t main()
{
	IOS;
	memset(cache, -1, sizeof(cache));
	memset(cache2, -1, sizeof(cache2));
	cin>>n>>c;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	for(int i=1;i<=n;i++)
		cin>>b[i];
	int ans=dp(1, c);
	cout<<ans;
	return 0;
}

Measured memory_bytes: 2816
//Deep Godhani
//DAIICT

#include<bits/stdc++.h>
using namespace std;

#define N 100000000000
#define PI acos(-1)
#define INF LONG_LONG_MAX
#define NINF LONG_LONG_MIN
#define ll long long int
#define ld long double
#define precision(x,d) cout << fixed << setprecision(d) << x
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL))

#include <bits/stdc++.h>
using namespace std;

const ll M = 2019;

void solve()
{
  string s;
  cin >> s;
  int n = s.length();
  int sub = 0,pow_of_ten = 1;
  vector<int> v(M);
  v[sub]++;
  ll ans = 0;
  for(int i=n-1;i>=0;i--)
  {
    int digit = s[i] - '0';
    sub = (sub + digit*pow_of_ten) % M;
    pow_of_ten = (10*pow_of_ten)%M;
    ans += v[sub];
    v[sub]++;
  }
  cout << ans << endl;
}

int main()
{
    FAST;
    ll t=1;
    //cin >> t;
    while(t--)
    {
      //cout << "************" << endl;
      solve();
      //cout << "************"  << endl;
    }
		return 0;
}


Measured memory_bytes: 3660
n, m = gets.split.map(&:to_i)
lr = Array.new(m){gets.split.map(&:to_i)}.transpose
l_max = lr[0].max
r_min = lr[1].min

#p lr

ans = 0

#答えがあるとき
if l_max <= r_min
  ans = r_min - l_max + 1
end

puts ans


Measured memory_bytes: 22320
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String str[] =S.split(""); 
        int sum = 0;
        for(int i=0;i<str.length/2;i++)
        {
            if(!(str[i].equals(str[str.length-i-1])))
            {
                sum++;
            }
        }
        System.out.println(sum);
    }
}


Measured memory_bytes: 21844
import java.io.*;
import java.util.StringTokenizer;
import java.util.ArrayList;
import java.util.Collections;

class Main {
	public static void main(String args[]) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String buf;

		try {
			
			while (!(buf = br.readLine()).equals("0")) {
				int n = Integer.parseInt(buf);
				StringTokenizer st = new StringTokenizer(br.readLine());
				ArrayList<Integer> a = new ArrayList<Integer>();

				for (int i=0;i<n;i++) a.add(Integer.parseInt(st.nextToken()));
				Collections.sort(a);

				boolean end = false;
				for (int i=0;i<n;) {
					int count = 1;
					int j = a.get(i);
					i++;
					while (i<a.size()&&j==a.get(i)) {
						count++;i++;
					}
					if (count>n/2) {
						System.out.println(a.get(i-1));
						end = true;
					}
					if (end) break;
				}
				if (!end) {
					System.out.println("NO COLOR");
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}

Measured memory_bytes: 194072
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<map>
using namespace std;
int main() {
  long long b=0,w=0;
  string s;
  cin >> s;
  for(int i=0; i<s.size(); i++) {
    if(s[i]=='B') {
      b++;
    }
    else {
      w+=b;
    }
  }
  cout << w << endl;
}


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

using namespace std;

int main() {
  int n,y;
  cin>>n>>y;
  y/=1000;
  
  int a=y%5;
  y-=a;
 
  int b=y%10;
  
  y-=b;
  b/=5;
  int c=y/10;
  n-=a;
  n-=b;
  if(n>y||n<c){
    cout<<-1<<" "<<-1<<" "<<-1<<endl;
    return 0;
  }
 
  for(int i=0; i<=c;i++){
    if((10*c-9*i-n)%4!=0){
      continue;
    }
    if(10*c-9*i<n||2*c-i>n){
      continue;
    }
    int k=(10*c-9*i-n)/4;
    cout<<i<<" "<<k+b<<" "<<10*c-10*i-5*k+a<<endl;
    return 0;
  }
  cout<<-1<<" "<<-1<<" "<<-1<<endl;
  
  
  
  
  
}

Measured memory_bytes: 3624
#include<iostream>
using namespace std;
int N;
int a[210];
int main(){
  cin >> N;
  for(int i = 0;i < N;i++) cin >> a[i];
  
  int res = 0;
  while(true){
    bool odd = false;
    for(int i = 0;i < N;i++){
      if(a[i] % 2 == 1) odd = true;
    }
    if(odd) break;
    for(int i = 0;i < N;i++){
      a[i] /= 2;
    }
    ++res;
  }
  cout << res << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int a,b;
    scanf("%d %d",&a,&b);

    if(b%2==0)
    {
        if (a>=0&&a<=5)
        {
            printf("0");

        }
        else if (a>=6 && a<=12 )
        {
            printf("%d",b/2);
        }
        else
        {
            printf("%d",b);
        }


    }
    return 0;

}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000000
using namespace std;
string s, chk;
int main()
{
    cin >> s;
    chk = s;
    for (int i = 0 ; i < s.size() / 2 ; ++i )
       swap( s[i], s[ s.size()-1 - i ] );
    for (int i = 0 ; i < s.size() ; ++i)
     switch ( s[i] )
    {
        case 'b' : s[i] = 'd' ; break ;
        case 'd' : s[i] = 'b' ; break ;
        case 'p' : s[i] = 'q' ; break ;
        case 'q' : s[i] = 'p' ; break ;
    } 
    if ( s != chk )
      printf("No\n");
    else
      printf("Yes\n");

    return 0;
}

Measured memory_bytes: 512
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string.h>
#include <algorithm>
#include <iostream>

using namespace std;

int main()
{
	int a[3], b[3], i, j, ans1 = 0, ans2 = 0, ans3 = 0;
	
	for (i = 0; i < 3; i++) {
		cin >> b[i];
	}
	
	a[0] = abs(b[0] - b[1]);
	a[1] = abs(b[2] - b[0]);
	a[2] = abs(b[2] - b[1]);

	for (i = 1; i <= 2; i++) {
		if (a[0] < a[i]) {
			int temp;
			temp = a[0];
			a[0] = a[i];
			a[i] = temp;
		}
	}

	cout << a[1]+a[2] << endl;
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
while 1:
    H, W = map(int, input().split())
    if H == 0 and W == 0:
        break
    if W%2 == 0:
        w1 = "#."*(int(W/2))
        w2 = ".#"*(int(W/2))
        if H%2 == 0:
            for i in range(int(H/2)):
                print(w1)
                print(w2)
        else:
            H -= 1
            for i in range(int(H/2)):
                print(w1)
                print(w2)
            print(w1)
    else:
        W -= 1
        w1 = "#."*(int(W/2))+"#"
        w2 = ".#"*(int(W/2))+"."
        if H%2 == 0:
            for i in range(int(H/2)):
                print(w1)
                print(w2)
        else:
            H -= 1
            for i in range(int(H/2)):
                print(w1)
                print(w2)
            print(w1)
    print()


Measured memory_bytes: 5620
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int GoukeiMasu = sc.nextInt() + 1;
		int ryokinjyoSuu = sc.nextInt();
		int syokaiIti = sc.nextInt();
		List<Integer> ryokinjyoItiList = new ArrayList<Integer>();
		for(int i=0;i<ryokinjyoSuu;i++) {
			ryokinjyoItiList.add(sc.nextInt());
		}
		//左に行く
		int imanoIti = syokaiIti;
		int hidariRyokin = 0;
		while(imanoIti != 0) {
			imanoIti--;
			if(ryokinjyoItiList.contains(imanoIti)) {
				hidariRyokin++;
			}
		}
		//右に行く
		imanoIti = syokaiIti;
		int migiRyokin = 0;
		while(GoukeiMasu != imanoIti) {
			imanoIti++;
			if(ryokinjyoItiList.contains(imanoIti)) {
				migiRyokin++;
			}
		}
		System.out.println((hidariRyokin<migiRyokin)?hidariRyokin:migiRyokin);
	}
}

Measured memory_bytes: 22996
#include <bits/stdc++.h>
#include <stdio.h>
#include <math.h>
using namespace std;
using vi = vector<int>;
using vll = vector<long long int>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long int>>;
using ll = long long int;

int main(){
    ll N, K; cin >> N >> K;
    vll A(N+1);
    for(int i=1; i<N+1; i++){
        cin >> A[i];
    }
    vb v(N+1, false);
    ll k = 1;
    v[1] = true;
    vll n(N+1, 10000000000);
    n[1] = 0;
    ll h = 1;
    ll j;
    bool d = true;
    for(int i=0; i<K; i++){
        if(v[A[k]] == false){
            v[A[k]] = true;
            n[A[k]] = h;
            k = A[k];
        }else{
            j = h - n[A[k]];
            d = false;
            break;
        }
        h++;
    }
    if(d){
        cout << k;
    }else{
        ll g = (K-h)%j;
        ll r = A[k];
        for(int i=0; i<g; i++){
            r = A[r];
        }
        cout << r;
    }
}

Measured memory_bytes: 6424
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007
#define all(x) x.begin(), x.end()

int binpow(int a, int b)
{
    int ans = 1;
    if (b == 0)
        return 1;
    while (b)
    {
        if (b & 1)
            ans = ans * a;
        a = a * a;
        b >>= 1;
    }
    return ans;
}

//read question carefully!

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t = 1;
    // cin >> t;
    while (t--)
    {
        int n;
        cin >> n;
        int a[n];
        for (int i = 0; i < n; ++i)
            cin >> a[i];
        int sum = 0;
        for (int i = 1; i < n; ++i)
        {
            if (a[i] < a[i - 1])
            {
                sum += a[i - 1] - a[i];
                a[i] = a[i - 1];
            }
        }
        cout << sum << "\n";
    }
}


Measured memory_bytes: 5212
import java.util.Scanner;

/*
 * AtCoder Beginner Contest 101 A
 */
public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		String s = scanner.next();
		String[] sArray = s.split("");


		int result = 0;
		for (String str : sArray) {
			if (str.equals("+")) {
				result++;
			} else {
				result--;
			}
		}

		System.out.println(result);

	}

}

Measured memory_bytes: 21332
n = int(input())  # 数値入力
str = list(input())  # 一文字ずつ格納
k = int(input())
k -= 1
ans = ""

for i in range(n):
    if str[i] != str[k]:
        ans += "*"
    else:
        ans += str[i]

print(ans)


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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define EPS (1e-8)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

typedef long long ll;

void compute() {

}

int main() {
  int h,w;
  char c;
  cin >> w >> h >> c;
  rep(y,h) {
    if( y == 0 || y == h-1 ) {
      rep(x,w) {
	if( x == 0 || x == w-1 ) {
	  cout << "+";
	} else {
	  cout << "-";
	}
      }
      puts("");
    } else {
      rep(x,w) {
	
	if( y == (h-1)/2 && x == ( w - 1 ) / 2 ) {
	  cout << c;
	}
	else if( x == 0 || x == w-1 ) {
	  cout << "|";
	} else {
	  cout << ".";
	}
      }
      puts("");
    }
  }

  compute();
  return 0;
}



Measured memory_bytes: 3088
#include <stdio.h>
#include <string.h>
#include <math.h>

int main() {
  int N;
  long int A[110] ;
  int i;

  scanf("%d", &N);

  for (i = 0; i < N; i++) {
    scanf("%ld", &A[i]);
  }

  int max = A[0];
  int min = A[0];


  for (i = 0; i < N; i++) {
    if (A[i] > max) {
      max = A[i];
    }
  }

  for (i = 0; i < N; i++) {
    if (A[i] < min) {
      min = A[i];
    }
  }

  printf("%d\n", max - min);

}


Measured memory_bytes: 128
import sys
input = sys.stdin.readline

N = int(input())
ab = [list(map(int, input().split())) for _ in range(N)]
ab = sorted(ab, key=lambda x:x[1])
now = 0
for i in range(N):
    now += ab[i][0]
    if ab[i][1] < now:
        print('No')
        quit()
print('Yes')

Measured memory_bytes: 55272
#include<bits/stdc++.h>
using namespace std;
int n2[10001]={0};
int masatoy(int,int);
int main(){
    while(1){
    int n,minx=0;
    cin>>n;
    if(n==0)return 0;
    for(int i=0;i<n;i++)cin>>n2[i];
    for(int i=0;i<n;i++){
        int hideo=n2[i];
        for(int j=1;j<=3;j++){
            n2[i]=j;
            minx=max(minx,masatoy(n,i));
        }
        n2[i]=hideo;
    }
    cout<<n-minx<<endl;
    }
}
int masatoy(int n,int j){
    int under=j, above=j+1,sum1=0,sum2=0,cnt=0,place;
    while(1){
        sum1=0;
        sum2=0;
        place=n2[under];
        for(int i=under;i>=0&&n2[i]==place;i--){
            sum1++;
            under--;
        }
        for(int i=above;i<n&&n2[i]==place;i++){
            sum2++;
            above++;
        }
        if(sum1+sum2>3){
            //under-=(sum1);
            //above+=(sum2);
            cnt+=sum1+sum2;
        }
        else break;
    }
    //cout<<under<<" "<<above<<endl;
    //cout<<endl;
    return cnt;
}

Measured memory_bytes: 3120
program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils,Classes;
var
  h,w,i,j,count,x,y,m,n,c,a,b,min:Integer;
  s:array of integer;
  s1,s2,s3:string;
  sw:char;
  tf:Boolean;
  nyu:TStringList;
begin
  try
    { TODO -oUser -cConsole Main : ここにコードを記述してください }
    Readln(n);

    SetLength(s,n);
    min:=101;
    count:=0;
    for i := 0 to n - 1 do begin
      Readln(s[i]);
      count:=count+s[i];
      if s[i] mod 10 <> 0 then
        min:=(min+s[i]-abs(min-s[i]))div 2;
    end;

    if (count mod 10 = 0)and (min<=100) then
      count:=count-min;

    if count mod 10 = 0 then
      count:=0;

    Writeln(count);
    Readln;
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
end.


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define Int int64_t
#define dump(x) cout << (x) << endl
#define fi first
#define se second
Int mod = 1e9+7;
Int INF = 1e18;
double EPS = 0.00000001;
//Int mod = 998244353;

int main() {
    Int a, b;
    cin >> a >> b;
    if (abs(a - b) % 2 == 1) {
        dump("IMPOSSIBLE");
    }
    else {
        dump(abs(a - b) / 2 + min(a, b));
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
constexpr int64_t mod=1e9+7;

int main()
{
  int64_t n;
  cin>>n;
  std::vector<int64_t> a(n);
  for(auto&& e: a) {
    cin>>e;
  }
  sort(a.begin(), a.end());
  std::multiset<int64_t> one,zero;
  one.insert(a[0]);
  one.insert(a.back());
  for (int i = 1; i < n-1; ++i)
  {
    zero.insert(a[i]);
  }
  int64_t ans=a.back()-a[0];
  while(!zero.empty()){
    int64_t one_min=*one.begin(),one_max=*one.rbegin();
    int64_t zero_min=*zero.begin(),zero_max=*zero.rbegin();
    int64_t tmp1=abs(one_min-zero_max),tmp2=abs(one_max-zero_min);
    if(tmp1>tmp2){
      one.erase(one.lower_bound(one_min));
      one.insert(zero_max);
      zero.erase(zero.lower_bound(zero_max));
    }
    else{
      one.erase(one.lower_bound(one_max));
      one.insert(zero_min);
      zero.erase(zero.lower_bound(zero_min));
    }
    ans+=max(abs(one_min-zero_max),abs(one_max-zero_min));
  }
  cout<<ans;
}

Measured memory_bytes: 5760
//   _/                _/                 _/_/_/   _/
//_/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
// _/     _/    _/   _/     _/    _/  _/_/_/     _/
//_/     _/    _/   _/     _/    _/  _/    _/   _/
// _/_/   _/_/       _/_/   _/_/      _/_/     _/
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=2e9;
const ll INF=9e18;
typedef pair<int,int> P;
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  int n;
  vector<int> v;
  cin >> n;
  cout << n << ": ";
  for(int i=2; i*i<=n; i++) {
    while(n%i==0) {
      v.push_back(i);
      n/=i;
    }
  }
  if(n>1) {
    v.push_back(n);
  }
  for(int i=0; i<v.size()-1; i++) {
    cout << v[i] << " ";
  }
  cout << v[v.size()-1] << endl;
}


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

int main() {
  string s;
  cin >> s;
  bool AC = true;
  if(s[0] != 'A') AC = false;
  int count = 0;
  for(int i=2; i<s.size()-1; i++) {
    if(s[i]=='C') count++;
    else if (isupper(s[i])) AC = false;
    if(i==s.size()-2 && count != 1) AC = false;  
  }
  for(int i=1; i<s.size(); i++) {
    if(i==1 || i==s.size()-1) {
      if(isupper(s[i])) AC = false;
    }
  }
  if(AC) cout << "AC" << endl;
  else cout << "WA" << endl;
  return 0;
 }

Measured memory_bytes: 3588