akhauriyash/Code-Regression huggingface dataset:
#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;
using namespace std;

ll INF = 1LL << 60;

class SegmentTree{
public:
  int N;
  vector<ll> node;

  //コンストラクタ
  SegmentTree(vector<ll> v){
    int sz = v.size();
    N = 1;
    while(N < sz) N *= 2;
    node.resize(2 * N - 1, INF);

    for(int i = 0; i < sz; i++){
      int k = i + N - 1;
      node[k] = v[i];
      while(k > 0){
        k = (k - 1) / 2;
        node[k] = min(node[k * 2 + 1], node[k * 2 + 2]);
      }
    }
  }

  //k番目の値(0_indexed)をaに変更
  void update(int k, ll a){
    //葉の節点
    k += N - 1;
    node[k] = a;
    //登りながら更新
    while(k > 0){
      k = (k - 1) / 2;
      node[k] = min(node[k * 2 + 1], node[k * 2 + 2]);
    }
  }

  //[a,b)の最小値
  ll query(int a, int b){
    return Query(a, b, 0, 0, N);
  }

  ll Query(int a, int b, int k, int l, int r){
    if(r <= a || b <= l) return INF;
    if(a <= l && r <= b) return node[k];
    else{
      ll v1 = Query(a, b, k * 2 + 1, l, (l + r) / 2);
      ll v2 = Query(a, b, k * 2 + 2, (l + r) / 2, r);
      return min(v1, v2);
    }
  }

  void print(){
    for(int i = 0; i < 2 * N - 1; i++){
      cout << "node[" << i << "] " << node[i] << endl;
    }
  }
};


/////////////////////////////////////////////////////////////////
#define fs first
#define sc second

struct edge{
    int l, r;
    ll c;
};

bool cmp(const edge &a, const edge &b){
    return a.r < b.r;
}

int main(){
    int N, M;
    cin >> N >> M;
    edge p[M];
    for(int i = 0; i < M; i++){
        cin >> p[i].l >> p[i].r >> p[i].c;
    }

    sort(p, p + M, cmp);

    /*for(int i = 0; i < M; i++){
        printf("%d %d %d\n", p[i].l, p[i].r, p[i].c);
    }*/

    SegmentTree sg = SegmentTree(vector<ll>(N, INF));
    sg.update(0, 0);

    for(int i = 0; i < M; i++){
        ll mn = sg.query(p[i].l - 1, p[i].r - 1);
        ll nxt = min(sg.query(p[i].r - 1, p[i].r), mn + p[i].c);
        sg.update(p[i].r - 1, nxt);
    }

    ll ans = sg.query(N - 1, N);

    if(ans == INF) ans = -1;

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


Measured memory_bytes: 4608
#include <bits/stdc++.h>
using namespace std;
using vi=vector<int>;
using ll=long long;
int main() {
    int N,M; cin>>N>>M;
    priority_queue<int> q;
    for (int i = 0; i < N; i++){
        int A; cin>>A;
        q.push(A);
    }
    for (int i = 0; i < M; i++){
        if(q.size()){
            int tmp=q.top();
            q.pop();
            if(tmp/2!=0)q.push(tmp/2);
        }else break;
    }
    ll ans=0;
    while(q.size()){
        ans+=q.top();
        q.pop();
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3916
#include<iostream>
using namespace std;
int main(){
 int m,n,f=0;
 char a[51][51],b[51][51];
 cin>>n>>m;
 for(int i=0;i<n;i++)
  for(int j=0;j<n;j++)cin>>a[i][j];
 for(int i=0;i<m;i++)
  for(int j=0;j<m;j++)cin>>b[i][j];
                
 for(int i=0;i<n;i++){/*bの左上と一致する場所を調べる*/
  if(f==1)break;
  for(int j=0;j<n;j++){
   if(f==1)break;
   if(a[i][j]==b[0][0]){/*一致した*/
    int f2=0;
    if(i+m<=n&&j+m<=n)
     for(int l=0;l<m;l++){/*ｂの画像と一致するかどうか*/
      if(f2==1)break;
      for(int k=0;k<m;k++)
       if(a[i+l][j+k]==b[l][k])f=1;
       else if(a[i+l][j+k]!=b[l][k]){f=0;f2=1;break;}
      }
    }
  }
 }   
 if(f==1)cout<<"Yes"<<endl;
 else cout<<"No"<<endl;
 return 0;
}


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, M;
  cin >> N >> M;
  vector<vector<int>> G(N);
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    G[a].emplace_back(b);
    G[b].emplace_back(a);
  }
  vector<int> res(N, -1);
  res[0] = 0;
  queue<int> que;
  que.push(0);
  while (!que.empty()) {
    int u = que.front();
    que.pop();
    for (int v : G[u]) {
      if (res[v] == -1) {
        res[v] = u;
        que.push(v);
      }
    }
  }
  if (*min_element(res.begin(), res.end()) == -1) {
    cout << "No" << '\n';
  } else {
    cout << "Yes" << '\n';
    for (int i = 1; i < N; i++) {
      cout << res[i] + 1 << '\n';
    }
  }
  return 0;
}


Measured memory_bytes: 10152
//import java.io.File;
//import java.util.Scanner;
import java.util.Stack;

class Main{
  public static void main(String[] args) throws Exception{
    //Scanner scan = new Scanner(new File("in.txt"));
    //Scanner scan = new Scanner(System.in);
    MyScanner scan = new MyScanner();

    int input1 = scan.nextInt();
    Stack<Integer> st = new Stack<>();
    int stc = 0;
    int answer = 0;

    for(int incount = 0; incount < input1; incount++) {
      int input2 = scan.nextInt();
      boolean flag = true;

      while(!st.isEmpty() && st.peek() > input2) {
        st.pop();
        answer++;
        stc--;
      }
      if(!st.isEmpty() && st.peek() < input2) {
        st.push(input2);
        stc++;
      }
      if(st.isEmpty()) {
        stc++;
        st.push(input2);
      }

      /*
      for(int j = 0; j < ite; j++) {
        System.out.print(arr[j]+",");
      }
      System.out.println(" answer -> "+answer);
      */
    }
    System.out.println(answer+stc);
  }
}

class MyScanner{
  StringBuilder sb;
  MyScanner() {sb = new StringBuilder();}

  int nextInt() throws Exception{
    sb.delete(0,2147483647);
    while(true) {
      int c = System.in.read();
      //System.out.println("c:"+c);
      if(c == ' ' || c == '\n' || c == '\r' || c < 16) {
        //System.out.println("return");
        return Integer.parseInt(sb.toString());
      }
      sb.appendCodePoint(c);
      //System.out.println(sb.toString());
    }
  }
}

Measured memory_bytes: 40760
import std.stdio, std.string, std.conv, std.range, std.algorithm;

void main() {
    auto S = readln.split.to!(int[]);
    auto N = S[0], Ma = S[1], Mb = S[2];
    auto data = new int[3][N];
    foreach (i; 0..N) {
        data[i] = readln.split.to!(int[]);
    }
    auto dp = new int[401][401][41];
    foreach (i; 0..41) {
        foreach (j; 0..401) {
            foreach (k; 0..401) {
                dp[i][j][k] = 114514;
            }
        }
    }
    dp[0][0][0] = 0;
    foreach (i; 1..N+1) {
        auto a = data[i-1][0];
        auto b = data[i-1][1];
        auto c = data[i-1][2];
        foreach (ca; 0..401) {
            foreach (cb; 0..401) {
                if (dp[i-1][ca][cb] == 114514) continue;
                dp[i][ca][cb] = min(dp[i-1][ca][cb], dp[i][ca][cb]);
                dp[i][ca+a][cb+b] = min(dp[i-1][ca][cb] + c, dp[i][ca+a][cb+b]);
            }
        }
    }
    auto res = 114514;
    foreach (ca; 1..401) {
        foreach (cb; 1..401) {
            if (ca * Mb == cb * Ma) res = min(res, dp[N][ca][cb]);
        }
    }
    if (res == 114514) res = -1;
    writeln(res);
}

Measured memory_bytes: 26108
N = int(input())
nap = [1]
X = [0 for i in range(10000)]
nap.extend(X)

for i in range(N):
	s = int(input())
	for j in range(1,10002):
		if nap[-j] == 1:
			nap[-j + s] = 1

ans = 0
for i in range(10001):
	if nap[i] == 1:
		if i % 10 != 0:
			ans = i

print(ans)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define s second
#define int long long
#define ll long long
#define ull unsigned long long
#define mp make_pair
#define pb push_back

using namespace std;
const int N = 1e6 + 7;
const int INF = 1e9 + 7;
const int LOG = 20;
ll n,a[N],cnt,ans;
main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    for(int i = 0; i<n; i++)
    {
        cin >> a[i];
    }
    for(int i = 0; i<n-1; i++)
    {
        if(a[i] >= a[i+1])
        {
            //cout << i << ' ' << i+1 << endl;
            ans++;
        }
        else
        {
            cnt = max(cnt,ans);
            ans = 0;
        }
    }
    cnt = max(cnt,ans);
    cout << cnt;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>
#include <stdlib.h>
#include <string.h>

typedef unsigned long long int uint64;
typedef long long int          int64;
 
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

void get_N (int64 *n)
{
  int cnt;
  
  cnt = scanf("%lld", n);

  return;
}

void get_NK (int64 *n, int64 *k)
{
  int cnt;
  
  cnt = scanf("%lld %lld", n, k);

  return;
}

void get_N1234 (int64 *n1, int64 *n2, int64 *n3, int64 *n4)
{
  int cnt;

  if (n2 == NULL) {
    cnt = scanf("%lld", n1);
    return;
  }
  if (n3 == NULL) {
    cnt = scanf("%lld %lld", n1, n2);
    return;
  }
  if (n4 == NULL) {
    cnt = scanf("%lld %lld %lld", n1, n2, n3);
    return;
  }
  cnt = scanf("%lld %lld %lld %lld", n1, n2, n3, n4);
  return;
}

void omit_LF (void)
{
  char c;
  int  cnt;
  
  cnt = scanf("%c", &c);
  return;
}

char *get_S (int64 n)
{
  char *buf;
  int  i;
  int  cnt;

  buf = (char *)malloc((size_t)(n * sizeof(char)));
  if (buf == NULL) {
    return NULL;
  }

  cnt = scanf("%s", buf);

  return buf;
}

char *get_SN (int64 max, int64 *size)
{
  char *buf;
  int  i;
  int  n;
  int  cnt;

  buf = (char *)malloc((size_t)(max * sizeof(char)));
  if (buf == NULL) {
    return NULL;
  }

  cnt = scanf("%s", buf);

  n = strlen(buf);

  *size = n;
  
  return buf;
}

int64 *get_NSeq (int64 n)
{
  int64 *buf;
  int64 i;

  buf = (int64 *)malloc((size_t)(n * sizeof(int64)));
  for (i=0; i<n; i++) {
    get_N(&buf[i]);
  }

  return buf;
}

typedef struct _tmp_t {
  int64    a;
  int64    b;
} tmp_t;

typedef int64 simple_t;

int compare_simple(const void *a, const void *b)
{
  simple_t *x;
  simple_t *y;

  x = (simple_t *)a;
  y = (simple_t *)b;

  if (x > y) return 1;
  if (y < x) return -1;

  return 0;
}
void qsort_simple (simple_t *array, int size)
{
  qsort(array, size, sizeof(simple_t), compare_simple);
}

int compare_a(const void *a, const void *b)
{
  tmp_t *x;
  tmp_t *y;

  x = (tmp_t *)a;
  y = (tmp_t *)b;

  if (x->a > y->a) return 1;
  if (x->a < y->a) return -1;

  return 0;
}

int compare_b(const void *a, const void *b)
{
  tmp_t *x;
  tmp_t *y;

  x = (tmp_t *)a;
  y = (tmp_t *)b;

  if (x->b > y->b) return 1;
  if (x->b < y->b) return -1;

  return 0;
}

void qsort_a (tmp_t *array, int size)
{
  qsort(array, size, sizeof(tmp_t), compare_a);
}

void qsort_b (tmp_t *array, int size)
{
  qsort(array, size, sizeof(tmp_t), compare_b);
}


int resolve1()
{
  int64 R;
  double pi=3.14159;
  double L;

  get_N(&R);

  L = pi*R*2;

  printf("%lf", L);
  return 0;
}

int resolve2()
{
  int64 N,M;
  int64 *A;
  int64 i;
  int64 total = 0;
  int64 play=0;
  
  get_NK(&N, &M);
  A = get_NSeq(M);

  for (i=0; i < M; i++) {
    total += A[i];
  }

  if (N >= total) {
    play = N - total;
  } else {
    printf("-1");
    return 0;
  }

  printf("%lld",play);
  return 0;
}


int main()
{
  char c;

  scanf("%c", &c);

  if ((c >= 'a') && ('z' >= c)) {
    printf("a");
  } else {
    printf("A");
  }

  return 0;
}



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

#define INF 1e9
#define LLINF 1e18
#define pi 3.14159265358979323
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;

int gcd(int a, int b) {
    if(a % b == 0) {
        return b;
    }
    else {
        return(gcd(b, a % b));
    }
}


int main() {
    string s;
    int a = 0;
    cin >> s;
    rep(i, 4) {
        if (s.at(i) == '2') a++;
    }
    cout << a << endl;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define ALL(a) (a).begin(), (a).end()
const ll mod = 1e9 + 7;

int cnt[100001] = {};

int main()
{
    int n, k, q;
    cin >> n >> k >> q;
    rep(i, q)
    {
        int x;
        cin >> x;
        cnt[x]++;
    }
    rep(i, n)
    {
        if (k - q + cnt[i + 1] > 0)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 1024
S=int(input())

#print(S//3600,end="")

#print(end=":")

#print((S%3600)//60,end="")

#print(end=":")

#print((S%3600)%60,end="")

h=S//3600

m=(S%3600)//60

s=(S%3600)%60



result='{h}:{m}:{s}'.format(h=S//3600,m=(S%3600)//60,s=(S%3600)%60)

print(result)



Measured memory_bytes: 5588
n = int(input())
AB = [list(map(int,input().split())) for i in range(n-1)]

tree = [[] for i in range(n+1)]
for a,b in AB:
	tree[a].append(b)
	tree[b].append(a)

parent = [0]*(n+1)
stack = [1]
while stack:
	v = stack.pop()
	for c in tree[v]:
		if c == parent[v]:
			continue
		parent[c] = v
		stack.append(c)

color = [0]*(n+1)
for i in range(1,n+1):
	cur_col = 1
	par_col = color[i]
	for c in tree[i]:
		if c == parent[i]:
			continue
		if cur_col == par_col:
			cur_col += 1
		color[c] = cur_col
		cur_col += 1
	# print(color)

print(max(color))
for a,b in AB:
	if a == parent[b]:
		print(color[b])
	else:
		print(color[a])

Measured memory_bytes: 37448
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
string solve() {
    int N, M;
    cin >> N >> M;
    string ans(N, ' ');
    for (int i = 0, s, c; i < M; i++) {
        cin >> s >> c;
        if (ans[s - 1] == ' ') ans[s - 1] = c + '0';
        else if (ans[s - 1] != c + '0') {
            return "-1";
        }
    }
    for (int i = 0; i < N; i++) {
        if (ans[i] == ' ') {
            ans[i] = i == 0 ? '1' : '0';
            if (N == 1) ans[i] = '0';
        }
    }
    if (ans.length() > 1 && all_of(ans.begin(), ans.end(), [](char c) {return c == '0';})) return "-1";
    return ans;
}
int main() {
    cout << solve() << endl;
}

Measured memory_bytes: 256
def solve():
    answers = []
    def square(ans, rest, limit):
        if rest == 0:
            answers.append(' '.join(map(str, ans)))
        else:
            for i in range(rest, 0, -1):
                if i > limit:
                    continue
                square(ans + [i], rest - i, i)
    
    import sys
    for n in map(int, sys.stdin):
        if n == 0:
            break
        square([], n, n)
    
    print('\n'.join(answers))

solve()


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

int main()
{
    ll L, R;
    cin >> L >> R;
    if (R - L > 2019)
    {
        cout << 0 << endl;
        return 0;
    }
    ll mn = 2020, mod;
    for (ll i = L; i < R; i++)
    {
        for (ll j = i + 1; j <= R; j++)
        {
            mod = ((i % 2019) * (j % 2019)) % 2019;
            if (mod < mn)
                mn = mod;
        }
    }
    cout << mn << endl;

    return 0;
}


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

const int MOD = 1e9+7;
const int MAX_N = 1e5+12;
int n;
ll x[MAX_N];
ll prob[MAX_N];

ll powmod(ll x, ll y)
{
	ll res = 1;
	while(y){
		if(y&1) (res*=x)%=MOD;
		(x*=x)%=MOD;
		y>>=1;
	}
	return res;
}

void solve()
{
	prob[1]=1;
	for(int i=2;i<n;++i) prob[i]=(prob[i-1]+powmod(i,MOD-2))%MOD;
	ll ans = 0;
	for(int i=1;i<n;++i) (ans+=(x[i]-x[i-1])*prob[i])%=MOD;
	for(int i=1;i<n;++i) (ans*=i)%=MOD;
	cout<<ans<<'\n';
}

int main()
{
	cin >> n;
	for(int i=0;i<n;++i) cin >> x[i];
	solve();
	return 0;
}

Measured memory_bytes: 5132
import sys,bisect,string,math,time,functools,random,fractions
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
from itertools import permutations,combinations,groupby
rep=range;R=range
def Golf():n,*t=map(int,open(0).read().split())
def I():return int(input())
def S_():return input()
def IS():return input().split()
def LS():return [i for i in input().split()]
def MI():return map(int,input().split())
def LI():return [int(i) for i in input().split()]
def LI_():return [int(i)-1 for i in input().split()]
def NI(n):return [int(input()) for i in range(n)]
def NI_(n):return [int(input())-1 for i in range(n)]
def StoLI():return [ord(i)-97 for i in input()]
def ItoS(n):return chr(n+97)
def LtoS(ls):return ''.join([chr(i+97) for i in ls])
def RA():return map(int,open(0).read().split())
def GI(V,E,ls=None,Directed=False,index=1):
    org_inp=[];g=[[] for i in range(V)]
    FromStdin=True if ls==None else False
    for i in range(E):
        if FromStdin:
            inp=LI()
            org_inp.append(inp)
        else:
            inp=ls[i]
        if len(inp)==2:
            a,b=inp;c=1
        else:
            a,b,c=inp
        if index==1:a-=1;b-=1
        aa=(a,c);bb=(b,c);g[a].append(bb)
        if not Directed:g[b].append(aa)
    return g,org_inp
def GGI(h,w,search=None,replacement_of_found='.',mp_def={'#':1,'.':0},boundary=1):
    #h,w,g,sg=GGI(h,w,search=['S','G'],replacement_of_found='.',mp_def={'#':1,'.':0},boundary=1) # sample usage
    mp=[boundary]*(w+2);found={}
    for i in R(h):
        s=input()
        for char in search:
            if char in s:
                found[char]=((i+1)*(w+2)+s.index(char)+1)
                mp_def[char]=mp_def[replacement_of_found]
        mp+=[boundary]+[mp_def[j] for j in s]+[boundary]
    mp+=[boundary]*(w+2)
    return h+2,w+2,mp,found
def TI(n):return GI(n,n-1)
def accum(ls):
    rt=[0]
    for i in ls:rt+=[rt[-1]+i]
    return rt
def bit_combination(n,base=2):
    rt=[]
    for tb in R(base**n):s=[tb//(base**bt)%base for bt in R(n)];rt+=[s]
    return rt
def gcd(x,y):
    if y==0:return x
    if x%y==0:return y
    while x%y!=0:x,y=y,x%y
    return y
def YN(x):print(['NO','YES'][x])
def Yn(x):print(['No','Yes'][x])
def show(*inp,end='\n'):
    if show_flg:print(*inp,end=end)

mo=10**9+7
inf=float('inf')
FourNb=[(-1,0),(1,0),(0,1),(0,-1)];EightNb=[(-1,0),(1,0),(0,1),(0,-1),(1,1),(-1,-1),(1,-1),(-1,1)];compas=dict(zip('WENS',FourNb));cursol=dict(zip('LRUD',FourNb))
l_alp=string.ascii_lowercase
#sys.setrecursionlimit(10**7)
read=sys.stdin.buffer.read;readline=sys.stdin.buffer.readline;input=lambda:sys.stdin.readline().rstrip()

########################################################################################################################################################################

show_flg=False
show_flg=True

ans=0

n,k=LI()
a=LI()
for i in range(n-k):
    if a[i]<a[i+k]:
        Yn(1)
    else:
        Yn(0)


#show(n,m)



Measured memory_bytes: 103328
#include <stdio.h>
#define SIZE 1000
#define LEN 1000

int stack[SIZE];
int stack_size = 0;


int pop()
{
	if (stack_size <= 0) return 0;
	return stack[--stack_size];
}


int push(int a)
{
	stack[stack_size++] = a;
}


int is_digit(char *s)
{
	
	if (*s == '+' || *s =='-') {
		s++;
		if (*s >= '0' && *s <= '9') return 1;
		return 0;
	}
	
	if (*s >= '0' && *s <= '9') return 1;
	return 0;
}


int get_number(char *s)
{
	int sign = 0, n = 0;
	
	
	if (*s == '+') {
		s++;
	} else if (*s == '-') {
		sign = 1;
		s++;
	}
	
	while (*s >= '0' && *s <= '9') {
		n = n * 10 + (*s - '0');
		s++;
	}
	
	if (sign) return -n;
	return n;
}


int calc_rpn(char *s)
{
	int a, b, n;
	
	
	while (*s) {
		
		
		if (is_digit(s)) {
			n = get_number(s);
			push(n);
			while (*s == '-' || *s == '+') {
				s++;
			}
			while (n) {
				n /= 10;
				s++;
			}
			
		
		} else {
			switch (*s) {
			case '+':
				a = pop();
				b = pop();
				push(b+a);
				break;
			case '-':
				a = pop();
				b = pop();
				push(b-a);
				break;
			case '*':
				a = pop();
				b = pop();
				push(b*a);
				break;
			case '/':
				a = pop();
				b = pop();
				if (a == 0) break;
				push(b/a);
				break;
			case '%':
				a = pop();
				b = pop();
				if (a == 0) break;
				push(b%a);
			}
			s++;
		}
	}
	return pop();
}

int main()
{
	char s[LEN];
	scanf("%[^\n]*s", s);
	printf("%d\n",calc_rpn(s));
	return 0;
}

Measured memory_bytes: 536
import sys

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


def main():
    H, W = map(int, readline().split())
    C = [list(map(int, readline().split())) for _ in range(10)]
    A = list(map(int, read().split()))

    for k in range(10):
        for i in range(10):
            for j in range(10):
                if C[i][j] > C[i][k] + C[k][j]:
                    C[i][j] = C[i][k] + C[k][j]

    ans = 0
    for n in A:
        if n != -1:
            ans += C[n][1]

    print(ans)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 5924
// #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>	// istringstream
using namespace std;

vector<int> solve(vector<int> list){
	// 1000*1000までなら計算スピード早い.
	for (int i = 0; i <= 1000; i++){
		for (int j = 0; j <= 1000; j++){
			list[i + j]++;
		}
	}

	return list;
}

int main(){
	// a+bの組み合わせ数 * c+dの組み合わせ数
	// sankou http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=612299#1
	// sankou http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=614745#1
	int n;
	vector<int> list(2001, 0);

	list = solve(list);

	while (cin >> n){
		long int ans = 0;
		for (int i = 0; i <= 2000; i++){
			for (int j = 0; j <= 2000; j++){
				if (i + j == n){
					ans += list[i] * list[j];
				}
			}
		}
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 1244
import java.util.*;
import java.util.Map.Entry;
 
class Main {
	 static int mod =  (int) (Math.pow(10,9)+7);
//	 static int mod = 998244353;
	 public static void main(String[] args) {
	        Scanner sc = new Scanner(System.in);
	        String S = sc.next();
	        char[] c = S.toCharArray();
	        
	        String ans="No";
	        if(c[2]==c[3]) {
	        	if(c[4]==c[5]) {
	        		ans="Yes";
	        	}
	        }
	        
        	System.out.println(ans);
	        	        
	 }
}


Measured memory_bytes: 23636
package main

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

var sc *bufio.Scanner

func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func main() {
	sc = bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	a, b, c := nextInt(), nextInt(), nextInt()
	ans := 0
	for i := a; i <= b; i++ {
		if c%i == 0 {
			ans++
		}
	}
	fmt.Println(ans)

}



Measured memory_bytes: 1112
#include <iostream>
#include <bitset>
#include <fstream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
#include <unordered_map>
#define Debug 0
//#include <boost/multiprecision/cpp_int.hpp>

const double EPS = (1e-10);


using namespace std;
using Int = long long;
//using namespace boost::multiprecision;

const Int MOD = 998244353;

Int mod_pow(Int x, Int n) {
    Int res = 1;
    while(n > 0) {
        if(n & 1) res = (res * x) % MOD; //ビット演算(最下位ビットが1のとき)
        x = (x * x) % MOD;
        n >>= 1; //右シフト(n = n >> 1)
    }
    return res;
}

//最大公約数
template<typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

//最小公倍数
template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

//入出力高速化(非同期化)
void fast_input() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

vector<Int> Divisor(Int n) {
    vector<Int> ret;
    for(Int i=1; i*i<=n; i++) {
        if(n % i == 0) {
            ret.push_back(i);
            if(i*i!=n) ret.push_back(n / i);
        }
    }
    return ret;
}

int main(void) {
    int A, B, T; cin >> A >> B >> T;
    int ans = T/A*B;
    cout << ans << endl;
}



Measured memory_bytes: 888
def convert(s): 
  
    # initialization of string to "" 
    new = "" 
  
    # traverse in the string  
    for x in s: 
        new += x  
  
    # return string  
    return new 
s=input()
a=[]
for i in range(len(s)):
  if s[i]=='0':
    a.append('0')
  elif s[i]=='1':
    a.append('1')
  else:
    if len(a)>0:
      a.pop()
print(convert(a))

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

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "Yes" : "No") << endl;
typedef long long ll;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;
const int MAX_N = 55;

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

int H, W;
string S[MAX_N];
int d[MAX_N][MAX_N];

typedef pair< int, int > PI;

int dfs()
{
  REP(i, MAX_N) {
    fill_n(d[i], MAX_N, INF);
  }
  queue< PI > q;
  q.push(make_pair(0, 0));
  d[0][0] = 0;

  while(!q.empty()) {
    PI from = q.front(); q.pop();

    if (from.first == H - 1 && from.second == W - 1) break;
    
    REP(i, 4) {
      int nextY = from.first + dy[i];
      int nextX = from.second + dx[i];

      if (!(0 <= nextX && nextX < W and
	    0 <= nextY && nextY < H)) continue;
      if (S[nextY][nextX] == '#') continue;
      if (d[nextY][nextX] < INF) continue;

      d[nextY][nextX] = d[from.first][from.second] + 1;
      q.push(make_pair(nextY, nextX));
    }
  }

  return d[H - 1][W - 1] + 1;
}

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

  cin >> H >> W;
  int ans = H * W;
  REP(hi, H) {
    cin >> S[hi];
    REP(wi, W) {
      if (S[hi][wi] == '#') {
	ans--;
      }
    }
  }

  ans -= dfs();
  if (ans < 0) ans = -1;
  
  cout << ans << endl;
  
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
 
using namespace std;
 
int main()
{
  string s, news;
  long unsigned int k;
  cin >> k >> s;
  if (s.size() <= k)
  {
    cout << s;
    return 0;
  }
  else
  {
    s.erase(k, s.size()-1);
    s.append("...");
   	cout << s;
    return 0;
  }
  
}


Measured memory_bytes: 3608
#include<iostream>
#include<vector>

using namespace std;

int main()
{
	ios::sync_with_stdio( false );
	int n, k;
	cin>>n>>k;
	vector< int > w;
	int num, P;
	for( int i=0; i<n; i++ ) {
		cin>>num;
		w.push_back( num );
		P = max( P, num );
	}
	
	int truckCnt, lr, i;
	int left = P;
	
	int right = 100000*10000;
	while( left < right ) {
		P = (left+right)/2;		
		truckCnt = k-1;
		lr = 0;
		for( i=0; i<n; i++ ) {
			if( P < lr+w.at(i) ) {
				truckCnt--;
				if( truckCnt < 0 ) { break; }
				lr = 0;
			}
			lr += w.at(i);
		}
		if( 0 <= truckCnt ) {
			right = P;
		} else {
			left = P+1;
		}
	}
	
	cout<<left<<'\n';

    return 0;
}

Measured memory_bytes: 1688
#include <iostream>
#include <complex>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <iomanip>

using namespace std;

typedef long double ld;
typedef complex<double> P;

class C{
public:
  P o;
  double r;
  C(){}
  C(P o, double r) : o(o), r(r){}
  bool operator < (const C &s) const {
    //return o.real() - r < s.o.real() - s.r;
    return o.real() < s.o.real();
  }
};

const int N = 100000;
const double INF = 1e77;

bool compare_y(C a, C b){
  //return a.o.imag() - a.r < b.o.imag() - b.r;
  return a.o.imag() < b.o.imag();
}

double dist(C a, C b){
  double dx = a.o.real() - b.o.real();
  double dy = a.o.imag() - b.o.imag();
  return max((double)0.0, sqrt(dx * dx + dy * dy) - a.r - b.r);
}

double valM;

double closest_pair(C *a, int n){
  if(n <= 1) return INF; 
  int m = n / 2;
  double x = a[m].o.real();
  double r = a[m].r;
  double d = min(closest_pair(a, m), closest_pair(a + m, n - m));
  inplace_merge(a, a + m, a + n, compare_y);

  vector<C> b;
  for(int i=0;i<n;i++){
    bool f = false;
    if(a[i].o.real() < x){
      if(!(x > a[i].o.real() + a[i].r)) f = true;
      if(x - a[i].o.real() - a[i].r - valM < d) f = true;
    }else{ // x < a[i].o.real()
      if(!(a[i].o.real() - a[i].r > x)) f = true;
      if(a[i].o.real() - a[i].r - x - valM < d) f = true;
    }
    if(!f) continue;
    //if(fabs(fabs(a[i].o.real() - x) - a[i].r) >= d) continue;
    for(int j=0;j<b.size();j++){
      int id = (int)b.size()-j-1;
      double dy = a[i].o.imag() - b[id].o.imag() - a[i].r - b[id].r;
      if(dy >= d) break;
      d = min(d, dist(a[i], b[id]));
    }
    b.push_back(a[i]);
  }
  return d;
}

main(){
  int n;
  static C A[N];

  while(cin >> n && n){
    valM = 0.0;
    for(int i=0;i<n;i++){
      double a, b, c;
      cin >> c >> a >> b;
      A[i] = C(P(a, b), c);
      valM = max(valM, c);
    }
    /*for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
        printf("%d %d %.8f\n", i, j, dist(A[i], A[j]));
      }
      }*/
    sort(A, A+n);
    //cout << fixed << setprecision(8) << closest_pair(A, n) << endl;
    printf("%.8lf\n", closest_pair(A, n));
  }
}

Measured memory_bytes: 8992
n=int(input())
h=list(map(int,input().split()))
for i in range(1,n):
  if h[n-i]<h[n-i-1]:
    h[n-i-1]-=1
for i in range(1,n):
  if h[i]<h[i-1]:
    print('No')
    exit()
print('Yes')

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

using namespace std;
using ll = long long;

#define mx 200005
#define inf 1000000000009

int n;
ll k;
ll f[mx];
ll a[mx]; 
bool ok(ll x) {
	ll tk = k;
	for (int i = 0; i < n; i++) {
		if (f[i] * a[i] > x) {
			ll aa = x / f[i];
			ll ex = a[i] - aa;
			if (ex > tk) return false;
			tk -= ex;
		}
	}

	return true;
}

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

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

	sort(a, a + n);
	sort(f, f + n, greater <ll>());
	ll lo = 0, hi = inf;
	ll ans = inf;
	while (lo <= hi) {
		ll mid = (lo + hi) / 2;
		if (ok(mid)) {
			ans = mid;
			hi = mid - 1;
		} else {
			lo = mid + 1;
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 3328
using System;

namespace ABC170C
{
    class Program
    {
        static void Main(string[] args)
        {
            var aa = Console.ReadLine().Split(" ");
            int x, n ,z;
            int f = 0;
            z = 9999999;
            x = int.Parse(aa[0]);n = int.Parse(aa[1]);
            int[] p = new int[n + 1];
            var b = Console.ReadLine().Split(" ");
            for(int i = 1;i <= n ;i++)
            {
                p[i] = int.Parse(b[i - 1]);
            }

            for(int i = 0;z == 9999999; i++)
            {
                f = 0;
                for (int c = 1; c <= n; c++)
                {
                    if (x + i == p[c])
                        f = 1;
                }

                if (f == 0)
                    z = x + i;


                f = 0;

                for (int c = 1; c <= n; c++)
                {
                    if (x - i == p[c])
                        f = 1;
                }

                if (f == 0)
                    z = x - i;


            }

            Console.WriteLine(z);
           
        
          


        }
    }
}


Measured memory_bytes: 17876
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main(void){
    int x; cin >> x;
    if(x < 1200) cout << "ABC" << endl;
    else cout << "ARC" << endl;
}

Measured memory_bytes: 256
use std::cmp;
use std::io;

const SPLIT_DELIMITER: char = ' ';

#[allow(unused_macros)]
macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

#[allow(dead_code)]
fn input_line_str() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
fn input_vector2d<T>(line: usize) -> Vec<Vec<T>>
where
    T: std::str::FromStr,
{
    let mut v: Vec<Vec<T>> = Vec::new();

    for _ in 0..line {
        let vec_line = input_vector();
        v.push(vec_line);
    }
    v
}

#[allow(dead_code)]
fn input_vector<T>() -> Vec<T>
where
    T: std::str::FromStr,
{
    let mut v: Vec<T> = Vec::new();

    let s = input_line_str();
    let split_result = s.split(SPLIT_DELIMITER);
    for z in split_result {
        let buf = match z.parse() {
            Ok(r) => r,
            Err(_) => panic!("Parse Error"),
        };
        v.push(buf);
    }
    v
}

#[allow(dead_code)]
fn str2vec(s: &str) -> Vec<char> {
    let mut v: Vec<char> = Vec::new();
    for c in s.chars() {
        v.push(c);
    }
    v
}

fn main() {
    let n: isize;
    let m: isize;
    let x: isize;
    input!(n, m, x);
    let v: Vec<isize> = input_vector();
    let mut ans = 0;

    for z in 0..m  {
        if v[z as usize] > x {
            ans = z-1;
            break;
        }
    }
    println!("{}", cmp::min(ans + 1, m - 1 - ans));
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define mod 998244353
#define int long long
#define inf 200000000
const int maxnodes=1005;
#define ll long long
#define N 300000
#define EPS 0.01
#define ld long double


int32_t main()
{
    IOS;

    vector<int> g[26];
    string s;
    string t;
    cin >> s >> t;
    for(int i = 0;i < s.length();i++)
        g[s[i] - 'a'].push_back(i);
    int start =  - 1;
    int copies = 1;
    for(int i = 0;i < t.length();i++)
    {
        int f = t[i] - 'a';
        if(g[f].size() == 0)
        {
            cout << -1;
            return 0;
        }
        vector<int>::iterator it = upper_bound(g[f].begin(),g[f].end(),start);
        if(it == g[f].end())
        {
            copies++;
            start = g[f][0];
        }
        else
            start = *it;
    }
    cout << (copies - 1) * s.length() + (start + 1);
}

Measured memory_bytes: 1736
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

int main() {
  int sx, sy, tx, ty;
  cin >> sx >> sy >> tx >> ty;

  for (int i = 0; i < ty - sy; i++) {
    cout << "U";
  }
  for (int i = 0; i < tx - sx; i++) {
    cout << "R";
  }
  for (int i = 0; i < ty - sy; i++) {
    cout << "D";
  }
  for (int i = 0; i < tx - sx; i++) {
    cout << "L";
  }
  cout << "L";
  for (int i = 0; i < ty - sy; i++) {
    cout << "U";
  }
  cout << "U";
  for (int i = 0; i < tx - sx; i++) {
    cout << "R";
  }
  cout << "RDR";

  for (int i = 0; i < ty - sy; i++) {
    cout << "D";
  }
  cout << "D";
  for (int i = 0; i < tx - sx; i++) {
    cout << "L";
  }
  cout << "LU";
  cout << endl;

  return 0;
}

Measured memory_bytes: 256
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 より
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

//

fn run() {
    input! {
        n: usize,
        m: i64,
        v: usize,
        p: usize,
        a: [i64; n],
    }
    let mut a = a;
    a.sort();
    a.reverse();
    let a = a;
    let mut ok = p - 1;
    let mut ng = n;
    while ng - ok > 1 {
        let mid = (ok + ng) / 2;
        if a[p - 1] > a[mid] + m {
            ng = mid;
        } else if v <= p - 1 + n - mid {
            ok = mid;
        } else {
            let d = v - (p - 1) - (n - mid);
            let mut sum = m * d as i64;
            for i in (p - 1)..mid {
                sum -= a[mid] + m - a[i];
            }
            if sum <= 0 {
                ok = mid;
            } else {
                ng = mid;
            }
        }
    }
    let ans = ng;
    println!("{}", ans);
}

fn main() {
    run();
}


Measured memory_bytes: 6396
def euclidean(a,b):
  _ = a % b
  if _ == 0:
    return b
  else:
    while 1:
      if b % _ == 0 :
        break
      else:
        _ = b % _
    return _
  
A, B, K = map(int, input().split())
 
a = max(A, B)
b = min(A, B)
e = euclidean(a, b)
by = []
r = int(e ** (1 / 2))
 
for i in range(1, r + 1):
  if e % i == 0:
    by.append(i)
    j = e // i
    if j != i:
      by.append(j)
by.sort(reverse = True)
print(by[K - 1])

Measured memory_bytes: 62456
n=int(input())
ans=0
for i in range(1,n+1):
  if i%3==0 and i%5==0:
    i='FizzBuzz'
  elif i%3==0:
    i='Fizz'
  elif i%5==0:
    i='Buzz'
  else:
    ans=i+ans
print(ans)

Measured memory_bytes: 9176
#include <stdio.h>

int color[105];

int main(){

	int a,b,c;

	scanf("%d %d %d",&a,&b,&c);

	color[a]++;
	color[b]++;
	color[c]++;

	int i;

	int ans=0;

	for(i=1;i<=100;i++){
		if(color[i]>0){ans++;}
	}
	printf("%d\n",ans);

	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

ll mod = 1e9 + 7;

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

    ll n;
    cin >> n;
    ll l, r;
    vector<P> p(n);
    REP(i, n) {
        cin >> l >> r;
        p[i] = {r, l};
    }
    VSORT(p);
    ll l1 = -1, r1 = 1e10 + 10;
    vll junl(n), junr(n);
    REP(i, n) {
        junl[i] = max(l1, p[i].second);
        junr[i] = min(r1, p[i].first);
        l1 = junl[i];
        r1 = junr[i];
    }
    ll l2 = -1, r2 = 1e10 + 10;
    vll revl(n), revr(n);
    REPR(i, n) {
        revl[i] = max(l2, p[i].second);
        revr[i] = min(r2, p[i].first);
        l2 = revl[i];
        r2 = revr[i];
    }
    ll s1 = 0, s2 = 0;
    l1 = junl[0], r1 = junr[0];
    l2 = revl[1], r2 = revr[1];
    if (r1 - l1 + 1 > 0) s1 = r1 - l1 + 1;
    if (r2 - l2 + 1 > 0) s2 = r2 - l2 + 1;
    ll res = s1 + s2;
    //cout << l1 << " " << r1 << ":::" << l2 << " " << r2 << endl;
    REP(i, n - 2) {
        l1 = junl[i + 1];
        r1 = junr[i + 1];
        l2 = revl[i + 2];
        r2 = revr[i + 2];
        if (r1 - l1 + 1 > 0) s1 = r1 - l1 + 1;
        else s1 = 0;
        if (r2 - l2 + 1 > 0) s2 = r2 - l2 + 1;
        else s2 = 0;
        //cout << l1 << " " << r1 << ":::" << l2 << " " << r2 << endl;
        res = max(res, s1 + s2);
    }

    l1 = junl[0], r1 = junr[0];
    l2 = revl[1], r2 = revr[1];
    if (r1 - l1 + 1 > 0) s1 = r1 - l1 + 1;
    if (r2 - l2 + 1 > 0) s2 = r2 - l2 + 1;
    ll d, xxx;
    vll ss(n);
    REP(i, n - 2) {
        d = p[i + 1].first - p[i + 1].second + 1;
        l1 = junl[i];
        r1 = junr[i];
        l2 = revl[i + 2];
        r2 = revr[i + 2];
        ll l3 = max(l1, l2), r3 = min(r1, r2);
        if (r3 - l3 + 1 > 0) xxx = r3 - l3 + 1;
        else xxx = 0;
        res = max(res, d + xxx);
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 5804
#include<iostream>
#include<algorithm>
#include<vector>

using namespace std;
int main(){
	
	int N;
	cin>>N;
	
	if(N%10==9||(N-N%10)==90){
      cout<<"Yes"<<endl;
    }else{
      cout<<"No"<<endl;
    }
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <string>
#include <algorithm>
#include <string>
#include <climits>
#include <utility>

#define REP(i, n) for (int (i) = 0; (i) < (int)(n); (i)++)
#define REG(i, a, b) for (int (i) = ((int)(a)); (i) < ((int)(b)); i++)
#define ALL(V) (V).begin(), (V).end()
#define PRINT(STR) cout << (STR) << endl
#define ROUNDED(N) fixed << setprecision(N)
#define SPACE " "

typedef long long ll;
using namespace std;

int nextInt() { int n; cin >> n; return n; }
double nextDouble() { double d; cin >> d; return d; }
string nextString() { string str; cin >> str; return str; }

int main() {
	cin.tie(0); //?????±?????????????????????
	ios::sync_with_stdio(false); //printf??¨??±??????????????????
  string a;
	int L;
	while(cin>>a>>L,L){
		while(a.size()<L)a = "0" + a;
		vector<vector<int>> num(31,vector<int>(L,0));
		REP(i,L)
		num[0][i] = a[i] - '0';
		REP(i,30){
			vector<int> a1(L);
			REP(j,L)a1[j] = num[i][j];
			sort(a1.begin(),a1.end());
			vector<int> a2(a1);
			reverse(a2.begin(),a2.end());
			for(int j = L-1;j>=0;j--)
				if(a2[j]-a1[j]+num[i+1][j]<0&&j>0){
					num[i+1][j-1]--;
					num[i+1][j] += 10+ a2[j] - a1[j];
				}else{
					num[i+1][j] += a2[j] - a1[j];
			}
			REP(j,i){
				bool is_agree=true;
				REP(k,L){
					if(num[i][k] != num[j][k]){
						is_agree = false;
						break;
					}
				}
				if(is_agree){
					cout << j << " ";
					int tmp=0;
					REP(p,L)tmp += pow(10,L-p-1)*num[j][p];
					cout << tmp;
					cout << " " << i-j << endl;
					i+=300;
					break;
				}
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3336
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
 
int main(void) {
    int N;
    cin >> N;
    set<int> st;
    for(int i=0;i<N;i++){
        int x;
        cin >> x;
        st.insert(x);
    }
    cout << st.size() << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef long long ll;
string S;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    cin >> S;
    int sum = 0;
    for(char c : S){
        sum += (c-'0');
    }
    sum %= 9;
    if(sum == 0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3736
class Factorial:
    def __init__(self,n,mod):
        self.f=[1]
        self.mod=mod
        for i in range(1,n+1):
            self.f.append(self.f[-1]*i%mod)
        self.i=[pow(self.f[-1],mod-2,mod)]
        for i in range(1,n+1)[::-1]:
            self.i.append(self.i[-1]*i%mod)
        self.i.reverse()
    def factorial(self,i):
        return self.f[i]
    def ifactorial(self,i):
        return self.i[i]
    def comb(self,n,k):
        return self.f[n]*self.i[n-k]%self.mod*self.i[k]%self.mod if n>=k else 0
from collections import*
M=10**9+7
n,*a=map(int,open(0).read().split())
v,_=Counter(a).most_common(1)[0]
l=-1
for i,b in enumerate(a):
  if b==v:
    if l<0:l=i
    else:r=n-i
c=Factorial(n+1,M).comb
for k in range(n+1):print((c(n+1,k+1)-c(l+r,k))%M)

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

int main()
{
    ll N, M;
    cin >> N >> M;
    ll ans = 100*N + 1800*M;
    for(ll i = 0; i < M; ++i) ans *= 2;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
template <typename A, typename B>
string to_string(pair<A, B> p);
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
string to_string(const string& s) {
    return '"' + s + '"';
}
string to_string(const char* s) {
    return to_string((string) s);
}
string to_string(bool b) {
    return (b ? "true" : "false");
}
string to_string(vector<bool> v) {
    bool first = true;
    string res = "{";
    for (int i = 0; i < static_cast<int>(v.size()); i++) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(v[i]);
    }
    res += "}";
    return res;
}
template <size_t N>
string to_string(bitset<N> v) {
    string res = "";
    for (size_t i = 0; i < N; i++) {
        res += static_cast<char>('0' + v[i]);
    }
    return res;
}
template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for (const auto &x : v) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}
template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
    return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
    return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif
//Auther: Arin Roday
#define vec vector
#define i64 long long
#define endl '\n'
#define sz(x) (x).size()
#define times(n) for(int i = 0; i < (n); ++i)
#define bits(x) __builtin_popcount(x)
 
int test_case_number = 1;

void print_case(){
    #ifdef LOCAL
    cout << "Case #" << test_case_number++ << ": ";
    #endif
}

void solve(){
    int n;
    cin >> n;
    if(n >= 1800){
        cout << "1" << endl;
    } else if(n >= 1600){
        cout << "2" << endl;
    } else if(n >= 1400){
        cout << "3" << endl;
    } else if(n >= 1200){
        cout << "4" << endl;
    } else if(n >= 1000){
        cout << "5" << endl;
    } else if(n >= 800){
        cout << "6" << endl;
    } else if(n >= 600){
        cout << "7" << endl;
    } else if(n >= 400){
        cout << "8" << endl;
    }
}
 
int main(){
    solve();
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define MOD 1000000007
#define INF 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define req(i, j, n) for(int i = j; i <= (int)(n); i++)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

int main() {
ll n;
  cin>>n;
  ll x[n+1];
  ll l[n+1];
  for(int i=1;i<=n;i++){
    cin>>x[i];
    cin>>l[i];
  }
    ll left[n+1];
    ll right[n+1];
    for(int i=1;i<=n;i++){
      left[i]=x[i]-l[i];
      right[i]=x[i]+l[i]-1;}
    
    P pa[n+1];
      for(int i=1;i<=n;i++){
      pa[i]=make_pair(right[i],left[i]);
      }
    
        sort(pa+1, pa+n+1);
    
    ll ans=1;
      ll now=pa[1].first;
    for(int i=2;i<=n;i++){
      if(pa[i].second>now){
        now=pa[i].first;
        ans++;}
    }
    
 cout<<ans<<endl;
        return 0;
  
  
      }

Measured memory_bytes: 4992
use text_io::*;
use std::process::exit;

fn main(){
    let n:usize = read!();
    let k:usize = read!();
    let mut v =Vec::new();
    for i in 0..n {
        let va:usize = read!();
        v.push(va);
    }
    v.sort();
    let mut a = 0;
    for i in 0..k {
        a+=v[i];
    }
    println!("{}",a)
}

Measured memory_bytes: 2120
nm = list(map(int, input().split()))
sc = []
for _ in range(nm[1]):
    sc.append(list(map(int, input().split())))

for i in range(1000):
    i = str(i)
    if len(i) == nm[0]:
        for j in sc:
            if int(i[j[0]-1]) == j[1]:
                continue
            else:
                break
        else:
            print(int(i))
            exit()

print(-1)

Measured memory_bytes: 3064