akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define mp make_pair
typedef pair<int,int> pii;
int gi[10][10],vis[10][10];
int main()
{
    for(int i=1;i<=3;i++)
    {
        for(int j=1;j<=3;j++)
            cin>>gi[i][j];
    }
    int n;cin>>n;
    for(int i=1;i<=n;i++){
        int x;cin>>x;
        for(int k=1;k<=3;k++)
        {
            for(int j=1;j<=3;j++){
                if(gi[k][j]==x)vis[k][j]=1;
            }
        }
    }
    int flag=0;
    for(int i=1;i<=3;i++){
        if(vis[i][1]&&vis[i][2]&&vis[i][3]){
            flag=1;break;
        }
    }
    for(int i=1;i<=n&&!flag;i++){
        if(vis[1][i]&&vis[2][i]&&vis[3][i]){
            flag=1;break;
        }
    }
    if((vis[1][1]&&vis[2][2]&&vis[3][3])||(vis[3][1]&&vis[2][2]&&vis[1][3])){
        flag=1;
    }
    if(flag)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

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

using namespace std;

void C(int N, vector<int>& A) {
	vector<int> B(N);
	for (int i = 0; i < N - 1; i++)
		B[A[i] - 1]++;
	for (int i = 0; i < N; i++)
		cout << B[i] << endl;
}

int main() {
	int N;
	cin >> N;
	vector<int> A(N - 1);
	for (int i = 0; i < N - 1; i++)
		cin >> A[i];
	C(N, A);
	return 0;
}

Measured memory_bytes: 4780
n,m = gets.chomp.split(" ").map(&:to_i)
p = Array.new(n,0)
v = Array.new(n+1,true)
adj = Array.new(n).map{Array.new}
edge = Array.new(m)
f = 0
v[0] = false

m.times do |i|
  l,r,d = gets.chomp.split(" ").map(&:to_i)
  edge[i] = [l-1,r-1,d]
  adj[l-1] << [r-1,d]
  adj[r-1] << [l-1,-d]
end

while f < n
  q = [f]
  while q.any?
    t = q.shift
    adj[t].each do |i,j|
      if v[i]
        q.push(i)
        v[i] = false
        p[i] = p[t]+j
      end
    end
  end
  for i in f..n
    if v[i]
      v[i] = false
      f = i
      break
    end
  end
end

ans = true

for i in 0..m-1
  if p[edge[i][1]]-p[edge[i][0]] != edge[i][2]
    ans = false
    break
  end
end

puts ans ? "Yes" : "No"

Measured memory_bytes: 55788
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main(){
    ll n, a, b;
    cin >> n >> a >> b;
    if ((b-a)%2LL==0) {
        cout << (b-a)/2LL << endl;
    }
    else {
        cout << min(n-b, a-1LL) + 1LL + (b - a - 1LL) / 2LL << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using namespace std;

//ループマクロ
#define FOR(i , a , b)  for(int i = (a) ; i < (b) ; i++)
#define REP(i , n)      for(int i = 0 ; i < n ; i++)
#define REPR(i , n)     for(int i = n ; 0 <= i ; i--)

//入出力
#define SCOUT(x) cout << (x) << " "
#define VECCIN(x) for(auto& ele : (x) ) cin >> ele
#define VECOUT(x) for(auto& ele : (x) ) cout << ele << " "; cout << endl;

//その他
#define ALL(obj) (obj).begin() , (obj).end() 
#define P pair<int , int>
#define V vector<int>
#define M map<int, int>
#define PQ priority_queue<int>
#define PQG priority_queue<int , V , greater<int>>
int main(void) {

	ios::sync_with_stdio(false);	cin.tie(0);
	int N;  cin >> N;
	vector<ll> keep(5);   //添え字0から順に M A R C H から始まる人物の人数を数える
	for(int i = 0 ; i < N ; i++){
	 string input;  cin >> input;
	 switch(input[0]){
	  case 'M':  keep[0] += 1;  break;
	  case 'A':  keep[1] += 1;  break;
 	  case 'R':  keep[2] += 1;  break;
	  case 'C':  keep[3] += 1;  break;
	  case 'H':  keep[4] += 1;  break;
	 }
	}
 
	ll ans = 0;
	for(int i = 0 ; i < 5 ; i++)
	 for(int j = i + 1 ; j < 5 ; j++)
	  for(int k = j + 1 ; k < 5 ; k++)
		ans += keep[i] * keep[j] * keep[k];

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include "iostream"
#include "algorithm"
#include "string"
#include "vector"
#include "cmath"
#include "bitset"
#include "queue"
#include "functional"
#include "map"
#include "unordered_map"
#include "set"
#include "stack"
#include "tuple"

#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define llmax 92233720368547758070
#define nyan "(=^･ω･^=)"
#define mkp make_pair
#define mkt make_tuple
#define P pair<ll, ll>
#define iP pair<int,int>
typedef long long ll;
using namespace std;

string s;
ll a[26]={},ans;

int main(){
	cin>>s;
	for(int i=0;i<s.size();++i){
		++a[s[i]-'a'];
	}
	ans=s.size()*(s.size()-1)/2+1;
	for(int i=0;i<26;++i){
		ans-=a[i]*(a[i]-1)/2;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<utility>
#include<map>
using namespace std;
typedef pair<int, int> P;

int main() {
    int N;
    cin >> N;
    map<P, bool> edge;
    if (N % 2 == 0) {
        for (int i = 1; i <= N; i++) {
            edge[P(i, N + 1 - i)] = true;
        }
    }
    else {
        for (int i = 1; i < N; i++) {
            edge[P(i, N - i)] = true;
        }
    }
    vector<P> ans;
    for (int i = 1; i <= N; i++) {
        for (int j = i + 1; j <= N; j++) {
            if (!edge[P(i, j)]) {
                ans.push_back(P(i, j));
            }
        }
    }
    cout << ans.size() << endl;
    for (int i = 0; i < ans.size(); i++) {
        cout << ans[i].first << ' ' << ans[i].second << endl;
    }
    return 0;
}

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

int main(void){
	string str;
	cin >> str;
	transform(str.begin(), str.end(), str.begin(), ::tolower);
	
	int count=0;
	while(1){
		string tmp;
		cin >> tmp;
		if(tmp=="END_OF_TEXT") break;
		transform(tmp.begin(), tmp.end(), tmp.begin(), ::tolower);
		if(str==tmp) count++;
	}
	cout << count << endl;
	return 0;
}



Measured memory_bytes: 3228
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
struct Card {
	char c; int v;
	Card() :c(0), v(0) {}
	Card(char c, int v) :c(c), v(v) {}
	bool operator==(const Card &p) {
		return c == p.c&&v == p.v;
	}
	bool operator<(const Card &p)const {
		return v < p.v;
	}
};
istream &operator >> (istream &is, Card &p) {
	is >> p.c >> p.v;
	return is;
}
ostream &operator<<(ostream &os, const Card &p) {
	os << p.c << p.v;
	return os;
}
template<typename T>
void bubblesort(vector<T>v) {
	vector<T>w(v);
	for (int i = 0; i < w.size(); i++) {
		for (int j = w.size() - 1; j > i; j--) {
			if (w[j] < w[j - 1])swap(w[j], w[j - 1]);
		}
	}
	rep(i, 0, w.size())cout << w[i] << (i == w.size() - 1 ? '\n' : ' ');
	rep(i,0,w.size()-1)rep(j,i+1,w.size())rep(a,0,w.size()-1)rep(b,a+1,w.size())
		if (w[i] == v[b] && w[j] == v[a] && w[i].v == w[j].v) {
			cout << "Not stable" << endl;
			return;
		}
	cout << "Stable" << endl;
	return;
}
template<typename T>
void selectionsort(vector<T>v) {
	vector<T>w(v);
	rep(i, 0, w.size()) {
		int index = i;
		rep(j, i + 1, w.size())if (w[j] < w[index])index = j;
		swap(w[i], w[index]);
	}
	rep(i, 0, w.size())cout << w[i] << (i == w.size() - 1 ? '\n' : ' ');
	rep(i, 0, w.size() - 1)rep(j, i + 1, w.size())rep(a, 0, w.size() - 1)rep(b, a + 1, w.size())
		if (w[i] == v[b] && w[j] == v[a] && w[i].v == w[j].v) {
			cout << "Not stable" << endl;
			return;
		}
	cout << "Stable" << endl;
	return;
}
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N; cin >> N;
	vector<Card> v(N); rep(i, 0, N) { cin >> v[i]; }
	bubblesort(v);
	selectionsort(v);
	return 0;
}

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

using namespace std;
 
// macro
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define MOD 1000000007
#define M_PI 3.14159265358979323846
#define ll long long
#define ull unsigned long long
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define SORT(ary) sort(begin(ary), end(ary))
#define VL vector<ll>
#define VVL vector<VL>
#define PL pair<ll, ll>
#define VC vector<char>
#define VVC vector<VC>

// Factorial
// need init
ll factorial_memo[5001];
ll factorial(ll n) {
  factorial_memo[0] = 1;
  if(factorial_memo[n] != -1) return factorial_memo[n];
  factorial_memo[n] = (factorial(n-1) * n) % MOD;
  return factorial_memo[n];
}
 
// Combination(nCr)
// need init
ll nCr_memo[5001][5001];
ll nCr(ll n, ll r) {
  if(r*2 > n) r = n-r;
  if(r == 1) return n;
  if(r == 0) return 1;
  if(nCr_memo[n][r] != -1) return nCr_memo[n][r];
  nCr_memo[n][r] = (nCr(n-1, r) + nCr(n-1, r-1)) % MOD;
  return nCr_memo[n][r];
}

ll dfs(VVL& g, vector<PL>& res, ll v, ll& count, ll from, VL& low, VL& pre) {
  pre[v] = count++;
  low[v] = pre[v];
  for(auto to:g[v]) {
    if (pre[to] == -1) {
      low[v] = min(low[v], dfs(g, res, to, count, v, low, pre));
      if(low[to] == pre[to]) res.push_back(make_pair(v, to));
    } else {
      if(from == to) continue;
      low[v] = min(low[v], low[to]);
    }
  }
  return low[v];
}

vector<PL> bridges(VVL& g, ll N) {
  vector<PL> res;
  if (N > 0) {
    VL low(N, -1);
    VL pre(N, -1);
    ll count = 0;
    dfs(g, res, 0, count, -1, low, pre);
  }
  return res;
}

void solve() {
  int H,W;
  cin >> H >> W;
  VVC base(H, VC(W));
  REP(i, H) {
    string str;
    cin >> str;
    REP(j, W) {
      base[i][j] = str.at(j);
    }
  }
  VVC ans(H, VC(W));
  REP(i, H) REP(j, W) {
    if(base[i][j] == '#') ans[i][j] = '#';
    else {
      int cnt = 0;
      FOR(x, -1, 2) FOR(y, -1, 2) {
        if(i+x < 0 || H <= i+x || j+y < 0 || W <= j+y) continue;
        if(base[i+x][j+y] == '#') cnt++;
      }
      ans[i][j] = '0'+cnt;
    }
  }
  REP(i, H) {
    REP(j, W) {
      cout << ans[i][j];
    }
    cout << "\n";
  }
}



int main() {
  // init
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
}

Measured memory_bytes: 256
order = gets.split.map(&:to_i)

def qsort(list)
  return list if list.size <= 1
  
  pivot = list[list.size - 1]
  lesser = []
  greater = []
  list.take(list.size - 1).each do |e|
    if e <= pivot
      lesser.push e
    else
      greater.push e
    end
  end
  return qsort(lesser) + [pivot] + qsort(greater)
end

puts qsort(order).join(' ')



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

void b() {
	auto isPalindrome = [](const std::string s) {
		for (int i = 0, j = s.length() - 1; i <= s.length() / 2; i++, j--) {
			if (s[i] != s[j]) {
				return false;
			}
		}
		return true;
	};
	std::string s;
	std::cin >> s;
	unsigned long n = s.length();
	if (isPalindrome(s) && isPalindrome(std::string(s.begin() + (n + 3) / 2 - 1, s.end())) && isPalindrome(std::string(s.begin(), s.begin() + (n - 1) / 2))) {
		std::cout << "Yes";
	}
	else {
		std::cout << "No";
	}
}

int main() {
  b();
  return 0;
}

Measured memory_bytes: 256
n=int(input())
l=[list(map(int,input().split())) for _ in range(n)]

x,y=0,0
t=0
flag=True

for i in range(n):
    if abs(l[i][1]-x)+abs(l[i][2]-y)<=(l[i][0]-t) and ((l[i][0]-t)-abs(l[i][1]-x)+abs(l[i][2]-y))%2==0:
        x=l[i][1]
        y=l[i][2]
        t=l[i][0]
    else:
        flag=False
if flag:
    print("Yes")
else:
    print("No")
    
    
    
        

Measured memory_bytes: 27300
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(obj) (obj).begin(),(obj).end()
#define debug(x) cerr << #x << ": " << endl
#define rep(i,n) for(int i=0; (i)<(n); ++(i))
#define rrep(i,n) for(int i=(n); (i)>=0; --(i))
#define reps(i,s,n) for(int i=(s); (i)<(n); ++(i))
#define maxi(v) distance(v.begin(), max_element(v.begin(), v.end()))
#define mini(v) distance(v.begin(), min_element(v.begin(), v.end()))
#define maxemt(v) *max_element(v.begin(), v.end())
#define minemt(v) *min_element(v.begin(), v.end())
#define lb(v,x) v[lower_bound(v.begin(), v.end(), x) - v.begin()]
#define ub(v,x) v[upper_bound(v.begin(), v.end(), x) - v.begin()]
template<class T> inline bool print(T& x){ cout << x << endl; return true; }
template<class T> inline bool print_(T& x){ cout << x << " "; return true; }
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; }
/*
ll gcd(ll x, ll y){
  if(y==0) return x;
  else return gcd(y, x%y);
  }
ll lcm(ll x, ll y){
  return x / gcd(x,y) * y;
}*/
const int INF = 1e9;
const ll llINF = 1LL<<60;
const int MOD = 1e9+7;
const double EPS = 1e-9;
int main(){
  int k;  cin >> k;
  int a[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  cout << a[k-1];
  
return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <climits>
#include <string>
#include <stdlib.h>
#include <algorithm>

using namespace std;
 
int ascSort(const void* v1, const void* v2) {
    const int _v1 = *((const int*)v1);
    const int _v2 = *((const int*)v2);
 
    if ( _v1 < _v2 ) {
        return 1;
    } else if ( _v1 > _v2 ) {
        return -1;
    } else {
        return 0;
    }
}

int main() {
	char a,b;
	cin>>a>>b;
	if((a=='H' && b=='H') || (a=='D' && b=='D')){
		cout << "H" << endl;
	}else{
		cout << "D" << endl;
	}
	return 0;
}

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


public class Main{
	
	static class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() 
        { 
            br = new BufferedReader(new
                     InputStreamReader(System.in)); 
        } 
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    }
	
	static class Pair
	{
		int p;
		int q;
		Pair(int p,int q)
		{
			this.p = p;
			this.q = q;
		}
	}
	
	static int gcd(int a,int b)
	{
		if(a == 0) return b;
		if(b == 0) return a;
		
		return gcd(b,a%b);
	}
	
	
	public static void main(String[] args) 
	{
		OutputStream outputStream = System.out;
        FastReader sc = new FastReader();
        PrintWriter out = new PrintWriter(outputStream);
        
        String s = sc.nextLine();
        
        if(s.equals("SUN"))
        {
        	out.println(7);
        }
        else if(s.equals("MON"))
        {
        	out.println(6);
        }
        else if(s.equals("TUE"))
        {
        	out.println(5);
        }
        else if(s.equals("WED"))
        {
        	out.println(4);
        }
        else if(s.equals("THU"))
        {
        	out.println(3);
        }
        else if(s.equals("FRI"))
        {
        	out.println(2);
        }
        else
        {
        	out.println(1);
        }
        out.close();
	}

}


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

ll mod = 1e9+7;

ll gcd(ll a,ll b){
	if(b==0)return a;return gcd(b,a%b);
}
ll expo(ll base,ll pow){
    ll ans = 1;
    while(pow!=0){
        if(pow&1==1){ans = ans*base;}
        base *= base;pow/=2;}return ans;
}
ll inv(ll x){return expo(x,mod-2);}

int vis[123456], col[123456];
int nex[26], prev1[26];

int main(){
    //freopen("ip.txt", "rt", stdin);
    //freopen("op.txt", "wt", stdout);
   string s;
   cin >> s;
   if(s.size() < 4){
      cout << "No";
          return 0;
   }
   string s1 = "YAKI";
   for(int i = 0; i < 4; i++){
       if(s[i] != s1[i]){
          cout << "No";
          return 0;
       }
   }
   cout << "Yes";
}


Measured memory_bytes: 256
while 1:
    try:
        nm = map(int, raw_input().split())
        if nm == [0, 0]:
            break
        n = nm[0]
        m = nm[1]
        p = map(int, raw_input().split())
        p_sorted = sorted(p)
        sum = 0
        for i in range(n):
            if (i+1) % m != 0:
                sum += p_sorted[-1-i]
        print sum
    except:
	pass

Measured memory_bytes: 4316
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdlib>
#include <string>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>
#define endl '\n'
#define ll long long
#define mod 1000000007
#define NCONS 200001
//#define NCONS 100001
#define MCONS 1001
#define LIMIT 1000000000

using namespace std;

int main(void)
{
    cin.tie(NULL); ios_base::sync_with_stdio(false);
    int a, b, c, d, e, k; cin >> a >> b >> c >> d >> e >> k;
    if(e - a > k)
        cout << ":(";
    else
        cout << "Yay!";
    
    return 0;
}


Measured memory_bytes: 256
def read_input():
    h, n = map(int, input().split())
    magic = {}
    for i in range(n):
        a, b = map(int, input().split())
        magic[i] = (a, b)

    return h, n, magic


def submit():
    h, n, magic = read_input()

    dp = [float('inf') for _ in range(h + 1)]
    dp[h] = 0

    for i in reversed(range(1, h + 1)):
        for a, b in magic.values():
            # 更新する
            # max(0, i - a)のHPにより少ない魔力消費量で行き着ければ更新する
            rest = max(0, i - a)
            if dp[rest] > dp[i] + b:
                dp[rest] = dp[i] + b

    print(dp[0])


submit()

Measured memory_bytes: 68900
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int A = Integer.parseInt(sc.next());//int型
		int B = Integer.parseInt(sc.next());//int型
		int T = Integer.parseInt(sc.next());//int型
		sc.close();
		int ans = T/A * B;
		
		System.out.println(ans);
	}

}


Measured memory_bytes: 22740
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define endl '\n'
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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


const ll INF=1e9+7;

int main(){
    ll ans=0;
    string s;
    cin >> s;
    ll len=0;
    rep(i,3){
        if(i==0){
            if(s[i]=='R') len++;
        }
        else{
            if(s[i]=='R') len++;
            else{
                ans=max(ans,len);
                len=0;
            }
        }
    }
    if(len) ans=max(ans,len);
    cout << ans << endl;
    return 0;
}

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

int main() {
	ll a, b;
	cin >> a >> b;
	if ((a + b) % 2 == 1) {
		cout << "IMPOSSIBLE" << endl;
	}
	else {
		cout << (a + b) / 2 << endl;
	}

}

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

#define LL long long

void print(vector<LL>v){
cout<<"**********************"<<endl;
    for(LL x : v){
        cout<<x<<endl;
    }
}

int main(){
    long long n,k,q;
    cin>>n>>k>>q;
    vector<long long>v(n,k-q);
    LL b=0;
    for(LL i=0;i<q;i++){
        int x;
        cin>>x;
        v[x-1]++;
    }
    for(LL x : v){
        if(x<=0) cout<<"No"<<endl;
        else cout<<"Yes"<<endl;
    }
    return 0;
}



Measured memory_bytes: 1408
'use strict';

let lines = require('fs').readFileSync('/dev/stdin', 'utf8').split('\n');
const N = +lines[0];
const as = lines[1].split(' ').sort();

let flags = [0, 0, 0, 0, 0, 0, 0, 0, 0];
for (let i = 0; i < as.length; i++) {
    let aa = as[i];
    if (aa >= 3200) {
        flags[8]++
    } else if (aa >= 2800) {
        flags[7] = 1
    } else if (aa >= 2400) {
        flags[6] = 1
    } else if (aa >= 2000) {
        flags[5] = 1
    } else if (aa >= 1600) {
        flags[4] = 1
    } else if (aa >= 1200) {
        flags[3] = 1
    } else if (aa >= 800) {
        flags[2] = 1
    } else if (aa >= 400) {
        flags[1] = 1
    } else if (aa >= 1) {
        flags[0] = 1
    }
}

let b = flags.reduce((s, aaa) => s + aaa, 0);

console.log((Math.max(b - flags[8], 1))+ ' ' + b);

Measured memory_bytes: 21064
mod = 10 ** 9 + 7

N = int(input())
T = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]

HT = [False] * N
for i in range(1, N):
    if T[i - 1] < T[i]:
        HT[i] = True
HT[0] = True

HA = [False] * N
for i in range(N - 1):
    if A[i] > A[i + 1]:
        HA[i] = True
HA[-1] = True

ans = 1
for i in range(N):
    if HT[i] and HA[i]:
        ans *= 1 if T[i] == A[i] else 0
    elif HT[i]:
        ans *= 1 if T[i] <= A[i] else 0
    elif HA[i]:
        ans *= 1 if T[i] >= A[i] else 0
    else:
        ans = (ans * min(T[i], A[i])) % mod
    if ans == 0:
        break
print(ans)


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

using namespace std;

#define x first
#define y second
#define mp make_pair
#define pb push_back

typedef long long ll;

const ll MOD = 1e9+7;
const ll INF = 1e9+5;

string s;
ll memo[105][5][2];

int dp(int pos, int k, bool ok) {
	if (k<0) return 0;
	if (pos == s.size()) {
		if (k == 0) return 1;
		return 0;
	}
	if (memo[pos][k][ok] != -1) return memo[pos][k][ok];
	ll sol = 0;
	for (char i='0' ; i<='9' ; i++) {
		if (ok) {
			sol += dp(pos+1, k-(i>'0'), 1);
		} else {
			if (i>s[pos]) break;
			sol += dp(pos+1, k-(i>'0'), i<s[pos]);
		}
	}
	return memo[pos][k][ok] = sol;
}

int main() {
	memset(memo, -1, sizeof memo);
	int k;
	cin >>s>>k;
	cout <<dp(0, k, 0)<<endl;
	return 0;
}

Measured memory_bytes: 256
#pragma region
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = n; i > 0; i--)
#define repc(i, m, n) for (int i = m; i < n; i++)
#define reprc(i, m, n) for (int i = m; i > n; i--)
#define all(v) v.begin(), v.end
#define INF 1e9
#define EPS 1e-10
using namespace std;
typedef long long ll;
#pragma endregion

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

    cout << 2 * R * 3.14159265358979 << endl;
}

Measured memory_bytes: 3772
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")

using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(int i=num, i##_len=(n); i<i##_len; ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define print(x) (cout << (x) << endl)
#define pb push_back
#define mp make_pair
#define sz(x) int(x.size())
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
#define fs first
#define sc second
template<typename T> vector<T> make_vec(size_t n, T a) { return vector<T>(n, a); }
template<typename... Ts> auto make_vec(size_t n, Ts... ts) { return vector<decltype(make_vec(ts...))>(n, make_vec(ts...)); }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << ' '; return os; }
// 多倍長
#include <boost/rational.hpp>
#include <boost/multiprecision/cpp_int.hpp>
using boost::rational;
using boost::multiprecision::cpp_int;

const double PI = acos(-1);
const int INF = 1e9;
const ll LLINF = 1e16;
const ll MOD = 1e9+7;
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

 

// 指定した文字cが文字列に何文字入ってるか
ll stringcount(string s, char c) {
    return count(s.cbegin(), s.cend(), c);
}


// 割り算の切り上げ処理
template<typename T>
T rp(T a, T b) {
  return (a + b - 1) / b;
}

// 桁和
template<typename T>
T digsum(T n) {
    T res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

// 回文判定
bool kai (string s) {
    string t{s};
    reverse(begin(t), end(t));
    return s == t;
}

using pint = pair<int, int>;
using pll = pair<ll, ll>;


vector<string> split(const string &s, char delim) {
    vector<string> elems;
    string item;
    for (char ch: s) {
        if (ch == delim) {
            if (!item.empty())
                elems.push_back(item);
            item.clear();
        }
        else {
            item += ch;
        }
    }
    if (!item.empty())
        elems.push_back(item);
    return elems;
}



int main(void)
{
    cout.tie(0);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    ll ans = 0;
    rep(i, n - 1){
        if(a[i + 1] < a[i]){
            ans += a[i] - a[i + 1];
            a[i + 1] += a[i] - a[i + 1];
        }
    }
    print(ans);


}



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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

int main()
{
    ll i,j;
    ll n;
    cin >> n;
    vector<ll> a(n);
    for(i = 0;i < n;++i){
        cin >> a.at(i);
    }
    const ll MOD = 1e9 + 7;
    vector<ll> color(3,0);
    ll ans = 1;
    for(i = 0;i < n;++i){
        vector<ll> ichi;
        rep(j,3){
            if(color.at(j) == a.at(i)) ichi.push_back(j);
        }
        if(ichi.size() == 0){
            cout << 0 << endl;
            return 0;
        }else if(ichi.size() == 3){
            ++color.at(2);
            ans *= 3;
        }else if(ichi.size() == 2){
            ++color.at(1);
            ans *= 2;
        }else if(ichi.size() == 1){
            auto x = lower_bound(all(color), a.at(i));
            ++*x;
        }
        sort(all(color));
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
import collections
from itertools import combinations

n = int(input())
li = map(int,input().split())

c = collections.Counter(li)

clist = list(c.keys())
var = len(clist)

ll = combinations(clist,3)

cnt = 0

for i,j,k in list(ll):
    if (i+j>k) and (i+k>j) and (j+k>i):
        cnt += 1*c[i]*c[j]*c[k]
print(cnt)

Measured memory_bytes: 20876
// inputに入力データ全体が入る
function Main(input) {
	var line = input.split("\n");
	var tmp = line[0].split(" ");
	var maxint = Number(tmp[0]);
	var minrest = Number(tmp[1]);
	var ans = 0;
	for(b = minrest + 1; b <= maxint; b++){
		var outsideLoop = (minrest === 0) ? maxint%b : (maxint%b-minrest+1);
		ans += (b-minrest)*Math.floor(maxint/b) + ((outsideLoop > 0) ? outsideLoop : 0);
	}
	console.log(ans);
}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7628
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            StringBuilder sb = new StringBuilder();

            int MAX = 104729;
            int sqrtMAX = (int)Math.Sqrt(MAX);

            int[] isPrime = Enumerable.Range(0, MAX + 1).ToArray();
            isPrime[0] = isPrime[1] = -1;

            for (int i = 0; i < sqrtMAX; i++)
            {
                if (isPrime[i] != -1)
                {
                    for (int j = i * i; j <= MAX; j += i)
                    {
                        isPrime[j] = -1;
                    }
                }
            }

            var primes = isPrime.Where(p => p != -1).ToArray();

            while (true)
            {
                int n = int.Parse(Console.ReadLine());

                if (n == 0) break;

                int sum = 0;

                for (int i = 0; i < n; i++) sum += primes[i];

                sb.AppendLine(sum.ToString());
            }
            Console.Write(sb);
        }
    }
}

Measured memory_bytes: 10780
#include <iostream>

using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;

    int a[110];
    int total = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        total += a[i];
    }

    double min = total / 4. / m;

    int cnt = 0;

    for (int i = 0; i < n; i++)
    {
        if (a[i] >= min)
        {
            cnt++;
        }
    }

    if(cnt >= m) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MAXN 100000
#define MAXLOG 10
#define eps 1e-2
#define pii pair<int,int>
#define MP(a,b) make_pair(a,b)
#define lowbit(x) ((x)&(-(x)))

using namespace std;
void get(int &v)
{
	char c;
	while((c=getchar())!=EOF&&isdigit(c)==0);
	v=c-'0';
	while((c=getchar())!=EOF&&isdigit(c))
		v=(v<<1)+(v<<3)+c-'0';
	return ;
}
int get()
{
    int v;
	char c;
	while((c=getchar())!=EOF&&isdigit(c)==0);
	v=c-'0';
	while((c=getchar())!=EOF&&isdigit(c))
		v=(v<<1)+(v<<3)+c-'0';
	return v;
}
int vis[MAXN+80];
int main()
{
	int n,x,i;
	get(n);
	for(i=1;i<=n;i++)
	{
		get(x);
		if(x>0)vis[x-1]++;
		vis[x]++;
		vis[x+1]++;
	}
	for(i=1;i<=MAXN;i++)
		vis[0]=max(vis[0],vis[i]);
	printf("%d",vis[0]);
	return 0;
}

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

int main(){

	const int N = 1e6 + 5;
	vector<ll> arr(N, false);

	for(int i= 2; i <= 1e6; i++){
		if(arr[i])
			continue;
		for(int j = 2*i; j <= 1e6; j += i){
			arr[j] = i;
		}
	}
	arr[1] = 1;
	for(int i = 2; i <= 1e6; i++){
		if(!arr[i])
			arr[i] = i;
	} 

	ll n;
	cin >> n;

	ll ans = 1;
	for(ll i = 2; i < n; i++){
		ll temp = i;
		map<ll,ll> m;
		while(temp > 1){
			m[arr[temp]]++;
			temp /= arr[temp];
		}

		ll prod = 1;
		for(auto p : m){
			prod *= (p.second+1);
		}
		ans += prod;
	}
	cout << ans << "\n";
}

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

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

    vector<int> A(c, 0);

    int count = 0;

    for(int i = 1; i <= c; i++) {
        if(c % i == 0 && i >= a && i <= b) {
            count++;
        }
    }

    cout << count << endl;
}


Measured memory_bytes: 3124
#include <iostream>
#include <vector>
#include <array>
#include <algorithm>
#include <cstring>
#include <queue>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cstdlib>
#include <sstream>
#include <bitset>

using namespace std;

using ll = long long;
using Vec = vector<ll>;
using P = pair<ll, ll>;
using VecP = vector<P>;
#define rep(i, n) for(ll i=0;i<(n);i++)
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))

//static const ll MOD = 1000000007;
//static const ll INF = 1000000000;
//#define PI 3.14159265359

int main() {
    // input
    ll N;
    cin >> N;
    ll AC = 0, WA = 0, TLE = 0, RE = 0;
    rep(i, N) {
        string S;
        cin >> S;
        if (S == "AC") {
            AC++;
        } else if (S == "WA") {
            WA++;
        } else if (S == "TLE") {
            TLE++;
        } else if (S == "RE") {
            RE++;
        }
    }

    //process
    cout << "AC x " << AC << endl;
    cout << "WA x " << WA << endl;
    cout << "TLE x " << TLE << endl;
    cout << "RE x " << RE << endl;

    return 0;
}


Measured memory_bytes: 3220
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<time.h>
#include<math.h>
#define MAX 50
const int nil=-1;
struct node
{
	int parent;
	int left;
	int right;
};
struct node tree[MAX];
int n;
void input()
{
	int i,j,id,c;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		tree[i].parent=nil;
		tree[i].left=nil;
		tree[i].right=nil;
	}
	for(i=1;i<=n;i++)
	{
		scanf("%d",&id);
		for(j=1;j<=2;j++)
		{
			scanf("%d",&c);
			if(j==1)
				tree[id].left=c;
			else
				tree[id].right=c;
			tree[c].parent=id;
		}
	}
	return;
}
void pre(int u)
{
	if(u==nil)
		return;
	printf(" %d",u);
	pre(tree[u].left);
	pre(tree[u].right);
	return;
}
void in(int u)
{
	if(u==nil)
		return;
	in(tree[u].left);
	printf(" %d",u);
	in(tree[u].right);
	return;
}
void post(int u)
{
	if(u==nil)
		return;
	post(tree[u].left);
	post(tree[u].right);
	printf(" %d",u);
	return;
}
int main()
{
	input();

	int i,root;
	for(i=0;i<n;i++)
		if(tree[i].parent==nil)
			root=i;

	printf("Preorder\n");
	pre(root);

	printf("\nInorder\n");
	in(root);

	printf("\nPostorder\n");
	post(root);
	printf("\n");

	return 0;
}


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 

#define ll long long
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define pu push
#define pp pop_back
#define in insert
#define ld long double
#define forn(low,high,i) for(i = low;i < high;i++)
#define forrev(high,low,i) for(i = high; i >= low;i--)
#define all(v) v.begin(),v.end()
#define sz(v) (int)v.size()
#define line cout << __LINE__;
#define prv(a) for(auto x : a) cout << x << ' ';cout << '\n';
#define prvp(a) for(auto x : a) cout << "{" << x.ff << ',' << x.ss << "}";cout << '\n';
#define decimal_digits cout << fixed << setprecision(15);
string to_string(string s) { return '"' + s + '"';}
string to_string(char s) { return string(1, s);}
string to_string(const char* s) { return to_string((string) s);}
string to_string(bool b) { return (b ? "true" : "false");}
template <typename A> string to_string(A);
template <typename A, typename B>string to_string(pair<A, B> p) {return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}
template <typename A> string to_string(A v) {bool f = 1; string r = "{"; for (const auto &x : v) {if (!f)r += ", "; f = 0; r += to_string(x);} return r + "}";}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {cerr << " " << to_string(H); debug_out(T...);}
#define pr(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

typedef unordered_map<int,int> umi;
typedef unordered_map<ll,ll> uml;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

const int inf = 1e9;
const ll INF = 1e18;
const int mod = 1e9 + 7;
const int bit32 = log2(inf) + 3;
const int bit64 = log2(INF) + 3;

inline int add(int a, int b){a += b; if(a >= mod) a -= mod; return a;}
inline int sub(int a, int b){a -= b; if(a < 0) a += mod; return a;}
inline int mul(int a, int b){return (int)((long long) a * b % mod);}
inline int modexpo(int a, int b){int res = 1; while(b > 0){ if(b & 1) res = mul(res, a); a = mul(a, a); b /= 2;} return res;}
inline int divide(int a, int b){ return mul(a, modexpo(b, mod - 2));}

clock_t time_p = clock();

void ktj(){
  time_p = clock() - time_p;
  cerr << "Time elapsed : " << (float)(time_p)/CLOCKS_PER_SEC << "\n";
}

void pre(){ // Reset each global variable (esp. for graphs)
  
}

void solve(){
  int a, b;
  cin >> a >> b;
  if(a < b){
    for(int i = 1; i <= b; i++){
      cout << a;
    }
    cout << '\n';
  }else{
    for(int i = 1; i <= a; i++){
      cout << b;
    }
    cout << '\n';
  }
}

int main(){
  fastio

  pre();

  int t = 1;
  // cin >> t;
  while(t--){
    solve();
  }

  ktj();
}


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

int main()
{
	int n;
	double d;
	vector<pair<int, int>> points;
	scanf("%d%lf", &n, &d);
	int cnt = 0;
	while(n--) {
		double x, y;
		scanf("%lf%lf", &x, &y);
		if(sqrt(x*x+y*y) <= d) cnt++;
	}
	printf("%d\n", cnt);
}

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

Measured memory_bytes: 600
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<(n);i++)
#define rep2(i,a,n) for(int i=a;i<n;i++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INFL = 1e18;
const int INF = 1001001001; 
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
const int mod =1000000007;
const double PI = acos(-1);
int main(){
	ll n;cin>>n;
	vl a(n+1);
	rep(i,n+1)cin>>a[i];
	if(a[n]==0){
		cout<<-1<<endl;
		return 0;
	}
	vl u(n+1,INFL);
	u[0]=1;
	int me =0;
	rep(i,n+1){
		if(i==0)continue;
		u[i]=(u[i-1]-a[i-1])*2;
		if(u[i]<=0){
			cout<<-1<<endl;
			return 0;
		}
		if(u[i]>INFL){
			break;
		}
		if(u[i-1]>u[i])me=i;
	}
	reverse(been(a));
	vl b(n+1);
	b[0]=a[0];
	rep(i,n+1){
		if(i==0)continue;
		b[i]=b[i-1]+a[i];
	}
	reverse(been(b));
	ll cnt =INFL;
	rep2(i,me,n+1){
		if(u[i]==INFL){
			cout<<-1<<endl;
			return 0;
		}
		if(u[i]>=b[i]){
			cnt=i;
			break;
		}
	}
	if(cnt==INFL){
		cout<<-1<<endl;
		return 0;
	}
	ll ans =0;
	rep(i,n+1){
		if(i<cnt)ans+=u[i];
		else
		{
			ans+=b[i];
		}
		
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 5636
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <algorithm>
#include<math.h>
#include <cmath>
#include<iomanip>
using namespace std;
int main(){
    double a, b, C;cin >> a >> b >> C;
    double rad = M_PI /180 *C;
    
    double S = a * b * sin(rad)/ 2;
    double L = sqrt(a * a + b * b -2*a*b*cos(rad)) + a + b;
    double h = 2 * S / a;
    cout << fixed << setprecision(12) << S << endl;
    cout << L << endl;
    cout << h << endl;
        return 0;
    }
            

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

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
#define dump(x) cout << #x << " = " << (x) << endl
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

template<class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}
 
template<class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
	os<<"{";
	rep(i, v.size()) {
		if (i) os<<",";
		os<<v[i];
	}
	os<<"}";
	return os;
}

const int maxn = 10;

ll d[maxn][maxn];

int main() {
	vector<ll> dp(maxn);
	dp[0] = 1;
	dp[1] = 2;

	for (int i = 2; i < maxn; ++i) {
		set<ll> st;
		rep(j, i) rep(k, j) {
			st.insert(dp[k] + dp[j]);
		}

		ll c = dp[i-1] + 1;
		while (true) {
			bool ok = true;
			rep(j, i) {
				if (st.count(c + dp[j]) || st.count(c)) {
					ok = false; break;
				}
			}
			if (ok) {
				break;
			}
			c++;
		}
		dp[i] = c;
	}

	//cout << dp << endl;

	int N; cin >> N;

	d[0][1] = d[1][0] = 1;

	for (int i = 2; i < N; ++i) {
		ll c = 0;
		vi pm;
		rep(j, i) pm.pb(j);
		vector<ll> cst;

		do {
			ll s = 0;
			rep(j, (int)pm.size()-1) {
				s += d[pm[j]][pm[j+1]];
			}
			cst.pb(s);
			c = max(c, s);
		} while (next_permutation(ALL(pm)));
		++c;
		//dump(cst);
		//sort(ALL(cst));
		//cst.erase(unique(ALL(cst)), cst.end());
		//dump(cst.size());
		//cerr << i << " " << c << endl;

		rep(j, i) d[j][i] = d[i][j] = c * dp[j];
	}

	rep(i, N) {
		rep(j, N) {
			printf("%lld%c", d[i][j], j == N-1 ? '\n' : ' ');
		}
	}

	return 0;
}

Measured memory_bytes: 5688
#include<bits/stdc++.h>
using namespace std;
const int N=300005,m=300001;
int n,k,a[N],tr[N<<2],ans;
void update(int k,int l,int r,int x,int v)
{
	if(l==r)
	{
		tr[k]=v;
		return;
	}
	int mid=l+r>>1;
	if(x<=mid) update(k<<1,l,mid,x,v);
	else update(k<<1|1,mid+1,r,x,v);
	tr[k]=max(tr[k<<1],tr[k<<1|1]);
}
int query(int k,int l,int r,int a,int b)
{
	if(l==a&&r==b)
		return tr[k];
	int mid=l+r>>1;
	if(b<=mid) return query(k<<1,l,mid,a,b);
	else if(a>mid) return query(k<<1|1,mid+1,r,a,b);
	else return max(query(k<<1,l,mid,a,mid),query(k<<1|1,mid+1,r,mid+1,b));
}
int main()
{
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		int l=max(0,a[i]-k),r=min(m-1,a[i]+k);
		int v=query(1,1,m,l+1,r+1)+1;
		ans=max(ans,v);
		update(1,1,m,a[i]+1,v);
	}
	printf("%d\n",ans);
	return 0;
}


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


int main(){

  int n,a,b,c,d,count;

  while(cin >> n){
    count = 0;
    for(a = 0; a < 10 ; a++){
      for(b = 0 ; b < 10 ; b++){
	for(c = 0 ; c < 10 ; c++){
	  for(d = 0 ; d < 10 ; d++){
	    if(a + b + c + d == n ){
	      count++;
	    }
	  }
	}
      }
    }
    cout << count << endl;
  }
  return 0;


}

Measured memory_bytes: 1160
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define dump(x) cerr << #x << " = " << (x) << endl;
typedef long long LL;
typedef vector<int> VI;
typedef vector<long long> VL;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = (int)1e9;
const long long mod = (long long)1e9 + 7;
const double pi = acos(-1.0);

//最大公約数
long long gcd(long long n, long long m) {
	return m == 0 ? n : gcd(m, n % m);
}
//最小公倍数
long long lcm(long long n, long long m) {
	return n / gcd(n, m) * m;
}
int main() {
	int n; cin >> n;
	VI a(n); rep(i, n)cin >> a[i];

	VI g1(n); g1[0] = 0;
	FOR(i, 1, n)g1[i] = gcd(g1[i - 1], a[i - 1]);
	VI g2(n); g2[0] = 0;
	FOR(i, 1, n)g2[i] = gcd(g2[i - 1], a[n - i]);

	int ans = 0;
	rep(i, n)ans = max<int>(ans, gcd(g1[i], g2[n - i - 1]));
	Cout(ans);
}

Measured memory_bytes: 1408
#include<stdio.h>
int isprime(int);

int main(){
  int n,x,i,c=0;
  scanf("%d",&n);
  for(i = 0;i < n;i++){
    scanf("%d",&x);
    if(isprime(x)){
      c++;
    }
  }
  printf("%d\n",c);
  return 0;
}

int isprime(int x){
  int i;
  if(x<2){
    return 0;
  }
  else if(x == 2){
    return 1;//2 is prime number
  }
  if(x%2 == 0){
    return 0;//not prime number
  }
  for(i = 3;i*i <= x;i++){//i???x??????????????\?????????
    if(x%i == 0){
      return 0;
    }
  }
  return 1;
}

Measured memory_bytes: 596
#ABC112
    
n,t = list(map(int,input().split()))
c = [list(map(int,input().split())) for _ in range(n)]
m = 1001
for i in range(n):
    if c[i][1] <= t and m > c[i][0]:
        m = c[i][0]
        
print(m) if m != 1001 else print("TLE")






Measured memory_bytes: 3060
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1

def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, K, H):
    H.sort()
    for _ in range(K):
        if H:
            H.pop()
    return sum(H)


def main():
    N, K = read_int_n()
    H = read_int_n()
    print(slv(N, K, H))


if __name__ == '__main__':
    main()


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

string str;

int main( void ) {
    
    cin >> str;
    
    int ans = 0; char chr = str[0];
    for( char ch : str ) {
        if( chr != ch ) {
            chr = ch;
            ans ++;
        }
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include<string>
#include<cmath>
#include<ciso646>
#include<cstring>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<utility>
#include<map>
#include<math.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
using ll = long long;
ll Max = 10 + 1e12;
int N = 5 + 1e5;


int main()
{
	int n; cin >> n;
	vector<int> aa(n);
	int cnt = 0;
	rep(i, n) {
		cin >> aa[i];
		if ((i+1) % 2 == 1 and aa[i] % 2 == 1)
			cnt++;
	}
	cout << cnt;
}

Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;

int main(){
	int n,ans=0,t,bef=1000;
	vector <int> a,c;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>t;
		a.push_back(t);
	}
	for(int i=0;i<n;i++){
		cin>>t;
		ans+=t;
	}
	for(int i=0;i<n-1;i++){
		cin>>t;
		c.push_back(t);
	}
	for(int i=0;i<n;i++){
		if(a[i]==bef+1){
			ans+=c[a[i]-2];
		}
		bef=a[i];
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
#import pdb;pdb.set_trace()
    
if False:
    fh = open('vol2_0201.txt', 'r')
else:
    fh = sys.stdin
    
def input():
    return(fh.readline())

def tot(item, pr, rec):
    if item in rec:
        ret = min(pr[item], sum([tot(p,pr,rec) for p in rec[item]]))
    else:
        ret = pr[item]

    return(ret)
        
while True:
    pr={}
    rec={}
    n = int(input())
    if n==0:
        break
    for _ in range(n):
        v = input().strip().split()
        pr[v[0]] = int(v[1])
    m = int(input())
    for _ in range(m):
        v = input().strip().split()
        rec[v[0]] = v[2:]

    item=input().strip()
    #sys.exit()
    print(tot(item, pr, rec))



Measured memory_bytes: 5628
// 完全に問題勘違いしてた、そりゃWAでるに決まってる…
#include <bits/stdc++.h>
using namespace std;

int main() {
  int n;
  cin >> n;
  for (int i = n; i < 1000; i++) {
    if (i % 111 == 0) {
      cout << i << endl;
      break;
    }
  }
}

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

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
//typedef tuple<int, int, int> T;
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++)
#define REP(i,x) FOR(i,0,x)
#define ALL(c) c.begin(), c.end()
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = {0, 1, 0, -1};

int main() {
  // use scanf in CodeForces!
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int N, K; std::cin >> N >> K;
  vector<int> A(N + 1, 0); REP(i, N) cin >> A[i];

  REP(_, K) {
    bool flag = true;
    vector<int> next_A(N + 1, 0);
    REP(i, N) {
      next_A[max(0, i - A[i])] += 1;
      next_A[min(N, i + A[i] + 1)] -= 1;
    }

    REP(i, N) {
      next_A[i+1] += next_A[i];
      if (next_A[i] < N) flag = false;
    }
    A = next_A;
    if (flag) break;
  }
  REP(i, N) {
    if (i > 0) std::cout << ' ';
    std::cout << A[i];
  }
  std::cout << '\n';
  return 0;
}

Measured memory_bytes: 4940