akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int64_t i=0;i < (int64_t)(n);i++)
#define invrep(i,n) for(int64_t i=n-1;i >= 0;i--)
#define _GLIBCXX_DEBUG
using namespace std;

//////全探索したいときに開けよ////////
vector<vector<int>> fspattern;
vector<int> fspattern_draft;
int fspcnt = 0;

void setfspattern_core(int floor,int number,int degree){
  if(floor==degree){
    fspattern.at(fspcnt) = fspattern_draft;
    fspcnt++;
  }else{
    rep(i,number){
      fspattern_draft.at(floor) = i;
      setfspattern_core(floor+1,number,degree);
    }
  }
}

void setfspattern(int number,int degree){
  fspcnt = 0;
  int64_t array_num = 1;
  rep(i,degree){
    array_num *= number;
  }
  fspattern = vector<vector<int>>(array_num,vector<int>(degree));
  fspattern_draft = vector<int>(degree);
  setfspattern_core(0,number,degree);
}

//////nCrのmodを求めたいときに開けよ/////////
//int64_t univMod = 1000000007;
//int64_t factnum = 100000
//vector<int64_t> modfact(factnum);
//vector<int64_t> modinvfact(factnum);

/*void setmodfact(){
  for(int i=0;i<factnum;i++){
    if(i == 0){
      modfact.at(i) = 1;
    }else{
      modfact.at(i) = (modfact.at(i-1)*i)%univMod;
    }
  }
}

int64_t calcmodpower(int64_t a,int64_t n){
  int64_t res = 1;
  while(n != 0){
    if(n & 1){
      res = (res * a) % univMod;
    }
    a = (a*a) % univMod;
    n = n >> 1;
  }
  return res;
}

int64_t calcinverse(int64_t n){
	return calcmodpower(n,univMod-2);
}

void setmodinvfact(){
  for(int i=0;i<factnum;i++){
    if(i==0){
      modinvfact.at(i) = 1;
    }else{
      modinvfact.at(i) = calcmodpower(modfact.at(i),univMod-2);
    }
  }
}*/


/*
int64_t calcGCD(int64_t a,int64_t b){
	int64_t p = a;
	int64_t q = b;
	int64_t c = a%b;
	while(c != 0){
		p = q;
		q = c;
		c = p%q;
	}
	return q;
}
*/

int main(){
  int64_t n,k;
  cin >> n >> k;
  string s;
  cin >> s;
  vector<int> a(1),b;
  bool isa = true;
  rep(i,n){
    if(isa){
      if(s[i] == '1'){
        a.back()++;
      }else{
        isa = false;
        b.push_back(1);
      }
    }else{
      if(s[i] == '0'){
        b.back()++;
        if(i == n-1) a.push_back(0);
      }else{
        isa = true;
        a.push_back(1);
      }
    }
  }
  /*rep(i,a.size()){
    cout << a[i];
  }
  cout << endl;
  rep(i,b.size()){
    cout << b[i];
  }
  cout << endl;*/
  if(b.size() <= k){
    cout << n << endl;
  }else{
    vector<int64_t> ruiseki;
    int64_t maxp = 0;
    ruiseki.push_back(a[0]);
    rep(i,b.size()){
      ruiseki.push_back(ruiseki.back()+b[i]+a[i+1]);
    }
    int64_t t=0;
    /*rep(i,ruiseki.size()){
      cout << ruiseki[i] << " ";
    }*/
    //cout << endl;
    while(t+k < b.size()+1){
      maxp = max(maxp,ruiseki[t+k]-ruiseki[t]+a[t]);
      //cout << ruiseki[t+k]-ruiseki[t]+a[t] << endl;
      t++;
    }
    cout << maxp << endl;
  }
      
    
    

}

Measured memory_bytes: 1468
X,Y=map(int,input().split())
mod=10**9+7
if (X+Y)%3!=0:
  print(0)
else:
  N=int((2*Y-X)/3)
  M=int((2*X-Y)/3)
  if N<0 or M<0:
    print(0)
  if N==0 or M==0:
    print(1)
  if N>0 and M>0:
    List=[0 for i in range(N+M)]
    List[0]=1
    for i in range(N+M-1):
      List[i+1]=List[i]*(i+2)%mod
    print(List[N+M-1]*pow(List[N-1],mod-2,mod)*pow(List[M-1],mod-2,mod)%mod)

Measured memory_bytes: 35388
def solve(a, b):
    global dp
    if a == b:
        return 0
    elif dp[a][b]:
        return dp[a][b]
    ret = INF
    for i in range(a, b):
        tmp = solve(a, i) + solve(i + 1, b) + c[i] * r[a] * c[b]
        ret = min(ret, tmp)
    dp[a][b] = ret
    return ret

n = int(input())
r = [0] * n;  c = [0] * n;
for i in range(n):
    r[i], c[i] = [int(x) for x in input().split()]

INF = float('inf')
dp = [[0 for _ in range(n)] for _ in range(n)]
print(solve(0, n - 1))


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

int main () {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int a;
  long long b, n;
  cin >> a >> b >> n;
  long long mn = min (n, b - 1);
  cout << a * mn / b << '\n';
  return 0;
}


Measured memory_bytes: 3636
#!/usr/bin/env python3
K =int(input())
N=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(N[K-1])



Measured memory_bytes: 2940
#include <cstdio>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <string>
#include <cstring>
#include <sstream>
#include <queue>
#include <iomanip>
#include <algorithm>
using namespace std;

int n;
set <int> S;

int main()
{
	scanf("%d", &n);
	while (n--) {
		int a; scanf("%d", &a);
		S.insert(a);
	}
	cout << S.size() << endl;
	return 0;
}

Measured memory_bytes: 256
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS --(ByteString, getLine, readInt, words)
import qualified  Data.ByteString as B
import Data.Array.Unboxed (UArray)
import Data.Array (Array, listArray, array, (!), (//), indices, elems, assocs)
import Data.Array.IArray (IArray) 

import Data.Array.ST  --(newListArray, runSTUArray, newArray, writeArray, readArray)
import Data.Array.IO 
import Control.Monad.ST (ST)

import qualified Data.Vector.Unboxed         as V --(fromList, !, replicateM)
import qualified Data.Vector.Unboxed.Mutable as VM --(new, read, write, swap, modify, unsafeWrite, unsafeRead, STVector, IOVector)


-- example: putStrLn show 123 ++ "and" ~~ 456 ++ "or" ~~ 789
(~~) :: Show a => String -> a -> String
a ~~ b = a ++ show b

bsToInt :: BS.ByteString -> Int
bsToInt = fst . fromJust . BS.readInt
getInt = bsToInt <$> BS.getLine

bsToInts :: BS.ByteString -> [Int]
bsToInts = map bsToInt . BS.words 
getInts = bsToInts <$> BS.getLine

getLines :: Int -> IO [BS.ByteString]
getLines n = replicateM n BS.getLine


effect :: (MArray a e m, Ix i) => a i e -> i -> (e -> e) -> m ()
effect ary i operator = (operator <$> readArray ary i) >>= writeArray ary i

-------------------------------------------------------------------------------
-------------------------------------------------------------------------------

bfs :: Array Int [Int] -> [Int] -> [Int] -> VM.IOVector Int -> Int -> IO ()
-- n-1 rooms is done
bfs _ _ _ _ 1 
    = return ()

-- go to next depth
bfs neighborsAry [] nexts exits k 
    = bfs neighborsAry nexts [] exits k

--transcribe current room's neighbors onto "exits"
bfs neighborsAry (c:currents) nexts exits k 
    = do
        let neighbors = neighborsAry ! c 
        newNexts <- filter (/= 0) <$> sequence [ do
                exit <- VM.read exits nb
                if exit == 0 then do
                    VM.write exits nb c
                    return nb
                else return 0
                | nb <- neighbors ]
        bfs neighborsAry currents (newNexts ++ nexts) exits (k - length newNexts) 



main :: IO ()
main = do
    [n,m] <- getInts
    abs <- replicateM m $ do 
        [a,b] <- getInts
        return (a,b)

    exits <- VM.new (n+1) :: IO(VM.IOVector Int)
    VM.set exits 0
    VM.write exits 1 1

    neighborsMAry <- newArray (1, n) [] :: IO(IOArray Int [Int])
    mapM_ (\(a,b) -> effect neighborsMAry a (b:) >> effect neighborsMAry b (a:)) abs
    neighborsAry <- freeze neighborsMAry
    bfs neighborsAry [1] [] exits n 

    putStrLn "Yes"
    mapM_ (\i -> VM.read exits i >>= print) [2..n]


Measured memory_bytes: 95904
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;


int main() {
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)cin>>a[i];
    sort(a,a+n);
    cout<<(a[n-1]-a[0])<<endl;
}


Measured memory_bytes: 256
/* src: (6 lines)

A, B, H, M = inputInt(), inputInt(), inputInt(), inputInt()
M /= 60.0
H = (H + M) / 12.0
dx = cos(M * 2 * M_PI) * B - cos(H * 2 * M_PI) * A
dy = sin(M * 2 * M_PI) * B - sin(H * 2 * M_PI) * A
printf("%.20f\n", sqrt(dx*dx+dy*dy))

*/

//#define NDEBUG

#include <cassert>
#include <vector>
#include <deque>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cmath>

using namespace std;

const char*inputCLineOrWord(int mode){static char buf[2097152];static int bufLen=sizeof(buf);static int bufPos=sizeof(buf);static bool canReadFlag=true;static bool crFlag=false;static bool enterFlag=false;if(canReadFlag&&(enterFlag?bufLen<=bufPos:(int)sizeof(buf)<=bufPos+bufPos)){if(0<bufLen-bufPos){memmove(buf,buf+bufPos,bufLen-bufPos);bufLen-=bufPos;}else{bufLen=0;}char*result=fgets(buf+bufLen,sizeof(buf)-bufLen,stdin);canReadFlag=(result!=NULL);if(result!=NULL){int n=strlen(result);enterFlag=(n!=(int)sizeof(buf)-1-bufLen||(1<=bufLen+n&&buf[bufLen+n-1]=='\n'));bufLen+=n;}bufPos=0;}if(mode==0){int pos=bufPos;while(true){char c=buf[pos];if(c==32){buf[pos++]='\0';break;}else if(c==10){if(crFlag){crFlag=false;if(bufPos==pos){pos=++bufPos;continue;}}buf[pos++]='\0';break;}else if(c==13){crFlag=true;buf[pos++]='\0';break;}else if(c==0){break;}++pos;}const char*ret=buf+bufPos;bufPos=pos;while(true){char c=buf[bufPos];if(c==32||c==10||c==13){++bufPos;}else{break;}}return ret;}else if(mode==1){int pos=bufPos;while(true){char c=buf[pos];if(c==10){if(crFlag){crFlag=false;if(bufPos==pos){pos=++bufPos;continue;}}buf[pos++]='\0';break;}else if(c==13){crFlag=true;buf[pos++]='\0';break;}else if(c==0){break;}++pos;}const char*ret=buf+bufPos;bufPos=pos;if(crFlag){while(true){char c=buf[bufPos];if(c==13){++bufPos;crFlag=false;break;}else{break;}}}return ret;}else if(mode==2){return bufLen<=bufPos?NULL:buf+bufPos;}assert(false);return NULL;}const char*inputCWord(){return inputCLineOrWord(0);}int inputInt(){return atoi(inputCWord());}
// generated code (by mmlang) :

int A;
int B;
double H;
double M;
double dx;
double dy;

int main() {
    {
        const auto & $c1 = inputInt();
        const auto & $c2 = inputInt();
        const auto & $c3 = inputInt();
        const auto & $c4 = inputInt();
        tie(A, B, H, M) = tuple<int, int, int, int>($c1, $c2, $c3, $c4);
    }
    M /= 60.0;
    H = (H + M) / 12.0;
    dx = cos(M * 2 * M_PI) * B - cos(H * 2 * M_PI) * A;
    dy = sin(M * 2 * M_PI) * B - sin(H * 2 * M_PI) * A;
    printf("%.20f\n", sqrt(dx * dx + dy * dy));
    return 0;
}


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

#define FOR(i, a, b) for(int i = a; i<b; ++i)
#define FR(a, b) for(int i = a; i>=b;--i)
#define _upgrade cin.tie(0); ios_base::sync_with_stdio(0)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(), x.end()
#define INF 1e9

using namespace std;

typedef long long ll;
typedef double db;
typedef unsigned long long ull;
typedef pair<int, int> iPair;

const int MAX = 2e5+2;
const int M = 1e9+7;

double dp[301][301][301];
int main()
{
    _upgrade;
    int n, c1 = 0, c2 = 0, c3 = 0;
    cin>>n;
    FOR(i, 0, n)
    {
        int x;
        cin>>x;
        if(x == 1)
            c1++;
        else if(x == 2)
            c2++;
        else
            c3++;
    }
    FOR(i, 0, 301)
        FOR(j, 0, 301)
            FOR(k, 0, 301)
            {
                if(i+j+k > n || i+j+k == 0)
                    continue;
                db a, b, c;
                a = 1.0*k/(i+j+k);
                b = 1.0*j/(i+j+k);
                c = 1.0*i/(i+j+k);
                if(k)
                    dp[k][j][i] += dp[k-1][j][i]*a;
                if(j)
                    dp[k][j][i] += dp[k+1][j-1][i]*b;
                if(i)
                    dp[k][j][i] += dp[k][j+1][i-1]*c;

                dp[k][j][i] += 1.0*n/(i+j+k);
            }
    cout<<setprecision(10)<<fixed<<dp[c1][c2][c3];
}



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

using namespace std;

int main()
{
	int n;
	int deta[3];
	int square;

	cin >> n;
	
	for (int i = 0; i < n; i++){
		for (int j = 0; j < 3; j++){
			cin >> deta[j];
		}
		
		sort (deta, deta + 3);

		square = (deta[0] * deta[0]) + (deta[1] * deta[1]);

		if (square == deta[2] * deta[2]){
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}

	return 0;
}

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

public class Main {
    public static void main(String[] args) {
        try {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            int n = Integer.parseInt(br.readLine());
            int sum = 0;
            for (int i = 0; i < n; i++) {
                sum += i + 1;
            }
            System.out.println(sum);
        } catch (IOException e) {
            e.printStackTrace();
           }
    }
}


Measured memory_bytes: 22996
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2, log
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
from decimal import Decimal
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
from decimal import *

s = input()

print(s[:4], s[4:])


Measured memory_bytes: 5148
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
    ll n;
    cin >> n;
    double cnt = 0;
    for(int i = 1; i <= n; i++){
        if(i % 2 == 1)
        cnt += 1;
    }
    double N = n;
    double k = cnt / N;
    cout << setprecision(10) << k << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
int a,b,c,N,i;
scanf("%d",&N);
for(i=0;i<N;i++){
scanf("%d %d %d",&a,&b,&c);
if((a*a+b*b==c*c)||(a*a+c*c==b*b)||(b*b+c*c==a*a)){
printf("YES\n");
}else{
printf("NO\n");
}
}
return 0;
}

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

using namespace std;

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

typedef pair<int, int> P;

int H, N;
char c[11][2][2];
char b[3][2][2][2];
char a[22][2][2];

int ans;
vector<P> pos;

bool inrange(int idx, int dy, int dx)
{
  rep(i, 2) rep(j, 2) rep(k, 2) {
    if(b[idx][i][j][k] == '#') {
      if(j+dy < 0 || 1 < j+dy || k+dx < 0 || 1 < k+dx) return false;
    }
  }
  return true;
}

int calc()
{
  int ret = 0;
  rep(i, 22) rep(j, 2) rep(k, 2) {
    a[i][j][k] = (i < H ? c[i][j][k] : '.');
  }
  rep(i, N) {
    bool stop = false;    
    for(int h = 20; h >= -1 && !stop; h--) {
      rep(j, 2) rep(k, 2) rep(l, 2) {
	if(b[i][j][k][l] == '.') continue;
	int z, y, x; tie(y, x) = pos[i]; z = h + j, y += k, x += l;
	if(z < 1 || a[z-1][y][x] == '#') stop = true;
      }
      if(!stop) continue;
      rep(j, 2) rep(k, 2) rep(l, 2) {
	if(b[i][j][k][l] == '.') continue;
	int z, y, x; tie(y, x) = pos[i]; z = h + j, y += k, x += l;
	a[z][y][x] = b[i][j][k][l];
      }
    }
    rep(j, 20) {
      int block = 0;
      rep(k, 2) rep(l, 2) block += (a[j][k][l] == '#');
      if(block < 4) continue;
      for(int h = j; h < 20; h++) {
	rep(k, 2) rep(l, 2) a[h][k][l] = a[h+1][k][l];
      }
      ret++, j--;
    }
  }
  return ret;
}

void dfs(int idx)
{
  if(idx == N) {
    ans = max(ans, calc());
    return;
  }
  for(int i = -1; i <= 1; i++) {
    for(int j = -1; j <= 1; j++) {
      if(inrange(idx, i, j)) {
	pos.emplace_back(i, j);
	dfs(idx + 1);
	pos.pop_back();
      }
    }
  }
}

int main()
{
  while(cin >> H >> N, H) {
    rep(i, H) rep(j, 2) rep(k, 2) cin >> c[i][j][k];
    rep(i, N) rep(j, 2) rep(k, 2) rep(l, 2) cin >> b[i][j][k][l];
    ans = 0; dfs(0);
    cout << ans << endl;
  }
  
  return 0;
}

Measured memory_bytes: 3048
#include <iostream>

using namespace std;

int main(){
	int e;
	while(cin >> e, e){
		int m = e;
		for(int z=0;z*z*z<=e;z++){
			for(int y=0;z*z*z+y*y<=e;y++){
				int x = e - z*z*z - y*y;
				m = min(m, x+y+z);
			}
		}
		cout << m << endl;
	}
}

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

int n, l, sum, Max;

int main() {
    cin >> n;
    rep(i, n) {
        cin >> l;
        sum += l;
        Max = max(Max, l);
    }
    cout << (Max < sum - Max ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
K = int(input())
if K%2==0:
    print(-1)
elif K==1:
    print(1)
elif K==7:
    print(1)
else:
    if K%7==0:
        K = K//7
    a = 1
    cnt = 1
    ind = -1
    for i in range(K):
        a = (a*10)%K
        cnt += a
        if cnt%K==0:
            ind = i
            break
    if ind<0:
        print(-1)
    else:
        print(ind+2)

Measured memory_bytes: 63392
import java.util.*;

public class Main {

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

	public void run() {
		Scanner sc = new Scanner(System.in);
		long n=sc.nextLong();
		long ans = 1001001001100L;
		for(long i=1; i*i<=n; i++) {
			if(n%i==0) {
				long x = n/i;
				long y = i;
				ans = Math.min(ans, f(x,y));
				//System.out.println(x+" "+y+" "+ans);
			}
		}
		System.out.println(ans);
		sc.close();
	}

	private long f(long x, long y) {
		return Math.max(k(x), k(y));
	}

	private long k(long x) {
		long ret = 0;
		while(x>0) {
			ret++;
			x/=10;
		}
		return ret;
	}
}


Measured memory_bytes: 35752
/* *>>>>>Anshit_Bhardwaj<<<<<* */
#include <bits/stdc++.h>
#define ll long long
#define f(i, x, n) for(int i = x; i < n; i++)
#define dbg(x) cout << x << endl
#define dbg2(x, y) cout << x << ' ' << y << endl
#define dbg3(x, y, z) cout << x << ' ' << y << ' ' << z << endl
#define mod 1000000007
using namespace std;

int main(){
    ll a, b;
    cin >> a >> b;
    if(2*a <= b && 4*a >= b && b % 2 == 0){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3616
N,*as=$<.read.split.map(&:to_i)
as = as.sort!

l = 0
r = N-1
ret = as[r]-as[l]
(N/2-1).times do
    ret += (as[l+1] - as[r]).abs
    ret += (as[l] - as[r-1]).abs
    l += 1
    r -= 1
end

if N.odd?
    center = N/2
    ret += [
        (as[center]-as[center-1]).abs,
        (as[center]-as[center+1]).abs,
    ].max
end

puts ret

Measured memory_bytes: 22260
import java.util.Scanner;

public class Main {
	    public static void main (String[] args) {
	    	Scanner scanner = new Scanner(System.in);
	    	int N = scanner.nextInt();
	    	int D = scanner.nextInt();
	    	int count = 0;
	    	for(int i=0;i<N;i++) {
	    		double X = scanner.nextInt();
	    		double Y = scanner.nextInt();
	    		if(Math.sqrt(X*X+Y*Y) <= D) {
	    			count++;
	    		}
	    	}
	    	System.out.println(count);
	    	scanner.close();
	    }
	}

Measured memory_bytes: 48660
import Foundation

#if swift(>=4.0)
extension String {
    func split(by separator: String) -> [String] {
        return self.components(separatedBy: separator)
    }
    func toArray() -> [String] {
        return self.map{String($0)}
    }
}
func exponentiate(_ lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#else
extension String {
    func split(by separator: String) -> [String] {
        return self.componentsSeparatedByString(separator)
    }
    var count: Int {
        return self.characters.count
    }
    func toArray() -> [String] {
        return self.characters.map{String($0)}
    }
    func uppercased() -> String {
        return self.uppercaseString
    }
    func lowercased() -> String {
        return self.lowercaseString
    }
}
//extension Array where Element == String {
//    func joined(separator separator: String) -> String {
//        return self.joinWithSeparator(separator)
//    }
//}
extension Array where Element: Comparable {
    func max() -> Element {
        return self.maxElement()!
    }
    func min() -> Element {
        return self.minElement()!
    }
    func sorted() -> Array {
        return self.sort()
    }
    func reversed() -> Array {
        return self.reverse()
    }
    mutating func sort() {
        self.sortInPlace()
    }
}
extension Array {
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
func exponentiate(lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#endif
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringSplit(by separator: String) -> [String] {
    return readLine()!.split(by: separator)
}
func readIntSplit(by separator: String) -> [Int] {
    return readLine()!.split(by: separator).map{Int($0)!}
}

/*************** テストスペース ***************/



/*************** メインプログラム ***************/

let s = readLine()!.toArray()
print(s[0]+"\(s.count-2)"+s[s.count-1])


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

using namespace std;

int main(){
    int n,k;
    cin >> n >> k;
    if(k > n-1){
        k = n-1;
    }
    vector<int> h(n);
    for(int i = 0;i < n;i ++){
        cin >> h.at(i);
    }

    vector<int> s(n);
    s.at(1) = abs(h.at(1) - h.at(0));

    if(n == 2){
        cout << s.at(1) << endl;
        return 0;
    }

    for(int i = 2;i < k;i ++){

        if(k == 1 || k == 2){
            break;
        }

        int m = 1000000000;

        for(int j = 0;j < i;j ++){
            m = min(m, s.at(j) + abs(h.at(i) - h.at(j)));
        }

        s.at(i) = m;
    }

    for(int i = k;i < n;i ++){
        
        int m = 1000000000;
        
        for(int j = i-k;j < i;j ++){
            m = min(m, s.at(j) + abs(h.at(i) - h.at(j)));
        }

        s.at(i) = m;
    }

    cout << s.at(n-1) << endl;
}


Measured memory_bytes: 1024
W,a,b = map(int,input().split())
if (a < b):
  if (a+W < b):
    print(b-a-W)
  else:
    print(0)
elif (a > b):
  if (b+W < a):
    print(a-b-W)
  else:
    print(0)
else:
  print(0)

Measured memory_bytes: 3060
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    var preX = 0
    var preY = 0
    var preT = 0
    for (i in 1..n) {
        val t = sc.nextInt()
        val x = sc.nextInt()
        val y = sc.nextInt()
        val dist = Math.abs(x - preX) + Math.abs(y - preY)
        val diffT = t - preT
        if (dist > diffT || dist % 2 != diffT % 2) {
            println("No")
            return
        }
        preX = x
        preY = y
        preT = t
    }
    println("Yes")
}

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

int main(void){

  int t,a,b,aa,bb;
  cin>>t>>a>>b;
  if(a-t>=0)aa=a-t;
  else aa=t-a;
  if(b-t>=0)bb=b-t;
  else bb=t-b;
  cout<<(bb>aa?"A":"B");
}


Measured memory_bytes: 256
a = list(map(str,input()))
if a[0] == a[1] and a[2] == a[3] and a[0] != a[2]:
    print("Yes")
elif a[0] == a[3] and a[1] == a[2] and a[0] != a[1]:
    print("Yes")
elif a[0] == a[2] and a[1] == a[3] and a[0] != a[1]:
    print("Yes")
else:
    print("No")
  

Measured memory_bytes: 3060
#include <stdio.h>

#define MOD 1000000007

struct mint {
    int n;
    mint(int n_ = 0) : n(n_) {}
};

mint operator+(mint a, mint b) { a.n += b.n; if (a.n >= MOD) a.n -= MOD; return a; }
mint operator-(mint a, mint b) { a.n -= b.n; if (a.n < 0) a.n += MOD; return a; }
mint operator*(mint a, mint b) { return (long long)a.n * b.n % MOD; }
mint &operator+=(mint &a, mint b) { return a = a + b; }
mint &operator-=(mint &a, mint b) { return a = a - b; }
mint &operator*=(mint &a, mint b) { return a = a * b; }

int H, W;
char S[1000][1001];
mint dp[1000][1000];

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


Measured memory_bytes: 4992
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        boolean r = false;
        while (sc.hasNext()) {
            String l = sc.next();
            while (l.length() < 5) {
                l = "0" + l;
            }
            if (r) {
                System.out.println();
            }
            r = true;
            boolean f=true;
            for (int i = 0; i < 8; i++) {
                if (i < 2) {
                    for (int j = 0; j < 5; j++) {
                        System.out.print((l.charAt(j) < '5' == f ? "*" : " ") + (j == 4 ? "\n" : ""));
                    }
                    f = false;
                } else if (i == 2) {
                    System.out.println("=====");
                } else {
                    for (int j = 0; j < 5; j++) {
                        System.out.print(((l.charAt(j) - '0') % 5 == i - 3 ? " " : "*") + (j == 4 ? "\n" : ""));
                    }
                }
            }
        }
    }
}



Measured memory_bytes: 39248
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <unordered_map>
#include <ctime>
#include <list>
#include <numeric>
#include <utility>
#include <ctime>
#define INF 1000000000
#define LINF 9000000000000000000
#define mod 1000000007

#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair
#define MOD(x) (x%(mod))

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=false;

/*---------------------------------------------------*/

int main(){
  int n;
  cin>>n;
  cout<<n/3<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;
using ll = long long;

int main(){
    int N;
    cin >> N;
    ll a;
    int count_4 = 0;
    int count_odd = 0;
    int count_even = 0;

    for(int i=0;i<N;i++){
        cin >> a;
        if(a%2 == 0){
            if(a%4 == 0){
                count_4++;
            }else{
                count_even++;
            }
        }
        else count_odd++;
    }
    if(count_even == 0){
        if(count_odd > count_4+1){
            cout << "No" << endl;
        }else{
            cout << "Yes" << endl;
        }
    }else{
        if(count_4 < count_odd){
            cout << "No" << endl;
        }else{
            cout << "Yes" << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		int M = stdIn.nextInt();
		int[] city = new int[N];
		Arrays.fill(city, 0);
		
		for(int i = 0; i < M; i++) {
			int a = stdIn.nextInt();
			int b = stdIn.nextInt();
			city[a-1]++;
			city[b-1]++;
		}
		
		for(int i = 0; i < N; i++) {
			System.out.println(city[i]);
		}

	}

}

Measured memory_bytes: 23380
#include <stdio.h>
int n;
int a[30010];
int b[30010][10];
int c[30010];
int d[30010][10];
int e[10];
int cnt;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%1d",&a[i]);
	}
	for(int i=n-1;i>=0;i--){
		for(int j=0;j<10;j++){
			b[i][j] = b[i+1][j] || a[i+1]==j;
			c[i] += b[i][j];
			if(b[i][j]){
				if(a[i+1]==j) d[i][j] = i+1;
				else d[i][j] = d[i+1][j];
			}
		}
	}
	for(int i=1;i<=n;i++){
		if(e[a[i]]==0){
			e[a[i]] = 1;
			for(int j=0;j<10;j++){
				if(d[i][j]!=0) cnt+=c[d[i][j]];
			}
		}
	}
	printf("%d\n",cnt);
}

Measured memory_bytes: 4304
#include<stdio.h>
#include<cmath>
#include<iostream>
using namespace std;
int main(){
    int n;
    scanf("%d", &n);
    double x[n], y[n];
    double p1=0, p2=0, p3=0, p=0;
    for(int i=0; i<n; i++)  scanf("%lf", &x[i]);
    for(int i=0; i<n; i++)  scanf("%lf", &y[i]);
    for(int i=0; i<n; i++)  p1+=abs(x[i]-y[i]);
    for(int i=0; i<n; i++)  p2+=(x[i]-y[i])*(x[i]-y[i]);
    for(int i=0; i<n; i++)  p3+=pow(abs(x[i]-y[i]), 3);
    for(int i=0; i<n; i++)  p=max(p, abs(x[i]-y[i]));
    printf("%.8lf\n%.8lf\n%.8lf\n%.8lf\n", p1, sqrt(p2), pow(p3, 1.0/3), p);
    return 0;
}


Measured memory_bytes: 3376
#include <cstdio>
#include <cstdlib>

int getParent(const int i);
int getLeft(const int i);
int getRight(const int i);

int main(int argc, const char** argv) {
    int *arr, size;

    scanf("%d", &size);

    arr = (int *) calloc(sizeof(int), size + 2);
    for (int i = 1; i < size + 1; i++) {
        scanf("%d", arr + i);
    }

    for (int i = 1; i < size + 1; i++) {
        printf("node %d: key = %d, ", i, arr[i]);
        if (getParent(i) >= 1) {
            printf("parent key = %d, ", arr[getParent(i)]);
        }
        if (getLeft(i) <= size) {
            printf("left key = %d, ", arr[getLeft(i)]);
        }
        if (getRight(i) <= size) {
            printf("right key = %d, ", arr[getRight(i)]);
        }
        printf("\n");
    }

    free(arr);
    return 0;
}

int getParent(const int i) {
    return i / 2;
}

int getLeft(const int i) {
    return 2 * i;
}

int getRight(const int i) {
    return 2 * i + 1;
}


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

using std::cin;
using std::cout;
using std::cerr;

using std::abs;
using std::min;
using std::max;
using std::swap;

using std::map;
using std::pair;
using std::set;
using std::string;
using std::vector;

using std::sort;
using std::reverse;

using ll = long long;

#define forn(i, n) for (ll i = 0; i < (ll) n; ++i)
#define sz(a) static_cast<int>(a.size())
#define endl '\n'

struct __init {
    __init() {
        cin.tie(nullptr);
        std::iostream::sync_with_stdio(false);
        cout << std::fixed << std::setprecision(10);
        cerr << std::fixed << std::setprecision(5);
        std::mt19937 rand(300);
    }

    ~__init() {
        #ifdef SEREZHKA
            cerr << "Time elapsed: " << static_cast<double>(clock()) / CLOCKS_PER_SEC << endl;
        #endif
    }
} init;

const ll inf = (ll) 1e9 + 7ll;
const int maxn = (int) 1e6 + 17;

ll L, R;

bool read() {
    if (!(cin >> L >> R))
        return false;

    return true;
}

ll enlarge(ll R) {
    bool f = false;

    for (int i = 60; i >= 0; --i)
        if ((R >> i) & 1) {
            f = true;
        } else {
            if (f)
                R |= (1ll << i);
        }

    return R;
}

void solve() {
    if (L == R) {
        cout << 1 << endl;
        return ;
    }

    ll M = -1;

    for (int i = 60; i >= 0; --i)
        if (((L >> i) & 1) == ((R >> i) & 1)) {
            L &= ~(1ll << i);
            R &= ~(1ll << i);
        } else {
            M = (1ll << i);
            break;
        }

    ll l1 = L, r1 = M + enlarge(R - M);
    ll l2 = l1 + M, r2 = 2ll * M - 1;

    if (r1 < l2)
        cout << r1 - l1 + 1 + r2 - l2 + 1 << endl;
    else
        cout << r2 - l1 + 1 << endl;
}

int main() {
#if SEREZHKA
    freopen("file.in", "r", stdin);
#endif

    while (read())
        solve();

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> void printvec(const vector<T>& v) {
  for (auto x : v) { cout << x << " "; }
  cout << endl;
}
template<class T> void printtree(const vector< vector<T> >& tree) {
  for (long long i = 0; i < tree.size(); ++i) {
    cout << i + 1 << ": "; printvec(tree[i]);
  }
}
template<class T, class U> void printmap(const map<T, U>& mp) {
  for (auto x : mp) { cout << x.first << "=>" << x.second << endl; }
}

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

#define rep(i, n) for(ll i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()
#define sz(x) (ll)(x).size()
#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;
typedef vector<ll> vl;
typedef vector<P> vp;

const ll INF = 1e9;
const ll MOD = 1000000007;  // 1e9 + 7

int main(int argc, char** argv) {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  //cout << setprecision(10) << fixed;

  ll a, b, c, k;
  cin >> a >> b >> c >> k;
  ll res = 0;
  ll useA = min(a,k);
  res += useA;
  k -= useA;
  ll useB = min(b,k);
  k -= useB;
  ll useC = min(c,k);
  res -= useC;
  k -= useC;

  cout << res << endl;
}


Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <bitset>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <algorithm>
#include <cmath>
#include <iterator>
#include <numeric>
#include <iomanip>
#define FI first
#define SE second
#define EB emplace_back
#define MP make_pair
#define REP(i, n) for (ll i = 0; i < n; i++)
#define INF 1100000000
#define LLINF 1100000000000000000LL
#define Decimal fixed << setprecision(20)
#define ALL(c) c.begin(),c.end()
#define SHOWVEC(v, sz) for(int i = 0; i < sz; i++) cerr << v[i] << ' '; cerr << endl;
#define SHOWX(x) cerr << #x << ": " << x << endl;
#define SHOWP(p) cerr << "[" << p.first << ',' << p.second << "]";

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

ll dp[5000];
int main()
{
  REP(i, 5000) dp[i] = LLINF;

  int N, M; cin >> N >> M;
  
  vector<pair<ll, ll>> v;
  REP(i, M) {
    ll a, b; cin >> a >> b;
    ll n = 0;
    REP(i, b) {
      ll c; cin >> c;
      c--;
      n += 1 << c;
    }
    v.EB(MP(a, n));
  }

  dp[0] = 0;
  REP(b, 1 << N) {
    REP(i, M) {
      ll a = v[i].FI;
      ll c = v[i].SE;
      dp[b | c] = min(dp[b | c], dp[b] + a);
    }
  }
  if (dp[(1 << N) - 1] == LLINF) cout << -1 << endl;
  else cout << dp[(1 << N) - 1] << endl;

  return 0;
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int m = scan.nextInt();
        int[] ar = new int[n];
        long sum = 0;
        for (int i = 0; i < n; i++) {
            ar[i] = scan.nextInt();
            sum+=ar[i];
        }
        double t = (double) sum/(double) (4*m);
        int cnt = 0;
        for (int i = n-1; i >= 0; i--) {
            if(ar[i] >= t) {
                cnt++;
            }
        }
        System.out.println(cnt >= m ? "Yes":"No");
    }
}


Measured memory_bytes: 23764
def ctoi(c):
    return ord(c) - ord('a')

def solve(s):
    masks = [1<<k for k in range(26)]
    cums = [0]
    for c in s:
        cums.append(cums[-1] ^ masks[ctoi(c)])
    if cums[-1] == 0:
        print(1)
        exit()

    dp = {0:0}
    for b in cums:
        for m in masks:
            msk = b^m
            if msk in dp:
                if b in dp:
                    dp[b] = min(dp[b], dp[msk]+1)
                else:
                    dp[b] = dp[msk]+1
    return dp[cums[-1]]

print(solve(input()))

Measured memory_bytes: 35124
# coding: utf-8
# Your code here!

n = int(input())
al = list(map(int,input().split()))

ans_l = [0 for i in range(n)]
for i in reversed(range(n+1)):
    if i == 0:
        break
    now = 0
    for j in range(2,n+1):
        if j * i <= n:
            now += ans_l[j*i-1]
        else:
            break
    if now%2 == al[i-1]:
        ans_l[i-1] = 0
    else:
        ans_l[i-1] = 1
        
print(sum(ans_l))
for idx,i in enumerate(ans_l):
    if i == 1:
        print(idx+1)
        

Measured memory_bytes: 70620
#include<iostream>
#include<map>
#include<string>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
using namespace std;

bool a[10]{};
int main() {
	int b, c; cin >> b >> c;
	for (int d = 0; d < c; d++) {
		int e; cin >> e;
		a[e] = true;
	}
	for (int i = b;; i++) {
		string s = to_string(i);
		bool P = true;
		for (char l : s) {
			if (a[l - 48])P = false;
		}
		if (P) {
			cout << i << endl;
			break;
		}
	}
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	L := nextInt()
	R := nextInt()
	d := nextInt()

	c := 0

	for i := L; i <= R; i++ {
		if i%d == 0 {
			c++
		}
	}
	fmt.Println(c)
}

var stdin = initStdin()

func initStdin() *bufio.Scanner {
	bufsize := 1 * 1024 * 1024 // 1 MB
	var stdin = bufio.NewScanner(os.Stdin)
	stdin.Buffer(make([]byte, bufsize), bufsize)
	stdin.Split(bufio.ScanWords)
	return stdin
}

func nextString() string {
	stdin.Scan()
	return stdin.Text()
}

func nextBytes() []byte {
	stdin.Scan()
	return stdin.Bytes()
}

func nextInt() int {
	i, _ := strconv.Atoi(nextString())
	return i
}

func nextInt64() int64 {
	i, _ := strconv.ParseInt(nextString(), 10, 64)
	return i
}

func debug(args ...interface{}) {
	fmt.Fprintln(os.Stderr, args)
}


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

int main(){
    int A,B,K; cin >> A >> B >>K;
    int div1[100];
    int small = min(A,B);
    int count =0;
    int i =1;

    for(i=1; i <= small; i++){

        if(A%i==0 && B%i==0){
            div1[count]=i;
            count++;
        }
        
    }

    cout << div1[count-K] << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	int n=s.size();
	if(s[n-1]=='s')
	{for(int i=0;i<n;i++)
	cout<<s[i];
	cout<<"es\n";}
	else
	{
		cout<<s<<"s\n";
	}
}


Measured memory_bytes: 3600
#include<stdio.h>
main()
{
    int a,b;
    scanf("%d %d",&a,&b);
    if((a==1 && b==2) || (a==2 && b==1))
        printf("3");
    else if ((a==2 && b==3) || (b==2 && a==3))
            printf("1");
    else if ((a==1 && b==3) || (b==1 && a==3))
            printf("2");
    else
            printf("Invalid");
}


Measured memory_bytes: 128
//#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"

#define rep(i,n) for(ll (i)=0;(i)<(ll)(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007LL
#define INF (1LL<<60LL)
#define int long long
typedef long long ll;

using namespace std;



signed main() {
	int n, m; cin >> n >> m;
	vector<string> v1(n), v2(m);
	rep(i, n) cin >> v1[i];
	rep(i, m) cin >> v2[i];
	bool ans = false;
	rep(i1,n-m+1)
		rep(j1, n - m + 1) {
		bool flag = true;
		rep(i2,m)
			rep(j2, m) {
			if (v1[i1 + i2][j1 + j2] != v2[i2][j2]) flag = false;
		}
		if (flag) ans = true;
	}
	if (ans) cout << "Yes" << endl;
	else cout << "No" << endl;
}

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

int main()
{
    int n, q, x, y;

    multiset<int> a;

    cin >> n;

    for( int i = 0; i < n; i++ )
    {
        cin >> q >> x;
        if( q == 0 )
        {
            a.insert(x);
            cout << a.size() << endl;
        }
        else if( q == 1 )
            cout << a.count(x) << endl;                                 //countという、指定された値の個数を返す関数もある。setは重複を許さないので0 or 1が返る。
        else if( q == 2 )
            a.erase(x);
        else
        {
            cin >> y;
            multiset<int>::iterator l = a.lower_bound(x), r = a.upper_bound(y);
            for(; l != r; l++ )
                cout << *l << endl;
        }
    }
    return 0;
}


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

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

    t=x;
    x=z;
    z=t;

    cout << x << " " << y << " " << z << endl;
    return 0;
}

Measured memory_bytes: 256
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

n = int(input())
ans = 0
for i in range(3,n+1,2):
    div = make_divisors(i)
    if len(div) == 8:
        ans += 1
print(ans)

Measured memory_bytes: 3188
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <unordered_map>
#include <iostream>
#include <iomanip>

using namespace std;

#define N 1000000000000000

int main() {
    string S, T;
    int i, j;
    cin >> S;
    cin >> T;

    for(i = 0; i < S.size(); i++){
        for(j = 0; j < S.size(); j++){
            if(S[(i + j) % S.size()] != T[j])
                break;
        }
        if(j == S.size()) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int main(){
  int sum[100],x,i=0,a1,a2;
  char s[100];

  while( scanf("%s", s) != EOF ){
    if ( s[0] == '+' ){
      i--;     
      a1=sum[i];
      i--;
      a2=sum[i];
      sum[i]=a1+a2;
      i++;
    } else if ( s[0] == '-' ){
      i--;    
      a1=sum[i];
      i--;
      a2=sum[i];
      
      sum[i]=a2-a1;
      i++; 
    } else if ( s[0] == '*' ){
      i--;    
      a1=sum[i];
      i--;
      a2=sum[i];
      sum[i]=a1*a2;
      i++;
    } else {
      x = atoi(s);
      sum[i]=x;      
      i++;    
    }
   
  }
  
  
  printf("%d\n",sum[i-1]);
  return 0;
}

Measured memory_bytes: 548
a,b,c,d = map(int,input().split())
A = c - a 
B = d - b 

ans = ''

ans +='R'*A + 'U'*B
ans +='L'*A + 'D'*B
ans +='L'+'U'*B+'U'+'R'*A +'R'+'D'
ans +='R'+'D'*B+'D'+'L'*A +'L'+'U'
print(ans)
# print('UURDDLLUUURRDRDDDLLU')

Measured memory_bytes: 38256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<ctime>
#include<cstdlib>
using namespace std;
int main()
{
	string i;
	cin>>i;
	cout<<i[0]<<i.length()-2<<i[i.length()-1]<<endl;
	
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define deb(x) cout<<#x<<" is "<<x<<endl;
typedef long long ll;
using namespace std;

int main()
{
    int n;
    cin>>n;
    vector<double>p(n+1);
    for(int i=1;i<=n;i++)
        cin>>p[i];
    
    double dp[n+1][n+1];
    for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=n;j++)
        {
            if(j>i)
                dp[i][j]=0;
            else if(i==0 && j==0)
                dp[0][0]=1;
            else if(j==0)
                dp[i][0]=(dp[i-1][0])*(1-p[i]);
            else
                dp[i][j]=(1-p[i])*dp[i-1][j] + p[i]*dp[i-1][j-1];
            
            // cout<<i<<" "<<j<<" "<<dp[i][j]<<endl;
        }
    }
    double ans=0;
    for(int i=n/2+1;i<=n;i++)
        ans=ans+dp[n][i];

    cout<<fixed<<setprecision(15)<<ans<<endl;
}

Measured memory_bytes: 73992
s = input()
ans = 'WA'
a = []
if s[0] == 'A' and s[2:-1].count('C') == 1:
     a = list(s)
     a.remove('A')
     a.remove('C')
     a = str(a)
     if a.islower() == True:
          ans = 'AC'
print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9+7;

void self_add(int& a, int b)
{
	a += b;
	if(a >= MOD)
		a%=MOD;
}

int main()
{
	int H,W;
	cin>>H>>W;
	vector<vector<char>> mat(H,vector<char>(W));
	vector<vector<int>> dp(H,vector<int>(W));
	for(int i=0;i<H;i++)
		for(int j=0;j<W;j++)
			cin>>mat[i][j];
	dp[0][0] = 1;
	for(int i=1;i<H;i++)
		if(mat[i][0] == '.')
			dp[i][0] = dp[i-1][0];
		else
			break;
	for(int i=1;i<W;i++)
		if(mat[0][i] == '.')
			dp[0][i] = dp[0][i-1];
		else
			break;
	for(int i=1;i<H;i++)
		for(int j=1;j<W;j++)
			if(mat[i][j]=='.')
				self_add(dp[i][j], dp[i-1][j] + dp[i][j-1]);
	cout<<dp[H-1][W-1]%MOD<<'\n';
}

Measured memory_bytes: 5248
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections;
using System.Text.RegularExpressions;


namespace ABC50
{
    class Program
    {
        static void Main(string[] args)
        {
            //
            A();
            Console.Read();

        }

        static void A()
        {
            string[] input = Console.ReadLine().Split(' ');
            int a = int.Parse(input[0]);
            int b = int.Parse(input[2]);
            string op = input[1];

            if (op == "+") Console.WriteLine((a + b).ToString());
            else if (op == "-") Console.WriteLine((a - b).ToString());
            else throw new ArgumentException();
        }
    }

}

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

int main() {
	int H, W, i, k;
	while (1) {
		cin >> H >> W;
		if (H == 0 && W == 0) {
			break;
		}
		for (k = 1; k <= H; k++) {
			for (i = 1; i <= W; i++) {
				if (i != W) {
					cout << "#";
				} else {
					cout << "#" << endl;
				}
			}
			if(k == H){
				cout << "\n";
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <string>
#include <set>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;

int main(){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if(abs(a-c) <= d || (abs(a-b) <= d && abs(b-c)<= d)){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
//=template==================================================================//
// include
#include <vector>
#include <list>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>

// namespace
using namespace std;

// define
#define FOR(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define REP(i,n) FOR(i,0,n)
#define MIN_V(v) *min_element(v.begin(), v.end())
#define MAX_V(v) *max_element(v.begin(), v.end())

// typedef
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef long long LL;
typedef unsigned long long ULL;

// conversion
inline int toInt(string s) {int v; istringstream sin(s); sin>>v; return v;}
inline int countChar(string s, char c) {int cnt,i; cnt=0; REP (i,s.size()) {if (s[i]==c) cnt++;} return cnt;}
template<class T> inline string toString(T x) {ostringstream sout; sout<<x; return sout.str();}
//===========================================================================//

//=function prototype========================================================//

//===========================================================================//

//=variables=================================================================//

//===========================================================================//
int main(void)
{
  // Scan begin.
  string s;
  int w;
  cin >> s >> w;
  // Scan done.

  // Code begin.
  int i=0;
  while (i*w < s.size()) {
    cout << s[i*w];
    i++;
  }
  cout << endl;
  // Code done.

  return 0;
}

//=functions=================================================================//

//===========================================================================//

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		
		for (int x = 0; x <= N; x++) {
			for (int y = 0; y <= N; y++) {
				int z = N - x - y;
				if (z < 0) {
					continue;
				}
				if (x * 10000 + y * 5000 + z * 1000 == Y) {
					System.out.println(x + " " + y + " " + z);
					return;
				}
			}
		}
		System.out.println("-1 -1 -1");
	}
}

Measured memory_bytes: 21844