akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
using namespace std;

int main()
{
	int a, b, k;
	cin >> a >> b >> k;
	int ans, cnt = 0;
	for( ans = min(a,b); ; --ans )
	{
		if( a % ans || b % ans ) continue;
		cnt++;
		if( cnt >= k ) break;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String _s = sc.next();
    char[] t = sc.next().toCharArray();
    _s += _s;
    char[] s = _s.toCharArray();
    List<Queue<Integer>> que = new ArrayList<>();
    int N = s.length;
    int M = t.length;
    for(int i = 0; i < 26; i++){
      que.add(new ArrayDeque<>());
    }
    for(int i = 0; i < N; i++){
      s[i] -= 'a';
    }
    for(int i = 0; i < M; i++){
      t[i] -= 'a';
    }
    for(int i = 0; i < N; i++){
      que.get(s[i]).add(i);
    }
    int[][] map = new int[N][26];
    for(int[] is : map){
      Arrays.fill(is, Integer.MAX_VALUE / 3);
    }
    for(int i = 0; i < N; i++){
      map[i][s[i]] = 0;
    }
    for(int i = 0; i < 26; i++){
      for(int j = N - 1; j >= 0; j--){
        map[j][i] = Math.min(map[j][i], map[(j + 1) % N][i] + 1);
      }
    }
    
    for(int i = 0; i < 26; i++){
      for(int j = 0; j < N; j++){
        if(map[j][i] == 0){
          map[j][i] = map[(j + 1) % N][i] + 1;
        }
      }
    }
    
    long ans = 0;
    int idx = N/2 - 1;
    if(map[N/2 - 1][t[0]] > Integer.MAX_VALUE / 5){
      System.out.println(-1);
      return;
    }
    ans += map[N/2 - 1][t[0]];
    idx += map[N/2 - 1][t[0]];
    idx %= N/2;
    for(int i = 1; i < M; i++){
      if(map[idx][t[i]] > Integer.MAX_VALUE / 5){
        System.out.println(-1);
        return;
      }
      ans += map[idx][t[i]];
      idx += map[idx][t[i]];
      idx %= N/2;
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 68128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int64_t n,t;
  cin >> n >> t;
  vector<int64_t> vec(n);
  rep(i,n){
    cin >> vec.at(i);
  }
  int64_t ans=t;
  rep(i,n-1){
    ans+=min(vec.at(i+1)-vec.at(i),t);
  }
  cout << ans;
}

Measured memory_bytes: 1792
import os
import sys
from io import BytesIO, IOBase
# region fastio

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# ------------------------------

from math import factorial
from collections import Counter, defaultdict, deque
from heapq import heapify, heappop, heappush

def RL(): return map(int, sys.stdin.readline().rstrip().split())
def RLL(): return list(map(int, sys.stdin.readline().rstrip().split()))
def N(): return int(input())
def comb(n, m): return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0
def perm(n, m): return factorial(n) // (factorial(n - m)) if n >= m else 0
def mdis(x1, y1, x2, y2): return abs(x1 - x2) + abs(y1 - y2)
mod = 998244353
INF = float('inf')

# ------------------------------
# f = open('../input.txt')
# sys.stdin = f

def main():
    n = N()
    arr = RLL()
    dic = defaultdict(int)
    for i in arr: dic[i]+=1
    sm = sum(arr)
    q = N()
    for _ in range(q):
        b, c = RL()
        num = dic[b]
        dic[c]+=dic[b]
        dic[b] = 0
        sm = sm-b*num+c*num
        print(sm)

if __name__ == "__main__":
    main()



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

int main() {
int N;
  cin >> N;
  int N10=N/10;
   int N000=N%1000;
  if(N10%111==0){
    cout << "Yes" << endl;
  }
  else if(N000%111==0){
    cout << "Yes" <<endl;
  }
    else{
      cout <<"No" <<endl;
    }
}


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

const int OP_LEN = 20;

typedef struct _node {
  int num;
  struct _node *left;
  struct _node *right;
} node;

node *tree = NULL;

node *make_node(int num)
{
  node *v = (node *)malloc(sizeof(node));
  v->num = num;
  v->left = NULL;
  v->right = NULL;
  return v;
}

void insert_body(node *tree, int num)
{
  node *l = tree->left;
  node *r = tree->right;
  if (num <= tree->num) {
    if (l == NULL)
      tree->left = make_node(num);
    else
      insert_body(l, num);
  } else {
    if (r == NULL)
      tree->right = make_node(num);
    else
      insert_body(r, num);
  }
}

void insert(int num)
{
  if (tree == NULL)
    tree = make_node(num);
  else
    insert_body(tree, num);
}

void print_tree(node *tree)
{
  if (tree == NULL) {
    printf("*");
  } else {
    printf("(%d ", tree->num);
    print_tree(tree->left);
    printf(" ");
    print_tree(tree->right);
    printf(")");
  }
}

void inorder(node *tree)
{
  if (tree == NULL) return;
  inorder(tree->left);
  printf(" %d", tree->num);
  inorder(tree->right);
}

void preorder(node *tree)
{
  if (tree == NULL) return;
  printf(" %d", tree->num);
  preorder(tree->left);
  preorder(tree->right);
}

void print()
{
  // print_tree(tree); printf("\n");
  inorder(tree); printf("\n");
  preorder(tree); printf("\n");
}

int main()
{
  int n; scanf("%d", &n);
  while (n--) {
    char op[OP_LEN]; scanf("%s", op);
    if (op[0] == 'i') {
      int num; scanf("%d", &num);
      insert(num);
    } else {
      print();
    }
  }
  return EXIT_SUCCESS;
}




Measured memory_bytes: 18712
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<malloc.h>

#define INF (1000000000)

int my_gets(char *buf,int nBuf,FILE *fp){
    int ch;

    while(--nBuf >0){
        ch=getc(fp);
        if(ch==EOF || ch=='\n')
            break;
        *(buf++)=(char)ch;
    }
    *(buf)='\0';

    return nBuf;
}

int N,M;
int E_s[1000],E_g[1000],E_d[1000];
int dist[100][100];

void WF_alg(void){
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            dist[i][j]=(i!=j)?INF:0;
        }
    }

    for(int i=0;i<M;i++){
            dist[E_s[i]-1][E_g[i]-1]= dist[E_g[i]-1][E_s[i]-1]= E_d[i];
    }

    for(int m=0;m<N;m++){
        for(int i=0;i<N;i++){
            for(int j=0;j<i;j++){
                if(dist[i][m]!=INF && dist[m][j]!=INF){
                if(dist[i][j]> dist[i][m]+dist[m][j]){
                    dist[i][j] = dist[j][i] = dist[i][m]+dist[m][j];
                    //printf("d(%d,%d) <= %d\n",i,j,dist[i][j]);
                }
                }
            }
        }
    }
}



int main(void){
    int cnt=0;

    scanf("%d %d%*c",&N,&M);

    for(int i=0;i<M;i++){
        scanf("%d %d %d%*c",&(E_s[i]),&(E_g[i]),&(E_d[i]));
    }
    WF_alg();
    for(int i=0;i<M;i++){
        if(E_d[i] > dist[E_s[i]-1][E_g[i]-1])
            cnt++;
    }
    printf("%d\n",cnt);
    return 0;
}

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

class D
{
	static void Main()
	{
		var n = int.Parse(Console.ReadLine());
		var a = Console.ReadLine().Split().Select(int.Parse).ToArray();

		var half = (long)n * (n + 1) / 4;
		Console.WriteLine(Last(1, a.Max(), m =>
		{
			var b = a.Select(x => x < m ? -1 : 1).ToArray();
			var s = CumSum(b);
			for (int i = 0; i <= n; i++) s[i] += n;

			// 転倒数
			var c = 0L;
			var st = new SegmentTree(2 * n + 1);
			for (int i = 0; i <= n; i++)
			{
				c += i - st.Sum(0, s[i] + 1);
				st.Add(s[i], 1);
			}
			return c <= half;
		}));
	}

	static int Last(int l, int r, Func<int, bool> f)
	{
		int m;
		while (l < r) if (f(m = r - (r - l - 1) / 2)) l = m; else r = m - 1;
		return l;
	}

	static int[] CumSum(int[] a)
	{
		var s = new int[a.Length + 1];
		for (int i = 0; i < a.Length; i++) s[i + 1] = s[i] + a[i];
		return s;
	}
}

class SegmentTree
{
	static int[] p2 = Enumerable.Range(0, 30).Select(i => (int)Math.Pow(2, i)).ToArray();
	static Dictionary<int, int> p2_ = Enumerable.Range(0, 30).ToDictionary(i => p2[i], i => i);

	static int LogFloor(int v)
	{
		for (int i = 1; ; i++) if (p2[i] > v) return i - 1;
	}

	int n2, logn;
	int[] a;
	public SegmentTree(int n)
	{
		logn = (int)Math.Ceiling(Math.Log(n, 2));
		n2 = p2[logn];
		a = new int[2 * n2];
	}

	public void Add(int i, int v)
	{
		for (i += n2; i > 0; i /= 2) a[i] += v;
	}

	// 簡易実装
	public int Sum(int start, int count)
	{
		if (p2_.ContainsKey(count))
		{
			return a[(start + n2) / count];
		}
		else
		{
			var c2 = p2[LogFloor(count)];
			return Sum(start, c2) + Sum(start + c2, count - c2);
		}
	}
}


Measured memory_bytes: 42912
#include <iostream>
#include <string>
#include <iomanip>
#include <cmath>
using namespace std;

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if(a>=b and a>=c){
        cout << (b+c) << endl;
    } else if (b>=c and b>=a){
        cout << (a+c) << endl;
    } else cout << (a+b) << endl;
}

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

using namespace std;
#define ll long long


int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    map<string, int> mp;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        mp[s]++;
    }
    vector<string> out = {"AC", "WA", "TLE", "RE"};
    for (auto x:out) cout << x << " x " << mp[x] << endl;
    return 0;
}

Measured memory_bytes: 3608
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
#include<sstream>
using namespace std;
typedef long long LL;
const int INF = 0x3f3f3f3f;


int main()
{
	string s,s1,s2;
	int n;
	cin >> n;
	cin >> s;
	if(n % 2 == 1){
		cout << "No" << endl;
		return 0;
	}	
	for(int i = 0;i < n / 2;i++){
		s1 += s[i];
	}
	for(int i = n / 2;i < n;i++){
		s2 += s[i];
	}
	if(s1 == s2)
	cout << "Yes" <<endl;
	else 
		cout << "No" << endl;
	return 0;
}


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

int main() {
  int x, y, z;
  cin >> x >> y >> z;

  int a = x, b = y, c = z;

  int tmp;
  tmp = a;
  a = b;
  b = tmp;

  tmp = a;
  a = c;
  c = tmp;

  cout << a << " " << b << " " << c << endl;
  return 0;
}


Measured memory_bytes: 256
S = input()
st = [(0, 0, -1)]
cur = 0; ma = 0
for i, c in enumerate(S):
    if c == '/':
        cur += 1
        s = 0
        while st and st[-1][0] == cur-1 and cur <= ma:
            lev, su, j = st.pop()
            s += su
        if st and st[-1][0] == cur:
            s += i - st[-1][2] - 1
        ma = max(ma, cur)
        st.append((cur, s, i))
    elif c == '\\':
        cur -= 1
        st.append((cur, 0, i))
    elif c == '_':
        st.append((cur, 0, i))
ans = []
for lev, su, j in st:
    if su > 0:
        ans.append(su)
print(sum(ans))
print(len(ans), *ans)


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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFやMODの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const ll MOD = 1000000007;

int main() {
  int n;
  cin >> n;
  vector<int> p(n), q(n);
  rep(i, n) cin >> p[i];
  rep(i, n) cin >> q[i];

  vector<int> v;
  rep(i, n) v.eb(i + 1);

  int a, b;
  int cnt = 1;
  do {
    bool aa = true;
    bool bb = true;
    rep(i, v.size()) {
      if (p[i] != v[i]) aa = false;
      if (q[i] != v[i]) bb = false;
    }
    if (aa) a = cnt;
    if (bb) b = cnt;
    cnt++;
  } while (next_permutation(all(v)));

  cout << abs(a - b) << endl;
}


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

int main() {
    int N;
    cin >> N;
    map<long long, int> mp;
    for(int i; i < N; i++) {
        int a;
        cin >> a;
        mp[a]++;
    }

    int ans = 0;
    for(auto p : mp) {
        if(p.first == 1) ans += p.second - 1;
        else ans += (p.second %= p.first);
    }

    cout << ans << endl;

    return 0;
}

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

int main()
{
  vector<vector<int>>c(3,vector<int>(3)) ;
  for(int i=0;i<3;i++) for(int j=0;j<3;j++) cin>>c.at(i).at(j) ;
  
  for(int i=0;i<2;i++){
    for(int j=0;j<2;j++){
      if(c.at(i).at(j)-c.at(i+1).at(j)!=c.at(i).at(j+1)-c.at(i+1).at(j+1)){
        cout<<"No"<<endl ;
        return 0 ;
      }
    }
  }
  cout<<"Yes"<<endl ;
  
  return 0 ;
}

Measured memory_bytes: 256
character(100) S
integer check
read*,S
check=0
do i=1,len_trim(S)
  if(check==0)then
    if(S(i:i)=="C")check=1
  else if(check==1)then
    if(S(i:i)=="F")check=2
  end if
end do
print"(A)",merge("Yes"," No",check==2)
end
  

Measured memory_bytes: 384
<?php
	$s=fgets(STDIN);
	$a=-1;
	for($i=0;$i<strlen($s);$i++)
	{
		if($a<0&&$s[$i]=='A')$a=$i;
		if($s[$i]=='Z')$z=$i;
	}
	echo $z-$a+1;


Measured memory_bytes: 3828
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = pow(10, 9) + 7;
//const ll MOD = 998244353;
//const ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
const ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
ll myctoi(char C) {return C - '0';}
char myitoc(ll N) {return '0' + N;}
#define FINALANS(A) {cout << (A) << '\n'; exit(0);}

vector<vector<ll>> G(100100, vector<ll>());
vector<ll> dp(100100, -1);
ll dfs(ll V)
{
  if (dp.at(V) != -1)
    return dp.at(V);

  ll ret = 0;
  for (auto nv : G.at(V))
  {
    chmax(ret, dfs(nv) + 1);
  }
  return dp.at(V) = ret;
}

int main()
{
  ll N, M;
  cin >> N >> M;
  for (ll i = 0; i < M; i++)
  {
    ll x, y;
    cin >> x >> y;
    x--, y--;
    G.at(x).push_back(y);
  }

  ll ans = 0;
  for (ll i = 0; i < N; i++)
  {
    chmax(ans, dfs(i));
  }

  cout << ans << endl;
}

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

using namespace std;

set <int> Se[200001];

int main()
{
    int n, m, k, X, Y, Mi=20000000, t=0;
    cin >> m >> n >> k;
    set <int> :: iterator it;
    for (int i = 0; i < k; i++)
    {
        cin >> X >> Y;
        X--;
        Y--;
        Se[Y].insert(X);
    }
    for (int i = 0; i < n; i++)
    {
        Se[i].insert(m);
    }
    if (Se[0].find(1) != Se[0].end())
    {
        cout << 1;
        return 0;
    }
    X=1;
    Y=0;
    t = 1;
    while (X < m && Y < n)
    {
        it = Se[Y].upper_bound(X);
        Mi = min(Mi, *it-X-1+t);
        if (Y == n-1)
        {
            break;
        }
        if (Se[Y+1].find(X) == Se[Y+1].end())
        {
            Y++;
        }
        it = Se[Y].upper_bound(X);
        Mi = min(Mi, *it-X-1+t);
        X++;
        t++;
    }
    cout << Mi+1;
    return 0;
}


Measured memory_bytes: 28416
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define ll long long
#define M 1000000007
#define sz(a) (ll)a.size()
#define pll pair<ll,ll>
#define rep(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define sep(i,a,b) for(ll i=(ll)a;i>=(ll)b;i--)
#define mll map<ll,ll>
#define vl vector<ll>
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(a) a.begin(),a.end()
#define F first
#define S second
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll m,d;
    cin>>m>>d;
    ll ans=0;
    rep(i,1,d+1)
    {
    	if(i/10>=2 and i%10>=2 and (i/10)*(i%10)<=m)
    		ans++;
    }
    cout<<ans;
}



Measured memory_bytes: 256
import heapq
n,m = map(int,input().split())

a = list(map(int,input().split()))


for i in range(n):
    a[i] = (-1) * a[i]

heapq.heapify(a)

for i in range(m):
    d = heapq.heappop(a)
    heapq.heappush(a,d/2)

ans = 0
for i in range(n):
    ans += int(-a[i])

print(ans)


Measured memory_bytes: 14180
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(x) (x).begin(), (x).end()
#define in(x, l, r) (ll)(l) <= (x) && (x) < (ll)(r)

int main() {
    int x;
    cin >> x;
    cout << (!x) << endl;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
#define IO ios::sync_with_stdio(false), cin.tie(0)
#define INF 0x3f3f3f3f
typedef long long ll;
using namespace std;
const int maxn=2e5+10;
int a[maxn];
int c[maxn];
int main()
{
	IO;
	int n,k;
	cin>>n>>k;
	for(int i=1;i<=k;i++){
		cin>>a[i];
	}
	
	c[1]=a[1]+n-a[k];
	for(int i=2;i<=k;i++){
		c[i]=a[i]-a[i-1];
	}
	int ans=0;
	for(int i=1;i<=k;i++){
		ans=max(ans,c[i]);
	}
	cout<<n-ans<<endl;
 	return 0;
}







Measured memory_bytes: 1792
s = input()
N = len(s)
result = 0
for i in range(N):
    if i % 2 == 0:
        # AtCoDeer: 'g'
        if s[i] == 'p':
            result -= 1
    else:
        # AtCoDeer: 'p'
        if s[i] == 'g':
            result += 1
print(result)

Measured memory_bytes: 3188
#include <cstdio>
#include <vector>
#include <string.h>
using namespace std;

int main(){
	vector<int> edge[501];
	int n, m, a, b;
	bool invite[501];
	int res;
	
	while(true){
		scanf("%d", &n);
		scanf("%d", &m);
		if(n == 0 && m == 0) break;
		for(int i = 0; i < m; i++){
			scanf("%d%d", &a, &b);
			edge[a].push_back(b);
			edge[b].push_back(a);
		}
		
		fill(invite, invite + (n + 1), false);
		invite[1] = true;
		if(!edge[1].empty()){
			for(int i = 0; i < edge[1].size(); i++){
				invite[edge[1][i]] = true;
				if(!edge[edge[1][i]].empty()){
					for(int j = 0; j < edge[edge[1][i]].size(); j++){
						invite[edge[edge[1][i]][j]] = true;
					}
				}
			}
		}
		
		res = 0;
		for(int i = 1; i <= n; i++){
			if(invite[i]){
				res++;
			}
		}
		printf("%d\n", res - 1);
		
		for(int i = 1; i <= n; i++){
			edge[i].clear();
		}
	}
	
	return 0;
}

Measured memory_bytes: 1196
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

use std::cmp::{max, min};
use std::collections::HashMap;

fn main() {
  let a = read::<String>();
  let mut abc = String::from("ABC");
  abc.push_str(&a);

  println!("{}", abc);
}



Measured memory_bytes: 4352
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

# 定義してないリストを参照するとエラーがでるからダミー置いといた。
A.append(100)
C.append(0)

total = 0

total = sum(B)

for i in range(1, N):
    if (A[i] - A[i - 1] == 1):
        total += C[A[i] - 1 - 1]

print(total)



Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define M (998244353)
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;
 
 

 
int main(void){
    map<char,int>d;
    string s;
    cin>>s;
    for(int i=0;i<s.length();i++)d[s[i]]++;
    if(d['N']==0){
        if(d['S']!=0){
            cout<<"No"<<endl;
            return 0;
        }
    }
    if(d['S']==0){
        if(d['N']!=0){
            cout<<"No"<<endl;
            return 0;
        }
    }
    if(d['E']==0){
        if(d['W']!=0){
            cout<<"No"<<endl;
            return 0;
        }
    }
    if(d['W']==0){
        if(d['E']!=0){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 256
H, W = map(int, input().split())

h = H // 2
w = W // 2

if H == 1 or W == 1:
    print(1)
    exit()

if W % 2 == 1:
    w += 1
if H % 2 == 1:
    print(h * W + w)
else:
    print(h * W)

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <stack>
#include <map>
#include <set>
#include <queue>
#include <functional>
using namespace std;
typedef long long ll;
int main(){
    int n;
    cin >> n;
    map<int,int> cnt_d;
    for(int i = 0;i < n;i++){
        int d;
        cin >> d;
        cnt_d[d]++;
    }

    int m;
    cin >> m;
    bool flag = true;
    for(int i = 0;i < m;i++){
        int t;
        cin >> t;
        if(cnt_d[t] <= 0)flag = false;
        else{
            cnt_d[t]--;
        }
    }

    if(!flag)cout << "NO" << endl;
    else cout << "YES" << endl;
}

Measured memory_bytes: 9600
n,m,X,Y=list(map(int,input().split()))
x=list(map(int,input().split()))
y=list(map(int,input().split()))

x_max=sorted(x)[-1]
y_min=sorted(y)[0]
for z in range(X+1,Y+1):
  if x_max < z <= y_min:
    print('No War')
    exit()
print('War')

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

int main() {
  int n,m,c,an;
  cin >> n >> m >> c;
  int bn[m];
  for(int j=0;j<m;j++){
    cin >> bn[j];
    }
  int sum=0,count=0;
  for(int i=0;i<n;i++){
    sum=0;
    for(int j=0;j<m;j++){
      cin >> an;
      sum = sum + bn[j]*an;
    }
    if(sum+c>0) count++;
  }
  cout << count << endl;
}


Measured memory_bytes: 256
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    auto nmq = readln.split.to!(int[]);
    auto N = nmq[0];
    auto M = nmq[1];
    auto Q = nmq[2];

    int[] as, bs, cs;
    long[] ds;
    foreach (_; 0..Q) {
        auto abcd = readln.split.to!(int[]);
        as ~= abcd[0]-1;
        bs ~= abcd[1]-1;
        cs ~= abcd[2];
        ds ~= abcd[3];
    }

    auto ns = new int[](N);
    long solve(int i, int p) {
        long r;
        if (i == N) {
            foreach (k; 0..Q) {
                if (ns[bs[k]] - ns[as[k]] == cs[k]) r += ds[k];
            }
            return r;
        } else {
            foreach (j; p..M+1) {
                ns[i] = j;
                r = max(r, solve(i+1, j));
            }
            return r;
        }
    }
    writeln(solve(0, 1));
}

Measured memory_bytes: 2768
#include <math.h>

#include <algorithm>  //sort,二分探索,など
#include <array>
#include <bitset>         //固定長bit集合
#include <cmath>          //pow,logなど
#include <complex>        //複素数
#include <deque>          //両端アクセスのキュー
#include <functional>     //sortのgreater
#include <iomanip>        //setprecision(浮動小数点の出力の誤差)
#include <iostream>       //入出力
#include <map>            //map(辞書)s
#include <numeric>        //iota(整数列の生成),gcdとlcm(c++17)
#include <queue>          //キュー
#include <set>            //集合
#include <stack>          //スタック
#include <string>         //文字列
#include <unordered_map>  //イテレータあるけど順序保持しないmap
#include <unordered_set>  //イテレータあるけど順序保持しないset
#include <utility>        //pair
#include <vector>         //可変長配列

using namespace std;
typedef long long ll;

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORD(i, a, b) for (ll i = (a); i >= (b); i--)
#define ALL(x) (x).begin(), (x).end()  // sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())  // sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

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

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

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;

vector<int> s;

int main() {
    int n, a, b, c;
    cin >> n >> a >> b >> c;
    s.resize(n);
    string si;
    for (int i = 0; i < n; ++i) {
        cin >> si;
        if (si == "AB") s[i] = 0;
        if (si == "AC") s[i] = 1;
        if (si == "BC") s[i] = 2;
    }

    vector<char> res;
    for (int i = 0; i < n; ++i) {

        if (s[i] == 0) {
            if (a == 0 && b == 0) {
                cout << "No" << endl;
                return 0;
            }

            if(a == 1 && b == 1 && c == 0){
                if(i < n-1){
                    if(s[i+1] == 1){
                        a++; b--;
                        res.push_back('A');
                    }else{
                        a--; b++;
                        res.push_back('B');
                    }
                    continue;
                }
            }

            if (a < b) {
                a++;
                b--;
                res.push_back('A');
            } else {
                a--;
                b++;
                res.push_back('B');
            }
        }
        if (s[i] == 1) {
            if (a == 0 && c == 0) {
                cout << "No" << endl;
                return 0;
            }

            if(a == 1 && b == 0 && c == 1){
                if(i < n-1){
                    if(s[i+1] == 0){
                        a++; c--;
                        res.push_back('A');
                    }else{
                        a--; c++;
                        res.push_back('C');
                    }
                    continue;
                }
            }

            if (a < c) {
                a++;
                c--;
                res.push_back('A');
            } else {
                a--;
                c++;
                res.push_back('C');
            }
        }
        if (s[i] == 2) {
            if (b == 0 && c == 0) {
                cout << "No" << endl;
                return 0;
            }

            if(a == 0 && b == 1 && c == 1){
                if(i < n-1){
                    if(s[i+1] == 0){
                        b++; c--;
                        res.push_back('B');
                    }else{
                        b--; c++;
                        res.push_back('C');
                    }
                    continue;
                }
            }

            if (b < c) {
                b++;
                c--;
                res.push_back('B');
            } else {
                b--;
                c++;
                res.push_back('C');
            }
        }
    }
    cout << "Yes" << endl;
    for (int i = 0; i < n; ++i) {
        cout << res[i] << endl;
    }
}

Measured memory_bytes: 3988
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define endl "\n"
#define sz(x) (int)(x).size()
#define _USE_MATH_DEFINES
using namespace std;
typedef long long int lli;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

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

    int n;
    cin >> n;
    int cnt = 0;
    vi a(n);
    rep(i, 0, n) cin >> a[i];
  
    rep(i, 0, n){
        while (a[i] % 2 == 0) {
          a[i] /= 2; 
          cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

long long h, w;
int main() {
    cin >> h >> w;
    long long sum = h*w;
    if(h == 1 || w == 1) {
        cout << 1 << endl;
    }else {
        if(sum % 2 == 0) {
            cout << sum / 2 << endl;
        }else {
            cout << sum / 2 + 1 << endl;
        }
    }
}

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

int main()
{
    bool flag;
    long long n;
    long long count=1;
    cin>>n;
    vector <int> a(n);

    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    int min=a[0];
    for(int i=1;i<n;i++)
    { 
        if(a[i]<min)
        {
            min = a[i];
            count++;
        }
    }
    cout<<count<<endl;
    return 0;
}

Measured memory_bytes: 1152
#!/usr/bin/env python3
import sys
import numpy as np


def solve(X: int):
    if X>=400 and X<=599:
        print(8)
    if X>=600 and X<=799:
        print(7)
    if X>=800 and X<=999:
        print(6)
    if X>=1000 and X<=1199:
        print(5)
    if X>=1200 and X<=1399:
        print(4)
    if X>=1400 and X<=1599:
        print(3)
    if X>=1600 and X<=1799:
        print(2)
    if X>=1800 and X<=1999:
        print(1)

    return


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

if __name__ == '__main__':
    main()


Measured memory_bytes: 27152
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def main():
    K = int(input())
    result = 0
    for a in range(1, K + 1):
        for b in range(1, K + 1):
            ab = gcd(a, b)
            for c in range(1, K + 1):
                tmp = gcd(ab, c)
                result += tmp

    print(result)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9216
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#include<cassert>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T> using vv=vector<vector<T>>;
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
const ll MOD=1e9+7;

int main(){
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(0);
  int n;
  cin>>n;
  ll a=1,b=1;
  rep(i,n){
    ll x,y;
    cin>>x>>y;
    ll t=max((a+x-1)/x,(b+y-1)/y);
    a=t*x;
    b=t*y;
  }
  cout<<a+b<<endl;
  return 0;
}


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

typedef long long ll;
#define sc scanf
#define pf printf
#define pb push_back

int main()
{
//    ll nm, nd;
//    double nx, np, ans;
//    sc("%lld%llf", &nm, &nx);
//    np = nx*100;
//    nd = np;
//    ans = (nm*nd)/100;
//   /// cout<<nm<<" "<<np<<endl;
//    cout<<(ll)ans<<endl;


    ll A, B;
    cin >> A >> B;
    char C;
    cin >> C;
    int D;
    cin >> D;
    B *= 100;
    B += D;
    ll X = A*B;
    X /= 100;
    cout << X << endl;

    return 0;
}


Measured memory_bytes: 3616
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <queue>
#include <set>
#include <vector>
#include <cstring>
#include <algorithm>

int main(){
  std::string S;
  std::cin >> S;
  
  if(S == "Sunny"){
    std::cout << "Cloudy" << std::endl;
  }
  else if(S == "Cloudy"){
    std::cout << "Rainy" << std::endl;
  }
  else{
    std::cout << "Sunny" << std::endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int BubbleSort ( int* Arr, int Max_order );

int main ( void ) {
    int Max_order = 0;
    int Arr[100] = {};
    int i = 0;
    int count_for_swap = 0;
    
    
    scanf( "%d", &Max_order );
    for ( i = 0; i < Max_order; i++ ) {
        scanf ( "%d ", &Arr[i] );
    }
    
    count_for_swap = BubbleSort ( Arr, Max_order );
    
    for ( i = 0; i < Max_order - 1; i++ ) {
        printf( "%d ", Arr[i] );
    }
    printf( "%d\n", Arr[i] );
    printf( "%d\n", count_for_swap );
    return 0;
}

int BubbleSort ( int* Arr, int Max_order )
{
    int count_for_swap = 0;
    int tmp = 0;
    int i = 0;
    int j = 0;
    
    for ( i = 0; i < Max_order; i++ ) {
        for ( j = Max_order - 1; j > i; j-- ) {
            if ( Arr[j] < Arr[j-1] ) {
                tmp = Arr[j];
                Arr[j] = Arr[j-1];
                Arr[j-1] = tmp;
                count_for_swap++;
            }
        }
    }
    
    return count_for_swap;
}



Measured memory_bytes: 2104
s = input()
if s == 'MON':
    print(6)
if s == 'TUE':
    print(5)
if s == 'WED':
    print(4)
if s == 'THU':
    print(3)
if s == 'FRI':
    print(2)
if s == 'SAT':
    print(1)
if s == 'SUN':
    print(7)

Measured memory_bytes: 3060
import numpy as np
N = int(input())

A = []
B = []
for i in range(N):
    a, b = list(map(int, input().split()))
    A.append(a)
    B.append(b)

diff = []
for _ in range(N):
    diff.append(B[_] + A[_])

diff = np.array(diff)
A = np.array(A)
B = np.array(B)

sort_index = diff.argsort()

A = (A[sort_index][::-1])
B = (B[sort_index][::-1])

taka = (A[0::2])
aoki = (B[1::2])

print(sum(taka) - sum(aoki))


Measured memory_bytes: 25052
n=int(input())
water=list(map(int,input().split()))
x=[]
temp=0
for i in range(1,n,2):
    temp+=water[i]
x.append(sum(water)-2*temp)
for j in range(n-1):
    x.append(2*water[j]-x[-1])
res=map(str,x)
print(' '.join(res))

Measured memory_bytes: 19144
// https://atcoder.jp/contests/abc172/tasks/abc172_d

#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define DEBUG 1
#if DEBUG
  #define _GLIBCXX_DEBUG
  #define DUMP(a) REP(_i, a.size()) cout << a[_i] << (_i + 1 == a.size() ? "\n" : " ")
  #define DUMP2D(b) REP(_j, b.size()) DUMP(b[_j]); cout << endl
#else
  #define DUMP(a)
  #define DUMP2D(b)
#endif

const ll N_MAX = 1e7;

ll N;

int main() {
  cin >> N;

  ll ans = 0;
  ll i;
  for (i = 1; i * 2 <= N; i++) {
    ll j = N / i;
    ans += i * j * (j + 1) / 2;
  }
  if (i <= N) ans += (N + i) * (N - i + 1) / 2;
  cout << ans << endl;
}


Measured memory_bytes: 3620
import sys

#a=int(input())
#b=int(input())
a,b=map(int,input().split())
ans=0
i=2
while i>0:
    if(a>b):
        ans+=a
        a=a-1
        #print(a)
    elif(b>a):
        ans+=b
        b=b-1
    else:
        ans+=a
        a=a-1
    i=i-1
print(ans)


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


#define fast_IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define pb push_back
#define F first
#define S second
#define int long long int
#define ll long long
#define ld long double

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

ll lcm(ll x,ll y){
    return (x*y)/(__gcd(x,y));
}

ll nod(ll n){
    while(n%10==0){
        n/=10;
    }
    return n;
}


signed main(){
    fast_IO;
    int t=1;
    //cin>>t;
    while(t--){
        int n;
        cin>>n;
        int res=7%n;
        for(int i=1;i<=1e7;i++){
            if(res==0){
                cout<<i<<endl;
                return 0;
            }
            res=(res*10+7)%n;
        }
        cout<<"-1"<<endl;
    }
    return 0;
}



Measured memory_bytes: 3568
#include "bits/stdc++.h"
using namespace std;
int Count[3];

int main(){
    int N , a , b , Num , i;
    scanf( "%d%d%d" , &N , &a , &b );

    for( i = 1 ; i <= N ; ++i ){
        scanf( "%d" , &Num );
        if( Num <= a ) ++Count[0];
        else if( Num > b ) ++Count[2];
        else ++Count[1];
    }

    int Ans = min( Count[1] , min( Count[0] , Count[2] ) );
    printf( "%d\n" , Ans );
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.util.function.*;
import java.util.stream.*;

public class Main{
	Scanner s=new Scanner(System.in);

	void solve(){
		int n=gInt();

		long[][]head=new long[10][10];

		int digit=1;
		for(int i=1;i<=n;++i) {
			if(i/digit==10)
				digit*=10;
			head[i/digit][i%10]++;
		}

		long r=0;
		for(int i:rep(10)) {
			for(int j:rep(10)) {
				r+=head[i][j]*head[j][i];
			}
		}
		System.out.println(r);
	}

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

	int gInt(){
		return Integer.parseInt(s.next());
	}
	long gLong(){
		return Long.parseLong(s.next());
	}
	double gDouble(){
		return Double.parseDouble(s.next());
	}

	SupplyingIterator<Integer> ints(int n){
		return new SupplyingIterator<>(n,this::gInt);
	}
	SupplyingIterator<Long> longs(int n){
		return new SupplyingIterator<>(n,this::gLong);
	}
	SupplyingIterator<Double> doubles(int n){
		return new SupplyingIterator<>(n,this::gDouble);
	}
	SupplyingIterator<String> strs(int n){
		return new SupplyingIterator<>(n,s::next);
	}

	Range rep(int i){
		return Range.rep(i);
	}
	Range rep(int f,int t,int d){
		return Range.rep(f,t,d);
	}
	Range rep(int f,int t){
		return rep(f,t,1);
	}
	Range rrep(int f,int t){
		return rep(t,f,-1);
	}

	IntStream REP(int v){
		return IntStream.range(0,v);
	}
	IntStream REP(int l,int r){
		return IntStream.rangeClosed(l,r);
	}

	IntStream INTS(int n){
		return IntStream.generate(this::gInt).limit(n);
	}
	Stream<String> STRS(int n){
		return Stream.generate(s::next).limit(n);
	}

}

class SupplyingIterator<T> implements Iterable<T>,Iterator<T>{
	int			t;
	Supplier<T>	supplier;

	SupplyingIterator(int t,Supplier<T> supplier){
		this.t=t;
		this.supplier=supplier;
	}

	@Override
	public Iterator<T> iterator(){
		return this;
	}

	@Override
	public boolean hasNext(){
		return t>0;
	}

	@Override
	public T next(){
		--t;
		return supplier.get();
	}

}

class Range implements Iterable<Integer>,PrimitiveIterator.OfInt{
	int to,cur,d;

	Range(int from,int to,int d){
		this.cur=from-d;
		this.to=to;
		this.d=d;
	}

	Range(int n){
		this(0,n-1,1);
	}

	@Override
	public Iterator<Integer> iterator(){
		return this;
	}

	@Override
	public boolean hasNext(){
		return cur+d==to||(cur!=to&&(cur<to==cur+d<to));
	}

	@Override
	public int nextInt(){
		return cur+=d;
	}
	static Range rep(int i){
		return new Range(i);
	}
	static Range rep(int f,int t,int d){
		return new Range(f,t,d);
	}
	static Range rep(int f,int t){
		return rep(f,t,1);
	}
	static Range rrep(int f,int t){
		return rep(f,t,-1);
	}
}

Measured memory_bytes: 27092
N = int(input())
A = list(map(int, input().split()))
d = 0
A.insert(0,0)
A.append(0)
for i in range(N+1):
    d += abs(A[i]-A[i+1])

for i in range(1,N+1):
    ans = d + abs(A[i-1]-A[i+1]) - (abs(A[i-1]-A[i])+abs(A[i]-A[i+1]))
    print(ans)


Measured memory_bytes: 64236
{-# LANGUAGE BangPatterns #-}

import Control.Monad
import Data.List
import Data.Bits
import Debug.Trace
import Data.Maybe
import qualified Data.ByteString.Char8 as C

main :: IO ()
main = do
  [n] <- readIntegers
  print $ findIJ n

findIJ n = findIJ' id
  where
    id = (floor $ sqrt $ fromIntegral n :: Integer)
    findIJ' d = if n `mod` d == 0 then (d - 1) + (n `div` d - 1) else findIJ' (d - 1)

-- 以下ライブラリ

readInts :: IO [Int]
readInts = map (fst . fromJust . C.readInt) . C.words <$> C.getLine

readNInts :: Int -> IO [[Int]]
readNInts = flip replicateM readInts

readIntegers :: IO [Integer]
readIntegers = map (fst . fromJust . C.readInteger) . C.words <$> C.getLine

readNIntegers :: Int -> IO [[Integer]]
readNIntegers = flip replicateM readIntegers

getNLns :: Int -> IO [String]
getNLns = flip replicateM getLine

Measured memory_bytes: 1020
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10, gcd, floor
from itertools import permutations, combinations, product, accumulate, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from decimal import *
#from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 1, 0, -1, 1, -1, -1, 1]
dy = [1, 0, -1, 0, 1, -1, 1, -1]
debugmode = True

t = input().split()
a, b = int(t[0]), Decimal(t[1])
bb = floor(b)
bbb = (b - bb)
ans = a * bb + int(a * bbb)
print(ans)

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

using namespace std;

const int K = 100001;
const int N = 101;

int n, k;
int arr[N];

int dp[K];

bool rec(int k) {
  if(k == 0) return false;
  if(dp[k] != -1) return dp[k];
  dp[k] = 0;
  for(int i = 0; i < n; ++i){
    if(k - arr[i] >= 0)
      dp[k] |= (!rec(k - arr[i]));
  }
  return dp[k];
}

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  cin >> n >> k;
  memset(dp, -1, sizeof dp);
  for(int i = 0; i < n; ++i)
    cin >> arr[i];
  bool res = rec(k);
  if(res) cout << "First\n";
  else cout << "Second\n";
}

Measured memory_bytes: 5376
#include<iostream>
#include<vector>
#include<algorithm>
int main(){
    std::vector<int> vec;
    for(int i = 0; i < 3; i++){
        int tmp;
        std::cin >> tmp;
        vec.push_back(tmp);
    }
    std::sort(vec.begin(),vec.end());
    if(vec[0] == 5 && vec[1]==5 && vec[2]==7){
        std::cout << "YES" << std::endl;
    }
    else
    {
        std::cout << "NO" << std::endl;
    }
    return 0;
}

Measured memory_bytes: 256
from collections import defaultdict
d = defaultdict(int)
N, K = map(int, input().split())
for i in range(N):
    a, b = map(int, input().split())
    d[a] += b
for k, v in sorted(d.items()):
    K -= v
    if K <= 0:
        print(k)
        break


Measured memory_bytes: 51800
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()   //reverse
#define strall(v) (v).cbegin(),(v).cend() //const_itterator
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<typename t, typename u, typename Comp=less<>>
bool chmax(t& xmax, const u& x, Comp comp={}) { if(comp(xmax, x)) { xmax = x; return true; } return false;}
template<typename t, typename u, typename Comp=less<>>
bool chmin(t& xmin, const u& x, Comp comp={}) { if(comp(x, xmin)) { xmin = x; return true;} return false;}
const int INF = 1e8;
const ll infl = 1LL << 60;
///////
const ll MOD = 1e9+7;
int main(){
  ll x;
  cin >> x;
  ll cash = 100;
  ll year = 0;
  while(1){
    year++;
    cash+=(cash*0.01);
    if(x <= cash) {cout << year << endl;return 0;}
  }
}


Measured memory_bytes: 3640
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<stdio.h>
#include<cmath>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

#define big ((ll)(1e9)+7)

int main()
{
  int a,b;
  cin >> a >> b;
  if(a < 10 && b < 10)
  {
    cout << a*b << endl;
  }
  else
  {
    cout << -1 << endl;
  }
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        int n = sc.nextInt();
        long[] arr = sc.nextLongArray(n);
        Arrays.sort(arr);
        long ans = 0;
        for(int i = 1; i < n-1; i++){
            ans += Math.abs(arr[i]);
        }
        System.out.println(arr[n-1]-arr[0]+ans);
        for(int i = 1; i < n-1; i++){
            if(arr[i] <= 0){
                System.out.println(arr[n-1] + " " + arr[i]);
                arr[n-1] -= arr[i];
            }else{
                System.out.println(arr[0] + " " + arr[i]);
                arr[0] -= arr[i];
            }
        }
        System.out.println(arr[n-1] + " " + arr[0]);
    }
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public double nextDouble() {
         return Double.parseDouble(next());
    }
    
    public String[] nextArray(int n) {
        String[] a = new String[n];
        for (int i = 0; i < n; i++)
            a[i] = next();
        return a;
    }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    } 
}


Measured memory_bytes: 47760