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

# define F first    
# define S second
      
# define pb push_back
# define sz(a) (int)(a.size())
# define vec vector

# define y1    Y_U_NO_y1
# define left  Y_U_NO_left
# define right Y_U_NO_right  

using namespace std;

typedef pair <int, int> pii; 
typedef long long ll;
typedef long double ld;

const int Mod = (int)1e9 + 7;
const int MX = 1073741822;
const ll MXLL = 4e18;
const int Sz = 1110111;

inline void Read_rap () {
  ios_base :: sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}
inline void randomizer3000 () {
  unsigned int seed;
  asm ("rdtsc" : "=A"(seed));
  srand (seed);
}
void files (string problem) {   
  if (fopen ((problem + ".in").c_str(),"r")) {
    freopen ((problem + ".in").c_str(),"r",stdin);
    freopen ((problem + ".out").c_str(),"w",stdout);
  }
}
int q;
      
bool pr[Sz];

int pref[Sz];

const int N = 1e5;

void Sieve (int N) {
	for (int i = 2; i <= N; i++) {
		if (!pr[i] && (1ll * i * i) <= N) {
			for (int j = i * i; j <= N; j += i)
				pr[j] = 1;
	  }
	}             
}

int main() 
{
  Read_rap ();
  Sieve (N);
  for (int i = 2; i <= N; i++) {
  	if ((i & 1) && !pr[i] && (!pr[(i+1)/2]))
  		pref[i]++;
  	pref[i] += pref[i - 1];
  }
  int q; cin >> q;
  while (q--) {
  	int l, r; cin >> l >> r;
  	cout << pref[r] - pref[l - 1] << endl;
  }	
  	     

  return 0;
} 










// Coded by Z..

Measured memory_bytes: 1152
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <time.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

struct Point{
	double x,y;
};

int N;
double a[32],b[32],c[32],d[32];

Point calc_Cross_Point(double x1,double x2,double x3,double x4,double y1,double y2,double y3,double y4){
	Point ret;
	ret.x = ((x2-x1)*(y3*(x4-x3)+x3*(y3-y4))-(x4-x3)*(y1*(x2-x1)+x1*(y1-y2)))/((y2-y1)*(x4-x3)-(y4-y3)*(x2-x1));
	if(x1 != x2){
		ret.y = ((y2-y1)*ret.x+y1*(x2-x1)+x1*(y1-y2))/(x2-x1);
	}else{
		ret.y = ((y4-y3)*ret.x+y3*(x4-x3)+x3*(y3-y4))/(x4-x3);
	}
	return ret;
}

double calc_S(Point a,Point b,Point c,Point d){
	return fabs((b.x*a.y - b.y*a.x)+(c.x*b.y - c.y*b.x)+(d.x*c.y - d.y*c.x)+(a.x*d.y - a.y*d.x))/2;
}

void func(){
	a[0] = 0;
	b[0] = 0;
	c[0] = 0;
	d[0] = 0;
	for(int i = 1; i <= N; i++)scanf("%lf",&a[i]);
	for(int i = 1; i <= N; i++)scanf("%lf",&b[i]);
	for(int i = 1; i <= N; i++)scanf("%lf",&c[i]);
	for(int i = 1; i <= N; i++)scanf("%lf",&d[i]);
	a[N+1] = 1;
	b[N+1] = 1;
	c[N+1] = 1;
	d[N+1] = 1;

	double ans = 0;

	Point A,B,C,D;

	for(int yoko = 0; yoko <= N; yoko++){
		for(int tate = 0; tate <= N; tate++){

			A = calc_Cross_Point(0,1,b[yoko],a[yoko],c[tate+1],d[tate+1],1,0);
			B = calc_Cross_Point(0,1,b[yoko+1],a[yoko+1],c[tate+1],d[tate+1],1,0);
			C = calc_Cross_Point(0,1,b[yoko+1],a[yoko+1],c[tate],d[tate],1,0);
			D = calc_Cross_Point(0,1,b[yoko],a[yoko],c[tate],d[tate],1,0);

			ans = max(ans,calc_S(A,B,C,D));
		}
	}

	printf("%.10lf\n",ans);
}

int main(){

	while(true){
		scanf("%d",&N);
		if(N == 0)break;

		func();
	}

	return 0;
}

Measured memory_bytes: 3168
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

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

    int a[n], b[n], c[n];
    rep(i, n)
    {
        cin >> a[i];
        a[i]--;
    }
    rep(i, n) cin >> b[i];
    rep(i, n - 1) cin >> c[i];
    int sum = 0;
    rep(i, n - 1)
    {
        sum += b[a[i]];
        if (a[i] + 1 == a[i + 1])
        {
            sum += c[a[i]];
        }
    }
    sum += b[a[n - 1]];

    OP(sum);
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		int a=scan.nextInt();
		int b[]=new int[a];
		int max=0;
		for(int i=0;i<a;i++) {
			b[i]=scan.nextInt();
			max+=b[i];
		}
		int ans=1145141919;
		int co=0;
		for(int i=0;i<a;i++) {
			co+=b[i];
			if(Math.abs(co-(max-co))<ans) {
				ans=Math.abs(co-(max-co));
			}
		}
		System.out.println(ans);
		}
}


Measured memory_bytes: 21716
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define Cout2(x, y) cout << (x) << " " << (y) << endl
#define dump(x) cout << #x << " = " << (x) << endl;
#define forauto(i, a) for(auto i : a)cout << i << " "; puts("");
typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = 1e9;
const double pi = acos(-1.0);

int solve(string s) {
	string mi = s; sort(all(mi));
	string ma = s; sort(all(ma), greater<int>());

	int ret = stoi(ma) - stoi(mi);
	return ret;
}

int main() {
	int n; cin >> n;
	rep(i, n) {
		string s; cin >> s;
		Cout(solve(s));
	}
}


Measured memory_bytes: 3044
import math
 
number = int(input())
 
def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
    return True

for i in range(10000000):
    if is_prime(number):
        print(number)
        break
    else:
        number += 1


Measured memory_bytes: 38896
#include <stdio.h>

int main(){
	int A,B,C,D,E,sum,average = 0;
	scanf("%d %d %d %d %d",&A,&B,&C,&D,&E);
	if(A<40){
		A =40;
	}
	if(B<40){
		B =40;
	}
	if(C<40){
		C =40;
	}
	if(D<40){
		D =40;
	}
	if(E<40){
		E =40;
	}
	sum = A+B+C+D+E;
	average = sum/5;
	printf("%d\n",average);
	return 0;
}

Measured memory_bytes: 2668
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <functional>
#include <cstring>
#include <set>
using namespace std;

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

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

	string ans = "CODEFESTIVAL2016";
	string s; cin>>s;
	int cnt = 0;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] != ans[i])cnt++;
	}

	cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 256
require 'pp'

def gets; ARGF.gets; end

class Solver

  def main
    x, y = gets.chomp.split.map(&:to_i)

    cur = x
    ans = 1
    loop do
      cur *= 2
      break if y < cur

      ans += 1
    end

    puts ans
  end
end

if __FILE__ == $0
  Solver.new.main
end


Measured memory_bytes: 2172
program main
    implicit none
    integer(8) N, i
    integer(8), allocatable :: A(:), boss(:)
    read *, N
    allocate(A(N))
    allocate(boss(N - 1))
    read *, boss
    do i = 1, N - 1
        A(boss(i)) = A(boss(i)) + 1
    end do
    do i = 1, N
        print '(I0)', A(i)
    end do
    stop
contains

end program main

Measured memory_bytes: 6264
#include<iostream>
#include<vector>
using namespace std;
 
const int N = 8010;
bool dpx[N][N*2];
bool dpy[N][N*2];
 
int main() {
    string s;
    cin >> s;
    int x, y;
    cin >> x >> y;
    x += N;
    y += N;
 
    bool isx = true;
    vector<int> xv, yv;
    int cnt = 0;
    for(char c : s) {
        if(c == 'T') {
            if(isx) xv.push_back(cnt);
            else yv.push_back(cnt);
            isx = !isx;
            cnt = 0;
        } else {
            cnt++;        
        }
    }
    if(isx) xv.push_back(cnt);
    else yv.push_back(cnt);

    dpx[0][N] = true;
    for(int i = 1; i <= xv.size(); i++) {
        for(int j = 0; j < N * 2; j++) {
            if(j - xv[i-1] >= 0) dpx[i][j] |= dpx[i-1][j - xv[i-1]];
            if(i != 1 && j + xv[i-1] < N * 2) dpx[i][j] |= dpx[i-1][j + xv[i-1]];
        }
    }
    dpy[0][N] = true;
    for(int i = 1; i <= yv.size(); i++) {
        for(int j = 0; j < N * 2; j++) {
            if(j - yv[i-1] >= 0) dpy[i][j] |= dpy[i-1][j - yv[i-1]];
            if(j + yv[i-1] < N * 2) dpy[i][j] |= dpy[i-1][j + yv[i-1]];
        }
    }

    if(dpx[(int)xv.size()][x] && dpy[(int)yv.size()][y]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    } 
 
    return 0;
}

Measured memory_bytes: 127232
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
#define fast                                                                   \
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long
#define ll long long
#define f(i, n) for (int i = 0; i < n; i++)
#define fo(i,a,n) for (i = a; i <= n; i++)
#define F first
#define S second
#define pii pair<int,int>
#define sz size()
#define all(v) v.begin(),v.end()
#define pb push_back
#define pf push_front    
#define PB pop_back
#define pll pair<long long, long long>
#define vi vector<int>
#define vl vector<int>
#define mp make_pair
#define mod 1000000007
typedef unsigned long long ull;
const int N = 200005;
const int MOD = 998244353 ;



void solve(){
    int n;
    cin>>n;
    int a[n+3];
    f(i,n)cin>>a[i];
    f(i,n){
        if(a[i] % 2 == 0){
            if(a[i]%3 != 0 && a[i]%5 != 0){cout<<"DENIED";return ;}
        }
    }
    cout<<"APPROVED";
}

int32_t main() {
    fast
    int t;
    t = 1;
    //cin >> t;
    while(t--)solve();
    return 0;
}


Measured memory_bytes: 256
# python3

#===============================================================================
from collections import defaultdict, Counter
from functools import lru_cache
from heapq import heappush, heappop
from math import gcd, floor, ceil
from sys import stdin, stdout

def ilist():
    return [int(x) for x in stdin.readline().strip().split(" ")]
def iint():
    return int(stdin.readline().strip())
def istr():
    return stdin.readline().strip()
##==============================================================================


def solve():
    pass


if __name__ == '__main__':
    N, K = ilist()
    di = [0] * (N + 1)
    for _ in range(K):
        d = iint()
        A = ilist()
        for i in range(d):
            di[A[i]] = 1
    print(N - sum(di))


Measured memory_bytes: 68360
#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define UNIQUE(v) { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); }
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return true;} return false; }
template<class T> bool chmin(T &a, const T &b) {if (a > b) {a = b; return true;} return false; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) (q ? "Yes" : "No")
#define YES(q) (q ? "YES" : "NO")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) { cerr << "[DEBUG] " #q ": ["; REP(dumpall_i, (q).size()) { cerr << q[dumpall_i] << (dumpall_i == (q).size() - 1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl; }
template<class T> T gcd(const T &a, const T &b) { return a < b ? gcd(b, a) : b ? gcd(b, a % b) : a; }
template<class T> T lcm(const T &a, const T &b) { return a / gcd(a, b) * b; }

// gcc拡張マクロ
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
using  ll = long long;
using ull = unsigned long long;
using  ld = long double;
using namespace std;

// モジュール
struct restaurant {
    ll i = 0;
    string s = "";
    ll p = 0;
};

// 処理内容
int main() {
    
    ll n; cin >> n;

    vector<restaurant> s;
    REP(i, n) {
        restaurant r;
        r.i = i + 1;
        cin >> r.s >> r.p;
        s.emplace_back(r);
    }

    sort(ALL_OF(s), [](restaurant &p, restaurant &q) -> bool {
        if (p.s == q.s) {
            return p.p > q.p;
        } else {
            return p.s < q.s;
        }
    });

    REP(i, n) {
        cout << s[i].i << endl;
    }
    
}

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

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

int max_n = 20 ;
int max_q = 200 ;
int n, q ;
vector<int> s(max_n+5) ;
vector<int> t(max_q+5) ;

bool solve( int key, int sum, int i) {
  if ( i == n ) return sum == key ;

  if ( solve(key, sum, i+1) ) return true ;

  if ( solve(key, sum + s.at(i), i+1) ) return true ;

  return false ;
}

int main()
{
  cin >> n ;
  rep(i,n){
    cin >> s.at(i) ;
  }
  cin >> q ;
  rep(i,q) {
    cin >> t.at(i) ;
  }

  rep(i,q) {
    int key = t.at(i) ;
    if ( solve(key, 0, 0) ) {
      cout << "yes" << endl ;
    }else{
      cout << "no" << endl ;
    }
  }

  return 0 ;
}


Measured memory_bytes: 3112
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
using vl = vector<ll>;
using vvl = vector<vl>;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
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;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

long long gcd(long long a, long long b) {
    for(;;) {
        if(a == 0)
            return b;
        b %= a;
        if(b == 0)
            return a;
        a %= b;
    }
}

long long lcm(long long a, long long b) {
    long long temp = gcd(a, b);
    return temp ? (a / temp * b) : 0;
}

int main() {
    int N, P;
    cin >> N >> P;
    vector<int> A(N);
    map<int, int> cnt;
    REP(i, N) {
        cin >> A[i];
        A[i] %= 2;
        cnt[A[i]]++;
    }
    long long com[51][51];
    com[0][0] = 1;
    for(int i = 1; i < 51; ++i) {
        for(int j = 0; j <= i; ++j) {
            com[i][j] += com[i - 1][j];
            if(j > 0) {
                com[i][j] += com[i - 1][j - 1];
            }
        }
    }
    ll ans = 1LL;
    ans *= pow(2, cnt[0]);
    // cout << ans << endl;
    //奇数のとき
    ll bns = 0LL;
    for(int i = P; i <= cnt[1]; i += 2) {
        bns += com[cnt[1]][i];
    }
    cout << ans * bns << endl;
    return 0;
}

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

namespace AtTest.ABC118
{
    class C
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            int n = ReadInt();
            int[] array = ReadInts();
            long res = array[0];
            for(int i = 1; i < n; i++)
            {
                res = GCD(res, array[i]);
            }
            Console.WriteLine(res);
        }

        static long GCD(long a, long b)
        {
            if (b > a)
            {
                long temp = b;
                b = a;
                a = temp;
            }
            long c = b;
            do
            {
                c = a % b;
                a = b;
                b = c;
            } while (c > 0);
            return a;
        }

        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


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

int main() {
	string s, t;
	cin >> s >> t;
	sort(s.begin(), s.end());
	sort(t.begin(), t.end(), greater<char>());
	if (s < t) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <vector>
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include <cmath>
#include <iomanip>
#include <ctype.h>

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi >;
using vl = vector<ll>;
using vvl = vector<vl >;
using pairi = pair<int, int>;
using pairl = pair<ll, ll>;

#define TR ","
#define TS " "
#define rep(i,N) for(ll i=0;i<(ll)N;++i)
#define rpt(i,a,b) for(ll i=a;i<(ll)b;++i)
#define all(v) v.begin(), v.end()
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)

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

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

void printVector(const vector<ll>& vec) {
    for (ll value : vec) {
        cout << value << " ";
    }
    cout << endl;
}

vector<int> IntegerToVector(int bit, int N) {
    vector<int> S;
    for (int i = 0; i < N; ++i) {
        if (bit & (1 << i)) {
            S.push_back(i);
        }
    }
    return S;
}

int main()
{
    ll cst = 1000000007;
    
    ll N, tkk=0, sw=0, sa; cin >> N;
    vl A(N), B(N);

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

    rep(i, N) sw = (sw + A[i]) % cst;

    sw = (sw * sw) % cst;

    rep(i, N) {
        B[i] = (A[i] * A[i]) % cst;
        tkk = (tkk + B[i]) % cst;
    }

    sa = (sw - tkk) % cst;

    if (sa < 0) sa += cst;

    if (sa % 2 == 0) {
        cout << sa / 2 << endl;
    }
    else {
        cout << (sa + cst) / 2 << endl;
    }

}

Measured memory_bytes: 6392
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
using i64 = long long;

int main() {
  i64 N;
  cin >> N;
  vector<int> A(N + 1);
  for (int i = 1; i <= N; i++) cin >> A[i];
  multiset<int> st;
  i64 res = 0;
  for (int i = 1; i <= N; i++) {
    if (!st.empty() && *st.begin() < A[i]) {
      auto itr = st.lower_bound(A[i]);
      itr--;
      st.erase(itr);
      st.insert(A[i]);
    } else {
      res++;
      st.insert(A[i]);
    }
  }
  cout << res << endl;
}

Measured memory_bytes: 5376
#include <iostream>
#include <numeric>

using namespace std;

int gcd3(int x, int y, int z) { return gcd(x, gcd(y, z)); }

int main(int argc, char const *argv[]) {
  // input
  int K;
  cin >> K;

  int sum = 0;
  for (int a = 1; a <= K; ++a) {
    for (int b = 1; b <= K; ++b) {
      for (int c = 1; c <= K; ++c) {
        sum += gcd3(a, b, c);
      }
    }
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cassert>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <stack>
#define rep(i, f, t) for(int i=(int)(f); i<(int)(t); i++)
#define rrep(i, f, t) for(int i=(int)(f); i>(int)(t); i--)
using namespace std;
using ll = long long;
#define MOD 1000000007
#define MOD2 998244353
constexpr int INFINT = (1 << 30) - 1;       // 1.07x10^ 9
constexpr int INFINT_LIM = (1LL << 31) - 1; // 2.15x10^ 9
constexpr ll INFLL = 1LL << 60;             // 1.15x10^18
typedef pair<ll, ll> P;
template<class T> inline T chmax(T& a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

/*dp[i][j] */

/*def*/
string ret;
ll k;

int main() {
/*input*/
    cin >> k;
/*main*/
    rep(i, 0, k)ret += "ACL";
/*output*/
    cout << ret << endl;
    return 0;
}


Measured memory_bytes: 3600
package main

import "fmt"

func main() {
	var N, A, B, s int
	fmt.Scan(&N, &A, &B)
	for i := 1; i <= N; i++ {
		n := i
		w := 0
		for n > 0 {
			w += n % 10
			n = n / 10
		}
		if A <= w && w <= B {
			s += i
		}
	}
	fmt.Println(s)

}


Measured memory_bytes: 512
h, w = list(map(int, input().split()))
s = [input() for _ in range(h)]
move = [(-1, 0), (1, 0), (0, -1), (0, 1)]
flag = 1
for i in range(h):
    for j in range(w):
        hantei = []
        if s[i][j] == "#":
            for dx, dy in move:
                if i+dx<0 or j+dy<0 or i+dx>h-1 or j+dy>w-1:
                    continue
                else:
                    hantei.append(s[i+dx][j+dy])
            if "#" not in hantei:
                flag = 0
                break

if flag:
    print("Yes")
else:
    print("No")

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

using namespace std;

using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;

using _loop_int = int;
#define REP(i,n) for(_loop_int i=0; i<(_loop_int)(n); i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a); i<(_loop_int)(b); i++)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1; i>=(_loop_int)(a); i--)

#define CHMIN(a,b) (a)=min((a),(b))
#define CHMAX(a,b) (a)=max((a),(b))
#define ALL(v) (v).begin(),(v).end()

#define DEBUG(x) cerr<<#x<<": "<<(x)<<endl
#define DEBUG_VEC(v) cerr<<#v<<": ";REP(__i,(v).size())cerr<<((v)[__i])<<", ";cerr<<endl

const ll MOD = 1000000007ll;

int main(){
    int n;
    cin>>n;
    int ans = 0;
    FOR(x,1,n+1){
        if(x<=9)ans++;
        else if(x<=99);
        else if(x<=999)ans++;
        else if(x<=9999);
        else if(x<=99999)ans++;
        else if(x<=999999);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iterator>

using namespace std;

int main() {

	int a, b, c;
	vector<int> v;
	int cnt = 0;
	cin >> a >> b >> c;
	
	v.push_back(a);
	v.push_back(b);
	v.push_back(c);

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

	cnt += v.at(1) - v.at(0);
	cnt += v.at(2) - v.at(1);

	cout << cnt << endl;
}



Measured memory_bytes: 256
#include <iostream>

using namespace std;

const int p = 1000000007;

int inv(int a) {
  // Calculates a ^ p-2 mod p
  int n = p - 2;
  long long ans = 1;
  while (n > 0) {
    if (n & 1) ans = (ans * a) % p;
    a = ((long long)a * a) % p;
    n >>= 1;
  }
  return (int)ans;
}

int solve(int X, int Y) {
  if ((X + Y) % 3 != 0) return 0;

  int N = (X + Y) / 3;
  int R1 = (2 * X - Y) / 3;
  int R2 = (2 * Y - X) / 3;
  if (R1 < R2) swap(R1, R2);

  if (R1 < 0 || R2 < 0) return 0;

  // For valid coordinates, we want to determine (X+Y)/3 C (2X-Y)/3
  int numerator = 1;
  while (N > R1) {
    numerator = ((long long)numerator * N) % p;
    N--;
  }

  int denominator = 1;
  while (R2 > 0) {
    denominator = ((long long)denominator * R2) % p;
    R2--;
  }

  return (int)(((long long)numerator * inv(denominator)) % p);
}

int main() {
  int X, Y; cin >> X >> Y;  
  
  // Pascal's traingle problem
  int ans = solve(X, Y);
  cout << ans << endl;
}

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

 using namespace std;
 int main() {
   int A, B, X;
   cin >> A >> B >> X;
   if (A > X) cout << "NO"<< endl;
   else if (A + B < X) cout << "NO" << endl;
   else cout << "YES" << endl;
 }


Measured memory_bytes: 256
import
    std.algorithm,
    std.array,
    std.conv,
    std.range,
    std.stdio,
    std.string;
 
void main()
{
    immutable n = readln.chomp.to!size_t;
    auto t = readln.chomp.split.map!(to!int).array;
    auto v = readln.chomp.split.map!(to!int).array;
 
    int pos;
    int[] start, end;
    foreach (ts; t)
    {
        start ~= pos;
        pos += ts;
        end ~= pos;
    }
 
    real result = 0;
    foreach (x2; 0..end[$-1]*2)
    {
        real x = x2 * 0.5;
        real xnext = x + 0.5;
        result += (velocity(x, start, end, v) + velocity(xnext, start, end, v)) / 4;
    }
    "%.2f".writefln(result);
}
 
auto velocity(real x, int[] start, int[] end, int[] v)
{
    return v.length.iota.map!(i => limit(x, start[i], end[i], v[i])).reduce!min
        .min(x).min(end[$-1]-x);
}
 
auto limit(real x, int start, int end, int v)
{
 
    if (x < start)
    {
        return v + (start - x);
    }
    if (end < x)
    {
        return v + (x - end);
    }
    return v;
}

Measured memory_bytes: 1404
#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(int i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9+7  
using ll = long long; 
using P=pair<int,int>;
using lP=pair<ll,ll>;
using fP=pair<double,double>;


int main(){
    int n,m;
    cin>>n>>m;
    vector<lP>ab(n);
    rep(i,n) cin>>ab[i].first>>ab[i].second;
    sort(ab.begin(),ab.end());
    ll ans=0;
    
    rep(i,n){
        if(m<ab[i].second)ans+=ab[i].first*m;
        else ans+=ab[i].first*ab[i].second;
        m-=ab[i].second;
        if(m<=0)break;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1792
(n,m),*a=[map(int,t.split())for t in open(0)]
p=[-1]*-~n
for a in a:
 a,b=map(r:=lambda x:x*(p[x]<0)or r(p[x]),a)
 if a-b:
  if p[a]>p[b]:a,b=b,a
  p[a]+=p[b];p[b]=a
print(sum(i<0for i in p)-2)

Measured memory_bytes: 53144
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <climits>

int main(){
	
	int N;
	std::cin >> N;

	int a[100];

	for (int i = 0; i < N; ++i) {
		std::cin >> a[i];
	}
	
	int col[13]{};
	
	for (int i = 0; i < N; ++i) {
		col[(a[i] / 400)] += 1;
	}

	int colcount = 0;
	for (int i = 0; i < 8; ++i) {
		colcount += (col[i] ? 1 : 0);
	}
	int colfree = 0;
	for (int i = 8; i < 13; ++i) {
		colfree += col[i];
	}

	int min = colcount;
	int max = colcount + colfree;

	if (min == 0) {
		min = 1;
	}

	std::cout << min << ' ' << max << std::endl;

	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <set>
#include <iomanip>
#include <stdio.h>
#include <sstream>
#include <bits/stdc++.h>
using namespace std;
int main(void){
  long long int n;
  cin>>n;
  long long int all=0;
  vector<long long int> a(n);
  for(long long int i=0; i<n; i++){
    cin>>a.at(i);
    all+=a.at(i);
  }

  vector<long long int> ans(n);
  ans.at(0)=all;
  for(long long int i=1; i<=n-2; i+=2){
    ans.at(0)-=2*a.at(i);
  }

  for(long long int i=1; i<n; i++){
    ans.at(i)=2*a.at(i-1)-ans.at(i-1);
  }
  for(long long int i=0; i<n; i++){
    cout<<ans.at(i);
    if(i==n-1){
      cout<<endl;
    }else{
      cout<<" ";
    }
  }
}

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

int Pow(int a, int n) {
  if (n == 1) return a;
  if (n % 2 == 1) return (a * Pow(a, n-1));
  int t = Pow(a, n/2);
  return t*t;
}

int main() {
  int N, M;
  cin >> N >> M;
  int time = (N-M)*100+M*1900;
  int cnt = Pow(2, M);
  cout << time*cnt << endl;
}


Measured memory_bytes: 3628
#include <iostream>
using namespace std;
int main() {
	int a[100000];
	int g;
	for (int i = 0; i < 100000; i++){
		cin >> a[i];
		if (a[i] == 0){
			g = i;
			break;
		}
	}
	for (int i = 0; i < g; i++){
		cout << "Case " << i + 1 << ": " << a[i] << endl;
	}
return 0; } 









Measured memory_bytes: 3024
N[7];//p`N ([0]=S,[1`5]=p`N,[6]=G)
X[7][1024],Y[7][1024];//p`NÌÀW
M[7][1024];//Å¬Ú®
#define INF 1e9
C0q(q){
	int j;
	for(j=0;j<N[q];j++){
		M[q][j]=M[0][0]+abs(X[0][0]-X[q][j])+abs(Y[0][0]-Y[q][j]);
	}
}
C(p,q){
	int i,j,t,d;
	for(j=0;j<N[q];j++){
		d=1e9;
		for(i=0;i<N[p];i++){
			t=M[p][i]+abs(X[p][i]-X[q][j])+abs(Y[p][i]-Y[q][j]);
			t<d?d=t:0;
		}
		M[q][j]=d;
	}
}
Cp6(p){
	int i,t,d;
	d=1e9;
	for(i=0;i<N[p];i++){
		t=M[p][i]+abs(X[p][i]-X[6][0])+abs(Y[p][i]-Y[6][0]);
		t<d?d=t:0;
	}
	M[6][0]=d;
}
main(){
	int test;
	int x,y,c,i,b,d,a,a0,ae;
	char l[1001];
	for(;scanf("%*d%d",&y)*y;){
		a=0;
		memset(N,0,sizeof(N));
		for(;y--;){
			scanf("%s",l);
			for(x=0;c=l[x];x++){
				if(c>='1'){
					if(c<='5')
						i=c-'0';
					else if(c=='S')
						i=0;
					else if(c=='G')
						i=6;
					X[i][N[i]]=x;
					Y[i][N[i]]=y;
					a+=!N[i]++;
				}
			}
		}
		if(a==7)
			a0=1,ae=6;
		else if(a==6){
			for(i=1;i<=5;i++)
				if(!N[i])
					a0=i,ae=i+1;
		}else 
			a0=ae=0;
//for(test=0;test<10;test++){//###test
		d=1e9;
		for(a=a0;a<ae;a++){
			M[0][0]=0;
			C0q(1+a%5);
			for(i=0;i<3;i++)
				C(1+(a+i)%5,1+(a+i+1)%5);
			Cp6(1+(a+3)%5);
			if(M[6][0]<d){
				d=M[6][0];
				b=a;
			}
		}
//}//###test
		printf(d!=1e9?"%d %d\n":"NA\n",b,d);
	}
{int n;for(n=1e6;n--;)getchar();}exit(0);//delay(0.52s)
}

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

int main(){
	string s;
	cin >> s;
	int ans = 0;
	rep(i, s.size()){
		if(s.at(i) == '1')
			ans++;
	}
	cout << ans << endl;
}


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

vector <vector<int>> adjlist(100005,vector<int>());
bool visited[100005];
int dp[100005];

int dfs(int node)
{
    if(dp[node] != -1)
        return dp[node];
    
    int ans = 0; 
    for(auto child : adjlist[node])
    {
        ans = max(ans,1+dfs(child));
    }
    
    dp[node] = ans;
    return ans;
}

int main()
{
    int n , m;
    cin >> n >> m;
    
    int a,b;
    for(int i=1;i<=m;i++)
    {
        cin >> a >> b;
        adjlist[a].push_back(b);
    }
    
    memset(visited,false,sizeof(visited));
    memset(dp,-1,sizeof(dp));
    
    int ans = 0;
    for(int i=1;i<=n;i++)
    {
        //if(visited[i] == false)
            ans = max(ans , dfs(i));
    }
    
    cout << ans << endl;
    return 0;
    
}

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

ll INF = 1e+18;
int iINF = 1e9;
int MAXI = 1e8 + 1;
using vec = vector<int>;

ll
rec(int n, ll x)
{
  if(n == 0) return 1;
  ll half = pow(2, n + 1) - 3;
  ll phalf = pow(2, n) - 1;
  if(x == 1) return 0;
  else if(x <= 1 + half) return rec(n - 1, x - 1);
  else if(x == 1 + half + 1) return phalf + 1;
  else if(x <= 1 + half + 1 + half) return phalf + 1 + rec(n - 1, x - 2 - half);
  else return (2 * phalf) + 1;

}

int 
main()
{
  int N; cin >> N;
  ll X; cin >> X;
  cout << rec(N, X) << endl;

}

Measured memory_bytes: 4024
#include<stdio.h>
#include<math.h>
 
int main(void)
{
    int i,r;
    double n[1000], sum = 0, ave;
    while(1)
    {
        scanf("%d",&r);
        if(r==0)
        {
            break;
        }
        for(i=0;i<r;i++)
        {
            scanf("%lf",&n[i]);
            sum += n[i];
        }
         
        ave = sum / r;
        sum = 0;
         
        for(i=0;i<r;i++)
        {
            sum += (n[i]-ave) * (n[i]-ave);
        }
         
        sum = sum / r;
        printf("%lf\n",sqrt(sum));
        sum = 0;
    }
    return 0;
 
}

Measured memory_bytes: 664
#include<vector>
#include<iostream>
#include<algorithm>
using namespace std;
static const int INF = 1000000;
int main() {
	int N;
	cin >> N;
	vector<int>a0(N);
	for (int i = 0; i < N; i++) {
		cin >> a0[i];
	}
	vector<int>a1(N);
	for (int i = 0; i < N; i++) {
		cin >> a1[i];
	}
	vector<int>dp(N, INF);
	int kiten = a0[0];
	for (int i = 0; i < N; i++) {
		kiten += a1[i];
	}
	dp[0] = kiten;
	for (int i =0 ; i < N-1; i++) {
		dp[i + 1] = (dp[i] - a1[i] + a0[i + 1]);

	}
	//cout << dp[N - 1] << endl;
	//for (int i = 0; i < N; i++) {
		//cout << i << " " << dp[i] << endl;
	//}
	cout << *max_element(dp.begin(), dp.end());
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n));
#define Vec(a,n) vector<string> (a)((n));
#define twovec(a,n,m) vector<vector<int>> a(n,vector<int>(m,0));
#define Twovec(a,n,m) vector<vector<double>> a(n,vector<double>(m,0));
#define P pair<int,int>
#define All(a) (a).begin(),(a).end()
#define Sort(a) sort(All(a));
#define Reverse(a) reverse(All(a));
#define PQ(n) priority_queue<P,vector<P>,greater<P>> (n)
#define pq(n) priority_queue<int> (n)
#define print(a) cout << (a) << endl;
#define printD(a) cout << setprecision(6) << (a) << endl;
using namespace std;
int max_int = 1000000007;
void Debug(auto a);
int nibul(auto a,auto b);
int nibuu(auto a,auto b);
void input(vector<int>& a,int n);

int n;

//重み付きUF
struct UnionFind_w {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
    vector<int> diff_weight;
    UnionFind_w(int n){ //最初は全てが根であるとして初期化
        init(n);
    }
    void init(int n) {
        par.resize(n);
        diff_weight.resize(n);
        REP(i,n){
            par[i] = i;
            diff_weight[i] = 0;
        }
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        int r = root(par[x]);
        if(par[par[x]] != par[x]) diff_weight[x] += diff_weight[par[x]];
        return par[x] = r;
    }

    int weight(int x){
        root(x);
        return diff_weight[x];
    }

    void unite(int x, int y,int w) { // xとyの木を併合
        w -= weight(x);
        w += weight(y);
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
        diff_weight[rx] = w;
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }

    int diff(int x,int y){
        return weight(x) - weight(y);
    }
};

signed main(){
    int n;
    cin >> n;
    vec(a,n);
    REP(i,n){
        cin >> a[i];
    }
    Reverse(a);
    REP(i,n){
        cout << a[i];
        if(i != n-1){
            cout << " ";
        }
        else{
            cout << endl;
        }
    }


    return 0;
}

void Debug(auto a){
    cout << "{ ";
    for(auto b: a){
        cout << b << " ";
    }
    cout << "}" << endl;
}
int nibul(auto a,auto b){
    int x = lower_bound(All(a),b) - a.begin();
    //key以上の初めてのitr
    return x;
}
int nibuu(auto a,auto b){
    int x = upper_bound(All(a),b) - a.begin();
    //key以下の最後のitr
    return x-1;
}

void input(vector<int>& a,int n){
    REP(i,n){
        cin >> a[i];
    }
}



Measured memory_bytes: 3088
import java.util.*;
    public class Main{ 
    public static void main(String arg[]){
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();
		int b=sc.nextInt();
		String s=sc.next();
		char ch[]=s.toCharArray();
		ch[b-1]=Character.toLowerCase(ch[b-1]);
		String s1=new String(ch);
		System.out.println(s1);
	}
}

Measured memory_bytes: 21844
import Control.Monad
 
main = do
    [a, b, c, d, e, k] <- forM [1 .. 6] $ \i -> readLn
    putStrLn $ solve a e k
 
solve :: Int -> Int -> Int -> String
solve a e k | e - a <= k = "Yay!"
            | otherwise  = ":("

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

int main() {
  string t;
  cin >>t;
  string ans;
  int all = 1<<t.size();
  int maxpd = 0;
  rep(s,all){
    int pdindex = 0;
    string u  = t;
    rep(i,t.size()){
      if (u[i]=='?'){
        if(s>>i&1) u[i] = 'P';
        else u[i] = 'D';
      }
    }
    rep(i,t.size()){
      if(u[i]=='D') pdindex++;
      if(u[i]=='P' && t[i+1]=='D') pdindex++;
    }
    if(pdindex>maxpd) {
      maxpd = pdindex;
      ans = u;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3928
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
const int MOD = 1000000007;
const int INF = numeric_limits<int>::max() / 2;
typedef pair<int,int> P;
typedef pair<int,pair<int, int>> P1;

using Graph = vector<vector<int>>;

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

  string S;
  cin >> S;
  int N = S.size();
  for(int i=0;i<N-1;i++){
    if(S[i] == S[i+1]){
      cout << i+1 << ' ' << i+2 << endl;
      return 0;
    }
  }
  for(int i=0;i<N-2;i++){
    if(S[i] == S[i+2]){
      cout << i+1 << ' ' << i+3 << endl;
      return 0;
    }
  }
  cout << -1 << ' ' << -1 << endl;
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		partA101();
	}


	public static void partA101() {
		Scanner scA = new Scanner(System.in);
		String S = scA.next();
		int count = 0;

		for(int i = 0 ; i < 4 ; i++) {
			if(S.charAt(i) == '+') {
				count++;
			}else if(S.charAt(i) == '-') {
				count--;
			}
		}

		System.out.println(count);

	}
}

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

using namespace std;

long long gcd(long long i, long long j) {

	//ユークリッドの互除法で最大公約数を求める
	//2変数の場合

	if (i < j) { swap(i, j); }

	while (i%j != 0) {
		int r;
		r = i % j;
		if (r == 0) { return j; }
		else { i = j; j = r; }
	}
	return j;
}

long long gcd(vector<long long> &a) {

	//ユークリッドの互除法で最大公約数を求める
	//多変数の場合

	long long x = a[0];
	long long y = a[1];
	for (long long i = 1; i < (long long)a.size(); i++) {
		y = a[i];
		if (x < y) { swap(x, y); }
		while (x%y != 0) {
			long long r;
			r = x % y;
			if (r == 0) {
				break;
			}
			else {
				x = y;
				y = r;
			}
		}
		x = y;
	}
	return y;
}

int main() {

	int n;
	cin >> n ;
	vector<long long> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	vector<long long> b(n+1);
	vector<long long> c(n+1);
	b[0] = a[0];
	c[n - 1] = a[n - 1];
	for (int i = 1; i < n; i++) {
		b[i] = gcd(b[i-1],a[i]);
	}
	for (int i = n-2; i >=0; i--) {
			c[i] = gcd(c[i+1],a[i]);
	}

	long long maxx = 0;;
	for (int i = 0; i < n; i++) {
		if (n == 2) {
			maxx = max(a[0],a[1]);
		}
		else if (i == 0) {
			maxx = max(maxx,c[1]);
		}
		else if (i == n - 1) {
			maxx = max(maxx,b[n - 2]);
		}
		else if (i == 1 && i == n - 2) {
			maxx = max(maxx,gcd(a[0], a[2]));
		}
		else if(i==1){
			maxx = max(maxx, gcd(a[0], c[i + 1]));
		}
		else if (i == n - 2) {
			maxx = max(maxx, gcd(b[i - 1], a[n-1]));
		}
		else {
			maxx = max(maxx, gcd(b[i - 1], c[i + 1]));
		}
	}

	cout << maxx << endl;
	return 0;
}

Measured memory_bytes: 2560
fn solve(s: &str) -> String {
    match s {
        "Sunny" => "Cloudy".to_owned(),
        "Cloudy" => "Rainy".to_owned(),
        "Rainy" => "Sunny".to_owned(),
        _ => unreachable!(),
    }
}

#[allow(unused_macros)]
macro_rules! parse_line {
    ( $t:ty ) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            iter.next().unwrap().parse::<$t>().unwrap()
        }
    );

    ( $( $t:ty), +) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ( $(iter.next().unwrap().parse::<$t>().unwrap()),* )
        }
    );
}

#[allow(unused_macros)]
macro_rules! read_line {
    () => {{
        let mut line = String::new();
        ::std::io::stdin().read_line(&mut line).unwrap();
        line.pop();
        line
    }};
}

#[allow(unused_macros)]
macro_rules! parse_vec {
    ( $t:ty ) => {{
        let mut line = String::new();
        ::std::io::stdin().read_line(&mut line).unwrap();
        let iter = line.split_whitespace();
        iter.map(|v| v.parse::<$t>().unwrap()).collect::<Vec<_>>()
    }};
}

fn main() {
    let s = read_line!();
    println!("{}", solve(&s));
}


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


const int N = 1e5 + 5, M = 1e9 + 7, oo = 1e9;

int n, k, arr[N], dp[N];
int solve(int ind) {
	if (ind == n-1)return 0;
	int& re = dp[ind];
	if (re != -1) return re;
	re = oo;
	for (int i = 1; i <= k; i++)
		if(ind+i <= n)
			re = min(re, abs(arr[ind] - arr[ind+i]) + solve(i + ind));
	return re;
}
int main() {


	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n >> k;
	for (int i = 0; i < n; i++)
	{
		cin >> arr[i];
	}
	memset(dp, -1, sizeof dp);
	cout << solve(0) << endl;
	return 0;
}

Measured memory_bytes: 5760
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
#include<complex>

using namespace std;

#define ll long long
#define ld long double
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

const double PI=acos(-1);
const double EPS=1e-9; //うまくいかなかったらゆるめる

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef pair<int,pii> pip;
typedef vector<pii> vp;
typedef vector<vi> vvi;

int gcd(int a, int b){if(b==0) return a;return gcd(b,a%b);}
int lcm(int a, int b){return a/gcd(a,b)*b;}


signed main(void) {
    int n,a,b,c,d;
    string s;
    cin >> n >> a;
    if(n == a){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

}


Measured memory_bytes: 888
n, m = list(map(int, input().split()))
a = [list(map(int, input().split()))[1:] for _ in range(n)]

cnt = 0
for i in range(1, m+1):
    flag = True
    for j in range(len(a)):
        if not i in a[j]:
            flag = False
    if flag:
        cnt += 1

print(cnt)



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

void main()
{
    char S[256], T[256];
    int i;

    scanf("%s", S);
    scanf("%s", T);

    // 元の文字数より1文字多いかチェック
    if(strlen(S) != (strlen(T) -1)){
        printf("No\n");
        return;
    }

    // 最初の入力と次の入力の1文字手前まで同じかチェック
    for(i=0;i<strlen(S);i++){
        if(S[i] != T[i]){
            printf("No\n");
            return;
        }
    }
    
    printf("Yes\n");
}


Measured memory_bytes: 1640
// ※※※ 解答不能 ※※※
// 正答者のソースを勉強する.
// kmjp氏
// https://atcoder.jp/contests/abc140/submissions/7408341
#include <bits/stdc++.h>
using namespace std;
using LL = long long;

int P[101010];
vector<pair<int, int>> V;

int main(){
    int N;
    multiset<int> S;
    scanf("%d", &N);
    S.insert(0), S.insert(0), S.insert(N + 1), S.insert(N + 1);
    for(int i = 0; i < N; i++){
        scanf("%d", &P[i + 1]);
        V.push_back({P[i + 1], i + 1});
    }
    sort(V.begin(), V.end());
    reverse(V.begin(), V.end());
    LL ret = 0;
    for(auto& v : V){
        LL num = v.first;
        int id = v.second;
        auto it = S.lower_bound(id);
        int R1 = *it++;
        int R2 = *it--;
        it--;
        int L1 = *it--;
        int L2 = *it;
        ret += num * (R2 - R1) * (id - L1);
        ret += num * (L1 - L2) * (R1 - id);
        S.insert(id);
    }
    printf("%lld\n", ret);
    return 0;
}

Measured memory_bytes: 6132
def comb(i,j)
  ans=1
  i.times{|k|
    ans*=(j-k)
  }
  i.times{|k|
    ans/=(k+1)
  }
  ans
end

while n=gets
  n=n.chomp.split("").map { |s| s.to_i }

  sum=0

  n.size.times{|i|
    c=comb(i,n.size-1)
    sum+=(c*n[i])
  }
  ans=sum%10
  p ans
end



Measured memory_bytes: 6844
#include<bits/stdc++.h>
using namespace std;
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;
  }
}
void wt_L(int x){
  char f[10];
  int m=0, s=0;
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
int N, cnt[100001];
int main(){
  int i, j, res;
  rd(N);
  for(i=0;i<N;i++){
    rd(j);
    cnt[j]++;
  }
  {
    int KL2GvlyY=0, Lj4PdHRW, Q5VJL1cS, e98WHCEY;
    for(Lj4PdHRW=1;Lj4PdHRW<(100000-1)+1;Lj4PdHRW++){
      e98WHCEY = cnt[Lj4PdHRW-1]+cnt[Lj4PdHRW]+cnt[Lj4PdHRW+1];
      if(KL2GvlyY==0 || Q5VJL1cS<e98WHCEY){
        Q5VJL1cS = e98WHCEY;
        KL2GvlyY = 1;
      }
    }
    res =Q5VJL1cS;
  }
  wt_L(res);
  putchar_unlocked('\n');
  return 0;
}
// cLay varsion 20170628-1 [beta]

// --- original code ---
// int N, cnt[100001];
// {
//   int i, j;
//   int res;
//   rd(N);
//   rep(i,N) rd(j), cnt[j]++;
//   res = max[k=1---1d5-1](cnt[k-1]+cnt[k]+cnt[k+1]);
//   wt(res);
// }


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define IO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
int n,m;

int main()
{
    IO
    int a,b,c;
    cin>>a>>b>>c;
    if(a*b*c==5*5*7)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define I 900000
int x[99],z[99],y[99][20],h[99],a,b,c,d,e,f,i,j,k;string S;
int main(){
while(true){
for(i=0;i<99;i++){x[i]=I;h[i]=0;}
memset(y,0,sizeof(y));
cin>>a>>b>>c;
if(!a){break;}
for(i=0;i<c;i++){
cin>>d>>e>>f>>S;
if(S[0]=='W'){
y[d][e]++;
}
else{
x[d]+=I;
x[d]-=f+1200*y[d][e];
}
}
for(i=1;i<=a;i++){z[i]=x[i];}
sort(x+1,x+a+1);
for(i=a;i>=1;i--){
for(j=1;j<=a;j++){
if(z[j]==x[i]&&!h[j]){
printf("%d %d %d\n",j,(x[i]+I-1)/I-1,(99*I-x[i])%I);
h[j]=1;
}
}
}
}
}

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

int main(){
    string s;
    cin >> s;
    int num[26] = {0};
    for(int i = 0;i < s.size();i++)num[(s[i]-'a')]++;
    sort(num,num+26,greater<int>());
    if(num[0] <= 1)cout << "yes";
    else cout << "no";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 100000000;
#define rep1(i, n) for (ll i=0; i<(n); i++) 
#define rep2(i, k, n) for (ll i=k; i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main() {
    ll n;
    cin >> n;
    map<string, ll> m;
    string s;
    rep1(i, n){
        cin >> s;
        m[s]++;
    }
    cout << "AC x " << m["AC"] << endl;
    cout << "WA x " << m["WA"] << endl;
    cout << "TLE x " << m["TLE"] << endl;
    cout << "RE x " << m["RE"] << endl;
    
    //printf("%.12f", ans);
}

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

int main()
{
    int n,k;
    cin >> n >> k;
    vector<pair<ll,int>> dt(n);
    rep(i,n) cin >> dt[i].second >> dt[i].first;
    sort(dt.begin(), dt.end(), greater<pair<ll,int>>());

    queue<ll> q0;
    queue<ll> q1;
    unordered_map<int, int> mp;

    ll tmp = 0;
    rep(i,k) {
        ll di = dt[i].first;
        ll ti = dt[i].second;
        tmp += di;
        if(mp.count(ti) == 0) { mp[ti] = 1; }
        else { ++mp[ti]; }
    }    
    ll x = mp.size();
    tmp += x*x;
    ll ans = tmp;
    
    for(int i=k-1;i>=0;--i) {
        ll di = dt[i].first;
        ll ti = dt[i].second;
        if(mp[ti] > 1) {
            q0.push(di);
            --mp[ti];
        }
    }

    rep2(i,k,n) {
        ll di = dt[i].first;
        ll ti = dt[i].second;
        if(mp.count(ti) == 0) { 
            q1.push(di);
            mp[ti] = 1;
        }
    }

    while(!q0.empty() && !q1.empty()) {
        tmp = tmp - q0.front() + q1.front() + 2*x + 1;
        ans = max(ans, tmp);
        q0.pop(); q1.pop();
        ++x;
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6308