akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
class Main {
     
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        Dice dice = new Dice(stdIn.nextInt(),stdIn.nextInt(),stdIn.nextInt(),stdIn.nextInt(),stdIn.nextInt(),stdIn.nextInt());
        int a = stdIn.nextInt();
        for(int i = 0; i < a; i++) {
            int T = stdIn.nextInt();
            int S = stdIn.nextInt();
            Dice copy = new Dice(dice.Top,dice.S,dice.E,dice.W,dice.N,dice.Bottom);
             
            int ans = solv(T,S,copy,0); 
            System.out.println(ans);
        }
    }
    public static int solv(int a, int b, Dice dice,int count) {
        if(dice.Top == a && dice.S == b) return dice.E;
        if(count == 4) return -1;
        int ans = -1;
        Dice tmp = new Dice(dice.Top,dice.S,dice.E,dice.W,dice.N,dice.Bottom);
        tmp.TurnN();
        ans = Math.max(solv(a,b,tmp,count+1),ans);
        tmp = new Dice(dice.Top,dice.S,dice.E,dice.W,dice.N,dice.Bottom);
        tmp.TurnS();
        ans = Math.max(solv(a,b,tmp,count+1),ans);
        tmp = new Dice(dice.Top,dice.S,dice.E,dice.W,dice.N,dice.Bottom);
        tmp.TurnE();
        ans = Math.max(solv(a,b,tmp,count+1),ans);
        tmp = new Dice(dice.Top,dice.S,dice.E,dice.W,dice.N,dice.Bottom);
        tmp.TurnW();
        ans = Math.max(solv(a,b,tmp,count+1),ans);
         
        return ans;
    }
     
     
     
}
 
class Dice {
    int Top; //1
    int Bottom; //6
    int N; //   5
    int S; //   2
    int W; //左 4
    int E; //右 3
    Dice(int a, int b, int c, int d, int e, int f) {
        Top = a;
        S = b;
        E = c;
        W = d;
        N = e;
        Bottom = f;
    }
    public void TurnN() {
        int tmp = Top;
        Top = S;
        S = Bottom;
        Bottom = N;
        N = tmp;
    }
    public void TurnW() {
        int tmp = Top;
        Top = E;
        E = Bottom;
        Bottom = W;
        W = tmp;
    }
    public void TurnE() {
        int tmp = Top;
        Top = W;
        W = Bottom;
        Bottom = E;
        E = tmp;
    }
    public void TurnS() {
        int tmp = Top;
        Top = N;
        N = Bottom;
        Bottom = S;
        S = tmp;
    }
     
}


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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())

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

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007;

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

int main(void){
    int D,N; cin >> D >> N;
    if(N<100) cout << (int)pow(100,D)*N << endl;
    else cout << (int)pow(100,D)*(N+1) << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
import numpy as np
from numba import jit,i8 #,njit


def input(): return sys.stdin.readline()

N,Q = map(int,input().split())

C=np.array(input().split(), int)

# Query取得-rightでソート
# dtypeQuery = [("index", int), ("start", int), ("end", int)]
queries=np.empty((Q,2),int)
# #rights=[[] for _ in range(N+1)]

for q in range(Q):
	l,r=map(int,input().split())
	#queries[q] = (q,l,r)
	queries[q][0] = l
	queries[q][1] = r
	#queries=np.sort(queries,order="end")

#queries=np.array(sys.stdin.buffer.read().split(),int).reshape(Q,2)

orderByR=np.argsort(queries[:,1])

# 各色の現在の一番右のindex
mostRightColorIndex = np.zeros(N+1, int)
# bit indexed tree
bitArray=np.zeros(N+1,int)

# @njit
# @jit(返り値の型(引数1の型,引数2の型,．．．,引数nの型))
@jit(i8[:](i8,i8,i8[:],i8[:,:],i8[:],i8[:],i8[:]))
def main(N,Q,C,queries,orderByR,mostRightColorIndex,bitArray):

	def add(itemCount, items, i, value):
		while i <= itemCount:
			items[i] += value
			i += (i & (-i))

	def sumFromStart(items, end):
		summary = 0
		i = end
		while i > 0:
			summary += items[i]
			i -= (i & (-i))
		return summary

	def sum(items, start,end):
		summary = sumFromStart(items, end) - sumFromStart(items, start-1)
		return summary

	# 答え配列
	ans=np.zeros(Q, i8)#int)
	#ans=[0]*Q
	# 左からBITと現在色の更新をしながら、クエリのrightに到達したときにBITにクエリ発行する
	qindex = 0

	for n in range(N):
		# 外側のループでは、全部の色をループ

		if Q <= qindex:
			break

		if 0 < mostRightColorIndex[C[n]]:
			# ループ中の場所の色のindexが既にある場合(=過去に、同じ色が登録されていた場合)
			# 今回で、同じ色の一番右側の要素はループ中の要素になる
			# 前登録したこの色の一番右のindexを一度BITから抜く(↓で再度登録される)
			add(N,bitArray,mostRightColorIndex[C[n]], -1 )

		# この要素の色の一番右のindexを、BITに登録
		mostRightColorIndex[C[n]] = n+1
		add(N,bitArray,n+1, 1)

		# while qindex < Q and n+1 == queries[qindex][2]:
		while qindex < Q and n+1 == queries[orderByR[qindex]][1]:
			# 今のBITが次のクエリ発行するための状態(n==query.right)だったら、クエリ発行
			tmpIndex = orderByR[qindex]
			start = queries[tmpIndex][0]
			end = queries[tmpIndex][1]
			ans[tmpIndex]=sum(bitArray,start,end)
			# print(tmpIndex,start,end,ans[tmpIndex])
			qindex += 1

	return ans

for a in main(N,Q,C,queries,orderByR,mostRightColorIndex,bitArray):
	print(a)


Measured memory_bytes: 149336
#pragma GCC optimize("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize("-Ofast")
#include <bits/stdc++.h>
using namespace std;

typedef int in;
#define int long long
#define pb push_back
#define f first
#define s second
#define double long double
const int MAX=2e5+10;
const int MAX2=2e5+4;
const int MAAX=2e18;
const int MOD=1e9+7;
int dp[3005][3005];
string a,b;
int fun(int idx,int idx2)
{
    if(idx==a.size()||idx2==b.size())
    {
        return 0;
    }
    int &ret=dp[idx][idx2];
    if(ret!=-1)
    {
        return ret;
    }
    if(a[idx]==b[idx2])
    {
        return ret=1+fun(idx+1,idx2+1);
    }
    return ret=max(fun(idx+1,idx2),fun(idx,idx2+1));
}
in main()
{
    memset(dp,-1,sizeof dp);
    cin>>a>>b;
    fun(0,0);
    int n=a.size();
    int n2=b.size();
    int idx=0,idx2=0;
    string ans="";
    while(idx<n&&idx2<n2)
    {
        if(a[idx]==b[idx2])
        {
            ans+=a[idx];
            idx++;
            idx2++;
        }
        else
        {
            if(dp[idx+1][idx2]>dp[idx][idx2+1])
            {
                idx++;
            }
            else
            {
                idx2++;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 71040
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <complex>
#include <vector>
#include<limits>
#include<iomanip>

using namespace std;

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

const long double pi = 3.141592653589793;

#define debug(x) cout << #x << " = " << (x) << endl;
#define rep(i, n) for(int i = 0;i < n;i++)
#define repi(i, j, n) for(int i = j;i < n;i++)
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define F first
#define S second

// #define COMMENT

/*

const int NN = 200090;
ll fact[NN];
ll finv[NN];
ll inv[NN];

void inverse_modulao() {
  fact[0] = fact[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;

  for(int i = 2;i < NN;i++) {
    fact[i] = fact[i-1]*i%mod;
    inv[i] = mod-mod/i*inv[mod%i]%mod;
    finv[i] = finv[i-1]*inv[i]%mod;
  }
}

ll nCr(int n, int r) {
  return fact[n]*finv[r]%mod*finv[n-r]%mod;
}

*/

int X;

ll p5(int x) {
  return 1LL*x*x*x*x*x;
}

int main() {

//  freopen("input.in","r",stdin);
//  freopen("output.out","w",stdout);

  cin >> X;
  rep(i, 1001) {
    rep(j, 1001) {
      ll u = p5(i);
      ll v = p5(j);

      if(u + v == X) {
        cout << i << " " << -j << endl;
        return 0;
      }
      if(u - v == X) {
        cout << i << " " << j << endl;
        return 0;
      }
    }
  }

  return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <tuple>
#include <set>
#include <map>
#include <string>
#include <iomanip>
#include <cmath>
#include <cassert>
using namespace std;

typedef long long ll;

ll A[100010];
vector<int> V;
map<int, int> M;

int main() {
  int N;
  cin >> N;
  for (auto i = 0; i < N; i++) {
    cin >> A[i];
    V.push_back(A[i]);
  }
  sort(V.begin(), V.end());
  for (auto i = 0; i < (int)V.size(); i++) {
    M[V[i]] = i;
  }
  for (auto i = 0; i < N; i++) {
    A[i] = M[A[i]];
  }
  int wrong[2];
  wrong[0] = wrong[1] = 0;
  for (auto i = 0; i < N; i++) {
    if (i % 2 != A[i] % 2) {
      wrong[i%2]++;
    }
  }
  assert(wrong[0] == wrong[1]);
  cout << wrong[0] << endl;
}


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

switches = []
for x in range(m):
	inputs = list(map(int, input().split()))
	switches.append(inputs[1:])
	
remainders = list(map(int, input().split()))

count = 0
for x in range(2 ** n):
	bin_x = '{:010b}'.format(x)
	# print("bin:", bin_x)
	
	flag= True
	for j, indexes in enumerate(switches):
		
		summation = 0
		for i in indexes:
			summation += int(bin_x[-i])
			# print(bin_x[-i])
		# print("sum", summation, "rem",remainders[j])
		if summation % 2 != remainders[j]:
			flag = False
	if flag:
		# print(f"flag: {flag}")
		count += 1

print(count)

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

#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <stdint.h>
#include <string.h>

//#define _USE_MATH_DEFINES
//#include <math.h>

#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <deque>
#include <string>

#include <algorithm>
#include <functional>
#include <bitset>
#include <functional>
#include <chrono>
#include <random>
#define sqr(x) (x) * (x)

typedef unsigned int u32;
typedef int i32;
typedef unsigned long long int u64;
typedef long long int i64;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;
using namespace std::chrono;

//const i64 mod = 1000000007ll;
const i64 smod = 11; //  998244353ll;
//const i64 inf = 1000000007; // 10000000000000007ll;

const double eps = 1e-8;

const i64 MAXN = 4 * 1'000'000 + 6;

i64 T;

i64 n;
i64 x, y, z;
i64 a[MAXN];

int main(int argc, char* argv[]) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(15); cout.setf(ios::fixed);

    cin >> x >> y >> z;
    swap(x, y);
    swap(x, z);

    cout << x << " " << y << " " << z << endl;

    return 0;
}

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

int main(){
    long long n, p, ans, cnt;
    vector <long long> pf;
    scanf("%lld%lld", &n, &p);
    long long x = sqrt(p);
    long long i = 2;
    cnt = 0;
    map <long long, int> f;
    while (p != 1 && i <= x){
        if (p % i == 0){
            pf.push_back(i);
            cnt++;
            p /= i;
        }
        else{
            if (cnt > 0)
                f[i] = cnt;
            cnt = 0;
            i++;
        } 
    }
    
    if (p != 1){
        pf.push_back(p);
        f[p] = 1;
    }
    else if (cnt > 0)
        f[i] = cnt;
    map <long long, int> :: iterator it;
    ans = 1;
    for (it = f.begin(); it != f.end(); it++){
        long long x = it -> second / n;
        ans *= pow(it -> first, x);
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 256
import fractions
N = int(input())
a = list(map(int, input().split()))

lcm = a[0]
for item in a[1:]:
    lcm = (lcm * item) // fractions.gcd(lcm, item)
f = 0
for item in a:
    f += (lcm - 1) % item
print(f)

Measured memory_bytes: 5344
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1e9+7;
const LL LINF=1LL<<62;
const int INF=1<<30;

int main(){
    int H,W;
    cin >> H >> W;
    char a[H][W];
    bool t[H][W];
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            cin >> a[i][j];
            t[i][j]=true;
        }
    }
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            for(int k=0;k<W;k++){
                if(a[i][k]=='#') break;
                if(k==W-1) t[i][j]=false;
            }
            for(int k=0;k<H;k++){
                if(a[k][j]=='#') break;
                if(k==H-1) t[i][j]=false;
            }
        }
    }
    for(int i=0;i<H;i++){
        bool c=false;
        for(int j=0;j<W;j++){
            if(t[i][j]){
                cout << a[i][j];
                c=true;
            }
            if(j==W-1&&c) cout << "\n";
        }
    }
    return 0;
}


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

using namespace std;

int main(){
	string s;
	cin >> s;
	int l = s.length(),cR[2]={0},cL[2]={0},k=0,key;
	vector<int> res(l,0);
	for(int i=0;i<l;i++){
		if(i > 0 && s[i-1] == 'L'&&s[i] == 'R'){
			res[key] = cR[0] + cL[1];
			res[key+1] = cR[1] + cL[0];
			cR[0] = cR[1] = cL[0] = cL[1] = k = 0;
			cR[0] = 1;
			k = 1;
		}else if(i > 0 && s[i-1] == 'R' && s[i] == 'L'){
			key = i-1;
			cL[0] = 1;
			k = 1;
		}else{
			if(s[i]=='R'){
				cR[k]++;
			}else{
				cL[k]++;
			}
			k = (k+1)%2;
		}
	}
	res[key] = cR[0] + cL[1];
	res[key+1] = cR[1] + cL[0];
	for(int i=0;i<l;++i){
		cout << res[i] << " ";
	}
	cout << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back
#define mp make_pair
#define fast ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define ff first
#define ss second
#define INF (ll) (1e9)
#define mod (ll) (1e9 + 7)
#define endl "\n"
#define tt ll testcase; cin>>testcase; while(testcase--)
 
const int mxn = 1*(1e5) + 5;
ll n, m;
 
void solve(){
    cin >> n >> m;
    ll a[n];
    for(ll i=0; i<n; i++) cin >> a[i];

    ll dp[n+1][m+1] = {};
    dp[0][0] = 1;
    vector<ll>sum(m+2, 0);
    // sum[0] = 1;
    for(ll i=1; i<=n; i++) {
        ll s = 0;
        for(int j=0; j<=m; j++) {
            s += dp[i-1][j];
            sum[j+1] = s;
        }
        for(ll j=0; j<=m; j++) {
            // for(ll k=0; k<=min(j, a[i-1]); k++) {
            //     dp[i][j] += dp[i-1][j-k];
            //     dp[i][j] %= mod;
            // }
            dp[i][j] = sum[j+1] - sum[j-min(j, a[i-1])];
            dp[i][j] %= mod;
        }
    }
    // for(int j=0; j<=n; j++)
    // for(int i=0; i<=m; i++) {
    //     cout<<dp[n][i]<<" ";
    // }
    cout << dp[n][m];
}
 
int main(){
    fast;
    #ifndef ONLINE_JUDGE 
    freopen("input.txt", "r", stdin); 
    freopen("output.txt", "w", stdout); 
    #endif 
     // tt
        solve();
    return 0;
}

Measured memory_bytes: 82760
alias Task = Tuple!(int, "start", int, "end");

void main() {
	auto ip = readAs!(int[]), N = ip[0], M = ip[1];
	Task[] tasks = new Task[](M);
	foreach(i; 0..M) {
		auto s = readAs!(int[]);
		tasks[i] = Task(s[0], s[1]);
	}
	tasks.sort!"a.end < b.end";

	int d = 0;
	int res;
	foreach(t; tasks) {
		if(d <= t.start) {
			d = t.end;
			res++;
		}
	}
	res.writeln;

}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.conv;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

Measured memory_bytes: 4092
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define println(x) cout << x << endl
#define fi first
#define se second
#define Yes println("Yes")
#define No println("No")
#define YES println("YES")
#define NO println("NO")
const int di[8] = {-1, 0, 1, 0, -1, -1, 1, 1};
const int dj[8] = {0, 1, 0, -1, -1, 1, 1, -1};

using pii = pair<int, int>;

int h, w;

bool on_grid(int i, int j)
{
    if (i < 0 || i >= h) return false;
    if (j < 0 || j >= w) return false;
    return true;
}

bool is_road(int i, int j, vector<vector<char>>& grid)
{
    if (on_grid(i, j) == false) return false;
    if (grid[i][j] == '#') return false;
    return true;
}

int main()
{
    cin >> h >> w;
    vector<vector<char>> grid(h, vector<char>(w));
    vector<vector<int>> t(h, vector<int>(w, -1));
    int whites = 0;
    int blacks = 0;
    rep(i, h)rep(j, w)
    {
        char ch; cin >> ch;
        if (ch == '.') whites++;
        else blacks++;
        grid[i][j] = ch;
    }
    pii s = pii(0, 0);
    pii g = pii(h-1, w-1);
    int cnt = 0;
    queue<pii> q; q.push(s);
    t[s.fi][s.se] = 0; 
    while (!q.empty())
    {
        pii p = q.front(); q.pop();
        if (p == g) break;
        rep(k, 4)
        {
            if (is_road(p.fi+di[k], p.se+dj[k], grid) && t[p.fi+di[k]][p.se+dj[k]] == -1)
            {
                q.push(pii(p.fi+di[k], p.se+dj[k]));
                t[p.fi+di[k]][p.se+dj[k]] = t[p.fi][p.se] + 1;
            }
        }
    }
    cnt = t[g.fi][g.se];
    if (cnt == -1) println(-1);
    else cout << whites - (cnt + 1) << endl;
}

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

int main(){

    string S;
    int N;
    cin >> S >>N;

    int order;
    int order_f;
    char buf;
    string S_first;
    string S_last;

    int reverse_flg = 0;

    for (int i=0; i<N; i++){
        cin >> order;

        if (order == 1){
            if (reverse_flg == 0){
                reverse_flg = 1;
            }
            else{
                reverse_flg = 0;
            }
        }

        if (order == 2){
            cin >> order_f >> buf;
            if (order_f == 1){
                if (reverse_flg == 0){
                    S_first = buf + S_first;
                }
                else{
                    S_last = S_last + buf;
                }
            }
            else{
                if (reverse_flg == 0){
                    S_last = S_last + buf;
                }
                else{
                    S_first = buf + S_first;
                }
            }
        }
    }

    if (reverse_flg == 0){
        cout << S_first + S + S_last << endl;
    }
    else{
        reverse(S.begin(), S.end());
        reverse(S_first.begin(), S_first.end());
        reverse(S_last.begin(), S_last.end());
        cout << S_last + S + S_first << endl;;
    }

    return 0;
}

Measured memory_bytes: 1512
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);

using namespace std;

int main(){_
    map<string,int> respostas;
    respostas["AC"] = 0;
    respostas["WA"] = 0;
    respostas["TLE"] = 0;
    respostas["RE"] = 0;
    int n;
    cin >> n;
    for(int i=0;i<n;i++){
        string entrada;
        cin >> entrada;
        respostas[entrada]++;
    }
    cout << "AC x " << respostas["AC"] << endl;
    cout << "WA x " << respostas["WA"] << endl;
    cout << "TLE x " << respostas["TLE"] << endl;
    cout << "RE x " << respostas["RE"] << endl;
    return 0;
}

Measured memory_bytes: 3648
#include<stdio.h>
int main()
{
	int n;
	scanf("%d", &n);
	int i;
	int p[22];
	for (i = 0; i < n; i++)
		scanf("%d", &p[i]);
	int ans = 0;
	for (i = 1; i < n - 1; i++)
	{
		if (p[i - 1] < p[i] && p[i] < p[i + 1])
			ans++;
		if (p[i - 1] > p[i] && p[i] > p[i + 1])
			ans++;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long
#define V vector<long long>
#define VV vector<vector<long long>>
#define VVV vector<vector<vector<long long>>>
#define rep(i,n) for(ll (i)=0;(i)<(n);++(i))
using namespace std;

int main() {
    ll n,m;
    cin>>n>>m;
    V a(n);
    rep(i,n)cin>>a[i];
    sort(a.rbegin(),a.rend());
    ll sum=accumulate(a.begin(), a.end(), 0LL);
    if((sum+4*m-1)/(4*m)<=a[m-1]){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}


Measured memory_bytes: 256
import sys
import bisect
input = sys.stdin.readline

def main():
    N = int(input())
    a = [int(input()) for i in range(N)]

    nums = []

    for i in a:
        if len(nums) > 0:
            if i <= nums[-1]:
                ind = bisect.bisect_left(nums, i)
                if nums[ind] == i:
                    nums.pop(ind)
                else:
                    bisect.insort(nums, i)
            else:
                nums.append(i)
        else:
            nums.append(i)
    
    print(len(nums))


if __name__ == "__main__":
    main()

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

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

using namespace std;

int main(){
	int n,m; cin>>n>>m;
	bool color[100000]={};
	color[0]=true;
	int num[100000];
	rep(i,n) num[i]=1;
	rep(i,m){
		int x,y; cin>>x>>y; x--; y--;
		num[y]++;
		num[x]--;
		if(color[x]){
			color[y]=true;
			if(num[x]==0) color[x]=false;
		}
	}

	cout<<count(color,color+n,true)<<endl;

	return 0;
}


Measured memory_bytes: 768
#include<stdio.h>
#include<string.h>
int main(){
  int i=0,count=0;
  char ss[200001];
  char tt[200001];
  scanf("%s %s",ss,tt);
  while(1){
    if(ss[i]=='\0'){break;}
    if(strncmp(&tt[i],&ss[i],1)==0){}else{count++;}
    i++;
  }
  printf("%d\n",count);
}

Measured memory_bytes: 2120
package main

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

type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func main() {
	sc := NewScanner()
	N := sc.nextInt()
	root := math.Sqrt(float64(N))
	upper := int(math.Floor(root))
	fmt.Println(pow(upper, 2))
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,tmp;
  cin >> N;
  int sum = 0;
  tmp = N;
  while(N){
    sum += N % 10;
    N = N / 10;
  }
//cout << tmp << endl;
//cout << sum << endl;
if (tmp % sum == 0) cout << "Yes" << endl;
else cout << "No" << endl;
}

Measured memory_bytes: 3588
from collections import deque
r, c = list(map(int, input().split()))
sy, sx = [0, 0]
gy, gx = [r-1, c-1]

s = [list(map(str, list(input()))) for i in range(r)]

N = r*c
G = [[] for _ in range(N)]
w_c = 0
for i in range(r):
    for j in range(c):
        if s[i][j] == '.':
            w_c += 1
            for x, y in ([0, 1], [0, -1], [1, 0], [-1, 0]):
                if 0 <= i+y <= r-1 and 0 <= j+x <= c-1:
                    if s[i+y][j+x] == '.':
                        G[i*c+j].append((i+y)*c+j+x)


# G[v]: 頂点vに隣接する頂点list
# N: 頂点数
# print(G)
dist = [-1]*N
que = deque([sy*c+sx])
dist[sy*c+sx] = 0
while que:
    v = que.popleft()
    d = dist[v]
    for w in G[v]:
        if dist[w] > -1:
            continue
        dist[w] = d + 1
        que.append(w)
if dist[gy*c+gx] == -1:
    print(-1)
else:
    print(w_c-dist[gy*c+gx]-1)


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

using namespace std;

using ll = long long;

#define ALL(A) A.begin(),A.end()

int main()
{
    int S,W;
    cin >> S >> W;
    if(S <= W) cout << "unsafe" << endl;
    else cout << "safe" << endl;
    return 0;
}

Measured memory_bytes: 3584
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;

const int N=510005;

int n,m;
int a[N],dp[N][2],mx[N];

void chang(int p,int w){
	if (w>=dp[p][1]){
		swap(dp[p][1],dp[p][0]);
		dp[p][1]=w;
		return;
	}
	if (w>dp[p][0]) dp[p][0]=w;
}

int main(){
	int i,j;
	scanf("%d",&n); m=(1<<n)-1;
	for (i=0;i<=m;i++) scanf("%d",&a[i]);
	for (i=1;i<=m;i++) mx[i]=a[i]+a[0];
	for (i=1;i<=m;i++){
		chang(i,a[0]);
		for (j=i;j;j=((j-1)&i)) chang(i,a[j]);
		mx[i]=dp[i][1]+dp[i][0];
	}
	for (i=1;i<=m;i++) mx[i]=max(mx[i],mx[i-1]);
	for (i=1;i<=m;i++) printf("%d\n",mx[i]);
	return 0;
}

Measured memory_bytes: 9088
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using llpair=pair<ll,ll>;
using llvec=vector<ll>;
using llmat=vector<vector<ll>>;
#define llmattp(name,a,b,num) name(a,vector<ll>(b,num))
#define LLINF 1LL<<60
#define ABS(x) ( (x)>0 ? (x) : -(x) )

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

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

ll gcd(ll a, ll b) {
	if(a==0||b==0) return 0;
	if(a<b) swap(a,b);
	ll tmp = a%b;
	while(tmp!=0) {
		a = b;
		b = tmp;
		tmp = a%b;
	}
	return b;
}

ll lcm(ll a, ll b) {
	return a*b/gcd(a,b);
}

ll factorial(ll x) {
	ll f=1;
	for(ll i=2; i<x; i++) {
		f*=i;
	}
	return f;
}

ll nPr(ll n, ll r) {
	ll result=1;
	for(ll i=r+1; i<=n; i++) result*=i;
	return result;
}

ll nCr(ll n, ll r) {

	if (n == 0) { return 0; }
	if (r == 0) { return 1; }
	if (r == 1) { return n; }
	if (n == r) { return 1; }

	if (r > n / 2) { r = n / 2; }

	double result = 1;
	for (double i = 1; i <= r; i++) {
		result *= (n - i + 1) / i;
	}

	return (ll)result;
}

bool IsPrime(ll num) {
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

	double sqrtNum = sqrt(num);
	for (ll i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			// 素数ではない
			return false;
		}
	}

	// 素数である
	return true;
}

ll GreaterBinarySearch(ll *array, ll key, ll max, ll min) {
	if(array[max]<array[min]) {
		return NULL;
	} else {
		ll mid = max + (min-max)/2;
		if(array[mid]<key) {
			return GreaterBinarySearch(array,key,max,mid-1);
		} if(array[mid]>key) {
			return GreaterBinarySearch(array,key,mid+1,min);
		} else {
			return mid;
		}
	}
}

int main() {
	string str; cin>>str;
	for(int i=0; i<str.length(); i+=2) { //odd
		if(str[i]=='L') {
			cout<<"No"<<endl;
			return 0;
		}
	}
	for(int i=1; i<str.length(); i+=2) { //even
		if(str[i]=='R') {
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001001001001
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define all(v) v.begin(),v.end()

int main(){
    int N;cin>>N;
    vector<int>p(N);
    int diff=0;
    rep(i,N){
        cin>>p.at(i);
        if(p.at(i)!=i+1){
            diff++;
        }
    }
    if(diff<=2){
        cout<<"YES"<<endl;
    }else{
        cout<<"NO"<<endl;
    }
}


Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int h,an,c=0;
    cin>>h>>an;
    int ara[an];
    for(int i=0; i<an; i++ )
    {
        cin>>ara[i];

    }
    int j=0;
    while(j<an)
    {
        h-=ara[j];
        j++;

    }
    if(h>0)
        cout<<"No"<<endl;

        else
            cout<<"Yes"<<endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define fill(a,val) memset(a,val,sizeof(a))
#define REP(i,a,b) for (auto i = a; i != b; i++)
#define ll long long int
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define f first
#define pb push_back
#define SQ(a) (a)*(a)

const int N = 200005;

using namespace std;
string X,Y;
int lcs(int i, int j, int count)  
{ 
      
    if (i == 0 || j == 0) 
        return count; 
          
    if (X[i-1] == Y[j-1]) { 
        count = lcs(i - 1, j - 1, count + 1); 
    } 
        count = max(count, max(lcs( i, j - 1, 0), lcs( i - 1, j, 0))); 
    return count; 
} 
int main()
{
    std::ios::sync_with_stdio(false);
    //ll p = 1000000007; 
    
    int T = 1;
    //cin>>T;
    // cin.ignore(); must be there when using getline(cin, s)
    while(T--)
    {
          string a,b;
          cin>>a>>b;
          int count = 0;
            for(int i = 0;i<a.length();i++)
            {
                if(a[i]!=b[i])
                    count++;
            }
            cout<<count;
    }
    return 0;
}

 

Measured memory_bytes: 3888
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <math.h>
#include <cmath>
#include <numeric>
#include <iomanip>


#define log(x) cout<<x<<endl
#define pb push_back
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
using namespace std;


// <<fixed<<setprecision(6)<<


int gcd(lint x, lint y){
  return y==0 ? x:gcd(y,x % y);
}


int combi(int n, int r){
  int num = 1;
  for(int i = 1; i <= r; i++){
    num = num * (n - i + 1) / i;
  }
  return num;
}


int main(){
  int a,b,c;
  cin>>a>>b>>c;
  cout<<a+b+c<<endl;
}


Measured memory_bytes: 3088
MM = input().split()
N =int(MM[0])
M =int(MM[1])
list1 = [i for i in range(M+1)]
for i in range(N):
  MM = input().split()
  list2 = [int(MM[j]) for j in range(1,int(MM[0])+1)]
  list1 = set(list1)&set(list2)
print(len(list1))


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

int main(){
	int width, height;
	int x, y, r;

	cin >> width >> height >> x >> y >> r;

	if(x >= r && x <= width - r && y >= r && y <= height - r){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 3112
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr int Inf = 2100000010;
constexpr ll INF= 2000000000000000000;
constexpr ll MOD = 998244353;
const double PI = 3.1415926535897;
typedef pair<ll,ll> P;
typedef pair<int,P> PP;

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;
}

void mod(ll &val, ll M) {
    val = val % M;
    if(val < 0) {
        val += M;
    }
}

template<typename T>
T RS(T N, T P, T M){
    if(P == 0) {
        return 1;
    }
    if(P < 0) {
        return 0;
    }
    if(P % 2 == 0){
        ll t = RS(N, P/2, M);
        if(M == -1) return t * t;
        return t * t % M;
    }
    if(M == -1) {
        return N * RS(N,P - 1,M);
    }
    return N * RS(N, P-1, M) % M;
}

int main() {
    ll N;
    cin >> N;
    ll X,M;
    cin >> X >> M;
    vector<bool> used(M);
    vector<ll> cnt;
    ll cnt2 = X;
    while(true) {
        cnt.push_back(cnt2);
        if(used.at(cnt2)) {
            break;
        }
        used.at(cnt2) = true;
        cnt2 = (cnt2 * cnt2) % M;
    }
    ll itr = -1;
    for(int i = 0;i < cnt.size();i++) {
        if(cnt.at(i) == cnt.at(cnt.size() - 1)) {
            itr = i;
            break;
        }
    }
    ll Sum = 0;
    if(itr >= N) {
        for(int i = 0;i < N;i++) {
            Sum += cnt.at(i);
        }
    }
    else {
        ll K = cnt.size() - 1 - itr;
        for(int i = 0;i < itr;i++) {
            Sum += cnt.at(i);
        }
        ll cnt3 = 0;
        for(int i = itr;i < cnt.size() - 1;i++) {
            cnt3 += cnt.at(i);
        }
        Sum += (N - itr) / K * cnt3;
        for(int i = itr;i < itr + (N - itr) % K;i++) {
            Sum += cnt.at(i);
        }
    }
    cout << Sum << endl;
}

Measured memory_bytes: 3796
import fractions

n, k = map(int, input().split())
L = list(map(int, input().split()))
if n == 1:
    g = L[0]
else:
    g = fractions.gcd(L[0], L[1])
    for i in range(2, n):
        g = fractions.gcd(g, L[i])
M = max(L)
if M >= k and k % g == 0:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')


Measured memory_bytes: 16240
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string.h>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <memory.h>
#include <set>
#include <cmath>
#define fio ios::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
ll _pow(ll a, ll b) {
	ll ans = 1;
	for (ll i = 0; b >> i; i++) {
		if ((b >> i) & 1) ans *= a;
		a *= a;
	}
	return ans;
}
int cnt[300];
int main(void) {
	int n, m; scanf("%d %d", &n, &m);
	int ans = 0;
	for (int i = 0; i < n; i++) {
		int k; scanf("%d", &k);
		for (int j = 0; j < k; j++) {
			int x; scanf("%d", &x);
			cnt[x]++;
			if (n <= cnt[x]) {
				ans++;
			}
		}
	}
	printf("%d\n", ans);
	return 0;
}

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

typedef struct { int x, y; } POINT;

double GetCross( POINT a, POINT b ) { return a.x * b.y - a.y * b.x; }

int main( void )
{
    int n, no = 1;
    POINT P[51];

    while ( cin >> n && n )
    {
        for ( int i = 0; i < n; i++ ) cin >> P[i].x >> P[i].y;
        for ( int i = 1; i < n; i++ ) P[i].x -= P[0].x, P[i].y -= P[0].y;

        double area = 0.0;
        for ( int i = 1; i + 1 < n; i++ ) area += GetCross( P[i], P[i+1] );
        area = fabs( area );
        area /= 2.0;

        printf( "%d %.1f\n", no, area );
        no++;
    }
    return 0;
}

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

int main(){
string number;
int sum;
while(1){
sum = 0;


//while(1){
cin >> number;
//scanf("%s",&number);
//if(number == '\n')break;
//}

if(number[0] == '0' && number.size() == 1)break;

for ( int i = 0; i < number.size(); i++ ){ 
  sum += number[i] - '0';
  number[i] = '0';
}
cout << sum << endl;
}
return 0;
}


Measured memory_bytes: 3192
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int l,a,b,c,d,r1,r2;
		l = sc.nextInt();
		a = sc.nextInt();
		b = sc.nextInt();
		c = sc.nextInt();
		d = sc.nextInt();

		r1 = a / c;
		r2 = b / d;

		r1 += (a % c != 0)? 1 : 0;
		r2 += (b % d != 0)? 1 : 0;

		l -= Math.max(r1, r2);

		System.out.println(l);
	}
}

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

int main() {
	int N;
	cin>>N;
	string S;
	cin>>S;
	
	if(N%2==1)cout<<"No"<<endl;
	else{
		string T,U;
		for(int i=0;i<N/2;i++){
			T+=S.at(i);
		}
	
	for(int i=N/2;i<N;i++){
			U+=S.at(i);
		}
		if(T==U){
		cout<<"Yes"<<endl;
	}
	else cout<<"No"<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
// AOJ 0525
#include<algorithm>
#include<cstdio>
#define rep(i, a) for( int i = 0; i != (a); ++i )

bool fld[10][10000];

int main()
{
	int R, C;
	while( scanf( "%d%d", &R, &C ), R | C )
	{
		rep( i, R )
			rep( j, C )
				scanf( "%d", &fld[i][j] );
	
		int ans = 0;
		for( int i = 1; i != 1 << R; ++i )
		{
			int cnt = 0;
			for( int c = 0; c != C; ++c )
			{
				int cn = 0;
				for( int r = 0; r != R; ++r )
					cn += (fld[r][c])^(i>>r&1);

				cnt += std::max( cn, R-cn );
			}
			ans = std::max( ans, cnt );
		}

		printf( "%d\n", ans );
	}

	return 0;
}

Measured memory_bytes: 1124
//#include <bits/stdc++.h>
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
//#include "boost/multiprecision/cpp_int.hpp"
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
///////////////////////////

int main(){fastio
    string s;cin>>s;
    rep(i,1,2){
        if(s[0]!=s[i]){
            cout<<"Yes"<<endl;return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int pow(int a,int b)
{
	int ans=1;
	for(int i=1;i<=b;i++)
		ans*=a;
	return ans;
}

int main(void)
{
	int n;
	cin >> n;

	int ki=0,gu=0;

	for(int i=1;i<=n;i++)
	{
		int a;
		cin >> a;
		if(a%2==0)
			gu++;
		else
			ki++;
	}

	cout << pow(3,n)-pow(2,gu) << endl;

}

Measured memory_bytes: 384
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int X, Y, Z;
    cin >> X >> Y >> Z;
    cout << (X - Z) / (Y + Z) << endl;

    return 0;
}


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

public class Main {

	public static void main(String[] args) {
		OriginScanner os = new OriginScanner();
		PrintWriter pw = new PrintWriter(System.out);
		
		String s = os.next();
		
		final String[] weeks = new String[] {
			"SAT", "FRI", "THU", "WED", "TUE", "MON", "SUN"
		};
		int w = 1;
		for (String week : weeks) {
			if (week.equals(s)) {
				pw.println(w);
				break;
			}
			w++;
		}
		pw.close();
	}
	
	static class OriginScanner {
		private BufferedReader br;
		private StringTokenizer st;
		
		public OriginScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		String nextLine() {
			String str = null;
			try {
				str = br.readLine();
			}
			catch (IOException e) {
				System.out.println(e);
			}
			return str;
		}
		String next() {
			if (st == null || !st.hasMoreTokens()) {
				st = new StringTokenizer(nextLine());
			}
			return st.nextToken();
		}
		int nextInt() {
			return Integer.parseInt(next());
		}
		double nextDouble() {
			return Double.parseDouble(next());
		}
		long nextLong() {
			return Long.parseLong(next());
		}
	}
}


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

using namespace std;

#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define sz(x) ((int)(x).size())
#define whole(x) (x).begin(), (x).end()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair < int, int > pii;
typedef pair < ll, ll > pll;

const int N = int(2000) + 2;
const int LG = 20;
const ll mod = 998244353;
const int INF = 2147483647;
const ll linf = 1e18;
const ld pi = acos(-1);
const ld EPS = 1e-10;

int n, k;
string s;
int main (){
    cin >> n >> k >> s;
    s[k - 1] = tolower(s[k - 1]);
    cout << s << "\n";
}


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

int main ()
{
    long long int a,b,s,m,su,xx;

    cin >> a>>b ;

    s = a+b;
    m = a*b;
    su = a-b;

    if (s >= m && s>= su)
    {
        cout << s << endl;
    }


    else  if (m >= s && m>= su)
    {
        cout << m << endl;
    }

    else  if (su >= m && su>= s)
    {
        cout << su << endl;
    }






}



Measured memory_bytes: 256
N, D = map(int, input().split())
pos = [0]*N
for p in range(N):
    pos[p] = [int(x) for x in input().split()]
ans = 0

for i in range(N):
    for j in range(i):
        dis = 0.0
        for k in range(D):
            dis += ((pos[i][k] - pos[j][k]) ** 2)
        if (dis)**0.5 % 1 == 0:
            ans += 1

print(ans)


Measured memory_bytes: 3060
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)

	list := make([]int, n-1)
	for i := 0; i < n-1; i++ {
		fmt.Scan(&list[i])
	}

	count := make([]int, n)
	for i := 0; i < n-1; i++ {
		count[list[i]-1]++
	}
	for i := 0; i < n; i++ {
		fmt.Println(count[i])
	}

}


Measured memory_bytes: 8096
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>

#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define bit(n,k) (((ll)n>>(ll)k)&1) /*nのk bit目*/
#define pb push_back
const long long INF= 1e+18+1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
//const ll MOD=1000000007LL;
const ll MOD=998244353LL;
//const ll MOD=1777777777LL;
//const ll MAX_V=114514LL;
//const ll MAX = 500010LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
vl dx={0,0,1,-1};
vl dy={1,-1,0,0};




int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  cout << fixed << setprecision(10);
  /*--------------------------------*/
  char c;cin>>c;
  if('a'<=c&&c<='z'){
    cout<<'a'<<endl;
  }
  else cout<<'A'<<endl;
}

Measured memory_bytes: 3596
#include<stdio.h>
int main(void)
{
	int i,x,y;
	i=0;
	while(i<=0){
		scanf("%d %d",&x ,&y);
		if(x==0&&y==0)break;
		if(x<y){
			printf("%d %d\n",x ,y);
		}else{
			printf("%d %d\n",y ,x);
		}
	}
	
	return 0;
}

Measured memory_bytes: 600
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

// inf
constexpr ll infl = 10000000000000000LL;
constexpr int inf = 1000000000;

int h, w;
bool isInInside(tuple<int, int, int> p) {
    return 0 <= get<0>(p) && get<0>(p) < h && 0 <= get<1>(p) && get<1>(p) < w;
}

int main() {
    cin >> h >> w;
    vector<vector<int>> grid(h, vector<int>(w, 0));
    vector<vector<bool>> visited(h, vector<bool>(w, false));
    queue<tuple<int, int, int>> que;
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            char c;
            cin >> c;

            if (c == '#') {
                grid[i][j] = 0;
                que.push({i, j, -1});
            } else {
                grid[i][j] = inf;
            }
        }
    }

    int ans = 0;
    while (!que.empty()) {
        auto &p = que.front();
        que.pop();

        int i = get<0>(p);
        int j = get<1>(p);

        if (!isInInside(p) || visited[i][j])
            continue;

        visited[i][j] = true;

        grid[i][j] = get<2>(p) + 1;
        ans = max(ans, grid[i][j]);

        que.push({i + 1, j, grid[i][j]});
        que.push({i, j + 1, grid[i][j]});
        que.push({i - 1, j, grid[i][j]});
        que.push({i, j - 1, grid[i][j]});
    }

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

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

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef pair<ll, ll> pair_t;
using Graph = vector<vector<ll>>;

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
/***** define constant start *******/
const ll MOD = 1000000007;
const double PI = 3.1415926535897932;
const ll INF = 1 << 29;
/****** define constant end ********/

/****** define variable start ******/
ll n, m;
vl a;
/******* define variable end *******/

ll solve() {
  cin >> n >> m;
  a.resize(n);
  ll count = 0;
  ll sou = 0;
  REP(i, n) {
    cin >> a[i];
    sou += a[i];
  }
  long double toku = (long double)sou / (4 * (long double)m);
  REP(i, n) {
    if (a[i] >= toku) {
      count++;
    }
  }
  if (count >= m) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}
int main() {
  // clock_t start = clock();
  cout << std::fixed << std::setprecision(10);
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll end_solve = solve();
  /*
  clock_t end = clock();
  const double time = static_cast<double>(end - start) / CLOCKS_PER_SEC *
  1000.0; printf("time %lf[ms]\n", time);
  */

  return (int)end_solve;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define All(V) v.begin(), v.end()
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD = 1e9+7, INF = 1e9;

int main()
{
  int n; cin >> n;
  ll ans = 1;
  vector<ll> v(n+10, 0);
  for(int i = 1; i <= n; i++){
    int k = i;
    for(int j = 2; j <= i; j++){
      if(k == 0)continue;
      while(k % j == 0){
        v[j]++;
        k /= j;
      }
    }
  }
  for(int i = 2; i <= n; i++){
    if(v[i] !=  0){
      ans *= v[i]+1;
      ans %= MOD;
    }
  }
  cout << ans << endl;
  system("pause");
}

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

typedef long long ll;

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

  string s = "";
  char tmp = input[0];
  s = s + tmp;
  
  for(int i = 1; i < input.size(); i++){
    if(tmp == input[i]){
      // 何もしない
    } else { 
      
      s = s + input[i];
      tmp = input[i];
    }
  }
  cout << s.size() -1  << endl;
}

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

int main(){
  int a , b;
  cin >> a >> b;
  
  if (a > 12){
    cout << b << endl;
  }else if(a < 6){
    cout << "0" << endl;
  }else{
    cout << b / 2 << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
int main(){
  int i,j,k,n,m,cnt=0;
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&m);
    k=0;
    if(m==2)cnt++;
    if(m%2==0)continue;
    for(j=3;j<=sqrt(m);j+=2)
      if(m%j==0){
        k=1;
        break;
      }
    if(k==0)cnt++;
  }
  printf("%d\n",cnt);
  return 0;
}



Measured memory_bytes: 2084
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main()
{
	string S;
	ll K;
	cin >> S >> K;
	int N = S.size();
	char c = '1';
	for (int i = 0; K > 0 && i < N; i++) {
		if (S[i] != '1') {
			c = S[i];
			break;
		}
		--K;
	}
	cout << c << endl;
	return 0;
}


Measured memory_bytes: 256