akhauriyash/Code-Regression huggingface dataset:
#include<iostream>

using namespace std;

long long dp[55][5555];
int n, a, x[55];

main(){
    cin >> n >> a;
    for(int i = 0; i < n; i++) cin >> x[i];
    dp[0][2500] = 1;
    for(int i = 0; i < n; i++){
        x[i] -= a;

        for(int j = 0; j <= 5000; j++){
            dp[i+1][j] += dp[i][j];
            if(j <= 5000-x[i]) dp[i+1][j+x[i]] += dp[i][j];
        }
    }
    cout << dp[n][2500]-1 << endl;

    return 0;
}

Measured memory_bytes: 2432
import           Control.Monad
import           Control.Monad.ST
import qualified Data.Array                  as A
import qualified Data.Array.ST               as ST
import qualified Data.Array.Unboxed          as AU
import           Data.Bits
import qualified Data.ByteString.Char8       as BS
import           Data.Char
import           Data.Int
import qualified Data.IntMap                 as IM
import           Data.List
import qualified Data.Map                    as M
import           Data.Maybe
import           Data.Ord
import qualified Data.Set                    as S
import           Data.Time
import qualified Data.Vector                 as V
import qualified Data.Vector.Mutable         as VM
import qualified Data.Vector.Unboxed         as VU
import qualified Data.Vector.Unboxed.Mutable as VUM

readInt :: IO [Int]
readInt = map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine

readInts :: Int -> IO [[Int]]
readInts n = replicateM n readInt

readInteger :: IO [Integer]
readInteger = map (fst . fromJust . BS.readInteger) . BS.words <$> BS.getLine

readIntegers :: Int -> IO [[Integer]]
readIntegers n = replicateM n readInteger

readString :: IO [String]
readString = map BS.unpack . BS.words <$> BS.getLine

readStrings :: Int -> IO [[String]]
readStrings n = replicateM n <$> readString

toPair :: [a] -> (a, a)
toPair [x, y] = (x, y)

main = do
  [n] <- readInt
  w <- replicateM n getLine
  putStrLn $ solve w


solve x
  | b && f x = "Yes"
  | otherwise = "No"
  where
    b = length (group (sort x)) == length x

f [_] = True
f (x:y:xs)
  | last x == head y = f (y : xs)
  | otherwise = False


Measured memory_bytes: 636
def solve():
  n,k = (int(i) for i in input().split())
  s = input()
  one = []
  zero = []  
  for i in range(n):
    if i == 0:
      if s[i] == "0":
        one.append(0)
        zero.append(1)
      else:
        one.append(1)
    
    else:     
     if s[i] == s[i-1]:
      if s[i] == "0":
        zero[-1]+= 1
      else:
        one[-1] += 1
     else:
      if s[i] == "0":
        zero.append(1)
      else:
        one.append(1)
  ans = 0 
  if len(zero) <= k:
    ans = n

  else:
   one = one + [0]*5
   zero = zero + [0]*5
   tmp = 0
   for i in range(k+1):
    tmp += one[i]
   for i in range(k):
    tmp += zero[i]
   ans = max(tmp,ans)
   for i in range(len(zero)-k-1):
        
       tmp -=  one[i]
       tmp +=  one[i+k+1]
       tmp -=  zero[i]
       tmp +=  zero[i+k]
       ans = max(ans,tmp)

  #print (one) 
 # print(zero)
  print(ans)
    
solve()

Measured memory_bytes: 4596
import java.util.Scanner;
class Main{
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String s =in.nextLine();
		if (s.endsWith("s")){
			s=s.concat("es");
		}
		else{
			s=s.concat("s");
		}
		System.out.println(s);
	}
}

Measured memory_bytes: 35668
N = gets.chomp.to_i
str = gets.split
a = Array.new(N)
for i in 0...N do
    a[i] = str[i].to_i
end
str = gets.split
b = Array.new(N)
for i in 0...N do
    b[i] = str[i].to_i
end
c = Array.new(N,1)
for i in 1...N do
    c[N-1-i] = c[N-i]*i
end
d = Array.new(0)
for i in 1..N do
    d.push(i)
end
e = Array.new(0)
for i in 1..N do
    e.push(i)
end

f = 1
i = 0
while d.size >= 2
    x = a[i]
    j = 0
    while x != d[j]
       j += 1 
    end
    f += c[i]*j
    d.delete_at(j)
    i += 1
end
g = 1
i = 0
while e.size >= 2
    x = b[i]
    j = 0
    while x != e[j]
       j += 1 
    end
    g += c[i]*j
    e.delete_at(j)
    i += 1
end

answer = (f-g).abs
puts answer

Measured memory_bytes: 1788
<?php
list($k) = ints();
$a = ints();
$maxn = $minn = 2;
for ($i = $k - 1; $i >= 0; --$i) {
    if (intdiv($maxn, $a[$i]) === intdiv($minn - 1, $a[$i])) exit('-1');
    $maxn = (intdiv($maxn, $a[$i]) + 1) * $a[$i] - 1;
    $minn = (intdiv($minn, $a[$i]) + min(1, $minn % $a[$i])) * $a[$i];
}
echo $minn . ' ' . $maxn;
function ints()
{
    return array_map('intval', explode(' ', trim(fgets(STDIN))));
}


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

using namespace std;
#define ll long long
inline ll read()
{
    ll d=0,f=1;
    char ch=getchar();
    while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
    while(isdigit(ch)){d=d*10+ch-'0';ch=getchar();}
    return d*f;
}

int main()
{
    int n;
    n=read();
    int mi=0;
    for(int i=1;i<=n;i++)
    {
        int t=read();
        if(t<mi)
        {
            printf("No\n");
            return 0;
        }
        mi=max(mi,t-1);
    }
    printf("Yes\n");
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define mod 1000000007

using namespace std;

void input() {
	int k;
	cin>>k;
	
	string s;
	for(int i=1;i<=k;i++) {
		s += "ACL";
	}
	cout<<s;
}

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	input();

	return 0;
}



Measured memory_bytes: 3640
N = int(input())
W = [[] for _ in range(N)]
seen = []
for i in range(N):
    W[i] = input()
judge = 0
for tango in W:
    if tango not in seen:
        seen.append(tango)
    else:
        judge = 1
for i in range(N-1):
    if W[i][-1] != W[i+1][0]:
        judge = 1
if judge == 0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
package main

import "fmt"

func main(){
	var K, S int
	fmt.Scan(&K, &S)
	var count int
	for i := 0; i <= K; i++ {
		for j := 0; j <= K; j++ {
			k := S - i - j
			if 0 <= k && k <= K{
				count++
			}
		}

	}
	fmt.Println(count)
}


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

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
//F6編譯，右上三角形執行，ctrl+c強制停止執行  F5開啟exe
#define ll long long
#define maxn 8005
#define mod 1000000000
using namespace std;

typedef pair<int, int> P;

int main()
{
    string s, t;
    cin >> s >> t;
    bool ok = 1;
    for (int i = 0; i < s.length(); i++)
    {
        if (s[i] != t[i])
            ok = 0;
    }
    if (ok)
        printf("Yes\n");
    else
        printf("No\n");

    return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define ll long long
#define inf 1000000000
#define infll 1000000000000000000ll
#define vi vector<int>
#define vll vector<ll>
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define mpr make_pair
#define fi first
#define se second
#define pq priority_queue<int>
#define pqll priority_queue<ll>
#define up(x,y) (x<(y)?x=(y):0)
#define dn(x,y) (x>(y)?x=(y):0)
#define ad(x,y) (x=(x+(y))%mod)
#define N 100009
#define mod 998244353
using namespace std;

int n,m,dp[N][2]; map<pii,int> mp;
int read(){
	int x=0; char ch=getchar(); bool flag=0;
	while (ch<'0' || ch>'9'){ if (ch=='-') flag=1; ch=getchar(); }
	while (ch>='0' && ch<='9'){ x=x*10+ch-'0'; ch=getchar(); }
	return flag?-x:x;
}
ll readll(){
	ll x=0; char ch=getchar(); bool flag=0;
	while (ch<'0' || ch>'9'){ if (ch=='-') flag=1; ch=getchar(); }
	while (ch>='0' && ch<='9'){ x=x*10+ch-'0'; ch=getchar(); }
	return flag?-x:x;
}
void gg(){ puts("0"); exit(0); }
int pw(ll y){
	int x=2,ans=1; y=max(0ll,y);
	for (; y; y>>=1,x=(ll)x*x%mod) if (y&1) ans=(ll)ans*x%mod;
	return ans;
}
int calc(int x,int y){ return mp[mpr(x,y)]-1; }
int main(){
	scanf("%d%d",&n,&m);
	int i,j,k,x,y,z,ans=1; ll cnt=0;
	for (i=1; i<=m; i++){
		scanf("%d%d%d",&x,&y,&z);
		mp[mpr(x,y)]=z+1;
		if (abs(x-y)>2){
			if (calc(y,x)==-1) cnt++; else
			if (calc(y,x)!=calc(x,y)) gg();
			//cerr<<calc(x,y)<<' '<<calc(y,x)<<'\n';
			//cnt+=(calc(y,x)==-1);
		}
	}
	cerr<<cnt<<'\n';
	for (i=2; i<n; i++){
		int x=calc(i-1,i+1),y=calc(i,i),z=calc(i+1,i-1);
		//cerr<<x<<' '<<y<<' '<<z<<'\n';
		if (x!=-1 && y!=-1 && z!=-1)
			if (x^y^z) gg();
		ans=(ll)ans*pw(1-(x!=-1)-(z!=-1))%mod;
		if (y==-1 && x!=-1 && z!=-1){
			mp[mpr(i,i)]=(x^z)+1;
	//		cerr<<i<<' '<<i<<' '<<(x^z)<<'\n';
		}
	}
	cnt=((ll)n*n-n-(n-1)*2-(n-2)*2)/2-cnt;
	//cerr<<'?'<<cnt<<'\n';
	ans=(ll)ans*pw(cnt)%mod;
	//cerr<<ans<<'\n';
	dp[1][0]=(calc(1,1)!=1); dp[1][1]=(calc(1,1)!=0);
	for (i=2; i<=n; i++)
		for (j=0; j<2; j++)
			for (k=0; k<2; k++){
				if (calc(i,i)!=-1 && calc(i,i)!=k) continue;
				x=calc(i-1,i); y=calc(i,i-1);
				if (x!=-1 && y!=-1)
					if (x^y^j^k) continue;
				ad(dp[i][k],(ll)dp[i-1][j]*pw(1-(x!=-1)-(y!=-1)));
			}
	//cerr<<pw((ll)n*(n+1)/2)<<'\n';
	printf("%lld\n",(ll)ans*(dp[n][0]+dp[n][1])%mod);
	return 0;
}


Measured memory_bytes: 38528
(defun f(a b)
  (let ((bb (* b 2)))
    (if (< (- a bb) 0)
      0
      (- a bb))))
(defun splitat (c line)
  (labels ((rec (line acc)
				(let ((pos (position-if (lambda(cc) (char= c cc)) line)))
				  (if pos
					  (rec (subseq line (1+ pos)) (cons (subseq line 0 pos) acc))
					(nreverse (cons line acc))))))
	(rec line nil)))
(let* ((line (read-line nil nil))
       (lst (mapcar #'parse-integer (splitat #\space line))))
  (format t "~A" (f (car lst) (cadr lst))))


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

const double PI=3.141592653589793;

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

  reverse(H.begin(), H.end());

  int maxi = 0;
  int val = 0;
  for (int i = 1; i < N;i++){
      if(H.at(i-1)<=H.at(i))
          val++;
        else
            val = 0;
        maxi = max(maxi, val);
  }
      cout << maxi << endl;
  return 0;
  }


Measured memory_bytes: 640
import sys

input = sys.stdin.readline
al = [list(map(int, input().split())) for _ in range(int(input()))]
al = sorted(al, key=lambda x: x[1])
s = 0
for i, j in al:
    s += i
    if s > j:
        print("No")
        break
else:
    print("Yes")

Measured memory_bytes: 48616
K = int(input())

A = [49] * 50
q, r = divmod(K, 50)
for i in range(50):
    A[i] += q
for i in range(r):
    for j in range(50):
        if i == j:
            A[j] += 50
        else:
            A[j] -= 1

print(50)
print(*A)

Measured memory_bytes: 3064
#include <stdio.h>

#define INF 1000000000

#define min(a, b) (((a) < (b)) ? (a) : (b))

const int di[2][9] = {{-2, -1, -1, 0, 0, 0, 1, 1, 2}, {-2, -1, -1, 0, 0, 0, 1, 1, 2}};
const int dj[2][9] = {{1, 1, 2, 1, 2, 3, 1, 2, 1}, {-1, -2, -1, -3, -2, -1, -2, -1, -1}};
const int cost[] = {['S'] = 0, ['T'] = 0, ['X'] = INF, ['1'] = 1, 2, 3, 4, 5, 6, 7, 8, 9};

typedef struct {
	int i, j, f, d;
} PairCoordDis;

PairCoordDis heap[32400];
int hsize;

void insert(int i, int j, int f, int d) {
	int ii;
	for (ii = hsize++; ii > 0 && d < heap[ii - 1 >> 1].d; ii = ii - 1 >> 1)
		heap[ii] = heap[ii - 1 >> 1];
	heap[ii] = (PairCoordDis){i, j, f, d};
}

int calcNextIdx(int i) {
	return i * 2 + 1 + (i * 2 + 2 < hsize && heap[i * 2 + 1].d > heap[i * 2 + 2].d);
}

PairCoordDis delete(void) {
	int i;
	int nextIdx;
	const PairCoordDis root = heap[0], last = heap[--hsize];

	for (i = 0; i * 2 + 1 < hsize && last.d > heap[nextIdx = calcNextIdx(i)].d; i = nextIdx)
		heap[i] = heap[nextIdx];
	heap[i] = last;

	return root;
}

char field[60][30];
int d[60][30][2];

void dijkstra(int h, int w, int si, int sj, int sf) {
	int i, j;

	for (i = 0; i < h; i++)
		for (j = 0; j < w; j++)
			d[i][j][0] = d[i][j][1] = INF;

	d[si][sj][sf] = 0;
	insert(si, sj, sf, 0);
	while (hsize > 0) {
		const PairCoordDis fromP = delete();
		const int nf = fromP.f ^ 1;

		if (fromP.d > d[fromP.i][fromP.j][fromP.f])
			continue;

		for (i = 0; i < 9; i++) {
			const int ni = fromP.i + di[fromP.f][i], nj = fromP.j + dj[fromP.f][i];
			if (ni >= 0 && ni < h && nj >= 0 && nj < w)
				if (fromP.d + cost[field[ni][nj]] < d[ni][nj][nf]) {
					d[ni][nj][nf] = fromP.d + cost[field[ni][nj]];
					insert(ni, nj, nf, d[ni][nj][nf]);
				}
		}
	}
}

int main(void) {
	int i, j, k;
	int w, h;

	while (scanf("%d %d", &w, &h), w) {
		int min;

		for (i = 0; i < h; i++)
			for (j = 0; j < w; j++)
				scanf(" %c", field[i] + j);

		min = INF;
		for (i = 0; i < w; i++)
			if (field[h - 1][i] == 'S')
				for (j = 0; j < 2; j++) {
					dijkstra(h, w, h - 1, i, j);
					for (k = 0; k < w; k++)
						if (field[0][k] == 'T') {
							min = min(min, d[0][k][0]);
							min = min(min, d[0][k][1]);
						}
				}

		printf("%d\n", min == INF ? -1 : min);
	}

	return 0;
}

Measured memory_bytes: 624
N = int(input())
A = tuple(map(int, input().split()))

x = 0
for i in range(N):
    if i % 2 == 0:
        x += A[i]
    else:
        x -= A[i]

W = [0]*(N)
W[0] = x
for i in range(N-1):
    W[i+1] = 2*A[i] - W[i]

print(*W)


Measured memory_bytes: 67172
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b;
    cin >> a >> b;
    int d = b - a;
    int n = d * (d - 1) / 2;
    cout << n - a;
}


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


int main() {
    int N;
    cin >> N;
    int a[N];
    rep(i,N) cin >> a[i];
    int minimum = INT_MAX;
    rep(i,100){
        int sum = 0;
        rep(m,N){
            sum += (a[m] - i - 1) * (a[m] - i - 1);
        }
        if(sum < minimum){
            minimum = sum;
        }
    }
    cout << minimum << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, x, n) for(int i = x; i < n; i++)
#define repr(i, x, n) for(int i = x; i > n; i--)
#define pii pair<int,int>
#define ll long long
const long long iinf = 1e18;
const int inf = 1e9;
const int MOD = (1e6+3);
int dir4[4][2] = {{1,0},{-1,0},{0,1},{0,-1}};
int knight[8][2] = {{2,1},{2,-1},{-2,1},{-2,-1},{1,2},{-1,2},{1,-2},{-1,-2}};

using namespace std;

void solve()
{
    int ans;
    for(int i = 1; i <= 5; i++){
        int x;
        cin >> x;
        if(x == 0) ans = i;
    }
    cout << ans;

}
//new line is printed in the main

int main()
{
    int t = 1;
        // cin >> t; // comment out if no test case is required
    // int i = 1;
    while(t--){
        //cout << "Case " << i++ << ": ";
        solve();
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 3592
import sys

def main():
    N = int(input())

    arr = [[0] * 10 for i in range(10)]
    for x in range(1, N+1):
        s = str(x)
        arr[int(s[0])][int(s[-1])] += 1

    ans = 0
    for y in range(1,10):
        for z in range(1,10):
            ans += arr[y][z] * arr[z][y]

    print(ans)

main()

Measured memory_bytes: 3060
/*by freesteed*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define pb push_back
#define fill(x,c) memset(x,c,sizeof(x))
#define fi first
#define se second
#define sz(A) (int)(A.size())
#define all(x) (x).begin(),(x).end()
#define caset int ___T; cin>>___T; for(int cs=1;cs<=___T;cs++)
#define get_be(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
//get_be biger & equal
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
const ll mod=1e9+7;
const ll oo=1e9+10;
const int Max = 1e6+10;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
//ll a[Max];
int h,w,ans=Max;
string s;
void go(vector<string> &grid,queue<pair<PII,int> > &Q,map<PII,int> &ma,int r,int c,int cnt){
	queue<PII> q;
	q.push({r,c});
	if(ma.count({r,c})&&ma[{r,c}]<=cnt+1);
	else{
		Q.push({{r,c},cnt+1});
	}
	while(!q.empty()){
		PII p = q.front();
		q.pop();
		int x = p.fi,y = p.se;
		//cout<<x<<" "<<y<<endl;
		if(x+1<h&&grid[x+1][y]=='#'){
			if(ma.count({x+1,y})&&ma[{x+1,y}]<=cnt+1);
			else{
				Q.push({{x+1,y},cnt+1}); 
				ma[{x+1,y}] = cnt+1;
				q.push({x+1,y});
			}
		}
		if(y+1<w&&grid[x][y+1]=='#'){
			if(ma.count({x,y+1})&&ma[{x,y+1}]<=cnt+1);
			else{
				Q.push({{x,y+1},cnt+1}); 
				ma[{x,y+1}] = cnt+1;
				q.push({x,y+1});
			}
		}
	} 
}
void solve(){
	cin>>h>>w;
	vector<string> grid;
	rep(i,0,h){
		cin>>s;
		grid.pb(s);
	}
	map<PII,int> ma;
	queue<pair<PII,int> > q;
	if(grid[0][0]=='.'){
		q.push({{0,0},0});
		ma[{0,0}] = 0;
	}else{
		go(grid,q,ma,0,0,0);
	}
	while(!q.empty()){
		pair<PII,int> p = q.front();
		q.pop();
		int x = p.fi.fi,y = p.fi.se,cnt=p.se;
		//cout<<x<<" "<<y<<" "<<cnt<<endl;
		if(x==h-1&&y==w-1){
			ans = min(ans,cnt);
		}
		if(y+1<w){
			if(grid[x][y+1]=='.'){
				if(ma.count({x,y+1})&&ma[{x,y+1}]<=cnt);
				else{
					q.push({{x,y+1},cnt});
					ma[{x,y+1}] = cnt;
				}
			}
			else go(grid,q,ma,x,y+1,cnt);
		}
		if(x+1<h){
			if(grid[x+1][y]=='.'){
				if(ma.count({x+1,y})&&ma[{x+1,y}]<=cnt);
				else{
					q.push({{x+1,y},cnt});
					ma[{x+1,y}] = cnt;
				}
			}
			else go(grid,q,ma,x+1,y,cnt);
		}
	} 
	cout<<ans<<endl;
}
int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//caset{
		solve();
	//}
  	return 0;
}





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

#define REP(i,num) for(ll i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=ll>
T in(){T x; cin >> x; return (x);}
template<typename T=ll,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

template<typename T>
bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>
bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}

class ConnectNodeInfo{
	vector<vector<pair<ll,ll>>> graph;
public:
	ConnectNodeInfo(int node_num){
		graph.resize(node_num);
	}
	void AddNonDirectionalConnection(ll u,ll v,ll w){
		graph[u].emplace_back(v,w);
		graph[v].emplace_back(u,w);
	}
	void AddDirectionalConnection(ll u,ll v,ll w){
		graph[u].emplace_back(v,w);
	}
	vector<pair<ll,ll>>& operator[](ll index){
		return graph[index];
	}
	size_t size(){return graph.size();}
};

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

	int N=in(),M=in();
	ConnectNodeInfo connect(N);
	REP(i,M){
		int u=in()-1,v=in()-1;
		connect.AddNonDirectionalConnection(u,v,1);
	}
	vector<int> X(N,-1);
	X[0] = 0;
	queue<int> Q;
	Q.push(0);
	while(!Q.empty()){
		int V=Q.front();
		Q.pop();
		for(auto& x:connect[V]){
			if(X[x.first]==-1){
				X[x.first]=V+1;
				Q.push(x.first);
			}
		}
	}

	out("Yes");
	REP(i,N-1){
		out(X[i+1]);
	}
	return 0;
}


Measured memory_bytes: 16256
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;

int dp[100005][3], a[100005][3], n;

int main(){
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> a[i][0] >> a[i][1] >> a[i][2];
    }
    //dp[i][j] = max(dp[i][j], dp[i+1][k] + a[i][k]) where k != j
    for(int i = 1; i <= n; i++){
        for(int j = 0; j < 3; j++){
            dp[i][j] = 0;
            for(int k = 0; k < 3; k++){
                if(j != k){
                    dp[i][j] = max(dp[i][j], dp[i-1][k] + a[i-1][k]);
                }
            }
        }
    }
    int mmax = 0;
    for(int i = 0; i < 3; i++)mmax = max(mmax, dp[n][i]);
    cout << mmax << endl;
    return 0;
}


Measured memory_bytes: 2560
#include <iostream>

using namespace std;

int main()
{
    int n, m;
    cin >> n;
    int t[n];
    for (int i = 0; i < n; i++) {
        cin >> t[i];
    }
    cin >> m;
    int p[m], x[m];
    int sum[m];
    for (int j = 0; j < m; j++) {
        sum[j] = 0;
        cin >> p[j] >> x[j];
        int pre = t[p[j] - 1];
        t[p[j] - 1] = x[j];
        for (int k = 0; k < n; k++) {
            sum[j] += t[k];
        }
        t[p[j] - 1] = pre;
    }
    for (int i = 0; i < m; i++) {
        cout << sum[i] << endl;
    }


    /*for (int k = 0; k < m; k++) {
        sum = 0;
        int pre = t[p[k] - 1];
        t[p[k] - 1] = x[k];
        for (int l = 0; l < n; l++) {
          sum += t[l];
        }
        t[p[k] - 1] = pre;
        cout << sum << endl;
    }*/
}


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



using namespace std;



int main(){

  int n;

  cin >> n;

  cin.ignore();



  for (int i = 1; i <= 9; i++){

    if((n % i == 0) && (n / i <= 9) && (n / i >= 0)){

      cout << "Yes" << endl;

      return 0;

    }

  }

  cout << "No" << endl;

  return 0;

}

    



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

int main(){
  int N;
  string S;
  cin >> N >> S;
  int ans=0;
  for(int i=0;i<N-2;i++){
    if(S.substr(i,3)=="ABC"){
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int c1, c5, c10, c50, c100, c500;
    cin >> c1 >> c5 >> c10 >> c50 >> c100 >> c500;
    if(1*c1+5*c5+10*c10+50*c50+100*c100+500*c500>=1000){
        cout << 1 << endl;
    }
    else{
        cout << 0 << endl;
    }
    
}



Measured memory_bytes: 3104
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INFLL LLONG_MAX // 9223372036854775807
#define EPS 1e-9
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }
using namespace std;

int main(){
    Init();
    ll n; cin >> n;
    ll ansT = 1, ansA = 1;
    rep(i, n){
        ll t, a; cin >> t >> a;
        ll mul = (ll)max(ceil((double long)ansT/t), ceil((double long)ansA/a));
        ansT = t*mul;
        ansA = a*mul;
    }
    cout << ansT+ansA << endl;
}

Measured memory_bytes: 3604
#include<stdio.h>
#include<math.h>
#define pb push_back
//#define FAST ios::sync_with_stdio(false);cin.tie(NULL),cout.tie(NULL);
//typedef long long ll;
#define pi acos(-1.0)
//using namespace std;

int main()
{
     double r;
     scanf("%lf",&r);
     printf("%.12lf\n",2*pi*r);
//    cin>>r;
//    cout<<2*pi*r<<fixed<<setprecision(12)<<endl;
    return 0;
}


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

int main(void){
    int n;
    cin >> n;
    vector<int> s(n);
    rep(i, n) cin >> s[i];
    sort(s.begin(), s.end());
    int q;
    cin >> q;
    vector<int> t(q);
    rep(i, q) cin >> t[i];
    int cnt = 0;
    rep(i, q){
        int lo = 0, hi = n;
        while(lo < hi){
            int mid = (hi + lo) / 2;
            if(t[i] == s[mid]){
                lo = mid;
                break;
            }
            else if(t[i] < s[mid]) hi = mid;
            else lo = mid + 1;
        }
        if(t[i] == s[lo]) ++cnt;
    }
    cout << cnt << endl;
    return 0;
}


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

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

int ans = 0;
int h, w;
char f[1010][1010], emb[4];
char joi[] = {'J', 'O', 'I'};
int d[1010][1010];

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

const int nx[] = {0, 1, 0, 1};
const int ny[] = {0, 0, 1, 1};

inline bool in(int x, int y){
  return (x<0||y<0||w-1<=x||h-1<=y);
}

int main()
{

  cin >> h >> w;
  REP(i, h) REP(j, w){
    cin >> f[i][j];
  }

  REP(i, 4){
    cin >> emb[i];
  }

  REP(i, h) REP(j, w) REP(k, 4){
    int x = j + dx[k];
    int y = i + dy[k];

    if (in(x, y)) continue;

    int cnt = 0;
    for (int l = 0; l < 4; l++){
      int sx = x + nx[l];
      int sy = y + ny[l];
      cnt += (f[sy][sx] == emb[l]);
    }
    if (cnt == 4){
      d[i][j]++;
      ans += (k == 0);
    }
  }

  int maxplus = 0;
  REP(i, h) REP(j, w){
    char s = f[i][j];
    REP(m, 3){
      int onakasuita = 0;
      f[i][j] = joi[m];

      REP(k, 4){
        int x = j + dx[k];
        int y = i + dy[k];

        if (in(x, y)) continue;

        int cnt = 0;
        REP(l, 4){
          int sx = x + nx[l];
          int sy = y + ny[l];
          cnt += (f[sy][sx] == emb[l]);
        }
        if (cnt == 4) onakasuita++;
      }
      maxplus = max(maxplus, onakasuita - d[i][j]);
    }
    f[i][j] = s;
  }

  cout << ans + maxplus << endl;
}

Measured memory_bytes: 8032
R, G, B, N = [int(x) for x in input().split()]


def solve():
    count = 0
    for r in range(0, N+1, R):
        rem = N - r
        count += sum(1 if (rem-g)%B == 0 else 0 for g in range(0, N-r+1, G))

    print(count)


#R, G, B, N = 13, 1, 4, 3000
#R, G, B, N = 1,2,3,4
solve()


        


Measured memory_bytes: 3060
S = list(input())

ans = 'AC'
if S[0] == 'A':
    del S[0]
    for i in range(1, len(S)-1):
        if S[i] == 'C':
            del S[i]
            ans = 'AC'
            break
        else:
            ans = 'WA'
    for j in range(len(S)):
        if S[j].isupper():
            ans = 'WA'
else:
    ans = 'WA'
print(ans)


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

int main(){
    int h,w;
    cin >> h >> w;
    vector<vector<char>> mat(h,vector<char>(w));
    for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin >> mat[i][j];
		}
	}
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			bool ok = false;
			if(mat[i][j]=='#'){
				if(i>0 && mat[i-1][j]=='#') ok=true;
				if(i<h-1 && mat[i+1][j]=='#') ok=true;
				if(j>0 && mat[i][j-1]=='#') ok=true;
				if(j<h-1 && mat[i][j+1]=='#') ok=true;
				if (ok==false) {cout << "No"; return 0;}
			}
			
		}
	}
	cout << "Yes";
			
}


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

int main() {
  int N;
  cin >> N;
  vector<int> as(N);
  rep(i, N) cin >> as[i];

  map<int, int> m;

  int free = 0;
  rep(i, N) {
    int a = as[i];
    if (3200 <= a) {
      free++;
      continue;
    }
    m[a/400]++;
  }

  int mSize = m.size();
  int mi, ma;
  if (mSize) {
    mi = mSize;
    ma = mi+free;
  } else {
    mi = 1;
    ma = free;
  }


  cout << mi << " " << ma << endl;

  return 0;
}


Measured memory_bytes: 256
n=int(input())
h=list(map(int,input().split()))
div=[]
ans=h[0]
for i in range(1,n):
  div.append(h[i]-h[i-1])
for i in range(1,n):
  if div[i-1]>0:
    ans+=div[i-1]
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) x.begin(),x.end()
using namespace std;


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

    string a,b;
    cin >> a >> b;
    double s = sqrt(stoi(a + b));
    if (s == floor(s)) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

ll N, K;
ll A[100100];
int cnt[40];
ll dp[40][2];

ll rec(int i, bool f){
    if(i < 0){
        return 0;
    }

    if(dp[i][f] != -1){
        return dp[i][f];
    }

    ll mx = 0;

    if(f || (K >> i & 1)){
        mx = rec(i - 1, f) + (1ll << i) * (N - cnt[i]);
    }

    mx = std::max<ll>(mx, rec(i - 1, f || (K >> i & 1)) + (1ll << i) * cnt[i]);

    return dp[i][f] = mx;
}

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

    std::cin >> N >> K;

    for(int i=0;i<N;++i){
        std::cin >> A[i];
    }

    for(int i=0;i<40;++i){
        for(int j=0;j<N;++j){
            if(A[j] >> i & 1){
                cnt[i] += 1;
            }
        }
    }

    memset(dp, -1, sizeof(dp));

    ll res = rec(39, false);
    std::cout << res << std::endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define int long long
using namespace std;
int A,B,Q;
std::vector<int> s,t;

int lobos(int i){
  int l=-1;int r=A-1;
  while(r-l>1){
    int m=(l+r)/2;
    if(s[m]>i)r=m;
    else l=m;
  }
  return s[r];
}
int bos(int i){
  int l=0;int r=A;
  while(r-l>1){
    int m=(l+r)/2;
    if(s[m]>i)r=m;
    else l=m;
  }
  return s[l];
}
int lobot(int i){
  int l=-1;int r=B-1;
  while(r-l>1){
    int m=(l+r)/2;
    if(t[m]>i)r=m;
    else l=m;
  }
  return t[r];
}
int bot(int i){
  int l=0;int r=B;
  while(r-l>1){
    int m=(l+r)/2;
    if(t[m]>i)r=m;
    else l=m;
  }
  return t[l];
}

signed main(){
  cin>>A>>B>>Q;
  std::vector<int> c(Q);
  s.resize(A);t.resize(B);
  for(int i=0;i<A;i++)cin>>s[i];
  for(int i=0;i<B;i++)cin>>t[i];
  for(int i=0;i<Q;i++)cin>>c[i];
  for(int i=0;i<Q;i++){
    int ans=1e18;
    if(lobos(c[i])>c[i]&&lobot(lobos(c[i]))>lobos(c[i]))ans=min(ans,lobot(lobos(c[i]))-c[i]);
    if(lobos(c[i])>c[i]&&bot(lobos(c[i]))<lobos(c[i]))ans=min(ans,lobos(c[i])*2-c[i]-bot(lobos(c[i])));
    if(bos(c[i])<c[i]&&lobot(bos(c[i]))>bos(c[i]))ans=min(ans,c[i]+lobot(bos(c[i]))-bos(c[i])*2);
    if(bos(c[i])<c[i]&&bot(bos(c[i]))<bos(c[i]))ans=min(ans,c[i]-bot(bos(c[i])));//cout<<bos(c[i])<<" "<<bot(bos(c[i]))<<endl;

    if(lobot(c[i])>c[i]&&lobos(lobot(c[i]))>lobot(c[i]))ans=min(ans,lobos(lobot(c[i]))-c[i]);
    if(lobot(c[i])>c[i]&&bos(lobot(c[i]))<lobot(c[i]))ans=min(ans,lobot(c[i])*2-c[i]-bos(lobot(c[i])));
    if(bot(c[i])<c[i]&&lobos(bot(c[i]))>bot(c[i]))ans=min(ans,c[i]+lobos(bot(c[i]))-bot(c[i])*2);
    if(bot(c[i])<c[i]&&bos(bot(c[i]))<bot(c[i]))ans=min(ans,c[i]-bos(bot(c[i])));

    cout<<ans<<endl;
  }
}


Measured memory_bytes: 3712
#include<cmath>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string.h>
using namespace std;
string a;
int main()
{
	cin>>a;
	if(a=="Sunny")
		cout<<"Cloudy";
	if(a=="Rainy")
		cout<<"Sunny";
	if(a=="Cloudy")
		cout<<"Rainy";
	return 0;	
} 

Measured memory_bytes: 256
let () =
    let _ = read_int () in
    let a =
        read_line ()
        |> Str.split (Str.regexp " ")
        |> List.map int_of_string
    in
    let max :: max2 :: _ = List.sort (fun u v -> compare v u) a in
    let mid =
        List.fold_left (fun acc elem ->
            let v1 = abs_float (float_of_int elem -. (float_of_int max /. 2.)) in
            let v2 = abs_float (float_of_int acc  -. (float_of_int max /. 2.)) in
            if v1 < v2 then elem else acc
        ) max2 a
    in
    Printf.printf "%d %d\n" max mid


Measured memory_bytes: 16640
def sq(a, b, mod):  # aのb乗を剰余,kは初期値#20191116-D-Knight
    if b == 0:
        return 1
    elif b % 2 == 0:
        return sq(a, b // 2, mod)**2 % mod
    else:
        return sq(a, b - 1, mod) * a % mod


def nCk(n, k, mod=10**9 + 7):
    x = max(k, n - k)
    y = min(k, n - k)
    kkai = 1
    for i in range(2, y + 1):
        kkai = (kkai * i) % mod
    nkkai = 1
    for i in range(x + 1, n + 1):
        nkkai = (nkkai * i) % mod
    answer = sq(kkai, mod - 2, mod) * nkkai % mod
    return answer


from sys import exit
X, Y = map(int, input().split())
if (X + Y) % 3 != 0:
    print(0)
    exit()

if X % 2 == 0:
    syurui = X - (X // 2) + 1
else:
    syurui = X - (X // 2)
for i in range(syurui):
    two = i
    one = X - two * 2
    if (two + one * 2) == Y:
        print(nCk(two + one, two))
        exit()
print(0)


Measured memory_bytes: 3064
#include<stdio.h>
#include<stdlib.h>
#include<math.h>


int main(){
    
    int x = 0;
    int y = 0;
    int ans = 0;

    scanf("%d", &x);
    scanf("%d", &y);
     
    if(x == 1 && y == 1) ans = 1000000;
    else {
        if (y <= 3){
            
            ans += (4 - y) * 100000;
        }
        if (x <= 3){
        
            ans += (4 - x) * 100000;
        }
    }
        
    printf("%d\n", ans);
    
}




Measured memory_bytes: 128
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    S = readline().strip()
    
    if S in ('AAA', 'BBB'):
        print('No')
    else:
        print('Yes')
    
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 9052
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
#define MOD 1000000007
using namespace std;

char str[3][105];

int main(int argc, char* argv[])
{
    long cnt[3]={0};
    long i;
    for(i=0; i<3; i++) {
        scanf("%s", str[i]);
    }
    
    i=0;
    while(1) {
        if(strlen(str[i])==cnt[i]) {
            printf("%c\n", 'A'+i); return 0;
        }
        long next = str[i][cnt[i]]-'a';
        cnt[i]++;

        i = next;
    }

    return 0;
}


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

int main(){
	string a,b;
	cin>>a>>b;
	int n1,n2;
	cin>>n1>>n2;
	map<string,int>m;
	m[a] = n1;
	m[b] = n2;
	string s;
	cin>>s;
	m[s]--;
	cout<<m[a]<<" "<<m[b];
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
using P = pair<int,int>;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

int main(){
    int n;
    cin >> n;
    vector<int> a(1e5+1);
    rep(i,n){
        int ai;
        cin >> ai;
        if (ai-1 >= 0) a[ai-1]++;
        a[ai]++;
        a[ai+1]++;
    }
    int ans = 0;
    rep(i,1e5+1) ans = max(ans, a[i]);
    cout << ans << endl;
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))
#define uniq(v) (v).erase(unique(all(v)), (v).end())

using namespace std;

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

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

void solve() {
  int n, x; cin >> n >> x;
  int d = 0;
  int ans = 1;
  rep(i, n) {
    int l; cin >> l;
    d += l;
    if (d > x) break;
    ans++;
  }
  cout << ans << '\n';
}


Measured memory_bytes: 256
import numpy as np
N,M,C = map(int,input().split())
B = list(map(int,input().split()))
A = [list(map(int,input().split())) for i in range(N)]
judge = 0
for i in range(N):
	sum = 0
	for j in range(M):
		sum += A[i][j]*B[j]
	if sum+C > 0:
		judge += 1
		
print(judge)

Measured memory_bytes: 21692
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {
	public static void main(String... args) {
		Scanner scan = new Scanner(System.in);
		String str = scan.next();

		IntStream.range(0, str.length()).forEach(x -> System.out.print("x"));
		scan.close();
	}
}

Measured memory_bytes: 26576
using System;
 
class Program
{
  static void Main(string[] args)
  {
    string s = Console.ReadLine();
    int count = 0;
    for(int i = 0; i < 3; i++){
      if(s[i] == 'o') count++;
    }
    
    Console.WriteLine("{0}", 700 + count * 100);
  }
}

Measured memory_bytes: 13140
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repR(i, n) for(int i = (n) - 1; i > -1; i--)
#define rep1(i, n) for(int i = 1; i < (int)(n + 1); i++)
#define rep1R(i, n) for(int i = (n); i > 0; i--)
#define ll long long
using namespace std;

static const int MAX = 100000;
vector<pair<int, int> > adj[MAX];
int N;
bool visited[MAX];
int d_max;
int u;

void diameter(int current, int d) {
  visited[current] = true;
  if (adj[current].size() == 1 && visited[adj[current][0].first]) {
    if (d_max < d) {
      d_max = d;
      u = current;
    }
    return;
  }
  rep(i, adj[current].size()) {
    pair<int, int> n = adj[current][i];
    int v = n.first, c = n.second;
    if (!visited[v]) diameter(v, d + c);
  }
}

int main() {
  cin >> N;
  rep(i, N - 1) {
    int s, t, c;
    cin >> s >> t >> c;
    adj[s].push_back(make_pair(t, c));
    adj[t].push_back(make_pair(s, c));
  }
  fill(visited, visited + N, false);
  d_max = 0;
  diameter(0, 0);
  int x = u;
  fill(visited, visited + N, false);
  d_max = 0;
  diameter(x, 0);
  cout << d_max << endl;
  return 0;
}



Measured memory_bytes: 13304
#include<bits/stdc++.h>
#define pb push_back
#define all(x) x.begin(), x.end()
using namespace std;
using ll = long long;
using vi = vector<int>;
const int maxn = 1<<20, mod = 924844033;
int n, k, a[maxn];
int ans = 0;
vi g[maxn];
int dfs(int v = 1) {
	int d = 0;
	for(auto &i : g[v]) d = max(d, 1+dfs(i));
	if(d == k-1 && a[v] != 1) ans++, d = -1;
	return d;
}
int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin >> n >> k;
	for(int i = 1; i <= n; i++) cin >> a[i];
	if(a[1] != 1) ans++, a[1] = 1;
	for(int i = 2; i <= n; i++) {
		g[a[i]].pb(i);
	}
	dfs();
	cout << ans;
}


Measured memory_bytes: 34688
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=2e5+10;
#define fi first
#define se second
#define pb push_back
int n,l,r;
char a[N],b[N];
int main() {
    ios::sync_with_stdio(false);
    cin>>n>>a+1>>b+1;
    for(int i=1;i<=2*n;i++){
        if(i&1){
            cout<<a[++l];
        }else cout<<b[++r];
    }
    return 0;
}

Measured memory_bytes: 256
fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)
fun <T> Array<Array<T>>.print() {
    this.forEach {
        println(it.joinToString(" "))
    }
}

fun main(args: Array<String>) {
    val n = readLong()
    val res = (1L..n).asSequence().fold(0L) { acc, i ->
        when {
            i % 3L == 0L && i % 5L == 0L -> acc
            i % 3L == 0L-> acc
            i % 5L == 0L -> acc
            else -> acc + i
        }
    }
    println(res)
}


Measured memory_bytes: 38008
X, N = list(map(int, input().split()))
p = list(map(int, input().split()))

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

i = 0
flag = 0

while(True):
    if(not((X-i) in p)):
        flag = -1
        break
    if(not((X+i) in p)):
        flag = 1
        break
    i += 1

print(X + i * flag)

Measured memory_bytes: 61760
use std::io::Read;

pub fn read_stdin() -> String {
    let mut s = String::new();
    ::std::io::stdin().read_to_string(&mut s).unwrap();
    s
}

pub trait Parse {
    fn to<T>(&mut self) -> T
    where
        T: std::str::FromStr;
}

impl<'a> Parse for std::str::SplitWhitespace<'a> {
    fn to<T>(&mut self) -> T
    where
        T: std::str::FromStr,
    {
        let word = self.next().unwrap();
        word.parse().ok().unwrap()
    }
}

fn comb2(n: usize) -> Vec<(usize, usize)> {
    let mut v = Vec::new();
    for i in 0..(n - 1) {
        for j in (i + 1)..n {
            v.push((i, j));
        }
    }
    v
}

fn main() {
    let source = read_stdin();
    let mut iter = source.split_whitespace();
    let n = iter.to();
    let v: Vec<u32> = (0..n).map(|_| iter.to()).collect();
    let sum: u32 = comb2(n).into_iter().map(|(i, j)| v[i] * v[j]).sum();
    println!("{}", sum);
}

Measured memory_bytes: 4352
import java.util.Scanner;
 
	public class Main {
		public static void main(String[] args) {
      	Scanner sc = new Scanner(System.in);
      
      	int N  =sc.nextInt();
       	int M  =sc.nextInt();
          
        int t[] = new int[N];
        double tt =0;
        for(int i=0; i<N; i++){
        	t[i] =sc.nextInt();
        	tt +=t[i];
        }
          double a = 0;
          int b = 0;
          for(int i=0; i<N; i++){
          	a = tt/(4*M);
          if(t[i]>=a){
            b++;
            if(b>=M){
          System.out.println("Yes");
              return;
          }
            }
          }
          System.out.println("No");
        }
    }


Measured memory_bytes: 35848
#include <iostream>
#include <string.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <functional>
#include <cassert>
#include <utility>
#include <stack>
#include <queue>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
typedef pair<int,int> Pi;
typedef long long int ll;
const int INF=(ll)(1<<30)-1;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

int n;
int b[105];

int main(){
	cin>>n;
	int ans[105];
	REP(i,n)
		cin>>b[i+1];
	for(int i=n;i>=1;i--){
		for(int j=i;j>=1;j--){
			if(b[j]==j){
				ans[i]=j;
				for(int k=j;k<i;k++){
					swap(b[k],b[k+1]);
				}
				break;
			}
			if(j==1){
				cout<<"-1"<<endl;
				return 0;
			}
			
		}
	}
	for(int i=1;i<=n;i++){
		cout<<ans[i]<<endl;
	}
	return 0;
}
		

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

int main(){
    vector<int> a(3);
    for(int i=0; i<3; i++){
        cin >> a[i];
    }
    sort(a.begin(),a.end());

    if(a[0] == 5 && a[1] == 5 && a[2] == 7) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

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

long long GCD(long long a, long long b){

  if(b==0) return a;
  else return GCD(b,a%b);

}


int main(){

  int n,x;
  cin>>n>>x;
  int a[n];
  for(int i=0; i<n; i++) cin>>a[i];

  int b=abs(a[0]-x);
  
  for(int i=1; i<n; i++){

  b=GCD(abs(a[i]-x),b);
  
  }

  cout <<b<<endl;
  
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <numeric>
#include <cstdlib>
#include <map>
#include <set>
#include <algorithm>
#include <math.h>
 
using namespace std;

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

    int sum = 0;

    for(int i = 1; i <= N; i++){
        int p;
        cin >> p;

        if(p != i){
            sum++;
        }
    }

    if(sum == 0 || sum == 2){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl; 
    }

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<set>
#include<tuple>
#include<ctime>
#include<functional>
#include<cmath>
#include<cassert>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> p; 
#define rep(i,n) for(ll i=0;i<(n);i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))

int main(){
    int N,a=0,w=0,t=0,r=0;
    string s;
    cin>>N;
    rep(i,N){
        cin>>s;
        if(s=="AC") a++;
        else if(s=="WA") w++;
        else if(s=="TLE") t++;
        else if(s=="RE") r++;
    }
    cout<<"AC x" <<" "<< a <<endl;
    cout<<"WA x"<<" "<< w <<endl;
    cout<<"TLE x"<<" " << t<<endl;
    cout<<"RE x" <<" "<< r<<endl;

}

Measured memory_bytes: 3644