akhauriyash/Code-Regression huggingface dataset:
use proconio::input;

fn main() {
    input! {
        x: i64
    };
    let ans = if x < 600 {
        8
    } else if x < 800 {
        7
    } else if x < 1000 {
        6
    } else if x < 1200 {
        5
    } else if x < 1400 {
        4
    } else if x < 1600 {
        3
    } else if x < 1800 {
        2
    } else {
        1
    };
    println!("{}", ans);
}


Measured memory_bytes: 2124
N, H = map(int, input().split(' '))
katana = [map(int, input().split(' ')) for _ in range(N)]
dmg_wield, dmg_throw = zip(*katana)

dmg_wield_max = max(dmg_wield)
dmg_throw = sorted([d for d in dmg_throw if d > dmg_wield_max])

n = 0
while H > 0 and dmg_throw:
    H -= dmg_throw.pop()
    n += 1

print(n + max(H-1, -1) // dmg_wield_max + 1)

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

# define rep(i, n) for(int(i)=0;(i)<(n);(i)++)
# define reps(i, n) for(int(i)=1;(i)<=(n);(i)++)
# define rrep(i, n) for(int i=((int)(n)); i>0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>=0; --i)
# define ALL(v) v.begin(), v.end()
template<class T>inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<typename T> void dump(T e){std::cout << e << std::endl;}
template<typename T> void dump(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void dump(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ dump(v); } }
typedef long long ll;


int main() {
  int n; cin >> n;
  ll x; cin >> x;
  vector <int> a(n);
  
  int sum;
  rep(i, n) {
    cin >> a[i];
    sum += a[i];
  }
  sort(a.begin(), a.end());
  
  int cnt;
  rep(i, n) {
    x -= a[i];
    if (x >= 0) cnt++;
    else break;
  }
  if (x>0) cnt --;
  dump(cnt);
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#define llint long long

using namespace std;

llint parent[100005];
llint N, M;
llint a[100005];
vector<llint> cmp[100005];

void init(){
	for(llint i = 0; i < N; i++) parent[i] = i;
}

llint root(llint i)
{
	if(parent[i] == i) return i;
	return parent[i] = root(parent[i]);
}

void unite(llint i, llint j)
{
	llint root_i = root(i), root_j = root(j);
	if(root_i == root_j) return;
	parent[root_i] = root_j;
}

bool same(llint i, llint j)
{
	return root(i) == root(j);
}

int main(void)
{
	cin >> N >> M;
	for(llint i = 0; i < N; i++) cin >> a[i];
	init();
	
	llint x, y;
	for(llint i = 0; i < M; i++){
		cin >> x >> y;
		unite(x, y);
	}
	
	for(llint i = 0; i < N; i++) root(i);
	for(llint i = 0; i < N; i++){
		cmp[parent[i]].push_back(a[i]);
	}
	
	llint cnt = 0, ccnt = 0;
	for(llint i = 0; i < N; i++){
		if(cmp[i].size() == 1) cnt++;
		if(cmp[i].size() > 0) ccnt++;
	}
	
	if(ccnt == 1){
		cout << 0 << endl;
		return 0;
	}
	if(2*(N-M-1) > N){
		cout << "Impossible" << endl;
		return 0;
	}
	
	llint sum = 0;
	for(llint i = 0; i < N; i++){
		if(cmp[i].size() > 0){
			sort(cmp[i].begin(), cmp[i].end());
			sum += cmp[i][0];
		}
	}
	
	vector<llint> vec;
	for(llint i = 0; i < N; i++){
		if(cmp[i].size() > 1){
			for(llint j = 1; j < cmp[i].size(); j++) vec.push_back(cmp[i][j]);
		}
	}
	sort(vec.begin(), vec.end());
	
	for(llint i = 0; i < 2*(N-M-1)-(N-M); i++) sum += vec[i];
	cout << sum << endl;
	
	return 0;
}

Measured memory_bytes: 7296
## coding: UTF-8
from decimal import *
from itertools import permutations, combinations,combinations_with_replacement,product

s = input().split()
t = [int(p) for p in s]

#print(t)
N = t[0] #偶数
M = t[1]

answer = int(N * (N-1) / 2) + int(M * (M-1) / 2)
print(answer)

Measured memory_bytes: 5076
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define 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 MIN(x) *min_element(ALL(x)) //最小値を求める
typedef long long ll;
typedef long double ld;
int main(){
    ll n;cin>>n;
    vector<ll> v(n),list;
    REP(i,n)cin>>v[i];
    map<ll,ll> mp;
    REP(i,n){
        ll a=v[i];
        if(mp.find(a)!=mp.end()){
            mp.at(a)++;
        }else{
            mp.insert(make_pair(a,1));
            list.push_back(a);
        }
    }
    ll sum=0;
    REP(i,SIZE(list)){
        ll key=list[i];
        ll value=mp.at(key);
        if(key>value){
            sum+=value;
        }else if(key<value){
            sum+=value-key;
        }
    }
    cout<<sum<<endl;
    return 0;
}


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

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static long LINF = 1L << 55;
	static int MOD = 1000000007;
	static int[] mh4 = { 0, -1, 1, 0 };
	static int[] mw4 = { -1, 0, 0, 1 };
	static int[] mh8 = { -1, -1, -1, 0, 0, 1, 1, 1 };
	static int[] mw8 = { -1, 0, 1, -1, 1, -1, 0, 1 };

	static class TaskX {

		public void solve(int testNumber, InputReader in, PrintWriter out) {

			int N = in.nextInt(), T = in.nextInt();
			int[] c = new int[N];
			int[] t = new int[N];
			for (int i = 0; i < N; i++) {
				c[i] = in.nextInt();
				t[i] = in.nextInt();
			}

			int cost = INF;
			for (int i = 0; i < N; i++) {
				if (t[i] <= T) {
					cost = Math.min(cost, c[i]);
				}
			}

			out.println(cost == INF ? "TLE" : cost);

		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

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

		public double nextDouble() {
			return Double.parseDouble(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public int[] nextIntArrayDec(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt() - 1;
			}
			return res;
		}

		public int[] nextIntArray1Index(int n) {
			int[] res = new int[n + 1];
			for (int i = 0; i < n; i++) {
				res[i + 1] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public long[] nextLongArrayDec(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong() - 1;
			}
			return res;
		}

		public long[] nextLongArray1Index(int n) {
			long[] res = new long[n + 1];
			for (int i = 0; i < n; i++) {
				res[i + 1] = nextLong();
			}
			return res;
		}

		public double[] nextDoubleArray(int n) {
			double[] res = new double[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextDouble();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}
	}

}


Measured memory_bytes: 21460
#include <bits/stdc++.h>
#define ll long long

using namespace std;

bool plain(string s){
    for(int i = 0;i<s.size()/2;i++)  if(s[i] != s[s.size() - i - 1])  return false;
    return true;
}

int main()
{
    string s;   cin >> s;
    bool check = true;
    check&=plain(s);
    check&=plain(s.substr(0 , (s.size() - 1)/2));
    check&=plain(s.substr((s.size() + 3)/2 - 1 , s.size() - ((s.size() + 3)/2) + 1));
    cout << (check ? "Yes" : "No");
    return 0;
}


Measured memory_bytes: 256
fn main() {
    let n: usize = read();
    let k: usize = read();
    let mut l: Vec<usize> = Vec::new();
    for _i in 0..n {
        l.push(read());
    }
    l.sort();
    let mut ans = 0;
    for _i in 0..k {
        ans += l.pop().unwrap();
    }
    println!("{}", ans);
}

// 以下関数


use std::io::*;
use std::str::FromStr;
pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

pub const MOD: u64 = 1_000_000_007;

pub fn is_prime(n: i32) -> bool {
    if n < 2 {
        return false;
    } else if n == 2 {
        return true;
    }
    let mut i = 2;
    while i * i < n {
        if n % i == 0 {
            return false;
        } else {
            i += 1;
            continue;
        }
    }
    true
}

pub fn lcm(mut n: i32, mut m: i32) -> i32 {
    n = if n > m { m } else { n };
    m = if n > m { n } else { m };
    let mut i = n;
    while i % m != 0 {
        i += n;
    }
    i
}

pub fn abs(n: i32) -> i32 {
    if n >= 0 {
        n
    } else {
        -n
    }
}

pub fn max(n: i32, m: i32) -> i32 {
    if n >= m {
        n
    } else {
        m
    }
}

pub fn min(n: i32, m: i32) -> i32 {
    if n <= m {
        n
    } else {
        m
    }
}

pub fn factorial(n: u32) -> u32 {
    if n == 0 {
        return 1
    }
    let mut r = n;
    for i in 0..n-1{
        r *= n-i-1;
    }
    r
}

pub fn combination(n: u32, m: u32) -> u32 {
    factorial(n) / factorial(m) / factorial(n-m)
}

Measured memory_bytes: 4352
#include<stdio.h>

int main(void){
    int n[100],x[100] ={0};
    int c[100] = {0};
    int a,b;
   int i, j, k,s,h;
   s = 0;
   while(1){
      
    scanf("%d %d",&a,&b);
    if(a == 0 && b == 0){
        break;
    }
    n[s] = a;
    x[s] = b;
    s++;
   }
 
int sum =0;
for(h = 0;h<s;h++)  
{ 
for ( i = 1;i<n[h];i++ ) {
    for ( j = i+1;j<n[h];j++) {
        for ( k = j+1;k<=n[h];k++ ) {
               sum = i+j+k;
               
               if (sum == x[h]){
                c[h]++;
                
                
               }
            
        }
    }
  }
}
for(i =0;i<s;i++)
    printf("%d\n",c[i]);

return 0;
}


Measured memory_bytes: 2040
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		// ?¨??????\???????????????????????????????????????
		Scanner sc= new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] values = new int[w];
		for(int i= 0; i< values.length; i++) {
			values[i] = i+ 1;
		}
		for(int i= 0; i< n; i++) {
			String str= sc.next();
			String[] ab = str.split(",");
			int a = Integer.parseInt(ab[0]) -1;
			int b = Integer.parseInt(ab[1]) -1;
			// a??¨b????????£???values??????????????????
			int c = values[a];
			values[a] = values[b];
			values[b] = c;
		}
		// values??????????????????
		for(int i = 0; i<values.length ; i++) {
			System.out.println(values[i]);
		}
	}
}

Measured memory_bytes: 17196
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
 
#define INF_LL 1e18
#define INF 1e9
 
#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
 
using namespace std;
 
using ll = long long;
using PII = pair<int, int>;
 
class Union_find{
private:
	vector<int> par;
	vector<int> rank;
	int n;
 
public:
	Union_find(int a){
		n = a;
		for(int i = 0;i < n;i++){
			par.push_back(i);
			rank.push_back(0);
		}
	}
 
	int find(int x){
		if(par[x] == x){
			return x;
		}else{
			return par[x] = find(par[x]);
		}
	}
 
	void unite(int x, int y){
		x = find(x);
		y = find(y);
		if(x == y) return;
 
		if(rank[x] < rank[y]){
			par[x] = y;
		}else{
			par[y] = x;
			if(rank[x] == rank[y]) rank[x]++;
		}
	}
 
	bool same(int x, int y){
		return find(x) == find(y);
	}
};
 
ll mod = 1e9+7;
 
ll powm(ll x, ll a){
	ll res = 1;
	REP(i, a){
		res = (res * x) % mod;
	}
	return res;
}
 
int main(void){
	ll in;
	cin >> in;
	ll res = in/11;
	res *= 2;
	if(in % 11 > 6){
		res += 2;
	}else if(in % 11 > 0){
		res += 1;
	}
	cout << res << endl;
}


Measured memory_bytes: 256
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
q = int(input())
ca = Counter(a)
ans = sum(a)
for _ in range(q):
    b, c = map(int, input().split())
    if b in ca.keys():
        x = ca[b]
        ca[b] = 0
        if c in ca.keys():
            ca[c] += x
        else:
            ca[c] = x
        ans += (c-b)*x
        print(ans)
    else:
        print(ans)

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

int main() {
 int h;
  int n;
  cin>>h>>n;
  int d=0;
  
  
  
  vector<int> vec(n);
     
  for (int i = 0; i < n; i++) {
    cin >> vec.at(i);
    d=d+vec.at(i);
  }
  if(d<h){
    cout<<"No"<<endl;
  }
    else{
      cout<<"Yes"<<endl;
    }
   
}
 


Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<deque>
#include<math.h>
using namespace std;
#define ll long long
int main(){
    string S;
    cin >> S;
    ll a=0,b=0,c=0;
    ll N =S.size();
    ll i;
    for(i=0;i<N;i++){
        if(S[i]=='a')a++;
        if(S[i]=='b')b++;
        if(S[i]=='c')c++;
    }
    if(a!=S.size()/3&&a!=(S.size()-1)/3+1){
        cout << "NO";
        return 0;
    }
    if(b!=S.size()/3&&b!=(S.size()-1)/3+1){
        cout << "NO";
        return 0;
    }
    if(c!=S.size()/3&&c!=(S.size()-1)/3+1){
        cout << "NO";
        return 0;
    }
    cout << "YES";
    return 0;
}


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

int main (){
	
	string s; 
	cin >> s;
	int ma = 0;
	int ans = 0;
	int co = 0;
	for (int i=0; i<s.size(); i++){
		if (s[i] == 'R') co ++;
		
		else {
			ans = max (co, ans);
			co =0;
		}
	}
	
	ans = max (co, ans);
	cout << ans << "\n";
}

    

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

int main() {
  int N, i;
  cin >> N;
  double x[N], total = 0;
  string u[N];
  for (int i = 0; i < N; i++) {
    cin >> x[i] >> u[i];
    if (u[i] == "JPY")
      total += x[i];
    else
      total += x[i] * 380000.0;
  }
  
  cout << total;
  
  return 0;
}


Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <limits>
#include <tuple>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <numeric>
#include <string>
#include <array>
#include <iomanip>

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rrep(i, n) for (int i = n-1; i >= 0; --i)
#define REP(i, s, n) for (int i = s; i< (int)(n); ++i)
#define all(x) x.begin(), x.end()

using namespace std;
using ll = long long;

class Node {
 public:
  ll cost;
  ll to, from;
  bool operator<(const Node &node) const noexcept{
    return this->cost < node.cost;
  };
};

// Union Find begin

class UnionFind {
 private:
  vector<ll> _par;
  vector<ll> _rank;
 public:
  explicit UnionFind(ll n);
  ll find(ll x);
  void unite(ll x, ll y);
  bool isSame(ll x, ll y);
};

UnionFind::UnionFind(ll n) {
  for (ll i = 0; i < n; ++i) {
    _par.push_back(i);
    _rank.push_back(0);
  }
}

ll UnionFind::find(ll x) {
  if (_par.at(static_cast<unsigned long>(x)) == x) return x;
  else return _par.at(static_cast<unsigned long>(x)) = find(_par.at(static_cast<unsigned long>(x)));
}

void UnionFind::unite(ll x, ll y) {
  x = find(x);
  y = find(y);
  if (x == y) return;

  if (_rank.at(static_cast<unsigned long>(x)) < _rank.at(static_cast<unsigned long>(y)))
    _par.at(static_cast<unsigned long>(x)) = y;
  else {
    _par.at(static_cast<unsigned long>(y)) = x;
    if (_rank.at(static_cast<unsigned long>(x)) == _rank.at(static_cast<unsigned long>(y)))
      ++_rank.at(static_cast<unsigned long>(x));
  }

}

bool UnionFind::isSame(ll x, ll y) {
  return find(x) == find(y);
}

// Union Find end

int main() {
  ios::sync_with_stdio(false);

  ll n;
  cin >> n;
  vector<pair<ll, ll>> px(n), py(n);
  rep(i, n) {
    ll x, y;
    cin >> x >> y;
    px.at(i).first = x;
    px.at(i).second = i;
    py.at(i).first = y;
    py.at(i).second = i;
  }
  sort(all(px));
  sort(all(py));

  vector<Node> nodes;
  rep(i, n - 1) {
    ll cost = abs(px.at(i).first - px.at(i + 1).first);
    Node node;
    node.cost = cost;
    node.from = px.at(i).second;
    node.to = px.at(i + 1).second;
    nodes.push_back(node);
  }
  rep(i, n - 1) {
    ll cost = abs(py.at(i).first - py.at(i + 1).first);
    Node node;
    node.cost = cost;
    node.from = py.at(i).second;
    node.to = py.at(i + 1).second;
    nodes.push_back(node);
  }
  sort(all(nodes));
  UnionFind unf(n);
  ll ans = 0;
  for (const auto &node : nodes) {
    if (not unf.isSame(node.from, node.to)) {
      unf.unite(node.from, node.to);
      ans += node.cost;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 12396
#include <iostream>
#include <set>
#include <string>
#include <algorithm>
#include <math.h>
#include <vector>
using namespace std;

int main(){
    int n,h,w;
    int a[1100];
    int b[1100];
    int res=0;
    cin >> n >> h >> w;
    for(int i=0;i<n;i++){
        cin >> a[i] >> b[i];
        if(a[i]>=h && b[i] >=w)res++;
    }
    cout << res << endl;
}

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



int main(){
    ll a, b;
    cin >> a >> b;
    ll ans = 0;
    if(a==1 && b == 1){
       ans+= 400000;
    }
    if(a==1){
        ans+=300000;
    }
    if(b==1){
        ans+=300000;
    }

    if(b==2){
        ans+=200000;
    }
    if(a==2){
        ans+=200000;
    }
    if(a==3){
        ans+=100000;
    }
    if(b==3){
        ans+=100000;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
L,R = map(int,input().split())
if R - L >= 2019 :
    print(0)
else:
    K = []
    for i in range(L,R+1,1):
        a = i % 2019
        K.append(a)
    ans = 10**9+7
    size = len(K)
    for x in range(size):
        for y in range(x+1,size):
            o = K[x] * K[y] % 2019
            if o < ans :
                ans = o
    print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
#include <queue>
using namespace std;
typedef long long int ll;
typedef long double ld;
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;
typedef pair<ll,ll> pairs;
vector<pairs> p;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
bool pairCompareSecond(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.second < secondElof.second;
}
#define MAX_N 100100
bool x[MAX_N];
ll num[MAX_N];
ll fibl[MAX_N]={0};
// 四方向への移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}
 
ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    return p;
}
 
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}
 
ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}


int main(){
    string s;
    cin >> s;
    for (ll i=0;i<s.size();i++){
        if (s[i]=='7'){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}


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

int n;
ll res = (ll)1e16, rmax, rmin, nmax, nmin, gap;
ll arr[200010];

void f(int l, int r){
	int nl, nr, mid;
	ll a, s;
	nl = l; nr = r - 1; gap = (ll)1e16;
	while(nl <= nr){
		mid = (nl + nr) / 2;
		a = arr[mid] - arr[l - 1]; s = arr[r] - arr[mid];
		if(gap > abs(a - s)) nmax = max(a, s), nmin = min(a, s), gap = abs(a - s);
		if(a < s) nl = mid + 1;
		else nr = mid - 1;
	}
}
int main(){
	int i;
	ll l, r;
	scanf("%d", &n);
	for(i = 1; i <= n; i++) scanf("%lld", &arr[i]), arr[i] += arr[i - 1];
	for(i = 2; i < n - 1; i++){
		f(1, i); rmax = nmax, rmin = nmin;
		f(i + 1, n); res = min(res, max(rmax, nmax) - min(rmin, nmin));
	}
	printf("%lld", res);
	return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>          // printf(), scanf()
#include <stdbool.h>

#define MAX_N 50000
#define MAX_SQRT_N 224
#define MAX_P 5140

bool f[MAX_N + 1];
int primes[MAX_P];
int np;

int
main(int argc, char **argv)
{
	int i, j;

	for (i = 0; i <= MAX_N; ++i)
		f[i] = true;

	np = 0;
	for (i = 2; i <= MAX_N; ++i)
	{
		if (f[i])
		{
			primes[np++] = i;
			if (i <= MAX_SQRT_N)
			{
				for (j = i + i; j <= MAX_N; j += i)
					f[j] = false;
			}
		}
	}

	while (true)
	{
		int n;
		scanf("%d", &n);
		if (n == 0)
			break;

		int count = 0;
		for (i = 0; primes[i] <= n / 2; ++i)
		{
			if (n - primes[i] >= 2 && f[n - primes[i]])
				count++;
		}

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

	return 0;
}

Measured memory_bytes: 668
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout <<(#x)<<" is "<<(x)<<endl
#define debug cout <<"hi"<<endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
const int MOD=1e9+7;
const int INF32=1<<30;
const ll INF64=1LL<<60;

void solve(){
  int H,W,h,w; cin >>H >>W >>h >>w;
  cout <<(H-h)*(W-w);
}

int main(){
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  solve();
return 0;}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  int N,R;cin >> N >> R;
  if(N<10) R += 100*(10-N);
  cout << R << endl;
  return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f

#include <iostream>
#include <cstdio>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
  
using namespace std;
  
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P> PP;
  
static const double EPS = 1e-8;
  
int tx[] = {0,1,0,-1};
int ty[] = {-1,0,1,0};

class Requirement{
public:
  int upper;
  int lower;
  Requirement() : upper(INF),lower(0) {}
  Requirement(int _u,int _l) : upper(_u),lower(_l) {}
};

int total_commands;
int total_skills;

bool check_path(int from_command,int to_command,
		Requirement requirement[101][101]){
  for(int skill_id = 0; skill_id < total_skills;skill_id++){
    if(requirement[from_command][skill_id].lower
       > requirement[to_command][skill_id].upper){
      return false;
    }
    // if(requirement[from_command][skill_id].upper
    //    < requirement[to_command][skill_id].lower){
    //   return false;
    // }
  }
  return true;
}

int main(){
  while(~scanf("%d %d",&total_commands,&total_skills)){
    Requirement requirement[101][101];

    bool is_valid[101];
    memset(is_valid,true,sizeof(is_valid));
    for(int command_idx = 0; command_idx < total_commands; command_idx++){
      int total_conditions;
      scanf("%d",&total_conditions);
      for(int condition_idx = 0; condition_idx < total_conditions; condition_idx++){
	int skill_id;
	string symbol;
	int required_point;
	cin >> skill_id >> symbol >> required_point;
	skill_id--;
	if(symbol == ">=") {
	  requirement[command_idx][skill_id].lower
	    = max(required_point,requirement[command_idx][skill_id].lower);
	}
	else if(symbol == "<="){
	  requirement[command_idx][skill_id].upper
	    = min(required_point,requirement[command_idx][skill_id].upper);
	}
	
	if(requirement[command_idx][skill_id].lower
	   > requirement[command_idx][skill_id].upper){
	  is_valid[command_idx] = false;
	}
      }
    }

    
    bool edge[101][101];
    //init
    for(int from = 0; from < total_commands; from++){
      for(int to = 0; to < total_commands; to++){
	edge[from][to] = check_path(from,to,requirement);
      }
    }

    bool used[101];
    memset(used,false,sizeof(used));

    for(int round = 0; round < total_commands; round++){
      for(int start = 0; start < total_commands; start++){
	if(!is_valid[start]) continue;
	if(used[start]) continue;

	bool select = true;
	for(int to = 0; to < total_commands; to++){
	  if(!edge[start][to] && !used[to]){
	    select = false;
	    break;
	  }
	  if(!is_valid[to]){
	    select = false;
	    break;
	  }
	}
	
	if(select){
	  used[start] = true;
	}
      }
    }
    
    int count = 0;
    for(int command_idx=0;command_idx<total_commands;command_idx++){
      if(used[command_idx]) count++;
    }
    printf("%s\n",(count == total_commands) ? "Yes" : "No");
  }
}

Measured memory_bytes: 1328
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
char a[105],flag;
int main()
{
	cin>>a;
	flag=0;
	for(int i=0;i<strlen(a);i++)
	{
		if(a[i]=='C')
		flag=1;
		if(a[i]=='F'&&flag==1)
		{
			cout<<"Yes";
			return 0;
		}
	}
	cout<<"No";
    return 0;
}


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

int main() {
  int n;
  string str;
  cin >> n;
  cin >> str;
  
  int x = 0;
  int ans = 0;

  for(int i=0; i < n; i++){
    if(str[i] == 'I'){
   x = x + 1;
   ans = max(ans,x);
    } else if(str[i] == 'D'){
   x = x - 1;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
// In the name of God

#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>
#include <complex>

using namespace std;

#define rep(i, a, b) for (int i = (a), i##_end_ = (b); i < i##_end_; ++i)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define mp make_pair
#define x first
#define y second
#define pb push_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }
template<typename T> inline bool smin(T &a, const T &b)   { return a > b ? a = b : a;    }
template<typename T> inline bool smax(T &a, const T &b)   { return a < b ? a = b : a;    }

typedef long long LL;

const int N = (int) 1e6 + 6, mod = (int) 0;
int a[N];
int sign(int x) { return x == 0 ? 0 : x < 0 ? -1 : 1; }
int main() {
	ios_base::sync_with_stdio(0);
	int n;
	cin >> n;
	for (int j = 0; j < n; ++j) {
		cin >> a[j];
	}
	long long mn = 1e18;
	for (int st = -1; st <= 1; st += 2) {
		long long cur = 0, res = 0, curst = st;
		for (int j = 0; j < n; ++j) {
			if (curst == -1) {
				curst = 1;
			} else {
				curst = -1;
			}
			cur += a[j];
			long long tmp = cur;
			cur = (sign(cur) != sign(curst) ? curst : cur);
			res += abs(cur - tmp);
		}
		mn = min(res, mn);
	}
	cout << mn << endl;
}












Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    // 初期ポイント
    int k = sc.nextInt();
    int q = sc.nextInt();

    int[] player = new int[n];

    for(int i = 0; i < q; i++){
      int tmp = sc.nextInt();
      player[tmp - 1]++;
    }
    for(int i = 0; i < n; i++){
      // int point = k - (q - player[i]);
      int point =  player[i] + k - q;
      if(point > 0){
        System.out.println("Yes");
      } else {
        System.out.println("No");
      }
    }
  }
}


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

int main ()
{
    int N, K;
    std::cin >> N >> K;
    
    --N;
    --K;
    
    if (N % K == 0)
    {
        std::cout << N/K << std::endl;
    }
    else std::cout << N/K+1 << std::endl;
    
    return 0;
}

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

struct Process
{
  string name;
  int time;
};

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

  queue<Process> queue;
  for (int i = 0; i < n; i++)
  {
    string name;
    int time;
    cin >> name >> time;
    queue.push(Process{name, time});
  }

  int t = 0;
  while (!queue.empty())
  {
    auto p = queue.front();
    queue.pop();

    if (p.time > q)
    {
      t += q;
      queue.push(Process{p.name, p.time - q});
    }
    else
    {
      t += p.time;
      cout << p.name << " " << t << endl;
    }
  }
}



Measured memory_bytes: 6344
#include<iostream>
#include<algorithm>
using namespace std;
#define MAX 1100
#define INF ((int)1e9+9)

int main(){
	int n, a[MAX], q, com, b, e;
	
	cin>>n;
	
	for(int i = 0; i < n; i++) cin>>a[i];
	
	cin>>q;
	
	for(int i = 0; i < q; i++){
		cin>>com>>b>>e;
		int ma = -INF, mi = INF;
		for(int j = b; j < e; j++) ma = max(a[j], ma), mi = min(a[j], mi);
		cout<<(com?ma:mi)<<endl;
	}
	return 0;
}


Measured memory_bytes: 3104
#[allow(unused_imports)]
use std::cmp;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::vec::Vec;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize,
    }
    println!("{}", n / 3)
}


Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <cstdio>
#include <set>
#include <cmath>
#include <unordered_map>
#include <algorithm>
#include <stack>
#include <unordered_set>
using namespace std;

int main () {
	vector<int> v;
	int a, b, c, d, e, k;
	cin >> a >> b >> c >> d >> e >> k;
	v.push_back(a);
	v.push_back(b);
	v.push_back(c);
	v.push_back(d);
	v.push_back(e);
	sort(v.begin(), v.end());
	if (v[4] - v[0] <= k)
		cout << "Yay!" << endl;
	else
		cout << ":("<< endl;



}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.util.Comparator;
import java.util.Collections;
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);
        CGoToSchool solver = new CGoToSchool();
        solver.solve(1, in, out);
        out.close();
    }

    static class CGoToSchool {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            ArrayList<node> a = new ArrayList<>();
            for (int i = 0; i < n; i++) {
                a.add(new node(in.nextInt(), i + 1));
            }
            Collections.sort(a, new Comparator<node>() {

                public int compare(node o1, node o2) {
                    return o1.x - o2.x;
                }
            });
            for (int i = 0; i < n; i++) out.print(a.get(i).y + " ");
        }

        class node {
            int x;
            int y;

            node(int x, int y) {
                this.x = x;
                this.y = y;
            }

        }

    }

    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 int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 44380
#include <iostream>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;

int main(void) {
    int n;
    cin >> n;

    int dp[n+1];

    rep(i, n+1) {
        dp[i] = i;
        int b = 6;
        while (b <= i) {
            dp[i] = min(dp[i-b]+1, dp[i]);
            b *= 6;
        }
        b = 9;
        while (b <= i) {
            dp[i] = min(dp[i-b]+1, dp[i]);
            b *= 9;
        }
    }
    cout << dp[n] << endl;
}


Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
	Scanner sc;
	int[][] map;
	final int WIDTH  = 12;
	final int HEIGHT = 12;

	private Main(){
		sc = new Scanner( System.in );
	}

	private void visit( int x, int y ){
		if( x < 0 || y < 0 || x >= WIDTH || y >= HEIGHT || map[ x ][ y ] == 0){ return; }
		map[ x ][ y ] = 0;
		visit( x - 1, y     );
		visit( x    , y - 1 );
		visit( x    , y + 1 );
		visit( x + 1, y     );

	}

	private void run(){
		while( sc.hasNext() ){
			int counter = 0;
			map = new int[ WIDTH ][ HEIGHT ];
			for( int y = 0; y < HEIGHT; y++ ){
				String line = sc.next();
				char[] cline = line.toCharArray();
				for(int x = 0; x < WIDTH; x++ ){
					map[ x ][ y ] = cline[ x ] - '0';
				}
			}
			for( int y = 0; y < HEIGHT; y++ ){
				for( int x = 0; x < WIDTH; x++ ){
					if( map[ x ][ y ] == 1 ){
						counter++;
						visit( x, y );
					}
				}
			}
			System.out.println( counter );
		}
	}

	public static void main( String[] args ){
		new Main().run();
	}

}

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

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

    int N, H, W;
    cin >> H >> W >> N;
    vector<int> A(N + 1);
    for (int i = 1; i <= N; ++i) {
        cin >> A.at(i);
    }

    vector<vector<int> > C(H, vector<int>(W));
    int y = 0, x = 0;
    for (int i = 1; i <= N; ++i) {
        int num = A.at(i);
        while (num) {
            C.at(y).at(x) = i;
            num--;
            if (y % 2 == 0) {
                if (x == W - 1) {
                    y++;
                } else {
                    x++;
                }
            } else {
                if (x == 0) {
                    y++;
                } else {
                    x--;
                }
            }
        }
    }
    for (int y = 0; y < H; ++y) {
        for (int x = 0; x < W; ++x) {
            if (x) cout << ' ';
            cout << C.at(y).at(x);
        }
        cout << endl;
    }

    return 0;
}

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

struct UnionFind {
	vector<int> par;

	UnionFind(int n) : par(n, -1) { }
	void init(int n) { par.assign(n, -1); }

	int root(int x) {
		if (par[x] < 0) return x;
		else return par[x] = root(par[x]);
	}

	bool issame(int x, int y) {
		return root(x) == root(y);
	}

	bool merge(int x, int y) {
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y); // merge technique
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x) {
		return -par[root(x)];
	}
};

int main() {
	int N, M;
	cin >> N >> M;
	UnionFind uf(N);
	for (int n = 0; n < M; ++n) {
		int A, B;
		cin >> A >> B;
		A--;
		B--;
		uf.merge(A,B);
	}
	set<int>st;
	for (int n = 0; n < N; ++n) {
		st.insert(uf.root(n));
	}
	cout << st.size() - 1 << endl;
	return 0;
}


Measured memory_bytes: 7668
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;

#define INX(x) (cin >> x)
#define OUTX(x) (cout << x << endl)

#define ADD emplace_back
#define MP make_pair
#define VVEC(type) vector<vector<type>>


int main()
{
    ll D, T, S;
    cin >> D >> T >> S;
    cout << (D > T * S ? "No" : "Yes") << endl;



    return 0;
}


Measured memory_bytes: 3616
#include <iostream>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  int N, A, B;
  cin >> N >> A >> B;
  if ((B - A) % 2)
    cout << "Borys" << endl;
  else
    cout << "Alice" << endl;
  return 0;
}


Measured memory_bytes: 3648
D, G = map(int,input().split())
pc = [list(map(int,input().split())) for i in range(D)]

ans = float("inf")
for bit in range(1 << D):
    cnt = 0
    sum = 0
    remain = set(range(1,D+1))

    for i in range(D):
        if bit & (1 << i):
            cnt += pc[i][0]
            sum += pc[i][0]*(i+1)*100 + pc[i][1]
            remain.discard(i+1)

    if sum < G:
        use = max(remain)
        n = min(pc[use-1][0],-(-(G - sum)//(use*100)))
        cnt += n
        sum += n*use*100

    if sum >= G:
        ans = min(ans,cnt)

print(ans)

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

int main(){
    int i , n , k , j , cnt = 0 , x;
    cin>>k>>n;
    for(i = 0 ; i <= k ; i++){
        for(j = 0 ; j <= k ; j++){
            x = n - (i + j);
            if((x >= 0 and x <= k) and (i + j + x == n))
                cnt++;
        }
    }
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 3624
#pragma GCC diagnostic error "-std=c++14"
#pragma GCC target("avx")
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
char s[105];
long long ans,flag=0,t,k=0;
int main(){
    scanf("%s",&s);
    t=(s[0]-'0')-1;
    if((strlen(s)-1)==0){
        cout<<s<<endl;
        return 0;
    }
    ans+=(strlen(s)-1)*9;
    for(register int i=0;i<strlen(s);++i)
        if(s[i]=='9')
			flag++;
    if(flag==strlen(s))
		t++; 
    ans+=t; 
	for(register int i=0;i<strlen(s);++i)
	  	k+=s[i]-'0';
	ans=max(k,ans);
    printf("%lld",ans);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep2(i, m, n) for(int i=int(m); i<int(n); ++i)
#define drep2(i, m, n) for(int i=int(m-1); i>=int(n); --i)
#define rep(i, n) rep2(i, 0, n)
#define drep(i, n) drep2(i, n, 0)
#define all(a) a.begin(), a.end()
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using Vbo = vector<bool>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using VVbo = vector<Vbo>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (auto &e : v) is >> e; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << " "; return os; }
template<typename T> inline int count_between(vector<T> &a, T l, T r) { return lower_bound(all(a), r) - lower_bound(all(a), l); } // [l, r)
inline int Log2(ll x) { int k; for (k = 0; x > 0; ++k) x >>= 1; return k; } // number of binary digits
const int INF  = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS   = 1e-10;
const int MOD  = int(1e9)+7;


struct mint {
  ll x;
  mint(ll x=0):x((x%MOD+MOD)%MOD){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += MOD-a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= MOD; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
  mint& operator/=(const mint r) {
    ll a = r.x, b = MOD, u = 1, v = 0;
    while (b) {
      ll t = a / b;
      a -= t * b; swap(a, b);
      u -= t * v; swap(u, v);
    }
    x = x * u % MOD;
    if (x < 0) x += MOD;
    return *this;
  }
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


int main() {
  ll n, K; cin >> n >> K;

  mint ans = 0;
  rep2(k, K, n+2) {    
    ans += n*k - ll(k)*(k-1) + 1;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3652
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define pb(a) push_back(a)
#define all(x) (x).begin(), (x).end()

#define FOR(i, a, n) for (int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))

#define PRINT(str) printf(#str "\n")
#define yOUT PRINT(Yes)
#define nOUT PRINT(No)
#define YOUT PRINT(YES)
#define NOUT PRINT(NO)

//関数定義
//最大公約数
ll gcd(ll a, ll b);

//最小公倍数
ll lcm(ll a, ll b);

int main() {
  // ========================================================
  int k, x;
  cin >> k >> x;
  FOR(i, x - k + 1, x + k) {
    if (i >= -100000 && i <= 100000) {
      cout << i << " ";
    }
  }
  cout << endl;
}

//最大公約数
ll gcd(ll a, ll b) {
  if (!b) return a;
  return gcd(b, a % b);
}

//最小公倍数
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }

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

int main(){
  ll x;cin>>x;
  ll a=100;
  
  ll ans=0;
  while(true){
    ans++;
    a+=a*0.01;
    if(a>=x) break;
  }
  cout<<ans<<endl;
}

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

using namespace std;

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

    int founda = 0;
    int aidx = 0;
    int zidx = 0;

    for (int i=0; i<s.length(); i++) {
        if (s[i] == 'A' && founda == 0) {
            founda++;
            aidx = i;
        } else if (s[i] == 'Z')
            zidx = i;
    }

    cout << zidx - aidx + 1 << endl;

    return 0;
}

Measured memory_bytes: 640
#include <stdio.h>

#include <math.h>

#include<limits.h>
#define NIL -1
#define MAX 100
int r[MAX], c[MAX];

int A[MAX][MAX];
 
int chain(int left, int right)
{
  int res=INT_MAX;
  int i;
 
  if (A[left][right] >= 0){


    return A[left][right];

  }
  if (left == right){
    return 0;
  }
  



  for (i = left; i < right; i++){

    /*計算*/
    res = fmin(res, chain(left, i) + chain(i + 1, right) + r[left] * c[i] * c[right]);
  }

  A[left][right] = res;


  return A[left][right];
}
 
int main()
{
  int n, i, j;

  /*初期化*/   
  for(i = 0; i < 100; i++){
    for(j = 0; j < 100; j++){
      A[i][j] = NIL;
    }
  }
  /*入力*/
  scanf("%d", &n);
  
  



  for (i = 0; i <= n-1;i++){

    scanf("%d ", &r[i]);

    scanf("%d",&c[i]);

  }


 
  printf("%d\n", chain(0, n - 1));


  return 0;
}

Measured memory_bytes: 648
#include<cstdio>
#include<iostream>
#define ll long long
using namespace std;
ll a[100000 +10];
ll dp[100000 +10];
ll inf = 0x3f3f3f3f3f3f3f;
int main()
{
//	cout<<inf<<endl;
	ll n,k; scanf("%lld%lld",&n,&k);
	ll i,j;
	for(i=1;i<=n;i++) scanf("%lld",&a[i]);
	for(i=1;i<=n;i++) dp[i] = inf ;
	dp[1] =0;
	for(i=1;i<=n;i++)
	{
		for(j=i-1;j>=i-k;j--)
		{
			if(j>0)
			{
				dp[i] = min(dp[i]  , dp[j] + abs(a[i] - a[j]));
			} 
			else break;
		}
	}
	printf("%lld\n",dp[n]);
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define man 10000
using namespace std;
bool dislike[10]={false};
bool valid(int n){
	while(n){
		if(dislike[n%10]) return false;
		n/=10;
	}
	return true;
}
int main() {
	// your code goes here
	int n, k,val;
	cin>>n>>k;
	for(int i=0;i<k;i++) {
		cin>>val;
		dislike[val] = true;
	}
	while(true){
		if(valid(n)) break;
		n++;
	}
	printf("%d\n",n);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n; cin >> n;
  int num = 100000;
  for ( int i = 0; i < n; i++ ) {
    int result = (int)(num*1.05) % 1000;
    if ( result == 0 ) num *= 1.05;
    else num = num * 1.05 + 1000 - result;
  }
  cout << num << endl;
  return 0;
}

Measured memory_bytes: 1160