akhauriyash/Code-Regression huggingface dataset:
use std::io::*;
use std::str::FromStr;

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")
}

fn main() {
    let k: i64 = read();
    let n: usize = read();
    let a: Vec<i64> = (0..n).map(|_| read()).collect();
    let mut ans = 10*10*10*10*10*10;
    for i in 0..n {
        let mut sum = 0;
        if i + 1 < n {
            sum += a[i] + (k - a[(i+1)%n]);
        } else {
            sum += a[i] - a[(i+1)%n];
        }

        //println!("{} {} {}", i, (i+1)%n, sum);

        if sum < ans {
            ans = sum;
        }
    }
    println!("{}", ans);
}


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

int main()
{
	int n;
	cin >> n;
	int l = 1001, r = -1;
	for(auto i = 0; i < n; ++i){
		int a;
		cin >> a;
		l = min(l, a);
		r = max(r, a);
	}
	cout << r - l << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static String Y = "Yes";
	public static String N = "No";
	public static long MOD = (long) (Math.pow(10, 9) + 7);
	public static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {

		long a = nl();
		long b = nl();
		long c = nl();

		long min1 = a * b;
		long min2 = b * c;
		long min3 = a * c;

		if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0) {
			out(0);
		} else {
			out(min(min(min1, min2), min(min2, min3)));
		}
	}

	/*
	 * 以下メソッド集
	 */

	static int abcount(String str) {
		int count = 0;
		int len = str.length();
		for (int i = 0; i < len - 1; i++) {
			if ("AB".equals(str.substring(i, i + 2))) {
				count++;
			}
		}
		return count;
	}

	static int ni() {
		return sc.nextInt();
	}

	static long nl() {
		return sc.nextLong();
	}

	static double nd() {
		return sc.nextDouble();
	}

	static String n() {
		return sc.next();
	}

	static char[] nc() {
		return sc.next().toCharArray();
	}

	static int kaijo(int n) {
		if (n == 0 || n == 1) {
			return 1;
		} else {
			return n * kaijo(n - 1);
		}
	}

	static int fib(int n) {
		return (n == 1 || n == 0) ? n : fib(n - 2) + fib(n - 1);
	}

	static long lcm(long m, long n) {

		return m * n / gcd(m, n);
	}

	static int lcm(int m, int n) {

		return m * n / gcd(m, n);
	}

	static long gcd(long a, long b) {
		return (b == 0) ? a : gcd(b, a % b);
	}

	static int gcd(int a, int b) {
		return (b == 0) ? a : gcd(b, a % b);
	}

	static void out(String info) {
		System.out.println(info);
	}

	static void out(int info) {
		System.out.println(info);
	}

	static void out(double info) {
		System.out.println(info);
	}

	static void out(long info) {
		System.out.println(info);
	}

	static void out(char info) {
		System.out.println(info);
	}

	static void out(Object obj) {
		System.out.println(obj.toString());
	}

	static void outn(String info) {
		System.out.print(info);
	}

	static void outn(int info) {
		System.out.print(info);
	}

	static void outn(double info) {
		System.out.print(info);
	}

	static void outn(long info) {
		System.out.print(info);
	}

	static void outn(char info) {
		System.out.print(info);
	}

	static double max(double d, double e) {
		return Math.max(d, e);
	}

	static long max(long a, long b) {
		return Math.max(a, b);
	}

	static double min(double d, double e) {
		return Math.min(d, e);
	}

	static long min(long a, long b) {
		return Math.min(a, b);
	}
}

class XY {
	int h;
	int c;

	XY(int h, int c) {
		this.h = h;
		this.c = c;
	}
}


Measured memory_bytes: 21716
import java.io.*;

class Main {
	public static void main(String[] args){
		try {
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));


			while(true){
			String[] line = br.readLine().split(" ");
			int H =Integer.parseInt(line[0]);
			int W =Integer.parseInt(line[1]);
				if(H == 0 && W == 0) break;
				for(int a = 1; a <=H; a++){
					for(int i = 1;i <= W;i++){
						System.out.print("#");
					}
					System.out.print("\n");
				}
				System.out.print("\n");
			}	
		} catch(Exception e){
		}
	}
}

Measured memory_bytes: 36288
#include<bits/stdc++.h>
using namespace std;
int n,k,a=1;int z;
int main(){
	cin>>n>>k;
	for(int i=1;i<=n;i++){
		if(a>k)a+=k;
		else a+=a;
	}
	cout<<a;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    long n, ans1=0, ans2=0, sum=0;
    cin >> n;
    vector<long long> a(n);
    for (long i=0; i<n; i++)
        cin >> a[i];
    for (long i=0; i<n; i++) {
        sum += a[i];
        if (i % 2 == 0 && sum >= 0) {
            ans1 += sum + 1;
            sum = -1;
        } else if (i % 2 == 1 && sum <= 0) {
            ans1 += 1 - sum;
            sum = 1;
        }
    }
    sum = 0;
    for (long i=0; i<n; i++) {
        sum += a[i];
        if (i % 2 == 1 && sum >= 0) {
            ans2 += sum + 1;
            sum = -1;
        } else if (i % 2 == 0 && sum <= 0) {
            ans2 += 1 - sum;
            sum = 1;
        }
    }
    cout << min(ans1, ans2) << '\n';
}

Measured memory_bytes: 1024
#include<iostream>
#include<cmath>
#include<stack>
#include<vector>
#include<cstring>
#include<algorithm>
#include<set>
#include<queue>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <complex>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cassert>
using namespace std;
typedef long long ll;
const ll inf =1e17;
typedef unsigned long long ull;
#define scn(a) scanf("%d",&a)
#define scd(a) scanf("%lf",&a)
#define scl(a) scanf("%lld",&a)
#define ptf(a) printf("%d\n",a)
#define mes(a,b) memset(a,b,sizeof(a))
#define fon(s,n) for(int i=s;i<=n;i++)
#define range(i,a,b) for(int i=a;i<=b;++i)
#define rerange(i,a,b) for(int i=a;i>=b;--i)
//#define N 100010
//const ll p =998244353;
const int S=20;
ll gcd(ll a,ll b) { return b>0 ? gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
ll q_pow(ll a,ll b,ll mod)
{
	ll ans=1,res=a;
	while(b){
		if(b&1) ans=ans*res%mod;
		res=res*res%mod;
		b>>=1;
	}
	return ans%mod;
}
ll a[100005];
//int cnt[105]={0};
int main()
{
	//int a, b, c, d, n, t;
	int t;
	// //double n,m,x,y;
	// scn(t);
	// while (t--)
	// {
	// 	int n;scn(n);
	// 	for(int i=0;i<n;i++) scl(a[i]);
	// 	sort(a,a+n);
	// 	ll ans1=a[n-1]*a[n-2]*a[n-3]*a[n-4]*a[n-5];
	// 	ll ans2=a[n-1]*a[n-2]*a[n-3]*a[1]*a[0];
	// 	ll ans3=a[n-1]*a[3]*a[2]*a[1]*a[0];
	// 	ll ans=max(ans1,ans2);
	// 	ans=max(ans,ans3);
	// 	printf("%lld\n",ans);
	// }
	double a,b,c;
	scd(a);scd(b);scd(c);
	if(b*c>=a) printf("Yes");
	else printf("No");
	return 0;
}





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

int main(){
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n;
	cin >> n;
	vector<int> a(n), b(n);
	for(int i = 0; i < n; i++) cin >> b[i];
	for(int i = 0; i < n; i++) cin >> a[i];
	vector<int> x;
	for(int i = 0; i < n; i++){
		x.push_back(i);
	}
	long long num = 0;
	int s = 0;
	while(s < (int)x.size()){
		int i = x[s];
		s += 1;
		int j = (i + n - 1) % n;
		int k = (i + 1) % n;
		if(a[i] - b[i] >= a[j] + a[k]){
			int v = (a[i] - b[i]) / (a[j] + a[k]);
			a[i] -= (a[j] + a[k]) * v;
			x.push_back(j);
			x.push_back(k);
			num += v;
		}
	}
	for(int i = 0; i < n; i++){
		if(a[i] != b[i]){
			cout << -1 << '\n';
			return 0;
		}
	}
	cout << num << '\n';
}

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

int main(){
 long long H,W,D,u,Q,L,R,ans;
cin>>H>>W>>D;
  vector<pair<int,int>>a(H*W+1);
  vector<long long>b(H*W+1);
  for(int i=0;i<D+1;i++){
    b[i]=0;
  }
  for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
  cin>>u;
  a[u]=make_pair(i,j);
}
  }
  for(int i=D+1;i<H*W+1;i++){
    b[i]=abs(a[i].first-a[i-D].first)+abs(a[i].second-a[i-D].second)+b[i-D];
  }
  cin>>Q;
  for(int i=0;i<Q;i++){
    ans=0;
    cin>>L>>R;
    ans=b[R]-b[L];
    cout<<ans<<endl;
  }
 }

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
using namespace std;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;

int main(){
  int n;cin>>n;
  bool p=false,w=false,g=false,y=false;
  rep(i,n){
    char s;cin>>s;
    if(s=='P')p=true;
    if(s=='W')w=true;
    if(s=='G')g=true;
    if(s=='Y')y=true;
  }
  if(p+w+g+y==3){
    cout << "Three" << endl;
  }else{
    cout << "Four" << endl;
  }
}


Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  int N, p[55];

  std::cin >> N;

  for (int i = 0; i < N; i ++)
    std::cin >> p[i];

  if (std::is_sorted(p, p + N)) {
    std::cout << "YES" << std::endl;

    return 0;
  }

  for (int i = 0; i < N; i ++)
    for (int j = i + 1; j < N; j ++) {
      std::swap(p[i], p[j]);

      if (std::is_sorted(p, p + N)) {
        std::cout << "YES" << std::endl;

        return 0;
      }

      std::swap(p[i], p[j]);
    }

  std::cout << "NO" << std::endl;

  return 0;
}


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

void rev(char *s){
    int l=strlen(s),i;
    for(i=0;i<l/2;i++){
        char t=s[i];
        s[i]=s[l-1-i];
        s[l-1-i]=t;
    }
}

int main(){
    int i,l;
  	int counter = 0;
    char s[256];
  	char copy[256];
    scanf("%s",s);
    l=strlen(s);
  	strcpy(copy,s);
    rev(s);
    for(i=0;i<l;i++){
    	if(s[i] != copy[i]) {
            counter++;
        }
    }
    printf("%d\n",counter/2);
    return 0;
}

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

using namespace std;

struct Edge {
  uint64_t a, b;
  Edge(uint64_t a = -1, uint64_t b = -1)
    : a(a), b(b) {}
  bool operator<(const Edge &edge) const {
    return (a == edge.a) ? b < edge.b : a < edge.a;
  }
};

struct VectorItem
{
  uint64_t node, num_of_edges;
  VectorItem(uint64_t node = -1, uint64_t num_of_edges = 0)
    : node(node), num_of_edges(num_of_edges) {}
  
  bool operator>(const VectorItem &item) const {
    return num_of_edges > item.num_of_edges;
  }
};

int main()
{
  uint64_t N;
  cin >> N;
  
  vector<Edge> edge_list(N - 1);
  vector<set<uint64_t>> edges(N);
  for (uint64_t n = 0; n < N - 1; ++n) {
    uint64_t a, b;
    cin >> a >> b;
    
    edge_list[n] = Edge(a - 1, b - 1);
    
    edges[a - 1].insert(b - 1);
    edges[b - 1].insert(a - 1);
  }
  
  uint64_t K = 0;
  vector<VectorItem> temp(N);
  for (uint64_t n = 0; n < N; ++n) {
    K = max(K, edges[n].size());
    temp[n] = VectorItem(n, edges[n].size());
  }
  cout << K << endl;
  
  vector<vector<bool>> used_color(N);
  for (uint64_t n = 0; n < N; ++n) {
    used_color[n] = vector<bool>(K, false);
  }
  
  map<Edge, uint64_t> color_table;
  
  vector<bool> visited(N);
  queue<uint64_t> q;
  q.emplace(0);
  while (!q.empty()) {
    uint64_t src = q.front(); q.pop();
    visited[src] = true;
    
    for (uint64_t dst : edges[src]) {
      if (visited[dst]) {
        continue;
      }
      
      for (uint64_t k = 0; k < K; ++k) {
        if (!used_color[src][k]) {
          used_color[src][k] = true;
          used_color[dst][k] = true;
          color_table[Edge(src, dst)] = k;
          color_table[Edge(dst, src)] = k;
          q.emplace(dst);
          break;
        }
      }
    }
  }
  
  for (uint64_t n = 0; n < N - 1; ++n) {
    cout << (color_table[edge_list[n]] + 1) << endl;
  }
  
  return 0;
}

Measured memory_bytes: 332032
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <random>

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

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;
const double TRIAL = 30e4;

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

    vector<double> x(n), y(n);
    rep(i, n){
        cin >> x[i] >> y[i];
    }

    vector<int> p(n);
    rep(i, TRIAL){
        double rx = sin(2*M_PI*i/TRIAL);
        double ry = cos(2*M_PI*i/TRIAL);

        double d = rx*x[0]+ry*y[0];
        int np = 0;
        for(int j = 1; j < n; j++){
            double dd = rx*x[j]+ry*y[j];
            if(dd > d){
                d = dd;
                np = j;
            }
        }
        p[np]++;
    }

    rep(i, n){
        cout << fixed << setprecision(6) << (double)p[i] / (double)TRIAL << endl;
    }

    return 0;
}


Measured memory_bytes: 1016
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.diverta2019_2
{
    class C
    {
        static void Main(string[] args)
        {
            Method(args);
        }

        static void Method(string[] args)
        {
            int n = ReadInt();
            long[] array = ReadLongs();
            /*long[] sorted = array.OrderBy(a => a).ToArray();
            long m = 0;
            for(int i = 0; i < n; i++)
            {
                if (i < n - 1 && sorted[i] < 0) m += -sorted[i];
                else m += sorted[i];
            }*/
            int maxIndex = 0;
            int minIndex = 0;
            for(int i = 0; i < n; i++)
            {
                if (array[maxIndex] < array[i]) maxIndex = i;
                if (array[minIndex] >= array[i]) minIndex = i;
            }
            long m = 0;
            for(int i = 0; i < n; i++)
            {
                if (i == minIndex || i == maxIndex) continue;
                m += Abs(array[i]);
            }
            m += array[maxIndex];
            m -= array[minIndex];

            var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            SetOut(sw);

            WriteLine(m);
            for(int i = 0; i < n; i++)
            {
                if (i == minIndex || i == maxIndex) continue;

                if (array[i] < 0)
                {
                    WriteLine(array[maxIndex] + " " + array[i]);
                    array[maxIndex] -= array[i];
                }
                else
                {
                    WriteLine(array[minIndex] + " " + array[i]);
                    array[minIndex] -= array[i];
                }
            }
            WriteLine(array[maxIndex] + " " + array[minIndex]);

            Out.Flush();
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


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

typedef long long ll;
#define ll long long
#define all(v) (v).begin(), (v).end()
#define _for(i,a,b) for(int i = (a); i < (b); i++) 
#define _rep(i,a,b) for(int i = (a); i <= (b); i++)

const int kMod = 1e9 + 7;
const int kMaxN = 1e6 + 5;

void taskA() {
    string s; cin >> s;
    int n = s.size();
    cout << (s[2]==s[3] && s[4]==s[5] ? "Yes\n" : "No\n");
    return;
}
void taskB() {
    int n; cin >> n;
    int ans = 0;
    ans += (n/500)*1000; n%=500;
    ans += (n/5)*5;
    cout << ans;
    return;
}
void taskC() {
    int n,k; cin >> k >> n;
    vector<int> a(n);
    _for(i,0,n) cin >> a[i];
    sort(a.begin(), a.end());
    ll ans = 0;
    int ma = 0;
    _for(i,1,n) {
        ans += (a[i]-a[i-1]); 
        ma = max(ma, a[i]-a[i-1]);
    }
    ans += (k-a[n-1]+a[0]);
    ma = max(ma, k-a[n-1]+a[0]);
    cout << ans-ma;
    return;
} 
void taskD() {
    int n,x,y; cin >> n >> x >> y;
    vector<int> cnt(n, 0);
    _rep(i,1,n) _rep(j,i,n) {
        int dis = j-i;
        int dix = abs(i-x)+abs(j-y)+1;
        dis = min(dis, dix);
        cnt[dis]++;
    }
    _for(i,1,n) {
        cout << cnt[i] << "\n"; 
    }
    return;
}

int main(){
    //ios::sync_with_stdio(false), cin.tie(nullptr);
    //taskA();
    //taskB();
    //taskC();
    taskD();
    
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int a,b;
bool boo[4];
int main()
{
	scanf("%d%d",&a,&b);
	boo[a]=1;boo[b]=1;
	if(!boo[1]) {printf("1");return 0;}
	if(!boo[2]) {printf("2");return 0;}
	if(!boo[3]) printf("3");
	return 0;
}

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

int main() {
  int N, K, snake=0;
  cin >> N >> K;

  vector<int> len(N);

  for (int i = 0; i < N; i++) {
    cin >> len.at(i);
  }
  sort(len.begin(), len.end());
  
  for (int i = 0; i < K; i++) {
    snake = snake + len.at(N-i-1);
  }
  cout << snake << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<string>
#define nl n<<1
#define nr (n<<1)|1
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int>P;
const int INF=0x3f3f3f3f;
const ll INFF=0x3f3f3f3f3f3f3f3f;
const double pi=acos(-1.0);
const double eps=1e-9;
const ll mod=1e9+7;
int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0' | ch>'9')
    {
        if(ch=='-') f=-1;
        ch=getchar();
    }
    while(ch>='0' && ch<='9')
    {
        x=x*10+ch-'0';
        ch=getchar();
    }
    return x*f;
}
void Out(int aa)
{
    if(aa>9)
        Out(aa/10);
    putchar(aa%10+'0');
}
int x[10];
int vis[205];
int mapp[205][205];
int n,m,r;
int minn;
void floy()
{
    for(int i=1;i<=n;i++)
        for(int j=1;j<=n;j++)
            for(int k=1;k<=n;k++)
                mapp[j][k]=min(mapp[j][k],mapp[j][i]+mapp[i][k]);
}
void dfs(int u,int num,int sum)
{
    if(num==r)
    {
        minn=min(minn,sum);
        return;
    }
    for(int i=1;i<=r;i++)
    {
        if(!vis[x[i]]&&mapp[u][x[i]]!=INF)
        {
            vis[x[i]]=1;
            dfs(x[i],num+1,sum+mapp[u][x[i]]);
            vis[x[i]]=0;
        }
    }
}
int main()
{
    n=read(),m=read(),r=read();
    int s=0,t=1;
    for(int i=1; i<=r; i++)
    {
        x[i]=read();
    }
    memset(mapp,INF,sizeof(mapp));
    for(int i=1;i<=m;i++)
    {
        int u=read(),v=read(),w=read();
        mapp[u][v]=mapp[v][u]=w;
    }
    floy();
    minn=2e9+7;
    for(int i=1;i<=r;i++)
    {
        memset(vis,0,sizeof(vis));
        vis[x[i]]=1;
        dfs(x[i],1,0);
    }
    cout<<minn;
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define mem( a , b ) memset( a , b , sizeof( a ) )
using namespace std;
int _I(){ int x; scanf("%d",&x); return x; }
long long _IL(){ long long x; scanf("%lld",&x); return x; }


struct node
{
        int v , w;
        node(){};
        node( int x , int y )
        {
                v = x;
                w = y;
        }

        bool operator < ( const node &R ) const
        {
                if( w == R.w ) return v < R.v;
                return w > R.w;
        }
};

long long mod;
long long bigmod( long long b , long long p )
{
        if( p == 0 ) return 1LL;
        long long r = bigmod( 2 , p/2 );
        r = ( ( r % mod ) * ( r % mod ) ) % mod;
        if( p & 1 )
        {
                r = ( ( b % mod ) * ( r % mod ) ) % mod;
        }
        return r;
}
vector< int > s1 , s2;
vector< pair< int , int > > divisor;
map< int , int > mp;
void solve()
{
       int a = _I();
       int b = _I();
       int l = 1 , h = 1000000;
       int mx = INT_MAX;
       while( l <= h )
       {
               int mid = ( l + h )/2;
               int aa = ( mid*8)/100;
               int bb = ( mid*10)/100;
               if( aa >= a && bb >= b )
               {
                       //cout<<mid<<"\n";
                       if( aa == a && bb == b ) mx = min( mx , mid );
                       h = mid-1;
               }
               else l = mid+1;
       }
       if( mx == INT_MAX ) cout<<-1<<"\n";
       else cout<<mx<<"\n";
}
int main()
{
        //freopen("input.txt","r",stdin);
        //freopen("output.txt","w",stdout);
       // int t = _I();
        //while( t-- )
                solve();

        return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
static const int NIL = -1;
static const int MAX = 200000;

int N;
int ans = 0;
vector<vector<int>> f(MAX+1);
vector<int> color(MAX+1);

void dfs(int r,int c) {
    int cnt = 1;
    stack<int> S;
    S.push(r);
    color.at(r) = c;
    while (!S.empty()) {
        int u = S.top();
        S.pop();
        for (int i=0;i<f.at(u).size();i++) {
            int v = f.at(u).at(i);
            if (color.at(v) == NIL) {
                color.at(v) = c;
                S.push(v);
                cnt++;
            }
        }
    }
    ans = max(ans,cnt);
}

void assigncolor() {
    int id = 0;
    for (int i=1;i<N+1;i++) {
        color.at(i) = NIL;
    }
    for (int u=1;u<N+1;u++) {
        if (color.at(u) == NIL) dfs(u,id++);
    }
}

int main() {
    int M,a,b;
    cin >>N >> M;
    
    for (int i=0;i<M;i++) {
        cin >> a >> b;
        f.at(a).push_back(b);
        f.at(b).push_back(a);
    }
    assigncolor();
    cout << ans << endl;
    
}

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

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)
#define rep(i,n) for(int i=0; i<n; i++)
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> P;
typedef map<int,int> mp;

const int MOD = 1e9 + 7;


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

    ll a, b, k;
    cin >> a >> b >> k;

    if(a > k){
        a-=k;
    }else{
        b -= k-a;
        a = 0;
    
        if(b < 0){
            b = 0;
        }
    }

    cout << a << " " << b << endl;

    return 0;
}


Measured memory_bytes: 256
N = int(input())
S = input()
LS = list(S)
count = 0
hantei = 0
alfabetto = [
"a","b","c","d","e","f","g","h","i","j","k","l","m",
"n","o","p","q","r","s","t","u","v","w","x","y","z"
]

for i in range(1, N):
    RLS = LS[0 : i]
    LLS = LS[i : N]

    for alfa in alfabetto:
        if (alfa in RLS) and (alfa in LLS):
            count += 1
    if hantei < count:
        hantei = count
    count = 0

print(hantei)


Measured memory_bytes: 3064
S=input()
# print(S)
if S=="keyence":
	print("YES")
	exit(0)
a="keyence"
if S[0:len(a)]==a:
	print("YES")
	exit(0)

# print(len(a))
for i in range(0,len(a)):
	# print(i)
	# print(S[0:i])
	# print(a[0:i])
	# print(S[len(S)+i-len(a):len(S)])
	# print(a[i:len(S)])
	
	if S[0:i]==a[0:i] and S[len(S)+i-len(a):len(S)]==a[i:len(S)]:
		print("YES")
		exit(0)
print("NO")
exit(0)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include<vector>
#define REP(i,n) for(int i=0;i<n;i++)
#define V vector
#define VI vector<int>
#define VVI vector<vector<int>>
#define M 1000000007

using namespace std;

int main(void){
    int N;
    cin>>N;
    VI h(N);
    VI dp(N);
    REP(i,N)cin>>h[i];
    dp[0]=0;
    dp[1]=abs(h[1]-h[0]);

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


Measured memory_bytes: 1024
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    d = int(ipt())
    c = [int(i) for i in ipt().split()]
    s = [[int(i) for i in ipt().split()] for _ in range(d)]
    ld = [-1]*26
    edval = [0]*26

    for i in range(d):
        edval = s[i]*1
        for j in range(26):
            dl = i-ld[j]
            edval[j] += 0.25*c[j]*dl**(1.7)
        v = edval.index(max(edval))
        ld[v] = i
        print(v+1)

    return

if __name__ == '__main__':
    main()


Measured memory_bytes: 88240
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
#include <set>

using namespace std;

typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define Fst first
#define Snd second
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)
#define repv(t,it,v) for(vector<t>::iterator it = v.begin() ; it != v.end() ; ++it)

int h,w;

int main(){
	scanf("%d%d" , &h , &w);
	repp(i,0,h){
		repp(j,0,w){
			char s[10];
			scanf(" %s" , s);
			if(s[0] == 's' && s[1] == 'n' && s[2] == 'u' && s[3] == 'k' && s[4] == 'e'){
				printf("%c%d\n" , 'A' + j , i + 1);
			}
		}
	}
	return 0;
}


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

typedef long long ll;

using namespace std;

int solve(ll n) {
    if (n <= 99) {
        return n;
    }
    return solve(n - 99) + 100;
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int d, n;
    cin >> d >> n;

    ll res = solve(n);
    for (int i = 0; i < d; i++) res *= 100;
    cout << res << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
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<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<28;
const ll INF=1ll<<50;
const double pi=acos(-1);
const double eps=1e-8;
const int mod=1e9+7;
const vi emp;
const int dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};

int n,m;
vi a,b;

int main(){
	cin>>n>>m;
	vvi dp(n+1,vi(m+1));
	for(int i=0;i<=n;i++) for(int j=0;j<=m;j++) if(i>j) dp[i][j]=inf;
	a=vi(n);
	b=vi(m);
	for(int i=0;i<n;i++) cin>>a[i];
	for(int i=0;i<m;i++) cin>>b[i];
	for(int i=1;i<=n;i++) for(int j=1;j<=m;j++){
		if(i<=j) dp[i][j]=min(dp[i-1][j-1]+a[i-1]*b[j-1],dp[i][j-1]);
	}
	cout<<dp[n][m]<<endl;
}

Measured memory_bytes: 5964
n=int(input())
s=input()
ans=0
for i in range(1000):
  v=str(i)
  v=v.zfill(3)
  ss=s
  if not v[0] in ss:
    continue  
  ss=ss[ss.index(v[0])+1:]
  if not v[1] in ss:
    continue
  ss=ss[ss.index(v[1])+1:]
  if not v[2] in ss:
    continue
  ans+=1
print(ans)

Measured memory_bytes: 3188
#include <stdio.h>

#define MAX 200000

int H, A[500001];

void heap(int i){

  int l, r, largest, tmp;

  l=2*i;
  r=2*i+1;

  if(l<=H&&A[l]>A[i]){

    largest=l;
  }
  else{

    largest=i;
  }

  if(r<=H&&A[r]>A[largest]){

    largest=r;
  }


  if(largest!=i){

    tmp=A[i];
    A[i]=A[largest];
    A[largest]=tmp;

    heap(largest);
  }

}

void build(){

  int i;

  for(i=H/2;i>=1;i--){
    heap(i);
  }
}

int main(){

  int i;
  
  scanf("%d", &H);

  for(i=1;i<=H;i++){

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

  build();

  for(i=1;i<=H;i++){

    printf(" %d", A[i]);
  }

  printf("\n");

  return 0;
}



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


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

  int N, M;
  cin >> N >> M;
  vector<vector<int>> results(N, vector<int>(2));
  for(int i = 0; i < M; i++){
    int p;
    string s;
    cin >> p >> s;
    p--;
    if(s == "AC"){
      results.at(p).at(0)++;
    } else{
      if(results.at(p).at(0) == 0){
        results.at(p).at(1)++;
      }
    }
  }
  int ansAC = 0;
  int ansWA = 0;
  for(int i = 0; i < N; i++){
    if(results.at(i).at(0) > 0){
      ansAC++;
      ansWA += results.at(i).at(1);
    }
  }
  cout << ansAC << " " << ansWA <<endl;
} 

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

using namespace std;

int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        int n,d;
        scanf("%d%d",&n,&d);
        priority_queue<int,vector<int>,greater<int>> x;
        x.push(d);
        for(int i=1;i<n;++i)
        {
            int a=x.top();
            x.pop();
            x.push(127);
            x.push(a^127);
        }
        int res=0;
        while(!x.empty())
        {
            res+=x.top();
            x.pop();
        }
        printf("%d\n",res);
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>


using namespace std;


int solve(string S);


int main() {

	int N, * T, M, * P, * X, ans = 0;

	cin >> N;

	T = new int[N];

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

	cin >> M;

	P = new int[M];
	X = new int[M];


	for (int i = 0; i < M; i++) {
		cin >> P[i] >> X[i];
	}

	for (int i = 0; i < M; i++) {
		for (int j = 0; j < N; j++) {
			if (j == P[i] - 1) {
				ans += X[i];
			}
			else{
				ans += T[j];
			}
		}
		cout << ans << "\n";
		ans = 0;
	}

	return 0;

}

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

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;//

const int64 infll = (1LL << 60) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


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

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

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

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

int main() {
  int N;
  cin >> N;
  vector< int > A(N);
  for(int i = 1; i < N; i++) {
    cin >> A[i];
    --A[i];
  }
  vector< int > dp(N);
  for(int i = N - 1; i > 0; i--) {
    dp[A[i]]++;
  }
  cout << dp << endl;
}


Measured memory_bytes: 4784
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c;cin>>a>>b>>c;
    int poor = 0;
    if(a==b&&a!=c) poor=1;
    else if(b==c&&b!=a) poor=1;
    else if(c==a&&c!=b) poor=1;
    if(poor) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    /*宣言部*/
    long nnum1, nnum2;    /*nnum1, nnum2:自然数a, b*/
    
    /*入力部*/
    scanf("%ld%ld", &nnum1, &nnum2);
    
    /*計算部*/    /*ユークリウッド互除法*/
    while (!(nnum1==nnum2)){    /*nnum1とnnum2が等しくなるまでループ*/
        /*大きい方から小さい方を引き続ける*/
        if (nnum1 > nnum2){
            nnum1 = nnum1 - nnum2;
        }else if (nnum1 < nnum2){
            nnum2 = nnum2 - nnum1;
        }
    }
    
    /*出力部*/
    printf("%d\n", nnum1);    /*nnum1とnnum2どちらも同じ最大公約数になってるので
                                とりあえずnnum1を表示*/
    return 0;
}

Measured memory_bytes: 592
#include <iostream>
#define REP(i, a, n) for(int i = ((int) a); i < ((int) n); i++)
using namespace std;

int N;
string S[100];

int main(void) {
  cin >> N;
  REP(i, 0, N) cin >> S[i];

  int cnt = 0;
  REP(i, 0, N) {
    if(S[i] == "A") cnt++;
    if(S[i] == "Un") {
      cnt--;
      if(cnt < 0) break;
    }
  }
  cout << (cnt == 0 ? "YES" : "NO") << endl;

  return 0;
}

Measured memory_bytes: 3160
#include <cstdio>
using namespace std;
int main(void){
  int n,k;
  int ans=1;
  scanf("%d%d",&n,&k);
  for (int i=0; i<n; i++){
    ans += (ans<k?ans:k);
  }
  printf("%d\n",ans);
  return 0;
}
    

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <limits>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <functional>

using namespace std;

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif
using ll = long long;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using vvvll = std::vector<vvll>;
#define reps(i, S, E) for (ll i = (S); i <= (E); i++)
#define rep(i, N) reps(i, 0, N-1)
#define deps(i, E, S) for (ll i = (E); i >= (S); i--)
#define dep(i, N) deps(i, N-1, 0)
const ll MOD = 1000000007;
const ll INF = 1LL << 60;


//C

//B

//A
int main() {
	ll a;
	scanf("%lld", &a);
	ll b;
	scanf("%lld", &b);
	ll c;
	scanf("%lld", &c);

	if (a + b + c >= 22) {
		printf("bust\n");
	}
	else {
		printf("win \n");
	}
}


Measured memory_bytes: 256
#include <stdio.h>

#define NUM 3

int main(void){
	int a, b;
	int hours, minutes, seconds;
	int i;
	
	scanf("%d %d", &a, &b);
	
	if(a > b){
		printf("a > b\n");
	}
	else if(a < b){
		printf("a < b\n");
	}
	else{
		printf("a == b\n");
	}
	
	return 0;
}

Measured memory_bytes: 580
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int maxn=2e3+5;
inline int read(){
	char c=getchar();int t=0,f=1;
	while((!isdigit(c))&&(c!=EOF)){if(c=='-')f=-1;c=getchar();}
	while((isdigit(c))&&(c!=EOF)){t=(t<<3)+(t<<1)+(c^48);c=getchar();}
	return t*f;
}
int n,a[maxn],vis[maxn],fd[maxn],m,b[maxn];
int f[maxn][maxn];
bool cmp(int x,int y){
	return a[x]>a[y];
}
signed main(){
	n=read();
	int ans=0;
	for(int i=1;i<=n;i++){a[i]=read();b[i]=i;}
	sort(b+1,b+1+n,cmp);
	for(int i=1;i<=n;i++){
		for(int j=0;j<=i;j++){
			int k=i-j;
			if(j>0)
			f[i][j]=f[i-1][j-1]+abs(b[i]-j)*a[b[i]];
			if(j<i)
			f[i][j]=max(f[i][j],f[i-1][j]+abs(n-k+1-b[i])*a[b[i]]);
		}
	}
	for(int i=1;i<=n;i++){
		ans=max(ans,f[n][i]);
		//printf("%lld %lld\n",i,f[n][i]);
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 26480
#include "bits/stdc++.h"
#define all(v) (v).begin(), (v).end()
using namespace std;
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define int long long
#define lson rt << 1, l, mid
#define rson rt << 1 | 1, mid + 1, r
#define lll __int128
#define pii pair<int, int>
#define fi first
#define se second

#define mp make_pair
signed main()
{

	int n,r;cin>>n>>r;
	int cnt=0;
	if(!n)cnt++;
	while(n){
		n/=r;cnt++;
	}
	cout<<cnt;

		getchar();
	getchar();
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#define MAX 30
using namespace std;
string S;

int main(){
    while (1) {
        int p;
        cin >> p;
        if (p!=0) {
            int stx[MAX],sty[MAX];
            for (int i = 0; i<p; i++){
                cin >> stx[i] >> sty[i];
            }
            int area[MAX][MAX]={};
            int pointx=10,pointy=10;
            int ord_num,ord_dis;
            char ord_dir;
            cin >> ord_num;
            for (int i =0; i<ord_num; i++) {
                cin >> ord_dir >> ord_dis;
                if (ord_dir=='N') {
                    for (int j=0; j<ord_dis; j++) {
                        pointy++;
                        area[pointx][pointy]=1;
                    }
                }if (ord_dir=='E') {
                    for (int j=0; j<ord_dis; j++) {
                        pointx++;
                        area[pointx][pointy]=1;
                    }
                }if (ord_dir=='S') {
                    for (int j=0; j<ord_dis; j++) {
                        pointy--;
                        area[pointx][pointy]=1;
                    }
                }if (ord_dir=='W') {
                    for (int j=0; j<ord_dis; j++) {
                        pointx--;
                        area[pointx][pointy]=1;
                    }
                }
            }
            int flag=0;
            for (int i=0; i<p; i++) {
                if (area[stx[i]][sty[i]]==1) {
                    flag++;
                }
            }
            if (flag==p) {
                cout << "Yes"<<"\n";
            }else{
                cout << "No" << "\n";
                
            }
        }else{
            break;
        }
    }
    
}

Measured memory_bytes: 1124
#include<stdio.h>
int MIN(int a,int b){return a<b?a:b;}
int main(){
  int a,b,c,n,s=0,m;
  scanf("%d %d %d %d",&a,&b,&c,&n);
  m=MIN(a,n);
  s+=m;
  n-=m;
  m=MIN(b,n);
  n-=m;
  m=MIN(c,n);
  s-=m;
  printf("%d\n",s);
  return 0;
}


Measured memory_bytes: 1712
import sys, bisect, math, itertools, heapq, collections
from operator import itemgetter
# a.sort(key=itemgetter(i)) # i番目要素でsort
from functools import lru_cache
# @lru_cache(maxsize=None)
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp():
    '''
    一つの整数
    '''
    return int(input())
def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))

n, m, x = inpl()
data = [inpl() for _ in range(n)]
ans=INF
for t in itertools.product([0, 1], repeat=n):
    tmp = 0
    a=[0]*m
    for idx, use in enumerate(t):
        if not use:
            continue
        else:
            tmp+=data[idx][0]
        for i in range(m):
            a[i] += data[idx][i + 1]
    FLAG=True
    for i in range(m):
        if a[i] < x:
            FLAG = False
            break
    if FLAG:
        ans=min(ans,tmp)
if ans == INF:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 69684
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
//
// using boost::multiprecision::cpp_int;
using namespace std;

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

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; }

typedef long long ll;
typedef pair<ll, ll> p;


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> v(n);
  rep(i, n) cin >> v[i];
  int q;
  cin >> q;
  vector<int> t(q);
  rep(i, q) cin >> t[i];
  int res = 0;
  set<int> s(ALL(v));

  for(auto a : t){
    if(s.count(a) >= 1) res++;
  }
  cout << res << endl;
}



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

int main(void){
	int A,B;
	cin>>A>>B;
	if(A >= 13)cout<<B<<endl;
	else if(A <= 5)cout<<0<<endl;
	else cout<<B/2<<endl;

	return 0;
}


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

int main() {
	string a,b;
	cin >> a >> b;
	int i,j;
	cin >> i >> j;
	string k;
	cin >> k;
	if(k == a) i--;
	else j--;
	cout << i << " " << j << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
 
int main(){
  ios_base::sync_with_stdio(false);

  int a, b;

  cin >> a >> b;
  
  int ans = a * b;
  ans -= a;
  ans -= b;
  ans++;  

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



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <climits>

using namespace std;

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

	int n;
	cin >> n;
	vector<int> a(n);
	long long num = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		a[i] *= 2;
		if (i % 2 == 1)num -= a[i];
		else num += a[i];
	}
	num /= 2;
	int pre = num;
	for (auto& i : a) {
		cout << pre << " ";
		pre = i - pre;
	}
	cout << endl;
}

Measured memory_bytes: 1792
S = input()

res1 = 0
res2 = 0

for i in range(len(S)):
    if i % 2 == 0:
        if S[i] == "0":
            res1 += 1
        else:
            res2 += 1
    else:
        if S[i] == "1":
            res1 += 1
        else:
            res2 += 1

print(min(res1, res2))

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

using namespace std;
#define int long long
int32_t main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n;
    cin>>n;
    int ans[n+1];
    for(int i=0;i<=n;++i) ans[i]=0;
    for(int i=1;i<=100;++i)
    {
        for(int j=1;j<=100;++j)
        {
            for(int k=1;k<=100;++k)
            {
                int h=i*i+j*j+k*k+k*i+k*j+j*i;
                if(h<=n) ans[h]++;
            }
        }
    }
    for(int i=1;i<=n;++i)
    {
        cout<<ans[i]<<endl;
    }
    return 0;
}


Measured memory_bytes: 3576
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

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

const ll MOD=998244353;
const ll INF=1e18;
const double pi=acos(-1);
const double eps=1e-10;

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

const int MAX_N = 300010;

ll modpow(ll a, ll b){
    if(b==0) return 1;
    else if(b%2==0){
        ll d=modpow(a, b/2)%MOD;
        return (d*d)%MOD;
    }
    else{
        return (a*modpow(a, b-1))%MOD;
    }
}

ll fact[MAX_N], finv[MAX_N];
ll comb(int n, int r){
    if(n<r || r<0) return 0;
    return fact[n]*finv[n-r]%MOD*finv[r]%MOD;
}

ll calc(int n){
    fact[0]=finv[0]=1;
    for(int i=1; i<=n; i++){
        fact[i]=(fact[i-1]*i)%MOD;
        finv[i]=modpow(fact[i], MOD-2);
    }
}

int main(){
    ll n, a, b, k; cin>>n>>a>>b>>k;
    calc(n+5);

    ll ans=0;
    for(ll i=0; i<=n; i++){
        ll sum=k;
        sum -= i*a;
        if(sum % b == 0){
            ans += comb(n, i) * comb(n, sum/b);
            ans %= MOD;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 4992
X = int(input())
 
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
 
    # divisors.sort()
    return divisors

yakusu = make_divisors(X)
for k in yakusu:
    for A in range(-1000, 1000):
        B = A-k
        if A**4 + (A**3)*B + (A**2)*(B**2) + A*(B**3) + B**4 == X/k:
            print(A, B)
            break

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

int main(){
  int h, w;
  int dist[10][10];
  cin >> h >> w;
  for(int i = 0; i < 10; i++){
    for(int j = 0; j < 10; j++){
      cin >> dist[i][j];
    }
  }
  for(int k = 0; k < 10; k++){
    for(int i = 0; i < 10; i++){
      for(int j = 0; j < 10; j++){
        dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
      }
    }
  }
  int sum = 0;
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      int a;
      cin >> a;
      if(a >= 0) sum += dist[a][1];
    }
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			String weather = sc.next();

			if ("Sunny".equals(weather)) System.out.println("Cloudy");
			else if ("Cloudy".equals(weather)) System.out.println("Rainy");
			else if ("Rainy".equals(weather)) System.out.println("Sunny");
		}
	}
}

Measured memory_bytes: 23764
//Optional FAST
 
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")
 
//Required Libraries
 

#include <bits/stdc++.h>
//#include<iostream>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
 
//Required namespaces
 
using namespace std;
using namespace __gnu_pbds;
//typedef
typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long,long> pll;

//define
#define pb push_back
#define pf push_front
#define fi first
#define se second
//#define endl '\n'
#define forin(i,a,b) for(long long i=a;i<=b;i++)
#define forde(i,a,b) for(long long i=a;i>=b;i--)
#define fio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);

ll power(ll x,ll y)
{
    if (y == 0)
        return 1;
    ll p = power(x, y/2) % MOD;
    p = (p * p) % MOD;

    return (y%2 == 0)? p : (x * p) % MOD;
}
ll modInverse(ll a)
{
   return power(a,MOD-2);
}
vector<ll> pr; 
//ll z[1001][11]={0};
int main()
{
    /*
    #ifndef ONLINE_JUDGE
       freopen ("input.txt" , "r" , stdin);
		// freopen ("OUTPUT.txt" , "w" , stdout);
	#endif
    */
    fio;
    ll n,k;
    cin>>n>>k;
    ll h[n];
    forin(i,0,n-1)
    cin>>h[i];

    ll ans=0;
    vector<ll> dp(n,inf);
    dp[0]=0;
    forin(i,0,n-1)
    {
         forin(j,i+1,i+k)
         {
             if(j<n)
             dp[j]=min(dp[j],dp[i]+abs(abs(h[j]-h[i])));
         }
       
    }
    cout<<dp[n-1]<<endl;
}

Measured memory_bytes: 1792