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

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

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000

ll a,b;

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

  cin>>a>>b;
  if(a>b)swap(a,b);
  ll k=(a+b)/2;
  if((ll)abs(a-k)!=(ll)abs(b-k))cout<<"IMPOSSIBLE"<<endl;
  else cout<<k<<endl;

  return 0;
}


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

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

	if(b > c){
		temp = b;
		b = c;
		c = temp;
	}

	if(a > b){
		temp = a;
		a = b;
		b = temp;
	}

	if(b > c){
		temp = b;
		b = c;
		c = temp;
	}

	cout<<a<<" "<<b<<" "<<c<<endl;
	return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define dump(x) cout << (x) << endl
typedef long long ll;
typedef pair<ll, ll> pl;
typedef pair<int, int> pi;
typedef vector<int> V;

int main() {
  ll a, b, k;
  cin >> a >> b >> k;
  if (b-a+1 < 2*k) {
    for (int i = a; i <= b; i++) {
      dump(i);
    }
  }
  else {
    for (int i = a; i < a+k; i++) {
      dump(i);
    }
    for (int i = b-k+1; i <= b; i++) {
      dump(i);
    }
  }
  return 0;
}


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

//////全探索したいときに開けよ////////
vector<vector<int>> fspattern;
vector<int> fspattern_draft;
int fspcnt = 0;

void setfspattern_core(int floor,int number,int degree){
  if(floor==degree){
    fspattern.at(fspcnt) = fspattern_draft;
    fspcnt++;
  }else{
    rep(i,number){
      fspattern_draft.at(floor) = i;
      setfspattern_core(floor+1,number,degree);
    }
  }
}

void setfspattern(int number,int degree){
  int64_t array_num = 1;
  rep(i,degree){
    array_num *= number;
  }
  fspattern = vector<vector<int>>(array_num,vector<int>(degree));
  fspattern_draft = vector<int>(degree);
  setfspattern_core(0,number,degree);
}

//////nCrのmodを求めたいときに開けよ/////////
//int64_t univMod = 1000000007;
//int64_t factnum = 100000
//vector<int64_t> modfact(factnum);
//vector<int64_t> modinvfact(factnum);

/*void setmodfact(){
  for(int i=0;i<factnum;i++){
    if(i == 0){
      modfact.at(i) = 1;
    }else{
      modfact.at(i) = (modfact.at(i-1)*i)%univMod;
    }
  }
}

int64_t calcmodpower(int64_t a,int64_t n){
  int64_t res = 1;
  while(n != 0){
    if(n & 1){
      res = (res * a) % univMod;
    }
    a = (a*a) % univMod;
    n = n >> 1;
  }
  return res;
}

int64_t calcinverse(int64_t n){
	return calcmodpower(n,univMod-2);
}

void setmodinvfact(){
  for(int i=0;i<factnum;i++){
    if(i==0){
      modinvfact.at(i) = 1;
    }else{
      modinvfact.at(i) = calcmodpower(modfact.at(i),univMod-2);
    }
  }
}

int64_t calcmodcomb(int64_t n,int64_t r){
  return (((modfact.at(n)*modinvfact.at(r))%univMod)*modinvfact.at(n-r))%univMod;
}

int64_t calcmodpositive(int64_t n){
  return (n + ((abs(n)+univMod-1)/univMod)*univMod)%univMod;
}
  
    */


/*
int64_t calcGCD(int64_t a,int64_t b){
	int64_t p = a;
	int64_t q = b;
	int64_t c = a%b;
	while(c != 0){
		p = q;
		q = c;
		c = p%q;
	}
	return q;
}
*/

int main(){
  int64_t a,b;
  cin >> a >> b;
  if(a >= b){
    rep(i,a){
      cout << b;
    }
  }else{
    rep(i,b){
      cout << a;
    }
  }
  cout << endl;

}

Measured memory_bytes: 256
from functools import reduce


def xor(a, b):
    return a ^ b


def main():
    N = int(input())
    A = list(map(int, input().split()))
    total_xor = reduce(xor, A)
    vals = map(lambda v: total_xor ^ v, A)
    print(' '.join(map(str, vals)))


if __name__ == '__main__':
    main()


Measured memory_bytes: 34120
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define watch(x) cout<<(#x)<<"="<<(x)<<'\n'
#define mset(d,val) memset(d,val,sizeof(d))
#define setp(x) cout<<fixed<<setprecision(x)
#define forn(i,a,b) for(int i=a;i<b;i++)
#define fore(i,a,b) for(int i=a;i<=b;i++)
#define pb push_back
#define F first
#define S second
#define INF ll(1e18)
#define MOD 998244353
#define pqueue priority_queue
#define fbo find_by_order
#define ook order_of_key
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef long double ld;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;

#define MAXN 100005

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	ll s,w; cin>>s>>w;
	if(w>=s) cout<<"unsafe\n";
	else cout<<"safe\n";
	
	return 0;
}


Measured memory_bytes: 3604
#include <iostream>
using namespace std;
int main()
{
  int n,k=0;
  cin>>n;
  for(int i=1;i<=9;i++)
  {
    if(n%i==0&&n/i<10)
    {
      k=1;
      cout<<"Yes";
      break;
    }
  }
  if(k==0)
    cout<<"No";
  return 0;
}

Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
from math import floor, sqrt, factorial, hypot, log  # log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter, defaultdict, deque
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement
from bisect import bisect_left, bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint


def ceil(a, b): return (a + b - 1) // b


inf = float('inf')
mod = 10 ** 9 + 7


def pprint(*A):
    for a in A:     print(*a, sep='\n')


def INT_(n): return int(n) - 1


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


def MF(): return map(float, input().split())


def MI_(): return map(INT_, input().split())


def LI(): return list(MI())


def LI_(): return [int(x) - 1 for x in input().split()]


def LF(): return list(MF())


def LIN(n: int): return [I() for _ in range(n)]


def LLIN(n: int): return [LI() for _ in range(n)]


def LLIN_(n: int): return [LI_() for _ in range(n)]


def LLI(): return [list(map(int, l.split())) for l in input()]


def I(): return int(input())


def F(): return float(input())


def ST(): return input().replace('\n', '')


def main():
    N = I()
    c = input()
    start = 0
    end = N - 1
    ans = 0
    is_end = True
    while(start != end):
        if is_end:
            if c[end] == 'R':
                is_end = False
            end -= 1
        else:
            if c[start] == 'W':
                is_end = True
                ans += 1
            start += 1
    if not is_end and c[start] == 'W':
        ans += 1
    print(ans)


if __name__ == '__main__':
    main()

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

#define IOS ios::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0) ;
 
#define pb push_back
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<vi>
#define vp vector<pii>
#define vs vector<string>
#define all(v) v.begin(),v.end()

#define lb  lower_bound
#define ub  upper_bound
#define bs  binary_search
#define ff  first
#define ss  second
#define sz(x) ((int)(x).size())
#define rep(i,l,r) for(int i=(l);i<(r);++i)
 
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b)) / gcd((a),(b))
     
#define pi 3.14159265358979323846264338327950L
#define MOD 1000000007

int32_t main(){

    
     char s;
     cin>>s;
     if((int)toupper(s)==(int)(s))
          cout<<"A";
     else
          cout<<'a';
  return 0;
}




Measured memory_bytes: 3632
def do():
    di = {}
    N = int(input())
    for _ in range(N):
        temp = int(input())
        if temp not in di:
            di[temp] = 1
        else:
            di[temp] += 1
    ans = 0
    for k,v in di.items():
        if v % 2 == 1:
            ans += 1
    print(ans)



if __name__ == "__main__":
    do()

Measured memory_bytes: 15072
#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)

signed main(){

	lli a,b;
	cin>>a>>b;
	if(a%2 ==0  || b%2==0)cout<<"No"<<endl;
	else cout<<"Yes"<<endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
    int n,k; cin>>n>>k;
    int ans = 0;
    while(n>0){
        n /= k;
        ans++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;
 
void main()
{
    auto nks = readln.split.to!(long[]);
    auto N = nks[0];
    auto K = nks[1];
    auto S = nks[2];

    auto rs = new long[](N);
    foreach (i; 0..K) {
        rs[i] = S;
    }
    auto x = S == 10^^9 ? 1 : 10^^9;
    foreach (i; K..N) {
        rs[i] = x;
    }
    writeln(rs.to!(string[]).join(" "));
}

Measured memory_bytes: 6908
# -* encode: utf-8 *-

N = int(input())
rates = [int(x) for x in input().split()]

rates.sort()
uppers = [399, 799, 1199, 1599, 1999, 2399, 2799, 3199, 4800]
accum = list()
counts = list()

for upper in uppers:
    accum.append(len([x for x in rates if x <= upper]))

counts.append(accum[0])
for i in range(1, 9):
    counts.append(accum[i] - accum[i-1])

_least = sum([1 for count in counts[:-1] if count > 0])
max_scorerer = counts[-1]

if _least == 0:
    least = 1
    most = max_scorerer
else:
    least = _least
    most = least + max_scorerer

print("{} {}".format(least, most))

Measured memory_bytes: 3064
K, N = map(int, input().split())
A = list(map(int, input().split()))

betweenD = [] # 隣の家との間隔
for i in range(N):
    if i==N-1:
        betweenD.append(K - A[i] + A[0])
    else:
        betweenD.append(A[i+1] - A[i])

print(sum(betweenD) - max(betweenD)) # 間隔が最も離れている家同士の移動を避ける

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

//#pragma gcc optimize("O3,unroll-loop")
//#pragma gcc target("sse,sse2,sse3,ssse3,sse4,avx,avx2,fma,abm,mmx,popcnt,tune=native")
//#define int long long
//#define double long double

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

    int n, arr[200001];
    long long k;
    cin >> n >> k;
    for (int i = 1; i <= n; i++)
        cin >> arr[i];

    int pos = 1, sp = -1;
    vector<int> route;
    map<int, int> vis;
    while (k--)
    {
        if (vis.count(pos))
        {
            sp = vis[pos];
            k++;
            break;
        }
        vis[pos] = route.size();
        route.push_back(pos);
        pos = arr[pos];
    }

    if (k == -1)
        cout << pos << '\n';
    else
    {
        k %= (route.size() - sp);
        cout << route[sp + k] << '\n';
    }

    return 0;
}

//      *   *  *****  *   *  *   *
//     *   *  *      **  *  *   *
//    *****  *****  * * *  *   *
//   *   *      *  *  **  *   *
//  *   *  *****  *   *   ***

//      ***** ***** *   * *     ***** *   * ***** *****
//        *  *   * *   * *       *   **  *   *   *   *
//       *  *   * ***** *       *   * * *   *   *****
//   *  *  *   *   *   *       *   *  **   *   *
//  ****  *****   *   ***** ***** *   *   *   *


Measured memory_bytes: 12088
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
typedef long double ld;
using namespace std;

ld inf = 1e18;
int n;
typedef pair<ld, int> P;
ld cost[1005];
vector<P> edge[1005];

void dijkstra() {
    priority_queue < P, vector<P>, greater<P> > q;
    for (int i = 0; i < n+2; i++) cost[i] = inf;
    cost[0] = 0.0;
    q.push(P(0.0, 0));

    while (!q.empty()) {
        P p = q.top(); q.pop();
        int node = p.second;
        if (cost[node] < p.first) continue;
        for (P next : edge[node]) {
            int next_node = next.second;
            ld c = next.first;

            if (cost[next_node] > cost[node] + c) {
                cost[next_node] = cost[node] + c;
                q.push(P(cost[next_node], next_node));
            }
        }
    }
}

int main() {
    ld x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2 >> n;

    vector <ld> X(n+2), Y(n+2), R(n+2);
    X[0] = x1; Y[0] = y1; R[0] = 0.0;
    for (int i = 1; i <= n; i++) {
        cin >> X[i] >> Y[i] >> R[i];
    }
    X[n+1] = x2; Y[n+1] = y2; R[n+1] = 0.0;

    for (int i = 0; i < n+2; i++) {
        for (int j = i+1; j < n+2; j++) {
            ld distance = sqrt((X[i] - X[j]) * (X[i] - X[j]) + (Y[i] - Y[j]) * (Y[i] - Y[j]));
            ld c = max((ld)0, distance - R[i] - R[j]);
            edge[i].push_back(P(c, j));
            edge[j].push_back(P(c, i));
        }
    }

    dijkstra();

    cout << fixed << setprecision(12) << cost[n+1] << '\n';
    return 0;
}

Measured memory_bytes: 42768
import java.util.Scanner;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int N = sc.nextInt();
   int i = N - N/2;
   float n = 0f;
   n = (float) i/N;
       
   System.out.println(n);
 
   
 }
}

Measured memory_bytes: 21716
# B(TLE) 2104ms

import numpy as np
N, K = map(int, input().split())
h = np.array(list(map(int, input().split())))
cost = np.zeros(N, dtype="int32")

cost[0] = 0
for i in range(1,N):
    start = 0 if i < K else i-K
    cost[i] = np.min(cost[start:i] + np.abs(h[i]-h[start:i]))

print(cost[-1])


Measured memory_bytes: 22760
#include <algorithm>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
// const int INF = (1 << 30) - 1;
// const ll LL_INF = (1LL << 62) - 1;
// const ll MOD = 1e9 + 7;

int N;
vector<int> H;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N;
  H.resize(N);
  for (int i = 0; i < N; i++) {
    cin >> H[i];
  }

  int ans = 0;
  int cur_num = 0;
  int cur_v = H[0];
  for (int i = 1; i < N; i++) {
    if (H[i] <= cur_v) {
      cur_num++;
      cur_v = H[i];
    } else {
      ans = max(ans, cur_num);
      cur_num = 0;
      cur_v = H[i];
    }
  }
  ans = max(ans, cur_num);

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

Measured memory_bytes: 640
N, Y = map(int, input().split())

l = [[] for _ in range(N+1)]

for i in range(N+1):
    for j in range(N+1-i):
        l[i].append(10000*i + 5000*j + 1000*(N-i-j))


a = 0
for i in range(N+1) :
    if Y in l[i] :
        print(str(i) + ' '+ str(l[i].index(Y)) + ' ' +  str((N-i-(l[i].index(Y)))))
        a =1
        break

if a== 0:
    print('-1 -1 -1')


Measured memory_bytes: 83344
import java.io.*;
public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str = br.readLine();
		int S = Integer.parseInt(str);
		int h = S / 3600;
		S = S % 3600;
		int m = S / 60;
		int s = S % 60;
		System.out.println(h + ":" + m + ":" + s);
		br.close();
	}
}

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

#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define dump(v)                  \
    cerr << #v ":[ ";            \
    for (auto macro_vi : v) {    \
        cerr << macro_vi << " "; \
    }                            \
    cerr << "]" << endl;
#define ddump(v)                           \
    cerr << #v ":" << endl;                \
    for (auto macro_row : v) {             \
        cerr << "[";                       \
        for (auto macro__vi : macro_row) { \
            cerr << macro__vi << " ";      \
        }                                  \
        cerr << "]" << endl;               \
    }
using lint       = long long;
const int INF    = 1e9;
const lint LINF  = 1e18;
const double EPS = 1e-10;

int main() {
    int x;
    cin >> x;
    if (x == 0) {
        cout << 1 << endl;
    } else {
        cout << 0 << endl;
    }

    return 0;
}

Measured memory_bytes: 3592
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int n, a, b;
    vector<int> v;
    
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> a >> b;
        v.push_back(a + b);
    }
    
    sort(v.begin(), v.end());
    while (1) {
        int cnt = 1;
        bool check = true;
        vector<int> t;
        
        for (int i = 0; i < v.size(); ++i) {
            if (i != v.size() - 1 && v[i] == v[i + 1]) {
                cnt++;
            }
            else {
                if (cnt >= 2)
                    check = false;
                
                if (cnt % 2 == 1)
                    t.push_back(v[i]);
                for (int j = 0; j < cnt / 2; ++j) {
                    t.push_back(v[i] + 1);
                }
                
                cnt = 1;
            }
        }
        
        if (check)
            break;
        
        v = t;
    }
    
    for (auto elem: v) {
        cout << elem << " " << 0 << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3912
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using u32 = uint32_t;
using vi = vector<int>;    using vvi = vector<vi>;
using vb = vector<bool>;   using vvb = vector<vb>;
using vl = vector<ll>;     using vvl = vector<vl>;
using vd = vector<double>; using vvd = vector<vd>;

#define MAXC(c, x) (c = max(c, x))
#define MINC(c, x) (c = min(c, x))

#define REP(i,n) for(auto i = 0 * (n), i##_len = (n); i < i##_len; ++i)
#define ALL(c) (c).begin(), (c).end()
#define FOR(i,s,n) for(ll i=s, i##_len=(ll)(n); i<i##_len; ++i)
#define TEN(x) ((ll)1e##x)
const ll mod = TEN(9) + 7;

const ll INF = 1e9;

int main() {
	#ifdef INPUT_FROM_FILE
	ifstream cin("sample.in");
	ofstream cout("sample.out");
	#endif
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(50);

	ll n; cin >> n;
	vvl dp(2, vl(n));
	REP(i, 2) REP(j, n) cin >> dp[i][j];

	vvl dp2(2, vl(n + 1, 0));
	REP(i, n) {
		dp2[0][i + 1] = dp2[0][i] + dp[0][i];
		dp2[1][i + 1] = max(dp2[1][i] + dp[1][i], dp2[0][i + 1] + dp[1][i]);
	}

	cout << dp2[1][n] << endl;

	return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned __int128 HASH;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll,int> plli;
typedef pair<double, int> pdbi;
typedef pair<int,pii> pipii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;
typedef vector<vector<int>> mat;

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n);i>0;i--)
#define rrep2(i,a,b) for (int i=(a);i>b;i--)
#define pb push_back
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()

const ll hmod1 = 999999937;
const ll hmod2 = 1000000000 + 9;
const ll INF = 1<<30;
const ll mod = 1000000000 + 7;
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const int dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1};
const double pi = 3.141592653589793;

//#define int long long
#define addm(X, Y) (X) = ((X) + ((Y) % mod) + mod) % mod

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    while (true) {
        int n;
        int cnt[26] = {};
        char C[105] = {};
        cin >> n;
        if (n == 0) break;
        bool ok1 = false;
        char ans;
        int ans_cnt = 0;
        rep(i, n) cin >> C[i];
        rep(i, n) {
            char c = C[i];
            cnt[c - 'A']++;
            rep(j, 26) {
                bool ok2 = true;
                rep(k, 26) {
                    if (j == k) continue;
                    if (cnt[k] + n - i - 1 >= cnt[j]) {
                        ok2 = false;
                        continue;
                    }
                }
                if (ok2) {
                    ans = 'A' + j;
                    ans_cnt = i + 1;
                    break;
                }
            }
            if (ans_cnt != 0) {
                ok1 = true;
                break;
            }
        }
        if (ok1) cout << ans << " " << ans_cnt << endl;
        else cout << "TIE" << endl;
    }
}

Measured memory_bytes: 3152
#include <stdio.h>
#include <iostream>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <string>
#include <map>
using namespace std;

//ABC 144B
int main() {
	int n;
	cin >> n;

	if (n >= 1 && n <= 81) {
		for (int i=1; i<=9; i++) {
			for (int j=1; j <=9; j++){
				if (n==i*j) {
					cout << "Yes" << endl;
					return 0;
				}
			}
		}
	}
	cout << "No" << endl;
}

Measured memory_bytes: 256
def bellman_ford(s):
    d = [float('inf')]*n # 各頂点への最小コスト
    d[s] = 0 # 自身への距離は0
    for i in range(n):
        e=0
        for x, y, z in g:
            if d[y] > d[x] + z and d[x] != float('inf'):
                d[y] = d[x] + z
                e+=1
        # 負閉路が存在
                if i == n - 1 and y==n-1 :
                 return "inf"
    return (-1)*d[n-1]

n, m = map(int,input().split()) # n:頂点数, w:辺の数
g = []
for k in range(m):
    a, b, c = map(int,input().split()) # 始点,終点,コスト
    g.append([a-1, b-1, -c])
print(bellman_ford(0))

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

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int N;
    cin >> N;
    vector<int> ans(4,0);
    for (int i = 0; i<N; ++i) {
        string verdict;
        cin >> verdict;
        if (verdict == "AC") ++ans[0];
        else if (verdict == "WA") ++ans[1];
        else if (verdict == "TLE") ++ans[2];
        else ++ans[3];
    }
    cout << "AC x " << ans[0] << '\n';
    cout << "WA x " << ans[1] << '\n';
    cout << "TLE x " << ans[2] << '\n';
    cout << "RE x " << ans[3] << '\n';
    
}

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

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<double> vd;
typedef vector<vd> vdd;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)
#define RFOR(i,x,y) for(ll i=(ll)x; i>=(ll)y; --i)
#define RREP(i,x) RFOR(i, x, 0)
#define ALL(a) a.begin(), a.end()
#define pb push_back
#define debug_print(x...) cerr << "line " << __LINE__ << " : "; debug_print_in(x);

template <typename First>
void debug_print_in(First first){
  cerr << first << endl;
  return;
}

template <typename First, typename... Rest>
void debug_print_in(First first, Rest... rest){
  cerr << first << " ";
  debug_print_in(rest...);
  return;
}

void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

template <typename First>
void OUT(First first){
  cout << first << endl;
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}

template<class t, class u> void chmax(t&a,u b){if(a<b)a=b;};
template<class t, class u> void chmin(t&a,u b){if(a>b)a=b;};
int popcount(int t){return __builtin_popcount(t);} //GCC
int popcount(ll t){return __builtin_popcountll(t);} //GCC

template <typename T>
void vec_print(vector<T> VEC){
  REP(i, VEC.size()){
    cerr << VEC[i] << " ";
  }
  cerr << endl;
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  REP(i,MAT.size()){
    REP(j,MAT[i].size()){
      cerr << MAT[i][j] << " ";
    }
    cerr << endl;
  }
};

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;
constexpr ll MOD = (ll)((1E+9)+7);

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  ll N;
  IN(N);

  if(N==2){
    OUT(1);
    return 0;
  }else if(N==3){
    OUT(2);
    return 0;
  }else if(N==4){
    OUT(3);
    return 0;
  }else if(N==5){
    OUT(3);
    return 0;
  }

  ll sqrt_N = (ll)sqrt((double)N)+1;

  ll ans = 1; // K=N
  set<ll> st_K;
  for(ll k=1; k<=sqrt_N+1; ++k){
    if(((N-1)/k)*k==N-1){
      st_K.emplace((N-1)/k);
      //debug_print((N-1)/k);
      ans++;
    }
  }
  for(ll K=2; K<=sqrt_N+1; ++K){
    if(st_K.find(K)!=st_K.end()) continue;
    ll N_copy = N;
    while(N_copy%K==0) N_copy/=K;
    //debug_print(N_copy, K);
    N_copy-=(N_copy/K)*K;
    if(N_copy==1){
      //debug_print(N_copy, K);
      ans++;
    }
  }

  OUT(ans);

  return 0;
}

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

int main()
{
  char s[310];
  scanf("%s",s);
  int n=strlen(s);
  int k;
  scanf("%d",&k);
  static int dp[310][310][310];
  int ans=1;
  for(int j=0;j<=n;j++){
    for(int i=0;i+j<=n;i++){
      for(int l=0;l<=k;l++){
	if(j==0||j==1){
	  dp[i][j][l]=j;
	  continue;
	}
	dp[i][j][l]=max(dp[i][j-1][l],dp[i+1][j-1][l]);
	if(s[i]==s[i+j-1]){
	  dp[i][j][l]=max(dp[i][j][l],dp[i+1][j-2][l]+2);
	}
	if(l>0){
	  dp[i][j][l]=max(dp[i][j][l],dp[i+1][j-2][l-1]+2);
	}
	ans=max(ans,dp[i][j][l]);
      }
    }
  }
  printf("%d\n",ans);
  return 0;
}

	


Measured memory_bytes: 112896
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define P pair<int,int>
#define PI 3.141592653589793
const int INF = 1001001001;
const ll MX = 1e18;

int main() {
	int d;
	cin >> d;
	vector<int> c(26),l(26),t(d);
	rep(i, 26) cin >> c[i];

	vector<vector<int>> s(d, vector<int>(26));
	rep(i, d) {
		int now = 0;
		int nowi = 0;
		rep(j, 26) {
			cin >> s[i][j];
			if (now < s[i][j]) {
				now = s[i][j];
				nowi = j;
			}
		}
		t[i] = nowi;
	}
	rep(i, d) cout << t[i]+1 << endl;
	int ans = 0;
	rep(i, d) {
		int x = t[i];
		ans += s[i][x];
		l[x] = i + 1;
		rep(j, 26) {
			if (j == x)continue;
			ans -= c[j] * (i + 1 - l[j]);
		}
		//cout << ans << endl;
	}
}


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

int main() {
    int n;
    cin >> n;
    unsigned long long ans = 1, MAX = 1000000000000000000,a[n];
    for(int i=0 ; i < n ; i++){
        cin >> a[i];
        if(a[i]==0){
            cout << 0 << endl;
            return 0;
        }
    }
    for(int i=0 ; i < n ; i++){
        if( a[i] <= MAX/ans){
            ans *= a[i];
        }
        else {
            cout << -1 << endl;
            return 0;
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 4396
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  	int N, ans=1;
  	cin >> N;
  	vector<int> diameter(N);
  	for(int i=0;i<N;i++){
    	cin >> diameter.at(i);
    }
  	sort(diameter.begin(),diameter.end());
  	for(int i=1;i<N;i++){
    	if(diameter.at(i) > diameter.at(i-1))ans++; 
    }
	cout << ans << endl;
}



Measured memory_bytes: 3628
// ABC 097 D
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i = 0; i < (int)(n); ++i)

int parent[100010],sequence[100010];
int N, M, x, y;

int find(int x){
    return parent[x]==x?x:parent[x]=find(parent[x]);
}
void unite(int x, int y){
    parent[find(x)] = find(y);
}

int main() {
    cin >> N >> M;
    REP(i,N){
        cin >> sequence[i];
        sequence[i]--;
        parent[i] = i;}
    REP(i,M){
        cin >> x >> y;
        x--; y--;
        unite(x,y);}
    int ans = 0;
    REP(i,N){
        if(find(i)==find(sequence[i])){
            ans++;}}
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
import java.util.*; 

class Main{
public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int k=sc.nextInt();
  		int a=1;
		int ans=0;

  		
		while(n>=a){
         a=a*k;
          ans++;
        }
    
 	

    	System.out.println(ans);
    }
}


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

	int a,b,c;
	long long ans,x,y,ab;

int main()
{
	scanf("%d%d%d%d%d",&a,&b,&c,&x,&y);
	if(a+b>=2*c)
	{
		ab=min(x,y)*2;
		if(x>y)
			ans=min(ab*c+(x-y)*a,max(x,y)*2*c);
		else
			ans=min(ab*c+(y-x)*b,max(x,y)*2*c);
	}
	else
	{
		ans=min(x*a+y*b,max(x,y)*2*c);
	}
	printf("%d",ans);
}


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

int main(){
    int n;
    cin >> n;
    vector<int> p(n);
    rep(i,n) cin >> p[i];
    
    sort(p.begin(),p.end());
    
    int nmax = p.at(n-1);
    int nmin = p.at(0);
    int minhp = 10000000;
    int han = minhp;
    
    for(int i = nmin;i < nmax;i++){
        int ma = 0;
        for(int j = 0;j < n;j++){
            ma += ((p[j] - i) * (p[j] - i));
        }
        
        minhp = min(minhp,ma);
    }
    if(minhp == han) cout << 0;
    else cout << minhp;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(i,a,b) for (int i=a; i<b; ++i)

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll N, K; cin >> N >> K;
    vector <ll> A(N+1);
    loop(i,1,N+1) cin >> A[i];
    vector <int> visited(N+1, 0);
    ll node=1;
    vector <ll> order;
    int index;
    while (1) 
    {
        if (visited[node]) {
            index = visited[node];
            break;
        }
        visited[node]=order.size()+1;
        order.push_back(node);
        node=A[node];
    }
    vector <ll> order2(order.begin()+index-1, order.end());
    if (K<order.size()) {
        cout << order[K] << "\n";
        return 0;
    }
    K-=(order.size()-order2.size());
    // cout << K << " " << order2.size() << " " << K%order2.size() << "\n";
    cout << order2[K%order2.size()] << "\n";
    return 0;
}

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

bool isPrime( int x ){
    if ( x == 2 ) return true;
    if ( x < 2 || x % 2 == 0 ) return false;
    for ( int i = 3; i * i < x; i += 2 ){
	if ( x % i == 0 ) return false;
    }
    return true;
}

main(){
    int n;
    while ( cin >> n ){
	for ( int i = n-1; ; i-- ) { 
	    if ( isPrime(i) ) { cout << i << " "; break; }
	}
	for ( int i = n+1; ; i++ ) { 
	    if ( isPrime(i) ) { cout << i << endl; break; }
	}
    }
}

Measured memory_bytes: 0
#[allow(unused_imports)]
use itertools::Itertools;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;

fn main() {
    input! {
        n: usize,
        m: usize,
        ab: [(Usize1, Usize1); m],
    }
    let mut g = vec![vec![]; n];
    for (a, b) in ab {
        g[a].push(b);
        g[b].push(a);
    }
    let mut par = vec![None; n];

    let mut q = std::collections::VecDeque::new();
    q.push_back((0, 0));
    while let Some((v, p)) = q.pop_front() {
        if par[v] != None {
            continue;
        }
        par[v] = Some(p);
        for &u in &g[v] {
            if u == p {
                continue;
            }
            q.push_back((u, v));
        }
    }
    println!("Yes");
    for i in 1..n {
        println!("{}", par[i].unwrap() + 1);
    }
}


Measured memory_bytes: 19704
A = int(input())
B = int(input())
C = int(input())
X = int(input())

ans = 0
for a in range(A + 1):
    for b in range(B + 1):
        q = (X - (500 * a + 100 * b)) / 50
        if q >= 0 and q <= C:
            ans += 1
print(ans)

Measured memory_bytes: 3060
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

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

#define MOD 1000000007

void solve(int test_case) {//228
	int h,w;
	cin>>h>>w;
	vector<vector<char>> arr(h,vector<char>(w));
	for(auto &a:arr)for(auto &b:a)cin>>b;
	REP(i,0,h-1) {
		REP(j,0,w-1) {
			if(arr[i][j]=='#') {
				if(i>0&&arr[i-1][j]=='#')continue;
				if(i<h-1 && arr[i+1][j]=='#')continue;
				if(j>0&&arr[i][j-1]=='#')continue;
				if(j<w-1 && arr[i][j+1]=='#')continue;
				cout<<"No";
				return;
			}
		}
	}
	cout<<"Yes";
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


Measured memory_bytes: 3628
#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cstring>
#include <functional>
#include <cmath>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define rep1(i,n) for(int i=1;i<=(n);++i)
#define all(c) (c).begin(),(c).end()
#define fs first
#define sc second
#define pb push_back
#define show(x) cout << #x << " " << x << endl
double x[100],y[100],v[100],a[100],b[100];
struct edge {int to,cap,rev;};
const int MAX_V=202,INF=1e9;
double eps=1e-9;
vector<edge> G[MAX_V];
bool used[MAX_V];
void add_edge(int from, int to, int cap){
	edge e1={to,cap,G[to].size()};
	edge e2={from,0,G[from].size()};
	G[from].push_back(e1);
	G[to].push_back(e2);
}
int dfs(int v,int t,int f){
	if(v==t) return f;
	used[v]=true;
	for(int i=0;i<G[v].size();i++){
		edge &e=G[v][i];
		if(!used[e.to] && e.cap>0){
			int d=dfs(e.to,t,min(f,e.cap));
			if(d>0){
				e.cap-=d;
				G[e.to][e.rev].cap+=d;
				return d;
			}
		}
	}
	return 0;
}
int max_flow(int s,int t){
	int flow=0;
	while(true){
		memset(used,0,sizeof(used));
		int f=dfs(s,t,INF);
		if(f==0) return flow;
		flow+=f;
	}
}
double ti[100][100];
int main(){
	while(true){
		int N,M;
		cin>>N>>M;
		if(N==0) break;
		rep(i,N) cin>>x[i]>>y[i]>>v[i];
		rep(i,M) cin>>a[i]>>b[i];
		int s=N+M,t=N+M+1;
		int V=N+M+2;
		rep(i,N) rep(j,M) ti[i][j]=sqrt((x[i]-a[j])*(x[i]-a[j])+(y[i]-b[j])*(y[i]-b[j]))/v[i];
		double ub=1e6,lb=0;
		while(ub-lb>eps){
			rep(i,V) G[i].clear();
			double m=(ub+lb)/2;
			rep(i,N) add_edge(s,i,1);
			rep(i,M) add_edge(i+N,t,1);
			rep(i,N) rep(j,M) if(ti[i][j]<m) add_edge(i,j+N,1);
			if(max_flow(s,t)==M) ub=m;
			else lb=m;
		}
		printf("%.12f\n",ub);
	}
}

Measured memory_bytes: 1672
s,k=open(0)
n=len(s)-1
k=int(k)
t=set()
for a in s[:n]:
  t.add(a)
for a,b in zip(s,s[1:n]):
  t.add(a+b)
for a,b,c in zip(s,s[1:],s[2:n]):
  t.add(a+b+c)
for a,b,c,d in zip(s,s[1:],s[2:],s[3:n]):
  t.add(a+b+c+d)
for a,b,c,d,e in zip(s,s[1:],s[2:],s[3:],s[4:n]):
  t.add(a+b+c+d+e)
print(sorted(t)[k-1])

Measured memory_bytes: 4464
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1LL << 60;
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)

int B[150];
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	int N;
	cin >> N;
	for (int i = 0; i < N-1; i++)cin >> B[i];

	int ans = 0;
	for (int i = 0; i < N; i++) {
		if (i == 0)ans += B[0];
		else if (i == N - 1)ans += B[N - 2];
		else ans += min(B[i-1],B[i]);
	}
	puts(ans);

	return 0;
}


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

int main(void) {
  int n, a, b;
  string s;
  cin >> n >> a >> b;
  cin >> s;

  int nb = 0;
  int nab = 0;
  for (const char &c : s) {
    if (c == 'a') {
      if (nab < a + b) {
        nab++;
        cout << "Yes" << endl;

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

    } else if (c == 'b') {
      nb++;

      if (nab < a + b && nb <= b) {
        nab++;
        cout << "Yes" << endl;

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

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

  return 0;
}

Measured memory_bytes: 896
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int[][] F = new int[N][10];
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < 10; j++) {
                F[i][j] = scan.nextInt();
            }
        }
        int[][] P = new int[N][11];
        for (int i = 0; i < N; i++) {
            for (int j = 0; j <= 10; j++) {
                P[i][j] = scan.nextInt();
            }
        }
        int max = (int)Math.pow(2, 11);
        long answer = Long.MIN_VALUE;
        for (int i = 1; i < max; i++) {
            String digits = Integer.toString(i, 2);
            int remain = 10 - digits.length();
            StringBuilder sb = new StringBuilder();
            for (int j = 0; j < remain; j++) {
                sb.append("0");
            }
            sb.append(digits);
            digits = sb.toString();
            int[] c = new int[N];
            char[] d = digits.toCharArray();
            for (int j = 0; j < 10; j++) {
                if (d[j] - '0' == 0) {
                    continue;
                }
                for (int k = 0; k < N; k++) {
                    if (F[k][j] == 1) {
                        c[k] += 1;
                    }
                }
            }
            long t = 0;
            for (int j = 0; j < N; j++) {
                t += P[j][c[j]];
            }
            answer = Math.max(answer, t);
        }
        System.out.println(answer);
    }
}


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

int main(){
  int n,fx=0,mod;
  string ans;
  cin>>n;
  mod=n;
  for(int i=0;i<9;i++)
  {
    fx=fx+mod%10;
    mod/=10;
  }

  if(n%fx==0) ans="Yes";
  else ans="No";

  cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val a = sc.nextInt()
    val b = sc.nextInt()
    println(problem063a(a, b))
}

fun problem063a(a: Int, b: Int): String {
    return if (a + b >= 10) "error" else (a + b).toString()
}

Measured memory_bytes: 29480
import java.util.*;
class Main{
  static Scanner sc = new Scanner(System.in);
  public static void main(String[] args){
    int x[] = new int[9999999];
    for(int i=0;i<5;i++){
      x[sc.nextInt()]=i;
    }
    System.out.println(x[0]+1);
  }
}

Measured memory_bytes: 74752
package main

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

func main() {
	sc := NewScanner()
	n := sc.NextInt()

	mp := map[string]bool{}

	for i := 0; i < n; i++ {
		s := sc.Next()
		mp[s] = true
	}
	ans := 0
	if mp["P"] {
		ans++
	}
	if mp["W"] {
		ans++
	}
	if mp["G"] {
		ans++
	}
	if mp["Y"] {
		ans++
	}

	if ans == 4 {
		fmt.Printf("Four\n")
		return
	}

	fmt.Printf("Three\n")

}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			result = append(result, v)
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	result = append(result, v)

	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 640
$debug=0
def main
  dat=[]
  fh=STDIN
  #fh=File.new("x.txt", "r")
  while fh.gets
    n=$_.chomp.to_i
    break if n==0

    max= -9999999
    subseq = []

    n.times {
      a = fh.gets.chomp.to_i
      subseq.map!{|x| x+= a}
      subseq.push(a)

      cmax = subseq.max
      max = cmax if cmax > max
    }
    puts max

  end
end

if $0 == __FILE__ then
  main
end


Measured memory_bytes: 6892
H, W = map(int, input().split())
a = [input() for _ in range(H)]
dp = [[0] * (W+1) for _ in range(H+1)]
ans = int(0)
mod = int(1000000007)
dp[1][1] = int(1)

for i in range(H):
    for j in range(W):
        if not(i==0 and j==0):
            if a[i][j] == ".":
#                print("Y",i,j)
                dp[i + 1][j + 1] = dp[i][j + 1] + dp[i + 1][j]
            else:
                dp[i + 1][j + 1] = 0

print(dp[H][W]%mod)

Measured memory_bytes: 157468
import bisect
from collections import deque
n = int(input())
color = deque([int(input())])
for i in range(1,n):
    num = int(input())
    if color[0] >= num:
        color.appendleft(num)
    else:
        bis = bisect.bisect_left(color, num)
        color[bis-1] = num
print(len(color))


Measured memory_bytes: 7284
#include <bits/stdc++.h>
/// TONI BO$$ was here
/// #MLC

using namespace std;
string v;
int rez[100001];
vector <int> poz;
int main()
{
    int n,i,z;
    cin>>v;
    n=v.size();
    for(i=0; i<n-1; i++)
        if(v[i]=='R' && v[i+1]=='L')
            poz.push_back(i);
    for(auto it : poz)
    {
        z=it;
        while(z>=0 && v[z]=='R')
        {
            if((it-z)%2)
                rez[it+1]++;
            else
                rez[it]++;
            z--;
        }
        z=it+1;
        while(z<n && v[z]=='L')
        {
            if((z-it-1)%2)
                rez[it]++;
            else
                rez[it+1]++;
            z++;
        }
    }
    for(i=0; i<n; i++)
        printf("%d ",rez[i]);

    return 0;
}


Measured memory_bytes: 1276
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<map>
#include<queue>
using namespace std;
typedef long long ll;
const int N=1e4+11,INF=~0u>>2;
int n,k;
bool vis[11];
int read(){
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-') f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return f*x;
}
bool check(int x){
	while(x){
		if(vis[x%10]==1) return 0;
		x/=10;
	}
	return 1;
}
int main(){
//	freopen("ex.in","r",stdin);
	n=read();k=read();
	for(int i=1;i<=k;++i){
		int t=read();
		vis[t]=1;
	}
	while(1){
		if(check(n)){
			printf("%d",n);
			return 0;
		}
		n++;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define lg long long int
#define loop(i,s,e) for(lg i=s;i<=e;i++)
#define iloop(i,s,e) for(lg i=e;i>=s;i--)
#define pb push_back
#define mp make_pair
#define mod 1000000007
using namespace std;

lg min(lg a,lg b)
{return a<b?a:b;}
lg max(lg a,lg b)
{return a>b?a:b;}
lg lcm(lg a ,lg b)
{
    return (a*b)/__gcd(a,b);
}
int main()
{
    lg n;
    cin>>n;
    vector<lg>a(n,0);
    vector<lg>b(n,0);

    for(lg i=0;i<n;i++)
        cin>>a[i];

    b[n-1]=a[n-1];
    for(lg i=n-2;i>=0;i--)
        b[i]=(a[i]+b[i+1])%mod;
    lg ans=0;
    for(lg i=0;i<n-1;i++)
        ans=(ans+((a[i]*b[i+1])%mod))%mod;
    cout<<ans%mod<<endl;
}


Measured memory_bytes: 6368
#include <bits/stdc++.h>
using namespace std;
bool so[1000000];

int main(){
  so[0]=so[1]=1;
  for(int i=2;i*i<=1e6;i++)
    if(!so[i]) for(int j=2;j<=1e6/i;j++)so[i*j]=1;
  
  int n;
  while(cin>>n,n){
    
    int ans=0;
    for(int i=2;i<=n-1&&i<=n-i;i++)
      if(!so[i]&&!so[n-i])ans++;
    
    cout<<ans<<endl;

  }
  return 0;
}

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

int n;
const long long INF = 1LL << 30;

int main() {
    cin >> n;
    int R[n];
    for (int i = 0; i < n; i++) cin >> R[i];
    
    int maxv = -INF;
    int minv = R[0];
    for (int i = 1; i < n; i++) {
        maxv = max(maxv, R[i] - minv);
        minv = min(minv, R[i]);
    }
    
    cout << maxv << endl;
    
    return 0;
}


Measured memory_bytes: 3872
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e9;
const ll mod = 1e9+7;
typedef pair<int,int> P;
#define rep(i,N) for(int i=0;i<N;i++)
#define rep2(i,m,N) for(int i=m;i<N;i++)
#define mm(n,m) memset(n,m,sizeof(n))

int main(){
    ll n,k,q;
    cin>>n>>k>>q;
    ll mn[n];
    ll a[q];
    mm(mn,0);
    rep(i,q){
        cin>>a[i];
        mn[a[i]-1] ++;
    }
    rep(i,n){
        ll tmp = k - (q-mn[i]);
       // cout<<"a,i:"<<tmp<<" "<<i<<endl;
        if(tmp<=0){
            cout<<"No"<<endl;
        }else{
            cout<<"Yes"<<endl;
        }
    }
}

Measured memory_bytes: 2176
#include <iostream>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
	string table = "qwertasdfgzxcvb";
	string str;
	while(cin >> str , str != "#"){
		string ans;
		rep(i,str.size()){
			ans += '0' + !!count(table.begin(),table.end(),str[i]);
		}
		ans.erase(unique(ans.begin(),ans.end()),ans.end());
		cout << ans.size()-1 << endl;
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#include <cassert>
typedef long long int ll;
using namespace std;

// @@ !! LIM()

int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  ll N; cin >> N;
  vector<ll> vec(N+1);
  for (ll i = 1; i <= N; i++) {
    ll x; cin >> x;
    vec.at(x) = i;
  }
  for (ll i = 1; i <= N; i++) {
    if (i > 1) cout << " ";
    cout << vec.at(i);
  }
  cout << endl;

  return 0;
}



Measured memory_bytes: 3876