akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
typedef long long lint;
typedef unsigned int uint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
typedef unsigned long long ulint;
#define endl '\n'
#define fst first
#define sed second
#define pb push_back
#define mp make_pair
#define rint register int
#define newline putchar('\n')
#define leave_space putchar(' ')
#define all(x) (x).begin(), (x).end()
#define reveal(x) cerr << #x << " = " << (x) << endl
#define rep(it, f, e) for (rint it = (f); it <= int(e); ++it)
#define per(it, f, e) for (rint it = (f); it >= int(e); --it)
const int MAXN = 1e5 + 10;
vector<int> edge[MAXN], cycle;
struct DSU {
	int par[MAXN];
	DSU() {
		rep (i, 1, MAXN - 1) {
			par[i] = i;
		}
	}
	inline int find(int x) {
		return par[x] == x ? x : par[x] = find(par[x]);
	}
	inline void marry(int x, int y) {
		par[find(x)] = find(y);
	}
}	Dsu;
int val[MAXN], par[MAXN];
inline void dfs(int u, int valor) {
	val[u] = valor;
	for (auto v : edge[u]) {
		if (v == par[u]) continue;
		par[v] = u;
		dfs(v, -valor);
		val[u] += val[v];
	}
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL), cout.tie(NULL);
	int le1 = 1, le2 = 1;
	int n, m, u, v;
	cin >> n >> m;
	rep (i, 1, m) {
		cin >> u >> v;
		if (Dsu.find(u) != Dsu.find(v)) {
			Dsu.marry(u, v);
			edge[u].pb(v);
			edge[v].pb(u);
		} else {
			le1 = u, le2 = v;
		}
	}
	dfs(le1, 1);
	if (n == m) {
		for (int u = le2; u; u = par[u]) {
			cycle.pb(val[u]);
		}
        if (cycle.size() & 1) {
			if (val[le1] & 1) {
				cout << -1 << endl;
				return 0;
			}
			for (int u = le2; u; u = par[u]) {
				val[u] -= val[le1] / 2;
			}
        } else {
			if (val[le1]) {
				cout << -1 << endl;
				return 0;
			}
			sort(all(cycle));
			for (int u = le2; u; u = par[u]) {
				val[u] -= cycle[cycle.size() / 2 - 1];
			}
        }
	} else if (val[le1]) {
		cout << -1 << endl;
		return 0;
	}
	lint ans = 0;
	rep (i, 1, n) {
		ans += abs(val[i]);
	}
    cout << ans << endl;
	return 0;
}


Measured memory_bytes: 12412
# -*- coding: utf-8 -*-
n, m, k = map(int, input().split())
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))

a, b = [0], [0]

for i in range(n):
    a.append(a[i] + a_list[i])
    
for j in range(m):
    b.append(b[j] + b_list[j])
    
ans, j = 0, m

for i in range(n+1):
    if a[i] > k:
        break
    while b[j] > k - a[i]:
        j -= 1
    ans = max(ans, i+j)
    
print(ans)

Measured memory_bytes: 47328
#include <stdio.h>
int main(void){
    
    int n,k,x,y;
    int sum = 0;

    scanf("%d\n%d\n%d\n%d",&n,&k,&x,&y);

    

    if(n>k){
        sum = k*x + (n-k)*y;
    }else{
        sum = n*x ;
    }

    printf("%d\n",sum);
    


    return 0;
}

Measured memory_bytes: 1732
#include<bits/stdc++.h>
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s; cin >> s;
  if(s == "Sunny")
    cout << "Cloudy" << endl;
  else if(s == "Cloudy")
    cout << "Rainy" << endl;
  else
    cout << "Sunny" << endl;  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
typedef vector <int> vi;
typedef pair< int ,int > pii;
#define PB push_back
#define MP make_pair
#define FF first
#define SS second
#define ll long long
#define MOD 1000000007
#define OJ \
    freopen("input.txt", "r", stdin); \
    freopen("output.txt", "w", stdout);
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int main(){
    FIO;
    //OJ;
    int h,w,k,ans=0;
    cin>>h>>w>>k;
    char c[h][w];
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin>>c[i][j];
        }
    }
    for(int i=0;i<(1<<h);i++){
        for(int j=0;j<(1<<w);j++){
            int count=0;
            for(int i1=0;i1<h;i1++){
                for(int j1=0;j1<w;j1++){
                    if((i&(1<<i1))&&(j&(1<<j1))&&c[i1][j1]=='#')
                        count++;
                }
            }
            if(count==k)
                ans++;
        }
    }
    cout<<ans;
}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string N;
  int K;
  cin >> N >> K;
  vector<vector<vector<int>>> dp(N.size() + 1,
                                 vector<vector<int>>(2, vector<int>(10, 0)));
  dp[0][0][0] = 1;
  // dp[i][smaller][digits]
  for (int i = 0; i < (int)N.size(); i++) {
    for (int s = 0; s < 2; s++) {
      for (int k = 0; k < K + 1; k++) {
        int c = N[i] - '0';

        for (int n = 0; n < 10; n++) {
          if (n > c && s == 0) continue;
          int ns = s;
          if (n < c) ns = 1;
          int nk = k;
          if (n != 0) nk++;

          dp[i + 1][ns][nk] += dp[i][s][k];
        }
      }
    }
  }
  cout << dp[N.size()][0][K] + dp[N.size()][1][K] << '\n';
  return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		
		String input = sc.next();
		String txt = sc.next();
		
		input = input + input;
		
		System.out.println(input.contains(txt) ? "Yes" : "No");
	}

}

Measured memory_bytes: 17312
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdio.h>
int main(int argc, const char * argv[]) {
    int x;
    scanf("%d",&x);
    long long ans=x/500*1000;
    ans+=(x%500)/5*5;
    printf("%lld",ans);
    return 0;
}


Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;

#define pb push_back
#define mp make_pair
#define F(i, a, n, b) for(int i=a;i<n;i+=b)
#define REVF(i, a, b, c) for(int i=a;i>=b;i-=c)
#define REP(i, n) F(i, 0, n, 1)
#define REP1(i, n) F(i, 1, n+1, 1)
#define REV(i, n) REVF(i, n, 0, 1)
#define PTR(it, x) for(auto it=x.begin();it!=x.end();++it)
#define MOD 1000000007

typedef unsigned long long ll;

const int MAX = 1e6 + 5;

int a,b;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	cin>>a>>b;
	if(a <= b){
		REP(i,b){
			cout<<a;
		}
	}
	else{
		REP(i,a){
			cout<<b;
		}
	}
	return 0;
}

Measured memory_bytes: 256
using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                string[] s = Console.ReadLine().Split();
                int a = int.Parse(s[0]);
                string b = (s[1]);
                int c = int.Parse(s[2]);
                if (b == "+")
                {
                    Console.WriteLine(a + c);
                }
                else if (b == "-")
                {
                    Console.WriteLine(a - c);
                }
                else if (b == "*")
                {
                    Console.WriteLine(a * c);
                }
                else if (b == "/")
                {
                    Console.WriteLine(a / c);
                }
                else
                {
                    break;
                }
            }
        }
    }
}

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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//main code

int main(int argc, char const* argv[])
{
    LL n,c,k;
    cin >> n >> c >> k;
    VL t(n);
    for (int i = 0; i < n; i++) {
        cin >> t[i];
    }
    SORT(t);
    LL ans = 1,p = 1,now = t[0];
    for (int i = 1; i < n; i++) {
        p++;
        if (t[i] - now > k or p > c) {
            ans++;
            p = 1;
            now = t[i];
            continue;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
#![allow(unused_imports)]
extern crate proconio;
use proconio::{input};
use std::cmp::Reverse;

pub fn main() {
    input! {
        a: i32,
        //h: [i64; n],
    }
    let ans = a + a.pow(2) + a.pow(3);

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


Measured memory_bytes: 2132
#include <iostream>

using namespace std;

int grundy(int A, int K){
    if(A < K) return 0;
    if(A%K == 0) return A/K;
    int blk = A/K;
    int src = blk * (K-1);
    return grundy(src + (A-src)%(blk+1), K);
}

int main(){
    int N;
    while(cin >> N){
        int g = 0;
        for(int i=0;i<N;i++){
            int A, K; cin >> A >> K;
            g ^= grundy(A, K);
        }
        cout << (g ? "Takahashi" : "Aoki") << endl;
    }
}

Measured memory_bytes: 256
# Reference: https://ikatakos.com/pot/programming_algorithm/data_structure/binary_indexed_tree
# Fenwick Tree
class BinaryIndexedTree:
    # a = [0] * n
    # O(n)
    def __init__(self, n):
        self.size = n
        self.data = [0] * (n+1)

    # return sum(a[0:i])
    # O(log(n))
    def cumulative_sum(self, i):
        ans = 0
        while i > 0:
            ans += self.data[i]
            i -= i & -i
        return ans

    # a[i] += x
    # O(log(n))
    def add(self, i, x):
        i += 1
        while i <= self.size:
            self.data[i] += x
            i += i & -i

from sys import stdin
input = stdin.buffer.readline

def main():
    n, m, q = map(int, input().split())
    lr = [tuple(map(int, input().split())) for _ in range(m)]
    pq = [(0, 0, 0)] * q
    for ind in range(q):
        i, j = map(int, input().split())
        pq[ind] = (i, j, ind)

    lr.sort(key=lambda x: x[0])
    l = [i for i, j in lr]
    r = [j for i, j in lr]
    pq.sort(key=lambda x: x[0])

    BIT = BinaryIndexedTree(n+1)
    for i in r:
        BIT.add(i, 1)

    # search r[lr_ind:]
    lr_ind = 0
    ans = [0] * q
    for left, right, pq_ind in pq:
        while lr_ind < m and l[lr_ind] < left:
            BIT.add(r[lr_ind], -1)
            lr_ind += 1

        ans[pq_ind] = BIT.cumulative_sum(right+1)

    for i in ans:
        print(i)

main()

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

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;

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

int main(){
    ll N;
    cin >> N;
    vll d(N);
    rep(i, N){
        cin >> d[i];
    }
    sort(d.begin(), d.end());
    if(d[N/2-1]!=d[N/2]){
        cout << abs(d[N/2]-d[N/2-1]) << endl;
    }
    else{
        cout << 0 << endl;
    }
}


Measured memory_bytes: 1024
def normalize(str)
    num = 0
    to_num = {}
    str.chars.map{|c|
        if ! to_num.has_key?(c)
            to_num[c] = num
            num += 1
        end
        to_num[c]
    }
end

puts normalize(gets.chomp) == normalize(gets.chomp) ? 'Yes' : 'No'


Measured memory_bytes: 27988
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using Pair = pair<int64_t, int64_t>;
constexpr int64_t kInf = INT64_MAX / 2L;

// std::cout << std::setprecision(20) << 1.1 << endl;

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

  int64_t K, A, B;
  cin >> K >> A >> B;
  if (B - A <= 2) {
    cout << (K + 1) << endl;
    return 0;
  }
  int64_t c_bis = 1;
  K -= (A - c_bis);
  c_bis = A;

  const int64_t count_2 = K / 2;
  c_bis += (B - A) * count_2;
  K -= count_2 * 2;
  if (K > 0) {
    c_bis += K;
  }
  cout << c_bis << endl;
  return 0;
}


Measured memory_bytes: 3564
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for(int i=0; i<n; ++i)
        cin >> a[i];

    int left = 1;
    int right = *max_element(a.begin(), a.end());
    while(left < right){
        int mid = (left + right) / 2;
        int cnt = 0;
        for(int i=0; i<n; ++i)
            cnt += (a[i] - 1) / mid;

        if(cnt <= k)
            right = mid;
        else
            left = mid + 1;
    }
    cout << left << endl;

    return 0;
}


Measured memory_bytes: 4024
a,b,m=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
l=[list(map(int,input().split())) for _ in range(m)]
ans=min(a)+min(b)
for x,y,c in l:
    ans=min(ans,a[x-1]+b[y-1]-c)
print(ans)

Measured memory_bytes: 38628
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

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

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

ll lcm(ll a, ll b)
{
    return a / gcd(a, b) * b;
}

inline double nCr(const int n, int r)
{
    if (n == 0)
    {
        return 0;
    }
    if (r == 0)
    {
        return 1;
    }
    if (r == 1)
    {
        return n;
    }
    if (n == r)
    {
        return 1;
    }

    if (r > n / 2)
    {
        r = n / 2;
    }

    double result = 1;
    for (double i = 1; i <= r; i++)
    {
        result *= (n - i + 1) / i;
    }

    return (result);
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

template <typename T>
map<T, T> soinsuubunkai(T n) //連想配列[素因数f.first][個数f.second]
{
    map<T, T> ret;
    for (T i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1)
        ret[n] = 1;
    return ret;
}

template <typename T>
T ketasuu(T num)
{
    return std::to_string(num).length();
}

int kaizyou(int k)
{
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

template <class ForwardIt, class T>
void iota(ForwardIt first, ForwardIt last, T value)
{
    while (first != last)
    {
        *first++ = value;
        ++value;
    }
}

//nの階乗を計算
int factorial(int n)
{
    int answer = 1;
    while (n > 1)
    {
        answer *= n;
        n--;
    }
    return answer;
}
int comb(int n, int r)
{
    return factorial(n) / (factorial(r) * factorial(n - r));
}

long long modpow(long long a, long long n, long long mod)
{
    long long res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}


template <typename T>
T amarinasi(T a,T b){
    if(a%b==0)
{
    return a/b;
}
else if(a%b>0)
{
    return a/b+1;
}
else
{
    return a/b-1;
}
}

//小数点以下10桁テンプレート（main関数内の最初に貼付け）
//std::cout << std::fixed << std::setprecision(10);

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

int main(){
ll n,x;
cin>>n>>x;
ll l;
ll sum=0;
ll cnt=0;
for(int i=0;i<n;i++){
    cin>>l;
    sum+=l;
    if(sum<=x){
        cnt++;
    }
}
cout<<cnt+1<<endl;
}











Measured memory_bytes: 256
S = input()
T = ''
words = ['dream', 'dreamer', 'erase', 'eraser']
for i in range(len(words)):
    words[i] = words[i][::-1]
for i in S[::-1]:
    T += i
    for q in words:
        if T == q:
            T = ''
print('YES' if T == '' else 'NO')

Measured memory_bytes: 3188
#include <iostream>
#include <functional>
#include <algorithm>
#include <math.h>
#include <iomanip>
#include <vector>
#define ll long long
#define ALLv(a)  (a).begin(),(a).end()
#define ALL(a,n)  (a),(a)+n

#define INF 1010000000000000017LL
#define MOD 1000000007LL
#define EPS 1e-12
#define PI 3.14159265358979323846
//REPEAT
//------------------------------------------
#define FOR(i,m,n) for(int (i)=(m);(i)<(n); i++)
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define WREP(i,in,j,jn) REP(i,in)REP(j,jn)
using namespace std;
//-------------------------------------------

int main(void){
	string S;cin>>S;
	for(int i=0;S[i]!='\0';i++)	cout<<'x';
	return 0;
}


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

int main()
{
    int a, p,n;
    std::cin >> a >> p;

    n = a*3 + p;


    std::cout << n/2 << std::endl;
    return 0;
}

Measured memory_bytes: 764
#include<iostream>
#include<cmath>

using namespace std;
int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int x = ceil((float)a/d);
  int y = ceil((float)c/b);
  
  cout << (x>=y? "Yes" : "No");
}


Measured memory_bytes: 3632
#define _GLIBCXX_DEBUG//TLEの原因になるので注意！！！！！！！！！！！
#include<cmath>
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
vector<int> arr;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define sz(x) int(x.sise())
#define mod 1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
deque<int> deq;
#define fi first
#define se second
//#define int long long

//cerrはコメントアウトしなくても通る//ただしTLEを引き起こすことがある

//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
//const ll INF = 1LL << 60;
//typedef pair<ll,ll> P;
typedef pair<int, int> P;
bool chmx(int &a, int b) {
	if (b > a) {
		a = b;
		return true;
	}
	return false;
}

bool chmn(int &a, int b) {
	if (b < a) {
		a = b;
		return true;
	}
	return false;
}

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



Measured memory_bytes: 3636
#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use itertools_num::ItertoolsNum;
#[allow(unused_imports)]
use std::cmp;
#[allow(unused_imports)]
use std::iter;
#[allow(unused_imports)]
use superslice::*;

fn run() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let n: usize = sc.read();
    let a = sc.read_vec::<usize>(n);

    let ans = a
        .into_iter()
        .enumerate()
        .filter(|&(i, x)| (i + 1) % 2 == 1 && x % 2 == 1)
        .count();
    println!("{}", ans);
}

fn main() {
    std::thread::Builder::new()
        .name("run".into())
        .stack_size(256 * 1024 * 1024)
        .spawn(run)
        .unwrap()
        .join()
        .unwrap();
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: std::ops::Deref<Target = str>>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn read_pairs<T: std::str::FromStr>(&mut self, n: usize) -> Vec<(T, T)> {
        (0..n).map(|_| (self.read(), self.read())).collect()
    }
    pub fn read_pairs_1_indexed(&mut self, n: usize) -> Vec<(usize, usize)> {
        (0..n)
            .map(|_| (self.read::<usize>() - 1, self.read::<usize>() - 1))
            .collect()
    }
    pub fn read_chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
    pub fn read_char_grid(&mut self, n: usize) -> Vec<Vec<char>> {
        (0..n).map(|_| self.read_chars()).collect()
    }
    pub fn read_matrix<T: std::str::FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<T>> {
        (0..n)
            .map(|_| (0..m).map(|_| self.read()).collect())
            .collect()
    }
}


Measured memory_bytes: 2208
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//using namespace __gnu_pbds;

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define lb lower_bound
#define ub upper_bound

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
//template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
const ll mod=1000000007;
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;}

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

  	string s;
  	cin >> s;
  	cout << s.rfind('Z') - s.find('A') + 1 << endl;
	return 0;
}


Measured memory_bytes: 720
#include<bits/stdc++.h>
#define ll long long int
#define pragi(a,b) for(ll i = a;i<b;i++)
#define pragj(a,b) for(ll j = a;j<b;j++)
#define pragk(a,b) for(ll k = a;k>=b;k--)
#define all(v) (v.begin(),v.end())
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define MP make_pair
#define MT make_tuple
#define F first
#define S second
#define KAKA ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const int mod = 1e9 + 7;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef long double ld;
typedef pair<int, int> pii;
//typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef pair<ll, ll> pll;

void Compute(ll x)
{
    KAKA
    vector<bool> primes(1e6,true);
    primes[0] = false;
    primes[1] = false;
    pragi(2,primes.size())
    {
        if(primes[i]){
        for(ll j = 2;i*j < primes.size();j++)
        {
            
                primes[i*j] = false;
            
        }}
    }
    vl vec;
    pragi(0,primes.size())
    {
      if(primes[i])
      vec.eb(i);
    }
    auto it = lb(vec.begin(),vec.end(),x);
    cout<<*it<<"\n";
}
int main()
{
    KAKA
    ll x;
    cin>>x;
    Compute(x);
}

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


void solve () {
    int n, m;
    cin >> n >> m;
    unordered_map <int , vector<int>> mp;
    vector<pair <int, int>> a(m);
    for (int i = 0; i < m; i++) {
        int p, y;
        cin >> p >> y;
        mp[p].push_back(y);
        a[i].first = p;
        a[i].second = y;
    }
    for (auto t = mp.begin(); t != mp.end(); t++) {
        sort((*t).second.begin(), (*t).second.end());
    }
    for (int i = 0; i < m; i++) {
        int p = a[i].first;
        int y = a[i].second;
        printf("%06d", p);
        int l = lower_bound(mp[p].begin(), mp[p].end(), y) - mp[p].begin();
        printf("%06d\n", l + 1);
    }
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    solve();
    return 0;
}


Measured memory_bytes: 12700
#include<bits/stdc++.h>
using namespace std;
void *wmem;
inline void rd(int &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline int rd(char c[]){
  int i, sz=0;
  for(;;){
    i = getchar_unlocked();
    if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF){
      break;
    }
  }
  c[sz++] = i;
  for(;;){
    i = getchar_unlocked();
    if(i==' '||i=='\n'||i=='\r'||i=='\t'||i==EOF){
      break;
    }
    c[sz++] = i;
  }
  c[sz]='\0';
  return sz;
}
inline void rd(string &x){
  char *buf=(char *)wmem;
  rd(buf);
  x = buf;
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(const char c[]){
  int i=0;
  for(i=0;c[i]!='\0';i++){
    putchar_unlocked(c[i]);
  }
}
char memarr[96000000];
int N;
string W[100];
int main(){
  int i;
  wmem = memarr;
  rd(N);
  {
    int Lj4PdHRW;
    for(Lj4PdHRW=0;Lj4PdHRW<N;Lj4PdHRW++){
      rd(W[Lj4PdHRW]);
    }
  }
  for(i=1;i<N;i++){
    if(W[i-1][W[i-1].size()-1] != W[i][0]){
      wt_L("No");
      wt_L('\n');
      return 0;
    }
  }
  sort(W, W+N);
  for(i=1;i<N;i++){
    if(W[i-1]==W[i]){
      wt_L("No");
      wt_L('\n');
      return 0;
    }
  }
  wt_L("Yes");
  wt_L('\n');
  return 0;
}
// cLay varsion 20190721-1

// --- original code ---
// int N;
// string W[100];
// {
//   int i;
//   rd(N,W(N));
// 
//   rep(i,1,N) if(W[i-1][W[i-1].size()-1] != W[i][0]){
//     wt("No");
//     return 0;
//   }
// 
//   sort(W, W+N);
//   rep(i,1,N) if(W[i-1]==W[i]){
//     wt("No");
//     return 0;
//   }
// 
//   wt("Yes");
// }


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

int main() {
  string S;
  cin >> S;
  
  if((S.at(0) == 'A' && S.at(1) == 'A' && S.at(2) == 'A') || (S.at(0) == 'B' && S.at(1) == 'B' && S.at(2) == 'B')){
    cout << "No" << endl;
  }
  else{
    cout << "Yes" << endl;
  }
}


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

#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define all(x) x.begin(),x.end()
typedef long long ll;
ll mod = 1000000007;
ll inf = 1e18;
int main(){

    int x;
    cin >> x;
    ll a,b;
    bool ans=false;

    for(a=-120; a<=120; a++){
        for(b=-120; b<=120; b++){
            if(a*a*a*a*a-b*b*b*b*b==x){
                cout << a << ' ' << b << endl;
                ans=true;
                break;
            }
        }
        if(ans) break;
    }
    
    return 0;
}

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

using namespace std;
using ll = long long;

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

  string s;
  int k;
  cin >> s >> k;

  auto cmp = [](const string &s1, const string &s2) {
    int n1 = s1.size();
    int n2 = s2.size();
    for (int i = 0;; i++) {
      if (i < n1 && i < n2) {
        if (s1[i] < s2[i])
          return true;
        else if (s1[i] > s2[i])
          return false;
      } else if (i < n1) {
        return false;
      } else if (i < n2) {
        return true;
      }
    }
    return true;
  };

  vector<string> v;
  set<string> st;
  int n = s.size();
  for (int i = 0; i < n; i++) {
    for (int len = 1; len <= 5; len++) {
      if (i + len > n)
        continue;
      string t = s.substr(i, len);
      if (st.count(t) > 0)
        continue;
      v.push_back(t);
      st.insert(t);
    }
  }
  sort(v.begin(), v.end(), cmp);
  cout << v[k - 1] << endl;

  return 0;
}


Measured memory_bytes: 4836
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#include <map>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
typedef long long ll;

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


int main(){
    ll n;
    cin >> n;
    vector<ll> a(n);
    REP(i,n){
        cin >> a[i];
    }
    string ans = "YES";
    sort(a.begin(),a.end());
    REP(i,n-1){
        if(a[i] == a[i+1]){
            ans = "NO";
        }
    }
    cout << ans << endl;
}


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

int main(){
  int min, max;
  cin >> min >> max;
  int anser = 0;
  for(int i = min; i <= max; i++){
    string str = to_string(i);
    if(str[0] == str[4] && str[1] == str[3]) anser++;
  }
  cout << anser << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// define
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (a * b) % mod
#define rollcall cout << "I'm Sucu." << endl;
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define fi first
#define se second
// debug
template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p){
  os << "(" << p.first << "," << p.second << ")";return os;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v){
  for (auto it = v.begin();it != v.end();++it){
    if(it != v.begin())os << " ";os << *it;
      }return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &mp){
  for(auto x: mp)os << "(" << x.first << "," << x.second << ")" << endl;
  return os;
}
template<typename T, int SIZE>
int array_length(const T (&)[SIZE]){return SIZE;}
template<typename T, int N>
void PRINTF(const T (&a)[N], int s = N, int t = -1, bool f = true){
	if(t == -1){rep(i,s){if(i)cout << " ";cout << a[i];}}
	else repi(i,s,t){if(i!=s)cout << " ";cout << a[i];}
	if(f)cout << "\n";
}
template<typename T, int N1, int N2>
void PRINTF(const T (&a)[N1][N2], int h = N1, int w = N2){
	rep(i,h){rep(j,w){cout << a[i][j] << " \n"[j==w-1];}}
}
// typedef
typedef complex<double> Point;
typedef pair<int,int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;

const int MAX = 3e5;
string str;
vector<int> G[MAX];
int numA[MAX], numB[MAX];
bool deleted[MAX];

void del(int now){
  if(deleted[now])return;
  deleted[now] = true;
  rep(i,G[now].size()){
    int to = G[now][i];
    if(deleted[to])continue;
    if(str[now] == 'A')numA[to]--;
    else numB[to]--;
    if(numA[to] == 0 or numB[to] == 0)del(to);
  }
  return;
}

signed main(){
  int n, m;
  scanf("%lld%lld", &n, &m);
  cin >> str;
  rep(i,m){
    int x, y;
    scanf("%lld%lld", &x, &y);x--;y--;
    if(str[y] == 'A')numA[x]++;
    else numB[x]++;
    if(str[x] == 'A')numA[y]++;
    else numB[y]++;
    G[x].pb(y);G[y].pb(x);
  }
  fill(deleted, deleted+MAX, false);
  rep(i,n){
    if(numA[i] == 0 or numB[i] == 0)del(i);
  }
  rep(i,n){
    if(!deleted[i]){printf("Yes\n");return 0;}
  }
  printf("No\n");
	return 0;
}










Measured memory_bytes: 20868
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

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

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

template <typename T>
class lazy_segment_tree{
    private:
        static int calc_size(int n){
            int m = 1;
            while(m < n){
                m *= 2;
            }
            return m;
        }

        void eval(int i, int l, int r){
            if(lazy[i] != -1){
                node[i] = lazy[i];
                if(r - l > 1){
                    lazy[i * 2 + 1] = lazy[i];
                    lazy[i * 2 + 2] = lazy[i];
                }
                lazy[i] = -1;
            }
        }

        void add(int s, int t, int x, int i, int l, int r){
            eval(i, l, r);

            if(t <= l || r <= s){
                return ;
            }

            if(s <= l && r <= t){
                lazy[i] = x;
                eval(i, l, r);
                return;
            }

            int m = l + (r - l) / 2;
            add(s, t, x, 2 * i + 1, l, m);
            add(s, t, x, 2 * i + 2, m, r);
            node[i] = node[2 * i + 1] + node[2 * i + 2];
        }

        T query(int s, int t, int i, int l, int r){
            eval(i, l, r);

            if(t <= l || r <= s){
                return 0;
            }

            if(s <= l && r <= t){
                return node[i];
            }

            int m = l + (r - l) / 2;
            T vl = query(s, t, i * 2 + 1, l, m);
            T vr = query(s, t, i * 2 + 2, m, r);
            return vl + vr;
        }

    public:
        int n;
        vector<T> node, lazy;
        T init;
        function<T(T, T)> f;

        lazy_segment_tree(int n, T init, function<T(T, T)> f)
            : n(calc_size(n)), node(calc_size(n) * 2, init) , lazy(calc_size(n) * 2, -1), init(init), f(f) {}

        void update(int i, const T& x){
            node[i + n] = x;
            for(int j = (i + n) / 2; j > 0; j /= 2){
                node[j] = node[j * 2] + node[j * 2 + 1];
            }
        }

        T query(int s, int t){
            return query(s, t, 0, 0, n);
        }

        void add(int s, int t, int x){
            add(s, t, x, 0, 0, n);
        }
};

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

    lazy_segment_tree<int> lst(n+1, (1LL << 31)-1, [](int a, int b){return a+b;});
    rep(i, q){
        int qq;
        cin >> qq;

        if(qq == 0){
            int s, t, x;
            cin >> s >> t >> x;
            lst.add(s, t+1, x);
        }

        if(qq == 1){
            int i;
            cin >> i;
            cout << lst.query(i, i+1) << endl;
        }
    }

    return 0;
}



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

using namespace std;

int N, M;
int x[100];
int memo[110][110][10];
int a[10], b[10], c[10];

int rec(int L, int R, int m)
{
    if (R - L == 0) {
	return (x[L] == a[m] ? 1 : 2);
    }
    int &res = memo[L][R][m];
    if (res > 0) return res;
    res = 2;
    for (int i = L; i <= R; i++) {
	int d = rec(L, i, b[m]);
	int e = rec(i + 1, R, c[m]);
	if (d == 1 && e == 1) {
	    res = 1;
	    break;
	}
    }
    return res;
}

int main()
{
    cin >> N;
    for (int i = 0; i < N; i++) {
	cin >> x[i];
    }
    cin >> M;
    for (int i = 0; i < M; i++) {
	cin >> a[i] >> b[i] >> c[i];
	b[i]--; c[i]--;
    }
    memset(memo, 0, sizeof(memo));
    cout << (rec(0, N - 1, 0) == 1 ? "Yes" : "No") << endl;
    return 0;
}

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

using namespace std;

int n;
long long a,b;
long long h[100000];

bool eno(long long t)
{
	int j=0;
	long long cnt=0;
	long long s[100000];
	for(int i=0;i<n;i++)
	{
		s[i]=h[i];
	}
	sort(s,s+n);
	reverse(s,s+n);
	for(int i=0;i<n;i++)
	{
		s[i] -= b*t;
	}
	while(j<n)
	{
		if(s[j]<0)
		{
			j++;
			continue;
		}
		cnt+=(s[j]/(a-b));
		//cerr<<t<<" "<<s[j]<<" "<<cnt<<endl;
		if(s[j]%(a-b)!=0)
		{
			cnt++;
		}
		if(cnt>t)
		{
			return false;
		}
		j++;
	}
	return true;
}

int main()
{
	long long ans;
	long long mid;
	long long l=-1;
	long long r=1e9+7;
	cin>>n>>a>>b;
	for(int i=0;i<n;i++)
	{
		cin>>h[i];
	}
	mid = (l+r)/2;
	while(abs(r-l)>1)
	{
		//cerr<<mid<<endl;
		mid = (l+r)/2;
		if(eno(mid)==true)
		{
			r=mid;
		}else{
			l=mid;
		}
	}
	
	if(eno(l)==true)
	{
		ans = l;
	}else{
		ans = r;
	}
	cerr<<l<<" "<<mid<<" "<<r<<endl;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define REP(i, d, n) for(int i=(d); i<(n); ++i)
#define all(v) v.begin(), v.end()
using ll = long long;
int main() {

int n,l;cin>>n>>l;
  vector<int>azi(n);
  int sum=0;int sumhantei=0;
  rep(i,n){azi.at(i)=l+i;}
  rep(k,n){sum=sum+azi.at(k);}
  
  vector<int>hantei(n);  
  rep(m,n){
    if(azi.at(m)<0){
      hantei.at(m)=9999; azi.at(m)=0-azi.at(m);}
    else{hantei.at(m)=0;}
  }
  
  int azimin=10000000;
  int worst=0;
  rep(j,n){
    if(azimin>azi.at(j)){
      azimin=azi.at(j);worst=hantei.at(j);}
  }
  
  if(worst>9){cout<<sum+azimin<<endl;}
  else{cout<<sum-azimin<<endl;}
}


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

int main(void){
double x1, x2, y1, y2;
double l;

scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);

l = sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
printf("%0.8lf", l);


return 0;

}


Measured memory_bytes: 2044
#include<iostream>
using namespace std;
long long a[55][55];
long long b[55][55];
int n;
void mul(long long x[55][55],long long y[55][55]){
	long long c[n][n];
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			c[i][j]=0;
			for(int k=0;k<n;k++){
				c[i][j]=(c[i][j]+x[i][k]*y[k][j])%(1000000007);
			}
		}
	}
	for(int i=0;i<n;i++)for(int j=0;j<n;j++)x[i][j]=c[i][j];
}
void pow(long long int p){
	if(p==1)return ;
	pow(p/2);
	mul(b,b);
	if(p%2)mul(b,a);
}
int main()
{
	long long k;
	cin>>n>>k;
	for(int i=0;i<n;i++)for(int j=0;j<n;j++){cin>>a[i][j];b[i][j]=a[i][j];}
	pow(k);
	long long ans=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			ans=(ans+b[i][j])%(1000000007);
		}
	}
	cout<<ans;
}

Measured memory_bytes: 256
n,m,x = map(int, input().split())
a = list(map(int, input().split()))
ans1 = 0
ans2 = 0
for i in range(x, n+1):
  if i in a:
    ans1 += 1
while x > 0:
  if x in a:
    ans2 += 1
  x-=1
print(min(ans1,ans2))

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int x; cin>>x;
	int i=0,j=0;
	for(;i<1000;++i){
		j=0;
		for(;j<1000;++j){
			if(x==powl(i,5)-powl(j,5))goto end;
			if(x==powl(i,5)+powl(j,5)){
				j*=-1; goto end;
			}
		}
	}
	end:
	cout<<i<<" "s<<j<<"\n"s;
}

Measured memory_bytes: 3660
#include <iostream>
#include <algorithm>

int main()
{
  long long l,r;
  std::cin >> l >> r;
  
  if( 2019 <= (r-l) ) { std::cout << 0; return 0; }

  int minNow = 2019;
  for(long long i=l; i<=r; i++)
  {
    for(long long j=i+1; j<=r; j++)
    {
      minNow = std::min<int>(minNow, (i*j)%2019); 
    }
  }
 
  std::cout << minNow;
  return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        AMultiplication1 solver = new AMultiplication1();
        solver.solve(1, in, out);
        out.close();
    }

    static class AMultiplication1 {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            out.println(in.nextInt() * in.nextInt());
        }

    }

    static class InputReader {
        public final BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

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

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

    }
}



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

using namespace std;

int main()
{
    int x, cnt[5];
    memset(cnt, 0, sizeof(cnt));
    for (int i = 1; i <= 6; i++)
    {
        cin >> x;
        cnt[x]++;
        if (cnt[x] > 2)
            return cout << "NO", 0;
    }
    cout << "YES";
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <utility>
#include <climits>
#include <vector>
#include <map>
#include <queue>
using namespace std;

#define ll long long
const int MOD = 1000000007;//10^9+7

ll max(ll a, ll b) {

	if (a > b)return a;
	else return b;

}
double max(double a, double b) {

	if (a > b)return a;
	else return b;

}
//a??¨b?????§?????????

ll min(ll a, ll b) {

	if (a < b)return a;
	else return b;

}
//a??¨b????°??????????

ll avd_i(ll a, ll b) {

	if (a > b)return a - b;
	else return b - a;

}
double avd_d(double a, double b) {

	double re;
	if (a > b)re = a - b;
	else re = b - a;
	return re;

}
//a??¨b???????????¶??????

ll powsur(ll a, ll b, ll p) {

	if (b == 0) {

		return 1;

	}
	else if (b % 2 == 0) {

		ll d = powsur(a, b / 2, p);
		return ((d%p)*(d%p)) % p;

	}
	else {

		return ((a%p)*powsur(a, b - 1, p) % p) % p;

	}

}
//p????´???°,a???b??????p??§?????£?????????

ll CMOD(ll n, ll r, ll p) {

	ll a = 1, b = 1, c = 1, re;
	for (int i = 1; i <= n; i++) {

		a *= i;
		a = a%p;

	}
	for (int i = 1; i <= r; i++) {

		b *= i;
		b = b%p;

	}
	for (int i = 1; i <= n - r; i++) {

		c *= i;
		c = c%p;

	}
	b = powsur(b, p - 2, p);
	c = powsur(c, p - 2, p);
	re = ((a%p)*(b%p)) % p;
	re = ((re%p)*c%p) % p;

	return re;

}
//p????´???°,(nCr)%p

ll gcd(ll a, ll b) {

	if (a > b) {

		ll tmp = a;
		a = b;
		b = tmp;

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

}
//?????§??¬?´???°

ll lcm(ll a, ll b) {

	return (a / gcd(a, b))*b;

}
//????°???¬?????°

int main() {
	
	int a[3];

	cin >> a[0] >> a[1] >> a[2];

	sort(a, a + 3);

	printf("%d %d %d\n", a[0], a[1], a[2]);

	return 0;
}

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

int main(){
  long long N;
  cin >> N;
  long long t = N, f = 0;
  while (t > 0){
    f += t % 10;
    t /= 10;
  }
  
  if (N % f == 0){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

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

int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    if(a+b == c || b+c == a || a+c == b){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
#include <deque>
#include <complex>
#include <bitset>

using namespace std;

/*
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
*/

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<long long, long long> pll;
typedef vector<pll> vpll;

typedef long double ld;
typedef vector<ld> vld;

typedef vector<bool> vb;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, n) for (ll i = 1; i <= (n); i++)
#define rrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rreps(i, n) for (ll i = (n); i >= 1; i--)
#define all(v) (v).begin(), (v).end()

template <class T> void chmin(T& a, T b) { a = min(a, b);}
template <class T> void chmax(T& a, T b) { a = max(a, b);}

constexpr int INF = 1 << 30;
constexpr ll INFL = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr ld EPS = 1e-12;
ld PI = acos(-1.0);

void solve() {
    ll n;
    cin >> n;
    vll a_(n);
    rep(i, n) cin >> a_[i];
    ll x = 0;
    rep(i, n) x ^= a_[i];
    ll a = a_[0], b = a_[1];
    x ^= a ^ b;
    ll s = a + b;

    vector<vvll> dp(42, vvll(2, vll(2, -1)));
    // i:桁、j:桁あふれ、k:より大きい
    dp[0][0][0] = 0;
    rep(i, 41) {
        ll ca = a & 1;
        ll cx = x & 1;
        ll cs = s & 1;
        rep(j, 2) rep(k, 2) {
            if(dp[i][j][k] == -1) continue;
            rep(na, 2) rep(nb, 2) {
                if((na ^ nb) != cx) continue;
                ll ns = na + nb + j;
                if(ns % 2 != cs) continue;
                ll nj = (ns >= 2 ? 1 : 0);
                ll nk;
                if(na < ca) nk = 0;
                else if(na > ca) nk = 1;
                else nk = k;
                chmax(dp[i + 1][nj][nk], dp[i][j][k] + ((1ll << i) * na));
            }
        }
        a >>= 1;
        x >>= 1;
        s >>= 1;
    }
    a = dp[41][0][0];
    if(a == -1 || a == 0) {
        cout << -1 << endl;
        return;
    }
    ll ans = a_[0] - a;
    cout << ans << endl;
    return;
}

int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
const int MN = 100100;
//MAX MIN
ll dp[MN][2];
vl v,w;
int main() {
	memset(dp,0,sizeof(dp));
	ll n;
	scanf("%lld",&n);
	ll rn;
	scanf("%lld",&rn);
	for(int i=0;i<n-1;i++) {
		char op;
		ll val;
		scanf(" %c %lld",&op,&val);
		if(op == '-') {
			w.push_back(rn);
			rn = 0;
			v.push_back(val);
		} else {
			rn += val;
		}
	}
	w.push_back(rn);
	for(int i=v.size()-1;i>=0;i--) {
		ll po = w[i+1]-v[i];
		ll pa = -w[i+1]-v[i];
		dp[i][0] = max(po+dp[i+1][0],pa-dp[i+1][1]);
		dp[i][1] = min(pa+dp[i+1][1],pa-dp[i+1][0]);
	}
	printf("%lld\n",w[0]+dp[0][0]);
}

Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,i,n,s=0;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		cin>>a>>b;
		s+=b-a+1;
	}
	cout<<s<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main() {
	int A[10];
	int S=0, M=0, L=0;
	int hold;
	for (int i = 0; i < 10; i++) {
		scanf("%d", &A[i]);
	}
	for (int j = 0; j < 10; j++) {
		if (L < A[j]) {
			L = A[j];
			hold = j;
		}
	}
	A[hold] = 0;
	for (int j = 0; j < 10; j++) {
		if (M < A[j]) {
			M = A[j];
			hold = j;
		}
	}
	A[hold] = 0;
	for (int j = 0; j < 10; j++) {
		if (S < A[j]) {
			S = A[j];
		}
	}
	printf("%d\n%d\n%d\n", L, M, S);


	return 0;
}


Measured memory_bytes: 2716
#include <iostream>
using namespace std;
int main(){
    long int a,b,lcm=0,r,x,y,count=0;
    while(cin>>a>>b){
        count++;
        if(count==50)break;
        x=a;
        y=b;
        while(1){
        r=a%b;
        a=b;
        b=r;
        if(r==0)break;
        }
        lcm=a;
    cout<<lcm<<" "<<x*y/lcm<<endl;
}
}

Measured memory_bytes: 3068