akhauriyash/Code-Regression huggingface dataset:
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define INF 10e16
#define MOD 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
using Int=int_fast64_t;
typedef long long int ll;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
ll cmp(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}

//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    int n;
    queue<int>q[1010];
    cin>>n;
    for(int i=0;i<n;i++)
        for(int j=0;j<n-1;j++){
            int a;cin>>a;a--;q[i].push(a);//每个人的比赛都压进去
        }
    set<Pin>buf;
    for(int now=0;now<n;now++){
        int next=q[now].front();
        if(q[next].front()==now)
            buf.insert(mp(min(now,next),max(now,next)));//第一轮对阵压进buf
    }
    int ans=0;
    while(!buf.empty()){
        ans++;//每天一循环
        set<Pin>buf2;
        for(auto &p:buf){ //这个循环的写法**important//该当轮次的每一局进行循环
            int a=p.fi,b=p.se;
            q[a].pop();
            q[b].pop();//a和b打
            if(!q[a].empty()){//如果a还没打完 把下一轮压进buf2
                int now=q[a].front();
                if(!q[now].empty()){
                    if(q[now].front()==a)
                        buf2.insert(mp(min(a,now),max(a,now)));
                }
            }
            if(!q[b].empty()){//同上
                int now=q[b].front();
                if(!q[now].empty()){
                    if(q[now].front()==b)
                        buf2.insert(mp(min(b,now),max(b,now)));
                }
            }
        }
        swap(buf,buf2);//下一局对阵表buf2
    }
    for(int i=0;i<n;i++){
        if(!q[i].empty()){
            cout<<-1<<endl;//如果还有人没打比赛
            return 0;
        }
    }
    cout<<ans<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------


Measured memory_bytes: 4736
import java.util.*

fun main(args:Array<String>) {
    val (n,m) = readLine()!!.split(" ").map { it.toInt() }
    val shinamono = readLine()!!.split(" ").map { it.toLong() }
    val queue = PriorityQueue<Long>()
    shinamono.forEach { queue.add(it*-1) }
    for(i in (1..m)) {
        val item = queue.poll()
        queue.add(item/2)
    }
    val ans = queue.sum()*-1
    println(ans)
}


Measured memory_bytes: 71924
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);
#define FO cout.tie(NULL);
#define FI cin.tie(NULL);
#define IN cin>>
#define OUT cout<<
#define loop(i,a,n) for(int i=a; i<n; i++)
#define rloop(i,a,n) for(int i=a; i>=n; i--)
#define endl "\n";
#define pb push_back
#define mp make_pair
#define set_bits(a) __builtin_popcountll(a)
#define ll long long int
#define ld long double
#define vll vector<long long int>
#define pll pair<long long int, long long int>
#define mod 1000000007
#define M 998244353
ll gcd(ll a, ll b)
{
    return (b?gcd(b,a%b):a);
}
ll P(ll B, ll power, ll modulo)
{
    ll ans=1LL;
    while(power>0LL)
    {
        if(power%2LL==1LL)
        {
            ans=(ans*B)%modulo;
        }
        B=(B*B)%modulo;
        power/=2LL;
    }
    return ans;
}
bool isPrime(ll n)
{
    if(n<=1LL)
    {
        return false;
    }
    if(n<=3LL)
    {
        return true;
    }
    if(n%2==0LL || n%3==0LL)
    {
        return false;
    }
    for(ll i=5LL; (i*i)<=n; i+=6LL)
    {
        if(n%i==0LL || n%(i+2LL)==0LL)
        {
            return false;
        }
    }
    return true;
}
using namespace std;
bool sortbysec(const pair<pair<int,int>,int> &a, const pair<pair<int,int>,int> &b)
{
    return (a.first.second<b.first.second);
}
bool sortbysecll(const pll &a, const pll &b)
{
    return (a.second<b.second);
}
ll modinv(ll x, ll y, ll modulo)
{
    return ((x%modulo)*(P(y,modulo-2LL,modulo)%modulo))%modulo;
}
void vok()
{
    FAST
    FO
    FI
    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt","r",stdin);
    //     freopen("output.txt","w",stdout);
    // #endif
}
int main()
{
    vok();
    ll n,k;
    IN n>>k;
    vll v;
    loop(i,0,n+1)
    {
        v.pb((ll)i);
    }
    vll v2=v;
    reverse(v.begin(),v.end());
    ll sum1=0, sum2=0;
    loop(i,0,k)
    {
        sum1+=v2[i];
        sum1%=mod;
    }
    loop(i,0,k)
    {
        sum2+=v[i];
        sum2%=mod;
    }
    ll ans=sum2-sum1+1LL;
    if(ans<=0)
    {
        ans+=mod;
    }
    ans%=mod;
    //OUT ans<<endl
    loop(i,k,n+1)
    {
        sum1+=v2[i];
        sum1%=mod;
        sum2+=v[i];
        sum2%=mod;
        ans+=(sum2-sum1+1LL);
        if(ans<=0)
        {
            ans+=mod;
        }
        ans%=mod;
    }
    OUT ans<<endl
    return 0;
}

Measured memory_bytes: 6340
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;

int main() {
    double a, b;
    int h, m;
    cin >> a >> b >> h >> m;

    double ch, cm;
    ch = 0.5 * (h*60.0 + m);
    while(ch >= 360) {
        ch -= 360.0;
    }
    cm = 6.0 * (h*60.0 + m);
    double ct;
    ct = abs(ch - cm);

    cout << fixed << setprecision(11);

    cout << sqrt(a*a + b*b - 2*a*b*cos(ct/180.0*M_PI)) << endl;
}

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

using namespace std; using ll=long long; const ll LNF=1e18; const int INF = 1e9+1; const ll M = 1e9+7;
typedef pair<int,int> P;

int main() {
  string s,t; cin>>s>>t;
  if (s == t.substr(0, s.size())) cout << "Yes" << endl;
  else cout <<"No\n";
}

Measured memory_bytes: 3632
#include<stdio.h>
#include<string.h>
int main(){
  char s[101],s2[102];
  int i,a=0,l;
  while(scanf("%s",s)!=EOF){
    l=strlen(s);
    for(i=0;s[i];i++)s2[l-i-1]=s[i];
    s2[l]=0;
    if(strcmp(s,s2)==0)a++;
  }
  printf("%d\n",a);
  return 0;
}

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

int main()
{
    int m,d;
    cin >> m >> d;
    if(d<22)    cout << "0";
    else if(m<4)    cout << "0";
    else
    {
        int cnt=0;
        for(int i=4;i<=m;i++)
        {
            for(int j=22;j<=d;j++)
            {
                int x=1,p=j,f=0;
                while(p>0)
                {
                    if((p%10)<2)
                    {
                        f=1;
                        break;
                    }
                    x*=(p%10);
                    p/=10;
                }
                if(x==i && f==0)    cnt++;
            }
        }
        cout << cnt;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin >> N;
    vector<int> W(N);
    int sum = 0;
    for(int i = 0; i < N; i++){
        cin >> W[i];
        sum += W[i];
    }

    int mini = sum;
    int  pre_sum = 0;
    for(int i = 0; i < N; i++){
        pre_sum += W[i];
        mini = min(mini, abs(2*pre_sum - sum));
    }
    cout << mini << endl;
}

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

int main(void){
    int n; cin >> n;
    bool flg=false;
    for(int i=0; i<50; i++){
        for(int j=0; j<50; j++){
            if(4*i+7*j==n){
                flg=true;
            }
        }
    }

    if(flg) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#!/usr/bin/python3
# -*- coding: utf-8 -*-
s = input()
n = int(input())
mae_list = []
usiro_list = []
flag = 1
for i in range(0, n):
    q_list = list(map(str, input().split()))
    if len(q_list) == 1:
        flag *= -1
    else:
        if (q_list[1] == "1" and flag == 1) or (q_list[1] == "2" and flag == -1):
            mae_list.append(q_list[2])
        else:
            usiro_list.append(q_list[2])
if flag == 1:
    if len(mae_list) > 0:
        mae_list.reverse()
        print(''.join(mae_list), end="")
    print(''.join(s), end="")
    if len(usiro_list) > 0:
        print(''.join(usiro_list), end="")
else:
    if len(usiro_list) > 0:
        usiro_list.reverse()
        print(''.join(usiro_list), end="")
    for i in range(0, len(s)):
        print(s[len(s)-i-1], end="")
    if len(mae_list) > 0:
        print(''.join(mae_list), end="")
print()

Measured memory_bytes: 6420
#include <stdio.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
//#include <unordered_map>
//#include <unordered_set>
//#include <boost/container/static_vector.hpp>
//#include <boost/unordered_set.hpp>
//#include <boost/unordered_map.hpp>
//#include <unistd.h>

//#include <cv.h>
//#include <highgui.h>
#include <stdlib.h>
#include <string>

const int MAX_N = 200;
int N;
int H[MAX_N];

int main(int argc, char **argv) {
    std::cin >> N;
    for (int i = 1; i <= N; i++) {
        std::cin >> H[i];
    }

    int cond = 0;
    int num = 0;

    for (int i = 1; i <= N; i++) {
        if (cond <= H[i]) {
            num++;
            cond = H[i];
        }
    }

    std::cout << num << std::endl;
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast",3,"inline")
#include <bits/stdc++.h>
using namespace std;
int ans=-100000,a,b;
int main(){
	ios_base::sync_with_stdio(false);
	cin>>a>>b;
	ans=max(ans,a-b);
	ans=max(ans,a+b);
	ans=max(ans,a*b);
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
import sys
n=int(input())
a=list(map(int,input().split()))
if n%2==0:
  dp=[[0 for i in range(2)] for j in range(n)]
  dp[0][0]=a[0]
  dp[1][1]=a[1]
  for i in range(2,n):
    if i==2:
      dp[i][0]=dp[i-2][0]+a[i]
      dp[i][1]=dp[i-2][1]+a[i]
    else:
      dp[i][0]=dp[i-2][0]+a[i]
      dp[i][1]=max(dp[i-2][1],dp[i-3][0])+a[i]
  print(max(dp[n-1][1],dp[n-2][0]))

else:
  dp=[[0 for i in range(3)] for j in range(n)]
  dp[0][0]=a[0]
  dp[1][1]=a[1]
  dp[2][2]=a[2]
  for i in range(2,n):
    if i==2:
      dp[i][0]=dp[i-2][0]+a[i]
      dp[i][1]=dp[i-2][1]+a[i]
    else:
      dp[i][0]=dp[i-2][0]+a[i]
      dp[i][1]=max(dp[i-2][1],dp[i-3][0])+a[i]
      dp[i][2]=max(dp[i-2][2],dp[i-3][1],dp[i-4][0])+a[i]
  print(max(dp[n-1][2],dp[n-2][1],dp[n-3][0]))

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

int main(){
    int h,w;
    cin >> h >> w;
    char maze[h][w];
    rep(i,h){
        rep(j,w){
            char c;
            cin >> c;
            maze[i][j]=c;
        }
    }

    int dx[4]={1,0,-1,0};
    int dy[4]={0,1,0,-1};
    int ans=0;
    rep(a,h){
        rep(b,w){
            if(maze[a][b]=='#') continue;
            int si=a;
            int sj=b;
            int d[h][w];
            memset(d,-1,sizeof(d));
            d[si][sj]=0;
            queue<pair<int,int>> que;
            que.push(make_pair(si,sj));
            int mmax=0;

            while(!que.empty()){
                P p=que.front();
                que.pop();
                rep(i,4){
                    int nx=p.first+dx[i];
                    int ny=p.second+dy[i];

                    if(nx<0 || nx>=h || ny<0 || ny>=w || maze[nx][ny]=='#' || d[nx][ny]!=-1) continue;
                    d[nx][ny]=d[p.first][p.second]+1;
                    mmax=max(mmax,d[nx][ny]);
                    que.push(make_pair(nx,ny));
                }
            }
            //cout << mmax << endl;
            ans=max(ans,mmax);
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#define N 25
#define NIL -1

struct Node{
  int parent,left,right;
};
struct Node T[10000];
int n,D[10000],H[10000];
int setHeight(int);
void setDepth(int,int);
//節点uの兄弟を返す
int brosend(int);
void print(int);

int main(){
  int n,i,a,b,c;
  int root=0;
  scanf("%d",&n);
  for(i=0;i<n;i++)
    T[i].parent=NIL;
  for(i=0;i<n;i++){
    scanf("%d %d %d",&a,&b,&c);
    T[a].left=b;
    T[a].right=c;
    if(b!=NIL)T[b].parent=a;
    if(c!=NIL)T[c].parent=a;
  }
  for(i=0;i<n;i++){
    if(T[i].parent==NIL)
      root=i;
  }
  setDepth(root,0);
  setHeight(root);
  for(i=0;i<n;i++)
    print(i);
  return 0;
}
int setHeight(int k){
  int h1=0,h2=0;
  if(T[k].left!=NIL)
    h1=setHeight(T[k].left)+1;
  if(T[k].right!=NIL)
    h2=setHeight(T[k].right)+1;
  return H[k]=(h1>h2?h1:h2);
}
void setDepth(int k,int g){
  if(k==NIL) return;
  D[k]=g;
  setDepth(T[k].left,g+1);
  setDepth(T[k].right,g+1);
}
int brosend(int k){
  if(T[k].parent==NIL)
    return NIL;
  if(T[T[k].parent].left!=k&&T[T[k].parent].left!=NIL)
    return T[T[k].parent].left;
  if(T[T[k].parent].right!=k&&T[T[k].parent].right!=NIL)
    return T[T[k].parent].right;
  return NIL;
}
void print(int k){
  printf("node %d: ",k);
  printf("parent = %d, ",T[k].parent);
  printf("sibling = %d, ",brosend(k));
  int deg=0;
  if(T[k].left!=NIL)deg++;
  if(T[k].right!=NIL)deg++;
  printf("degree = %d, ",deg);
  printf("depth = %d, ",D[k]);
  printf("height = %d, ",H[k]);

  if(T[k].parent==NIL){
    printf("root\n");
  }
  else if(T[k].left==NIL&&T[k].right==NIL){
    printf("leaf\n");
  }
  else {
    printf("internal node\n");
  }
}
  
  



Measured memory_bytes: 2112
#include<stdio.h>
int main()
{
    int n,a,b,c;
    while(~scanf("%d",&n))
    {if(n>999||n<100)
            break;
        a=n/100;
        b=n%100/10;
        c=n%10;

        if(c==a)
            printf("Yes\n");
        else
            printf("No\n");

    }
    return 0;

}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main() {
  long N, A, B;
  cin >> N >> A >> B;
  long save, q, r;
  save = N / (A+B);
  q = A * save;
  r = min(N % (A+B), A);
  cout << q + r << endl;
  return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
 
#include <iostream>
#include <sstream>
#include <vector>
#include <iterator>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <utility>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <stdint.h>
#include <limits.h>
 
#define    pi          acos(-1)
#define    ll          long long
#define    mp          make_pair
#define    pb          push_back
#define    vi          vector <int>
#define    vs          vector <string>
#define    maxx(a,b,c) max(a,max(b,c))
#define    minn(a,b,c) min(a,min(b,c))
#define    all(x)      (x).begin(),(x).end()
#define    fill(x,y)   memset(x, y, sizeof(x))
#define    trace(x)    cout << #x << " = " << x << endl
#define    bug         cout << "Bug check" << endl
#define    eps         1e-10
#define    endl        '\n'
 
using namespace std;

int main(){
	//freopen("in.txt","r", stdin);
	//freopen("out.txt","w", stdout);
	
	ios::sync_with_stdio(0);
	cin.tie(0);

	set <int> s;
	for(int i=0;i<3;i++){
		int a;  cin >> a;
		s.insert(a);
	}
	puts(s.size()==2? "Yes" : "No");

 	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
  int n = 0;
  long long int x, y;
  long long int t;
  scanf("%lld %lld", &x, &y);
  t = x;
  while ( t <= y ) {
    t *= 2;
    n++;
  }
  printf("%d\n", n);

  return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
int main(void){
    int a[3], b[3];
    for(int i = 0; i < 3; i++){
        scanf("%d %d",&a[i],&b[i]);
    }
    int num[4] = {0};
    int ans = 1; //1 == true, 0 == false
    for(int i = 0 ; i < 3; i++){
        num[a[i]-1]++;
        num[b[i]-1]++;
    }
    for(int i = 0; i < 4; i++){
        if(num[i] < 3) ans = 1;
        else{ans = 0; break;}
    }

    if(ans == 1)printf("YES\n");
    else printf("NO\n");

    return 0;
}

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

int main() {
  int64_t X, K, D;
  cin >> X >> K >> D;
  int64_t Y;
  Y = abs(X);
  int64_t n;
  n = round(Y / D);
  
  if(n > K){
    if(X > 0){
      int64_t ans1 = abs(X - K * D);
      cout << ans1 << endl;
    }
    else{
      int64_t ans2 = abs(X + K * D);
      cout << ans2 << endl;
    }
  }
  else{
    if((K - n) % 2 == 1){
      if(Y - n * D > 0){
        int64_t ans3 = abs(Y - (n + 1) * D);
        cout << ans3 << endl;
      }
      else{
        int64_t ans4 = abs(Y - (n - 1) * D);
        cout << ans4 << endl;
      }
    }
    else{
      int64_t ans5 = abs(Y - n * D);
      cout << ans5 << endl;
    }
  }
}

Measured memory_bytes: 3616
n = int(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
from itertools import permutations
i = 0
for permu_lis in permutations(range(1, n + 1)):
  i += 1
  if list(permu_lis) == p:
    a = i
  if list(permu_lis) == q:
    b = i
print(abs(a - b))

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
constexpr int inf = 1000000010;
constexpr ll INF = 1000000000000000010;
constexpr ld eps = 1e-12;
constexpr ld pi = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }

constexpr ll mod = 998244353;
constexpr ll modsize = 1000010;
vector<ll> fac(modsize);
vector<ll> inv(modsize);
vector<ll> facinv(modsize);

void modcalc() {
	if (modsize == 0) abort();
	fac[0] = 1; fac[1] = 1; inv[1] = 1;
	facinv[0] = 1; facinv[1] = 1;
	for (ll i = 2; i < modsize; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		facinv[i] = facinv[i - 1] * inv[i] % mod;
	}
}

ll modinv(ll a) {
	if (a == 0) abort();
	ll b = mod, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= mod;
	if (u < 0) u += mod;
	return u;
}

ll modpow(ll a, ll b) {
	ll ans = 1;
	a %= mod;
	while (b) {
		if (b & 1) ans = ans * a % mod;
		a = a * a % mod;
		b >>= 1;
	}
	return ans;
}

ll modcomb(ll n, ll k) {
	if (n < 0 || k < 0 || n < k) return 0;
	return fac[n] * facinv[k] % mod * facinv[n - k] % mod;
}

ll modperm(ll n, ll k) {
	if (n < 0 || k < 0 || n < k) return 0;
	return fac[n] * facinv[n - k] % mod;
}

ll modhom(ll n, ll k) {
	if (n < 0 || k < 0 || n == 0 && k > 0) return 0;
	if (n == 0 && k == 0) return 1;
	return fac[n + k - 1] * facinv[k] % mod * facinv[n - 1] % mod;
}


signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	modcalc();

	ll n, k;
	cin >> n >> k;
	ll ans = 0;
	rep(i, k) {
		if (k - i >= i && k - i >= n) {
			if (i * 2 == k) ans += modcomb(k - 1, i) - modcomb(k - 1, k - n + 1);
			else ans += modcomb(k, i) - modcomb(k, 2 * k - 2 * i - n + 1);
		}
	}
	cout << (ans % mod + mod) % mod << '\n';
}

Measured memory_bytes: 23680
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=999999999999;

int main(){
    string s;
    cin>>s;
    int ans=700;
    for(int i=0;i<3;i++){
        if(s[i]=='o') ans+=100;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n)  FOR(i, 0, n)
#define ASC(c) sort((c).begin(), (c).end())
#define DESC(c) sort((c).begin(), (c).end(), greater<int>())

#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

typedef long long ll;
typedef unsigned long long ull;
struct edge { int u, v; ll w; };
 
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
    vector<vector<int> > a(4, vector<int>(4));
    vector<vector<int> > t(4, vector<int>(4, 0));

    FOR(i, 1, 4) {
        FOR(k, 1, 4) cin >> a[i][k];
    }

    int n; cin >> n;
    REP(_, n) {
        int b; cin >> b;
        FOR(i, 1, 4) FOR(k, 1, 4) if (a[i][k] == b) t[i][k] = 1;
    }
    if (t[1][1] + t[1][2] + t[1][3] == 3
        || t[2][1] + t[2][2] + t[2][3] == 3
        || t[3][1] + t[3][2] + t[3][3] == 3

        || t[1][1] + t[2][1] + t[3][1] == 3
        || t[1][2] + t[2][2] + t[3][2] == 3
        || t[1][3] + t[2][3] + t[3][3] == 3

        || t[1][1] + t[2][2] + t[3][3] == 3
        || t[1][3] + t[2][2] + t[3][1] == 3) cout << "Yes" << endl;
    else cout << "No" << endl;

}


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

#define st first
#define nd second
typedef long long LL;
typedef long double LLD;
typedef pair <int, int> PII;
typedef pair <LL, LL> PLL;

int main()
{   
    int n, k;
    scanf("%d %d", &n, &k);
    printf("%d", (n % k == 0) ? 0 : 1);

    return 0;
}

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

#define int long long
#define fi first
#define se second
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define yn(x) ((x) ? "YES" : "NO")

typedef pair <int, int> ii;
typedef pair <int, ii> iii;

const int siz = 5e1 + 10;
const int SIZ = 5e3 + 10;
const int mod = 1e9 + 7;
/*const*/ int maxx = 2e9;
const int MAXX = 1e18;
const string file = "1";

vector <vector <iii> > edges;
ii cha[siz]; /// coins receive, time waste
int dist[siz][5010]; /// current vertex, current coins
bool done[siz][5010]; /// same shjt

void Dijkstra(int s, int c) {
    priority_queue <iii, vector <iii>, greater <iii> > pq; /// minimum dist, current vertex, current coins
    memset(dist, 0x3f, sizeof(dist));
    pq.push(iii(dist[s][c] = 0, ii(s, c)));

    while (!pq.empty()) {
        int u, cur;
        tie(u, cur) = pq.top().se;
        pq.pop();

        if (done[u][cur]) {
            continue;
        }
        done[u][cur] = true;

        for (auto &x : edges[u]) {
            int v, ned, tim;
            v = x.fi;
            tie(ned, tim) = x.se;

            for (int i = 0; cur + cha[u].fi * i - ned < maxx; i++) {
                if (cur + cha[u].fi * i - ned >= 0) {
                    if (dist[v][cur + cha[u].fi * i - ned] > dist[u][cur] + tim + cha[u].se * i) {
                        dist[v][cur + cha[u].fi * i - ned] = dist[u][cur] + tim + cha[u].se * i;
                        pq.push(iii(dist[v][cur + cha[u].fi * i - ned], ii(v, cur + cha[u].fi * i - ned)));
                    }
                }
            }
        }
    }
}

int32_t main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

//    freopen ((file + ".inp").c_str(), "r", stdin);
//    freopen ((file + ".out").c_str(), "w", stdout);

    int n, m, s;
    cin >> n >> m >> s;

    edges.resize(n + 1);
    int mx = 0;
    for (int i = 1; i <= m; i++) {
        int u, v, a, b;
        cin >> u >> v >> a >> b;

        edges[u].push_back(iii(v, ii(a, b)));
        edges[v].push_back(iii(u, ii(a, b)));
        mx = max(mx, a);
    }

    for (int u = 1; u <= n; u++) {
        cin >> cha[u].fi >> cha[u].se;
    }

    maxx = mx * m + 1;
    Dijkstra(1, min(s, maxx));

    for (int u = 2; u <= n; u++) {
        int mn = MAXX;
        for (int i = 0; i < maxx; i++) {
            mn = min(mn, dist[u][i]);
        }

        cout << mn << "\n";
    }

//    cerr << "Time: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";

    return 0;
}


Measured memory_bytes: 202420
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#define rep(i,n) for (int i=0;i<n;i++)
using ll = long long;
using namespace std;


void solve(){

}
int main (){
    ios::sync_with_stdio(0);
    cin.tie(0);
    string s,t;
    int a,b;
    string u;
    cin >> s >> t >> a >> b >> u;
    if(u==s){
        a--;
    }
    else{
        b--;
    }
    cout << a << " " << b;
    return 0;
}

Measured memory_bytes: 3600
#include "bits/stdc++.h"
#define rep(i,b) for(ll i=0;i<b;i++)
#define ll long long
using namespace std;
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vvvl vector<vector<vector<ll>>>
#define debug(x) cerr<<#x<<" "<<x<<'\n';
bool cmp(pair<ll,ll> a, pair<ll,ll> b) { return a.second > b.second; }

int main(){
    ll n,a; cin>>n>>a;
    ll ans=1;
    rep(i,n-1){
        ans*=(a-1);
    }
    cout<<a*ans<<endl;
}

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

int main(){
    int n; cin >> n;
    int L[n];
    for(int i = 0; i < n; i++){
        cin >> L[i];
    }
    sort(L, L + n, greater<int>());
    int cnt = 0;
    for(int i = 0; i < n-2; i++){
        for(int j = i+1; j < n-1; j++){
            for(int k = j+1; k < n; k++){
                if(L[i] < L[j] + L[k]) {
                    cnt++;
                    //cout << L[i] << " " << L[j] << " " << L[k] << endl;
                }
                else break;
            }
        }
    }
    cout << cnt << endl;;
}

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

vector<string> split(const string &s, char delim) {
  vector<string> elems;
  stringstream ss(s);
  string item;
  while (getline(ss, item, delim)) {
    if (!item.empty()) {
      elems.push_back(item);
    }
  }
  return elems;
}

int largest(const vector<string> &ss) {
  int result = 0;
  for (const string & s : ss) {
    result = max(result, (int)s.size());
  }
  return result;
}

int main(void) {
  string s;
  cin >> s;

  int result = 999;
  for (int i = 0; i < 26; i++) {
    vector<string> part = split(s, i + 'a');
    result = min(result, largest(part));
  }

  cout << result << endl;
  return 0;
}

Measured memory_bytes: 3624
N, K = map(int, input().split(' '))
a= list(map(int, input().split(' ')))

INF = float('inf')
ans = INF

if N == K:
    ans = abs(a[N-1]-a[0])+min(abs(a[0]), abs(a[N-1]))
else:
    for i in range(N-K+1):
        ans = min(ans, abs(a[i+K-1]-a[i])+min(abs(a[i+K-1]), abs(a[i])))

print(ans)

Measured memory_bytes: 14224
n=int(input())
root = [[] for i in range(n)]
for i in range(n):
    a=int(input())
    root[i].append(a-1)


stack=[0]
count = 1
while len(stack):
    v = stack.pop()
    for i in root[v]:
        if i == 1:
            print(count)
            exit()
        count += 1
        stack.append(i)
        if count == 1000000:
            print(-1)
            exit()

print(-1)


Measured memory_bytes: 55840
#include <bits/stdc++.h>
using namespace std;
string s,st,p,c;
int n,L,R,k;

void setup()
{
    int i=0;
    st+=' ';

    while (st[i]!=' ')
        c+=st[i++];
    i++;
    while (st[i]!=' ')
        if (L==0) L=st[i++]-'0';
        else L=L*10+st[i++]-'0';
    i++;
    while (st[i]!=' ')
        if (R==0) R=st[i++]-'0';
        else R=R*10+st[i++]-'0';
    i++;
    if (c=="replace")
    {
        while (st[i]!=' ')
            p+=st[i++];
    }
}

int main()
{
    getline(cin,s);
    scanf("%d\n",&n);
    for(int i=1;i<=n;i++)
    {
        st.clear();p.clear();L=R=0;c.clear();
        getline(cin,st);
        setup();
        if (c=="print")
        {
            //cout<<s<<endl;
            for(int i=L;i<=R;i++) printf("%c",s[i]);
            printf("\n");
        }
        else
            if (c=="replace")
            {
                for(int i=0;i<p.size();i++)
                    s[L+i]=p[i];
              //  cout<<s<<endl;
            }
            else
            {
                int i=L,j=R;
               // cout<<i<<" * "<<j<<endl;
                while (i<j)
                {
                 //   cout<<i<<" "<<j<<endl;
                    swap(s[i++],s[j--]);
                }
            }
    }
}



Measured memory_bytes: 3276
using System;
using System.Collections.Generic;
using System.Linq;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            var AB = Io.ReadSplit<int>();
            var A = AB[0];
            var B = AB[1];

            var c = 1;
            var tapCount = 0;
            while (true)
            {
                if (c >= B) break;

                c = c - 1 + A;
                tapCount++;
            }

            Console.WriteLine(tapCount);
        }
    }

    class Io
    {
        public static string Read()
        {
            return Console.ReadLine();
        }

        public static IEnumerable<string> ReadRepeat(int count)
        {
            return Enumerable.Range(0, count).Select(_ => Read());
        }

        public static T Read<T>()
        {
            return (T)Convert.ChangeType(Read(), typeof(T));
        }

        public static IEnumerable<T> ReadRepeat<T>(int count)
        {
            return Enumerable.Range(0, count).Select(_ => Read<T>());
        }

        public static string[] ReadSplit(char devide = ' ')
        {
            return Read().Split(devide);
        }

        public static T[] ReadSplit<T>(char devide = ' ')
        {
            return ReadSplit(devide)
                .Select(s => (T)Convert.ChangeType(s, typeof(T)))
                .ToArray();
        }

        public static IEnumerable<T[]> ReadSplitRepeat<T>(int count, char devide = ' ')
        {
            return Enumerable.Range(0, count).Select(_ => ReadSplit<T>(devide));
        }
    }
}


Measured memory_bytes: 13524
a, b, k = [int(i) for i in input().split()]

for i in range(k):
    if i % 2 == 0:
        if a % 2 == 1:
            a -= 1
        a //= 2
        b += a
    else:
        if b % 2 == 1:
            b -= 1
        b //= 2
        a += b

print(a, b)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
//using namespace boost::multiprecision;
typedef long long int ll;
typedef long double ld;
#define MOD 1000000007
#define ALL(obj) (obj).begin(),(obj).end()
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 long long INF = 1LL << 60;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
bool pairCompareSecond(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.second < secondElof.second;
}
//四方向への移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

struct edge{//グラフに使うヤツ
    ll from,to,cost;
};

typedef vector<vector<edge> > G;
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}

int main(){
    ll a,b,c,k;
    cin >>  a >> b >> c >> k;
    while (b<=a){
        k--;
        b*=2;
    }
    while (c<=b){
        k--;
        c*=2;
    }
    if (k>=0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 3596
#include <stdio.h>

int main(void) 
{
	unsigned int i = 1;
	unsigned int x;
	
	for(i = 0; i <= 10000; i++)
	{
		scanf("%d", &x);
		if(x == 0)
		{
			break;
		}
		printf("Case %d: %d\n", i + 1, x);
	}
	return 0;
}

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

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

    int lmax = 0, rmin = 100001;
    for (int i = 0; i < M; i++) {
        int l, r; cin >> l >> r;
        lmax = max(lmax, l);
        rmin = min(rmin, r);
    }

    int out = rmin - lmax + 1;
    cout << (out > 0 ? out : 0) << endl;

    return 0;
}


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

#define F first
#define S second

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;

const int N = 100010, M = 110;

int n;
LL A, B;
LL a[N];

bool check(LL x)
{
	LL cnt = 0;
	for (int i = 1; i <= n; i ++ ) cnt += max(0LL, (a[i] - x * B + A - B - 1) / (A - B));
	return cnt <= x;
}

int main()
{
	scanf("%d%lld%lld", &n, &A, &B);
	for (int i = 1; i <= n; i ++ ) scanf("%lld", a + i);
	
	LL l = 0, r = 1e9;
	while (l < r)
	{
		int mid = l + r >> 1;
		if (check(mid)) r = mid;
		else l = mid + 1;
	}
	
	printf("%lld\n", r);
	return 0;
}

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

class Node:
    def __init__(self):
        self.parent_id = -1
        self.depth = 0
        self.children = []

def cal_depth (node,x):
    node.depth = x

    for children_id in node.children:
        cal_depth(nodes[children_id],x+1)


nodes = []
for i in range(n):
    nodes.append(Node())

for i in range(n):
    table = list(map(int,input().split()))
    node_id = table[0]
    num = table[1]

    for j in range(num):
        children_id = table[2+j]
        nodes[node_id].children.append(children_id)
        nodes[children_id].parent_id = node_id


for node in nodes:
    if node.parent_id == -1:
        cal_depth(node,0)
        break

for i in range(n):

    print("node %d: parent = %d, depth = %d, "%(i,nodes[i].parent_id,nodes[i].depth),end = "")

    if nodes[i].parent_id == -1:
        print("root,",end = "")
    else:
        if len(nodes[i].children) == 0: #葉
            print("leaf,",end = "")
        else: #節
            print("internal node,",end = "")

    print(" [",end = "")
    print(', '.join(map(str,nodes[i].children)),end = "")
    print("]")


Measured memory_bytes: 40708
#include <bits/stdc++.h>
using namespace std;
    int main(){
        int N;
            cin >> N;
                for(int i = 1; i <= 9; i++){
                    if(N <= i * 111){
                        cout << i*111 << endl;
                            return 0;
                    }
                }
    return 0;}


Measured memory_bytes: 256
local pi = math.pi
local mab = math.abs
local mfl = math.floor

local function comp(a, b)
  return a < b
end

local function lower_bound(ary, x)
  local num = #ary
  if num == 0 then return 1 end
  if not comp(ary[1], x) then return 1 end
  if comp(ary[num], x) then return num + 1 end
  local min, max = 1, num
  while 1 < max - min do
    local mid = mfl((min + max) / 2)
    if comp(ary[mid], x) then
      min = mid
    else
      max = mid
    end
  end
  return max
end

local function printformat(num)
  print(string.format("%.13f", num))
end
local sx, sy = io.read("*n", "*n")
local tx, ty = io.read("*n", "*n")
local m = io.read("*n")
if sx == tx then
  local f = false
  for i = 1, m do
    local x, y = io.read("*n", "*n")
    if x == sx and (sy - y) * (ty - y) < 0 then
      f = true
    end
  end
  local ret = mab(sy - ty) * 100
  if f then ret = ret - 20 + 10 * pi end
  printformat(ret)
  os.exit()
elseif sy == ty then
  local f = false
  for i = 1, m do
    local x, y = io.read("*n", "*n")
    if y == sy and (sx - x) * (tx - x) < 0 then
      f = true
    end
  end
  local ret = mab(sx - tx) * 100
  if f then ret = ret - 20 + 10 * pi end
  printformat(ret)
  os.exit()
end

local invmode = false
if tx < sx and ty < sy then
  sx, sy, tx, ty = tx, ty, sx, sy
elseif tx < sx then
  invmode = true
  sx, tx = -sx, -tx
elseif ty < sy then
  invmode = true
  sx, sy, tx, ty = tx, ty, sx, sy
  sx, tx = -sx, -tx
end
local t = {}
for i = 1, m do
  local x, y = io.read("*n", "*n")
  if invmode then x = -x end
  if sx <= x and x <= tx and sy <= y and y <= ty then
    table.insert(t, {x, y})
  end
end
local inf = 1000000007
local len = {}
for i = 1, #t do
  len[i] = inf
end
table.sort(t, function(a, b) return a[2] < b[2] end)
for i = 1, #t do
  local x = t[i][1]
  local lb = lower_bound(len, x)
  if x < len[lb] then
    len[lb] = x
  end
end
local fountain_count = 0
for i = 1, #t do
  if len[i] < inf then
    fountain_count = i
  else
    break
  end
end
local ret = (ty + tx - sy - sx) * 100
if fountain_count == 1 + math.min(tx - sx, ty - sy) then
  ret = ret - (fountain_count - 1) * (20 - 5 * pi) + 10 * pi - 20
else
  ret = ret - fountain_count * (20 - 5 * pi)
end
printformat(ret)

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

int main() {
  int N, L;
  cin >> N >> L;
  vector<string> words(N);
  for (int i = 0; i < N; i++) {
    cin >> words.at(i);
  }
  
  sort(words.begin(), words.end());
  for (int i = 0; i < N; i++) {
    cout << words.at(i);
  }
  
}



Measured memory_bytes: 256
while True:
    h,w = map(int,input().split())
    if w == 0 and h == 0:
        break
    for i in range(h):
        for j in range(w):
            if i != 0 and i!=h-1 and j != 0 and j != w-1:
                print('.',end='')
            else:
                print('#',end='')
        if i!=h:
            print()
    print()



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


// NOTE TO SELF // try to simplyfy the problem

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

#define ll long long int

//const int mod=1000000007;

using namespace std;




int main()
{

    ll n,W;
    cin>>n>>W;
    
    ll wt[n],val[n];
    rep(i,n)
    cin>>wt[i]>>val[i];
    
    
      ll K[n + 1][W + 1];
    
      // Build table K[][] in bottom up manner
      for (ll i = 0; i <= n; i++) {
          for (ll w = 0; w <= W; w++) {
              if (i == 0 || w == 0)
                  K[i][w] = 0;
              else if (wt[i - 1] <= w)
                  K[i][w] = max(
                      val[i - 1] + K[i - 1][w - wt[i - 1]],
                      K[i - 1][w]);
              else
                  K[i][w] = K[i - 1][w];
          }
      }
    
      cout<< K[n][W]<<endl;

}


Measured memory_bytes: 82332
n, k = list(map(int, input().split()))

mod = 10**9 + 7
k = min(k, n-1)

def choose(n, r):
    x = 1
    y = 1
    for i in range(1, r+1):
        x = (x * (n-i+1)) % mod
        y = (y * i) % mod
    return (x * pow(y, mod-2, mod)) % mod

kaijo = [1]
for i in range(1,n+1): 
  kaijo.append(kaijo[i-1]*i % mod)

ans = 0
for i in range(k+1):
#    ans += (choose(n, min(i,n-i)) * choose(n-1, min(i,n-1-i))) % mod
    ans += (kaijo[n] * pow(kaijo[i]*kaijo[n-i], mod-2,mod) % mod) * (kaijo[n-1]*pow(kaijo[i]*kaijo[n-1-i],mod-2,mod) % mod)
    ans = ans % mod
print(ans % mod)


Measured memory_bytes: 11052
#include <iostream>
#include <cmath>
typedef long long ll;

using namespace std;

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

  int dp[N - 1];
  dp[0] = 0;
  dp[1] = abs(h[0] - h[1]);

  if (N == 2) cout << dp[1];
  else {
    for (int i = 2; i < N; i++) {
      dp[i] = min(dp[i - 2] + abs(h[i - 2] - h[i]), dp[i - 1] + abs(h[i - 1] - h[i]));
    }
    cout << dp[N - 1];
  }
  
}


Measured memory_bytes: 1024
# -*- coding: utf-8 -*-
# AtCoder Beginner Contest


if __name__ == '__main__':
    n, m = list(map(int, input().split()))
    xyz = [list(map(int, input().split())) for i in range(n)]
    candidates = [0 for _ in range(8)]
    signs = [[1, 1, 1], [1, 1, -1], [1, -1, 1], [-1, 1, 1], [1, -1, -1], [-1, 1, -1], [-1, -1, 1], [-1, -1, -1]]

    for k in range(8):
        summed_xyz = [0 for _ in range(n)]
        i = 0

        for x, y, z in xyz:
            summed_xyz[i] = (x * signs[k][0]) + (y * signs[k][1]) + (z * signs[k][2])
            i += 1

        candidate = sorted(summed_xyz, reverse=True)
        candidates[k] = sum(candidate[:m])

    print(max(candidates))


Measured memory_bytes: 3404
a, b, c = map(int, input().split())
if a >= b >= c:
    print(c, b, a)
elif a >= c >= b:
    print(b, c, a)
elif b >= a >= c:
    print(c, a, b)
elif b >= c >= a:
    print(a, c, b)
elif c >= b >= a:
    print(a, b, c)
elif c >= a >= b:
    print(b, a, c)


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

using namespace std;

int main(){
	int n;
	int vis[200]={0};
	int k;
	cin>>n >>k;
	for(int i = 1;i <= k;i++)
	{
		int d;
		cin>>d;
		for(int j = 1;j <= d;j++)
		  {
		  	int x;
		  	cin>>x;
		  	vis[x]=1;
		  }
	}
	int ans = 0;
	for(int i =1;i <= n;i++)
	 if(!vis[i]) ans++;
	 cout<<ans<<endl;
}

Measured memory_bytes: 3604
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

int DP[105][10005];

int main() {
    int N, W;
    cin>>N>>W;
    int v[N], w[N];
    for(int i=0;i<N;++i){
        cin>>v[i]>>w[i];
    }
    for(int i=0;i<=W;++i){
        if(i>=w[0]) DP[0][i] = v[0];
    }
    for(int i=1;i<N;++i){
        for(int j=0;j<=W;++j){
            if(w[i]<=j){
                DP[i][j] = max(DP[i-1][j], DP[i-1][j-w[i]] + v[i]);
            }
            else DP[i][j] = DP[i-1][j];
        }
    }
    /**
    for(int i=0;i<N;++i){
        for(int j=0;j<=W;++j){
            cout<<DP[i][j]<<" ";
        }
        cout<<endl;
    }
    **/
    cout<<DP[N-1][W]<<endl;
}




Measured memory_bytes: 6996
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <queue>

typedef char                SINT8;
typedef unsigned char       UINT8;
typedef short               SINT16;
typedef unsigned short      UINT16;
typedef int                 SINT32;
typedef unsigned int        UINT32;
typedef long long           SINT64;
typedef unsigned long long  UINT64;
typedef double              DOUBLE;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))
#define rep(i,a,b) for(int (i)=int(a);(i)<int(b);(i)++)

#define INF 1000000001;
#define MOD 1000000007;
#define INF64 1000000000000000001;

#define F first
#define S second

#define Pii pair<SINT32,SINT32>
#define Pll pair<SINT64,SINT64>


using namespace std;

int main() {

	SINT32 N = 0;
	SINT32 ans = 0;

	cin >> N;

	vector<SINT32> UDATA(N);
	vector<SINT32> PUDATA(N);
	vector<SINT32> DDATA(N);
	vector<SINT32> PDDATA(N);

	
	rep(i,0,N) {
		cin >> UDATA[i];
	}
	PUDATA[0] = UDATA[0];
	rep(i,1,N) {
		PUDATA[i] += UDATA[i] + PUDATA[i-1];
	}

	rep(i,0,N) {
		cin >> DDATA[i];
	}
	PDDATA[0] = DDATA[0];
	rep(i,1,N) {
		PDDATA[i] += DDATA[i] + PDDATA[i-1];
	}

	PUDATA.insert(PUDATA.begin(), 0);
	PDDATA.insert(PDDATA.begin(), 0);

	rep(i,0,N) {
		ans = MAX(ans,PUDATA[i+1] + PDDATA[N]-PDDATA[i]);
	}

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

//	sort(DATA.begin(),DATA.end());
//	sort(DATA.begin(),DATA.end(),std::greater<SINT32>());
//	__gcd(ANS,DATA[i]);

//	DATA.emplace_back(BUF);	//後ろに追加

//  DATA.erase(std::unique(DATA.begin(), DATA.end()), DATA.end());	//ソート後に使用

//	DATA.insert(DATA.begin() + X, 0);	//X番目の要素に0を挿入


//	vector<vector<SINT32>> DP(N,vector<SINT32>(3));	//2次元配列

/*
	SINT32 M = 3;
	vector<pair<SINT32,SINT32>> DATA2(M);
	for (SINT32 i = 0; i < M; i++) {
		cin >> DATA2[i].first;
		cin >> DATA2[i].second;
	}
	sort(DATA2.begin(),DATA2.end());
	cout << DATA2[0].first << endl;
	cout << DATA2[0].second << endl;
*/

// 	vector<pair<int,pair<int,int>>> DATA(M);
//	cin >> DATA[i].first;
//	cin >> DATA[i].second.first;
//	cin >> DATA[i].second.second;


//		APOSI = lower_bound(ADATA.begin(),ADATA.end(),QDATA[i]) - ADATA.begin();	//key以上を探す
//		BPOSI = lower_bound(BDATA.begin(),BDATA.end(),QDATA[i]) - BDATA.begin();


/* 文字列回転
	string N;
	cin >> N;
	N = N[N.length()-1] + N.substr(0,N.length()-1);
*/
/* 文字列合成
	string N,M;
	cin >> N >> M;
	SINT64 ans = 0;
	ans = stoi(N+M);
*/



/* SET コンテナ
	set<SINT32> DATA;
	for (SINT32 i = 0; i < N; i++) {
		SINT32 buf;
		cin >> buf;
		DATA.insert(buf);
	}

	//全表示
    set<string>::iterator it; //  イテレータを用意
    for(it = DATA.begin(); it != DATA.end(); it++) {
        cout << *it << endl;
    }

	//N番目を一部表示
	set<string>::iterator it; //  イテレータを用意
	it = DATA.begin();
	rep (i,0,N) {
		it++;
	}
	cout << *it << endl;
*/

/* map
	map<string,SINT32> mp;
	SINT32 N = 0;
	SINT32 mx = 0;

	cin >> N;
	for (SINT32 i = 0; i < N; i++) {
		string s;
		cin >> s;
		mp[s]++;
	}
	for(auto it=mp.begin();it!=mp.end();it++) {
		mx=max(mx,it->second);
	}

*/

Measured memory_bytes: 256
import java.util.*;
import java.util.stream.Collectors;

public class Main {

    private static int MOD = 1_000_000_007;

    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        solve(scanner);
    }


    // int N = Integer.parseInt(scanner.nextLine());
    // int N = scanner.nextInt(), M = scanner.nextInt();
    // scanner.nextLine();
    // int[] n = Arrays.stream(scanner.nextLine().split(" ")).mapToInt(Integer::parseInt).toArray();
    static void solve(Scanner scanner) {
        int N = Integer.parseInt(scanner.nextLine());
        long[] n = Arrays.stream(scanner.nextLine().split(" "))
                .mapToLong(Long::parseLong).toArray();
        boolean allp = Arrays.stream(n).filter(x -> x < 0).count() % 2 == 0;
        long min = Arrays.stream(n).map(Math::abs).min().orElse(0);
        long total = Arrays.stream(n).map(Math::abs).sum();
        System.out.println(allp ? total : total - 2 * min);
    }

}


Measured memory_bytes: 55532
#include<cstdio>
#include<cmath>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;

int main()
{
	int n, k;
	int i;
	int cnt = 0;
	int input;

	scanf("%d %d", &n, &k);

	for (i = 0; i < n; i++)
	{
		scanf("%d", &input);

		cnt += (input >= k);
	}

	printf("%d\n", cnt);

	return 0;
}

Measured memory_bytes: 128