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

#define int long long
#define pb push_back 
#define pf push_front 
#define mp make_pair
#define fr first
#define sc second
#define Rep(i, n) for ( int i = 0 ; i < (n); i++ )
#define All(v) v.begin(), v.end()

typedef pair<int, int> Pii; typedef pair<int, Pii> Pip;
const int INF = 1107110711071107;

signed main() {
  int n;
  while ( cin >> n, n ) {
    char c[101];
    int cnt[26] = {0};
    Rep(i, n) cin >> c[i];
    if ( n == 1 ) {
      cout << c[0] << " " << 1 << endl;
      continue;  
    }
    int ans = -1;
    char ansc;
    Rep(i, n) {
      cnt[c[i] - 'A']++;
      vector<Pii> tmp(26);
      Rep(j, 26) tmp[j] = Pii(cnt[j], j);
      sort(tmp.begin(), tmp.end(), greater<Pii>());      
      if ( tmp[0].fr - tmp[1].fr > (n-1 - i) && ans < 0 ) {
	ans = i;
	ansc = (char)('A'+tmp[0].sc);
      }
    }

    if ( ans < 0 ) cout << "TIE" << endl;
    else cout << ansc << " " << ans+1 << endl;
  }
}

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

using std::vector;
using std::pair;
using Pair = pair<int, int>;

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

  int N{}, M{};
  std::cin
    >> N
    >> M;

  vector<Pair> city(M);
  for(auto& c : city)
  {
    std::cin
      >> c.first
      >> c.second;
    --c.first;
  }

  vector<vector<Pair>> state(N);
  for(size_t index = 0; index < city.size(); ++index)
  {
    auto& p = city[index];
    state[p.first].push_back( Pair{p.second, index} );
  }

  for(auto& list : state)
  {
    std::sort(
      list.begin(),
      list.end(),
      std::less<Pair>());
  }

  vector<Pair> res(M);
  for(size_t state_i = 0; state_i < state.size(); ++state_i)
  {
    for(size_t x_i = 0; x_i < state[state_i].size(); ++x_i)
    {
      auto city_i = state[state_i][x_i].second;
      res[city_i] = { state_i + 1, x_i + 1};
    }
  }

  std::cout << std::setfill('0');
  for(const auto& ans : res)
  {
    std::cout
      << std::setw(6) << ans.first
      << std::setw(6) << ans.second
      << '\n';
  }
  std::cout
    << std::setfill(' ')
    << std::flush;

  return 0;
}


Measured memory_bytes: 8576
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
ld sum = 0;
int n; ld d, x;
ld p[400010];
int main() {
	cin >> n >> d >> x;
	rep(i, 2 * n) {
		sum += d; d += x;
	}
	rep1(i, n) {
		p[i] = 1.0 / (2.0*i) + 1 / (ld)i*p[i - 1] * ((i - 1) / (ld)i) + ((i - 1) / (ld)i)*p[i - 1];
	}
	cout << fixed << setprecision(10);
	cout << p[n] * sum << endl;
	return 0;
}


Measured memory_bytes: 4352
#include<iostream>
#include<string>
using namespace std;
int main(){
  int d[3]={};
  d[0]=1;
  string s;
  while(cin>>s){
    swap(d[s[0]-'A'],d[s[2]-'A']);
  }
  for(int i=0;i<3;i++) if(d[i]) cout << (char)('A'+i) << endl;
  return 0;
}

Measured memory_bytes: 1172
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll n,a,b;
	cin>>n>>a>>b;
	ll ans=0;
	ll c[100010];
	for(ll i=0;i<n;i++){
		cin>>c[i];
	}
	for(ll i=1;i<n;i++){
		ll now=c[i]-c[i-1];
		now*=a;
		if(now<b){
			ans+=now;
		}
		else{
			ans+=b;
		}
	}
	cout <<ans;
	// your code goes here
	return 0;
}

Measured memory_bytes: 1024
# -*- coding:utf-8 -*-

def solve():
    N, M = list(map(int, input().split()))
    X = list(map(int, input().split()))

    X.sort()
    diffs = []
    for i in range(len(X)-1):
        diffs.append(abs(X[i]-X[i+1]))
    
    diffs.sort()

    ans = 0
    for i in range(len(diffs) - (N-1)):
        ans += diffs[i]
    
    print(ans)

if __name__ == "__main__":
    solve()

Measured memory_bytes: 13960
use std::io;
use std::collections::HashMap;
use std::ops::{Deref, DerefMut};

fn main() {
    let mut buffer = String::new();
    io::stdin().read_line(&mut buffer).unwrap();
    buffer.clear();
    io::stdin().read_line(&mut buffer).unwrap();
    let mut xs: CountedData = CountedData(
        buffer
        .split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect()
    );
    
    xs.sort();
    let mut counter = HashMap::new();
    while !xs.is_empty() {
        let (key, c) = xs.count_and_drain();
        counter.insert(key, c);
    }

    let m: i32 = counter.keys().map(
        |key| {
            [-1, 0, 1]
                .iter()
                .map(|x| {
                    match counter.get(&(key + x)) {
                        None => 0,
                        Some(i) => *i,
                    }
                })
                .sum()
        }).max().unwrap();
    
    println!("{}", m);
}

struct CountedData(Vec<i32>);

impl CountedData {
    fn count_and_drain(&mut self) -> (i32, i32) {
        let key = self.0[0].clone();
        let cnt = self.0.iter()
            .take_while(|&&x| x == key)
            .count();
        self.0.drain(..cnt);
        (key, cnt as i32)        
    }
}

impl Deref for CountedData {
    type Target = Vec<i32>;

    fn deref(&self) -> &Vec<i32> {
        &self.0
    }
}

impl DerefMut for CountedData {
    fn deref_mut(&mut self) -> &mut Vec<i32> {
        &mut self.0
    }
}

Measured memory_bytes: 10492
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <array>
#include <cmath>
#include <queue>
#include <stack>
#include <numeric>

using namespace std;

int main() {
	int n, cnt = 0;
	cin >> n;
	vector<int>a(n);
	for (int i = 0; i < n; i++)cin >> a[i];
	for (int i = 0; i < a.size(); i++) {
		if (a[i] % 2 != 0 && i % 2 == 0) {
			cnt++;
		}
	}
	cout << cnt;
}


Measured memory_bytes: 3564
a[9],x,i,c,d,e;main(f){for(;++i>8?i<13?e=a[i-8],f=a[i-4],e-f?x&1<<e&&++d,x&1<<f&&++d,x|=1<<e|1<<f:++c:(c=d=x=i=!printf("%d %d\n",c,d),1):~scanf("%d",a+i););}

Measured memory_bytes: 0
#![allow(non_snake_case)]

fn main() {
    let line = {
        let mut line = String::new();
        for _ in 0..160 {
            line.push_str("#.")
        }
        line
    };
    loop {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        let mut iter = buf.split_whitespace();
        let H : usize = iter.next().unwrap().parse().unwrap();
        let W : usize = iter.next().unwrap().parse().unwrap();

        if H == 0 && W == 0 {break;}

        for n in 0..H {
            println!("{}", &line[n % 2..n % 2 + W]);
        }
        println!();
    }
}



Measured memory_bytes: 5028
from functools import reduce
import math

def main():
    # 文字列の2進数を数値にする
    # '101' → '5'
    # 文字列の頭に'0b'をつけてint()にわたす
    # binary = int('0b'+'101',0)

    # 2進数で立っているbitを数える
    # 101(0x5) → 2
    # cnt_bit = bin(5).count('1')
    
    # N! を求める
    # f = math.factorial(N)

    # N の逆元
    # N_inv = pow(N,MOD-2,MOD)

    # nCr
    # Nの階乗 * rの階乗の逆元 * n-rの階乗の逆元
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    INF = float("inf")

    # 大きな素数
    MOD = 10**9+7
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    a = int(input())
    if a %2 ==1:        
        print((a//2) *(a//2 +1))
    else:
        print((a//2) * (a//2))
    
if __name__ == '__main__':
    main()


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

class calc{
  string s;
  string::iterator it;
public:
  calc(string str){
    s = str;
    it = str.begin();
  }

  int fact(){
    if(*it == '('){
      *it++;
      int ret = exp();
      *it++;
      return ret;
    } else {
      int ret = 0;
      while('0' <= *it && *it <= '9'){
	ret *= 10;
	ret += *it-'0';
	++it;
      }
      return ret; 
    }
}

  int turm(){
    int ret = fact();
    while(*it == '*' || *it == '/'){
      if(*it == '*'){
	*it++;
	ret *= fact();
 
      } else if(*it == '/'){
	*it++;
	ret /= fact(); 
      }
    }
    return ret;
  }
  int exp(){
    int ret = turm();
    while(*it == '+' || *it == '-'){
      if(*it == '+'){
	*it++;
	ret += turm();
 
      } else if(*it == '-'){
	*it++;
	ret -= turm(); 
      }
    }
    return ret;
  }
};

int main(){
  int n;
  cin >> n;
  while(n--){
    string str;
    cin >> str;
    calc ans(str);
    cout << ans.exp() << endl;
  }
  return 0;
}

Measured memory_bytes: 1216
N = int(input())
W = list(map(int, input().split()))
min = 9999999
for i in range(N):
  S1 = S2 = 0
  for j in range(N):
    if j <= i :
      S1 += W[j]
    else :
      S2 += W[j]
  if abs(S1-S2) < min :
    min = abs(S1-S2)
print(min)

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

int main()
{
  int n;
  cin>>n;
  int a,b,q=0,c=0;
  for(int i=0;i<n;i++)
  {
      cin>>a>>b;
      if(a==b) c++;
      else c=0;
      if(c==3) q=10;
  }
  if(q==10) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;

return 0;
}


Measured memory_bytes: 3628
#include <stdio.h>
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <math.h>
#include <ctype.h>
using namespace std;
int n,k;
long long int x[100001];
long long int xp[100001];
long long int xm[100001];
long long int zp = 0;
int m=0,p=0;
int main(void)
{
    cin >> n >> k;
    for(int i=0; i<n; i++){
        cin >> x[i];
        if(x[i] >= 0){
            p++;
            xp[p] = x[i];
        }else{
            m++;
            xm[m] = x[i];
        }
    }

    long long int res = 9000000000;
    for(int i = 0; i <= k; i++)
    {
        if(k-i > m || i > p){continue;}
        if(xp[i] <= -xm[m+1-(k-i)]){ 
            res = min(res, xp[i] * 2 - xm[m-(k - i)+1]);
        }else{
            res = min(res, xp[i] - xm[m+1 - (k - i)] * 2);
        }

    }
    
    cout << res;
    
    return 0;
}

Measured memory_bytes: 1792
#include<stdio.h>
int main(void)
{


int W,H,x,y,r;

scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);




if(x+r<=W && x-r>=0){

	if(y+r<=H && y-r>=0){

printf("Yes\n");

}

else{

printf("No\n");

}

}
else{

printf("No\n");

}

return 0;
}


Measured memory_bytes: 2124
#include<bits/stdc++.h>
#define faster_io ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define mem(a,b) memset(a,b,sizeof a)
#define F first
#define S second
#define ll long long
#define pb push_back
#define pll pair<ll, ll>
using namespace std;
const ll N = 1e6 + 7, M = 1e5 + 7, mod = 1e9 + 7, inf = 1e18 + 7;
ll tc, n, m, q, a, b, c, d, i, j, k, ans;
ll ar[N], fact[N];
string s;
vector < ll > vec;

ll bigmod(ll base, ll pow)
{
    if(pow == 0)
        return 1;
    ll x = bigmod(base, pow / 2);
    x = (x * x) % mod;
    if(pow % 2)
        x = (x * base) % mod;
    return x;
}

ll cal(ll N, ll R)
{
    return (fact[N] * bigmod((fact[R] * fact[N - R]) % mod, mod - 2)) % mod;
}

int main()
{
    faster_io;
    cin >> n >> m;
    fact[0] = 1;
    for(i = 1; i <= n; i++)
        fact[i] = (fact[i - 1] * i) % mod;
    for(i = 1; i <= n; i++)
        cin >> ar[i];
    sort(ar + 1, ar + n + 1);
    for(i = 1; i <= n; i++)
    {
        if(i <= n - m + 1)
            ans = (ans - (ar[i] * cal(n - i, m - 1)) % mod + mod) % mod;
        if(i >= m)
            ans = (ans + (ar[i] * cal(i - 1, m - 1)) % mod) % mod;
    }
    cout << ans << endl;
}


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

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

	int n, m;
	cin >> n >> m;
	vector<vector<int>> g(n, vector<int>(n));
	for(int i = 0; i < m; i++) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		g[a][b] = g[b][a] = 1;
	}
	vector<int> perm(n);
	iota(perm.begin(), perm.end(), 0);
	int ans = 0;
	do {
		bool ok = true;
		for(int i = 0; i < n - 1; i++) {
			if(!g[perm[i]][perm[i + 1]]) ok = false;
		}
		ans += ok;
	} while(next_permutation(perm.begin() + 1, perm.end()));
	cout << ans << endl;
	return 0;	
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	long long a,n,num;
	cin>>a>>n;
	for(long long i=0;i<n;i++)
	{
		scanf("%lld",&num);
		a-=num;
	}
	if(a<=0) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#define LL long long
using namespace std;
LL read(){
	LL ans=0,f=1,c=getchar();
	while(c<'0'||c>'9'){if(c=='-') f=-1; c=getchar();}
	while(c>='0'&&c<='9'){ans=ans*10+(c-'0'); c=getchar();}
	return ans*f;
}
LL n,k,ans;
LL gcd(LL x,LL y){
	while(y){
		LL p=x%y;
		x=y;
		y=p;
	}
	return x;
}
int main(){
	n=read(); ans=read();
	for(int i=1;i<n;i++){
		k=read();
		ans=ans/gcd(ans,k)*k;
	}printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 128
def resolve():
    a,b = map(int, input().split())
    A = list(map(int, input().split()))
    count = 0

    for c in range(b):
        count += A[c]
    
    result = a - count
    if result < 0:
        print("-1")
    else:
        print(result)
    
resolve()

Measured memory_bytes: 9876
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>
#include <random>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
//#define int long long

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;
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; }

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;
//inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    string s,t;
    cin >> s >> t;

    cout << t << s << endl;
}

signed main() {
    solve();
    
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        double x = sc.nextDouble();
        int ans = (int)Math.ceil(x/1.08);
        
        if(Math.floor(ans*1.08)==x){
            System.out.println(ans);
        }else{
            System.out.println(":(");
        }
   }
}


Measured memory_bytes: 37300
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(V) sort((V).begin(),(V).end())
#define pb push_back
#define endl '\n'
#define int long long

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

// 変数定義
string s,t;
int cnt = 0;
//

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> s >> t;
  if(s[0] == t[0]) {
  	cnt++;
  }
  if(s[1] == t[1]){
  	cnt++;
  }
  if(s[2] == t[2]) {
  	cnt++;
  }
  cout << cnt << endl;
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use proconio::{fastout, input, marker::*};

#[fastout]
fn main() {
   input! {
      x: i32,
      n: usize,
      p: [usize; n]
   }

   let mut a = [true; 102];
   for p in p {
      a[p] = false;
   }
   let mut ans = 0;
   for i in 0..=101 {
      if a[i as usize] && (x - ans).abs() > (x - i).abs() {
         ans = i;
      }
   }
   println!("{}", ans);
}


Measured memory_bytes: 2196
using System;
using System.Collections.Generic;
using System.Linq;
using BitArray = System.Collections.BitArray;
using BigInteger = System.Numerics.BigInteger;
using TextReader = System.IO.TextReader;
using System.Text;

namespace AtCoderProject
{
    public class Program
    {
        public object Calc()
        {
            return new[] { "Even", "Odd" }[consoleReader.Int & consoleReader.Int & 1];
        }

        #region いつもの
#pragma warning disable
        private ConsoleReader consoleReader;
        public Program(ConsoleReader consoleReader) { this.consoleReader = consoleReader; }
        static void Main() => Console.WriteLine(new Program(new ConsoleReader(Console.In)).Calc()); static string AllLines<T>(IEnumerable<T> source) => string.Join("\n", source);
    }
    public class ConsoleReader
    {
        private string[] ReadLineSplit() => textReader.ReadLine().Split(Array.Empty<char>(), StringSplitOptions.RemoveEmptyEntries);
        private string[] line = Array.Empty<string>();
        private int linePosition;
        private TextReader textReader;
        public ConsoleReader(TextReader tr) { textReader = tr; }
        public int Int => int.Parse(String);
        public long Long => long.Parse(String);
        public double Double => double.Parse(String);
        public string String
        {
            get
            {
                if (linePosition >= line.Length)
                {
                    linePosition = 0;
                    line = ReadLineSplit();
                }
                return line[linePosition++];
            }
        }
        public class SplitLine
        {
            private string[] splited;
            public SplitLine(ConsoleReader cr) { splited = cr.ReadLineSplit(); cr.line = Array.Empty<string>(); }
            public int[] Int => String.Select(x => int.Parse(x)).ToArray();
            public int[] Int0 => String.Select(x => int.Parse(x) - 1).ToArray();
            public long[] Long => String.Select(x => long.Parse(x)).ToArray();
            public double[] Double => String.Select(x => double.Parse(x)).ToArray();
            public string[] String => splited;
        }
        public SplitLine Split => new SplitLine(this);
        public class RepeatReader : IEnumerable<ConsoleReader>
        {
            ConsoleReader cr; int count;
            public RepeatReader(ConsoleReader cr, int count) { this.cr = cr; this.count = count; }
            public IEnumerator<ConsoleReader> GetEnumerator() => Enumerable.Repeat(cr, count).GetEnumerator();
            System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator();

            public IEnumerable<string> String => this.Select(cr => cr.String);
            public IEnumerable<int> Int => this.Select(cr => cr.Int);
            public IEnumerable<int> Int0 => this.Select(cr => cr.Int - 1);
            public IEnumerable<long> Long => this.Select(cr => cr.Long);
            public IEnumerable<double> Double => this.Select(cr => cr.Double);
        }
        public RepeatReader Repeat(int count) => new RepeatReader(this, count);
    }
    #endregion
}

Measured memory_bytes: 11092
N = int(input())

combi=[[0]*10 for _ in range(10)]
for i in range(1,N+1):
    num = str(i)
    sentou=num[0]
    matubi=num[-1]
    combi[int(sentou)][int(matubi)]+=1

ans=0
for i in range(10):
    for j in range(10):
        ans+=combi[i][j]*combi[j][i]

print(ans)



Measured memory_bytes: 40684
/*  -*- coding: utf-8 -*-
 *
 * b.cc: B: 1 Dimensional World&#039;s Tale
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

/* typedef */

/* global variables */

/* subroutines */

/* main */

int main() {
  int n, m, x, y;
  scanf("%d%d%d%d", &n, &m, &x, &y);

  int maxx = x, miny = y;

  for (int i = 0; i < n; i++) {
    int xi;
    scanf("%d", &xi);
    if (maxx < xi) maxx = xi;
  }

  for (int i = 0; i < m; i++) {
    int yi;
    scanf("%d", &yi);
    if (miny > yi) miny = yi;
  }

  if (maxx < miny) puts("No War");
  else puts("War");
  return 0;
}


Measured memory_bytes: 256
#input()
K=int(input())
A,B=map(int,input().split())
#list(map(int,input().split()))
#[input() for i in range(N)]

if (A%K == 0) or (B%K == 0):
    print('OK')
elif A//K != B//K:
    print('OK')
else:
    print('NG')


Measured memory_bytes: 9160
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
typedef long long ll;

int main(){
    fastio
    ll n ; 
    cin >> n ; 
    vector<pair<ll,ll> > v(n) ; 
    for(ll i=0;i<n;i++){
    	cin >> v[i].second >> v[i].first ; 
    	if ( v[i].second > v[i].first ){
    		cout << "No" << endl;
    		return 0 ;
    	}
    }
    sort(v.begin(),v.end()) ; 
    ll ans = 0 ; 
    for(ll i=0;i<n;i++){
    	ans += v[i].second ; 
    	if ( ans > v[i].first ) {
    		cout << "No" << endl;
    		return 0 ; 
    	}
    }
    cout << "Yes" << endl;
    return 0 ;
}


Measured memory_bytes: 3456
# include<bits/stdc++.h>
# include<string>
using namespace std;
int main(){
	long int n;
  	cin >> n;
  	string s;
  	// std::string::iterator it;
  	// storing in string
  	cin >> s;
  	// body
  	long int res = 1;
  	for(int i = 1; i < n; i++){
    	if(s[i] != s[i-1])
          res += 1;
    }
  // printing output
  cout << res <<'\n';
  
	return 0;
}


Measured memory_bytes: 512
import sys
import collections

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))

n = ri()
d = collections.Counter(rr())
for _ in range(n-1):
    d1 = collections.Counter(rr())
    h = dict()
    for k, v in d1.items():
        if k in d:
            h[k] = min(d[k], v)
    d = h
s = ''
for k in sorted(d):
    s += k*d[k]
print(s)    













Measured memory_bytes: 9400
#include <iostream>

using namespace std;

int div2cnt(int x)
{
    int cnt = 0;
    while(0 == x % 2)
    {
        cnt++;
        x /= 2;
    }

    return cnt;
}

int main()
{
    int n;
    cin >> n;
    int a[n];
    int ans = 0;
    for(int i = 0; i < n; i++)
    {
        cin >> a[i];
        ans += div2cnt(a[i]);
    }

    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 256
#include <cassert>
#include <cstdint>
#include <functional>
#include <vector>

template <typename Monoid> class SegmentTree {
public:
  using value_type = Monoid;
  using reference = value_type &;
  using const_reference = const value_type &;
  using container_type = std::vector<value_type>;
  using size_type = typename container_type::size_type;

private:
  const size_type size_, capacity;
  container_type tree;
  static size_type getsize(const size_type &size) noexcept {
    size_type ret = 1;
    while (ret < size)
      ret <<= 1;
    return ret;
  }
  void recalc(const size_type &index) {
    tree[index] = tree[index << 1] + tree[index << 1 | 1];
  }

public:
  SegmentTree(const size_type &size)
      : size_(size), capacity(getsize(size_)), tree(capacity << 1) {}
  void update(size_type index,
              const std::function<value_type(const_reference)> &f) {
    assert(index < size());
    index += capacity;
    tree[index] = f(tree[index]);
    while (index >>= 1)
      recalc(index);
  }
  void update(const size_type &index, const_reference data) {
    update(index, [&data](const_reference x) { return data; });
  }
  value_type range(size_type begin, size_type end) const {
    assert(begin <= end);
    assert(begin <= size());
    assert(end <= size());
    value_type retL, retR;
    for (begin += capacity, end += capacity; begin < end;
         begin >>= 1, end >>= 1) {
      if (begin & 1)
        retL = retL + tree[begin++];
      if (end & 1)
        retR = tree[end - 1] + retR;
    }
    return retL + retR;
  }
  size_type search(const std::function<bool(const_reference)> &b) const {
    if (!b(tree[1]))
      return size();
    value_type acc;
    size_type i = 1;
    while (i < capacity)
      if (!b(acc + tree[i <<= 1]))
        acc = acc + tree[i++];
    return i - capacity;
  }
  const_reference operator[](const size_type &index) const {
    assert(index < size());
    return tree[index + capacity];
  }
  size_type size() const noexcept { return size_; }
  bool empty() const noexcept { return !size_; }
};


#include<algorithm>
template <typename T> struct Mini {
	T a;
	Mini(const T &x = 2147483647) : a(x) {}
	Mini operator+(const Mini &o) const{ return Mini(std::min(a, o.a)); }
};
#include<iostream>
int main() {
	using M = Mini<int>;
	int n, q;
	std::cin >> n >> q;
	SegmentTree<M> T(n);
	while (q--) {
		int c, x, y;
		std::cin >> c >> x >> y;
		if (c)
			std::cout << T.range(x, y + 1).a << std::endl;
		else
			T.update(x, M(y));
	}
	return 0;
}


Measured memory_bytes: 3860
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
bool  vis[300005];
int main() {
     ios::sync_with_stdio(false);
  cin.tie(0);
ll k;
cin>>k;
string s;
cin>>s;
ll n=s.length();
if(n<=k)
cout<<s<<endl;
else{
string ans=s.substr(0,k);
ans+="...";
cout<<ans<<endl;}
}

Measured memory_bytes: 3644
# 146A
# 日曜日が何日後なのか

# 入力
s = str(input())

# 処理
if s == "SUN":
    print(7)
elif s == "MON":
    print(6)
elif s == "TUE":
    print(5)
elif s == "WED":
    print(4)
elif s == "THU":
    print(3)
elif s == "FRI":
    print(2)
elif s == "SAT":
    print(1)


Measured memory_bytes: 9048
import numpy as np

n=int(input())
a=np.array(input().split()).astype(int)

a_g=(a%2==0)
a_35=(a[a_g]%3==0)+(a[a_g]%5==0)

if a_35.all():
	ans="APPROVED"
else:
	ans="DENIED"
print(ans)

Measured memory_bytes: 14512
import java.util.Scanner;

class Main{



	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		int n = sc.nextInt();
		int i = sc.nextInt();
		System.out.println(n-i+1);

		
	}


}




class Pair implements Comparable{
	int from;		//p
	int end;		//y
	int num;
	int bango;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return from - otherpair.from;
	}
}



Measured memory_bytes: 21204
n = int(input())
red = [list(map(int, input().split())) for _ in range(n)]
blue = [list(map(int, input().split())) for _ in range(n)]
red.sort(key=lambda x: x[0])
blue.sort(key=lambda x: x[0])

ans = 0
for b in blue:
    tmp_y = -1
    pop_i = None
    flag = False
    for i, r in enumerate(red):
        if r[0] >= b[0]:
            break
        if r[1] < b[1]:
            flag = True
            if r[1] >= tmp_y:
                pop_i = i
                tmp_y = r[1]
    if flag:
        red.pop(pop_i)
        ans += 1
print(ans)


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

typedef long long ll;
typedef pair<int,int> P;
typedef map<int,int> M;
typedef vector<int> V;
typedef queue<int> Q;
typedef pair<long,long> PLL;
typedef map<long,long> MLL;
typedef vector<long> VLL;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define MOD (1e9+7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n-1);i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
/*--------------------------------------------*/

int main(){
    int n,x;cin>>n>>x;
    V m(n);
    rep(i,n)cin>>m[i];
    sort(ALL(m));
    int sum=0;
    rep(i,n){
        sum+=m[i];
    }
    int remain=x-sum;
    int tmp=0;
    while(remain>=0){
        remain-=m[0];
        tmp++;
    }
    cout<<tmp+n-1<<endl;
}


Measured memory_bytes: 256
k= int(input())

seen = [0]*(k+1)
rem=0
for i in range(0,k+1):
    rem = (rem*10+7) % k
    # print(rem)
    if rem == 0:
        print(i + 1)
        break
    elif seen[rem] ==1:
        print('-1')
        break
    else:
        seen[rem] =1

Measured memory_bytes: 16628
import Data.Maybe as Maybe
import Data.List as List


solve :: [Int] -> Int
solve = getMaxArea

getMaxArea :: [Int] -> Int
getMaxArea s
    | a1 > 0 && a2 > 0 = a1 * a2
    | otherwise = 0
    where
        a = getMaxLength 0 s
        a1 = fst a
        a2 = snd a

getMaxLength :: Int -> [Int] -> (Int, Int)
getMaxLength _ [] = (-1, -1)
getMaxLength y (x1:x2:xs)
    | x1 == x2 && y > 0 = (y, x1)
    | x1 == x2 = getMaxLength x1 xs
    | otherwise = getMaxLength y ([x2] ++ xs)
getMaxLength _ _ = (-1, -1)


main :: IO ()
main = do
    n <- getLine
    a <- map read . words <$> getLine :: IO [Int]
    let s = sortBy (flip compare) a
    print $ solve s

Measured memory_bytes: 52604
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int d = sc.nextInt();
		int t = sc.nextInt();
		int s = sc.nextInt();
		if(s*t >= d) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

		sc.close();
	}
}


Measured memory_bytes: 35584
#include<bits/stdc++.h>
using ll = long long;
using namespace std;
int main(){
   	int N, M;
  	string blue, red;
  	cin >> N;
  	map<string, int> table;
  	int m = 0;
  	for(int i = 0; i < N; ++i){
      cin >> blue;
      table[blue]++;
  	}
	cin >> M;
  	for(int i = 0; i < M; ++i){
      cin >> red;
      table[red]--;
  	}
  	for(auto itr = table.begin(); itr != table.end(); ++itr){
      m = max(m, itr->second);
    }
 
    cout << m << endl;
}

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

using namespace std;

typedef long long            ll;
typedef unsigned             ui;
typedef unsigned long long   ull;
typedef pair<int,int>        i_i;
typedef pair<ll,int>         ll_i;
typedef pair<ll,ll>          ll_ll;
typedef pair<double,int>     d_i;
typedef pair<double,double>  d_d;
typedef vector<int>          vi;
typedef vector<vector<int> > vii;

#ifdef DEBUG
#define dprintf      printf
#define dputs        puts
#define dout(x)      cout<<#x" = "<<(x)<<endl
#define darray(x,n)  {int i;rep(i,n)cout<<#x"["<<i<<"] = "<<*((x)+i)<<endl;}
#define dloop(i,s,g) for(int (i)=(s);(i)<(g);(i)++)
#define drep(i,n)    for(int (i)=0;(i)<(n);(i)++)
#define dstop()      scanf("%*c")
#else
#define dprintf      (1)?0:printf
#define dputs        (1)?0:puts
#define dout(x)
#define darray(x,n)
#define dloop(i,s,g) if(int i=0){}else
#define drep(i,n)    if(int i=0){}else
#define dstop()
#endif

#define F    first
#define S    second
#define pb   push_back
#define mp   make_pair

#define loop(i,s,g) for((i)=(s);(i)<(g);(i)++)
#define rep(i,n)    for((i)=0;(i)<(n);(i)++)
#define all(x)      (x.begin(),x.end())
#define in(T,...) T __VA_ARGS__; impl(__VA_ARGS__)
#define array(T,id,n) T id[(n)]; for(int i=0;i<(n);i++)cin>>id[i]
#define putv(n)     cout<<(n)<<endl

//#define int long long
#ifndef int
#define INF __INT32_MAX__
#else
#define INF __INT64_MAX__
#endif

void impl(){};
template <typename T,typename... TS >
void impl(T &head,TS &... tail)
{
  cin>>head;
  impl(tail ...);
}

int c[10][3]={
  {0,1,2,},
  {0,1,3,},
  {0,1,4,},
  {0,2,3,},
  {0,2,4,},
  {0,3,4,},
  {1,2,3,},
  {1,2,4,},
  {1,3,4,},
  {2,3,4,},
};

signed main(void)
{
  in(int,n);
  int i;
  ll sum[10]={};
  rep(i,n){
    in(string,s);
    switch(s[0]){
    case 'M': sum[0]++; break;
    case 'A': sum[1]++; break;
    case 'R': sum[2]++; break;
    case 'C': sum[3]++; break;
    case 'H': sum[4]++; break;
    default : sum[5]++; break;
    }
  }
  ll ans=0;
  rep(i,10)
    ans+=sum[c[i][0]]*sum[c[i][1]]*sum[c[i][2]];
  putv(ans);
  return 0;
}


Measured memory_bytes: 256
import java.util.*

data class HowManyCombinations(val n: Int, val x: Int) {
    fun count(): Int {
        if (x > n + (n - 1) + (n - 2)) return 0
        val base = Math.min(x - 3, n)
        var cnt = 0
        for (i in base downTo 3) {
            for (j in i - 1 downTo 2) {
                for (k in j - 1 downTo 1) {
                    if (x - i - j - k == 0) {
                        cnt++
                    }
                }
            }
        }
        return cnt
    }
}

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`)
    val list = mutableListOf<HowManyCombinations>()
    while (true) {
        val n = scanner.nextInt()
        val x = scanner.nextInt()
        if (n == 0 && x == 0) {
            break
        }
        list.add(HowManyCombinations(n, x))
    }
    list.forEach {
        println(it.count())
    }
}


Measured memory_bytes: 26108
#include <bits/stdc++.h>
using namespace std;
#define int long long   // aaaaaaaaaaaaaaaaaa
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define allr(x) (x).rbegin(),(x).rend()
#define in(s,x) s.find(x) != s.end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define SIZE(buff) (sizeof(buff)/sizeof(buff[0]))
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<pair<int,int>> VPII;
const ll mod=1000000007;
const ll INF= 1LL<<60-1;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;} ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
template<class T> void chmin(T& a,const T& b) { if(a>b) a=b; }
template<class T> void chmax(T& a,const T& b) { if(a<b) a=b; }
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
template<typename T, typename U>ostream& operator << (ostream& os, pair<T, U>& pair_var)
{os << pair_var.first << " " << pair_var.second ;return os;}
template<class tContainer>
long long sum(tContainer const& iContainer) {return  std::accumulate(std::begin(iContainer), std::end(iContainer), 0LL);}
 
// head
 
 
int m,n,k,res,tmp,tmp2,tmp3,h,w,x,y;
VI a;
deque<PII> que;
string s;
VI b;
vector<PII> g[2100600];
//int b[2100000];
int c[210] = {};
int rui[210000];
set<int> ch;
 
signed main() {
	cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n;
  rep(i,0,n){
    cin>>m;
    b.pb(m);
  }
  sort(all(b));
  cout<<b[n/2]-b[n/2-1]<<endl;
    
}

Measured memory_bytes: 50680
X = int(input())

numbers = dict()

for i in range(-200, 200):
    numbers.setdefault(i, i**5)

for i in range(-200, 200):
    for j in range(-200, 200):
        if numbers[i] - numbers[j] == X:
            output = [i, j]
            break

print(output[0], output[1])


Measured memory_bytes: 9076
#python3
n = int(input())
s = [str(input()) for _ in range(n)]
sep = ''
dic = dict()
for string in s:
  tmp = sep.join(sorted(string))
  if tmp in dic:
    dic[tmp] += 1 
  else :
    dic[tmp] = 1
ans = 0
for i in dic.values(): 
  ans += i*(i-1)//2
print(ans)

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

const long INF = 2000000000;

int v,e;
long d[100][100];

int main(){
  scanf("%d %d",&v,&e);
  fill(d[0],d[0]+10000,INF);
  for(int i=0;i<v;i++) d[i][i] = 0;
  for(int i=0;i<e;i++){
    int a,b,cost;
    scanf("%d %d %d",&a,&b,&cost);
    d[a][b] = cost;
  }
  for(int k=0;k<v;k++)
    for(int i=0;i<v;i++)
      for(int j=0;j<v;j++)
        if(d[i][k]!=INF&&d[k][j]!=INF)
          d[i][j] = min(d[i][j],d[i][k]+d[k][j]);
  for(int i=0;i<v;i++){
    if(d[i][i]<0){
      printf("NEGATIVE CYCLE\n");
      return 0;
    }
  }
  for(int i=0;i<v;i++){
    for(int j=0;j<v;j++){
      if(d[i][j]==INF) printf("INF");
      else printf("%ld",d[i][j]);
      if(j!=v-1) printf(" ");
      else printf("\n");
    }
  }
}

Measured memory_bytes: 1112
#include <bits/stdc++.h>
#define ri register int
#define il inline
#define ll long long
using namespace std;

const int N = 1e6 + 110;
const int MAXN = 110;
const int inf = 0x7fffffff;
const double eps = 1e-8;
const int maxn = 20;

il int read()
{
	int x = 0, f = 1;
	char ch = getchar();
	while (!isdigit(ch))
	{
		if (ch == '-')
			f = -1;
		ch = getchar();
	}
	while (isdigit(ch))
	{
		x = (x << 3) + (x << 1) + ch - '0';
		ch = getchar();
	}
	return x * f;
}

int l, cur = 1, num;

struct edge
{
	int fr, to, dis;
};
edge ans[N];

int main()
{
	l = read();
	l--;
	while (l)
	{
		if (l % 2 == 0)
		{
			ans[++num] = (edge){cur, maxn, l};
			l--;
		}
		ans[++num] = (edge){cur, cur + 1, 0};
		ans[++num] = (edge){cur, cur + 1, (l + 1) >> 1};
		l >>= 1;
		cur++;
	}
	while (cur != maxn)
	{
		ans[++num] = (edge){cur, cur + 1, 0};
		cur++;
	}
	printf("%d %d\n", maxn, num);
	for (ri i = 1; i <= num; i++)
		printf("%d %d %d\n", ans[i].fr, ans[i].to, ans[i].dis);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll N = 100;
const ll K = 1e5;

ll as[N];
ll n, k;

ll dp[K + 1];

// First false, Second true
bool voitanko(ll k) {
    // k jäljellä
    if (k == 0) {
        //cout << "voitanko(0) = false\n";
        return false;
    }
    if (dp[k] != -1) {
        return dp[k];
    }
    for (ll i = 0; i < n; i++) {
        ll a = as[i];
        if (k - a < 0) continue;
        if (!voitanko(k - a)) {
            //cout << "voitanko(" << k << ") = true\n";
            dp[k] = true;
            return true;
        }
    }
    //cout << "voitanko(" << k << ") = false\n";
    dp[k] = false;
    return false;
}

int main() {
    cin >> n >> k;
    copy_n(istream_iterator<ll>(cin), n, as);
    fill_n(dp, k + 1, -1);
    cout << (voitanko(k) ? "First" : "Second") << "\n";
    return 0;
}


Measured memory_bytes: 4096
#include<bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll inf=1e9+7;
const ll mod=1e9+7;
int main(){
    int n;cin>>n;
    cout<<n*n*n<<endl;
}

Measured memory_bytes: 256
#[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 , usize1 ) => {read_value ! ($ next , usize ) - 1 } ; ($ next : expr , $ t : ty ) => {$ next () . parse ::<$ t > () . expect ("Parse error" ) } ; }
#[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 ) * } } ; }
#[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 ) * } } ; }

fn main() {
    input! {
        m: i32,
    }
    println!("{}", 48 - m);
}


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


int main(){
	int a, b;
	cin >> a >> b;
	if(a >= 6 && a <= 12){
		b /= 2;
	}
	if(a <= 5){
		b = 0;
	}
	cout << b;
	return 0;
}

Measured memory_bytes: 256
X = int(input())

if X < 600:
    print(8)
elif X < 800:
    print(7)
elif X < 1000:
    print(6)
elif X < 1200:
    print(5)
elif X < 1400:
    print(4)
elif X < 1600:
    print(3)
elif X < 1800:
    print(2)
elif X < 2000:
    print(1)


Measured memory_bytes: 9168
#include <bits/stdc++.h>
#define MOD (long long)(1E9+7)
#define rep(i, n) for(int i = 0; i < n; i++)

using namespace std;

int main(){
	double n,m,t;
	cin >>n >> m;
	printf("%8.8lf\n", n/m);
}

Measured memory_bytes: 256
#define LOCAL
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rrep(i, n) for(int i=(n-1); i>=0; --i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()
#define memr(dp, val) memset(dp, val, sizeof(dp))
using namespace std;
typedef long long ll;
static const int INTINF = (INT_MAX >> 1); // 10^9 + 10^7
static const ll LLINF = (LLONG_MAX >> 1);
static const int MAX = 1e5+1;
static const ll MOD = 1e9+7;
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; }
string to_string(string s) { return '"' + s + '"'; }
string to_string(bool b) { return b ? "true" : "false"; }
template <size_t N> string to_string(bitset<N> bs) {
  string res;
  for (size_t i = 0; i < N; ++i) res += '0' + bs[i];
  return res;
}
string to_string(vector<bool> v) {
  string res = "{";
  for (bool e : v) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p);
template <class C> string to_string(C c) {
  string res = "{";
  for (auto e : c) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
void debug() { cerr << '\n'; }
template <class Head, class... Tail> void debug(Head head, Tail... tail) {
  cerr << '\t' << to_string(head), debug(tail...);
}
#ifdef LOCAL
#define print(...) cerr << "[" << #__VA_ARGS__ << "]:", debug(__VA_ARGS__)
#else
#define print(...)
#endif

ll dp[101][101][1000];

int main(int argc, const char * argv[]) {
	std::cout << std::fixed << std::setprecision(15);

  ll N, W; cin >> N >> W;
  vector<ll> w(N), v(N);
  ll ori = -1;
  rep(i, N){
    cin >> w[i] >> v[i];
    if(ori == -1) ori = w[0];
    w[i] -= ori;
  }

  memr(dp, -1);
  ll ans = 0;
  dp[0][0][0] = 0;
  rep(i, N){
	  rep(j, 100){
		  rrep(k, 1000){
			  if(dp[i][j][k] == -1) continue;
			  chmax(dp[i+1][j][k], dp[i][j][k]);
			  chmax(ans, dp[i+1][j][k]);
			  if((j+1) * ori + k + w[i] > W) continue;
			  chmax(dp[i+1][j+1][k+w[i]], dp[i][j][k] + v[i]);
			  chmax(ans, dp[i+1][j+1][k+w[i]]);
		  }
	  }
  }

  cout << ans << endl;

	return 0;
}


Measured memory_bytes: 80000
n = int(input())
A = (list)(map(int, input().split()))
B = (list)(map(int, input().split()))

A_sum = [0]*n
B_sum = [0]*n

A_sum[0] = A[0]
B_sum[n-1] = B[n-1]
# i　下に降りるところ
for i in range(1, n):
    A_sum[i] = A_sum[i-1]+A[i]
    B_sum[n-i-1] = B_sum[n-i] + B[n-i-1]


print(max(A_sum[i]+B_sum[i] for i in range(n)))


Measured memory_bytes: 3064
#include<iostream>
#include<string>
using namespace std;
int main(){
	int n,p[100],b;
	string s[100],a;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>s[i]>>p[i];
	}
	for(int j=0;j<n;j++){
		a="zzzzzzzzzz";b=0;
		for(int k=0;k<n;k++){
			if(a>s[k]){
				a=s[k];
				b=0;
			}
			if(a==s[k]&&b<=p[k]){
				b=p[k];
			}
		}
		for(int l=0;l<n;l++){
			if(a==s[l] && p[l]==b){
				s[l]="zzzzzzzzzzz";p[l]=-1;
				cout<<l+1<<endl;
			}	
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
long long a,b;
int ans=1;
int main(){
	cin>>a>>b;
	for(int i=2;;){
		a=a*i;
		if(a<=b){
			ans++;
		}
		else{
			break;
		}
	}
	cout<<ans;
	return 0;
} 

Measured memory_bytes: 256
// たなこふ先生の input マクロ (´･_･`)
// 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)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[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)*}
    };
}

#[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<_>>()
    };

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

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

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

fn main() {
    input! {
        ab : usize,
        bc : usize,
        _ca : usize,
    }

    println!("{}", ab*bc/2);
}


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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;


#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


int main()
{
    ll n,ans=__LONG_LONG_MAX__;
    cin>>n;
    vector<ll> x(n);
    for (int i = 0; i < n; i++)
    {
        cin>>x[i];
    }
    for (int i = 0; i < 101; i++)
    {
        ll tmp=0;
        for (int j = 0; j < n; j++)
        {
            tmp+=(i-x[j])*(i-x[j]);
        }
        ans=min(ans,tmp);
    }
    cout<<ans<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    string s;
    cin >> s;
    int n = s.size();
    cout << s.substr(0, n-9+1) << endl;
    return 0;
}


Measured memory_bytes: 3592