akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <ctime>
#include <map>
#include <iomanip>
using namespace std;

typedef long long ll;

#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
 
long gcd(long long a, long long b){
	if (a%b==0){
		return b;
	}
	else{
		return gcd(b,a%b);
	}
}
 
long lcm(long long a, long long b){
	return a / gcd(a,b) * b;
}
 
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a < b) { a = b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a > b) { a = b; return 1; } return 0; }
 
const ll INF = 1ll<<60;
const ll MOD = 1000000007;
const double EPS = 1e-10;

int a[9], a_f[9], b[10];
int n;
int f = 0;

int main(){
	REP(i,9) cin >> a[i];
	cin >> n;
	REP(i,n){
		cin >> b[i];
		REP(j,9){
			if (b[i] == a[j]) a_f[j] = 1;
		}
	}

	for (int i = 1; i < 8; i+=3){
		if (a_f[i] && a_f[i+1] && a_f[i-1]){
			f = 1;
			break;
		}
	}

	FOR(i,3,6){
		if (a_f[i] && a_f[i+3] && a_f[i-3]){
			f = 1;
			break;
		}
	}

	if (a_f[4] && a_f[0] && a_f[8]) f = 1;
	if (a_f[4] && a_f[2] && a_f[6]) f = 1;

	if (f) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

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

int n, dist[100005];

int main() {
	scanf("%d", &n);
	memset(dist, -1, sizeof(dist));
	deque<int> que; que.push_back(1);
	dist[1] = 1;
	while (!que.empty()) {
		int now = que.front(); que.pop_front();
		if (now == 0) {
			cout << dist[0] << endl; return 0;
		}
		int nxt = (now * 10) % n;
		if (dist[nxt] == -1 || dist[nxt] > dist[now]) {
			dist[nxt] = dist[now];
			que.push_front(nxt);
		}

		nxt = (now + 1) % n;
		if (dist[nxt] == -1 || dist[nxt] > dist[now]) {
			dist[nxt] = dist[now] + 1;
			que.push_back(nxt);
		}

	}
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)
#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI (3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>void tf(bool b,S t,T f){if(b)puta(t);else puta(f);}
void YN(bool b){tf(b,"YES","NO");}
void Yn(bool b){tf(b,"Yes","No");}
void yn(bool b){tf(b,"yes","no");}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1;for(auto s:t){os<<(a?"":" ")<<s;a=0;}return os;}
template<class S>auto&operator>>(istream&is,vector<S>&t){for(S&a:t)cin>>a;return is;}

/*他のライブラリを入れる場所*/
constexpr ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
constexpr ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	ll ans=0;
	ans+=b/c-(a-1)/c;
	ans+=b/d-(a-1)/d;
	ans-=b/lcm(c,d)-(a-1)/lcm(c,d);
	
	puta(b-a+1-ans);
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
char s[110];
int main(){
	int k,n,i;
	scanf("%d%s",&k,s+1);
	n=strlen(s+1);
	if(n<=k)printf("%s\n",s+1);
	else{
		for(i=1;i<=k;i++)printf("%c",s[i]);
		printf("...\n");
	}
}

Measured memory_bytes: 1644
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;
import java.util.Set;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int k = sc.nextInt();
        Set<String> set = new HashSet<>();
        for (int i = 1; i <= k; i++) {
            for (int j = 0; j < s.length() - i + 1; j++) {
                set.add(s.substring(j, j + i));
            }
        }
        List<String> list = new ArrayList<>(set);
        Collections.sort(list);
        System.out.println(list.get(k - 1));
    }

}


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

#include <iostream>
#include <cmath>
#include <vector>

using namespace std;

int main() {
    int N;
    cin >> N;
    vector<string> tmp(N);
    vector<int> l_B(N, 0), r_A(N, 0);

    for (int i = 0; i < N; i++) {
        cin >> tmp.at(i);
    }
    int count = 0;

    for (int i = 0; i < N; i++) {
        if (tmp.at(i).at(0) == 'B') {
            l_B.at(i) = 1;
        }
        if (tmp.at(i).at(tmp.at(i).size()-1) == 'A') {
            r_A.at(i) = 1;
        }

        for (int j = 0; j < tmp.at(i).size()-1; j++) {
            if(tmp.at(i).at(j)=='A'){
                if(tmp.at(i).at(j+1)=='B'){
                    count++;
                }
            }
        }
    }
    int A_sum=0;
    int B_sum=0;
    for (int i = 0; i < N; i++) {
        A_sum += r_A.at(i);
        B_sum += l_B.at(i);
    }
//    if(A_sum!=B_sum && min(A_sum,B_sum)!=0){
//        count += min(A_sum, B_sum);
//    }
//    else if(min(A_sum,B_sum)!=0){
//        count += A_sum;
//    }
    count += min(A_sum,B_sum);
//    AとBが全て同じタイミングで1になるとき
    bool flag = true;
    
    if(A_sum !=0 && (A_sum == B_sum)) {
        for (int i=0; i < N; i++) {
            if (r_A.at(i) != l_B.at(i)) {
                flag = false;
                break;
            }
        }
        if (flag) {
            count--;
        }
    }
    cout << count << endl;
}

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

int N, K;
void err() {
	cout << -1 << endl;
	exit(0);
}


int main() {
	cin >> N >> K;

	if (K > (N - 1)*(N - 2) / 2) {
		err();
	}
	else {
		vector<pair<int,int>>e;
		for (int i = 2; i <= N; i++) {
			e.pb({ 1,i });
		}
		int cnt = ((N-1)*(N-2)/2)-K;
		int l = 2;
		int r = l;
		while (cnt > 0) {
			if(r < N){
				r++;
			}else{
				l++;
				r = l + 1;
			}
			e.pb({ l,r });
			cnt--;
		}

		cout << e.size() << endl;
		rep(i, 0, e.size()) {
			cout << e[i].first << " " << e[i].second << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0;i < n;i++)
#define rev(i, n) for(int i = n;i >= 0;i--)
#define Rep(i, m, n) for(int i = m;i < n;i++)
#define repeatrev(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define itn int

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
typedef priority_queue<int> Pr;

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    int h = 0;
    cin >> s;
    rep(i, s.size() - 1){
        if(s[i] == s[i + 1]) h ++;
    }
    if(h != 0) cout << "Bad" << endl;
    else cout << "Good" << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
int main()
{
  int n,k;
  cin >> n >> k;
  vector<int> v(n);
  rep(i,n) cin >> v[i];
  int res=0;
  rep(i,n){
    rep(j,n-i+1){
      vector<int> vec;
      int sum=0;
      rep(a,i){	vec.push_back(v[a]);sum+=v[a];}
      rep(b,j){ vec.push_back(v[n-b-1]);sum+=v[n-b-1];}
      sort(vec.begin(), vec.end());
      if(i+j>k) continue;
      //      cout << i+j << " " << sum << "\n";
      // rep(qq,vec.size()) cout << vec[qq] << " ";
      // cout << "\n";
      rep(c,k-(i+j)){
	if(i+j<=c) break;
	if(vec[c]<0) sum -= vec[c];
	else break;
      }
      res = max(res,sum);
    }
  }

  cout << res << "\n";
  
  return 0;
}


Measured memory_bytes: 256
from typing import List, Dict

INF = 10**9+1


def read_int() -> int:
    return int(input().strip())


def read_ints() -> List[int]:
    return list(map(int, input().strip().split(' ')))

def remove_if_gt(a, b):
    if a >= b:
        return a-b
    return a

def solve() -> int:
    N, K = read_ints()
    A = read_ints()
    S = []
    for i in range(N):
        prefix = 0
        for j in range(i, N):
            prefix += A[j]
            S.append(prefix)
    S.sort(reverse=True)
    highest_bit = 40
    answer = 0
    while highest_bit >= 0:
        while 1<<highest_bit > S[0]:
            highest_bit -= 1
            if highest_bit < 0:
                return answer
        highest_bit_val = 1<<highest_bit
        count = 0
        for i in range(len(S)):
            if S[i] >= highest_bit_val:
                count += 1
            else:
                break
        if count < K:
            S = [remove_if_gt(s, highest_bit_val) for s in S]
        else:
            answer += highest_bit_val
            S = [remove_if_gt(s, highest_bit_val) for s in S if s >= highest_bit_val]
        S.sort(reverse=True)
    return answer


if __name__ == '__main__':
    print(solve())


Measured memory_bytes: 116436
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 5LL << 60;
const ll mod = 1e9 + 7;

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

	for(int i = 0; i < N; i++) {
		if(a[i] % 2) {
			cout << "first";
			return 0;
		}
	}
	cout << "second";
	return 0;
}

Measured memory_bytes: 4024
#include <iostream>

using namespace std;
static const int MAX = 100;
int main()
{
    int R[MAX],n;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>R[i];
    }
    for(int i=0;i<n;i++){
        int v = R[i];
        int j = i-1;
        while(j>=0&&R[j]>v){
            R[j+1] = R[j];
            j--;
        }
        R[j+1] = v;
        for(int k=0;k<n;k++){
            if(k>0) cout<<" ";
           cout<<R[k];
        }
        cout<<endl;
    }
    return 0;
}




Measured memory_bytes: 3084
#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include<bits/stdc++.h>
#define FASTIO ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define rep(a, c) for (int(a) = 0; (a) < (c); (a)++) 
#define ll long long
#define vi vector<ll>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pli pair<ll, int> 
#define pb push_back
#define str string
#define mod 998244353
#define pi 3.14159265
using namespace std;
int main()
{
    ll a;
    cin >> a;
    cout << a+a*a+a*a*a;
}

Measured memory_bytes: 3628
import java.util.*;
public class Main {
    public static void main(String [] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        Map<Integer,ArrayList<Integer>> L = new HashMap<>();
        int [] Con = new int[n];
        Arrays.fill(Con,-1);
        for(int i=0;i<m;i++){
            int s = sc.nextInt();
            int t = sc.nextInt();
            if(L.containsKey(s)) L.get(s).add(t);
            else{
                ArrayList<Integer> A = new ArrayList<Integer>();
                A.add(t);
                L.put(s,A);
            }
            if(L.containsKey(t)) L.get(t).add(s);
            else{
                ArrayList<Integer> A = new ArrayList<Integer>();
                A.add(s);
                L.put(t,A);
            }
        }
        //探索
        for(int i=0;i<n;i++){
            if(Con[i]==-1) {
                Con[i] = i;
                Connection(L, i, Con,i);
            }
        }
        L.clear();
        int q = sc.nextInt();
        for(int i=0;i<q;i++){
            int s = sc.nextInt();
            int t = sc.nextInt();
            int num = Con[s];
            if(Con[t]==num) System.out.println("yes");
            else System.out.println("no");
        }
    }
    public static void Connection(Map<Integer,ArrayList<Integer>> L,int now,int Con[],int cnt){
        ArrayDeque<Integer> Stack = new ArrayDeque<>();
        Stack.add(now);
        while(Stack.size()!=0){
            now = Stack.pop();
            if(L.get(now)!=null) {
                for(int i:L.get(now)){
                    if(Con[i] == -1){
                        Stack.add(i);
                        Con[i] = cnt;
                    }
                }
            }
        }
    }
}


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

using namespace std;

int main() {
	string S;
	cin >> S;
	sort(S.begin(), S.end());
	int cnt[100] = { 0 };

	for (int i = 0; i < S.size(); i++) {
		cnt[S[i] - 'a']++;
	}

	for (int i = 0; i < 26; i++) {
		if (cnt[i] % 2 != 0) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;

	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Queue;
import java.util.StringTokenizer;

public class Main {
	static  ArrayList<Pair>adj[];
	static PrintWriter out=new PrintWriter(System.out);
        static Integer[] b;
	public static void main(String[] args) throws Exception {
	Scanner sc=new Scanner(System.in);
	int n=sc.nextInt();
	int a=sc.nextInt();
	int sum=n/a;
	if(n%a!=0) {
		sum++;
	}
	System.out.println(sum);
		
out.flush();
	}

static long sum;	
	
	static void dfs(int u,int p,  int l, int r) {
		   

for(Pair v:adj[u]) {
	  if(r<l) {
		  return;
	  }
 if(p!=v.v&&v.cost<b[r]) {
	 int cur=r;
 while(l<=r&&v.cost<b[r])  	r--;
 
dfs(v.v,u,r+1,cur);
 }
}

 sum+= 1l*(r-l+1)*1l*(u + 1)*1l;
}

static class Scanner {
		StringTokenizer st;
		BufferedReader br;
 
		public Scanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}
 
		public Scanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}
 
		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
 
		public String nextLine() throws IOException {
			return br.readLine();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
 
		public char nextChar() throws IOException {
			return next().charAt(0);
		}
 
		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public boolean ready() throws IOException {
			return br.ready();
		}
 
		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}	

	
	
	 static class Pair implements Comparable<Pair>{
		  int v;
		  int cost;
		  Pair(int a, int b){
			  v=a;
			  cost=b;
		  }
		public int compareTo(Pair p) {
			return (int) (p.cost-this.cost);
		 
				 
		}
	 }
}

Measured memory_bytes: 21204
#N = int(input())
#N = int(input())
#S = input()
# = input().split()
# = input().split()
# = map(int,input().split())
# = map(int,input().split())
X = list(map(int,input().split()))
# = list(map(int,input()).split())

for i in range(len(X)):
    if X[i] == 0:
        print(i+1)
        exit()

Measured memory_bytes: 61528
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
#define LL long long;

int n, s1, s2;
int ans = 10000000;
int w[100];

int main(){

	cin >> n;
	for (int i = 0; i < n; i++)cin >> w[i];


	for (int i = 1; i <= n; i++){
		for (int j = 0; j < i; j++){
			s1 += w[j];
		}
		for (int j = i; j < n; j++){
			s2 += w[j];
		}
		if (s1 < s2) swap(s1, s2);
		ans = min(ans, s1 - s2);
		s1 = 0;
		s2 = 0;
	}

	cout << ans << endl;

	return 0;
}

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

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Jaynil
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DBouquet solver = new DBouquet();
        solver.solve(1, in, out);
        out.close();
    }

    static class DBouquet {
        static long mod = 1000000007;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            long n = in.nextLong();
            long a = in.nextLong();
            long b = in.nextLong();
            out.println((Maths.power(2, n, mod) - Maths.nCr(n, a, mod) - Maths.nCr(n, b, mod) + 2 * mod - 1) % mod);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }

    static class Maths {
        static long nCr(long n, long r, long p) {
            //r is small
            long up = 1;
            long down = 1;
            for (long i = n - r + 1; i <= n; i++) {
                up *= i;
                up %= p;
            }
            for (long i = 1; i <= r; i++) {
                down *= i;
                down %= p;
            }
            return (up * power(down, p - 2, p)) % p;
        }

        static long power(long x, long y, long p) {
            long res = 1;
            x = x % p;
            while (y > 0) {
                if ((y & 1) == 1)
                    res = (res * x) % p;
                y = y >> 1;
                x = (x * x) % p;
            }
            return res;
        }

    }
}



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

//#define DEBUG

using namespace std;

uint32_t count_ans[4];

template <class T>
void print_vect(std::vector<T> v){
    for(int i = 0 ; i < v .size(); i++) cout << v[i] << " ";
    cout << endl;
}


void solve(){
    uint32_t N ;
    cin >> N;
    std::string S;
    for(uint32_t i = 0; i < N ; i++){
        cin >> S;
        if( S == "AC"){
            count_ans[0]++;
        }else if ( S == "WA"){
            count_ans[1]++;
        }else if( S == "TLE"){
            count_ans[2]++;
        }else{
            count_ans[3]++;
        }
    }
    cout << "AC x " << count_ans[0] << endl;
    cout << "WA x " << count_ans[1] << endl;
    cout << "TLE x " << count_ans[2] << endl;
    cout << "RE x " << count_ans[3] << endl; 
}

int main()
{
    //making data IO Fast
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    /****************************/

    #ifdef DEBUG
    int TEST_CASES = 4;
    while(TEST_CASES--){
    #endif // DEBBUG

    solve();

    #ifdef DEBUG
    }
    #endif // DEBUG
    
    return 0;
}


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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,k,mi=1000000000;
	cin>>n>>k;
	vector<ll>v(n);
	for(ll i=0;i<n;i++)cin>>v.at(i);
	sort(v.begin(),v.end(),greater<ll>());
	for(ll i=0;i<n-k+1;i++){
		mi=min(v.at(i)-v.at(i+k-1),mi);
	}
	cout<<mi<<endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int mod = 1000000007;
int dp[3003][3003];
int main()
{  ios_base::sync_with_stdio(false); cin.tie(NULL);
   string s,t;cin>>s>>t;
   int i,j;
   for(i=0;i<=s.size();i++)
   {
     for(j=0;j<=t.size();j++)
     { dp[i][j]=0; }
   }
   for(i=1;i<=s.size();i++)
   {
     for(j=1;j<=t.size();j++)
     {
       if(s[i-1]==t[j-1]) { dp[i][j]=dp[i-1][j-1]+1; }
       else               { dp[i][j]=max(dp[i-1][j],dp[i][j-1]); }
     }
   }
   i--; j--;
   string lcs;
   while(dp[i][j]!=0)
   { if(dp[i][j]!=max(dp[i-1][j],dp[i][j-1]))
     {
       lcs.push_back(s[i-1]);
       i--; j--;
     }
     else if(dp[i][j]==dp[i-1][j]) { i--; }
     else if(dp[i][j]==dp[i][j-1]) { j--; }
   }
    reverse(lcs.begin(),lcs.end());
   cout<<lcs;
   return 0;
}


Measured memory_bytes: 35456
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pl;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Rep(i, k, n) for (int i = k; i < (int)(n); i++)
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;
const int MOD = 1000000007;
const double PI = acos(-1); //3.14~
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main()
{
    int n; cin >> n;
    ll x[n], l[n];
    rep(i, n)
    {
        cin >> x[i] >> l[i];
        int d = l[i];
        l[i] = l[i] + x[i];
        x[i] = x[i] - d;
        if (x[i] < 0) x[i] = 0;
    }

    Pl itv[n];
    rep(i, n) itv[i].first = l[i], itv[i].second = x[i];
    sort(itv, itv + n);

    ll ans = 0, t = 0;
    rep(i, n)
    {
        if (t <= itv[i].second)
        {
            //cout << itv[i].first << endl;
            ans++;
            t = itv[i].first;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3328
#include <iostream>
using namespace std;
int main(){
	int t;
	cin>>t;
	for(int i=0;i<t;++i){
		int n,min=0,max=0,h,oh;
		cin>>n;
		for(int j=0;j<n;++j){
			cin>>h;
			if(j!=0){
				if(max<h-oh)max=h-oh;
				if(min>h-oh)min=h-oh;
			}
			oh=h;
		}
		cout<<max<<" "<<-min<<"\n";
	}
	return 0;
}

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

arr = [int(x) for x in input().split(" ")]

ans = 0

sum = 0

curr = True

for i in range(len(arr)):
    if ((sum + arr[i]) == 0 or ((sum + arr[i]) > 0) == curr):
        if curr:
            temp = -1 - sum
        else:
            temp = 1 - sum
        ans += abs(temp - arr[i])
        sum += temp
    else:
        sum += arr[i]
    curr = not curr

ans1 = 0

curr = False

sum = 0

for i in range(len(arr)):
    if ((sum + arr[i]) == 0 or ((sum + arr[i]) > 0) == curr):
        if curr:
            temp = -1 - sum
        else:
            temp = 1 - sum
        ans1 += abs(temp - arr[i])
        sum += temp
    else:
        sum += arr[i]
    curr = not curr

print(min(ans,ans1))

Measured memory_bytes: 59280
package main

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

var sc *bufio.Scanner

const M int = 1000000007

var F = make([]int, 200000)

func init() {
	sc = bufio.NewScanner(os.Stdin)
	buffsize := 1000000
	buff := make([]byte, buffsize)
	sc.Buffer(buff, buffsize)
	sc.Split(bufio.ScanWords)

	F[0] = 1
	for i := 1; i < len(F); i++ {
		F[i] = F[i-1] * i % M
	}
}

func loadint() (result int) {
	sc.Scan()
	result, _ = strconv.Atoi(sc.Text())
	return
}

func factorize(m int) map[int]int {
	result := map[int]int{}
	i := 2
	x := m
	for i*i <= m {
		n := 0
		for x%i == 0 {
			n++
			x /= i
		}
		if n > 0 {
			result[i] = n
		}
		i++
	}
	if x > 1 {
		result[x] = 1
	}
	return result
}

func pow(x, n, m int) int {
	r := 1
	for n > 1 {
		if n&1 == 1 {
			r = r * x % m
		}
		x = x * x % m
		n >>= 1
	}
	return r * x % m
}

func C(x, y int) int {
	return (F[x] * pow(F[y], M-2, M) % M) * pow(F[x-y], M-2, M) % M
}

func main() {
	n := loadint()
	m := loadint()
	fs := factorize(m)
	result := 1
	for _, y := range fs {
		result = result * C(n+y-1, y) % M
	}
	fmt.Println(result)
}


Measured memory_bytes: 2304
#include <stdio.h>
int main (void){
  char s[4] = {};
  int tmp = 0;
  
  scanf("%s, %s, %s, %s", &s[0], &s[1],&s[2],&s[3]);
  for(int i = 0; i < 4; i++){
    if(s[i] == '+'){
      tmp++;
    }else{
      tmp--;
    }
  }
  
  printf("%d\n", tmp);
  
  return 0;
}


Measured memory_bytes: 128
# ABC089-D
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
h,w,d=IL()
A=[IL() for i in range(h)]
Al=[0]*(h*w+1)
for i in range(h):
    for j in range(w):
        Al[A[i][j]]=[i,j]

rui={}
for i in range(d):
    T=[0]
    for j in range(1,h*w+1-i-d,d):
        T.append(abs(Al[j+i][0]-Al[j+d+i][0])+abs(Al[j+i][1]-Al[j+d+i][1]))
    for j in range(len(T)-1):
        T[j+1]+=T[j]
    rui[(i+1)%d]=T
q=I()
for w in range(q):
    l,r=IL()
    idx=l%d
    if idx==0:
        li=l//d-1
        ri=r//d-1
    else:
        li=l//d
        ri=r//d
    print(rui[idx][ri]-rui[idx][li])

Measured memory_bytes: 73304
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

#define ll long long
#define INF 1<<31-1
#define LNF 9223372036854775807
#define PI 3.14159265358979
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define FOR(i,a,n) for(i=a;i<n;i++)
#define MOD 1000000007
//#define MOD 998244353
#define NUM 200010
 
void swap(int* a,int* b){int tmp=*a;*a=*b;*b=tmp;}
int abs(int a){if(a<0)return -a;return a;}
int dup(int a,int d){if(a%d==0)return a/d;else return a/d+1;}
int mod(int a,int m){if(a<0)return a%m+m;else return a%m;}

void swapl(ll* a,ll* b){ll tmp=*a;*a=*b;*b=tmp;}
ll absl(ll a){if(a<0)return -a;return a;}
ll dupl(ll a,ll d){if(a%d==0)return a/d;else return a/d+1;}
ll modl(ll a,ll m){if(a<0)return a%m+m;else return a%m;}

ll GCD(ll a,ll b){ll c=1,tmp=MAX(a,b);b=MIN(a,b);a=tmp;while(c!=0){c=a%b;a=b;b=c;}return a;}
ll LCM(ll a,ll b){return a*b/GCD(a,b);}

ll factorial(ll n, ll m) {return n < m ? 1 : n*factorial(n-1, m);}

int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

// ll dp[]

int main(){
    ll k, i;
    char s[1000];
    
    scanf("%lld", &k);
    scanf("%s", s);
    
    for (i = 0; i < k; i++)
    {
        if(s[i] == '\0'){
            return 0;
        }
        printf("%c", s[i]);
    }
    if(s[k] == '\0') return 0;

    printf("...\n");
    
    return 0;
}

Measured memory_bytes: 1644
while true
  n, r = gets.chomp.split(' ').map(&:to_i)
  break if (n | r) == 0
  
  ary = Array.new(n)
  (n).downto(1) do |i|
    ary[n-i] = i
  end

  r.times do 
    p, c = gets.chomp.split(' ').map(&:to_i)
    del = ary.slice!(p-1, c)
    ary = del + ary
  end
  puts ary[0]
end

Measured memory_bytes: 9192
import java.io.*;

class Main{
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int n=Integer.parseInt(br.readLine());
for(int i=0; i<n; i++){
String str = br.readLine();
String[] s = str.split(" ");
double xa = Double.parseDouble(s[0]);
double ya = Double.parseDouble(s[1]);
double ra = Double.parseDouble(s[2]);
double xb = Double.parseDouble(s[3]);
double yb = Double.parseDouble(s[4]);
double rb = Double.parseDouble(s[5]);
double d=Math.hypot(xa-xb,ya-yb);
if(ra+rb<d){
System.out.println("0");
}
else if(ra+rb>=d&&Math.abs(ra-rb)<=d){
System.out.println("1");
}
else if(ra>rb){
System.out.println("2");
}
else{
System.out.println("-2");
}
}
}
}

Measured memory_bytes: 15092
#include <cstdio>

using namespace std;

int main() {
  int x = 0;
  for (;;) {
    const int c = getchar();
    if (c == EOF)
      break;

    if (c == '\n') {
      if (!x)
        break;
      printf("%d\n", x);
      x = 0;
      continue;
    }
    const int n = c - 0x30;
    x += n;
  }

  return 0;
}

Measured memory_bytes: 2596
#include<iostream>
#include<string>
using namespace std;
int main()
{
     string s;
    cin>>s;
    int i=0;
  int  f=1;
   char c;
         for(i=0;i<26;i++)
            {
                     char  ch =   ( char)  ( 'a'+i) ;
                      f=1;
                     for( int j=0; j< s.size(); j++)
                         {
                              if( s[j] == ch )
                                   {   f=0;
                                       break;
                                       
                                   }
                         }
                     

                    if( f==1)
                       {  c= ch; break;}
            }
          if( f==1)
             cout<<c<<endl;
          else
              cout<<"None"<<endl;
     return 0;
}


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

int Q(int x){
	cout<<x<<endl;
	string s;
	cin>>s;
	if(s[0]=='V') exit(0);
	return s[0]=='M';
}
void f(int s, int e, int l, int r){
	int m = s+e>>1;
	int t = Q(m);
	if((l!=t) ^ ((m-s)&1)) f(s, m, l, t);
	else f(m+1, e, !t, r);
}
int main(){
	int N; cin>>N;
	int t = Q(0);
	f(0, N-1, t, !t);
	return 0;
}

Measured memory_bytes: 880
#include <cstdio>
#include <cstring>
#include <string>
using namespace std;

int n;
char buf[1000];
int invmod[] = {0, 1, 0, 9, 0, 21, 0, 15, 0, 3, 0, 19, 0, 0, 0, 7, 0, 23, 0, 11, 0, 5, 0, 17, 0, 25};

string decrypt(string s, int a, int b) {
  string ret;

  if (invmod[a]*a%26 != 1) return "";
   
  for (int i=0; i<s.size(); i++) {
    if (s[i] == ' ') ret += ' ';
    else {
      int k = (s[i]-'a'-b+26)%26;
      ret += 'a'+k*invmod[a]%26;
    }
  }

  return ret;
}

void process() {
  fgets(buf, sizeof(buf), stdin);
  char *sp = strchr(buf, '\n');
  if (sp != NULL) *sp = '\0';

  for (int i=0; i<26; i++) {
    for (int j=0; j<26; j++) {
      string decoded = decrypt(buf, i, j);
      if (decoded.find("that") != string::npos) {
        printf("%s\n", decoded.c_str());
        return;
      }

      if (decoded.find("this") != string::npos) {
        printf("%s\n", decoded.c_str());
        return;
      }
    }
  }
}

int main() {
  scanf("%d ", &n);
  while (n--) {
    process();
  }
}

Measured memory_bytes: 2604
#include <iostream>
#include <string>

using namespace std;

int main(void) {
	int h, w;
	char s[60][60];


	cin >> h >> w;
	for (int i = 0; i < h; i++) {
		cin >> s[i];
	}

	int c[8][2] = {
		{-1,-1},
		{-1,0 },
		{-1,1},
		{0,1},
		{1,1},
		{1,0},
		{1,-1},
		{0,-1}
	};

	for (int i = 0; i <= h; i++)
		for (int j = 0; j <= w; j++) {
			if (s[i][j] == '.') {
				int mine = 0;
				for (int k = 0; k < 8; k++) {
					int y = i + c[k][0];
					int x = j + c[k][1];
					if (0 <= y && y <= h
						&& 0 <= x && x <= w) {
						if (s[y][x] == '#') mine++;
					}
				}
				s[i][j] = '0' + mine;
			}
		}


	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cout << s[i][j];
		}
		cout << '\n';
	}
}

Measured memory_bytes: 3084
/**
 *   author: sahushivam
 *   created: 23 January 2019  10:00:41
**/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;

#define REP(i, a, b) for(int i = a; i < b; i++)
#define RREP(i, a, b) for(int i = a-1; i >= b; i--)
#define PB push_back
#define MP make_pair
#define MOD 1000000007
#define INF 0x7fffffff

void optimizeIO(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
}

int main(){
    optimizeIO();
    int n;
    cin>>n;
    int *a=new int[n];  
    int *b=new int[n]; 
    int *c=new int[n]; 
    REP(i,0,n) cin>>a[i]>>b[i]>>c[i];
    int happiness[n][3];
    happiness[0][0]=a[0];
    happiness[0][1]=b[0];
    happiness[0][2]=c[0];
    REP(i,1,n){
    	happiness[i][0]=max(happiness[i-1][1],happiness[i-1][2])+a[i];
    	happiness[i][1]=max(happiness[i-1][0],happiness[i-1][2])+b[i];
    	happiness[i][2]=max(happiness[i-1][1],happiness[i-1][0])+c[i];
    }
    cout<<max(happiness[n-1][0],max(happiness[n-1][1],happiness[n-1][2]));
	return 0;
}

Measured memory_bytes: 2560
//高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INTINF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

int main() {
	ll ans = 0;
	int tmp;
	ll a;
	double b;
	cin >> a >> b;
	b = round(b*100.0); //100倍して小数第1位で四捨五入
	ll c = b; // long long int に格納
	cout << (ll)(c*a/100) << endl; //Aとの積を100で割って出力
}


Measured memory_bytes: 3692
#include<bits/stdc++.h>
/************************************************/
#define rep(i,n) for(int i=0;i<n;i++)
#define m_p make_pair
#define pb push_back
#define fr first
#define se second
#define forn(i,a,n) for(int i=a;i<n;i++)
#define foreach(i,c) for(__typeof(c.begin())i=(c.begin());i!=(c).end();i++)
#define pii pair<int,int>
#define vi vector<int>
#define ll long long
#define sz(s) s.size()
#define all(s) s.begin(),s.end()
#define zero(x) memset(x,0,sizeof(x))
#define vii vector<pair<int,int> >
#define mpis map<int,string>
#define mpii map<int,int>
#define mpsi map<string,int>
#define re return
#define mod 1000000007
/************************************************/
using namespace std;

long long get(){
	char c=getchar();
	long long x=0LL;
	while(c<'0'||c>'9')
	c=getchar();
	while(c>='0'&&c<='9'){
		x*=10LL;
		x+=(c-'0');
		c=getchar();
	}
	return x;
}
int s[2001][2001],s1[2001][2001],s2[2001][2001];
bool f[2001][2001];
int n,m,q;
int x1,y3,x2,y2;
int main()
{
    string t[2001];
    cin>>n>>m>>q;
    rep(i,n){
        cin>>t[i];
        rep(j,m)
        if(t[i][j]=='1')
        f[i][j]=true;
    }
    forn(i,1,n+1)
    forn(j,1,m+1){
            s[i][j]=s[i-1][j]+s[i][j-1]-s[i-1][j-1]+f[i-1][j-1];
            s1[i][j]=s1[i-1][j]+s1[i][j-1]-s1[i-1][j-1];
            if(f[i-1][j-1]&&f[i-1][j])
            s1[i][j]++;
            s2[i][j]=s2[i-1][j]+s2[i][j-1]-s2[i-1][j-1];
            if(f[i-1][j-1]&&f[i][j-1])
            s2[i][j]++;
    }
    while(q--)
    {
        cin>>x1>>y3>>x2>>y2; 
        cout<<(s[x2][y2]-s[x1-1][y2]-s[x2][y3-1]+s[x1-1][y3-1])-(s1[x2][y2-1]-s1[x2][y3-1]-s1[x1-1][y2-1]+s1[x1-1][y3-1]+s2[x2-1][y2]-s2[x2-1][y3-1]-s2[x1-1][y2]+s2[x1-1][y3-1])<<"\n";
    }
    re 0;
}


Measured memory_bytes: 56704
S = input()
ss = list('abcdefghijklmnopqrstuvwxyz')

flag = True
cnt = 0
for i in range(len(S)):
    if i == 0:
        if S[i] != 'A':
            flag = False
        continue
    elif 2 <= i <= len(S) - 2:
        if S[i] == 'C':
            cnt += 1
            continue
    if S[i] not in ss:
        flag = False

if flag and cnt == 1:
    print('AC')
else:
    print('WA')

Measured memory_bytes: 3060
#include <stdio.h>
#include <string.h>

//sを二つくっつけてpを検索する
//scanfで文字列取ろう
//同上でpを読み込む
//sを二つくっつけた文字列(doublesとか？)を作る
//検索
//boolで場合分けて表示

int main(){

  char s[100];

  char p[100];

  scanf("%s",s);
 
  scanf("%s",p);

  /*
  printf("%s\n",p);
  printf("%c\n",p[0]); 
  */


  int length = strlen(s);

  /*
  printf("%d\n",length);  
  */
 
  char doubles [length*2+1];

  int a,b;

  for(a=0;a<=length-1;a++){

    doubles[a]=s[a];

  }

  for(b=0;b<=length-1;b++){

    doubles[length+b]=s[b];

  }

  doubles[2*length]='\0';

  char *ch;

  ch=strstr(doubles,p);

  if(ch==NULL){

    printf("No\n");
    
  }else{

    printf("Yes\n");

  }

  return 0;

}

Measured memory_bytes: 524
n,m=map(int,input().split())
dp=[[0]*(m+1) for _ in range(n+1)]
dp[1][1]=1
grid=[]
grid.append(['0']*(m+1))
for i in range(n):
  grid.append(list('0'+input()))
for i in range(1,n+1):
  for j in range(1,m+1):
    tmp=0
    if grid[i-1][j] == '.':
      tmp+=dp[i-1][j]
    if grid[i][j-1] == '.':
      tmp+=dp[i][j-1]
    dp[i][j]+=tmp
print(dp[n][m]%(10**9+7))

Measured memory_bytes: 165464
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))

typedef struct{
    double x;
    double y;
}city;

//昇順
int asc(const void* a, const void* b){
    return *(int*)a-*(int*)b;
}

//降順
int desc(const void* a, const void* b){
    return *(int*)b-*(int*)a;
}

int main(void){
    int N;
    scanf("%d",&N);

    //A[0]~A[N-1]に格納する
    city* A;
    NEW(A,N);
    for(int i=0;i<N;i++){
        scanf("%lf%lf",&A[i].x,&A[i].y);
    }

    //map[i][j]はi→jの距離
    double map[N][N];
    double sum=0;
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            map[i][j]=sqrt((A[i].x-A[j].x)*(A[i].x-A[j].x)+(A[i].y-A[j].y)*(A[i].y-A[j].y));
            sum+=map[i][j];
        }
    }

    double ans=sum/N;
    printf("%.7lf\n",ans);

    return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

class Main{
	static Scanner s=new Scanner(System.in);
	static int gInt(){return Integer.parseInt(s.next());}
	public static void main(String[]$){
		int v=gInt();
		System.out.println(v/10%111==0||v%1000%111==0?"Yes":"No");
	}
}

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

long long n3(int a) {
    long long ret = 1;
    for (int i = 0; i < 3; i++) {
        ret *= a;
    }
    return ret;
}

int main() {
    int n,k;
    cin >> n >> k;
    if (k % 2 == 1) {
        long long cnt = 0;
        for(int i = 1; i <= n; i++)
        {
            if (i % k == 0) cnt++;
        }
        cout << n3(cnt) << endl;
    }
    else {
        long long cnt1 = 0;
        long long cnt2 = 0;
        for(int i = 1; i <= n; i++)
        {
            if (i % k == 0) cnt1++;
            else if (i % k == (k / 2)) cnt2++;
        }
        cout << n3(cnt1) + n3(cnt2) << endl;
    }
}

Measured memory_bytes: 256
//参考：http://ehafib.hatenablog.com/entry/2015/12/23/164517
//インクルード
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

int main(int argc, char const *argv[]) {
  int n,r;
  std::cin >> n >> r;

  if (n >= 10) {
    std::cout << r << '\n';
  } else {
    int ans;
    ans = r + 100 * (10 - n);
    std::cout << ans << '\n';
  }
  return 0;
}


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

typedef long long            ll;
typedef unsigned long long   ull;
typedef vector<int>          vi;
typedef vector<ll>           vl;
typedef pair<int, int>       pi;
typedef pair<ll, ll>         pl;
typedef vector<pi>           vpi;
typedef vector<pl>           vpl;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> orderedSet;

#define read        freopen("in.c", "r", stdin)
#define write       freopen("out.c", "w", stdout)
#define all(a)      a.begin(), a.end()
#define UNI(a)      a.resize(unique(all(a), a.begin()) - a.begin())
#define bye         exit(0)
#define mp          make_pair
#define ff          first
#define ss          second
#define L(x)        ((x) << 1)
#define R(x)        ((x) << 1 | 1)
#define SZ(a)       (ll)(a).size()
#define pb          push_back
#define eb          emplace_back
#define eps         1e-9
#define inf         (1000000000)
#define infl        (1000000000000000000LL)
#define cs(p)       printf("Case %d:", (p)++)
#define ptc(c)      putchar(c)
#define gtc()       getchar()
#define nl          puts("")
#define sp          printf(" ")
#define out(a)      printf("%lld", (ll)(a))
#define SET(a, x)   memset((a), x, sizeof(a))
#define dbg(x)      cout << "--- " << #x << " = " << (x) << '\n'

ll bgm(ll a, ll b, ll m) {
    b = (b == -1) ? (m - 2) : b;
    a %= m;
    ll rem = 1;
    while(b != 0) {
        if(b&1) {
            rem = (rem * a) % m;
        }
        a = (a * a) % m;
        b >>= 1;
    }
    return rem;
}

inline ll in() {
    ll a;
    assert(scanf("%lld", &a) != EOF);
    return a;
}

const int MAX = 100000 + 5;
const int LEN = 50;
const ll MOD = 1000000007;

int n, k;
int h[MAX];

int dp[MAX];

int main() {
    n = in(), k = in();
    for(int i = 1; i <= n; i++) {
        h[i] = in();
    }
    dp[1] = 0;
    for(int i = 2; i <= n; i++) {
        dp[i] = inf;
        for(int j = i - 1, l = 0; j > 0 and l < k; j--, l++) {
            dp[i] = min(dp[i], abs(h[i] - h[j]) + dp[j]);
        }
    }
    out(dp[n]), nl;
    return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>

int selectionSort(int A[],int N){
  int i,j,minj,n,cnt=0;
  
  for(i=0;i<N-1;i++){
    minj=i;
    for(j=i;j<N;j++){
      if(A[j]<A[minj]){
	minj=j;
      }
    }
    n=A[i];
    A[i]=A[minj];
    A[minj]=n;
    if(i!= minj) cnt++;
  }
  return cnt;
  
}


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

  scanf("%d",&n);

  int A[n];

  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }

  cnt=selectionSort(A,n);

  for(i=0;i<n-1;i++){
    printf("%d",A[i]);
    printf(" ");
  }
  printf("%d",A[n-1]);

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



Measured memory_bytes: 2144
use std::io;

fn gets() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).ok();
    buf
}

fn main() {
    let line = gets();
    let k = line.trim().parse::<usize>().unwrap();
    let line = gets();
    let s = line.trim();
    let n = s.chars().count();
    if n <= k {
        println!("{}", s)
    } else {
        let (first, _) = s.split_at(k);
        println!("{}...", first);
    }
}


Measured memory_bytes: 2120
/*氏名：保坂優介, 学籍番号：200441141
  概要：範囲をを満たすか*/

#include<stdio.h>

int main(void)
{
    int a, b, c;        //変数の宣言

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

    if (a < b && b < c)     //範囲内か判別
    {
        printf("Yes\n");      //出力
    }

    else        //範囲外の場合
    {
        printf("No\n");       //出力
    }

    return 0;
}


Measured memory_bytes: 2092
#include <bits/stdc++.h>
#include <string>
using namespace std;
int main()
{

    int small = 100000,num;
    string s;
    cin >> s;

    for (int i = 0; i < s.size() - 2; i++)
    {
        int n100 = s[i] - '0', n10 = s[i + 1] - '0', n1 = s[i + 2] - '0';
        num = n100 * 100 + n10 * 10 + n1;
        if (num > 754)
        {
            if (num - 753 < small)
            {
                small = num - 753;
            }
        }
        else
        {
            if (753 - num < small)
            {
                small = 753 - num;
            }
        }
    }
    //cout<<num<<endl;
    cout << small << endl;

    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional>
#include <cctype>
#include <locale>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<long long,long long> Pll;
#define fout(num) cout << fixed << setprecision(20) << (num) << endl
//s[i]=tolower(s[i]); islower(s[i]); cout << tolower(s[i])はバグ


signed main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    ll n; cin >> n;
    ll a[3],b[3];
    rep(i,3) cin >> a[i];
    rep(i,3) cin >> b[i];
    
    vector<vector<ll>> dp(4,vector<ll>(n+1));
    
    rep(i,n+1) dp[0][i]=0;
    
    rep(i,3){
        rep(j,n+1){
            if((j-a[i])>=0) dp[i+1][j]=max(dp[i][j],dp[i+1][j-a[i]]+b[i]-a[i]);
            else dp[i+1][j]=dp[i][j];
        }
    }
    
    ll res=0;
    for(ll i=0;i<=n;i++) chmax(res,n+dp[3][i]);

    
    vector<vector<ll>> dp2(4,vector<ll>(res+1));

    rep(i,res+1) dp2[0][i]=0;
    rep(i,3){
        rep(j,res+1){
            if((j-b[i])>=0) dp2[i+1][j]=max(dp2[i][j],dp2[i+1][j-b[i]]+a[i]-b[i]);
            else dp2[i+1][j]=dp2[i][j];
        }
    }
    ll ans=0;
    for(ll i=0;i<=res;i++) chmax(ans,res+dp2[3][i]);
    
    cout << ans << endl;
}


Measured memory_bytes: 979632
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<stdio.h>
#include<queue>
#include <climits>
const int mod = 1e9 + 7;
const int INF = 1e9;
using namespace std;
typedef long long ll;

int main()
{
    int n;
    string s;
    int k;
    cin >> n >> s >> k;
    char x = s[k-1];
    for(int i = 0; i < n; i++){
        if(s[i] == x){
            cout << x;
        }else{
            cout << '*';
        }
    }
}


Measured memory_bytes: 256
if __name__ == '__main__':
    from sys import stdin
    # from collections import defaultdict
    import math
    input = stdin.readline

    # import random

    a, b, n = map(int, input().split())
    """
    a = random.randint(1, 10**6)
    b  = random.randint(1, 10**6)
    n = random.randint(1, 10**12)
    """
    # print(a, b, n)
    
    if b > n:
        # print('a')
        print(int(math.floor((a*n)/b) - a*math.floor(n/b)))
        exit()
    print(int(math.floor((a*(b-1))/b)))

Measured memory_bytes: 9136
#include<bits/stdc++.h>
using namespace std;
const int maxn=10;
int n,x[maxn],y[maxn];
long double tot;
bool vis[maxn];
long double dist(int a,int b)
{
	return sqrt((x[a]-x[b])*(x[a]-x[b])+(y[a]-y[b])*(y[a]-y[b]));
}
void dfs(int d,int cur,long double dis)
{
	if(d==n)
	{
		tot+=dis;
		return;
	}
	for(int i=1;i<=n;i++)
		if(!vis[i])
		{
			vis[i]=true;
			dfs(d+1,i,dis+dist(cur,i));
			vis[i]=false;
		}
}
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++) cin>>x[i]>>y[i];
	for(int i=1;i<=n;i++)
	{
		vis[i]=true;
		dfs(1,i,0);
		vis[i]=false;
	}
	for(int i=2;i<=n;i++) tot/=i;
	printf("%.10Lf\n",tot);
	return 0;
}

Measured memory_bytes: 256