akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

// Seishun 18 Kippu 2013
// 2013/09/10
public class Main{
	Scanner sc=new Scanner(System.in);

	int INF=1<<28;
	double EPS=1e-12;

	void run(){
		int n=sc.nextInt(), t=sc.nextInt();
		sc.next();
		sc.next();
		int count=0;
		String line="";
		for(int i=0; i<n-1; i++){
			int time1=f(sc.next());
			String name=sc.next();
			int time2=f(sc.next());
			sc.next();
			if(time2-time1>=t){
				line+=name+" "+(time2-time1)+"\n";
				count++;
			}
		}
		line=count+"\n"+line;
		print(line);
	}

	int f(String s){
		return Integer.parseInt(s.substring(0, 2))*60
				+Integer.parseInt(s.substring(3, 5));
	}

	void solve(){

	}

	void debug(Object... os){
		System.err.println(Arrays.deepToString(os));
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

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

Measured memory_bytes: 17384
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
  int n, a[200000] = {};
  cin >> n;
  for(int i = 0; i < n; i++)
    cin >> a[i];
  for(int i = n - 1; i >= 0; i -= 2)
    cout << a[i] << " ";
  for(int i = n % 2; i < n - 2; i += 2)
    cout << a[i] << " ";
  if(n >= 2) cout << a[n - 2] << endl;
  return 0;
}

Measured memory_bytes: 2944
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"

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

    int k, a, b;
    cin >> k >> a >> b;
    int i;
    for(i = a; i <= b; i++){
        if(i % k == 0)
            break;
    }
    if(i == b + 1)
        cout << "NG";
    else
        cout << "OK";
    cout << endl;

    return 0;
}

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

using namespace std;
const int maxn = 1e5 + 30;

int goright[maxn];

int main(){
  int n; cin >> n;
  vector<int> a;
  for(int i=0;i<n;i++){
    int t; scanf("%d", &t);
    a.push_back(t);
  }
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  for(int i = n-1; i >= 0; i--){
    if(i == n-1 || a[i] != a[i+1]) goright[i] = 0;
    else goright[i] = goright[i+1] + 1;
  }
  int x = 0;
  while(true){
    x++;
    if(a[x] <= x) break;
  }
  x--;
  assert(a[x] > x);
  if(a[x] - 1 == x){
    if(goright[x] % 2 == 0) cout << "Second\n";
    else cout << "First\n";
  }
  else{
    if((a[x] - x) % 2 == 0){
      cout << "First\n";
    }
    else{
      if(a[x+1]-1 == x && goright[x+1] % 2 == 0){
	cout << "First\n";
      }
      else{
	cout << "Second\n";
      }
    }
  }
}


Measured memory_bytes: 1144
import java.util.Scanner;
class Main{
    int a,b;
    public void Germany() {
        Scanner sc = new Scanner(System.in);
            a = sc.nextInt();
            b = sc.nextInt();
        if(a < b) {
        System.out.println("a < b");
        }else if(a > b){
                System.out.println("a > b");
        }else{
                System.out.println("a == b");
                }
    }
    public static void main(String[] args) {
        new Main().Germany();
    }
}

Measured memory_bytes: 17156
#include<bits/stdc++.h>
using namespace std;
long long int dp[1007][1007];
bool matris[1007][1007];
const long long int md=1000000007;
int main()
{
	/*freopen("a.gir","r",stdin);
	freopen("a.cik","w",stdout);*/
	int n,w;
	cin >> n >> w;
	char a;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<w;j++)
		{
			cin >> a;
			if(a=='#')
				matris[i][j]=1;
		}
	}
	dp[0][0]=1;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<w;j++)
		{

			if(matris[i][j]==1)
			{
				dp[i][j]=0;
			}
			else
			{
				if(i==0 && j==0)
					continue;
				else if(i==0 && j!=0)
				{
					dp[i][j]=dp[i][j-1];
				}
				else if(i!=0 && j==0)
				{
					dp[i][j]=dp[i-1][j];
				}
				else
					dp[i][j]=(dp[i-1][j]%md+dp[i][j-1]%md)%md;
			}
			// cout << i<< " " << j << " "<< dp[i][j] << "\n";
		}	
	}
	cout << dp[n-1][w-1] << "\n";

}

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

int main(){
    int n, k;
    cin >> n >> k;
    int x;

    int sum = 0;
    for(int i = 0; i < n; i++){
        cin >> x;
        sum += min(abs(x), abs(x-k))*2;
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace YieldSample
{
    class Program
    {
        static void Main()
        {
            var sc = new Scanner();
            Enumerable.Range(1, 30)
                .Except(sc.IntArray(28))
                .Output();

            Console.ReadKey();
        }
    }
}

static class Extensions
{
    public static IEnumerable<T> Output<T>(this IEnumerable<T> source)
    {
        foreach (var item in source)
        {
            Console.WriteLine(item);
        }
        return source;
    }

    public static T Print<T>(this T obj)
    {
        Console.WriteLine(obj);
        return obj;
    }
}

public class Scanner
{
    string[] buffer = new string[0];
    int index = 0;
    public char[] SplitChars { get; set; }
    public string String()
    {
        if (index < buffer.Length) return buffer[index++];
        string line = "";
        while (line == "") line = Console.ReadLine();
        if (line == null) return null;
        buffer = line.Split(SplitChars, StringSplitOptions.RemoveEmptyEntries);
        index = 0;
        return buffer[index++];
    }
    public string[] StringArray(int count) { return NextArray(count, x => x); }
    public void Skip(int count) { for (int i = 0; i < count; i++) String(); }
    public T Next<T>(Func<string, T> parser) { return parser(String()); }
    public T[] NextArray<T>(int count, Func<string, T> parser)
    {
        var arr = new T[count];
        for (int i = 0; i < count; i++) arr[i] = Next(parser);
        return arr;
    }
    public int Int() { return Next(int.Parse); }
    public int[] IntArray(int count) { return NextArray(count, int.Parse); }
    public double Double() { return Next(double.Parse); }
    public double[] DoubleArray(int count) { return NextArray(count, double.Parse); }
}

Measured memory_bytes: 10068
n, m = map(int, input().split())
cnt = 0
ac_cnt = 0
wa_cnt = 0
ans_flag = 0
bp = -1
d = []
for i in range(m):
    a, b = map(str, input().split())
    d.append([a, b])
d.sort(key=lambda x: x[0])
# print(d)
for i in range(m):
    p, s = d[i][0], d[i][1]
    # print(p, s)
    if bp != p:
        cnt = 0
        ans_flag = 0
    if s == 'WA' and ans_flag == 0:
        cnt += 1
    elif s == 'AC' and ans_flag == 0:
        ac_cnt += 1
        wa_cnt += cnt
        cnt = 0
        ans_flag = 1
    bp = p

print(ac_cnt, wa_cnt)


Measured memory_bytes: 25936
#include<bits/stdc++.h>
using namespace std;
string str;
int pos = -1;
int main(){
	cin>>str;
	for(int i=0;i<str.length();i++) if(str[i]=='C'){
		pos = i;
		break;
	}
	if(pos==-1){
		printf("No\n");
		return 0;
	}
	for(int i=pos+1;i<str.length();i++) if(str[i]=='F'){
		printf("Yes\n");
		return 0;
	}
	printf("No\n");
	return 0;
}

Measured memory_bytes: 256
def cc
    n = gets.chomp.to_i
    v = gets.chomp.split(/\s/).map{|x| x.to_i}
    v = v.sort

    x = (v[0] +v[1])/2.0
    for i in 2..(v.length-1)
        x = (x+v[i])/2
    end

    puts x
end

cc

Measured memory_bytes: 3836
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <vector>

using namespace std;
typedef long long ll;


void make_z(const string& str, vector<ll>& z); 

void search(
    const string& text,
    const string& pattern,
    set<ll>& out
){
    string concat = pattern + "$" + text; 
    ll l = concat.size(); 
  
    vector<ll> z(l);
    make_z(concat, z);
 
    out.clear();
    for (ll i = pattern.size() + 1; i < l; ++i){
        if (z.at(i) == pattern.size()){
            out.insert(i - pattern.size() - 1);
        }
    } 
} 

void make_z(const string& s, vector<ll>& z) { 
    const ll n = s.size(); 
    ll L = 0, R = 0; 
    for (int i = 1; i < n; ++i) {
        if (i > R) { 
            L = R = i; 
            while (R < n && s[R-L] == s[R]){
                R++;
            }
            z[i] = R-L; 
            R--; 
        }else{  // i <= R
            const ll k = i-L; 
            if (z[k] < R-i+1){
                z[i] = z[k]; 
            }else{
                L = i; 
                while (R<n && s[R-L] == s[R]){
                    R++;
                }
                z[i] = R-L; 
                R--; 
            }
        } 
    } 
} 


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

    int ans = 0;
    for(int pos = 0; pos < s.size() - 1; ++pos){
        int lo = 0;
        int hi = (s.size() - pos) / 2;
        while(lo < hi && hi > ans){
            int mid = (hi + lo + 1) / 2;

            set<ll> out;
            search(
                s.substr(pos + mid, s.size() - (pos + mid)),
                s.substr(pos, mid),
                out
            );
            if(out.size()){
                lo = mid;
            }else{
                hi = mid - 1;
            }

            // auto it = search(
            //     s.begin() + pos + mid,
            //     s.end(),
            //     s.begin() + pos,
            //     s.begin() + pos + mid
            // );
            // if(it != s.end()){
            //     lo = mid;
            // }else{
            //     hi = mid - 1;
            // }
        }
        ans = max(ans, lo);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 528
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...)
#endif

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fls(x) (64 - __builtin_clzll(x))
#define pcnt(x) __builtin_popcountll(x)
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

template <class T>
map<T, int> prime_factor(T n) {
    map<T, int> ret;
    for (T i = 2; i * i <= n; i++) {
        while (n % i == 0) {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1) ret[n] = 1;
    return ret;
}

template <class T>
bool cop (map<T, int> &m1, map<T, int> &m2) {
    if (m1.size() < m2.size()) {
        for (auto [a, b] : m1) if (m2[a] != 0) return false;
    } else {
        for (auto [a, b] : m2) if (m1[a] != 0) return false;
    }
    return true;
}

template <class T>
map<T, int> lcm_prime (map<T, int> &m1, map<T, int> &m2) {
    map<T, int> ret;
    for (auto [a, b] : m1) ret[a] = max(b, m2[a]);
    for (auto [a, b] : m2) ret[a] = max(b, m1[a]);
    return ret;
}


int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n; cin >> n;
    vector<ll> a(n); rep (i, n) cin >> a[i];
    ll setg = a[0]; rep (i, n) setg = gcd(setg, a[i]);
    bool setw = (setg == 1);
    if (!setw) {
        cout << "not coprime\n";
        return 0;
    }

    set<ll> primes;
    rep (i, n) {
        for (auto [p, k] : prime_factor(a[i])) {
            if (primes.find(p) != primes.end()) {
                cout << "setwise coprime\n";
                return 0;
            }
            primes.insert(p);
        }
    }
    cout << "pairwise coprime\n";
    return 0;
}

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

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	int n, a, b; cin >> n >> a >> b;
	cout << min(a, b) << " " << max(0, a + b - n) << '\n';
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=1e9+7;
const ll mod=998244353;
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    double r;cin>>r;
    cout<<fixed<<setprecision(10)<<r*M_PI*2.00<<endl;
}

Measured memory_bytes: 3796
from collections import Counter
N = int(input())
alist = Counter(tuple(map(int,input().split())))
max_counter = 0
com = alist.most_common()
for num,cou in com:
    counter = 0
    counter += cou
    counter += alist[num-1]
    counter += alist[num+1]
    if counter > max_counter:
        max_counter = counter

print(max_counter)

Measured memory_bytes: 15316
import java.io.*;
import java.util.*;
public class Main{
	static void main() throws Exception{
		int n=sc.nextInt(),k=sc.nextInt();
		int[]in=sc.intSortedArr(n);
		int ans=0;
		for(int i=0;i<k;i++)ans+=in[i];
		pw.println(ans);
	}
	public static void main(String[] args) throws Exception{
		pw=new PrintWriter(System.out);
		sc = new MScanner(System.in);
		int tc=1;
//		tc=sc.nextInt();
		while(tc-->0)
			main();
		pw.flush();
	}
	static PrintWriter pw;
	static MScanner  sc;
	static class MScanner {
		StringTokenizer st;
		BufferedReader br;
		public MScanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}
 
		public MScanner(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 int[] intArr(int n) throws IOException {
	        int[]in=new int[n];for(int i=0;i<n;i++)in[i]=nextInt();
	        return in;
		}
		public long[] longArr(int n) throws IOException {
	        long[]in=new long[n];for(int i=0;i<n;i++)in[i]=nextLong();
	        return in;
		}
		public int[] intSortedArr(int n) throws IOException {
	        int[]in=new int[n];for(int i=0;i<n;i++)in[i]=nextInt();
	        shuffle(in);
	        Arrays.sort(in);
	        return in;
		}
		public long[] longSortedArr(int n) throws IOException {
	        long[]in=new long[n];for(int i=0;i<n;i++)in[i]=nextLong();
	        shuffle(in);
	        Arrays.sort(in);
	        return in;
		}
		public Integer[] IntegerArr(int n) throws IOException {
	        Integer[]in=new Integer[n];for(int i=0;i<n;i++)in[i]=nextInt();
	        return in;
		}
		public Long[] LongArr(int n) throws IOException {
	        Long[]in=new Long[n];for(int i=0;i<n;i++)in[i]=nextLong();
	        return in;
		}
		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 void shuffle(int[]in) {
		for(int i=0;i<in.length;i++) {
			int idx=(int)(Math.random()*in.length);
			int tmp=in[i];
			in[i]=in[idx];
			in[idx]=tmp;
		}
	}
	static void shuffle(long[]in) {
		for(int i=0;i<in.length;i++) {
			int idx=(int)(Math.random()*in.length);
			long tmp=in[i];
			in[i]=in[idx];
			in[idx]=tmp;
		}
	}
}

Measured memory_bytes: 33232
import java.util.Scanner;

class Main {
    void solve() {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt(), m = in.nextInt(), k = in.nextInt();

        for(int a = 0; a <= m; a++) {
            for(int b = 0; b <= n; b++) {
                if(n * a + m * b - 2 * a * b == k) {
                    System.out.println("Yes");
                    return;
                }
            }
        }
        System.out.println("No");
    }

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


Measured memory_bytes: 22992
def is_prime(n):# O(logn)
    if n == 2:
        return 1
    elif n == 1 or n % 2 == 0:
        return 0
    for i in range(3, int(n ** .5) + 1, 2):
        if n % i == 0:
            return 0
    return 1

X = int(input())

while True:
    if is_prime(X):
        print(X)
        exit()
    X += 1


Measured memory_bytes: 9432
def main():
    C1n = list(map(int, input().split()))
    C2n = list(map(int, input().split()))
    C3n = list(map(int, input().split()))

    C = [C1n, C2n, C3n]

    a_s = [0]
    b_s = [C[0][0], C[0][1],C[0][2]]

    a_s.append(C[1][0] - b_s[0])
    a_s.append(C[2][0] - b_s[0])

    for i, a_i in enumerate(a_s):
        for j, b_j in enumerate(b_s):
            if not ((a_i + b_j) == C[i][j]):
                print("No")
                return 

    print("Yes")
      
main()

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

using namespace std;

#define INF 2000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<int, int> P;


int main()
{
	ll n, t;
	cin >> n >> t;
	if (n==1) {
		ll tmp;
		cin >> tmp;
		cout << t << "\n";
		return 0;
	}

	ll tmp;
	cin >> tmp;
	ll up = tmp+t;
	ll ret = 0;
	ll prev = tmp;
	for (int i = 1; i < n; i++) {
		cin >> tmp;
		if (tmp>=up) {
			ret += t;
		} else {
			ret += (tmp-prev);
		}
		prev=tmp;
		up = prev+t;
	}
	ret += t;
	cout << ret << endl;
}


Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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

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

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

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

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

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

fn main() {
    input!{
        n: usize,
        p: [i32; n],
    }
    let mut result = 0;
    let mut max = p[0];
    let mut min = p[0];
    for i in 0..n {
        if p[i] <= max && p[i] <= min {
            result += 1;
        }
        if p[i] > max {
            max = p[i];
        }
        if p[i] < min {
            min = p[i];
        }
    }
    println!("{}", result);
}


Measured memory_bytes: 6524
import sys, heapq, bisect, math, fractions
from collections import deque

N = int(input())
A = list(map(int, sys.stdin.readline().rsplit()))

res = 0
for i, a in enumerate(A):
    if i == A[a - 1] - 1 and i < a - 1:
        res += 1

print(res)

Measured memory_bytes: 15932
N, S = int(input()), input()
countw, counte = 0, S.count("E")

ans = 3 * 10 ** 5
for s in S:
    if s == "W":
        ans = min(ans, counte + countw)
        countw += 1
    elif s == "E":
        counte -= 1
        ans = min(ans, counte + countw)
print(ans)


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

using namespace std;

#define ll long long

int binary_search(ll x, int left, int right, vector<ll> &u){
  int center = left + (right - left) / 2;
  if(right - left <= 1 || u[center] == x) return center;
  else if(u[center] < x) return binary_search(x, center, right, u);
  else return binary_search(x, left, center, u);
}

ll min(ll a, ll b){
  if(a > b) return b;
  else return a;
}

ll abso(ll a){
  if(a < 0) return -a;
  else return a;
}

int main(){
  int a, b;
  int q;
  cin >> a >> b >> q;
  vector<ll> s(a + 2);
  vector<ll> t(b + 2);
  for(int i = 1; i <= a; i++) cin >> s[i];
  for(int i = 1; i <= b; i++) cin >> t[i];
  s[0] = -20000000000;
  t[0] = -20000000000;
  s[a + 1] = 30000000000;
  t[b + 1] = 30000000000;
  for(int i = 0; i < q; i++){
    ll x; cin >> x;
    int xa = binary_search(x, 0, a + 2, s);
    int xb = binary_search(x, 0, b + 2, t);
    ll min1 = min(abso(x - s[xa]) + abso(s[xa] - t[xb]), abso(x - t[xb]) + abso(t[xb] - s[xa]));
    ll min2 = min(abso(x - s[xa]) + abso(s[xa] - t[xb + 1]), abso(x - t[xb + 1]) + abso(t[xb + 1] - s[xa]));
    ll min3 = min(abso(x - s[xa + 1]) + abso(s[xa + 1] - t[xb]), abso(x - t[xb]) + abso(t[xb] - s[xa + 1]));
    ll min4 = min(abso(x - s[xa + 1]) + abso(s[xa + 1] - t[xb + 1]), abso(x - t[xb + 1]) + abso(t[xb + 1] - s[xa + 1]));
    cout << min(min(min1, min2), min(min3, min4)) << endl;
    //cout << s[xa] << " " << x << " " << s[xa + 1] << endl;
    //cout << t[xb] << " " << x << " " << t[xb + 1] << endl;
    //cout <<min1 << " " << min2 << " " << min3 << " " << min4 << endl;
  }
  return 0;
}


Measured memory_bytes: 2944
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
	return list(map(int,input().split()))
def m(): #複数文字
	return map(int,input().split())
def onem(): #Nとかの取得
	return int(input())
def s(x): #圧縮
	a = []
	if len(x) == 0:
		return []
	aa = x[0]
	su = 1
	for i in range(len(x)-1):
		if aa != x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a
def jo(x): #listをスペースごとに分ける
	return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
	return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
	ll = 0
	rr = r
	while True:
		mid = (ll+rr)//2

	if rr == mid:
		return ll
	if (ここに評価入れる):
		rr = mid
	else:
		ll = mid+1
"""

n = onem()
ans = ""
while True:
	if n <= 26:
		ans = chr(96+n) + ans
		break
	else:
		po = n % 26
		if po == 0:
			po = 26
		ans = chr(96+po) + ans
		n //= 26
		if po == 26:
			n -= 1
print(ans)



Measured memory_bytes: 83640
#include <bits/stdc++.h>
#define REP(i, n) for (long long i = 0; i < (long long)n; i++)
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using Vecl = vector<ll>;
using Graph = vector<vector<int>>;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, M;
  cin >> N >> M;
  vector<int> A(N);
  ll sum = 0;
  REP(i, N) {
    cin >> A[i];
    sum += A[i];
  }
  sort(A.begin(), A.end(), greater<int>());
  REP(j, M) {
    if (4 * M * A[j] < sum) {
      cout << "No" << endl;
      return 0;
    }
  }

  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int dp[3010][3010];

int main() {
	string s,t;
	cin>>s>>t;
	int ssize=s.size();
	int tsize=t.size();
	dp[0][0]=0;
	for(int i=0; i<ssize ; i++){
		for(int j=0;j<tsize;j++){
			if(s[i]==t[j]) {
				dp[i+1][j+1]=max(dp[i+1][j+1],dp[i][j]+1);
			
			}
			dp[i+1][j]=max(dp[i+1][j] ,dp[i][j]);
			dp[i][j+1]=max(dp[i][j+1], dp[i][j]);
		}
	}
	int ans=0;
	int y;
	int x;
	for(int i=1; i<=ssize;i++) {
		if (dp[i][tsize]>ans) {
			ans=dp[i][tsize];
			x=i;	y=tsize;
		}
	}
	for(int i=1; i<=tsize;i++) 
		if (dp[ssize][i]>ans) {
			ans=dp[ssize][i];
			y=i;	x=ssize;
		}

	string r="";
	while(ans){
		if(s[x-1]==t[y-1]){
			r+= s[x-1];		
			x--;y--;ans--;
		}
		else if (dp[x-1][y]>dp[x][y-1]){
			x--;
		}
		else y--;
		
	}
	reverse(r.begin(),r.end());
	cout<<r<<endl;
	return 0;
}

Measured memory_bytes: 35584
S = str(input())
N = len(S)
AGCT = ["A", "G", "C", "T"]

ans = 0
for i in range(N + 1):
  for j in range(N + 1):
    if i <= j:
      x = 0
      for k in S[i : j]:
        if k in AGCT:
          x += 1
        else:
          ans = max(ans, x)
          x = -1 * N
    ans = max(ans, x)   
       
ans = max(ans, x)        
print(ans)

Measured memory_bytes: 38256
#include <cstdio>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

const double EPS = 1.0e-10;

class Point
{
public:
    double y, x;
    Point(){
        y = x = 0.0;
    }
    Point(double y0, double x0){
        y = y0;
        x = x0;
    }
    Point operator+(const Point& p) const{
        return Point(y + p.y, x + p.x);
    }
    Point operator-(const Point& p) const{
        return Point(y - p.y, x - p.x);
    }
    Point operator*(double a) const{
        return Point(y * a, x * a);
    }
    Point operator/(double a) const{
        return Point(y / a, x / a);
    }
    double length() const{
        return sqrt(y * y + x * x);
    }
    double dist(const Point& p) const{
        return sqrt(pow(y - p.y, 2) + pow(x - p.x, 2));
    }
    double dot(const Point& p) const{
        return y * p.y + x * p.x; // |a|*|b|*cos慮
    }
    double cross(const Point& p) const{
        return x * p.y - y * p.x; // |a|*|b|*sin慮
    }
};

int n;
vector<double> distDevil;
vector<vector<double> > dist;

bool solve(int curr, bitset<21> visited, double t)
{
    if(visited.to_ulong() == (1<<n)-1)
        return true;

    for(int i=0; i<n; ++i){
        if(!visited[i] && t + dist[curr][i] > distDevil[i] - EPS)
            return false;
    }

    for(int i=0; i<n; ++i){
        if(!visited[i]){
            visited[i] = true;
            if(solve(i, visited, t + dist[curr][i]))
                return true;
            visited[i] = false;
        }
    }

    return false;
}

int main()
{
    for(;;){
        Point h, d;
        cin >> n >> h.x >> h.y >> d.x >> d.y;
        if(n == 0)
            return 0;

        ++ n;
        vector<Point> p(n);
        p[0] = h;
        for(int i=1; i<n; ++i)
            cin >> p[i].x >> p[i].y;

        distDevil.resize(n);
        for(int i=0; i<n; ++i)
            distDevil[i] = d.dist(p[i]);

        dist.assign(n, vector<double>(n));
        for(int i=0; i<n; ++i){
            for(int j=0; j<n; ++j){
                dist[i][j] = p[i].dist(p[j]);
            }
        }

        if(solve(0, 1, 0.0))
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    }
}

Measured memory_bytes: 1248
N = int(input())
b = input().split()
a = []
c = []
for i in range(N):
    if i % 2 == 0:
        a.append(int(b[i]))
for i in range(len(a)):
    if a[i] % 2 == 1:
        c.append(a[i])
print(len(c))

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

#define REP(i, x) REPI(i, 0, x)
#define REPI(i, a, b) for (int i = int(a); i < int(b); ++i)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

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

  int N;
  cin >> N;
  vector<int> S(N);
  int sum = 0;
  REP(i, N) {
    cin >> S.at(i);
    sum += S.at(i);
  }

  if (sum % 10 != 0) {
    cout << sum << endl;
    return 0;
  }

  sort(S.begin(), S.end());
  bool found = false;
  REP(i, N) {
    if (S.at(i) % 10 == 0) {
      continue;
    }
    sum -= S.at(i);
    found = true;
    break;
  }

  if (found) {
    cout << sum << endl;
  } else {
    cout << 0 << endl;
  }

  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        ArrayList<D> arrayList = new ArrayList<>();
        for (int i = 0;i < n;++i) {
            int x = sc.nextInt();
            int y = sc.nextInt();
            int h = sc.nextInt();
            D d = new D();
            d.x = x;
            d.y = y;
            d.h = h;
            arrayList.add(d);
        }

        for (int cx = 0;cx <= 100;++cx){
            for (int cy = 0;cy <= 100;++cy){
                long last = -1;
                boolean flag = false;
                for (int i = 0;i < n;++i){
                    if(arrayList.get(i).h == 0)continue;
                    long a = Math.abs(arrayList.get(i).x - cx) + Math.abs(arrayList.get(i).y - cy) + arrayList.get(i).h;
                    if(last >= 0){
                        if(last != a){
                            flag = true;
                            break;
                        }
                    }
                    last = a;
                }
                if(!flag){
                    for (int i = 0;i < n;++i){
                        long h = last - Math.abs(arrayList.get(i).x - cx) - Math.abs(arrayList.get(i).y - cy);
                        if(h < 0)h = 0;
                        if(arrayList.get(i).h != h){
                            flag = true;
                            break;
                        }
                    }
                    if(!flag){
                        System.out.println(cx + " " + cy + " " + last);
                        return;
                    }
                }
            }
        }


    }


    static class D{
        long x;
        long y;
        long h;
    }



}




Measured memory_bytes: 24020
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import numpy as np

MOD = 10**9 + 7

N,K = map(int,readline().split())
A = np.array(read().split(),np.int64).reshape(N,N)

def mult(A,B):
    C = np.zeros((N,N),np.int64)
    for n in range(N):
        C[n] = (A[n,:][:,None] * B % MOD).sum(axis=0) % MOD
    return C

def mat_power(A,n):
    if n == 0:
        return np.eye(N,dtype=np.int64)
    X = mat_power(A,n//2)
    X = mult(X,X)
    return mult(A,X) if n&1 else X

answer = mat_power(A,K).sum() % MOD
print(answer)

Measured memory_bytes: 20992
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <cassert>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define srep(i,n,m) for(int i=n;i<m;i++)
#define elif else if
#define INF 1000000007
#define pi 3.141592653589793
using namespace std;
int saidaikouyakusuu(int a,int b){
    if(b==0) return a;
    return saidaikouyakusuu(b,a%b);
}
int saisyoukoubaisuu(int a,int b){
    return a*b/saidaikouyakusuu(a,b);
}
int n,m,cnt=0,aa[220000],o=0,p;
pair<int,int> pp[220000];
string s,ss[220000];
char c,ca;
queue<int> que;
signed main(){
    cin>>n;
    rep(i,n){
        cin>>pp[i].second>>pp[i].first;
    }
    sort(pp,pp+n);
    cout<<pp[0].first+pp[0].second<<endl;
}

Measured memory_bytes: 12036
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define ces(d) cout<<" "<<endl;

int main() {

int N,M;
cin>>N>>M;
int ans=0;
if(abs(N-M)>=2){
	ce(ans);
	
}else{
	long long k=1,i=1;
        int n=N,m=M;
	while(N>0){
		k*=N--;
		k%=1000000007;
	}
	while(M>0){
		i*=M--;
		i%=1000000007;
	}
	ans=(k*i)%1000000007;
	
	if(n==m){
		ce((ans*2)%1000000007);
	}else{
		ce(ans);
	}
	
}

}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <algorithm> // sort
#include <iomanip>
#include <map>
#include <list>
#include <bits/stl_numeric.h>

#define DEBUG 0
#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;
using namespace std;


//方針: x と(-y)を作成したい
//x,yをどう選べば最大値が得られるか

//-4,-2,0,1,2,3
// 4
// 3 -4 -> 7
// -2 2 -> -4
//負と正で負をつくる
//正と負で正をつくる



//いい感じに負と正の数をあわせて、どん

int main(){
    ll N;
    cin >> N;
    vector <ll> a(N);
    REP(i,N)cin >> a[i];
    sort(a.begin(),a.end());
    ll pra = 0;
    ll mai = 0;
    REP(i,N)
    {
        //if(a[i] == 0)
        //{
        //    if(pra == 0)++pra;
        //    else ++mai;
        //}
        if(a[i] <= 0)
        {
            ++mai;
        }
        else
        {
            ++pra;
        }
    }
    ll l = 0;
    ll r = N-1;
    vector <pair<ll, ll >> p(N-1);
    REP(i,N-2)
    {
        if(pra > mai)
        {
            p[i].first = a[l];
            p[i].second = a[r];
            //負をつくる
            a[l] = a[l] - a[r];
            --pra;
            --r;
        }
        else
        {
            p[i].first = a[r];
            p[i].second = a[l];
            //正をつくる
            a[r] = a[r] - a[l];

            --mai;
            ++l;
        }
    }
    //最後の1回は逆にする
    p[N-2].first = a[r];
    p[N-2].second = a[l];

    cout << a[r] - a[l] << endl;
    REP(i,N-1)
    {
        cout << p[i].first << " " << p[i].second << endl;
    }

    return 0;
}


Measured memory_bytes: 4224
#include <iostream>
#include <cmath>
using namespace std;
 
int main() {
    double a, b, A, B, N, M, K;
    int i;
    cin >> N >> M >> K;
    A = min(N, M);
    B = max(N, M);
    for(i = 0; i <= A; i++){
        a = i;
        if(2*a != A){
            b = (K -a*B) / (A -2*a);
            if(ceil(b) == floor(b) && b <= B && b >= 0){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
/*
Author: Racer5x
 ***************************************   UNAUTHORISED COPYING OF CODE PROHIBITED   **********************************
*/
 
// #pragma GCC optimize("O3")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#include<bits/stdc++.h>
#define int         long long
#define double      long double
#define pb          emplace_back
#define pf          emplace_front
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define x           first
#define y           second
#define endl        '\n'
#define hell        998244353 
#define PI          3.141592653589
#define tezz        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MAX         2000000000000000000
#define M           1000000007
using namespace std;
 
signed main()
{
    tezz
    
    int a, b, k;
    cin>>a>>b>>k;

    int curr = max(a - k, 0LL);
    if(curr){
    	cout<<curr<<' '<<b;
    }
    else{
    	curr = k - a;
    	cout<<0<<' '<<max(b-curr, 0LL);
    }
} 

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	int x;
	cin>>x;
	if(x>=400&&x<=599) puts("8");
	if(x>=600&&x<=799) puts("7");
	if(x>=800&&x<=999) puts("6");
	if(x>=1000&&x<=1199) puts("5");
	if(x>=1200&&x<=1399) puts("4");
	if(x>=1400&&x<=1599) puts("3");
	if(x>=1600&&x<=1799) puts("2");
	if(x>=1800&&x<=1999) puts("1");    
} 

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

using namespace std;
#define vsort(v) sort(v.begin(), v.end());
#define vsort_reverse(v) sort(v.begin(), v.end(), greater<int>());

int cal(int x) {
	int sum = 0;
	int div;

	while(x) {
		div = x % 10;
		sum += div;
		x /= 10;
	}
	return sum;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, A, B;
	cin >> N >> A >> B;
	vector<int> v;
	int rslt = 0;
	for(int i = 1; i <= N; i++) {
		int sum = cal(i);
		if(A <= sum and sum <= B) {
			rslt += i;
		}
	}
	cout << rslt << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
    int N;
    cin >> N;
    int field[N][2];
    vector<int> results;
    for(int i = 0; i < 2; i++){
        for(int j = 0; j < N; j++){
            cin >> field[j][i];
        }
    }
    
    for(int i = 0; i < N ; i++){
        int candy = 0;
        int nowY = 0;
        for(int x = 0; x <= i; x++){
            candy += field[x][nowY];
        }
        nowY++;
        for(int x2 = i; x2 < N; x2++){
            candy += field[x2][nowY];
        }
        results.push_back(candy);
    }
    sort(results.begin(), results.end(), greater<int>());
    
    cout << results[0] << endl;
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int arr[MAX],n;
int status(int a)
{
    if(a<0)
        return 1;
    else if(a>0)
        return 0;
    else
        return 2;
}
ll solve()
{
    ll cnt=0;
    ll sum=arr[0],f=0;
    if(arr[0]<0)
        f=1;
    else
        f=0;
    for(int i=1; i<n; i++)
    {
        f^=1;
        int add=arr[i];
        if(status(arr[i])!=f)
            add=0,cnt+=abs(arr[i]);
        sum+=add;
        if(status(sum)!=f)
        {
            cnt+=abs(sum)+1;
            if(f)
                sum=-1;
            else
                sum=1;
        }
    }
    return cnt;
}
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    cin>>n;
    for(int i=0; i<n; i++)
    {
        cin>>arr[i];
    }
    if(!arr[0])
    {
        arr[0]=1;
        ll x=solve()+1;
        arr[0]=-1;
        ll y=solve()+1;
        cout<<min(x,y)<<endl;
    }
    else
    {
        ll x,y;
        x=solve();
        if(arr[0]>0)
        {
            y=arr[0]+1;
            arr[0]=-1;
            y+=solve();
        }
        else
        {
            y=abs(arr[0])+1;
            arr[0]=1;
            y+=solve();
        }
        cout<<min(x,y)<<endl;
    }


    return 0;
}


Measured memory_bytes: 4024
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int a[3][3];
int n;

int main(){
	for(int i=0;i<3;i++) for(int j=0;j<3;j++) cin>>a[i][j];
	cin>>n;
	for(int i=0;i<n;i++){
		int x;
		cin>>x;
		for(int j=0;j<3;j++) for(int k=0;k<3;k++) if(a[j][k]==x) a[j][k]=0;
	}
	bool B=0;
	for(int i=0;i<3;i++) if(!a[i][0]&&!a[i][1]&&!a[i][2]) B=1;
	for(int i=0;i<3;i++) if(!a[0][i]&&!a[1][i]&&!a[2][i]) B=1;
	if(!a[0][0]&&!a[1][1]&&!a[2][2]) B=1;
	if(!a[0][2]&&!a[1][1]&&!a[2][0]) B=1;
	cout<<(B?"Yes":"No")<<endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#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 pair<int, int> pi;
tree<int,int,greater<int>,rb_tree_tag,tree_order_statistics_node_update> map_t;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for(int i = 0; i < (a); ++i)
#define pb push_back
#define sz(x) (int)x.size()
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
#define REV(x) reverse(x.begin(),x.end())
int dx[]={-1,0,1,0};
int dy[]={0,-1,0,1};

ll modPow(ll a,ll x,ll p)
{
    a%=p;
    if(x==0)
        return 1;
    ll res=modPow(a,x/2,p);
    if(x%2)
        return (((res*res)%p)*a)%p;
    return (res*res)%p;
}

ll choose2(ll u)
{
    return ((u-1)*u)/2;
}

int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n,p;
    cin >> n >> p;
    string s;
    cin >> s;
    if(p==2 || p==5)
    {
        ll tot=0;
        F0R(i,n)
        {
            int d=s[i]-'0';
            if(d%p==0)
                tot+=i+1;
        }
        cout << tot;
        return 0;
    }
    unordered_map<int,int> cnt;
    cnt[0]++;
    ll tot=0;
    ll curr=0;
    F0R(i,n)
    {
        curr=curr*10; curr+=(s[i]-'0');
        curr%=p;
        int temp=curr*modPow(10,n-1-i,p);
        temp%=p;
        cnt[temp]++;
    }
    for(auto e : cnt)
        tot+=choose2(e.second);
    cout << tot;

    return 0;
}


Measured memory_bytes: 916
Imports System

Module Program
    Sub Main(args As String())

        Dim X As Integer = Integer.Parse(Console.ReadLine())

        Dim ans As Integer
        Select Case X
            Case 400 To 599
                ans = 8
            Case 600 To 799
                ans = 7
            Case 800 To 999
                ans = 6
            Case 1000 To 1199
                ans = 5
            Case 1200 To 1399
                ans = 4
            Case 1400 To 1599
                ans = 3
            Case 1600 To 1799
                ans = 2
            Case 1800 To 1999
                ans = 1
        End Select

        Console.WriteLine(ans)

    End Sub
End Module


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

int main() {
    int n, parity[2] = {};
    cin >> n;
    for (int a; cin >> a; parity[a % 2]++) {
    }
    if (parity[1] % 2 == 0) {
        cout << "YES";
    } else {
        cout << "NO";
    }
    return 0;
}

Measured memory_bytes: 256
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
def pri(x): print('\n'.join(map(str, x)))

N = int(input())
A = list(map(int, input().split()))

d = [0]*N
for a in A:
    d[a-1] += 1

for di in d:
    print(di)



Measured memory_bytes: 33740
#include <iostream>
using namespace std;
long long dp[405][405],a[505],qzh[505];
int main(int argc, char** argv) {
	int n;
	cin >> n;
	for(int i=1;i<=n;i++)
	{
		cin >> a[i];
		qzh[i]=qzh[i-1]+a[i];
	}
	for(int i=2;i<=n;i++)
	{
		for(int j=1;j<=n-i+1;j++)
		{
			int l=j,r=j+i-1;
			dp[l][r]=1e18;
			for(int k=l;k<=r;k++)
				dp[l][r]=min(dp[l][r],dp[l][k]+dp[k+1][r]);
			dp[l][r]+=qzh[r]-qzh[l-1];
		}
	}
	cout << dp[1][n];
	return 0;
}

Measured memory_bytes: 1536
import sys
def input():
    return sys.stdin.readline()[:-1]

N = int(input())
ABC = [list(map(int,input().split())) for _ in range(N)]

inf = 10**9+7
dp = [[0] * 3 for _ in range(N+10)]
dp[0] = [ABC[0][0],ABC[0][1],ABC[0][2]]

for i in range(N-1):
    for j in range(3):
        for k in range(3):
            if j==k:continue
            dp[i+1][j] = max(dp[i+1][j],dp[i][k]+ABC[i+1][j])
        
    

print(max(dp[N-1][:]))


Measured memory_bytes: 70108
#![allow(unused_imports)]

use std::{i32, i64, u32, u64, usize, f64};
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::io::{stdout, Write, BufWriter};
use std::mem::{swap};
use maplit::*;
use proconio::marker::{Isize1, Usize1, Bytes, Chars};

#[proconio::fastout]
fn main() {
    proconio::input!(
        h: usize,
        w: usize,
        grid: [Chars; h],
    );
    let mut s = 0usize;
    for a in grid.into_iter().flatten() {
        if a == '#' { s += 1; }
    }
    if s == h + w - 1 { println!("Possible"); }
    else { println!("Impossible"); }
}


Measured memory_bytes: 2200
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;


class Program
{
    static void Main(string[] args)
    {
        // 入力
        var n = long.Parse(Console.ReadLine());
        char[] c = Console.ReadLine().ToCharArray();

        var ans = 0L;
        long count = c.Where(x => x == 'R').Count();
        if (count != c.Length)
        {
            long tmp = 0;
            for (int i = 0; i < count; i++)
            {
                if (c[i] == 'R') tmp++;
            }

            ans = count - tmp;
        }

        // 出力
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 29368
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

mt19937 mrand(random_device{} ()); 

int rnd(int x) {
  return mrand() % x;
}

typedef long double ld;
typedef long long ll;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define pb push_back
#define mp make_pair
#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const ld eps = 1e-9;
const ld pi = acos((ld) -1.0);

void precalc() {
}

const int maxn = (int) 1e5 + 10;
int a[maxn];

int n, m, k;

int read() {
  if (scanf("%d%d%d", &n, &m, &k) < 3) {
    return 0;
  }
  for (int i = 0; i < n; ++i) {
    scanf("%d", a + i);
  }
  return 1;
}

long long infll = (long long) 1e18;

long long dp[maxn];

void solve() {
  for (int i = 0; i < n; ++i) {
    dp[i] = a[i];
  }
  vector<pair<long long, int> > st;
  for (int iter = 1; iter < k; ++iter) {
    st.clear();
    int left = 0;
    for (int i = 0; i < n; ++i) {
      long long d0 = dp[i];

      //eprintf("%lld%c", dp[i], " \n"[i == n - 1]);

      if (left < sz(st) && st[left].second < i - m) {
        ++left;
      }

      dp[i] = sz(st) == left ? -infll : (st[left].first + (long long) a[i] * (iter + 1));

      if (d0 > -infll) {
        while (sz(st) > left && st.back().first <= d0) {
          st.pop_back();
        }
        st.pb(mp(d0, i));
      }
    }
  }
  printf("%lld\n", *max_element(dp, dp + n));
}

int main() {
  precalc();
#ifdef LOCAL
  freopen(TASK ".out", "w", stdout);
  assert(freopen(TASK ".in", "r", stdin));
#endif

  while (1) {
    if (!read()) {
      break;
    }
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


Measured memory_bytes: 2552