akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
    int N,M;
    cin >> N >> M;

    int T = 0;
    for (int i = 0; i < M; i++) {
        int A;
        cin >> A;
        T += A;
    }

    if (N < T) cout << -1 << endl;
    else cout << N - T << endl;
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main(void){
  int N;
  cin >> N;
  vector<int> v;
  int sum = 0;
  for(int i=0;i<N;i++){
    int tmp;
    cin >> tmp;
    sum = sum + tmp;
    v.push_back(tmp);
  }
  double locate_d = (double)sum/N;
  int loc = round(locate_d);
  long ans = 0;
  for(int i=0;i<N;i++){
    ans = ans + (loc - v[i])*(loc - v[i]);
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#define REP(i, n) for (int i = 0; i < (n); i++)

using namespace std;

int main() {
  int N, M;
  cin >> N >> M;
  int mn = 1;
  int mx = N;
  REP(i, M) {
    int l, r;
    cin >> l >> r;
    mx = min(mx, r);
    mn = max(mn, l);
  }
  cout << max(0, mx - mn + 1) << '\n';
}


Measured memory_bytes: 256
/*  
     author : masaow    
     g++ : 17.3.20  
*/        
#include <bits/stdc++.h>  
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define forn(i,a,b)        for( i = a ; i < b  ; i++ )
#define debug(x)           cout << #x << " " << x << " -- \n"
#define ll                 long long  
#define p(x)               cout << x << "\n" ; 
#define pi                 pair<int,int>
#define vi                 vector <int>
#define pb                 push_back
#define vp                 vector <pair<ll,ll>>
#define endl               cout << "\n"
#define mi                 map <int,int> 
#define f1                 first 
#define s1                 second    
#define in                 insert
#define all(x)             x.begin(),x.end() 
using namespace std ; 
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set ; 
const int SIZE = 1e5+7 ;  
const int MOD = 1e9 +7 ; 
const int INF = 2e9+7 ;
/*  
    time : 08 : 48    
    date : 16...02...2020
*/ 
void I_O(){
    ios::sync_with_stdio(false) ;
    cin.tie(NULL);
    cout.tie(NULL);
}
int tests(){ 
  int N,K,S ;
  int i ; 
  cin  >> N >> K  >> S  ;
  if(S+7 != MOD) {  
  forn(i,0,K)
    cout << S <<  ' ' ; 
  while(i++ < N)
  cout << MOD-7 << ' '   ;
  return   0 ;  
  }
  forn(i,0,K)
    cout << S << ' ' ;
    while( i++ < N ) 
      cout << 1 <<  ' '  ; 

  return  0 ;   
}
int main(){ 

    I_O() ;  
    int cases = 1 ;
    // cin >> cases;  
    while(cases--) 
      tests(); 
  return 0 ;
}
// web dev simplified
// LearnCode.Academy
/*
 g++ subminnnt.cpp -Wall -Wextra -pedantic
 -std=c++11 -O2 -Wshadow -Wformat=2 -Wfloat-equal
 -Wconversion -Wlogical-op -Wshift-overflow=2
 -Wduplicated-cond -Wcast-qual -Wcast-align -D_GLIBCXX_DEBUG
 -D_GLIBCXX_DEBUG_PEDANTIC -D_FORTIFY_SOURCE=2 -fsanitize=address 
 -fsanitize=undefined -fno-sanitize-recover -fstack-protec    
*/         
         
  

Measured memory_bytes: 1280
N = int(input())
S = [input() for _ in range(N)]
S = ["".join(sorted(s)) for s in S]

cnt = 0
dic = {}

for w in S:
    if w in dic:
        cnt += dic[w]
        dic[w] += 1
    else:
        dic[w] = 1
        
print(cnt)

Measured memory_bytes: 19852
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<utility>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

struct fast_io {
	fast_io(){
		std::cin.tie(nullptr);
		std::ios::sync_with_stdio(false);
	};
} fio;

signed main(){
	cout<<fixed<<setprecision(10);
	
	int N;
    vector<int> A;
    int sum = 0;
    int ans = 0;
    
    cin>>N;
    
    A.resize(N);
    
    
    for(int i = 0; i < N; i++){
        cin>>A[i];
        
        sum += A[i];
        sum %= MOD;
    }
	
    for(int i = 0; i < N; i++){
        
        sum = (sum  + MOD - A[i]%MOD) % MOD;
        ans += sum * A[i] % MOD;
        ans %= MOD;
        
    }
	
    cout<<ans<<endl;
    
	return 0;
}

Measured memory_bytes: 4468
N, W = map(int, input().split())
 
dp = [[0]*(W+1) for _ in range(N+1)]
 
for i in range(1, N+1):
  w, v = map(int, input().split())
  for j in range(1, W+1):
    dp[i][j] = dp[i-1][j]
    if j >= w:
      dp[i][j] = max(dp[i-1][j], dp[i-1][j-w]+v)

print(dp[N][W])

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

string solve(string s) {
    vector<char> was(26);
    for (char c : s) was[c - 'a'] = 1;

    if (s.length() < 26) {
        for (int i = 0; i < 26; i++) {
            if (!was[i]) {
                s += (char)('a' + i);
                return s;
            }
        }
    }
    int n = s.length();
    for (int i = n - 1; i >= 0; i--) {
        for (int c = s[i] - 'a' + 1; c < 26; c++) {
            if (!was[c]) {
                s[i] = 'a' + c;
                s = s.substr(0, i + 1);
                return s;
            }
        }
        was[s[i] - 'a'] = 0;
    }
    return "-1";
}

int main() {
#ifdef HOME
    freopen("in", "r", stdin);
#endif

    string s;
    while (cin >> s) {
        cout << solve(s) << endl;
    }

#ifdef HOME
    cerr << "time: " << clock() * 1.0 / CLOCKS_PER_SEC << endl;
#endif
    return 0;
}


Measured memory_bytes: 764
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;

namespace ABC166
{
    public class Solve
    {
        public static void Main(string[] args)
        {
            new ABC_B();
        }
    }
    public class ABC_A
    {
        public ABC_A()
        {
            var s = Ex.Read;

            var str = s == "ABC" ? "ARC" : "ABC";
            str.Cw();
        }
    }
    public class ABC_B
    {
        public ABC_B()
        {
            var l = Ex.ReadIntArray();
            // N 人のすぬけ君  K 種類のお菓子
            var n = (int)l[0];
            var k = (int)l[1];

            // お菓子を1つも持っていない
            bool[] ans = new bool[n];

            for (int i = 0; i < k; i++)
            {
                var ii = Ex.ReadInt;
                var l2 = Ex.ReadIntArray();
                foreach (var v in l2) ans[v - 1] = true;
            }
            ans.Where(v => !v).Count().Cw();
        }
    }
    public class ABC_C
    {
        public ABC_C()
        {
        }
    }
    public class ABC_D
    {
        public ABC_D()
        {
        }
    }
    public class ABC_E
    {
        public ABC_E()
        {
        }
    }
    public class ABC_F
    {
        public ABC_F()
        {
        }
    }
    public static class Ex
    {
        public static void Cw(this object s) { Console.WriteLine(s); }

        public static List<string> FastSort(this List<string> s) { s.Sort(StringComparer.Ordinal); return s.ToList(); }
        public static string yesno(this bool b) { return b ? "yes" : "no"; }
        public static string YesNo(this bool b) { return b ? "Yes" : "No"; }
        public static string YESNO(this bool b) { return b ? "YES" : "NO"; }

        public static string Read { get { return Console.ReadLine().Trim(); } }
        public static int ReadInt { get { return int.Parse(Read); } }
        public static long ReadLong { get { return long.Parse(Read); } }
        public static double ReadDouble { get { return double.Parse(Read); } }
        public static string[] ReadArray() { return Read.Split(' '); }
        public static int[] ReadIntArray() { return Read.Split(' ').Select(int.Parse).ToArray(); }
        public static long[] ReadLongArray() { return Read.Split(' ').Select(long.Parse).ToArray(); }
        public static string[] ReadArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public static int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public static long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}


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

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

using namespace std;
using lint=long long;

int main(){
	int n; scanf("%d",&n);
	vector<lint> a(n);
	rep(i,n) scanf("%lld",&a[i]);

	vector<int> coef(n-1);
	rep(i,n/2) coef[i]=coef[n-2-i]=2*(i+1);
	coef[n/2-1]--;

	sort(a.begin(),a.end());
	lint res1=0;
	rep(i,n-1) res1+=coef[i]*abs(a[i+1]-a[i]);

	reverse(a.begin(),a.end());
	lint res2=0;
	rep(i,n-1) res2+=coef[i]*abs(a[i+1]-a[i]);

	printf("%lld\n",max(res1,res2));

	return 0;
}


Measured memory_bytes: 1536
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) ((int)(x).size())
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
    int N; cin>>N; N++;
    vint x(N);
    REP(i,N) cin>>x[i];
    sort(ALL(x));

    int g=0;
    REP(i,N-1) g=__gcd(g,x[i+1]-x[i]);
    cout<<g<<endl;
}


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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define copy(from, to) copy(from.begin(), from.end(), back_inserter(to))
#define sort(a) sort(a.begin(), a.end())
#define p(s) cout << (s) << endl

typedef long long ll;
using namespace std;

template<class T>
void load(vector<T> &v, int n) {
  for (int i = 0; i < n; ++i) {
    T t;
    cin >> t;
    v.push_back(t);
  }
}


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

  int c = -1 , f = -1;
  rep(i, s.length()) {
    if (s[i] == 'C') {
      c = i;
    } else if (s[i] == 'F') {
      f = i;
    }
  }
  
  if (c != -1 && f != -1 && c < f) {
    p("Yes");
  } else {
    p("No");
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define printYes() cout << "Yes" << endl;
#define printNo() cout << "No" << endl;
#define printVector(v) rep(i, v.size()) cout << v[i] << endl;

int main()
{
  string S, T, U;
  int A, B;
  cin >> S >> T >> A >> B >> U;
  if (S == U)
    A--;
  else
    B--;
  cout << A << " " << B << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))

using STATE = u32;
vs32 pow3(16);

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

    int n, m;

    vs32 pow3(16);
    pow3[0] = 1;
    rep (i, 16)
    {
        pow3[i + 1] = pow3[i] * 3;
    }

    while (true)
    {
        cin >> n >> m;
        if (n == 0 && m == 0) break;
        STATE state = 0;
        rep (i, 3)
        {
            int num;
            cin >> num;
            rep (j, num)
            {
                int temp;
                cin >> temp;
                --temp;
                state += pow3[temp] * i;
            }
        }

        queue< STATE > q;
        q.push(state);
        int ans = 0;
        bool found = false;
        vector< bool > done(pow3[15] + 100, false);
        while (true)
        {
            int qsize = q.size();
            rep (it, qsize)
            {
                STATE s = q.front(); q.pop();
                if (done[s]) continue;
                done[s] = true;
                if (s == 0 || s == pow3[n] - 1)
                {
                    cout << ans << "\n";
                    found = true;
                    break;
                }
                else if (ans == m)
                {
                    cout << "-1\n";
                    found = true;
                    break;
                }
                s32 top[3] = {-1, -1, -1};
                rep (i, n)
                {
                    int idx = (s / pow3[i]) % 3;
                    top[idx] = i;
                }
                rep (i, 3)
                {
                    if (top[i] != -1)
                    {
                        rep (j, 3)
                        {
                            if (!(j == i + 1 || j == i - 1)) continue;
                            if (top[j] == -1 || top[i] > top[j])
                            {
                                STATE ns{s};
                                ns -= pow3[top[i]] * i;
                                ns += pow3[top[i]] * j;
                                if (!done[ns])
                                {
                                    q.push(ns);
                                }
                            }
                        }
                    }
                }
            }
            if (found) break;
            ++ans;
        }
    }

    return 0;
}



Measured memory_bytes: 4920
// Template from https://techracho.bpsinc.jp/jhonda/2019_08_05/78537

// input macro for competive-programming from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

    ($iter:expr, bytes) => {
        read_value!($iter, String).into_bytes()
    };

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

fn main() {
    use std::io::Read;
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();

    println!("{}", solve(&s));
}

macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
r#"4 3"# => r#"10"#,
r#"10 10"# => r#"76"#,
}


fn solve(src: &str) -> String {
    input! {
        source = src,
        n: usize,
        k: isize,
    }
    let mut ans = 1;

    for _ in 0..n {
        ans = std::cmp::min(ans * 2, ans + k);
    }

    ans.to_string()
}

Measured memory_bytes: 4352
const main = (txt: any): void => {
  const input = txt.split('\n')
  let ans: string = ''
  const [h, w]: number[] = input[0].split(' ').map((i: string) => Number(i))
  for (let i = 1; i <= h * 2; i++) {
    for (let j = 1; j <= w; j++) {
      const index = Math.floor((i + 1) / 2)
      if (i === h * 2 && j === w) {
        ans += input[index].split(' ')[0][j - 1]
      }
      else if (j === w) {
        ans += input[index].split(' ')[0][j - 1] + '\n'
      }
      else {
        ans += input[index].split(' ')[0][j - 1]
      }
    }
  }
  console.log(ans)
}



main(require('fs').readFileSync('/dev/stdin', 'utf8'))

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

int main(){
    int n;
    cin>>n;
    vector<int>v(n);
    vector<int>c(n);
    vector<int>sa(n);
    for(int i=0;i<n;i++){
        cin>>v.at(i);

    }
    for(int i=0;i<n;i++){
        cin>>c.at(i);
        sa.at(i)=v.at(i)-c.at(i);
    }
    int total=0;
    for(int i=0;i<n;i++){
        if(sa.at(i)>0){
            total+=sa.at(i);


        }
    }
    cout<<total<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a,b;
	cin>>a>>b;
	if(a==b)
	{
		cout<<a+b<<endl;
	}
	else
	{
		cout<<max(a,b)+max(a,b)-1<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <memory>
#include <memory.h>
#include <queue>
#include <algorithm>
using namespace std;

typedef pair<int, int> P;
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
bool g[40][40][40][40];
int memo[40][40];

int main(){
  int w, h;
  int can;
  while(cin >> w >> h && (w || h)){
    
    memset(g, false, sizeof(g));
    for(int i = 1; i <= h * 2 - 1; i++){
      if(i % 2 == 1){
	for(int j = 1; j <= w - 1; j++){
	  cin >> can;
	  if(can == 0){
	    g[i/2+1][j][i/2+1][j+1] = true;
	    g[i/2+1][j+1][i/2+1][j] = true;
	  }
	}
	
      }else{
	for(int j = 1; j <= w; j++){
	  cin >> can;
	  if(can == 0){
	    g[i/2][j][i/2+1][j] = true;
	    g[i/2+1][j][i/2][j] = true;
	  }
	}
      }
    }
  
    memset(memo, -1, sizeof(memo));
    memo[1][1] = 1;
    queue<P> que;
    que.push(P(1, 1));
    while(!que.empty()){
      P p = que.front();
      que.pop();
      int y = p.first;
      int x = p.second;
      for(int i = 0; i < 4; i++){
	int y2 = y + dy[i];
	int x2 = x + dx[i];
	if(g[y][x][y2][x2] && memo[y2][x2] == -1){
	 
	  memo[y2][x2] = memo[y][x] + 1;
	  que.push(P(y2, x2));
	}
      }
    }
    int res = memo[h][w];
    if(res == -1) cout << 0 << endl;
    else cout << res << endl;
  }
  return 0;
}

Measured memory_bytes: 3416
N = int(input())
T, A = [int(s) for s in input().split(" ")]
H_list = [int(s) for s in input().split(" ")]

temps = [T-0.006*H for H in H_list]

dfs = []
for t in temps:
  df = abs(t-A)
  dfs.append(df)

print(dfs.index(min(dfs))+1)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
typedef long long int ll;
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define MOD 1000000007
#define INF 93193111451418101
#define MIN -93193111451418101
#define EPS 1e-11
using namespace std;

int main() {
  ll n;
  cin >> n;
  vector<ll> v;
  REP(i, n) {
    ll a;
    cin >> a;
    v.pb(a);
  }
  sort(v.begin(), v.end(), greater<ll>());
  ll a = 0, b = 0;
  REP(i, v.size()) {
    if (i % 2 == 0) {
      a += v[i];
    } else {
      b += v[i];
    }
  }
  cout << a - b << endl;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
)

func main() {
	var a, b, k int
	fmt.Scan(&a, &b, &k)

	min := int(math.Min(float64(a), float64(b)))
	var numbers = []int{}
	for i := min; i >= 1; i-- {
		if a%i == 0 && b%i == 0 {
			numbers = append(numbers, i)
		}
	}

	fmt.Println(numbers[k-1])
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string s = {};
    cin >> s;
    if (s[0] == s[1])
    {
        cout << "Bad" << endl;
    }
    else if (s[1] == s[2])
    {
        cout << "Bad" << endl;
    }
    else if (s[2] == s[3])
    {
        cout << "Bad" << endl;
    }
    else
    {
        cout << "Good" << endl;
    }
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int counter = 0;
		int len = (int)(Math.log10(n));
		while(n!=0) {
			int mod = (int)Math.pow(10, len);
			if((n-(n%mod))/mod == 2) {
				counter++;
			}
			len--;
			n = n%mod;
		}
		System.out.println(counter);
	}
}


Measured memory_bytes: 25172
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <set>
#include <map>
#include <unordered_map>
#include <complex>
#include <iomanip>
#include <cmath>
#include <tuple>
using namespace std;

long long const MOD = 1000000007LL;

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

    int a[n], b[n], c[n];
    for (int i = 0; i < n; i++) cin >> a[i] >> b[i] >> c[i];

    // 0: A　海で泳ぐ→幸福度 a_i
    // 1: B　虫取り→幸福度 b_i
    // 2: C　宿題→幸福度 c_i
    long dp[n + 1][3];

    // 初期化。
    for (int i = 0; i <= n; i++) {
        for (int j = 0; j < 3; j++) dp[i][j] = 0;
    }
    dp[1][0] = a[0];
    dp[1][1] = b[0];
    dp[1][2] = c[0];

    for (int i = 2; i <= n; i++) {
        dp[i][0] += max(dp[i - 1][1] + a[i - 1], dp[i - 1][2] + a[i - 1]);
        dp[i][1] += max(dp[i - 1][0] + b[i - 1], dp[i - 1][2] + b[i - 1]);
        dp[i][2] += max(dp[i - 1][0] + c[i - 1], dp[i - 1][1] + c[i - 1]);
    }

    long res = max(dp[n][0], max(dp[n][1], dp[n][2]));

    cout << res << endl;
}


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

#define int long long
#define xxx int32_t
#define fuck_u return 0;

xxx main() {
    int n, w;
    scanf("%lld%lld", &n, &w);
    int dp[w+1] = {0};
    for(int item=0; item<n; ++item) {
		int weight, value;
		scanf("%lld%lld", &weight, &value);
		for (int w1=w-weight; w1>=0; --w1) {
		//for (int w1=0; w1<=w-weight; ++w1) {	
			//if(w1 != weight)
			dp[w1+weight] = max(dp[w1+weight], dp[w1]+value);
		}
	}
	int maximum = 0;
	for(int i=0; i<w+1; ++i)
		maximum = max(maximum, dp[i]);
    printf("%lld", maximum);
	fuck_u
}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define PI 2*acos(0)
#define INF 1e17
#define mx 998244353
using namespace std;
ll int mod(ll int a,ll int b)
{
    ll int m=a%b;
    if(m<0) m=(b<0)?(m-b):(m+b);
    return m;
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll int n,x,y,i,j,sum;
    cin>>n;
    sum=0;
    for(x=1;x<=n;x++){
        y=n/x;
        sum+=((y*(y+1))/2)*x;
    }
    cout<<sum;
    return 0;
}


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

int a, b, c, d, e;

int main() {
    cin >> a >> b >> c;
    if (a < b) {
        if (a < c) d = 1;
        else d = 3;
    }
    else if (b < c) d = 2;
    else d = 3;
    if (d == 1) {
        cout << a << " ";
        if (b < c) cout << b << " " << c << endl;
        else cout << c << " " << b << endl;
    }
    if (d == 2) {
        cout << b << " ";
        if (a < c) cout << a << " " << c << endl;
        else cout << c << " " << a << endl;
    }
    if (d == 3) {
        cout << c << " ";
        if (a < b) cout << a << " " << b << endl;
        else cout << b << " " << a << endl;
    }
}


Measured memory_bytes: 3084
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;

#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define ldb ldouble

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 16;
const ll MOD = 998244353;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;
#define szz(x) (int)(x).size()
#define rep(i, n) for(int i=0;i<n;i++)
#define Se second
#define Fi first

vector <int> in[8];
bool dchk[26];

char u[4050];
vector<int> readvec() {
	scanf("%s", u);
	vector <int> rv;
	for (int i = 0; u[i] != 0; i++) rv.push_back(u[i] - '0');
	reverse(all(rv));
	return rv;
}

bool cmp(vector<int> &a, vector<int> &b) {
	if (a.size() != b.size()) return a.size() < b.size();
	for (int i = a.size() - 1; i >= 0; i--) if (a[i] != b[i]) return a[i] < b[i];
	return false;
}
int main() {
	int N, i, j;
	scanf("%d", &N);
	for (i = 0; i <= N; i++) in[i] = readvec();
	

	while(1) {
		int c = 0;
		int mx = 7;
		for (j = 1; j <= N; j++) {
			if (dchk[j]) continue;
			c++;
			if (cmp(in[mx], in[j])) mx = j;
		}
		if (c == 1) {
			swap(in[1], in[mx]);
			break;
		}
		int t;
		for (j = 1; j <= N; j++) {
			if (dchk[j] || j == mx) continue;
			t = j;
		}

		int L1 = in[mx].size(), L2 = in[t].size();
		for (i = 0; i < L2; i++) in[mx][i + L1 - L2] ^= in[t][i];
		while (!in[mx].empty() && !in[mx].back()) in[mx].pop_back();
		if (in[mx].empty()) {
			dchk[mx] = true;
			continue;
		}
		for (i = 1; i <= N; i++) {
			if (dchk[i] || i == mx) continue;
			if (in[i] == in[mx]) dchk[mx] = true;
		}
	}
	
	ll ans = 0;
	int L1 = in[0].size(), L2 = in[1].size();
	for (i = L1 - 1; i >= L2 - 1; i--) ans = (ans * 2 + in[0][i]) % MOD;
	
	in[2].resize(L1);
	for (i = 0; i < L1; i++) in[2][i] = 0;
	for (i = L1 - 1; i >= L2 - 1; i--) {
		if (in[0][i] != in[2][i]) {
			int t = i - (L2 - 1);
			for (j = L2 - 1; j >= 0; j--) in[2][t + j] ^= in[1][j];
		}
	}
	
	bool chk = true;
	for (i = L2 - 2; i >= 0; i--) {
		if (in[0][i] == in[2][i]) continue;
		if (in[0][i] < in[2][i]) chk = false;
		break;
	}
	if (chk) ans = (ans + 1) % MOD;
	return !printf("%lld\n", ans);
}

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

int main()
{
    int n = 0;
    cin >> n;
    vector<long long> length(n);

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

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

    int ans = 0;
    for (int i = 0; i < n - 2; i++)
    {
        for(int k = i + 1; k < n - 1; k++)
        {
            for (int l = k + 1; l < n; l++)
            {
                if (length[i] == length[k] || length[k] == length[l] || length[i]== length[l])
                {
                    continue;
                }
                if (length[i] + length[k] > length[l])
                {
                    ans++;
                }
            }
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
int n,k,ans,tot;
int a[100005],b[100005];
struct Edge{
    int x,next;
}e[200005];
inline void pp(int x,int y){
    e[++tot].x=y;
    e[tot].next=a[x];
	a[x]=tot;
}
int dfs(int x,int deep){
    int ret=deep;
    for(int i=a[x];i;i=e[i].next)
        ret=max(ret,dfs(e[i].x,deep+1));
    if(b[x]!=1&&ret-deep==k-1)return ans++,0;
    else return ret;
}

int main(){
	int i;
    cin>>n>>k;
    for(i=1;i<=n;i++)scanf("%d",b+i);
    if(b[1]!=1)ans=b[1]=1;
    for(i=2;i<=n;i++)pp(b[i],i);
    dfs(1,0);
	cout<<ans;
	return 0;
}

Measured memory_bytes: 6528
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(x)(x).begin(), (x).end() // 昇順ソート
#define rall(v)(v).rbegin(), (v).rend() // 降順ソート
#define INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair < ll, ll >
#define F first
#define S second
const int MOD = 1000000007;
template < class T > bool chmax(T & a,const T & b) { if (a < b) { a = b; return true; } return false; }
template < class T > bool chmin(T & a,const T & b) { if (a > b) { a = b; return true; } return false; }
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

int main() {
    int N,X;cin >> N >> X;
    vector<int> L(N);rep(i,N)cin >> L[i];
    vector<LL> rui(N+1);
    rep(i,N){
        rui[i+1] = rui[i] + L[i];
    }

    LL ans = 0;
    rep(i,N)if(rui[i+1] <= X)ans++;
    cout << ans+1 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stdio.h>
#include <list>
#include <numeric>
#include <stack>
#include <queue>
#include <tuple>
#include <bitset>
#include <map>
#include <math.h>
//ceil(a/b)   (a + (b - 1))/ b
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
typedef long long ll;
typedef pair<int,int> P;
const int inf=1000000007;
const ll mod=1000000007;
const double PI=3.14159265358979323846;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};

ll gcd(ll a, ll b){
  if (b==0) return a;
  else return gcd(b,a%b);
}

int cans(bool f){
  if(f) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}





int main(){
  int N,K;
  cin >> N >> K;
  int p[N];
  rep(i,N){
	cin >> p[i];
  }

  sort(p,p+N);
  int ans = 0;
  rep(i,K) ans += p[i];
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3184
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
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;}
int const INF = 1001001001;


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

int N,T;
cin >> N >> T;
vi A(N);
rep(i,N) cin >> A[i];

vi s(N+1, INF);
rep(i,N) s[i+1] = min(s[i],A[i]);

int M = 0;
rrep(i,N-1) {
    chmax(M, A[i] - s[i]);
}
int cnt = 0;
rrep(i,N-1) {
    if(A[i] - s[i] == M) cnt++;
}
cout << cnt << endl;
return 0;
}

Measured memory_bytes: 1024
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <fstream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functional>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
using namespace std;
#define ll           long long
#define all(v)       (v).begin() , (v).end()
#define vi           vector <ll>
#define vii          vector <pair<ll,ll>>
#define ii           pair<ll,ll>
#define sz(v)	     ((int)((v).size()))
#define lp(i,a,b)    for(int i=a;i<b;i++)
#define pb           push_back
#define pf           push_front
#define F            first
#define S            second
#define endl         "\n"
#define IOS          ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const double PI = 3.14159265358979323846;
const ll inf=2e9,MOD=998244353,MAX=1e7+2;

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    IOS;
    int n;
    cin>>n;
    map<ll,int>mp;
    mp[n]=1;
    int cnt=1;
    while(mp[n]!=2){
        cnt++;
        n=(n%2==0?n/2:3*n+1);
        mp[n]++;
    }
    cout<<cnt;

}

Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define all(x) (x).begin(),(x).end()

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

typedef long long ll;

using namespace std;

template <class Abel>
class BIT
{
public:
  using F=function<Abel(Abel,Abel)>;
  F f;
  ll l;
  vector<Abel> bit;
  Abel m0;
  BIT(ll maxidx,F fu,Abel m0):f(fu),l(maxidx),m0(m0)
  {
    bit.assign(l,m0);
  }
  void update(ll idx,ll val)
  {
    while(idx<=l)
    {
      bit[idx]=f(bit[idx],val);
      idx+=idx & -idx;
    }
  }
  ll query(ll idx)
  {
    ll res=m0;
    while(idx>0)
    {
      res=f(bit[idx],res);
      idx-=idx& -idx;
    }
    return res;
  }
};
ll mod=1e9+7;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;cin>>n;
  vector<ll> s(n);
  rep(i,n)cin>>s[i];
  s.erase(unique(all(s)),s.end());
  //rep(i,s.size())cout<<s[i];
  ll l=s.size();
  map<ll,vector<ll>> cidx;
  vector<ll>tv;
  rep(i,l)
  {
    if(cidx.count(s[i])==0)
    {
      cidx[s[i]]=tv;
    }
    cidx[s[i]].push_back(i);
  }
  BIT<ll>bt(200100,[](ll a,ll b){return (a+b)%mod;},0);

  rep(i,l)
  {
    //cout<<i<<" "<<s[i]<<" ";
    ll tsum=bt.query(i+1);

    //cout<<tsum<<endl;
    ll nidx=upper_bound(all(cidx[s[i]]),i)-cidx[s[i]].begin();
    if(nidx==cidx[s[i]].size())continue;
    bt.update(cidx[s[i]][nidx]+1,(tsum+1));
    //cout<<tsum<<endl;

  }
  cout<<(bt.query(200010)+1)%mod<<endl;



  return 0;

}


Measured memory_bytes: 25216
#include <iostream>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <complex>
using namespace std;

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

const int INF = 1e9;
int dx4[4]={1,0,-1,0};
int dy4[4]={0,1,0,-1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

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

int N, A[100002];

int main() {
  cin >> N;
  int a;
  ll sum;
  A[0] = 0;
  A[N + 1] = 0;
  for(int i=1; i<=N; i++) {
    cin >> a;
    A[i] = a;
    sum += abs(A[i] - A[i - 1]);
  }
  sum += abs(A[N]);

  int b, c, d;
  for(int i=1; i<=N; i++) {
    ll ans = sum;
    a = A[i - 1]; b = A[i]; c = A[i + 1];
    if(a < b && c < b || b < a && b < c) {
      ans -= abs(a - b) + abs(b - c);
      ans += abs(a - c);
    }

    cout << ans << endl;
  }
}


Measured memory_bytes: 1664
get_number(Number) :-
    get_string(String),
    number_string(Number, String).

get_number(A, B) :-
    get_number(A),
    get_number(B).

get_number(A, B, C) :-
    get_number(A, B),
    get_number(C).

get_string(String) :-
    current_input(Input),
    read_string(Input, ' \n', '', _, String).

/* memo
    code(int)
    string_code(1, S, C), (C: code)
    char_code(X, Y) (X: char, Y: code)
    string_chars(S, S2) (S: string, S2: [char])
    to_lower(C, C2) (C: char? C2: code?)

    f(0, [], []).
    f(Z, [X|Xs], [Y|Ys]) :- X = Y, f(Z1, Xs, Ys), Z is Z1 + 1.
    f(Z, [_|Xs], [_|Ys]) :- f(Z, Xs, Ys).

    match: =, \=

    numeric: <,=<, >, >= (eval)
    lexicographically: @<. @=<, @>, @>=
    value?: =:=, =\= (eval)
    identical: ==, \==
*/

f(S, A, B, C) :- 
    string_code(1, A, C1),
    string_code(2, B, C2),
    string_code(3, C, C3),
    S = [C1,C2,C3].

main :-
    get_string(A),
    get_string(B),
    get_string(C),
    string_codes(A, A2),
    string_codes(B, B2),
    string_codes(C, C2),
    f(X, A2, B2, C2),
    string_codes(Y, X),
    writeln(Y). 


Measured memory_bytes: 7944
#include<bits/stdc++.h>
using namespace std;
#define ll unsigned long long int
int main(){
string s;cin>>s;
ll k;cin>>k;
int i=0;
int c=0;
for( i=0;i<s.size();i++){
	if(s[i]=='1'){
		if(k==1){cout<<1;break;}
		else k--;
	}
	else {cout<<s[i];break;}
	
}
 
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;
int main() {
	int N, K;
	string S;

	cin >> N >> K;
	cin >> S;

	K -= 1;
	if (S[K] == 'A')	S[K] = 'a';
	if (S[K] == 'B')	S[K] = 'b';
	if (S[K] == 'C')	S[K] = 'c';

	cout << S;

}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std; 
void constructXOR(int A[], int n) 
{ 
	int XOR = 0; 
	for (int i = 0; i < n; i++) 
		XOR ^= A[i]; 
	for (int i = 0; i < n; i++) 
		A[i] = XOR ^ A[i]; 
} 

int main() 
{
	int t,i;
	cin>>t;
	int A[t];
	for(i=0;i<t;i++)
	{
		cin>>A[i];
	}
	int n = sizeof(A) / sizeof(A[0]); 
	constructXOR(A, n); 
	for (int i = 0; i < n; i++) 
		cout << A[i] << " "; 
	return 0; 
} 


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

int main() {

    int A1, A2, A3;
    cin >> A1 >> A2 >> A3;
    if (A1 + A2 + A3 >= 22) {
        cout << "bust\n";
    } else {
        cout << "win\n";
    }

}


Measured memory_bytes: 256
N, K = map(int, input().split())
A = list(map(int, input().split()))

for i in range(K):
    B = [0] * N
    for j in range(N):
        l = max(0,j-A[j])
        r = j+A[j]+1
        B[l] += 1
        if r < N:
            B[r] -= 1
    for j in range(1, N):
        B[j] += B[j-1]

    A = B

    if sum(A) == N**2:
        break

print(*A)

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

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

fn gcd(x: usize, y: usize) -> usize {
    if x > y {
        gcd(y, x)
    } else if y % x == 0 {
        x
    } else {
        gcd(y % x, x)
    }
}

fn main() {
    input! {
        n: usize,
        mut x: [usize; n],
    }

let mut ans = x[0];
    for &i in x[1..n].iter() {
        ans = gcd(ans, i);
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
from collections import Counter

n = int(input())
p = [int(input()) for _ in range(n)]

lst = [-1] * (n + 1)
for num in p:
    bfo = lst[num - 1]
    if bfo == -1:
        lst[num] = num
    elif bfo > 0:
        lst[num] = bfo
cnt = Counter(lst).values()
print(n - max(cnt))


Measured memory_bytes: 120720
while 1:
	n = input()
	if n == 0:break
	D = range(1,7)
	ans = 1
	for i in range(n):
		c = raw_input()[0]
		if c == "N":
			D = [D[1],D[5],D[2],D[3],D[0],D[4]]
		elif c == "S":
			D = [D[4],D[0],D[2],D[3],D[5],D[1]]
		elif c == "E":
			D = [D[3],D[1],D[0],D[5],D[4],D[2]]
		elif c == "W":
			D = [D[2],D[1],D[5],D[0],D[4],D[3]]
		elif c == "R":
			D = [D[0],D[2],D[4],D[1],D[3],D[5]]
		elif c == "L":
			D = [D[0],D[3],D[1],D[4],D[2],D[5]]
		ans += D[0]
	print ans

Measured memory_bytes: 4396
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<(int)(n);i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

int main(){
    int s;
    cin >> s;
    const string ai = "ai";

    int t = s / 100;

    cout << ai << 1333;
    rep(i,t) cout << 3;
    cout << endl;
}


Measured memory_bytes: 3220
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<climits>
#include<set>
#include<utility>
#include<typeinfo>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef set<int> S;
#define rep(i, n) for(int i=0; i<n; i++)
const ll MOD=1e9+7;

int main(){

	int n, k, a[100000];
	cin >> n >> k;
	for(int i=0; i<n; i++){
		cin >> a[i];
	}
	int ans=MOD;
	for(int i=0; i<n; i++){
		if(n==k+i-1){
			break;
		}
		if(a[i]<0 && a[k+i-1]>=0){
			ans=min(ans, min(abs(a[i]), abs(a[k+i-1]))*2+max(abs(a[i]), abs(a[k+i-1])));
		} else if(a[i]<=0 && a[k+i-1]<=0){
			ans=min(ans, abs(a[i]));
		} else if(a[i]>=0 && a[k+i-1]>=0){
			ans=min(ans, abs(a[k+i-1]));
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <deque>
#include <set>
#include <iomanip>
#include <utility>
#define ll long long
#define ld long double
using namespace std;

ll C[200010], mod=1000000007;

int main() {
	int N;
	cin >> N;
	for(int i=0; i<N; ++i) cin >> C[i];
	sort(C, C+N, greater<int>());
	ll bs=1, ans=0;
	for(int i=0; i<N-1; ++i) bs=(bs*2)%mod;
	ll now=(bs*2)%mod;
	for(int i=0; i<N; ++i){
		ans=(ans+(now*C[i])%mod)%mod;
		now=(now+bs)%mod;
	}
	ans=(ans*bs)%mod;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1792
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 0; i < (int)c; i++)
#define all(v) v.begin(), v.end()
const int inf = 1000000000; //10^9
using ll = long long;
using P = pair<int, int>;
//加算代入演算子は+=！！！！！

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

    vector<P> p(m);
    rep(i, m) cin >> p[i].first >> p[i].second;

    rep(x, 1000)
    {                             //以下、例えばx=702の時、d配列に207を入れる処理
        int keta = 1;
        int nx = x / 10;          //最初の桁は初期化で入れてる
        vector<int> d(1, x % 10); //配列作成時に1桁目を入れる
        while (nx)
        {
            keta++;
            d.push_back(nx % 10); //2桁目から追加してく
            nx /= 10;
        }
        reverse(d.begin(), d.end()); //配列dを逆順にする
        if (keta != n) continue; //xの桁がn桁に満たさない場合は継続しない
        bool ok = true;
        rep(i, m)
        {
            if (d[p[i].first - 1] != p[i].second) { //ketaを計測してないとエラーになる
                ok = false; //ex. 7,2,7とd配列を比較。違ったらfalseになる
            }
        }
        if (ok)
        {
            cout << x << endl; //条件を通過したxを出力
            return 0;
        }
    }
    cout << -1 << endl; //それ以外は-1
    return 0;
}

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


int main(){
	unsigned long long int phi;
	unsigned long long int n;
	unsigned long long int i;
	
	cin >> n;
	phi = n;
	
	i=2;
	while(i<=n){
		if(n%i==0){
			n = n/i;
			phi = phi * (i-1) / i;
			
			while(n%i==0){
				n=n/i;
			}
			
		}
		++i;
	}
	
	cout << phi << endl;
	
	return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <set>
#include <algorithm>
#include <utility>
#define INF (1e+9)
#define debug(x) cerr << #x << ": " << x << "\n";
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int MAX_N = (int)2e5;

template <size_t N>
class unionFindTree{
	private:
		int par[N];
		int rank[N];
		int united[N];
	public:
		unionFindTree(){
			for(int i = 0; i < (int) N; i++){
				par[i] = i; rank[i] = 0; united[i] = 1;
			}
		}
		void init(){
			for(int i = 0; i < (int) N; i++){
				par[i] = i; rank[i] = 0; united[i] = 1;
			}
		}
		int find(int x){
			if(par[x] == x) return x;
			else return par[x] = find(par[x]);
		}
		void unite(int x, int y){
			x = find(x); y = find(y);
			if(x == y) return;

			if(rank[x] < rank[y]){
				par[x] = y;
				united[y] += united[x];
			}else{
				par[y] = x;
				united[x] += united[y];
				if(rank[x] == rank[y]) rank[x]++;
			}
		}
		bool same(int x, int y){
			return find(x) == find(y);
		}
		int count(int x){
			return united[find(x)];
		}
};


int main(void){
	unionFindTree<MAX_N> uf1, uf2;
	int N, K, L; cin >> N >> K >> L;

	for(int i = 0; i < K; i++){
		int p, q; cin >> p >> q;
		uf1.unite(--p, --q);
	}
	for(int i = 0; i < L; i++){
		int p, q; cin >> p >> q;
		uf2.unite(--p, --q);
	}

	multiset<P> st;
	P ls[N];
	for(int i = 0; i < N; i++) ls[i] = make_pair(uf1.find(i), uf2.find(i));
	// for(int i = 0; i < N; i++) st.insert(ls[i]);
	// for(int i = 0; i < N-1; i++) cout << st.count(ls[i]) << ' ';
	// cout << st.count(ls[N-1]) << '\n';

	sort(ls, ls+N);
	for(int i = 0; i < N; i++){
		cout << upper_bound(ls, ls+N, make_pair(uf1.find(i), uf2.find(i))) - lower_bound(ls, ls+N, make_pair(uf1.find(i), uf2.find(i)));
		if(i != N-1) cout << ' ';
		else cout << '\n';
	}

	return 0;
}


Measured memory_bytes: 6912
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <stack>
#include <cctype>
#include <queue>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <climits>
#define lson rt<<1,l,mid
#define rson rt<<1|1,mid+1,r
#define fi first
#define se second
#define ping(x,y) ((x-y)*(x-y))
#define mst(x,y) memset(x,y,sizeof(x))
#define mcp(x,y) memcpy(x,y,sizeof(y))
using namespace std;
#define gamma 0.5772156649015328606065120
#define MOD 924844033
#define inf 0x3f3f3f3f
#define N 100005
#define maxn 50005
typedef pair<int,int> PII;
typedef long long LL;
LL read(){
    LL 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<<3)+(x<<1)+ch-'0';ch=getchar();}
    return x*f;
}
int n,m;
multiset<int>S;
int main(){
    //freopen("in.txt","r",stdin);
    int i,j,group,x,y,v,Case=0;
    n=read();
    int len=0;
    for(i=1;i<=n;++i){
        x=read();
        S.insert(x);
        len=max(len,x);
    }
    int ans=inf;
    for(i=0;i<=len;++i){
        int temp=max(i,len-i);
        if(S.find(temp)==S.end())return 0*printf("Impossible\n");
        S.erase(S.find(temp));
        ans=min(ans,temp);
    }
    if(!S.empty()&&(*S.begin())<=ans)return 0*printf("Impossible\n");
    printf("Possible\n");
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;
using ll = long long;

int main()
{
  int N, K; string S; cin >> N >> S >> K;
  K--;

  for (int i = 0; i < N; ++i) {
    if (S[K] != S[i]) {
      S[i] = '*';
    }
  }

  cout << S << endl;
}

Measured memory_bytes: 256