akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>

#define pb push_back
#define mp make_pair
#define taskname "A"

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef tree <int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

const int maxn = 3e3 + 5;
const int mod = 1e9 + 7;
int n , T;
ii a[maxn];
int dp[maxn][maxn];

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    if(fopen(taskname".INP","r")){
		freopen(taskname".INP", "r",stdin);
		freopen(taskname".OUT", "w",stdout);
    }
    cin >> n >> T;
    for(int i = 1 ; i <= n ; ++i)cin >> a[i].first >> a[i].second;
    sort(a + 1 , a + n + 1);
    int res = 0;
    for(int i = 1 ; i <= n ; ++i){
        for(int j = 1 ; j <= T ; ++j){
            dp[i][j] = dp[i - 1][j];
        }
        for(int j = a[i].first ; j <= T ; ++j){
            dp[i][j] = max(dp[i][j] , dp[i - 1][j - a[i].first] + a[i].second);
        }
        for(int j = 0 ; j <= T ; ++j){
            res = max(res , dp[i][j]);
            if(j < T)res = max(res , dp[i - 1][j] + a[i].second);
        }
    }
    cout << res;
}


Measured memory_bytes: 35456
def warshallfloyd(branch): #branchの中身はbranch[頂点] = [隣接頂点、距離]#
	dist = [[10000000 for i in range(n)]for k in range(n)]
	for i in range(n):
		dist[i][i] = 0
		for k in range(len(branch[i+1])):
			dist[i][branch[i+1][k][0]-1] = branch[i+1][k][1]
	for i in range(n):
		for k in range(n):
			for e in range(n):
				newlength = dist[k][i] + dist[i][e]
				if newlength < dist[k][e]:
					dist[k][e] = newlength
	return dist

import itertools
n,m,r = map(int,input().split())
visit = list(map(int,input().split()))
branch = dict()
for i in range(1,n+1):
	branch[i] = []
for i in range(m):
	a,b,c = map(int,input().split())
	branch[a].append([b,c])
	branch[b].append([a,c])

distance = warshallfloyd(branch)

min = 1000000000
test = list(itertools.permutations(visit))
for i in range(len(test)):
	temp = 0
	for k in range(len(test[i])-1):
		temp += distance[test[i][k]-1][test[i][k+1]-1]
	if temp < min:
		min = temp
print(min)

Measured memory_bytes: 14380
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef pair<int, int> pii;
typedef double f32;
typedef long long i64;
const int N = 1e5+5; const f32 pi = acos(-1);
int n, L, T[N]; f32 X, Y, w;
int main()
{
    scanf("%d%d", &n, &L);
    for(int i = 1; i <= n; ++i) scanf("%d", T+i);
    for(int i = 1; i <= n; ++i) for(int j = 1; j < i; ++j)
        w = pi*(T[i]+T[j])/L, X += cos(w)*(n-2*(i-j-1)-2), Y += sin(w)*(n-2*(i-j-1)-2);
    X /= n*(n-1ll)*(n-2ll)/6, Y /= n*(n-1ll)*(n-2ll)/6, printf("%.9lf %.9lf\n", X, Y);
    return 0;
}

Measured memory_bytes: 4208
# coding: UTF-8
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    A=[[0]*3 for _ in range(3)]
    l=[]
    for i in range(3):
        A[i]=list(map(int,input().split()))
    for i in range(3):
        l.append(A[i])
        l.append([A[0][i],A[1][i],A[2][i]])
    l.append([A[0][0],A[1][1],A[2][2]])
    l.append([A[2][0],A[1][1],A[0][2]])
    N=int(input())
    b=[int(input()) for i in range(N)]
    for x in l:
        for y in x:
            if not y in b:
                break
        else:
            print('Yes')
            exit()
    print('No')

if __name__ == '__main__':
    main()


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

int top,S[200];

void push(int);
int pop(void);

int main(){
  int a,b;
  char s[200];

  while( scanf("%s",s) != EOF){
    
    if ( s[0] == '+' ){
      a=pop();
      b=pop();
      push(b+a);

    } else if ( s[0] == '-' ){
      a=pop();
      b=pop();
      push(b-a);

    } else if ( s[0] == '*' ){
      a=pop();
      b=pop();
      push(b*a);

    } else {
      push(atoi(s));

    }
  }
  printf("%d\n",pop());
  return 0;
}

void push(int x){
  top++;
  S[top]=x;
}

int pop(void){
  top--;
  return S[top+1];
}



Measured memory_bytes: 2108
#include<bits/stdc++.h>
using namespace std;
#define re register
const int mod=1e9+7;
struct par{int x,tp;}c[1010];
int a[610],b[610],qq[610],f[610][310],g[610][310];
inline bool cmp(const par&A,const par&B){return A.x<B.x;}
int main()
{
	re int n,nm1=0,tt=0;
	scanf("%d",&n);
	for(re int i=1;i<=2*n;i++)
	{
		scanf("%d",&a[i]);a[i]=a[i]!=-1?2*n+1-a[i]:-1;if(a[i]!=-1)b[a[i]]=1;
	}
	for(re int i=1;i<=2*n;i++)
	if(!b[i])c[++tt]=(par){i,1};
	for(re int i=1;i<=n;i++)if(a[i*2-1]==-1&&a[i*2]==-1)nm1++;
	else if(a[i*2-1]==-1||a[i*2]==-1)c[++tt]=(par){max(a[i*2-1],a[i*2]),0};
	sort(c+1,c+tt+1,cmp);
	f[0][0]=1;
	re int a1=0,b1=0;
	for(re int i=1;i<=tt;i++)
	{
		memcpy(g,f,sizeof(f));
		memset(f,0,sizeof(f));
		//printf("**%d %d\n",c[i].tp,c[i].x);
		if(c[i].tp)
		{
			a1++;
			for(re int j=0;j<=a1;j++)
				for(re int k=0;k<=b1;k++)f[j][k]=((long long)g[j][k+1]*(k+1)+(j?g[j-1][k]:0)+g[j+1][k])%mod;//,printf("*l*%d %d %d\n",j,k,f[j][k]);
		}else
		{
			b1++;
			for(re int j=0;j<=a1;j++)
				for(re int k=0;k<=b1;k++)f[j][k]=((k?g[j][k-1]:0)+g[j+1][k])%mod;//,printf("*l*%d %d %d\n",j,k,f[j][k]);
		}
	}
	for(re int i=1;i<=nm1;i++)f[0][0]=(long long)f[0][0]*i%mod;
	printf("%d\n",f[0][0]);
}

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

int main() {
  int N;
  cin>>N;
  vector<int> vec(N);
  for(int i=0;i<N;i++) cin>>vec.at(i);
  sort(vec.begin(), vec.end(), greater<int>());
  int Bob=0,Alice=0;
  for(int i=0;i<N;i+=2) {
    Alice += vec.at(i);
  }
  for(int i=1;i<N;i+=2) {
    Bob += vec.at(i);
  }
  cout << Alice-Bob << endl;
  return 0;
}


Measured memory_bytes: 256
s = input()
n = len(s)

s='|'+s+'|'

dp=[0]*(n+1)

#数列aの各項a_iについて、左右に連続する'<<<','>>>'の数をそれぞれカウント、
#その最大がa_iの最小値となる
R = [0]*(n+1)
L = [0]*(n+1)

#left count <<<
for i in range(1,n+1):
    if s[i]=='<':
        L[i] = L[i-1]+1
    else:
        L[i]=0
#right count >>>
for i in range(n-1,-1,-1):
    if s[i+1]=='>':
        R[i] = R[i+1]+1
    else:
        R[i]=0
ans=0
for i in range(n+1):
    ans+=max(R[i],L[i])
#print(L,R,s)
print(ans)




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

int main(){

  int a,b;
  cin >> a >> b;

  int sum = 0;
  int x[1000] = {};
  for(int i = 1; i < 1000; i++){
    sum += i;
    x[i] += sum;
  }

  for(int i = 0; i < 1000; i++){
    if(x[i]-a == x[i+1]-b){
      cout << x[i]-a << endl;
      break;
    }
  }

	return 0 ;
}


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

bool isPrime(int n) {
	if(n < 2) return false;
	bool result = true;
	for(int i = 2; i <= sqrt(n); i++) {
		if(n % i == 0) result = false;
	}
	return result;
}

int main() {
	int n;
	cin >> n;
	int count = 0;
	for(int i = 2; i <= 55555; i++) {
		if(isPrime(i) == 1 && i % 5 == 1) {
			cout << i << " ";
			count++;
		}
		if(count == n) break;
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//----***やべーやつら***----
using namespace std;
#define int long long

//----***型定義***----
using ll = long long;
using P = pair<int,int>;

//----***Like a Pythonista***----
#define REP(ii,jj,nn) for (ll ii=jj;ii<(nn);ii++)
#define RREP(ii,nn,jj) for (ll ii = nn; jj<ii;ii--)
#define each(i,...) for (auto&& i:__VA_ARGS__)
#define ALL(vec) (vec).begin(),(vec).end()
#define sum(...) accumulate(ALL(__VA_ARGS__),0LL)
#define dsum(...) accumulate(ALL(__VA_ARGS__),0.0)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
template<class T> inline auto max(const T& a){ return *max_element(ALL(a)); }
template<class T> inline auto min(const T& a){ return *min_element(ALL(a)); }
inline ll gcd(ll a,ll b){if(b == 0) return a;return  gcd(b,a%b);}
inline ll lcm(ll a,ll b){ll g = gcd(a,b);return a / g * b;}

//----***定数***----
#define MOD 1000000007
#define INF 100000000000000000
#define EPS 1e-9
const vector<vector<int>> DXY={{-1,0},{1,0},{0,-1},{0,1}};

//----***パーツ***----
#define fi first
#define se second
#define pb push_back
#define re return
#define br break

//----***入出力***---
void print() { std::cout << "\n"; }
template <class T>void print(const T &x) {std::cout << x<<"\n";}
template <class T, class... Args>void print(const T &x, const Args &... args) {std::cout << x << " ";print(args...);}
#define debug(var)  do{std::cerr << #var << " ↓ "<<"\n";view(var);}while(0);
#define dbg cerr<<"🥺🥺🥺🥺🥺🥺"<<endl;
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

//----***初期時読み込み***----
struct initial{initial(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);};}initial_;

signed main(){
  int N;cin>>N;
  double T,A;cin>>T>>A;
  int ans=-1;
  double degree=INF,a;
  REP(i,0,N){
    cin>>a;
    if(degree>abs(A-(T-a*0.006))){
      degree=abs(A-(T-a*0.006));
      ans=i+1;
    }
  }
  print(ans);
}


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

const int inf = 1012345678;

int main()
{
	int a,b,c,x = 0;
	cin >> a >> b >> c >> x;

	int ans = 0;

	for (int i = 0; i <= a; i++)
	{
		for (int j = 0; j <= b; j++)
		{
			for (int k = 0; k <= c; k++)
			{
				if(((500 * i) + (100 * j) + (50 * k)) == x)
				{
					ans++;
				}
			}
		}
	}

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

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
typedef long long LL;

LL n,m,col[200005] = {0};
vector <LL> G[200005];
LL flg,siz,cnt[3] = {0};
LL ans;

void dfs(LL u,LL f){
	for(LL i = 0;i < G[u].size();i ++){
		LL v = G[u][i];
		if(col[v] && col[v] == col[u]) flg = 1;
		if(!col[v]){
			col[v] = 3 - col[u]; siz ++;
			dfs(v,u);
		}
	}
}

int main(){
	ios::sync_with_stdio(false);
	LL u,v;
	cin >> n >> m;
	
	for(LL i = 1;i <= m;i ++){
		cin >> u >> v;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	
	for(LL i = 1;i <= n;i ++){
		if(col[i]) continue;
		flg = 0; siz = 1; col[i] = 1; dfs(i,0);
		if(siz == 1) cnt[2] ++;
		else cnt[flg] ++;
	}
	ans = (2 * n * cnt[2] - cnt[2] * cnt[2]) + (2 * cnt[0] * cnt[0]) + (cnt[1] * cnt[1] + cnt[1] * cnt[0] * 2);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 15360
a,b,k = list(map(int,input().split()))

a_l = [a+i for i in range(k)]
b_l = [b-i for i in range(k)]
if b-a < k:
    [print(i) for i in range(a,b+1)]
else:
    [print(i) for i in sorted(set(a_l+b_l))]


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

int main () {
    int n, i;
    double D1 = 0;
    double D2 = 0;
    double D3 = 0;
    double Dinf = 0;
    double x[100], y[100];
    double del[100];
    
    scanf("%d", &n);
    for (i = 0; i < n; i++) scanf("%lf", &x[i]);
    for (i = 0; i < n; i++) scanf("%lf", &y[i]);
    for (i = 0; i < n; i++) {
        del[i] = fabs(x[i] - y[i]); 
        D1 += del[i];
        D2 += del[i] * del[i];
        D3 += del[i] * del[i] * del[i];
        if (Dinf < del[i]) Dinf = del[i];
    }
    printf("%lf\n", D1);
    printf("%lf\n", pow(D2, 1.0/2.0));
    printf("%lf\n", pow(D3, 1.0/3.0));
    printf("%lf\n", Dinf);
}


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

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

const int Maxn = 100005;

int n, m;
ii ab[Maxn];
vector <int> my[Maxn];
ll res;

bool Less(const ii &a, const ii &b)
{

    if (a.second != b.second) return a.second > b.second;
}

int main()
{
    scanf("%d %d", &n, &m);
    for (int i = 0; i < n; i++) {
        scanf("%d %d", &ab[i].first, &ab[i].second);
        if (ab[i].first <= m)
            my[m - ab[i].first].push_back(ab[i].second);
    }
    priority_queue <int> Q;
    for (int i = m - 1; i >= 0; i--) {
        for (int j = 0; j < my[i].size(); j++)
            Q.push(my[i][j]);
        if (!Q.empty()) {
            res += Q.top(); Q.pop();
        }
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 6400
#!/usr/bin/env python3
import sys


def solve(N: int, M: int):
    a = 0 if N == 0 else N * (N - 1) / 2
    b = 0 if M == 0 else M * (M - 1) / 2
    print(int(a + b))
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    solve(N, M)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <numeric>

int testcase_ends() {
  size_t n, m;
  scanf("%zu %zu", &n, &m);
  if (n == 0 && m == 0) return 1;

  std::vector<int> a(n), b(m);
  for (auto& ai: a) scanf("%d", &ai);
  for (auto& bj: b) scanf("%d", &bj);

  std::sort(a.begin(), a.end());
  std::sort(b.begin(), b.end());

  int asum = std::accumulate(a.begin(), a.end(), 0);
  int bsum = std::accumulate(b.begin(), b.end(), 0);

  if ((asum+bsum) % 2 > 0) return puts("-1"), 0;
  b.push_back(1e9);

  int resa = -1;
  int resb = -1;
  for (auto ai: a) {
    // asum-ai+bj == bsum-bj+ai
    // bj+bj == bsum-asum+ai+ai
    // bj == (bsum-asum)/2+ai
    int bj0 = (bsum-asum)/2 + ai;
    int bj = *std::lower_bound(b.begin(), b.end(), bj0);
    if (bj != bj0) continue;
    if (resa == -1 || resa + resb > ai + bj) {
      resa = ai;
      resb = bj;
    }
  }
  if (resa == -1) return puts("-1"), 0;
  printf("%d %d\n", resa, resb);
  return 0;
}

int main() {
  while (!testcase_ends()) {}
}



Measured memory_bytes: 2632
#include <bits/stdc++.h>
using namespace std;
#define rep(shoki,i,n) for(int i=shoki; i<n; i++)
#define _GLIBCXX_DEBUG
using ll = long long;
using vi = vector<int>;

int m[110];

int main(){
    int n,x; cin>>n>>x;
    rep(0,i,n) cin>>m[i];
    sort(m,m+n);
    int rst = 0;
    rep(0,i,n){
        x -= m[i];
        rst++;
    }
    rst += x/m[0];

    cout << rst << endl;
}

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

int main() {
  int N;
  cin >> N;
  
  for( int i = 0; i < N; i++ ){
    string S;
    cin >> S;
    if( S == "Y" ){
      cout << "Four" << endl;
      break;
    }
    if( i == (N-1) ){
      cout << "Three" << endl;
    }
  }
}

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

namespace AtCoder.ABC111.B
{
    class Program
    {
        static void Main()
        {
            var sc = new Scanner();
            var n = sc.Nextint();

            for (int i = 1; i <= 9; i++)
            {
                var nice = i * 100 + i * 10 + i;
                if (n <= nice)
                {
                    Console.WriteLine(nice);
                    return;
                }
            }
        }
    }
    class Scanner
    {
        string[] s;
        long i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string Next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return Next();
            i = 0;
            return s[i++];
        }

        public int Nextint()
        {
            return int.Parse(Next());
        }
        public int[] Arrayint(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = Nextint() + add;
            }
            return Array;
        }

        public long NextLong()
        {
            return long.Parse(Next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (long i = 0; i < N; i++)
            {
                Array[i] = NextLong() + add;
            }
            return Array;
        }

        public double NextDouble()
        {
            return double.Parse(Next());
        }

        public double[] ArrayDouble(long N, double add = 0)
        {
            double[] Array = new double[N];
            for (long i = 0; i < N; i++)
            {
                Array[i] = NextDouble() + add;
            }
            return Array;
        }

        public decimal NextDecimal()
        {
            return decimal.Parse(Next());
        }

        public decimal[] ArrayDecimal(long N, decimal add = 0)
        {
            decimal[] Array = new decimal[N];
            for (long i = 0; i < N; i++)
            {
                Array[i] = NextDecimal();
            }
            return Array;
        }
    }
}


Measured memory_bytes: 11092
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::str::FromStr;
use std::io::*;
use std::collections::*;
use std::cmp::*;

struct Scanner<I: Iterator<Item = char>> {
    iter: std::iter::Peekable<I>,
}

macro_rules! exit {
    () => {{
        exit!(0)
    }};
    ($code:expr) => {{
        if cfg!(local) {
            writeln!(std::io::stderr(), "===== Terminated =====")
                .expect("failed printing to stderr");
        }
        std::process::exit($code);
    }}
}

impl<I: Iterator<Item = char>> Scanner<I> {
    pub fn new(iter: I) -> Scanner<I> {
        Scanner {
            iter: iter.peekable(),
        }
    }

    pub fn safe_get_token(&mut self) -> Option<String> {
        let token = self.iter
            .by_ref()
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            Some(token)
        }
    }

    pub fn token(&mut self) -> String {
        self.safe_get_token().unwrap_or_else(|| exit!())
    }

    pub fn get<T: FromStr>(&mut self) -> T {
        self.token().parse::<T>().unwrap_or_else(|_| exit!())
    }

    pub fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.get()).collect()
    }

    pub fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }

    pub fn char(&mut self) -> char {
        self.iter.next().unwrap_or_else(|| exit!())
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.get::<String>().chars().collect()
    }

    pub fn line(&mut self) -> String {
        if self.peek().is_some() {
            self.iter
                .by_ref()
                .take_while(|&c| !(c == '\n' || c == '\r'))
                .collect::<String>()
        } else {
            exit!();
        }
    }

    pub fn peek(&mut self) -> Option<&char> {
        self.iter.peek()
    }
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin.bytes().map(|c| c.unwrap() as char));
    let n: usize = sc.get();
    let mut adj = vec![Vec::new(); n];
    for _ in 0..n {
        let u = sc.get::<usize>() - 1;
        let k: usize = sc.get();
        for _ in 0..k {
            let v = sc.get::<usize>() - 1;
            adj[u].push(v);
        }
    }
    let mut dist = vec![-1; n];
    dist[0] = 0;
    let mut q = VecDeque::new();
    q.push_front(0);
    while let Some(i) = q.pop_back() {
        let cur = dist[i];

        for &n in &adj[i] {
            if dist[n] != -1 { continue; }

            dist[n] = cur + 1;
            q.push_front(n);
        }
    }

    for i in 0..n {
        println!("{} {}", i+1, dist[i]);
    }
}



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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll x;
    cin>>x;
    ll ans=100;
    int i=0;
    while(ans<x){
        ans=ans+(ans/100);
        //cout<<ans;
        i++;
    }
    cout<<i;
    return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef set<int> si;
typedef map<string, int> msi;
typedef greater<int> gt;
typedef priority_queue<int, vector<int>, gt> minq;
typedef long long ll;
const ll INF = 1e18L + 1;

//clang++ -std=c++11 -stdlib=libc++ 
int main() {
  int N,M; cin>>N>>M;
  puts(N==M?"Yes":"No");
  
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
int cnt;
int cnt2;
int cnt3;
int N;
int n;
cin>>N;
for(int i=1;i<=N;i++){
 n=i;

 while(n%2==0){

 n=n/2;
 cnt++;
 }
 if(cnt>=cnt2){
  cnt2=cnt;
cnt3=i;
 
 }
  cnt=0;
 }
cout<<cnt3<<endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
int n;
int p[111111];
int main(void){
  cin >> n;
  for(int i = 0; i < n; i++){
    int a,b;
    cin >> a >> b;
    p[a-1]++;
    p[b]--;
  }
  int best=0;
  for(int i = 1; i <= 100001; i++){
    p[i] += p[i-1];
    if(i <= p[i]){
      best = i;
    }
  }
  cout << best << endl;
}

Measured memory_bytes: 1556
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll q;cin>>q;
  for(ll i=0;i<q;i++){
    ll x,y;
    cin>>x>>y;
    if(x>y)swap(x,y);
    ll ans=x-1;
    long double k=sqrt(x*y-0.75)-x+0.5;
    ll lk=k;
    ans+=k+(x*y-1)/(x+k);
    cout<<ans-(x!=y)<<endl;
  }
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int MN = 1e5 + 5, LN = 17, INF = 0x3f3f3f3f, MOD = 1e9 + 7;

int N, L;

int main() {
    ios_base::sync_with_stdio(false), cin.tie(nullptr);
    cin >> N >> L;
    vector<string> a;
    for (int i = 0; i < N; i++) {
        string s; cin >> s;
        a.push_back(s);
    }
    sort(all(a));
    string ret;
    for (string i : a) ret += i;
    cout << ret << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
//#include <set>
//#include <map>
//#include <iomanip>
//#include <algorithm>
//#include <numeric>
//#include <queue>
//#include <stack>
//#include <math.h>
//#include <vector>
//#include <string>
//#include <list>
//#include <deque>
//#include <unordered_map>
//typedef long long LL;
//typedef long double LD;
using namespace std;
 
//#define MOD 1000000007
//#define MAX 200100
//#define NIL -1

int main() {
    int s;
    int w;
    cin >> s >> w;
    if(w>=s){
        cout << "unsafe" << endl;
    }else{
        cout << "safe" << endl;
    }

    return 0;
}

Measured memory_bytes: 3624
h,w=map(int,input().split())
S=[list(input()) for i in range(h)]
ans= [["" for i in range(w)] for j in range(h)]
for i in range(h):
  for j in range(w):
    if S[i][j]=="#":
      ans[i][j]="#"
    else:
      cnt = 0
      for k in range(-1,2):
        for l in range(-1,2):
          if 0<=i+k<h and 0<=j+l<w and S[i+k][j+l]=="#":
            cnt += 1
      ans[i][j]=str(cnt)
for i in range(h):
  for j in range(w):
    print(ans[i][j],end="")
  print("")


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

int main() {
  int X = 0, scard, tcard;
  int N;
  cin >> N;
  vector<string> s(N);
  for (int i = 0; i < N; i++)
    cin >> s.at(i);
  int M;
  cin >> M;
  vector<string> t(M);
  for (int i = 0; i < M; i++)
    cin >> t.at(i);
  for (int i = 0; i < N; i++) {
        scard = 0, tcard = 0;
    for (int j = 0; j < N; j++) {
       if (s.at(j) == s.at(i))
         scard++;
    }
    for (int j = 0; j < M; j++) {
     if (t.at(j) == s.at(i))
       tcard++;
    }
    if (X < scard - tcard)
      X = scard - tcard;
  }
  cout << X << endl;
}

Measured memory_bytes: 256
// Written By NewbieChd
#include <iostream>
#include <iomanip>
#include <cmath>
// #define double long double
using namespace std;

const int maxN = 100003;
inline double square(double x) { return x * x; }

struct Vector {
    double x, y;
    Vector() {}
    Vector(double x, double y) : x(x), y(y) {}
    friend Vector operator+(const Vector& a, const Vector& b) { return Vector(a.x + b.x, a.y + b.y); }
    friend Vector operator-(const Vector& a, const Vector& b) { return Vector(a.x - b.x, a.y - b.y); }
    friend Vector operator*(const Vector& a, const double& b) { return Vector(a.x * b, a.y * b); }
    friend Vector operator/(const Vector& a, const double& b) { return Vector(a.x / b, a.y / b); }
    inline double length() { return sqrt(square(x) + square(y)); }
    inline void read() { cin >> x >> y; }
    inline void write() { cout << fixed << setprecision(10) << x << ' ' << y << '\n'; }
};
inline double distance(Vector a, Vector b) { return sqrt(square(b.x - a.x) + square(b.y - a.y)); }
inline double dot(Vector a, Vector b) { return a.x * b.x + a.y * b.y; }
inline double cross(Vector a, Vector b) { return a.x * b.y - a.y * b.x; }

inline Vector project(Vector a, Vector b, Vector c) {
    b = a - b;
    return b * (dot(b, c - a) / square(b.length())) + a;
}
inline Vector reflect(Vector a, Vector b, Vector c) {
    a = project(a, b, c);
    return a * 2 - c;
}

int main() {
    ios::sync_with_stdio(false);
    Vector a, b, c;
    a.read(), b.read();
    int Q;
    for (cin >> Q; Q; --Q)
        c.read(), reflect(a, b, c).write();
    return 0;
}



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

inline 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 - 48; ch = getchar(); }
    return x * f;
}

const int M = 1e5 + 10;

struct P {
    int b;ll c;
    bool operator < (const P &rhs) const {
        return c > rhs.c;
    }
} p[M];

int main() {
    int n = read(), m = read();
    priority_queue<ll, vector<ll>, greater<ll> > que;
    for (int i = 0; i < n; i++) {
        int x = read();
        que.push((ll)x);
    }
    for (int i = 0; i < m; i++) p[i].b = read(), p[i].c = (ll)read();
    sort(p, p + m);
    for (int i = 0; i < m; i++) {
        int b = p[i].b;
        if (p[i].c <= que.top()) break;
        while (b--) {
            if (que.top() < p[i].c) {
                que.pop();
                que.push(p[i].c);
            } else {
                break;
            }
        }
    }
    ll sum = 0;
    while (!que.empty()) {
        int x = que.top(); que.pop();
        sum += x;
    }
    cout << sum << '\n';
    return 0;
}


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

int main() {
  int n;
  cin >> n;
  map<int, int> list;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    list[x]++;
  }
  int m;
  cin >> m;
  bool flag = true;
  for (int i = 0; i < m; i++) {
    int t;
    cin >> t;
    if (list.find(t) != list.end()) {
      if (list[t] == 0) {
        flag = false;
      }
      list[t]--;
    }
    else {
      flag = false;
    }
  }
  if (flag) {
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
  return 0;
}

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

int main() {
  int A, B, M;
  cin >> A >> B >> M;
  
 vector<int> a(A);
 vector<int> b(B);
 vector<vector<int>> discount(M, vector<int>(3));
  
 for (int i = 0; i< A; i++) cin >> a.at(i);
 for (int i = 0; i< B; i++) cin >> b.at(i);
 for (int i = 0; i< M; i++) {
   for (int j = 0; j< 3; j++) {
     cin >> discount.at(i).at(j);  
   }
 }
 
 int cost = 0;
 int answer = 0;
 int x,y;
 for (int i = 0; i < M; i++){
   x = discount.at(i).at(0);
   y = discount.at(i).at(1);
   cost = a.at(x-1) + b.at(y-1) - discount.at(i).at(2);
   if (i == 0) answer = cost;
   if (cost < answer) answer = cost;
 }
 sort (a.begin(),a.end());
 sort (b.begin(),b.end());
 cost = a.at(0) + b.at(0);
 if (cost < answer) answer = cost;
  cout << answer << endl;  
}

Measured memory_bytes: 6528
#include<stdio.h>
#include<vector>
#include<iostream>
#include<map>

using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<(int)(n);i++)

std::map<ll, ll> PrimeFactor(ll n){
    std::map<ll, ll> answer;
    for(ll i=2;i*i<=n;i++){
        while(n%i==0){
            answer[i]++;
            n /= i;
        }
    }
    if(n!=1)answer[n]=1;
    return answer;
}

int main(){
    ll n;
    cin >> n;
    cout << n << ":";
    for(auto i : PrimeFactor(n)){
        while(i.second--) cout << " " << i.first;
    }
    cout << endl;
}



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

int main(){
  int N, M;
  int A[10000];
  int play;
  int sum = 0;

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

  if (sum > N){
    cout<< "-1";
  } else {
    play = N - sum;
    cout << play;
  }

  return 0;
}


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

using namespace std;

int n, ia, ib;
long long x[100005], y[100005], aa, bb;

int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
		scanf("%lld", x + i);
	sort(x, x + n);
	ia = 0;
	ib = n - 1;
	if (ib % 2 == 1)
		ib--;
	for (int i = (n - n / 2) - 1; i >= 0; i--) {
		y[ia] = x[i];
		ia += 2;
		i--;
		if (i >= 0) {
			y[ib] = x[i];
			ib -= 2;
		}
	}
	ia = 1;
	ib = n - 1;
	if (ib % 2 == 0)
		ib--;
	for (int i = (n - n / 2); i < n; i++) {
		y[ib] = x[i];
		ib -= 2;
		i++;
		if (i < n) {
			y[ia] = x[i];
			ia += 2;
		}
	}
	for (int i = 1; i < n; i++)
		aa += abs(y[i] - y[i - 1]);
	// for (int i = 0; i < n; i++) printf("%lld ", y[i]); puts("");
	ia = 0;
	ib = n - 1;
	if (ib % 2 == 1)
		ib--;
	for (int i = n / 2; i < n; i++) {
		y[ia] = x[i];
		ia += 2;
		i++;
		if (i < n) {
			y[ib] = x[i];
			ib -= 2;
		}
	}
	ia = 1;
	ib = n - 1;
	if (ib % 2 == 0)
		ib--;
	for (int i = n / 2 - 1; i >= 0; i--) {
		y[ib] = x[i];
		ib -= 2;
		i--;
		if (i >= 0) {
			y[ia] = x[i];
			ia += 2;
		}
	}
	for (int i = 1; i < n; i++)
		bb += abs(y[i] - y[i - 1]);
	// for (int i = 0; i < n; i++) printf("%lld ", y[i]); puts("");
	printf("%lld\n", max(aa, bb));
	return 0;
}

Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		
		Scanner scan = new Scanner(System.in);
		
		int n=scan.nextInt();
		String str = scan.next();
		char a[] = str.toCharArray();
		
		if(n>=str.length()) {
			System.out.println(str);
		}else {
			for(int i=0;i<n;i++) {
				System.out.print(a[i]);
			}
			System.out.println("...");
		}
		
		
			
		}

	}





Measured memory_bytes: 35800
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using ll = long long;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using P = pair<ll, ll>;

// chmin, chmax関数
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}
template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}

// Yes-Noを出力する問題で楽をする
void Ans(bool f){
    if(f) cout << "Yes" << endl;
    else cout << "No" << endl;
}

//---------------------------

int main(){
    int n,x,t;
    cin >> n >> x >> t;
    cout << (n+x-1)/x*t << endl;
    return 0;
}

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

int main()
{
	int n, x, j, k;

	while(cin >> n >> x && (n || x)) {

		if(x > 3*n - 3)  {
		    cout << "0\n";
            continue;
		}
		
		int count = 0;
		int kmax = min(n+1, x-2);

		for(k = max(3,x-2*n+3); k < kmax; ++k) {
			int jmax = min(k, x-k);
			for(j = max(2, x-n-k+2); j < jmax; ++j)
				count += (x - 2*j - k) < 0;
		}
		
		cout << count << endl;
	}
	
	return 0;
}



Measured memory_bytes: 3032
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const long long INF = 1LL << 60;

int main() { 
    long double W, H;
    cin >> W >> H;
    ll x, y;
    cin >> x >> y;
    cout << fixed<< setprecision(9) <<W * H / 2 << " "<<((x + x == W) && (y + y == H)) << endl;
    return 0;
}

Measured memory_bytes: 3792
#define _CRT_SECURE_NO_WARNINGS
#include <vector>
#include <iostream>
using namespace std;

typedef double LD;
typedef long long LL;
typedef pair<int, int> PII;
#define MP make_pair
#define PB push_back
#define X first
#define Y second
#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define RFOR(i,b,a) for(int i = (b) - 1; i >= (a); --i)
#define REP(i, t) FOR(i,0,t)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())

const LL MOD = 1000000007;
const LL INF = 1e9;
const LL MAXN = 10007;

int main()
{
	ios_base::sync_with_stdio(0);
	//freopen("In.txt", "r", stdin);
	LL x, y;
	cin >> x >> y;
	if (x <= y)
	{
		if (x >= 0 || y <= 0)
			cout << y - x;
		else
			cout << min(y - x, abs(x + y) + 1);
		return 0;
	}
	cout << min(abs(x - y) + 2, abs(x + y) + 1);
	//cout << endl; system("pause");
	return 0;
}

Measured memory_bytes: 256
int N,K,C;
char S[2<<17];
int R[2<<17];
main()
{
	scanf("%d%d%d\n",&N,&K,&C);
	gets(S);
	int now=K;
	for(int i=N;i-->0;)
	{
		if(S[i]=='o')
		{
			R[i]=now--;
			i-=C;
		}
	}
	now=0;
	for(int i=0;i<N;i++)
	{
		if(S[i]=='o')
		{
			if(R[i]==++now)printf("%d\n",i+1);
			i+=C;
		}
	}
}


Measured memory_bytes: 2432
R, G, B, N = map(int, input().split())

num = 0
ans = 0
for r in range(N+1):
    numR = R*r
    if numR > N: continue
    for g in range(N+1):
        numG = numR + G*g
        if numG > N: continue
        b = (N-numG) / B
        if int(b) == b and b >= 0:
            ans += 1

print(ans)


Measured memory_bytes: 42220
#include<map>
#include<bitset>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<stack>
#define REP(i,x,y) for(ll i=x;i<=y;i++)
#define SIZE(a) ll(a.size())
#define vll vector<ll>
#define MEMSET(a, n, m) for(ll i=0;i<=n;i++) a[i] = m
#define BIT(n) (ll(1)<<n)
#define UNIQUE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define UNIQUE_ARRAY(a,n) n = unique(a + 1, a + x + 1) - a - 1
#define SORT(a,n) sort(a+1,a+n+1)
#define SORT_O(a,n,order) sort(a+1,a+n+1,order)
#define PER(i,y,x) for(ll i=y;i>=x;i--)
typedef long long ll;
using namespace std;
int main(){
    ll n,a;
    cin>>n>>a;
    cout<< n*n-a<<endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i=a; i<n; i++)
#define RREP(i, a, n) for(ll i=n-1; i>=a; i--)
typedef long long ll;
const ll mod =1e9+7;
const ll inf =1e18;
using namespace std;

ll h, w;
ll a[101010], b[101010];
vector<pair<ll, bool>> vp; // <a[i]or[b[i], is a>
int main(){
    cin>>h>>w;
    REP(i, 0, h){
        cin>>a[i];
        vp.emplace_back(a[i], true);
    }
    REP(j, 0, w){
        cin>>b[j];
        vp.emplace_back(b[j], false);
    }

    sort(vp.begin(), vp.end());

    ll ans=0;
    ll cnth=w, cntw=h;
    for(auto itr : vp){
        if(itr.second){
            ans+=(itr.first*cnth);
            cntw--;
        }
        else{
            ans+=(itr.first*cntw);
            cnth--;
        }

        if(cnth<=0 || cntw<=0) break;
    }

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


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

const int N = 1e5;

int v[N];

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

    int n;
    cin >> n;

    for (int i = 0; i < n; ++i)
        cin >> v[i];
    sort(v, v + n);

    double last = v[0];
    for (int i = 1; i < n; ++i)
        last = (last + v[i]) / 2;

    cout << last;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define range(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define rep(i,n) range(i,0,n)
using namespace std;

typedef long double D;
typedef complex<D> P;
typedef struct {P s,t;} L;

const D eps=1.0e-10;
const D pi=acos(-1.0);
template<class T> bool operator==(T a, T b){return abs(a-b)< eps;}
template<class T> bool operator< (T a, T b){return a < b-eps;}
template<class T> bool operator<=(T a, T b){return a < b+eps;}
template<class T> int sig(T r) {return (r==0||r==-0) ? 0 : r > 0 ? 1 : -1;}
template<class T> int sig(T a,T b = 0) {return a < b ? -1 : b > a ? 1 : 0;}
#define X real()
#define Y imag()

D ip(P a, P b) {return a.X * b.X + a.Y * b.Y;}
D ep(P a, P b) {return a.X * b.Y - a.Y * b.X;}
D sq(D a) {return sqrt(max(a, (D)0));}
P vec(L l){return l.t-l.s;}
inline P input(){D x,y;cin >> x >> y; return P(x,y);}
//??\??? ???????????¬????????¨???

// ?°???± verify AOJ CGL_1_A
P proj(P b,P p){ return b*ip(b,p)/norm(b);}
P proj(L l,P p){ return l.s+proj(vec(l),p-l.s);}
// ????°? verify AOJ CGL_1_B
P refl(L l,P p){ return proj(l,p)*D(2.0)-p; }

int main(void){
	while(1){
		char tmp;
		double x,y;
		cin >> x >> tmp >> y;
		if(cin.eof()) break;
		P a,b;
		a={x,y};
		cin >> tmp >> x >> tmp >> y;
		b={x,y};
		L base={a,b};
		P point;
		cin >> tmp >> x >> tmp >> y;
		point={x,y};
		P ans=refl(base,point);
		cout.precision(10);
		cout << fixed << ans.X << " " << ans.Y << endl;
	}
	return 0;
}

Measured memory_bytes: 1308
import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {

    Scanner sc = new Scanner(System.in);

    class Card implements Comparable<Card> {
        public final String Suit;
        public final int Number;

        public Card(String input) {
            this.Suit = input.substring(0, 1);
            this.Number = Integer.valueOf(input.substring(1, 2));
        }

        @Override
        public int compareTo(Card card) {
            if (this.Number < card.Number) return -1;
            if (this.Number > card.Number) return 1;
            return 0;
        }

        @Override
        public String toString() {
            return this.Suit + String.valueOf(this.Number);
        }

        @Override
        public boolean equals(Object obj) {
            if (obj == this) return true;
            if (!(obj instanceof Card)) return false;
            Card c = (Card) obj;
            return this.Suit.equals(c.Suit) && this.Number == c.Number;
        }
    }

    Card[] bubbleSort(Card[] c) {
        int n = c.length;
        for (int i = 0; i < n; i++)
            for (int j = n - 1; j > i; j--) {
                if (c[j - 1].compareTo(c[j]) > 0) {
                    Card tmp = c[j - 1];
                    c[j - 1] = c[j];
                    c[j] = tmp;
                }
            }
        return c;
    }

    Card[] selectionSort(Card[] c) {
        int n = c.length;
        for (int i = 0; i < n; i++) {
            int minIndex = i;
            for (int j = i; j < n; j++) {
                if (c[minIndex].compareTo(c[j]) > 0) {
                    minIndex = j;
                }
            }
            Card tmp = c[i];
            c[i] = c[minIndex];
            c[minIndex] = tmp;
        }
        return c;
    }

    void show(final Card[] xs) {
        if (xs != null) {
            String out =
                    Arrays.stream(xs)
                            .map(Card::toString)
                            .collect(Collectors.joining(" "));
            System.out.println(out);
        }
    }

    void showIsStable(boolean f) {
        System.out.println(f ? "Stable" : "Not stable");
    }

    void solve() {
        // Input
        int n = sc.nextInt();
        Card[] c = new Card[n];
        for (int i = 0; i < n; i++) {
            c[i] = new Card(sc.next());
        }

        // Solve
        Card[] bubble = bubbleSort(c.clone());
        boolean isStableBubble = true;
        Card[] selection = selectionSort(c.clone());
        boolean isStableSelection = Arrays.deepEquals(bubble, selection);

        // Output
        show(bubble);
        showIsStable(isStableBubble);
        show(selection);
        showIsStable(isStableSelection);
    }

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



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

int n, k, ma, res, i;
int a[100010];

int gcd(int x, int y)
{
	return y == 0 ? x : gcd(y, x % y);
}

int main()
{
	scanf("%d%d", &n, &k);
	ma = 0;
	for (i = 1; i <= n; ++i)
	{
		scanf("%d", &a[i]);
		res = gcd(res, a[i]);
		ma = max(ma, a[i]);
	}
	if (k <= ma && (ma - k) % res == 0) puts("POSSIBLE");
				else puts("IMPOSSIBLE");
	return 0;
}

Measured memory_bytes: 640
// clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c), end(c)
#define rall(c) rbegin(c), rend(c)
#define fore(x, c) for(auto &&x : c)
#define rep(i, a, n) for(int i = a, i##len = (int)(n); i < i##len; ++i)
#define rrep(i, a, n) for(int i = (int)(n - 1); i >= a; --i)
#define sz(c) ((int)c.size())
#define contains(c, x) (c.find(x) != end(c))
#define inseg(l, x, r) ((l) <= (x) && (x) < (r))
#define dump(...)
#define pb push_back
#define eb emplace_back
#define _ 0
const signed INF_ = 1001001001; const long long INF = 1001001001001001001LL;
const int DX[9] = {0,1,0,-1,1,1,-1,-1,0}, DY[9] = {-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os, const vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is, vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
  is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a, const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a, const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap = priority_queue<T, deque<T>, greater<T>>;
struct before_main_function {
  before_main_function() {
      cin.tie(nullptr); ios::sync_with_stdio(0);
      cout << setprecision(15) << fixed;
  }
} before_main_function;
// clang-format on
//------------------8<------------------------------------8<--------------------

signed main() {
  int N, K;
  cin >> N >> K;
  vi A(N);
  cin >> A;
  rep(loop, 0, K) {
    vi B(N);
    rep(i, 0, N) {
      int l = max(0LL, i - A[i]);
      int r = min(N - 1, i + A[i]);
      B[l]++;
      if (r < N - 1) B[r + 1]--;
    }
    bool changed = A[0] != B[0];
    rep(i, 0, N - 1) {
      B[i + 1] += B[i];
      if (A[i + 1] != B[i + 1]) changed = true;
    }
    if (!changed) break;
    A.swap(B);
  }
  cout << A << endl;
  return (0 ^ _ ^ 0);
}



Measured memory_bytes: 6368
#include<iostream>
#include<cmath>
using namespace std;
int main() {
	int time,atai, ansa = 0;
	cin >> time;
	long suuti;
	ansa = time;
	for (int i = 0; i < time; i++) {
		cin >> suuti;
		if (suuti == 2) {
			continue;
		}
		atai = sqrt(suuti);
		for (int ii = 2; ii <= atai + 1; ii++) {
			if (suuti%ii==0) {
				--ansa;
				break;
			}
		}
	}
	cout << ansa << endl;
	return 0;
}

Measured memory_bytes: 1164
import java.util.Scanner;

public class Main {
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int K = sc.nextInt();
//        List<Integer> list = new ArrayList<Integer>();
//        List<Integer> lo = new ArrayList<Integer>();
        int X = sc.nextInt();
        
        
        for(int i = 0; i < 2*(K-1)+1; i++) {
            System.out.print(X-K+1+i);
            if(i != 2*(K-1) )System.out.print(" ");
        }
        System.out.println("");

    }
}


Measured memory_bytes: 22996
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> l_l;
typedef pair<int,int> i_i;
const ll mod=1e9+7;
const int inf=1<<30;

int main(){
  vector<vector<int> > g(3,vector<int>(3));
  rep(i,3)rep(j,3) cin >> g[i][j];
  int n; cin >> n;
  vector<int> b(n);
  rep(i,n) cin >> b[i];
  rep(i,3)rep(j,3)rep(k,n){
    if(g[i][j]==b[k]) g[i][j]=-1;
  }
  bool f=0;
  rep(i,3){
    if(g[i][0]==-1&&g[i][1]==-1&&g[i][2]==-1) f=1;
  }
  rep(i,3){
    if(g[0][i]==-1&&g[1][i]==-1&&g[2][i]==-1) f=1;
  }
  if(g[0][0]==-1&&g[1][1]==-1&&g[2][2]==-1) f=1;
  if(g[0][2]==-1&&g[1][1]==-1&&g[2][0]==-1) f=1;
  if(f) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

int main() {
	map<ll,ll>a;
	ll n;
	cin>>n;
	for(int i=0;i<n;i++){
		ll z;
		cin>>z;
		a[z]++;
	}
    ll ans=0;
    for(auto itr = a.begin(); itr != a.end(); ++itr) {
        if( (itr->second)%2!=0){
        	ans++;
        }
    }
    cout <<ans;
	return 0;
}

Measured memory_bytes: 6528
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;

template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

ll comb(int n, int k) {
    if (n == 0 || k == 0) {
        return 1;
    }

    ll ans = 1;
    for (int i = 0; i < k; i++) {
        ans *= n;
        n--;
    }
    for (int i = 1; i <= k; i++) {
        ans /= k;
    }
    return ans;
}

vector<vector<ll>> dp1;
vector<vector<ll>> dp2;

int main(void) {
    string S;
    int K;
    cin >> S >> K;
    int len = (int) S.size();
    S = " " + S;

    // require more spaces
    dp1.resize(len + 2, vector<ll>(K + 2, 0));
    dp2.resize(len + 2, vector<ll>(K + 2, 0));

    dp1[0][0] = 1;

    for (int i = 0; i < len; i++) {
        for (int j = 0; j <= K; j++) {
            int next_d = S[i + 1] - '0';

            // dp1
            if (next_d == 0) {
                dp1[i + 1][j] += dp1[i][j];
            } else {
                // set same digit
                dp1[i + 1][j + 1] += dp1[i][j];

                // set 0
                dp2[i + 1][j] += dp1[i][j];

                // otherwise
                for (int d = 1; d < next_d; d++) {
                    dp2[i + 1][j + 1] += dp1[i][j];
                }
            }

            // dp2
            dp2[i + 1][j] += dp2[i][j];
            dp2[i + 1][j + 1] += dp2[i][j] * 9;
        }
    }

    // printf("dp1: \n");
    // for (int i = 0; i <= len; i++) {
    //     for (int j = 0; j <= K; j++) {
    //         cout << dp1[i][j] << " ";
    //     }
    //     cout << endl;
    // }
    // cout << endl;

    // printf("dp2: \n");
    // for (int i = 0; i <= len; i++) {
    //     for (int j = 0; j <= K; j++) {
    //         cout << dp2[i][j] << " ";
    //     }
    //     cout << endl;
    // }
    // cout << endl;

    cout << dp1[len][K] + dp2[len][K] << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
	char gr[100];
	int n = 0;

	while (1) {
		int m, f, r; cin >> m >> f >> r;

		if (m == -1 && f == -1 && r == -1) break;

		if (m == -1 || f == -1) gr[n] = 'F';
		else if (m + f >= 80) gr[n] = 'A';
		else if (m + f >= 65) gr[n] = 'B';
		else if (m + f >= 50) gr[n] = 'C';
		else if (m + f >= 30) {
			if (r >= 50) gr[n] = 'C';
			else gr[n] = 'D';
		}
		else gr[n] = 'F';

		++n;
	}

	for (int i = 0; i < n; ++i) cout << gr[i] << endl;
}


Measured memory_bytes: 3068