akhauriyash/Code-Regression huggingface dataset:
#![allow(unused_imports)]
#![allow(dead_code)]

use std::io::{ self, BufRead };
use std::iter::Iterator;
use std::cmp::*;
use std::collections::*;
use std::str;

fn sum(mut x: i64) -> i64 {
    let mut y = 0;
    while x > 0 {
        y += x % 10;
        x /= 10;
    }
    y
}

fn main() {
    let stdin = io::stdin();
    let mut cin = stdin.lock();

    let ss = cin.split(b'\n')
    .map(|s| s.unwrap()).take(3).collect::<Vec<_>>();
    let n = str::from_utf8(&ss[0]).unwrap().parse::<usize>().unwrap();

    let s = &ss[1];
    let t = &ss[2];

    let mut m = 0;
    for i in 0..(n+1) {
        if s[i..] == t[..(n-i)] {
            m = i;
            break;
        }
    }

    let ans = n + m;
    println!("{}", ans);
}

Measured memory_bytes: 4352
//
//  practise.h
//  c++practise
//
//  Created by Ubnit04 on 2015/06/10.
//
//
#include <iostream>

using namespace std;

void Solution()
{
    int n;
    
    cin>>n;
    
    while(n--)
    {
        float x1, y1;
        float x2, y2;
        float x3, y3;
        float x4, y4;
        
        cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
        
        float ab = (y2 - y1) / (x2 - x1); // when "y / x = " another line's data, it can be seen as parallel
        float cd = (y4 - y3) / (x4 - x3);
        
        if (ab == cd )
        {
            cout<<"YES"<<endl;
        }
        else
        {
            cout<<"NO"<<endl;
        }
    }
}

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

Measured memory_bytes: 1228
l=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51
]
k=int(input())
print(l[k-1])

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
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; }

#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;

int f(int N, vector<vector<int>> &v){
  priority_queue<int, vector<int>, greater<int>> MIN;

  int ret = 0;
  int cnt = 0;
  REP(i, N+1){
    for(int j : v[i]){
      cnt++;
      if(cnt <= i){
        ret += j;
        MIN.emplace(j);
      }else{
        if(!MIN.empty() && MIN.top() < j){
          ret += j-MIN.top();
          MIN.pop();
          MIN.emplace(j);
        }
        cnt--;
      }
    }
  }
  return ret;
}

void solve(){
  int N;
  cin >> N;

  int ans = 0;
  vector<vector<int>> vl(N+1), vr(N+1);
  REP(i, N){
    int K, L, R;
    cin >> K >> L >> R;

    int MIN = min(L, R);
    ans += MIN;
    L -= MIN; R -= MIN;
    if(L > 0) vl[K].emplace_back(L);
    else vr[N-K].emplace_back(R);
  }
  ans += f(N, vl)+f(N, vr);
  cout << ans << "\n";
}

signed main() {
  int T; 
  cin >> T;

  REP(i, T){
    solve();
  }

  return 0;
}


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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){
while(x->left!=NIL)
x=x->left;
return x;
}

Node treeMaximum(Node x){
while(x->right!=NIL)
x=x->right;
return x;

}

Node treeSearch(Node u, int k){
if(u == NIL || k == u->key) return u;
if (k < u->key)
return treeSearch(u->left, k);
else
return treeSearch(u->right, k);


}

Node treeSuccessor(Node x){
	Node y;
if (x->right != NIL)
return treeMinimum(x->right); // case 1
y = x->parent;
while (y != NIL && x == y->right) {
x = y;
y = y->parent;
}
return y; // case 2

}

void treeDelete(Node z){
	 Node y; // node to be deleted
	 Node x; // child of y
	 if (z->left == NIL || z->right == NIL)
   y=z;
else y =treeSuccessor(z);
 if (y->left != NIL)
     x = y->left;
 else
   x = y->right;
   
   if (x != NIL)
      x->parent = y->parent;
      
      if( y->parent == NIL)
root = x;

else if( y == y->parent->left)
     y->parent->left = x;
     
   else
    y->parent->right = x;
    
     if( y != z)
   z->key = y->key;


}



void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x!=NIL) {
  	y=x;
  	if(z->key < x->key) x = x->left;
  	else x = x->right;
  }
  	z->parent = y;
  	
  if (y == NIL) root =z;
  
  else if (z->key < y->key) y->left = z;

else y->right = z;



}

void inorder(Node u){
if(u==NIL) return;
inorder(u->left);
printf(" %d",u->key);
inorder(u->right);

}
void preorder(Node u){
if(u==NIL) return;
printf(" %d",u->key);
preorder(u->left);
preorder(u->right);

}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
     else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
  }
}
  return 0;
}



Measured memory_bytes: 20472
import           Data.Char
import qualified Data.ByteString.Char8 as B
import qualified Data.Vector.Unboxed   as U

main :: IO ()
main = do
  n <- readLn
  ps <- U.unfoldrN n (B.readInt . B.dropWhile isSpace) <$> B.getLine
  print $ solve ps

solve :: U.Vector Int -> Int
solve = U.length . U.filter id . (U.zipWith3 monotone <$> id <*> U.tail <*> U.drop 2)
  where
    monotone x y z
      | x < y && y < z = True
      | x > y && y > z = True
      | otherwise      = False

Measured memory_bytes: 508
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<string>
#include<functional>
#define rep(i,n,m) for(int i=(n);i<(int)(m);i++)
#define reps(i,n,m) for(int i=(n);i<=(int)(m);i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define fs first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define LB(a,x) lb(all(a), x) - a.begin()
#define UB(a,x) ub(all(a), x) - a.begin()
#define printfdouble(x) printf("%.20f\n",(x))
#define chartoint(c) (int)((c) - '0')
#define chartoll(c) (long long)((c) - '0')
#define MOD 1000000007
#define itn int
#define enld endl
#define ednl endl
#define icn cin
#define cotu cout
#define Endl endl
#define stirng string
using namespace std;
typedef long long ll;
const double pi = 3.141592653589793;
using Graph = vector<vector<int>>;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return 1;} return 0;}
template<class T> bool chmin(T &a, const T &b){if(b<a){a=b; return 1;} return 0;}
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

vector<pair<long long, long long>> prime_factorize(long long N) {
    vector<pair<long long, long long>> res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0;
        while (N % a == 0) {
            ++ex;
            N /= a;
        }
        res.push_back({a, ex});
    }
    if (N != 1) res.push_back({N, 1});
    return res;
}

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int N; cin >> N;
    ll ans = 0;
    reps(C,1,N-1){
        ll tmp = 1;
        auto v = prime_factorize(N-C);
        rep(i,0,SZ(v)){
            tmp *= (v[i].second+1);
        }
        ans += tmp;
    }
    cout << ans << enld;
    return 0;
}

Measured memory_bytes: 3644
#include "bits/stdc++.h"
using namespace std;
const int MAX = 700000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y) {
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}

int dp[100030] = {};
int f(int a) {
	if (a < 0) {
		return 10000000;
	}
	if (a == 0) {
		return 0;
	}
	if (dp[a] != 0) {
		return dp[a];
	}

	return dp[a] = min(f(a - 1)+1, min(f(a-6)+1,min(f(a-9)+1,min(f(a-36)+1,min(f(a-81)+1,min(f(a-216)+1,min(f(a-729)+1,min(f(a-1296)+1,min(f(a-6561)+1,min(f(a-7776)+1,min(f(a-59049)+1,f(a-46656)+1)))))))))));
}
int main() {
	int n;
	cin >> n;
	cout << f(n);
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)

int count(vector<string> S, int h, int w) {
  int c = 0;
  rep2(i, h - 1, h + 2) {
	if(i < 0 || i >= S.size()) continue;
	rep2(j, w - 1, w + 2) {
	  if(j < 0 || j >= S[i].size()) continue;
	  if(S[i][j] == '#') c++;
	}
  }
  return c;
}

int main() {
  int H, W;
  cin >> H >> W;
  vector<string> S;
  rep(i, H) {
	string s;
	cin >> s;
	S.push_back(s);
  }
  rep2(h, 0, H) {
	rep2(w, 0, W) {
	  if(S[h][w] == '#') continue;
	  int c = count(S, h, w);
	  S[h][w] = '0' + c;
	}
  }
  rep(i, H) {
	cout << S[i] << endl;
  }
}



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

int main(){
    int N,M;
    cin >> N >> M;
    int L[N],R[N];
    int LT,RT;
    for(int i=0; i<M; i++ ){
        cin >> L[i] >> R[i];
    }
    LT=1;
    RT=N;
    for(int i=0; i<M; i++){
        if(LT<=L[i]){
            LT = L[i];
        }
        if(RT>=R[i]){
            RT = R[i];
        }
        //cout << "LT RT " << LT << " " << RT << endl;
    }

    cout << max(RT-LT+1,0) << endl;

    return 0;
}

Measured memory_bytes: 1024
public class Main {
	public static void main(String[] age){
		int S = new java.util.Scanner(System.in).nextInt();
		int s=0, m=0, h=0;
		while(S>=3600){
			h++;
			S=S-3600;
		}
		while(S>=60){
			m++;
			S=S-60;
		}
		s=S;
		System.out.println(h + ":" + m + ":" + s);
	}
}

Measured memory_bytes: 26260
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

int dp[MAX_N];

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

    int a[n], b[n];
    rep(i,n)cin >> a[i] >> b[i];

    
    srep(i, 1, MAX_N)dp[i] = 1001001001;

    rep(i,n){
        rep(j,10001){
            dp[j+a[i]] = min(dp[j+a[i]], dp[j] + b[i]);
        }
    }

    int ans = 1001001001;

    srep(i,h,MAX_N)ans = min(ans, dp[i]);

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


Measured memory_bytes: 1024
#include<iostream>
#include<stack>
using namespace std;
int main(){
    string s;
    cin>>s;
    string result="";
    result+=s[0];
    int length=s.size()-2;
    stack<int>st;
    while(length!=0){
        st.push(length%10);
        length/=10;
    }
    while(!st.empty()){
        result+=st.top()+'0';
        st.pop();
    }
    result+=s[s.size()-1];
    cout<<result;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#include<iostream>
#include<stdio.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fr(i,j,n)   for(long long i=j;i<(n);++i)
#define bk(i,j,n)   for(long long i=j;i>=n;--i)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define endl "\n"
#define MOD 1000000007
#define debug1(x) cout<<#x<<" "<<x<<endl;
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;
#define srt(x) sort(x.begin(),x.end());
#define run ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ordered_set tree<ll , null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>

typedef long long ll;
ll modpower(ll a,ll b,ll c)
{
	ll res=1;
	while(b)
	{
		if(b&1LL)
			res=(res*a)%c;
		a=(a*a)%c;
		b>>=1;
	}
	return res;
}

vector<ll> adj[100005];
ll dp[100005];
ll in[100005],out[100005];
bool vis[100005];
void fun(ll src,ll lev)
{
    in[src]+=lev;
    vis[src]=1;
    for(auto it:adj[src])
    {
        if(!vis[it])
        {
            fun(it,lev+1);

            out[src]=max(out[it]+1,out[src]);
        }else{

        out[src]=max(out[it]+1,out[src]);
        }
    }
}

int main()
{
    run;
    ll n;
    cin>>n;
    ll m;
    cin>>m;
    fr(i,0,m)
    {
        ll a,b;
        cin>>a>>b;
        adj[a].pb(b);

    }
    fr(i,1,n+1)
    {
        if(!vis[i])
        {
            fun(i,0);
        }
    }
    ll ans=0;
    fr(i,0,n+1)
    {
        ans=max(ans,in[i]+out[i]);
    }
    cout<<ans;








}


Measured memory_bytes: 9856
#include <bits/stdc++.h>
// #include <iomanip>
#include <iostream>

using namespace std;

int main() {
  // 2
  // 6 5 2
  // 7 6
  int n;
  // scanf("%d", &n);
  cin >> n;

  vector<int> a(n + 1);
  for (int i = 0; i < n + 1; i++) {
    // scanf("%d", &a[i]);
    cin >> a[i];
  }

  vector<int> b(n + 1);
  for (int i = 0; i < n; i++) {
    // scanf("%d", &b[i]);
    cin >> b[i];
  }
  b[n] = 0;

  long r = 0;
  for (int i = 0; i < n; i++) {
    int m1 = min(a[i], b[i]);
    int m2 = min(a[i + 1], b[i] - m1);
    r += (m1 + m2);
    a[i + 1] -= m2;
  }
  cout << r;
}


Measured memory_bytes: 1024
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 main() {
    input! {
        c1: chars,
        c2: chars,
    }
    let mut ret = true;
    for i in 0..3 {
        if c1[i] != c2[2-i] {
            ret = false;
        }
    }
    println!("{}", if ret { "YES" } else { "NO" });
}


Measured memory_bytes: 4352
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {n: usize};

    let mut max = 0;
    let mut result = 1;

    for i in 1..n + 1 {
        if i % 2 == 1 {
            continue;
        }

        let mut r = i;
        let mut count = 0;

        while r >= 2 {
            r /= 2;
            count += 1;
        }

        if count > max {
            max = count;
            result = i;
        }
    }

    println!("{}", result);
}


Measured memory_bytes: 2148
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Program {
    static void Main(string[] args) {
        //入力
        long N = long.Parse(Console.ReadLine());
        string[] s = new string[N];
        string[] joinString = new string[N];
        for (long i = 0; i < N; i++) {
            s[i] = Console.ReadLine();
            var list = new List<char>();
            for (int a = 0; a < 10; a++) {
                list.Add(s[i][a]);
            }
            list.Sort();
            joinString[i] = string.Join("", list);
        }

        //カウンタ
        long counter = 0;

        //検証
        var sortedList = joinString.ToList().GroupBy(x => x).Select(g => new { number = g.Key, duplicationCount = g.Count() }).ToList();
        var sortedList_ordered = sortedList.OrderByDescending(g => g.duplicationCount).Where(g => g.duplicationCount >= 2).ToArray();

        for (long i = 0; i < sortedList_ordered.Count(); i++) {
            counter += sortedList_ordered[i].duplicationCount * (sortedList_ordered[i].duplicationCount - 1L) / 2L;
        }
        
        //出力
        Console.WriteLine(counter);
    }
}

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

int main() {
    long long int a,b,c[3],tmp[3],ans;
    cin>>a>>b>>c[0]>>c[1];
    c[2]  =c[0]/__gcd(c[0],c[1])*c[1];
    for(int i=0;i<3;++i){
        tmp[i]=b/c[i]-(a-1)/c[i];
    }
    
    ans=b-a+1-(tmp[0]+tmp[1]-tmp[2]);
    cout<<ans<<endl;
	return 0;
}

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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; i++) cin >> a[i];
  int ans = 0;
  while(true){
    for(int i=0;i<n;i++){
      if(a[i]%2!=0){
        cout<<ans<<endl;
        return 0;
      }
    }
    for(int i=0;i<n;i++){
      a[i]/=2;
    }
    ans++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3580
a=[[j for j in input().split()] for _ in range(3)]
n=int(input())
b=[input() for i in range(n)]
ans=[[0 for i in range(3)] for j in range(3)]
for i in range(3):
    for j in range(3):
        if a[i][j] in b:
            ans[i][j]=1
flg=False
for i in range(3):
    if all([ans[i][j]==1 for j in range(3)]):
        flg=True
    if all([ans[j][i]==1 for j in range(3)]):
        flg=True
if all([ans[i][i]==1 for i in range(3)]):
    flg=True
if all([ans[i][2-i]==1 for i in range(3)]):
    flg=True
    
print('Yes' if flg else 'No')

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
#include<stack>
#include<numeric>
#include<tuple>
using namespace std;


typedef pair<int, int> P;
typedef long long ll;

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

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



int main(){
	
	int n;
	cin >> n;
	vector<int> a(n);
	vector<vector<int> > x(n), y(n);

	int ans = 0;

	rep(i, n){
		cin >> a[i];
		rep(j , a[i]){
			int xx, yy;
			cin >> xx >> yy;
			xx--;
			x[i].push_back(xx);
			y[i].push_back(yy);
		}
	}

	for (int bit = 0; bit < (1<<n); ++bit) {
		bool ok = true;
		int score = 0;
		for(int i = 0; i < n && ok; ++i){
			if((bit & (1 << i)) <= 0)	continue;
			for(int j = 0; j < a[i] && ok; ++j){
				int xx = x[i][j];
				int yy = y[i][j];
				if((bool)(bit & (1 << xx)) != (bool)yy)	ok = false;
			}
		}
		if(ok){
			rep(i, n){
				if(bit & (1 << i))	score++;
			}
		}
		ans = max(ans, score);

	}

	cout << ans << endl;


}

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

int main(){
  int n,m;

  while(cin>>n>>m){
    int res = 0;

    for(int i=0;i<n;i++){
      int cnt = 0;
      for(int j=0;j<m;j++){
        int x;
        cin>>x;
        cnt += x;
      }
      res = max(res,cnt);
    }

    cout<<res<<endl;
  }
}

Measured memory_bytes: 0
#include<stdio.h>
#define ll long long
int main(){
    ll k, a, b, c;
    scanf("%lld%lld%lld%lld",&a,&b,&c,&k);
    ll ans;
    if(k <= a){
        ans = k;
    }
    else{
        if(k < a + b){
            ans = a;
        }
        else{
            ll p = k - a - b;
            ans = a - p;
        }
    } 
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 1728
h,w = map(int, input().split())		# 5 7

##パターン1
#M = list( list(input()) for _ in range(h) )


m=['.']*(w+2)
M=[]
M.append(m)
for i in range(h):
	s = '.' + input() + '.'
	M.append(list(s))
M.append(m)

#print(M)


for x in range(1,h+1):
	for y in range(1,w+1):
		#print(M[x][y], end="")
		if M[x][y]=='.': continue
		
		b=False
		b=b or (M[x-1][y]=='#')
		b=b or (M[x+1][y]=='#')
		b=b or (M[x][y-1]=='#')
		b=b or (M[x][y+1]=='#')
		
		if b==False:
			print('No')
			exit(0)


print('Yes')







Measured memory_bytes: 3064
#include <bits/stdc++.h>
    using namespace std;
     
    int main() {
      int ColorP, ColorW, ColorG, ColorY;
      ColorP = 0;
      ColorW = 0;
      ColorG = 0;
      ColorY = 0;
      int loop, sum, i;
      string arare;
      cin >> loop;
      for (i=1;i<=loop;i++){
          cin >> arare;
          if (arare == "P") {
             ColorP = 1;
          }
          if (arare == "W") {
              ColorW = 1;
          }
          if (arare == "G") {
              ColorG = 1;
          }
          if (arare == "Y") {
              ColorY = 1;
          }
      }

      sum = ColorP + ColorW + ColorG + ColorY;
      if (sum == 3) {
          cout << "Three" << endl;
      } else {
          cout << "Four" << endl;
      }
    }

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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

ll A[105];

int main() {
    ll N;
    cin >> N;
    REP(i, N) {
        cin >> A[i];
    }

    ll num = 0;
    REP(i, N) {
        ll mi = i;
        FOR(j, N, i + 1) {
            if (A[j] < A[mi])
                mi = j;
        }
        if (mi != i)
            num++;
        swap(A[i], A[mi]);
    }

    REP(i, N - 1) {
        cout << A[i] << " ";
    }
    cout << A[N - 1] << endl;
    cout << num << endl;
    return 0;
}


Measured memory_bytes: 3104
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();

		boolean[][] card_52;
		card_52 = new boolean[4][13];

		for (int i = 0; i < n; i++) {
			String SHCD = scan.next();
			int num1_13 = scan.nextInt();

			if (SHCD.equals("S")) {
				card_52[0][num1_13 - 1] = true;

			} else if (SHCD.equals("H")) {
				card_52[1][num1_13 - 1] = true;

			} else if (SHCD.equals("C")) {
				card_52[2][num1_13 - 1] = true;

			} else if (SHCD.equals("D")) {
				card_52[3][num1_13 - 1] = true;

			}

		}

		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 13; j++) {
				if (i == 0) {
					if (card_52[0][j] == false) {
						System.out.println("S" + " " + (j + 1));
					}

				}
				if (i == 1) {
					if (card_52[1][j] == false) {
						System.out.println("H" + " " + (j + 1));
					}

				}
				if (i == 2) {
					if (card_52[2][j] == false) {
						System.out.println("C" + " " + (j + 1));
					}

				}
				if (i == 3) {
					if (card_52[3][j] == false) {
						System.out.println("D" + " " + (j + 1));
					}

				}

			}

		}

	}

}

Measured memory_bytes: 26368
s = STDIN.gets

aa, bb = s.scan(/.{2}/).map(&:to_i)

if (0 < aa && aa < 13) && (0 < bb && bb < 13)
  puts 'AMBIGUOUS'
elsif 0 < aa && aa < 13
  puts 'MMYY'
elsif 0 < bb && bb < 13
  puts 'YYMM'
else
  puts 'NA'
end

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

int main() {
    long long n;
    cin >> n;
    long long t[n],a[n];
    long long tt=1,aa=1;
    long long m;
    for(long long i=0;i<n;i++){
        cin >> t[i] >> a[i];
        m=max((tt+t[i]-1)/t[i],(aa+a[i]-1)/a[i]);
        tt=m*t[i];
        aa=m*a[i];
    }
    cout << tt+aa << endl;
}

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

using namespace std;

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

#define F first
#define S second
#define PB push_back
#define MK make_pair
#define REP(i, a, b) for (int i=a; i < b; i++)


bool sort_by(pi c, pi d){
	return c.S < d.S;
}

int main() {
	int h, w;
	cin >> h >> w;
	char grid[h][w];
	vector<bool> rows(h, false);
	vector<bool> cols(w, false);
	string c;
	
	REP(i, 0, h){
		cin >> c;
		REP(j, 0, w){
			rows[i] = (c[j]=='#'?true:rows[i]);
			cols[j] = (c[j]=='#'?true:cols[j]);
			grid[i][j] = c[j];
		}
	}
	
	REP(i, 0, h){
		if(!rows[i]) continue;
		REP(j, 0, w){
			if(cols[j]) cout << grid[i][j];
		}
		cout << endl;
	}
			
	
				

}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <tuple>
#include <stdio.h>
#include <bitset>
#include <limits.h>
#include <complex>
#include <deque>
#include <iomanip>
#include <list>
#include <cstring>
using namespace std;
#define pi pair<int,int>
#define pl pair<long long,long long>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define en cout << endl //セミコロンつけろ
//#define MM 1000000000
//#define MOD MM+7
typedef long long ll;
const int MM = 1e9;
const int MOD = MM+7;
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1,0,1,0,-1,-1,1,1};
int dy[8] = {0,-1,0,1,-1,1,1,-1};
// 'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122
template<typename T>
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
template<typename T>
T LCM(T x,T y){
    T gc = GCD(x,y);
    return x*y/gc;
}
struct edge {
    ll to,cost;
};

/*
const int COM_MAX = 500500;
long long fac[COM_MAX],finv[COM_MAX],inv[COM_MAX];
void init(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < COM_MAX; i++){
        fac[i] = fac[i-1]*i%MOD;
        inv[i] = MOD - inv[MOD%i]*(MOD/i)%MOD;
        finv[i] = finv[i-1]*inv[i]%MOD;
    }
}
long long COM(int n,int k){
    if(n < k || n < 0 || k < 0) return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
*/

int main(){
    int H,W; cin >> H >> W;
	char s[55][55];
	int num = 0;
	int dist[55][55];
	for (int i = 0; i < H; i++){
		for (int j = 0; j < W; j++){
			cin >> s[i][j];
			if (s[i][j] == '#'){
				num++;
			}
			dist[i][j] = MM;
		}
	}

	queue<pair<int,int> > que;
	//cout << "num = " << num << endl;
	que.push({0,0});
	dist[0][0] = 0;
	while (que.size()){
		pair<int,int> now = que.front();
		que.pop();
		for (int i = 0; i < 4; i++){
			int ny = now.first + dy[i];
			int nx = now.second + dx[i];
			if (dist[ny][nx] > dist[now.first][now.second] + 1 && s[ny][nx] == '.' && 0 <= ny && ny < H && 0 <= nx && nx < W){
				dist[ny][nx] = dist[now.first][now.second] + 1;
				que.push({ny,nx});
			}
		}
	}
	//cout << dist[H-1][W-1] << endl;
	if (dist[H-1][W-1] == MM){
		cout << -1 << endl;
		return 0;
	}
	cout << H*W - num - dist[H-1][W-1] - 1 << endl;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
constexpr double EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max()/2;
constexpr int MOD = 1e9+7;

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

    int n;cin>>n;
    vector<ll> a(n);
    for(int i=0;i<n;i++) cin>>a[i];
    sort(a.begin(),a.end());
    cout<<a[n-1]-a[0]<<endl;
}


Measured memory_bytes: 256
import Data.List

solve :: Int -> [Int] -> Int
solve n [] = n
solve n l
  | 0 /= getIndex l = solve (n+1) $ change l $ getIndex l
  | otherwise = solve n (tail l)
  where
    getIndex l = (\(Just x) -> x) $ elemIndex (minimum l) l
    change l i = tail $ (take i l) ++ [head l] ++ drop (i + 1) l
main = do
  list <- fmap (map read . tail . words) getContents
  putStrLn $ unwords $ map show $ sort $ list
  print $ solve 0 list



Measured memory_bytes: 4060
def examE():
    H, W = LI()
    A = [LI() for _ in range(H)]
    B = [LI() for _ in range(H)]
    Diff = [[0] * W for _ in range(H)]
    M = 0
    for i in range(H):
        for j in range(W):
            m = abs(A[i][j] - B[i][j])
            Diff[i][j] = m
            M += m
    dp = [[0] * (W + 1) for _ in range(H + 1)]
    dp[0][0] |= (1 << Diff[H-1][W-1])
    for i in range(H):
        for j in range(W):
            here = dp[i][j]
            s = Diff[i][j]
            ni = (here << s) | (here >> s)
            ex = 0
            #溢れる分
            for k in range(1, s + 1):
                if (here >> k) & 1:
                    ex |= (1 << (s - k))
            dp[i + 1][j] |= (ni | ex)
            dp[i][j + 1] |= (ni | ex)
#            print(s,ni,here,ex,dp[i+1][j])

    a = dp[H - 1][W - 1]
    ans = 0
    for k in range(M + 1):
        if (a >> k) & 1:
            ans = k
            break
    print(dp)
    print(ans)
    return

def examE2():
    H, W = LI()
    A = [LI() for _ in range(H)]
    B = [LI() for _ in range(H)]
    dp = [0]*(H*W)
    cur = abs(A[0][0] - B[0][0])
    dp[0] |= (1 << cur)
    for i in range(H):
        for j in range(W):
            now = dp[i*W + j]
            if i < H - 1:
                cur = abs(A[i + 1][j] - B[i + 1][j])
                ni = (now << cur) | (now >> cur)
                ex = 0
                for k in range(1, cur + 1):
                    if (now >> k) & 1:
                        ex |= (1 << (cur - k))
                dp[(i+1)*W +j] |= (ni | ex)
            if j < W - 1:
                cur = abs(A[i][j + 1] - B[i][j + 1])
                ni = (now << cur) | (now >> cur)
                ex = 0
                for k in range(1, cur + 1):
                    if (now >> k) & 1:
                        ex |= (1 << (cur - k))
                dp[i*W +j+1] |= (ni | ex)
    #print(dp[-1])
    ans = inf
    for i,f in enumerate(str(bin(dp[-1]))[::-1]):
        if f=="1":
            ans = i
            break
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
alphabet = [chr(ord('a') + i) for i in range(26)]

if __name__ == '__main__':
    examE2()


Measured memory_bytes: 58716
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 20, M = (1 << 16);

#define inc(i, x, y) for (int i = x; i <= y; ++i)
#define dec(i, x, y) for (int i = x; i >= y; --i)
#define gc getchar

bool chkmin(int &x, int y) { return x > y ? x = y, 1 : 0; }
bool chkmax(int &x, int y) { return x < y ? x = y, 1 : 0; }

int rd() {
	int ret = 0; bool fl = 0; char ch = 0;
	while (!isdigit(ch)) fl |= (ch == '-'), ch = gc();
	while (isdigit(ch)) ret = (ret << 1) + (ret << 3) + (ch ^ 48), ch = gc();
	return fl ? -ret : ret;
}

int dp[M][N], e[N][N], g[M];

int main() {
	int n = rd() - 1, m = rd(), S = (1 << n + 1) - 1, sum = 0;
	memset(dp, -1, sizeof(dp));
	inc(i, 1, m) {
		int u = rd() - 1, v = rd() - 1, w = rd();
		e[u][v] = e[v][u] = w;
		sum += w;
	}
	inc(i, 3, S) {
		inc(j, 0, n) if ((i >> j) & 1) inc(k, 0, n) if ((i >> k) & 1) g[i] += e[j][k];
		g[i] >>= 1; 
	} 
	dp[1][0] = 0;
	inc(i, 1, S) inc(j, 0, n) {
		if (dp[i][j] == -1) continue;
		inc(k, 0, n) {
			if ((i >> k) & 1) continue;
			if (e[j][k] == 0) continue;
			chkmax(dp[i | (1 << k)][k], dp[i][j] + e[j][k]);
		}
		int zj = (S ^ i) | (1 << j);
		for (int k = zj; k; k = (k - 1) & zj) 
			chkmax(dp[i | k][j], dp[i][j] + g[k]);
	}
	int ans = sum;
	inc(i, 0, S) chkmin(ans, sum - dp[i][n]);
	printf("%d\n", ans);
}


Measured memory_bytes: 5504
#include <iostream>
using namespace std;
int main() {
    string s;
    cin>>s;
    if(s=="SUN")cout<<7;
    else if(s=="MON")cout<<6;
    else if(s=="TUE")cout<<5;
    else if(s=="WED")cout<<4;
    else if(s=="THU")cout<<3;
    else if(s=="FRI")cout<<2;
    else if(s=="SAT")cout<<1;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define endl '\n'
#define D(x) cerr << #x << " = " << (x) << '\n'
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
typedef long long ll;

const int N = 1e6 + 5;

int n;
int a[N];
vector<int> d[N];
int cnt[N];

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

  for(int i = 1; i < N; i++) {
    for(int j = i; j < N; j += i) {
      d[j].push_back(i);
    }
  }

  cin >> n;
  int g = 0;
  int mn = 1e9;
  for(int i = 0; i < n; i++) {
    cin >> a[i];
    mn = min(mn, a[i]);
    g = __gcd(g, a[i]);
    for(int di : d[a[i]]) {
      cnt[di]++;
    }
  }
  bool pairwise = true;
  for(int i = 2; i < N; i++) {
    if(cnt[i] > 1) {
      pairwise = false;
    }
  }
  if(pairwise) cout << "pairwise coprime" << endl;
  else if(g == 1) cout << "setwise coprime" << endl;
  else cout << "not coprime" << endl;
  return 0;
}


Measured memory_bytes: 125524
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val s = sc.next()
    val t = sc.next()
    println(problem082b(s, t))
}

fun problem082b(s: String, t: String): String {
    val sD = s.toList().sorted()
    val tD = t.toList().sortedDescending()
    return if (sD.joinToString() < tD.joinToString()) "Yes" else "No"
}

Measured memory_bytes: 34120
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>
#include <random>



using namespace std;
using ll = long long;
using ull = unsigned long long;

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

#define REP(i, n) for(ll i = 0; i < n; i++)















int main(){
    ll r;
    cin >> r;
    cout << r * r << endl;
}

Measured memory_bytes: 256
include Math
$memo=[]
$path=[Float::INFINITY,[]]

#4 2 5
#1 2 5 7

def solve(data,town)
	vis=data[0]
	wk=data[1]
	tl=data[2]
	search(0,town[0],0,wk,tl,town,vis)
end



def search(w,c,v,wk,tl,town,vis)
	(1..town.length-1).each do |i|
		walk=(town[i]-c)*wk
		w+= walk<=tl ? walk : tl
		c=town[i]
		#p [c,w,town[i]]
	end
	p w
end


if __FILE__==$0
	reads_i=lambda{|s,d|s.strip.split(d).map(&:to_i)}
	reads_s=lambda{|s,d|s.strip.split(d)}
	read_i=lambda{|s|s.strip.to_i}
	read_s=lambda{|s|s.strip}
	dl=" "
	data=reads_i[gets,dl]
	pos=reads_i[gets,dl]
	solve(data,pos)
end

Measured memory_bytes: 9484
import java.io.*;
import java.math.*;
import java.util.*;

public class Main {
    private static boolean debug = false;
    private static boolean elapsed = false;

    private static PrintWriter _out = new PrintWriter(System.out);
    private static PrintWriter _err = new PrintWriter(System.err);

    private void solve(Scanner sc) {
        int H = sc.nextInt();
        int W = sc.nextInt();

        long r1 = calc(H, W);
        long r2 = calc(W, H);
        _out.println(Math.min(r1, r2));
    }
    private long calc(long w, long h) {
        if (w % 3 == 0 || h % 3 == 0) {
            return 0;
        }

        long res = Long.MAX_VALUE;
        for (long i = h / 3; i <= h / 2; ++i) {
            {
                long a1 = i * w;
                long a2 = ((h - i) / 2) * w;
                long a3 = (h - i - ((h - i) / 2)) * w;
                long max = Math.max(a1, Math.max(a2, a3));
                long min = Math.min(a1, Math.min(a2, a3));
                res = Math.min(res, max - min);
            }
            {
                long a1 = i * w;
                long a2 = (h - i) * (w / 2);
                long a3 = (h - i) * (w - w / 2);
                long max = Math.max(a1, Math.max(a2, a3));
                long min = Math.min(a1, Math.min(a2, a3));
                res = Math.min(res, max - min);
            }
        }
        return res;
    }
    private static BigInteger C(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        for (long i = r; i > 1; --i) {
            res = res.divide(BigInteger.valueOf(i));
        }
        return res;
    }
    private static BigInteger P(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        return res;
    }
    /*
     * 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9
     * 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18
     */
    public static void main(String[] args) {
        long S = System.currentTimeMillis();

        Scanner sc = new Scanner(System.in);
        new Main().solve(sc);
        _out.flush();

        long G = System.currentTimeMillis();
        if (elapsed) {
            _err.println((G - S) + "ms");
        }
        _err.flush();
    }
}

Measured memory_bytes: 23764
from collections import Counter

H, W = map(int,input().split())
A = ""
for _ in range(H): A += input()
C_A = Counter(A)
g1 = (H*W)%2
g2 = (H%2)*(W//2) + (W%2)*(H//2)
g4 = (H//2)*(W//2)
g1_est = 0; g2_est = 0; g4_est = 0;

for n in C_A.values():
    g4_est += n//4
    g2_est += (n%4)//2
    g1_est += n%2
if g4_est>=g4:
    g2_est += 2*(g4_est - g4)
    if g2==g2_est and g1==g1_est:
        print("Yes")
        exit()
print("No")


Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
constexpr int64_t mod=1e9+7;

int main()
{
  int64_t n,sum_a=0,sum_b=0;
  cin>>n;
  vector<int64_t> a(n),b(n);
  for (int i = 0; i < n; ++i)
  {
    cin>>a[i];
    sum_a+=a[i];
  }
  for (int i = 0; i < n; ++i)
  {
    cin>>b[i];
    sum_b+=b[i];
  }
  if(sum_b>sum_a){
    cout<<-1;
    return 0;
  }
  int64_t s=0;
  int64_t cnt=0;
  std::vector<int64_t> vec;
  for (int i = 0; i < n; ++i)
  {
    if(a[i]<b[i]){
      cnt++;
      s+=b[i]-a[i];
    }
    else{
      vec.emplace_back(a[i]-b[i]);
    }
  }
  if(cnt==0){
    cout<<0;
    return 0;
  }
  sort(vec.begin(), vec.end(),greater<int64_t>());
  int64_t tmp=0;
  for(auto&& e: vec) {
    tmp+=e;
    cnt++;
    if(tmp>=s) break;
  }
  cout<<cnt;
}

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	vector<vector<int>>c(3,vector<int>(3));
	for(auto&i:c)for(auto&j:i)cin>>j;
	vector<int>a(3),b(3); a.front()=0;
	for(int i=0;i<3;++i)b.at(i)=c.at(i).at(0)-a.at(0);
	for(int i=0;i<3;++i)a.at(i)=c.at(0).at(i)-b.at(0);
	bool yes=true;
	for(int j=0;j<3;++j){
		for(int i=0;i<3;++i){
			if(c.at(j).at(i)!=a.at(i)+b.at(j)){
				yes=false;
			}
		}
	}
	cout<<(yes?"Yes"s:"No"s)<<"\n"s;
}

Measured memory_bytes: 256
#include <math.h>
#include <assert.h>

#include <vector>
#include <numeric>
#include <iostream>
#include <algorithm>
#include <functional>

template <typename T>
void in(T& x) {
    std::cin >> x;
}

template <typename T>
void out(const T H) {
    std::cout << (H);
}

template <typename T1, typename... T2>
void out(const T1 H, const T2... T) {
    std::cout << (H) << " "; out(T...);
}

template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, const std::pair<T1, T2>& v) {
    return os << v.first << " " << v.second;
}

template <typename T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& v) {
    int n = (int) v.size();
    for (int i = 0; i < n - 1; ++i) os << v[i] << ' ';
    return os << v[n - 1];
}

template <typename T>
void eout(const char *s, const T H) {
    std::cerr << s << "=" << H << "\n";
}

template <typename T1, typename... T2>
void eout(const char *s, const T1 H, const T2... T) {
    while (*s != ',') std::cerr << *s++;
    std::cerr << "=" << H << " | "; eout(++s, T...);
}

#define nl                std::cout << "\n"
#define err(args...)      eout(#args, args)

#define inn(x)            int x; in(x)
#define rep(i, n)         for (int i =  0 ; i < (n); ++i)
#define per(i, n)         for (int i = (n) - 1; i > -1; --i)
#define repr(i, l, r)     for (int i = (l); i < (r); ++i)

#define sz(v)             ((int) v.size())
#define all(v)            (v).begin(), (v).end()
#define lla(v)            (v).rbegin(), (v).rend()

#define no                std::cout << "NO\n"
#define yes               std::cout << "YES\n"

const int INF           = 2147483647;
const long long int LNF = 9223372036854775807LL;

using ll  = long long int;
using vi  = std::vector<int>;
using vb  = std::vector<bool>;
using ii  = std::pair<int, int>;
using iii = std::pair< ii, int>;
using vii = std::vector<ii>;

const int N  = 505050;
const int MD = 1000*1000*1000 + 7;

int solve();
int main() {
    std::ios_base::sync_with_stdio(0); std::cin.tie(0);
    //std::cout.tie(0);

    //inn(t); repr(tc, 1, t + 1)
    solve();

    return 0;
}

int solve() {
    inn(k); inn(x);
    repr(i, x - k + 1, x + k) out(i, ' ');
    return 0;
}


Measured memory_bytes: 256
using System;

namespace AtCoder.ABC._102
{
    class b
    {
        static void Main(string[] args)
        {
            var line = Console.ReadLine().Trim();
            var N = int.Parse(line);
            line = Console.ReadLine().Trim();
            var A = Array.ConvertAll<string, int>(line.Split(' '), new Converter<string, int>(s => int.Parse(s)));
            Array.Sort(A);
            Console.WriteLine(A[N - 1] - A[0]);
        }
    }
}


Measured memory_bytes: 13268
#include<stdio.h>
int main(void)
{
	int a,b,c,d,e;
	scanf("%d %d",&a,&b);
	
	c = a + b;
	d = a - b;
	e = a * b;
	
	if(c >= d && c >= e){
		printf("%d",c);
	}else if(d >= c && d >= e){
		printf("%d",d);
	}else{
		printf("%d",e);
	}
	return 0;
}

Measured memory_bytes: 128
import itertools
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
for x,y in itertools.permutations([a,b,c,d,e],2):
    if x-y > k:
        print(":(")
        exit()
print("Yay!")

Measured memory_bytes: 38384
#import sys
MOD = 10 ** 9 + 7
INFI = 10**10
#input = sys.stdin.readline
import math
from collections import deque
import itertools
import heapq
#import bisect
from fractions import Fraction
import copy
from functools import lru_cache
from collections import defaultdict
import pprint

#oo=list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
# ko=list("abcdefghijklmnopqrstuvwxyz")

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def kingaku(a,b,n):
    keta=len(str(n))
    return a*n+b*keta

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

#    h,w,a,b = map(int, input().split())
#    c = [[0 for j in range(n)] for i in range(n)]

def ret(a):
    c=[None]*(len(a)-1)
    if len(a)==1:
        return a[0]
    elif len(a)==0:
        return 0
    for i in range(1,len(a)):
        c[i-1]=abs(a[i]-a[i-1])
    return ret(c)

def soinsubunkai(n):
    a = []
    i = 1
    while i*i <= n:
        if n % i == 0 and i!=1:
            a.append(i)
            n=n//i

        if n% i !=0 or i==1:
            i += 1
    nokori=[n]
    return a + nokori

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

def main():
    #l,r,d=map(int,input().split())
    n,k = map(int, input().split())
    a=list(map(int,input().split()))
    for i in range(k,n):
        if a[i-k]<a[i]:
            print("Yes")
        else:
            print("No")

if __name__ == "__main__":

    main()


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

int x,y,vis[5];
vector<int> adj[5];

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	for (int i=1;i<=3;i++){
		cin >> x >> y;
		adj[x].push_back(y);
		adj[y].push_back(x);
	}
	for (int i=1;i<=4;i++){
		if (adj[i].size() == 1){
			vis[i] = 1;
			int ok = 1;
			while (ok){
				ok = 0;
				for (int &nxt : adj[i]){
					if (!vis[nxt]){
						i = nxt;
						ok = 1;
						break;
					}
				}
				vis[i] = 1;
			}
			if (vis[1] && vis[2] && vis[3] && vis[4]){
				cout << "YES\n";
			}else{
				cout << "NO\n";
			}
			return 0;
		}
	}
}

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

#define ll long long

int main() {
	long long a, b, c, n, k;
	
	cin >> n >> k;
	int ans;
	if (k == 1){
		ans = 0;
	}else{
		ans = n - k;
	}
	cout << ans << endl; 
	return 0;
}

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

int main(){
    int n, m;
    int a, b;
    bool ans = false;
    cin >> n >> m;
    vector<bool> vis(n+1, false);

    for (int i = 0; i < m; i++){
        cin >> a >> b;

        if (a == 1){
            if (vis[b]  == true) {
                ans = true;
            }
            else {
                vis[b] = true;
            }
        }
        else if (b == n) {
            if (vis[a]  == true) {
                ans = true;
            }
            else {
                vis[a] = true;
            }
        }
    }

    if (!ans) cout << "IM";
    cout << "POSSIBLE" << endl;
    return 0;

}

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

int main(){
	int N,H,W,a = 0,b = 0,res = 0;
	cin >> N >> H >> W;
	if(N > H){
		a = N - H +1;
	}else if(N == H){
		a = 1;
	}
	if(N > W){
		b = N - W+1;
	}else if(N == W){
		b = 1;
	}
	res = a*b;
	cout << res << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    #define MAXN 55
    #define INF 1000000009
     
    ll n;
     
    int main()
    {
        cin >> n;
        for(ll i = sqrt(n); i > 0; i--){
            if(n % i == 0){
                ll mx = i > n / i ? i : n / i;
                ll ans = 0;
                while(mx){
                    ans++;
                    mx /= 10;
                }
                printf("%lld\n", ans);
                return 0;
            }
        }
     
     
        return 0;
    }

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

// b[i] >= max(a[i], a[i+1]);
// a[i] = min(b[i],b[i-1]);
// b[i =1 ~(n-1)]
// a[i = 1~n]

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n;
    cin>>n;
    vector<int> b(n+1,0);
    for(int i = 1; i< n;i++) cin>> b[i];

    b[0] = b[n] = INF;
    
    ll sum = 0;
    for(int i = 1; i<=n; i++) sum += min(b[i], b[i-1]);
    cout<< sum <<endl;
    return 0;
}


Measured memory_bytes: 256