akhauriyash/Code-Regression huggingface dataset:
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.TreeSet;
 
 
 
public class Main {
  public static void main(String[] args) {
    InputReader sc = new InputReader(System.in);
 
    int n = sc.nextInt();
    int m = sc.nextInt();
    int x = sc.nextInt();
    
    int sumsmall = 0;
    int sumbig = 0;

    for(int i = 0; i < m; i++){
      int newone = sc.nextInt();
      if(newone < x){
        sumsmall ++;
      }else{
        sumbig ++;
      }
    }

    if(sumsmall > sumbig){
      System.out.println(sumbig);
    }else{
      System.out.println(sumsmall);
    }
   
 
  }

 //ここからテンプレ
  static class InputReader {
      private InputStream stream;
      private byte[] buf = new byte[1024];
      private int curChar;
      private int numChars;
      private SpaceCharFilter filter;
 
      public InputReader(InputStream stream) {
          this.stream = stream;
      }
 
      public int next() {
          if (numChars == -1)
              throw new InputMismatchException();
          if (curChar >= numChars) {
              curChar = 0;
              try {
                  numChars = stream.read(buf);
              } catch (IOException e) {
                  throw new InputMismatchException();
              }
              if (numChars <= 0)
                  return -1;
          }
          return buf[curChar++];
      }
 
      public String nextStr() {
        int c = next();
        while(isSpaceChar(c)){c = next();}
        StringBuffer str = new StringBuffer();
        do{
          str.append((char)c);
          c = next();
        }while(!isSpaceChar(c));
        return str.toString();
      }
 
      public char nextChar() {
        int c = next();
        while(isSpaceChar(c)){c = next();}
        char ret;
        do{
          ret = (char)c;
          c = next();
        }while(!isSpaceChar(c));
        return ret;
      }
 
      public int nextInt() {
          int c = next();
          while (isSpaceChar(c))
              c = next();
          int sgn = 1;
          if (c == '-') {
              sgn = -1;
              c = next();
          }
          int res = 0;
          do {
              if (c < '0' || c > '9')
                  throw new InputMismatchException();
              res *= 10;
              res += c - '0';
              c = next();
          } while (!isSpaceChar(c));
          return res * sgn;
      }
 
      public boolean isSpaceChar(int c) {
          if (filter != null)
              return filter.isSpaceChar(c);
          return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
      }
 
      public interface SpaceCharFilter {
          public boolean isSpaceChar(int ch);
      }
  }
}

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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
from collections import deque
from fractions import gcd
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#############
# Main Code #
#############

N = inputI()
L = inputIL()

L.sort()

aa = [0 for i in range(1001)]
for l in L:
  aa[l] += 1

s = list(set(L))
s.sort()

count = 0
for a in range(len(s)):
  for b in range(a,len(s)):
    for c in range(b,len(s)):
      if s[a]+s[b]>s[c]:
        if s[a]!=s[b] and s[b]!=s[c]:
          count += aa[s[a]]*aa[s[b]]*aa[s[c]]
          continue
        if s[a] == s[c]:
          count += aa[s[a]]*(aa[s[a]]-1)*(aa[s[a]]-2)//6
          continue
        if s[a] == s[b]:
          count += aa[s[a]]*(aa[s[a]]-1)*aa[s[c]]//2
          continue
        if s[b] == s[c]:
          count += aa[s[a]]*aa[s[b]]*(aa[s[b]]-1)//2
          continue
        
print(count)
    


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

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

    
    vector<long double> a(n);
    for(long long i = 0; i < n; i++){
        cin >> a[i];
        if(a[i] == 0){
            printf("0\n");
            return 0;
        }
    }

    long double sum = a[0];

    for(long long i = 1; i < n; i++){
        sum = sum * a[i];
    }

    if(sum > 1000000000000000000){
        printf("-1\n");
    }
    else{
        printf("%lld\n", (long long)sum);
    }

    return 0;
}

Measured memory_bytes: 4852
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define endl "\n"
#define se second
#define ls( s) (s&(-s))
#define ll long long
const int N = 3000300;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
const int mod =    1e9+7;
int ans;
int main()
{ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int x;
int y;
cin>>x>>y;
if(x==1)
ans+=300000;
if(x==2)
ans+=200000;
if(x==3)
ans+=100000;
if(y==1)
ans+=300000;
if(y==2)
ans+=200000;
if(y==3)
ans+=100000;
if(x==1&&y==1)
ans+=400000;
cout<<ans;


}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
ll GCD(ll a,ll b) {return b ? GCD(b,a%b):a;}
ll LCM(ll c,ll d){return c/GCD(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
ll dp[10005];
int main(){
   int n,W;
   cin>>n>>W;
   V<ll> v(n),w(n);
   for(int i=0;i<n;i++)cin>>v[i]>>w[i];
   dp[0]=1;
   for(int i=0;i<n;i++){
       for(int j=0;j<=W;j++){
           if(dp[j]&&j+w[i]<=W)chmax(dp[j+w[i]],dp[j]+v[i]);
       }
   }
   ll ans=0;
   for(int i=0;i<=W;i++)chmax(ans,dp[i]);
   cout<<ans-1<<"\n";
}


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

int main()
{
    int a,b,ans;
    cin>>a>>b;
    for(int i=1;i<=1010;i++)
    {
        if(a == i*8/100 && b == i*10/100)
        {
            cout<<i;
            return 0;
        }
    }
    cout<<-1;
    return 0;
}




Measured memory_bytes: 3588
import java.util.Scanner;

public class Main{
	public static void main(String args[]){
		Scanner scan = new Scanner(System.in);
		String S = scan.next();
		String T = scan.next();
		String Ts = T.substring(0,S.length());
		String result = "";
		if(S.equals(Ts)) {
			result = "Yes";
		}else {
			result = "No";
		}
		System.out.println(result);
	}

}

Measured memory_bytes: 35684
#![allow(non_snake_case)]
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
     };
     ($next:expr, $t:ty) => {
         $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(dead_code)]
const INF: u64 = 1000000007;


fn finish(n: &isize, set: &HashSet<isize>) -> bool {
    let mut n = *n;
    let mut ret = true;
    while n > 0 {
        let tmp = n % 10;
        if set.contains(&tmp) {
            ret = false;
            break
        }
        n /= 10;
    }
    ret
}

fn main() {
    input!{
        N: isize, K: isize,
        D: [isize; K]
    }

    let mut set = HashSet::new();
    for d in D {
        set.insert(d);
    }

    let mut ans = N;

    while !finish(&ans, &set) {
        ans += 1;
    }

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

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

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

int main() {
  int k;
  int sum = 0;

  cin >> k;

  int tmp;

  int a=1;
  int b=1;
  int c=1;


  // k++;

  for(int i=1; i<=k; i++){
      for(int j=1; j<=k; j++){
          for(int l=1; l<=k; l++){
            tmp = gcd(i,j);
            sum += gcd(tmp,l);
          }
      }
  }


  cout << sum;


}

Measured memory_bytes: 3592
import sys
range = xrange
input = raw_input

N,K = [int(x) for x in input().split()]

prob = 0
for k in range(1,N+1):
    p = 1.0/N
    score = k
    while score < K:
        score *= 2
        p /= 2
    prob += p

print `prob`


Measured memory_bytes: 30572
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define FOR(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
using namespace std;

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

    int N, M;
    cin >> N >> M;
    cout << N * (N - 1) / 2 + M * (M - 1) / 2 << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include <list>
#include<stack>
#include<queue>
#include <vector>
#include <set>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include <functional>
using namespace std;

#define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define LL long long
#define CLR(a) memset((a),0,sizeof(a))
#define SZ(x) (int((x).size()))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<<str<<endl
const int INF = (1 << 30);

//毎回変える定数
#define N_MAX 200


//変数
string s, t;
vector<int> canIds;
vector<string> ans;


//サブ関数
//入力
void input() {
	cin >> s >> t;
}


//計算
void calc() {
	//挿入可能位置計算
	REP(i, s.size() - t.size() + 1) {
		bool flag = true;
		REP(j, t.size()) {
			if (s[i + j] != '?' && s[i + j] != t[j]) {
				flag = false; break;
			}
		}
		if (flag)canIds.push_back(i);
	}
	if (canIds.size() == 0)return;

	//挿入を実際にしてみる
	for (auto i : canIds) {
		string tmp = s;
		REP(j, t.size()) {
			tmp[i + j] = t[j];
		}
		REP(j, tmp.size()) {
			if (tmp[j] == '?')tmp[j] = 'a';
		}
		ans.push_back(tmp);
	}
	sort(ans.begin(), ans.end());
}


//出力
void output() {
	if (canIds.size() == 0) {
		DEBUGING("UNRESTORABLE");
	}
	else {
		DEBUGING(ans[0]);
	}
}


//デバッグ
void debug() {
	int N;
	cin >> N;
}


//メイン関数
int main() {

	input();
	calc();
	output();
	debug();

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int H, W;
char s[2001][2001];
int f[2001][2001];

int main() {
  //入力
  cin >> H >> W;
  for(int i = 0; i< H; ++i){
    for(int j = 0; j < W; ++j){
      cin >> s[i][j];  
    }
  }
  int ans = 0;

  for(int i = 0; i < H; ++i){
    int j = 0;
    int left = 0;
    int right = 0;
    while(j < W){
      if(s[i][j] == '#'){
        right = j;
        for(int k = left; k < right; ++k){
          f[i][k] += (right - left);
        }
        left = j + 1;
      }
      
      if(j == W-1 && s[i][j] == '.'){
        for(int k = left; k <= j; ++k){
          f[i][k] += (j - left + 1);
        }
      }    
      ++j;
    }
  }  
  
  for(int j = 0; j < W; ++j){
    int i = 0;
    int left = 0;
    int right = 0;
    while(i < H){
      if(s[i][j] == '#'){
        right = i;
        for(int k = left; k < right; ++k){
          f[k][j] += (right - left);
        }
        left = i + 1;
      }
      
      if(i == H-1 && s[i][j] == '.'){
        for(int k = left; k <= i; ++k){
          f[k][j] += (i - left + 1);
        }
      }    
      ++i;
    }
  }

  for(int i = 0; i < H; ++i){
    for(int j = 0; j < W; ++j){
      if(ans < f[i][j]){
        ans = f[i][j];
      } 
    }
  }

  cout << ans - 1 << endl;
  return 0;
}

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

const int MAXN = 1e5 + 5;

int N, K;
int x[MAXN];

int main() {
	scanf("%d%d", &N, &K);
	for (int i = 0; i < N; i++)
		scanf("%d", x + i);
	
	int ans = 1e9;
	for (int i = 0; i <= N - K; i++)
		ans = min(ans, x[i + K - 1] - x[i] + min(abs(x[i]), abs(x[i + K - 1])));
	
	printf("%d\n", ans);
	
	return 0;
}

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

a,b = [0],[0]
for i in range(N):
    a.append(a[i]+A[i])
for j in range(M):
    b.append(b[j]+B[j])

ans = 0
j = 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: 47268
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] str = br.readLine().split(" ");
        int n = Integer.parseInt(str[0]);
        int m = Integer.parseInt(str[1]);

        int[] coin = new int[m];
        str = br.readLine().split(" ");
        for (int i = 0; i < m; i++) coin[i] = Integer.parseInt(str[i]);
        Arrays.sort(coin);

        int[] dp = new int[n+1];
        Arrays.fill(dp, Integer.MAX_VALUE - 1);
        dp[0] = 0;
        for (int i = 0; i <= n; i++) {
            for (int j = 0; j < m; j++) {
                if (i - coin[j] < 0) break;

                dp[i] = Integer.min(dp[i], dp[i-coin[j]] + 1);
            }
        }
        System.out.println(dp[n]);

    }
}

Measured memory_bytes: 25540
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
#define pb(x) push_back(x)
#define HAYAKU_HAYAKU ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main()
{
    HAYAKU_HAYAKU; 
    ll n,m,sum;
    cin>>n>>m;
    sum = n * 500;
    sum >= m ? cout<<"Yes" : cout<<"No";
}

Measured memory_bytes: 3572
#include <iostream>
using namespace std;
int main(){
  int n, i, a;
  cin >> n;
  a=n;
  char s[n+1];
  cin >> s;
  for(i=0; i<n-1; i++)
    if(s[i]==s[i+1])
      a--;
  cout << a << endl;
  return 0;
}

Measured memory_bytes: 384
MOD = 10**9+7

n,k=map(int,input().split())
ans=0

gcd=[0]*(k+1)
for i in range(1,k+1):
    gcd[i]=pow(k//i,n,MOD)
for i in range(k//2,0,-1):
    for j in range(i*2,k+1,i):
        gcd[i]-=gcd[j]
for i in range(1,k+1):
    ans+=i*gcd[i]%MOD

print(ans%MOD)

Measured memory_bytes: 11424
from collections import deque

n,d,a = map(int, input().split())
xhl = []
for _ in range(n):
    x,h = map(int, input().split())
    cnt = (h-1)//a + 1
    xhl.append((x,cnt))

xhl.sort()

attack_q = deque([])
attack_sum = 0
ans = 0
for x,h in xhl:
    # print('----',((x,h)))
    # print(attack_q)
    # print(attack_sum)
    while attack_q and attack_q[0][0] < x:
        poped_cnt = attack_q.popleft()[1]
        attack_sum -= poped_cnt
    # print(attack_q)
    # print(attack_sum)
    rem = h-attack_sum
    if rem <= 0:
        continue
    attack_sum += rem
    ans += rem
    attack_q.append((x+2*d, rem))
    # print(rem)

print(ans)
# print(xhl)

Measured memory_bytes: 94684
import java.util.Scanner;

// 分かってないがサンプル通ったので提出
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    long k = sc.nextLong();
    int q = sc.nextInt();
    int[]a = new int[n+1];

    if(k-q > 0) {
      for(int i=0; i<n; ++i)
        System.out.println("Yes");
      System.exit(0);
    }

    for(int i=0; i<q; ++i)
      ++a[sc.nextInt()];

    for(int i=1; i<=n; ++i) {
      if(a[i] + k - q <= 0) System.out.println("No");
      else System.out.println("Yes");
    }

  }
}

Measured memory_bytes: 59564
#include <cstdio>

int main()
{
    int i, j, n;
    char mark;
    char marks[4] = {'S', 'H', 'C', 'D'};
    int num;
    bool cards[4][13] = {false};

    scanf("%d ", &n);
    for (i = 0; i < n; i++)
    {
        scanf("%c %d ", &mark, &num);
        for (j = 0; j < 4; j++)
        {
            if (mark == marks[j])
            {
                cards[j][num - 1] = true;
                break;
            }
        }
    }
    for (i = 0; i < 4; i++)
    {
        for (j = 0; j < 13; j++)
        {
            if (!cards[i][j])
            {
                printf("%c %d\n", marks[i], j + 1);
            }
        }
    }
    return 0;
}


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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
from collections import deque
from fractions import gcd
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#############
# Main Code #
#############

s = inputS()

if s[2]==s[3] and s[4]==s[5]:
  print('Yes')
else:
  print("No")

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

int main(){
  long long n, a, b;
  cin >> n >> a >> b;
  
  long long ans = (b-a) / 2;
  if((b-a)%2 == 1){
    ans = (n-b) + (b-a+1) / 2;
    ans = min(ans, (a-1) + (b-a+1) / 2);
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int k, s, x, y, z, count;
    cin >> k >> s;
    count =0;
    for (x = 0; x <= k; x++) {
        for (y = 0; y <= k; y++) {
            z = s - y - x;
            if (0 <= z && z <= k) {
                count++;
            }
        }
    }
    cout << count << endl;
    return 0;
}

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

int main() {
    int n;
    int l;
    cin >> n >> l;
    int ans = n * (l-1) + (n+1) * n / 2;
    int maxApple = l+n-1;
    int minApple = l;
    if(maxApple > 0 && minApple > 0){
        ans -= minApple;
    }else if(maxApple < 0 && minApple < 0){
        ans -= maxApple;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

/**
 * https://beta.atcoder.jp/contests/abc077/tasks/abc077_a
 */
public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		char[][] c = new char[2][3];
		for(int i=0; i<2; i++){
			c[i] = sc.next().toCharArray();
		}
		sc.close();
		
		String ans = "YES";
		if(c[0][0]!=c[1][2] || c[0][1]!=c[1][1] || c[0][2]!=c[1][0]){
			ans = "NO";
		}
		System.out.println(ans);

	}

}

Measured memory_bytes: 23764
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <iomanip>
#include <bitset>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>

using namespace std;

int main() {
  int n, m;
  cin >> n >> m;
  int ans = 0;
  map <int, int> cnt;
  for (int i = 0; i < n; i++) {
    int k;
    cin >> k;
    for (int j = 0; j < k; j++) {
      int x;
      cin >> x;
      cnt[x]++;
      if (cnt[x] == n) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main()
{
  int i,res=0;
  string s,t;
  cin >> s >> t;
  for(i=0;i<3;i++)
    if(s.substr(i,1)==t.substr(i,1)) res++;
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
#include <map>
#include <iterator>
#include <functional>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <fstream>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <list>
#include <sstream>
#include <cstring>
#include <stdio.h>
using namespace std;
#pragma GCC optimize("O3")
#pragma GCC target("sse4")

typedef double LD;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
typedef pair<LD, LD> PDD;
typedef pair<LL, LL> PLL;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef vector<char> VCH;
typedef vector<LD> VLD;
typedef vector<string> VS;
typedef vector<VS> VSS;
typedef vector<VI> VVI;
typedef vector<VLL> VVLL;
typedef vector<VCH> VVCH;
typedef vector<PII> VPII;
typedef vector<PLL> VPLL;
typedef vector<PDD> VPDD;
#define MP make_pair
#define PB push_back
#define X first
#define Y second
#define next fake_next
#define prev fake_prev
#define left fake_left
#define right fake_right

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define RFOR(i,b,a) for(int i = (b) - 1; i >= (a); --i)
#define REP(i, t) FOR(i,0,t)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())
#define FILL(a, value) memset(a, value, sizeof(a))

const LD PI = acos(-1.0);
const LD EPS = 0.5;
const LL INF = 1e9;
const LL mod = 1000003;
const LL LINF = 1e18 + 10;
const LL MAX = 1e5 + 1;

LL solve(LL i, LL o, LL j, LL l)
{
	LL ans = 0;
	ans += o;
	ans += 2 * (i / 2);
	ans += 2 * (j / 2);
	ans += 2 * (l / 2);

	return ans;
}

LL solve2(LL i, LL o, LL j, LL l)
{
	LL ans = 0;
	ans += o;
	if (i && j && l)
	{
		ans += (i - 1) / 2 * 2;
		ans += (j - 1) / 2 * 2;
		ans += (l - 1) / 2 * 2;
		ans += 3;
	}

	return ans;
}

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//freopen("In.txt", "r", stdin);

	LL i, o, t, j, l, s, z;
	while (cin >> i >> o >> t >> j >> l >> s >> z)
	{
		LL ans = solve(i, o, j, l);
		ans = max(ans, solve2(i, o, j, l));
		cout << ans << endl;
	}
	cin >> o;
	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<iostream>
#include<fstream>
#include<vector>
#include<string>
#include<algorithm>
#include<climits>
#include<numeric>
#include<cmath>
#include<cstring>
#include<deque>
#include<map>
#include<iomanip>

#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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define VSORT(v) sort(v.begin(), v.end());
#define VE vector<int>
#define VEP vector<pair<int,int>>
#define llong long long
#define pb(a) push_back(a)
using namespace std;
const vector<VE> DIR{ {-1,0},{1,0},{0,-1},{0,1} };
const llong MOD = 1000000007;
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}
template<class T>
int dp2csv(const vector<vector<T>> & dp, const string fname);
int range_check(int val, int min, int max) {
	if (val < min) {
		return -1;
	}
	if (val > max) {
		return -1;
	}
	return val;
}
template<class T,class T1>
bool array_find(const T& array, const T1& dst) {
	auto result = find(array.first(), array.end(), dst);
	if (result == array.end()) {
		return false;
	}
	else {
		return true;
	}
}
int main() {
	int n;
	cin >> n;
	string str;
	cin >> str;
	int ans = 0;
	REP(i, n-2) {
		if (str[i] == 'A' && str[i + 1] == 'B' && str[i + 2] == 'C') {
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}
template<class T>
int dp2csv(const vector<vector<T>> & dp, const string fname) {
	ofstream ofs(fname);
	if (ofs.fail()) { cerr << "cannot open file. :" + fname << endl; return -1; }
	for (auto dp_row : dp) {
		for (auto dp_cell : dp_row) {
			ofs << dp_cell << ",";
		}
		ofs << endl;
	}
	ofs.close();
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>

using namespace std;

int main(void) {
	int i, tmp;
	int N, M;
	vector<int> ans;
	cin >> N >> M;
	for (i = 0; i < N; i++) {
		ans.push_back(0);
	}
	for (i = 0; i < M; i++) {
		cin >> tmp;
		ans[tmp - 1]++;
		cin >> tmp;
		ans[tmp - 1]++;
	}
	for (i = 0; i < N; i++) {
		cout << ans[i] << endl;
	}
	return 0;
}




Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{
	static int card[];
	public static void main(String[] args)throws IOException{
		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader reader = new BufferedReader(isr);
		Main app = new Main();
		
		int n = Integer.valueOf(reader.readLine());
		int m = Integer.valueOf(reader.readLine());
		
		card = new int[2 * n];
		for(int i = 0; i < 2 * n; i++) card[i] = i + 1;
		for(int i = 0; i < m; i++) card = app.shuffle(Integer.valueOf(reader.readLine()));
		for(int var : card) System.out.println(var);
		
		reader.close();
	}
	
	public int[] shuffle(int k){
		int res[] = new int[card.length];
		if(k == 0){
			int hoge = 0;
			for(int i = 0; i < card.length / 2; i++){
				res[hoge++] = card[i];
				res[hoge++] = card[i + card.length / 2];
			}
		}else{
			for(int i = 0; i < k; i++) res[card.length - k + i] = card[i];
			for(int i = 0; i < card.length - k; i++) res[i] = card[i + k];
		}
		return res;
	}
	
}

Measured memory_bytes: 26216
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO ?????????????????????????????????????????????
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = 0;
		int tmp = br.read();
		while(tmp != 13 && tmp != 10){
			n = n * 10 + (tmp - '0');
			tmp = br.read();
		}

		int[] array = new int[n];
		int num = 0;
		int i1 = 0;
		tmp = br.read();
		if(tmp == 13 || tmp == 10){
			tmp = br.read();
		}
		while(tmp != -1 && tmp != 10 && tmp != 13){
			num = 0;
			while(tmp >= '0' && tmp <= '9'){
				num = num * 10 + (tmp - '0');
				tmp = br.read();
			}
			if(tmp == -1){
				break;
			}
			array[i1] = num;
			i1++;
			tmp = br.read();
		}
		
		int index = partition(array, 0, array.length - 1);
		StringBuilder sb = new StringBuilder();
		int outLen = array.length;
		
		if(index != 0){
			sb.append(array[0]);
		}
		else{
			sb.append("["+array[0] + "]");
		}
		for(int i = 1; i < outLen ; i++){
			//sb.append(" "+array[i]);
			if(i == index){
				sb.append(" ["+array[i] + "]");
				
			}
			else{
				sb.append(" "+array[i]);
				
			}
		}
		System.out.println(sb);
	}
	
	static int partition(int[] array, int p, int r){
		int x = array[r];
		int i = p - 1;
		for(int j = p ; j <= r -1 ;j++){
			if(array[j] <= x){
				i++;
				int tmp = array[i];
				array[i] = array[j];
				array[j] = tmp;
				
			}
		}
		int tmp = array[i + 1];
		array[i + 1] = array[r];
		array[r] = tmp;
		return i + 1;
	}

}

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

using namespace std;using int64 = long long;
const int mod = 1e9 + 7;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}


int main() {
  int N;
  cin >> N;
  vector< int > A(N);
  cin >> A;

  int64 ret = 0;

  int64 low = 1;
  for(int i = 0; i < N; i++) {
    int64 sa = max(0LL, (A[i] - 1) / low);
    ret += sa;
    if(i == 0 || A[i] == low) ++low;
  }
  cout << ret << endl;
}


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

#define M 1046257
#define NIL (-1)
#define L 14

char H[M][L];

/* 文字から数値に変換 */
int getChar(char ch) {
  if ( ch == 'A' ) return 1;
  else if ( ch == 'C' ) return 2;
  else if ( ch == 'G' ) return 3;
  else if ( ch == 'T' ) return 4;
  return 0;
}

/* 文字列から数値へ変換して key を生成する */
long long getKey(char str[]) {
  long long sum = 0, p = 1, i;
  for(i=0;i<strlen(str);i++) {
    sum += p*(getChar(str[i]));
    p*= 5;
  }
  return sum;
}

int h1(int key){ return key % M; }
int h2(int key){ return 1 + (key % (M-1)); }

int find(char str[]) {
  long long key, i, h;
  key = getKey(str); /* 文字列を数値に変換 */
  for(i=0; ;i++) {
    h = (h1(key) + i*h2(key)) % M;
    if( strcmp(H[h],str) == 0) return 1;
    else if ( strlen(H[h]) == 0 ) return 0;
  }
  return 0;
}

int insert(char str[]) {
  long long key, i, h;
  key = getKey(str); /* 文字列を数値に変換 */
  for(i=0; ; i++) {
    h = (h1(key) + i * h2(key)) %M;
    if(strcmp(H[h],str) == 0) return 1;
    else if(strlen(H[h]) == 0) {
      strcpy(H[h],str);
      return 0;
    }
  }
  return 0;
}

int main(void) {
  int i, n;
  char str[L], com[9];
  for(i=0;i<M;i++) H[i][0] = '\0';
  scanf("%d",&n);
  for(i=0;i<n;i++) {
    scanf("%s %s",com,str);
    if(com[0] == 'i') {
      insert(str);
    } else {
      if(find(str)){
        printf("yes\n");
      } else {
        printf("no\n");
      }
    }
  }
  return 0;
}


Measured memory_bytes: 16052
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define MOD @
#define ADD(X,Y) ((X) = ((X) + (Y)%MOD) % MOD)
typedef long long i64; typedef vector<int> ivec; typedef vector<string> svec;

int N;
bool C[101010];
char in[101010];
set<int> tree[101010];
bool valid[101010];
int profit[101010];

void rm_edge(int x, int y)
{
	tree[x].erase(y);
	tree[y].erase(x);
}

void visit(int p)
{
	if (C[p]) return;
	if (tree[p].size() == 1) {
		valid[p] = false;
		int q = *(tree[p].begin());
		rm_edge(p, q);
		visit(q);
	}
}

vector<int> graph[101010];
int best = 0;

void update_best(pair<pair<int,int>, pair<int,int>>& p, pair<int, int> v)
{
	if (v > p.first) {
		p.second = p.first;
		p.first = v;
	} else if (v > p.second) {
		p.second = v;
	}
}

pair<int, int> solve(int p, int rt)
{
	// non leaf, any
	pair<pair<int, int>, pair<int, int> > nl{ {0, -1}, {0, -1} }, any{ {0, -1}, {0, -1} };
	for (int i = 0; i < graph[p].size(); ++i) {
		int q = graph[p][i];
		if (q == rt) continue;

		auto tmp = solve(q, p);
		update_best(nl, { tmp.first, i });
		update_best(any, { tmp.second, i });
	}
	best = max(best, profit[p] + nl.first.first + nl.second.first);
	if (nl.first.second != any.first.second) best = max(best, profit[p] + nl.first.first + any.first.first);
	else {
		best = max(best, profit[p] + nl.first.first + any.second.first);
		best = max(best, profit[p] + nl.second.first + any.first.first);
	}

	if (graph[p].size() == 1) {
		return { -10, profit[p] };
	}
	return { nl.first.first + profit[p], any.first.first + profit[p] };
}

int main()
{
	scanf("%d", &N);
	for (int i = 0; i < N - 1; ++i) {
		int x, y;
		scanf("%d%d", &x, &y);
		--x; --y;
		tree[x].insert(y);
		tree[y].insert(x);
	}
	scanf("%s", in);
	for (int i = 0; i < N; ++i) C[i] = in[i] == 'W';

	bool hasW = false;
	for (int i = 0; i < N; ++i) if (C[i]) hasW = true;

	if (!hasW) {
		puts("0");
		return 0;
	}

	fill(valid, valid + N, true);
	for (int i = 0; i < N; ++i) visit(i);

	int base = -2;
	int ep = -1;
	int cnt = 0;
	for (int i = 0; i < N; ++i) if (valid[i]) {
		++cnt;
		base += 2;
		ep = i;
		if ((tree[i].size() % 2 != 0) != C[i]) ++base;
		for (int j : tree[i]) graph[i].push_back(j);
	}

	if (cnt == 1) {
		puts("1");
		return 0;
	}

	for (int i = 0; i < N; ++i) if (valid[i]) {
		profit[i] = ((tree[i].size() % 2 != 0) != C[i]) ? 2 : 0;
	//	printf("%d %d\n", i, profit[i]);
	}

	//printf("%d\n", base);

	solve(ep, -1);
	
	printf("%d\n", base + min(-best, 0));
	return 0;
}


Measured memory_bytes: 29440
import java.util.*;

public class Main{
	public static void main(String[] args){
		List<Integer> list = new LinkedList<Integer>();
		ListIterator<Integer> iterator = list.listIterator();
		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();

		for(int i = 0; i < n; i++){
			int cmd = scan.nextInt();

			switch(cmd){

				case 0:
					iterator.add(scan.nextInt());
					iterator.previous();
					break;

				case 1:
					int d = scan.nextInt();
					if(d > 0){
						for(int j = 0; j < d; j++) iterator.next();
					}
					else{
						for(int j = 0; j > d; j--) iterator.previous();
					}
					break;

				case 2:
					iterator.next();
					iterator.remove();
					break;
			}
		}
		for(Integer i : list) System.out.println(i);
	}
}



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

using namespace std;

#define N 200

int
main ()
{
  int n;
  int two_e[N];

  cin >> n;

  for (int i = 0; i < n; i++)
    {
      int input;
      cin >> input;
      two_e[i] = 0;
      while (input % 2 == 0)
	{
	  two_e[i]++;
	  input /= 2;
	}
    }
  int min = INT_MAX;

  for (int i = 0; i < n; i++)
    {
      if (two_e[i] < min)
	{
	  min = two_e[i];
	}
    }

  cout << min << endl;
  return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(x) cout << fixed << setprecision(x);
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;
 
 
int main(){
  vl vec(5);
  rep(i,5){
    cin >> vec.at(i);
  }
  rep(i,5){
    if(vec.at(i) ==0){
      cout << i+1 << endl;
    }
  }
}
     

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

typedef long long ll;
#define rep(i,a,b) for (int i = a; i < b; i++)
#define repn(i,a,b) for (int i = a; i >=b ;i--)
#define MOD 1000000007

void solve(){
    int n;cin>>n;
    unordered_set<string> st;
    string s;
    rep(i,0,n){
        cin>>s;
        st.insert(s);
    }
    cout<<st.size();


return ;
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
   int t=1;
   //cin>>t;
   rep(i,0,t){
     solve();
  }
return 0;
}

Measured memory_bytes: 17644
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
  int a[3000],b[3000];
  int i=0;
  while(1){
    scanf("%d %d",&a[i],&b[i]);
    if(a[i]==0 && b[i]==0){
      break;
    }else{
      if(a[i] > b[i]){
        swap(a[i],b[i]);
      }
    }
    i++;
  }
  for(int j=0;j<i;j++){
    printf("%d %d\n",a[j],b[j]);
  }
  return 0;
}

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

int main() {
  int N, K;
  cin >> N >> K;
  
  int X = 1;
  
  for (int i = 0; i < N; i++){
    if (X < K)
      X *= 2;
    else
      X += K;
  }
  
  cout << X << endl;
}


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

int main(){
  int n;
  vector<int> mat[100];
  cin >> n;
  for(int i=0;i<n;i++){
    int u,k;
    cin >> u >> k;
    for(int j=0;j<k;j++){
      int v;
      cin >> v;
      mat[i].push_back(v-1);
    }
  }

  int d[100];
  for(int i=0;i<n;i++) d[i]=(-1);

  queue<int> nb;
  nb.push(0);
  d[0]=0;

  while(!nb.empty()){
    for(vector<int>::iterator it=mat[nb.front()].begin();it!=mat[nb.front()].end();it++){
      if(d[*it]==-1){
        d[*it]=d[nb.front()]+1;
        nb.push(*it);
      }
    }
    nb.pop();
  }

  for(int i=1;i<=n;i++)
    cout << i << ' ' << d[i-1] << endl;
  
  return 0;
}

Measured memory_bytes: 3136
while true
    n,x = gets.split.map(&:to_i)
    sum = 0
    if n==0 && x==0 then break end

    for i in 1...n
        for j in (i+1)...(x-i)
            k = x-i-j
            if j < k && k <= n then sum += 1 end
        end
    end
    puts sum
end

Measured memory_bytes: 8612
import sys
import math
from collections import Counter
import itertools
#from functools import reduce

# 入力を整数に変換して受け取る
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
# 入力全てを整数に変換したものの配列を受け取る
def LI(): return list(map(int, sys.stdin.readline().split()))
# 入力全てを整数に変換して1引いたものの配列を受け取る
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SR(): return sys.stdin.readline().rstrip()

ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_uppercase2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'

# リストを改行区切りで出力する
p2D = lambda x: print(*x, sep="\n")
p2E = lambda x: print(''.join(x))
p2S = lambda x: print(*x, sep=" ")

# ###########################################

l=[II(),II(),II(),II(),II()]
t=643
P = itertools.permutations(l)
cnt=0
for p in P:
    cnt=0
    i=0
    for x in p:
        i+=1
        cnt+=x
        if cnt%10!=0 and i!=5:
            cnt=cnt+(10-(cnt%10))
    t=min(cnt,t)
print(t)


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

typedef long long ll;
int A[85];

int main() {
    int N;
    cin >> N;
    for (int i = 0; i < N; ++i) cin >> A[i];

    ll money = 1000;
    ll stock = 0;
    for (int i = 0; i < N - 1; ++i) {
        if (stock > 0) {
            money += stock * A[i];
            stock = 0;
        }
        if (A[i+1] > A[i]) {
            stock += money / A[i];
            money -= stock * A[i];
        }
    }
    if (stock > 0) {
        money += stock * A[N - 1];
        stock = 0;
    }

    cout << money << endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define maxn 100002
using namespace std;
int score[maxn],freq[maxn];
int main() {
	// your code goes here
	int n,initial_points,q, player_no;
	cin>>n>>initial_points>>q;
	for(int i=0;i<=n;i++) {
		freq[i] = 0;
		score[i] = initial_points;
	}
	
	for(int i=0;i<q;i++){
		cin>>player_no;
		freq[player_no]++;
	}
	for(int i=1;i<=n;i++){
		int penalty = q-freq[i];
		//printf("%d %d %d %d\n",i, score[i], freq[i], penalty);
		score[i]-=penalty;
		//printf("%d %d %d %d\n",i, score[i], freq[i], penalty);
		printf("%s\n", (score[i]>0) ? "Yes" : "No");
	}
	return 0;
}

Measured memory_bytes: 1408
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val dList = readLine()!!.split(' ').map(String::toLong)
    var sum = 0L
    for (i in 0 until n - 1) {
        for (j in i + 1 until n) {
            sum += dList[i] * dList[j]
        }
    }
    println(sum)
}

Measured memory_bytes: 38136
from sys import stdin, setrecursionlimit
#input = stdin.buffer.readline
setrecursionlimit(10 ** 7)

from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
from collections import deque, defaultdict, Counter
from itertools import combinations, permutations, combinations_with_replacement
from itertools import accumulate
from math import ceil, sqrt, pi, radians, sin, cos

MOD = 10 ** 9 + 7
INF = 10 ** 18

H, W = map(int, input().split())
Ch, Cw = map(int, input().split())
Dh, Dw = map(int, input().split())
S = [input() for _ in range(H)]

Ch -= 1
Cw -= 1
Dh -= 1
Dw -= 1

grid = [[0 for _ in range(W)] for _ in range(H)]
grid[Ch][Cw] = 1

stack1 = [(Ch, Cw)]
stack2 = []

answer = 1

#print(grid)

while 1:
    while stack1:
        sh, sw = stack1.pop()
    
        stack2.append((sh, sw))
    
        for i, j in [(-1, 0), (1, 0), (0, 1), (0, -1)]:
            nh, nw = sh + i, sw + j
            if 0 <= nh < H and 0 <= nw < W and S[nh][nw] != "#" and grid[nh][nw] == 0:
                if nh == Dh and nw == Dw:
                    print(answer - 1)
                    exit()
                grid[nh][nw] = answer
                stack1.append((nh, nw))
    #print(grid)
    
    if len(stack2) == 0:
        break
    
    answer += 1
    while stack2:
        sh, sw = stack2.pop()
        for i in range(-2, 3):
            for j in range(-2, 3):
                nh, nw = sh + i, sw + j
                if 0 <= nh < H and 0 <= nw < W and S[nh][nw] != "#" and grid[nh][nw] == 0:
                    if nh == Dh and nw == Dw:
                        print(answer - 1)
                        exit()
                    grid[nh][nw] = answer
                    stack1.append((nh, nw))
    #print(grid)

print(-1)

Measured memory_bytes: 82204
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
printV = lambda x: print(*x, sep="\n")
printH = lambda x: print(" ".join(map(str,x)))
def IS(): return sys.stdin.readline()[:-1]
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LII(rows_number): return [II() for _ in range(rows_number)]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]

def main():
	N = II()
	print(N**3)

if __name__ == '__main__':
	main()

Measured memory_bytes: 3064
#include <iostream>

int main()
{
    int a, b;
    std::cin >> a >> b;
    if(a < b){
        std::cout << "a < b" <<std::endl;
    }else if(a > b){
        std::cout << "a > b" <<std::endl;
    }else{
        std::cout << "a == b" <<std::endl;
    }
    return 0;
}



Measured memory_bytes: 3084
# AtCoder Regular Contest 080
# C - 4-adjacent

N=int(input())
alist=list(map(int,input().split()))

oddcount=0
mod40=0
other=0

for a in alist:
    if a%2==1:
        oddcount+=1
    elif a%4==0:
        mod40+=1
    else:
        other+=1

if N==1:
    if mod40==N:
        print("Yes")
        exit()
    else:
        print("No")
        exit()
if N==2 or N==3:
    if mod40>0 or other==N:
        print("Yes")
        exit()
    else:
        print("No")
        exit()
# ↑ここまではあってそう。

if N%2==1:  # N>3 ,Nが奇数の時
    if (N-((other//2)*2))//2 <= mod40:
        print("Yes")
        exit()
    else:
        print("No")
        exit()

else:   # N>3 ,Nが偶数の時
    if (N-((other//2)*2))//2 <= mod40:
        print("Yes")
        exit()
    else:
        print("No")
        exit()

Measured memory_bytes: 20260
#include <cstdio>

using namespace std;

const int mod = 1000000007;
char a[1000][1001];
int dp[1000][1000];

int main() {
    int h, w, i, j;
    
    scanf("%d %d", &h, &w);
    
    for (i = 0; i < h; i++) scanf("%s", a[i]);
    
    dp[0][0] = 1;
    
    for (i = 0; i < h; i++) {
        for (j = 0; j < w; j++) {
            if (i + 1 < h && a[i + 1][j] == '.') {
                dp[i + 1][j] += dp[i][j];
                if (dp[i + 1][j] >= mod) dp[i + 1][j] -= mod;
            }
            
            if (j + 1 < w && a[i][j + 1] == '.') {
                dp[i][j + 1] += dp[i][j];
                if (dp[i][j + 1] >= mod) dp[i][j + 1] -= mod;
            }
        }
    }
    
    printf("%d\n", dp[h - 1][w - 1]);
    
    return 0;
}


Measured memory_bytes: 4992