akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
public static class P
{
    static int[][] table;
    public static void Main()
    {
        table = Enumerable.Repeat(0, 10).Select(_ => Console.ReadLine().Split().Select(int.Parse).ToArray()).ToArray();
        //Console.WriteLine(Operation(new List<int>() { 2,0,1,6 }));
        int res = 0;
        for (int num = 0; num < 10000; num++)
        {
            var debug = false;
            var s = num.ToString().PadLeft(4, '0').Select(x => x - '0').ToList();
            s.Add(Operation(s));
            var origs = s.ToList();
            for (int j = 0; j < s.Count; j++)
            {
                for (int k = 0; k < 10; k++)
                {
                    if (s[j] == k) continue;
                    var old = s[j];
                    s[j] = k;
                    if (Validation(s))
                    {
                        if (debug) Console.WriteLine(string.Join(" ", s));
                        goto end;
                    }
                    s[j] = old;
                }
            }
            for (int j = 0; j < s.Count - 1; j++)
            {
                var k = j + 1;
                if (s[j] == s[k]) continue;
                var tmp = s[j];
                s[j] = s[k];
                s[k] = tmp;
                if (Validation(s))
                {
                    if (debug) Console.WriteLine(string.Join(" ", s));
                    goto end;
                }
                tmp = s[j];
                s[j] = s[k];
                s[k] = tmp;
            }
            continue;
            end:;
            if (debug) Console.WriteLine($"orig : {string.Join(" ", origs)}\n");
            res++;
        }
        Console.WriteLine(res);
    }
    public static int Operation(List<int> a)
    {
        var res = 0;
        for (int i = 0; i < a.Count; i++)
        {
            res = table[res][a[i]];
        }
        return res;
    }
    public static bool Validation(List<int> a)
    {
        return Operation(a) == 0;
    }
}


Measured memory_bytes: 22596
#include <stdio.h>
#include <string.h>
int main()
{
    int m;
    char a[5];
    scanf("%s",a);
    if(strcmp(a,"SUN")==0)
        printf("7\n");
    if(strcmp(a,"MON")==0)
        printf("6\n");
    if(strcmp(a,"TUE")==0)
        printf("5\n");
    if(strcmp(a,"WED")==0)
        printf("4\n");
    if(strcmp(a,"THU")==0)
        printf("3\n");
    if(strcmp(a,"FRI")==0)
        printf("2\n");
    if(strcmp(a,"SAT")==0)
        printf("1\n");




    return 0;
}


Measured memory_bytes: 128
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);

		int N = s.nextInt();
		int[] nums = new int[N];
		int[] ansNum = new int[N];
		int count = 1;

		for (int i = 0; i < N; i++) {
			nums[i] = Integer.parseInt(s.next());
		}
		Arrays.sort(nums);
/*		System.out.println(Arrays.toString(nums));*/

		//0 even
		int evenodd = 0;
		for (int i = 1; i < N; i++) {

			if (nums[i] == nums[i - 1]) {

				//偶数連続 1
				if (evenodd == 0) {
/*					System.out.println(1);*/
					--count;
					evenodd = 1;
				}

				//奇数連続 2
				else {
/*					System.out.println(2);*/
					++count;
					evenodd = 0;
				}
				//3
			} else {
/*				System.out.println(3);*/
				++count;
				evenodd = 0;
			}
/*			System.out.println(" i :" + i + "evenodd :" + evenodd);*/
		}
		System.out.println(count);
	}

}


Measured memory_bytes: 48820
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define rep(N) for (int i = 0; i < N; ++i)
#define Rep(a, b) for (int i = a; i < b; ++i)
#define For(i, N) for (int i = 0; i < N; ++i)
#define all(v) v.begin(), v.end()
#define rev(v) v.rbegin(), v.rend()
#define makei(N) int N; cin >> N;
#define makel(N) ll N; cin >> N;
#define makes(s) string s; cin >> s;
#define maked(d) double d; cin >> d;
#define makev(v, N) vi v(N); rep(N)cin >> v[i];
#define mod 1000000007
#define re return 0
#define distance(x1,y1,x2,y2) sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2));

using namespace std;
using ll = long long int;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vs = vector<string>;
using pii = pair<int, int>;
using pis = pair<int, string>;
using msi = map<string, int>;

template<typename T>
void say(T s) {
	cout << s << "\n";
}

template<typename T>
void say(vector<T> s) {
	auto itr = s.begin();
	cout << *(itr++);
	while (itr != s.end()) {
		cout << " " << *(itr++);
	}
	cout << "\n";
}

void yn(bool b) {
	if (b)say("Yes");
	else say("No");
}

template<typename T>
void maxi(T &a, T b) {
	a = max(a, b);
}

template<typename T>
void mini(T &a, T b) {
	a = min(a, b);
}

int main() {
	makei(N);
	int ans = 0;
	rep(N) {
		makei(a);
		while (a % 2 == 0) {
			a /= 2;
			++ans;
		}
	}
	say(ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define vll vector<ll>

using namespace std;

const ll N = 4e5+100;
const ll MOD = 1e9+7;
string s,t;
ll tree[N];

void build(ll node,ll l,ll r)
{
	if(l==r)
	{
		tree[node] = (s[l-1] == t[r-1]);
	}
	else
	{
		ll mid = (l + r) >> 1LL;
		build(node*2,l,mid);
		build(2*node+1,mid+1,r);
		tree[node] = tree[node*2] + tree[node*2+1];
	}
}

ll query(ll node,ll st,ll en,ll l,ll r)
{
	if(r < st || l> en) return 0;
	if(st >= l && en <= r) return tree[node];
	ll mid = (st + en)/2;
	ll p1 = query(node*2,st,mid,l,r);
	ll p2 = query(node*2+1,mid+1,en,l,r);
	return p1 + p2;
}

ll pre[N];
ll pr2[N];
int main()
{
	cin >>  s >>t;
	ll q;
	cin >> q;
	ll n = s.size();
	for(int i =1;i<=n;i++)
	{
		if(s[i-1] == 'A')
		{
			pre[i] = pre[i-1] + 1;
		}
		else pre[i] = pre[i-1] + 2;
		
		if(t[i-1] == 'A')
		{
			pr2[i] = pr2[i-1] + 1;
		}
		else pr2[i] = pr2[i-1] + 2;
	}

	while(q--)
	{
		ll l,r,x,y;
		cin>> l >>r >>x >>y;
		
		ll sum1 = pre[r] - pre[l-1];
		ll sum2 = pr2[y] - pr2[x-1];
		sum1 %= 3;
		sum2 %= 3;
		//cout << sum2 << " " << sum1 << endl;
		if(sum2==sum1) cout << "YES\n";
		else cout << "NO\n";
	}
	
	return 0;
}

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

using namespace std;
typedef long long ll;

string S;
ll np[2020];

int main()
{
    ios_base::sync_with_stdio(0);

    cin >> S;

    int p10 = 1;
    int vv = 0;
    np[0]++;
    for (int i = S.length() - 1; i >= 0; i--)
    {
        vv = (vv + p10 * (S[i] - '0')) % 2019;
        p10 = (10 * p10) % 2019;
        np[vv]++;
    }

    ll res =0 ;
    for (int i = 0; i < 2019; i++)
        res += (np[i] * (np[i] - 1)) / 2;
    cout << res << "\n";
}

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

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> t(200005, 0);
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    t.at(a)++;
  }
  sort(t.begin(), t.end(), greater<int>());

  int ans = 0;
  for (int i = 0; i < k; i++) {
    ans += t.at(i);
    if (t.at(i) == 0) {
      cout << 0;
      return 0;
    }
  }
  cout << n - ans;
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <map>

using namespace std;

int main(){
  int N;
  cin >> N;
  map<int, int> m;
  
  for(int i = 0; i < N; i++){
    int a;
    cin >> a;
    m[a]++;
  }
  
  int ans = 0;
  for(auto iter = m.begin(); iter != m.end(); iter++){
    if(iter->second % 2 != 0) ans++;
  }
  cout << ans;
}


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

int main(){
  int n;
  cin >> n;
  vector<int> p(n);
  rep(i,n) cin >> p[i];
  int m = 1e9;
  int ans = 0;
  rep(i,n) {
    m = min(m, p[i]);
    if (m == p[i]) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
n=int(input())
a=list(map(int,input().split()))

b=[0 for _ in range((n+1)//2)]
for i in range(n):
    b[a[i]//2]+=1
if n%2==0:
  for i in range(n//2):
    if b[i]!=2:
      print(0)
      break
  else:
    print(pow(2,n//2,10**9+7))
else:
  if b[0]!=1:
    print(0)
  else:
    for i in range(1,n//2+1):
      if b[i]!=2:
        print(0)
        break
    else:
      print(pow(2,n//2,10**9+7))    


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

s = []
s.append("#" * (W+2))
for i in range(H):
    tmp = "#"
    tmp += input()
    tmp += "#"
    s.append(tmp)
s.append("#" * (W+2))

flag = True
for i in range(1, len(s)-1):
    for j in range(1, W+1):
        if s[i][j] == "#":
            if (s[i][j-1] == "." and s[i][j+1] == "." 
                and s[i-1][j] == "." and s[i+1][j] == "."):
                flag = False
                break
            
if flag:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)x.size())
#define FOR(i,a,b) for (int i=a;i<=b;++i)
#define FORD(i,a,b) for (int i=a;i>=b;--i)
using namespace std;
typedef long long LL;
typedef pair<int,int> pa;
typedef vector<int> vec;
void getint(int &v){
    char ch,fu=0;
    for(ch='*'; (ch<'0'||ch>'9')&&ch!='-'; ch=getchar());
    if(ch=='-') fu=1, ch=getchar();
    for(v=0; ch>='0'&&ch<='9'; ch=getchar()) v=v*10+ch-'0';
    if(fu) v=-v;
}
int n,t;
char s[500010];
int main(){
	cin>>n;
	cout<<(n-2)*180<<endl;
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define REP(i,a) for(int i = 0; i < (a);i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using Graph = vector < vector<int>>;
long int sum[200020] = {};
int main() {
	int N;
	cin >> N;
	vector<int> value;
	vector<int> cost;
	int tvalue = 0;
	int tcost = 0;
	for (int i = 0; i < N; i++) {
		int a;
		cin >> a;
		value.push_back(a);
	}
	for (int i = 0; i < N; i++) {
		int b;
		cin >> b;
		cost.push_back(b);
	}
	for (int i = 0; i < N; i++) {
		if (value[i] > cost[i]) {
			tvalue = tvalue + value[i];
			tcost = tcost + cost[i];
		}
	}
	cout << tvalue - tcost << endl;
}

Measured memory_bytes: 256
n = int(input())
s = input()

cnt = 0
for i in range(1000):
  x = str(i).zfill(3)
  a = s.find(x[0])
  b = s[a+1:].find(x[1])
  c = s[a+b+2:].find(x[2])
  if -1 not in (a,b,c):
    cnt += 1
print(cnt)

Measured memory_bytes: 3060
{-# LANGUAGE BangPatterns #-}
import Control.Monad
import Data.Maybe
import Debug.Trace
import Data.List
import qualified Data.Map.Strict as Map
import qualified Data.IntMap.Strict as IntMap
import qualified Data.Set as Set
import qualified Data.IntSet as IntSet
import Data.Functor
import Data.Array
-- import Data.Array.Unboxed
import Control.Monad.ST
import Data.Array.ST

main :: IO ()
main = getLine >>= putStrLn . solve
solve :: String -> String
solve "Sunny" = "Cloudy"
solve "Cloudy" = "Rainy"
solve "Rainy" = "Sunny"



Measured memory_bytes: 380
while True:
    H, W = map(int, input().strip().split())
    if H == 0 and W == 0:
        break
    else:
        for i in range(H):
            for j in range(W):
                if i == 0 or i == H - 1 or j == 0 or j == W - 1:
                    print("#", end="")
                else:
                    print(".", end="")
            print()
        print()



Measured memory_bytes: 7004
"use strict";

const main = arg => {
    const K = arg.split("\n")[0].split(" ")[1];
    const l = arg.split("\n")[1].split(" ").map(n=>parseInt(n)).sort((a,b)=>b-a);
    
    console.log(l.slice(0, K).reduce((m,n)=>m+n));
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 7372
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int N,K;
vector<int> A;



int main()
{

	cin >> K;
	cin >> N;

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

	int m = K - A[N - 1] + A[0];

	for (int i = 0; i < N-1; i++) {
		m = max(m,A[i + 1] - A[i]);
	}

	int ans = K - m;


	cout << ans <<endl;

	return 0;
}



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

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

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            char[] a = in.next().toCharArray();
            boolean[] v = new boolean[26];
            for (char x : a) v[x - 'a'] = true;
            for (int i = 0; i < 26; ++i) {
                if (!v[i]) {
                    out.println((char) (i + 'a'));
                    return;
                }
            }
            out.println("None");
        }

    }

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

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

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

    }
}



Measured memory_bytes: 23124
//             بسم الثالوث الاقدس

#include<iostream>	
#include<algorithm>
#include<cstdio>
#include<sstream>
#include<cmath>
#include<climits>
#include<string>
#include<iomanip>
#include<vector>
#include<map>
#include<fstream>
using namespace std;
//********************************************************************************************
//******************************************************************************************** 
/*
jesus help me.......
*/
typedef long long lld;
typedef char c;


bool prime(int x)
{
	if (x == 1)
		return false;
	else if (x == 2)
		return true;
	for (int i = 2; i*i <= x; i++)
	{
		if (x%i == 0)
			return false;

	}
	return true;
}
bool AreDoubleSame(double dFirstVal, double dSecondVal)
{
	return fabs(dFirstVal - dSecondVal) < numeric_limits<double>::epsilon();
}


/*
jesus help me.......
jesus help me.......
jesus help me.......
*/




int main()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL); cout.tie(NULL);


	//freopen("keys.in", "r", stdin);
	
	int n, a, b;
	cin >> n >> a >> b;
	int tot = 0;
	for (int i = 1; i <= n; i++)
	{
		int sum = 0;
		int x = i;
		while (x > 0)
		{
			sum += (x % 10);
			x = x / 10;
		}
		if (sum >= a&&sum <= b)
			tot += i;
	}
	cout << tot << endl;



	/////system("pause");
	return 0;
}
/*
jesus help me.......
jesus help me.......
jesus help me.......
*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;

int n, a[100], dp[100][10];

int f(int k, int s)
{
    if (k == n)
        return (s ? 0 : -1e9);
    if (dp[k][s] != -1)
        return dp[k][s];

    int sol = max(
        f(k + 1, s),
        a[k] + f(k + 1, (s + a[k]) % 10));
    return dp[k][s] = sol;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    for (int i = 0; i < n; ++i)
        cin >> a[i];

    memset(dp, -1, sizeof dp);
    cout << (f(0, 0) > 0 ? f(0, 0) : 0);
}


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

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

int main() {
  long K;
  cin>>K;
  long now=7;
  if(K==7||K==1){
    cout<<1<<endl;
    return 0;
  }
  if(K%2==0||K%5==0){
    cout<<-1<<endl;
    return 0;
  }
  long ans=1;
  while(now!=0){
    now+=modpow(10,ans,K)*7;
    now%=K;
    ans++;
    //cout<<now<<endl;
    if(ans>1000000) break;
  }
  if(ans<1000000) cout<<ans<<endl;
  else cout<<-1<<endl;
}


Measured memory_bytes: 3616
N = int(input())
binarys = []
flag = 0

if N == 0:
    print(0)
    flag = 1
    
while N != 0:
    if N % -2 != 0:
        binarys.append('1')
        N = N // -2 + 1
    else:
        binarys.append('0')
        N = N // -2

binarys.reverse()

if flag == 0:
    print(''.join(binarys))

Measured memory_bytes: 3060
import collections

N = int(input())
A = [int(i) for i in input().split()]

con = collections.Counter(A)

ans = len(set(A))

tmp = 0

for i in con.values():
    if i % 2 == 0:
        tmp += 1
        
if tmp % 2 != 0:
    ans -= 1
    
print(ans)

Measured memory_bytes: 21084
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}
void readS(T)(size_t n,ref T t){t=new T(n);foreach(ref v;t){auto r=rdsp;foreach(ref j;v.tupleof)pick(r,j);}}

void main()
{
  struct R { int c, t; }
  int n, ts; readV(n, ts);
  R[] r; readS(n, r);
  auto c = r.filter!(ri => ri.t <= ts).map!"a.c";
  if (c.empty)
    writeln("TLE");
  else
    writeln(c.reduce!min);
}


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


struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);
    };
}aaaaaaa;

int main(){
    int N,M;
    cin>>N>>M;
    int L[M];
    int R[M];
    rep(i,M){
        cin>>L[i]>>R[i];
    }
    sort(L,L+M);
    sort(R,R+M);
    int ans = R[0]-L[M-1]+1;
    if(ans<0){
        cout<<0<<endl;
    }
    else{
        cout<<ans<<endl;
    }

    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <stdlib.h>

static int cmp(const void *a, const void *b);

int main(int argc, char *argv[])
{
    int i, N, list[100], n = 0;
    scanf("%d", &N);
    for ( i = 0; i < N; i++ ){
        scanf("%d", &list[i]);
    }
    qsort(list, N, sizeof(int), cmp);
    for ( i = 1; i < N; i++ ){
        n += list[i]-list[i-1];
    }
    printf("%d\n", n);
    return 0;
}

static int cmp(const void *a, const void *b)
{
    return *((int *)a) - *((int *)b);
}

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

namespace AGC007Shik
{
    class Program
    {
        static void Main(string[] args)
        {
            int H, W;
            string[] vals = Console.ReadLine().Split(' ');
            H = int.Parse(vals[0]);
            W = int.Parse(vals[1]);

            int[,] board = new int[H + 2, W + 2];
            string line;
            int numStep = 0;
            for (int i=0; i < H; i++)
            {
                line = Console.ReadLine();
                for (int j = 0; j < W; j++)
                {
                    if (line[j] == '#')
                    {
                        board[i + 1, j + 1] = 1;
                        numStep++;
                    }
                }
            }
            int x = 1;
            int y = 1;
            numStep--;
            while(true)
            {
                if(x == W && y == H)
                {
                    if (numStep == 0)
                        Console.WriteLine("Possible");
                    else
                        Console.WriteLine("Impossible");
                    return;
                }
                if(board[y, x+1] == 1)
                {
                    x++;
                    numStep--;
                }
                else if(board[y+1, x] == 1)
                {
                    y++;
                    numStep--;
                }
                else
                {
                    Console.WriteLine("Impossible");
                    return;
                }
            }
             
        }
    }
}


Measured memory_bytes: 13140
import math

def main():
    A, B = map(int, input().split())
    a_min = int(math.ceil(A / 0.08))
    a_max = int(math.floor((A+1) / 0.08)) - 1
    b_min = 10 * B
    b_max = 10 * (B+1) - 1
    if a_max < b_min or b_max < a_min:
        print(-1)
    else:
        print(max([a_min, b_min]))


if __name__ == '__main__':
    main()


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

int main() {
	ios_base::sync_with_stdio( false );

	int64_t a, b, x;
	cin >> a >> b >> x;

	int64_t p = b / x + 1;
	int64_t q = (a-1) >= 0 ? ((a-1) / x + 1) : 0;

	cout << p-q << endl;
}


Measured memory_bytes: 256
IDENTIFICATION DIVISION.
       PROGRAM-ID. ATCODER.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  indata PIC X(100).
       PROCEDURE DIVISION.
        ACCEPT indata.
        
         IF indata = "SUN" THEN
           DISPLAY "7"
         END-IF
         IF indata = "MON" THEN
           DISPLAY "6"
         END-IF
         IF indata = "TUE" THEN
           DISPLAY "5"
         END-IF
         IF indata = "WED" THEN
           DISPLAY "4"
         END-IF
         IF indata = "THU" THEN
           DISPLAY "3"
         END-IF
         IF indata = "FRI" THEN
           DISPLAY "2"
         END-IF
         IF indata = "SAT" THEN
           DISPLAY "1"
         END-IF


       STOP RUN.


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

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

typedef tree <ll, null_type, less <ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// order_of_key(val): returns the number of values less than val
// find_by_order(k): returns an iterator to the kth largest element (0-based)

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define sz(a) (ll)(a.size())
#define endl "\n"

template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) 
{
    os << "{ ";
    for(auto& y : x) 
    {
        os << y << " ";
    }
    return os << "}";
}

template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) 
{
    return os << "[" << p.ff << ", " << p.ss << "]";
}

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

    return gcd(b, a%b);
}

ll modexp(ll a, ll b, ll c)
{   
    a%=c;

    ll ans = 1;

    while(b)
    {
        if(b&1)
        {
            ans = (ans*a)%c;
        }

        a = (a*a)%c;
        b >>= 1;
    }

    return ans;
}

ll nxt()
{
    ll x;
    cin >> x;
    return x;
}

const ll L = 1e5+5;

void solve()
{
    string s;;
    cin >> s;

    for(ll i=0; i<sz(s); i++)
    {
        if(s[i] == '?')
        {
            s[i] = 'D';
        }
    }

    cout << s << endl;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    
    ll T = 1;
    // T = nxt();

    while(T--)
    {
        solve();
    }

    return 0;
}

Measured memory_bytes: 3784
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int A[] = {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};
    int K;
    cin >> K;
    cout << A[K - 1] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
typedef long long ll;
typedef pair<ll,ll> pr;
typedef vector<ll> vc;
typedef unordered_map<ll,ll> umap;
#define pb emplace_back
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define repr(i,a,b) for(ll i=a;i>=b;i--)
#define reps(i,v) for(ll i=0;i<v.size();i++)
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }

//Range_Minimum_Query
//(0-indexed)
const int max_n = 1e6+5;
const long long int_max = 1e9+7;
int ns;
long long dat[2 * max_n - 1];
void rmq_init(int initn){
    ns = 1;
    while(ns < initn) ns *= 2;
    for(int i = 0; i < 2 * ns - 1; i++) dat[i] = 0;
}
//k番目の値(0-indexed)をaに変更
void update(int k, long long a){
    k += ns - 1;
    dat[k] = a;
    while(k > 0){
        k = (k - 1) / 2;
        dat[k] = min(dat[k * 2 + 1], dat[k * 2 + 2]);
    }
}

//[a,b)の最小値を求める
//query(a, b, 0, 0, ns)で呼ぶ
long long query(int a, int b, int k, int l, int r){
    if(r <= a || b <= l) return 0;
    if(a <= l && r <= b) return dat[k];
    else{
        long long vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
        long long vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
        return min(vl, vr);
    }
}

int main() {
    // your code goes here
    ll n, h[max_n], a[max_n], hk[max_n], dp[max_n];
    cin >> n;
    rep(i,0,n-1){
    	cin >> h[i];  h[i]--;
    	hk[h[i]] = i;
    }
    rep(i,0,n-1){
    	cin >> a[i];
    	a[i] = -a[i];
    }
    rmq_init(n);
    rep(i,0,n-1){
    	dp[i] = query(0,hk[i],0,0,ns) + a[hk[i]];
    	update(hk[i],dp[i]);
    }
    cout << -query(0,n,0,0,ns) << endl;
    return 0;
}

Measured memory_bytes: 17408
/*
このコード、と～おれ!
Be accepted!
  ∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
　　　　　　　　　　(¸.·´ (¸.·'* ☆
*/

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printfin(a) printf(a ? "possible\n" : "inposible\n")
#define all(x) (x).begin(), (x).end()
using ll = long long;

//マクロとかここまで

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>

using namespace std;

int main() {
	
	int n, p, count = 0;
	scanf("%d", &n);
	rep(i, n) {
		scanf("%d", &p);
		if (i + 1 != p)++count;
	}
	
	printYN(count == 2 || count == 0);

	return 0;
}


Measured memory_bytes: 128
a,op,b = input().split()
a = int(a)
b = int(b)
while op != '?':
    if op == '+':
        c = a+b
        print(c)
    elif op == '-':
        c = a-b
        print(c)
    elif op == '*':
        c = a*b
        print(c)
    else:
        c = a//b
        print(c)
    a,op,b = input().split()
    a = int(a)
    b = int(b)



Measured memory_bytes: 5596
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

// Solution
public class Main {
  private static Scanner in;
  private static PrintWriter out;
  private static final String INPUT = ""; // input file name

  /**
   * Interactive get next command
   */
  static int get(int pos) {
    out.println(pos + 1);
    out.flush();
    return ni();
  }

  static void solve() {
    int h = ni();
    int w = ni();

    // is this empty space
    boolean[][] arr = new boolean[h][w];
    for (int i = 0; i < h; i++) {
      char[] split = in.next().toCharArray();
      int j = 0;

      for (char s : split) {
        arr[i][j++] = s == '.';
      }
    }

    long[][] dp = new long[h][w];
    dp[0][0] = 1;

    for (int i = 1; i < h; i++)
      dp[i][0] = arr[i][0] ? dp[i - 1][0] : 0;
    for (int j = 1; j < w; j++)
      dp[0][j] = arr[0][j] ? dp[0][j - 1] : 0;

    int mod = (int) 1e9 + 7;

    for (int i = 1; i < h; i++) {
      for (int j = 1; j < w; j++) {
        dp[i][j] = arr[i][j] ? (dp[i][j - 1] % mod + dp[i - 1][j] % mod) % mod : 0;
      }
    }

    out.println(dp[h - 1][w - 1]);
  }

  public static void main(String[] args) throws Exception {
    long S = System.currentTimeMillis();
    in = INPUT.isEmpty() ? new Scanner(System.in) : new Scanner(INPUT);
    out = new PrintWriter(System.out);

    solve();
    out.flush();
    long G = System.currentTimeMillis();
    tr(G - S + "ms");
  }

  private static int gcd(int a, int b) {
    while (b != 0) {
      int t = b;
      b = a % b;
      a = t;
    }

    return a;
  }

  private static int ni() {
    return in.nextInt();
  }

  private static String nt() {
    return in.next();
  }

  private static String ns() {
    return in.nextLine();
  }

  private static long nl() {
    return in.nextLong();
  }

  // Math Utils
  private static int pi(int num, int pow) {
    int result = 1;

    while (pow > 0) {
      if (pow % 2 == 1) {
        result *= num;
      }

      num *= num;
      pow /= 2;
    }

    return result;
  }

  private static int pim(int num, int pow, int mod) {
    int result = 1;

    while (pow > 0) {
      if (pow % 2 == 1) {
        // keep collecting `odd` num in result
        result = (result * num) % mod;
      }

      num = (num * num) % mod;
      pow /= 2;
    }

    return result;
  }

  private static long pl(long num, long pow) {
    long result = 1;

    while (pow > 0) {
      if (pow % 2 == 1) {
        result *= num;
      }

      num *= num;
      pow /= 2;
    }

    return result;
  }

  private static long plm(long num, long pow, long mod) {
    long result = 1;

    while (pow > 0) {
      if (pow % 2 == 1) {
        // keep collecting `odd` num in result
        result = (result * num) % mod;
      }

      num = (num * num) % mod;
      pow /= 2;
    }

    return result;
  }

  static void tr(Object... o) {
    if (!INPUT.isEmpty())
      out.println(Arrays.deepToString(o));
  }
}


Measured memory_bytes: 49300
#include <iostream>
#include <vector>
#include <map>

using std::cout;
using std::endl;
using std::cin;

int main(int argc, char* argv[])
{
  int s,w;
  cin >> s >> w;
  std::string result =  (w >= s) ? "unsafe" : "safe";
  std::cout << result << std::endl;
  return 0;
}


Measured memory_bytes: 3592
#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl
#define tarce(x) cerr<<#x<<": "<<x<<" "<<endl
#define trace2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define sa(a,n) for(int i =0 ; i<n ; i++) cin>>a[i]
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define pb push_back
#define inf 2e18
#define scan() int n; cin>>n ; int a[n+1]; for(int i = 1 ; i<=n ; i++) cin>>a[i]
#define scan2() int n,k; cin>>n>>k ; int a[n+1]; for(int i = 1 ; i<=n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) cout<<a[i]<<' '
#define mem(a,v) memset(a,v,sizeof(a))
#define pii pair<int,int>
#define mkp make_pair
using namespace std;
#define N 200005


int32_t main(){
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);

        string s;
        cin >> s;
        int n=s.size();
        int w=0;
        if(s[2]==s[3] && s[4]==s[5]){
            cout << "Yes" << '\n';
        }
        else{
            cout << "No" << '\n';
        }

}

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

using namespace std;

const int MAXN = 5e5 + 10;

int n, k, cnt, arr[MAXN], bit[MAXN], newarr[MAXN];
int answer[MAXN];
pair<int, int> seg[4 * MAXN];
int lazy[4 * MAXN];

void bit_upt(int id, int val)
{
	for (; id < MAXN; id += id & (-id))
		bit[id] += val;
	return;
}

int bit_get(int id)
{
	int res = 0;
	for (; id; id &= id - 1)
		res += bit[id];
	return res;
}

pair<int, int> cmp(pair<int, int> l, pair<int, int> r)
{
	if (l.first < r.first)
		return l;
	return r;
}

void build(int l = 1, int r = n + 1, int id = 1)
{
	if ((r - 1) == l)
	{
		seg[id] = {newarr[l], l};
		return;
	}
	int mid = l + r >> 1;
	build(l, mid, id << 1);
	build(mid, r, id << 1 | 1);
	seg[id] = cmp(seg[id << 1], seg[id << 1 | 1]);
	return;
}

void assign(int g, int l = 1, int r = n + 1, int id = 1)
{
	if (l == (r - 1))
	{
		seg[id] = {1e9 - lazy[id], l};
		return;
	}
	int mid = l + r >> 1;
	if (g < mid)
		assign(g, l, mid, id << 1);
	else
		assign(g, mid, r, id << 1 | 1);
	seg[id] = cmp(seg[id << 1], seg[id << 1 | 1]);
	seg[id].first -= lazy[id];
	return;
}

void upt(int s, int e, int l = 1, int r = n + 1, int id = 1)
{
	if (l >= s && r <= e)
	{
		lazy[id]++;
		seg[id].first--;
		return;
	}
	if (l >= e || r <= s)
		return;
	int mid = l + r >> 1;
	upt(s, e, l, mid, id << 1);
	upt(s, e, mid, r, id << 1 | 1);
	seg[id] = cmp(seg[id << 1], seg[id << 1 | 1]);
	seg[id].first -= lazy[id];
	return;
}

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin >> n >> k;
	for (int i = 1; i <= n; i++)
	{
		cin >> arr[i];
	}
	k--;
	for (int i = 1; i <= k; i++)
	{
		bit_upt(arr[i], 1);
		cnt++;
	}
	for (int i = 1; i <= n; i++)
	{
		if ((i + k) <= n)
		{
			bit_upt(arr[i + k], 1);
			cnt++;
		}
		if ((i - k - 1) >= 1)
		{
			bit_upt(arr[i - k - 1], -1);
			cnt--;
		}
		newarr[i] = cnt - bit_get(arr[i]);
	}
	build();
	for (int i = n; i; i--)
	{
		int id = seg[1].second;
		answer[id] = i;
		assign(id);
		upt(max(1, id - k), min(n, id + k) + 1);
	}
	for (int i = 1; i <= n; i++)
		cout << answer[i] << '\n';
	return 0;
}

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

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

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

//vector<vector<ll> > comb(ll n, ll b){





int main(){
  ll n,q,a,b,p,k,x,cnt,MOD,ans;
  // MOD = 1000000007;
  ans = 0;

  set<ll> s;

  cin >> n;

  rep(i,n){
    cin >> q;
    s.insert(q);
  }
  if (s.size()!=n) cout << "NO" << endl;
  else cout << "YES" << endl;
}


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

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

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

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

  int64_t H, W;
  cin >> H >> W;
  vector<vector<bool>> is_open(H + 2, vector<bool>(W + 2, false));
  for (int64_t i = 1; i <= H; ++i) {
    string s;
    cin >> s;
    for (int64_t j = 1; j <= W; ++j) {
      if (s.c_str()[j - 1] == '.') {
        is_open[i][j] = true;
      }
    }
  }

  vector<vector<int64_t>> dp(H + 2, vector<int64_t>(W + 2, 0));
  const int64_t kMod = 1000000007LL;
  for (int64_t i = 1; i <= H; ++i) {
    for (int64_t j = 1; j <= W; ++j) {
      if (i == 1 && j == 1) {
        dp[i][j] = 1;
      } else if (is_open[i][j]) {
        dp[i][j] += dp[i - 1][j] + dp[i][j - 1];
        dp[i][j] %= kMod;
      }
    }
  }

  cout << dp[H][W] << endl;
  return 0;
}


Measured memory_bytes: 11324
//R<3S
#include <bits/stdc++.h>
#define hell 1000000007
#define PI 3.14159265358979323844
#define mp make_pair
#define pb push_back
#define fi first 
#define se second
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))  
#define REVERSE(v) reverse(ALL(v))
#define endl "\n"
#define vecmax(v) max_element(all(v))
#define vecmin(v) min_element(all(v))
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) m*(n/GCD(m,n))
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(x) for(auto i : x)
#define sz(a) (int)a.size()
#define sl(a) (int)a.length()
#define int long long
#define ld long double 
#define pii std::pair<int, int> 
#define pll std::pair<ll, ll>  
#define vi vector<int>  
#define vl vector<ll>
#define vvi vector<vi > 
#define vii vector<pii >
#define mii map<int,int>
#define mll map<ll,ll>


using namespace std;

string s,t;
int n,m;
int dp[3001][3001];
string ans;
int find(int i,int j)
{
	if(i==0||j==0)return dp[i][j]=0;
	
	if(dp[i][j]!=-1)return dp[i][j];
	
	if(s[i-1]==t[j-1]){return dp[i][j]=1+find(i-1,j-1);}
	else return dp[i][j]=max(find(i-1,j),find(i,j-1));
}
void prints(int i,int j)
{
	if(i==0||j==0)return;
	// cout<<i<<" "<<j<<endl;
	if(s[i-1]==t[j-1]){ans.pb(s[i-1]);prints(i-1,j-1);}
	else if(dp[i-1][j]>dp[i][j-1])prints(i-1,j);
	else prints(i,j-1);
}
void solve()
  {
	cin>>s>>t;
	n=sz(s);m=sz(t);
	ans.clear();
	repA(i,0,n)repA(j,0,m)dp[i][j]=-1;
	find(n,m);

	prints(n,m);
	REVERSE(ans);
	cout<<ans;


  }



signed main()
{
   std::ios_base::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
   int t;
   t=1;
   //cin>>t;
   while(t--)
    {
        solve();
    }


   return 0;
}


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

struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) { }
	bool unionSet(int x, int y) {
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};


struct Edge {
	int a, b, cost;

	Edge(int a, int b, int cost) : a(a), b(b), cost(cost) {}

	bool operator<(const Edge& o)const {
		return cost < o.cost;
	}
};

int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	int n, Ans = 0; cin >> n;
	vector<Edge> es;
	for (int i = 1; i <= n;i++) {
		for (int j = 1; j <= n; j++) {
			int temp; cin >> temp;
			if (j < i)continue;
			if (temp != -1) {
				Edge e(i, j, temp);
				es.push_back(e);
			}
		}
	}
	sort(es.begin(), es.end());

	/*kruskal*/

	UnionFind uf(n+1);
	for (int i = 0; i < es.size();i++) {
		//cout << es[i].a << " " << es[i].b << " " << es[i].cost << endl;
		Edge& e = es[i];
		if (!uf.findSet(e.a, e.b)) {
			Ans += e.cost;
			uf.unionSet(e.a, e.b);
		}
	}

	cout << Ans << endl;

}

Measured memory_bytes: 3336
#include <stdio.h>

int main() {
    long long x;
    long long s, e, m;
    
    scanf("%lld", &x);
    s = 1;
    e = 100000;
    //printf("[%d]\n", e);
    while(s < e) {
        m = (s + e) / 2;
        if(m * (m + 1) / 2 < x) s = m + 1;
        else e = m;
    }
    printf("%lld\n", s);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <string.h>
#include <math.h>
#include <stdlib.h>
using namespace std;

int main(void) {
	// your code goes here
	char s[100001];
	cin >> s;
	int n=strlen(s),i,j,a[100001];
	for(i=1;i<=n;i++){
		if(s[i-1]=='0') a[i]=0;
		if(s[i-1]=='1') a[i]=1;
	}
	if(a[1]==0||a[n]==1){
		cout << -1 << endl;
		return 0;
	}
	for(i=1;i<=n;i++){
		if(a[i]!=a[n-i]){
			cout << -1 << endl;
			return 0;
		}
	}
	a[n]=1;
	i=2;
	int save=1;
	while(i<=n){
		if(a[i]==1){
			for(j=save;j<i;j++) cout << j << " " << i << endl;
			save=i;
		}
		i++;
	}
	return 0;
}


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

const long long INF = 1LL<<50;

int main(){
    int n,k;
    cin >> n >> k;
    
    vector<int> x(n);
    for (int i = 0; i < n; i++) cin >> x[i];
    
    long long ans = INF;
    
    for (int i = 0; i + k -1 < n; i++){
        long long cost1 = abs(x[i]) + (x[i+k-1] - x[i]);
        long long cost2 = abs(x[i+k-1]) + (x[i+k-1] - x[i]);
        
        ans = min(ans, cost1);
        ans = min(ans, cost2);
    }
    
    cout << ans << endl;
}

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

typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define pi pair<int,int>
#define vi vector<int>
#define vvi vector<vector<int> >
#define vvl vector<vector<long long> >
#define vl vector<ll>
#define vii vector<pair<int,int> >
#define vll vector<pair<long long,long long> >
#define pb push_back
#define mp make_pair3

const ll mod=1e9+7;
#define MAX 100000

int modulo = 420047;

ll binexpo(ll a,ll b,ll c){

    if(b==0) return 1;
    else if(b%2==0) return binexpo(((a%c)*(a%c))%c,b/2,c)%c;
    else return ((a%c)*(binexpo(((a%c)*(a%c))%c,b/2,c)%c))%c;
}

int main(){

    int n;
    cin>>n;

    int arr[n];
    FOR(i,0,n) cin>>arr[i];

    ll dp[n];
    memset(dp,INT_MAX,sizeof(dp));

    dp[0] = 0;
    dp[1] = abs(arr[1] - arr[0]);
    FOR(i,2,n){
        ll val1 = dp[i-1] + abs(arr[i] - arr[i-1]);
        ll val2 = dp[i-2] + abs(arr[i] - arr[i-2]);
        dp[i] = min(val1,val2);
    }

    cout<<dp[n-1];

    return 0;
}




Measured memory_bytes: 1408
import sys
import heapq
sys.setrecursionlimit(10**6)
def MAP(): return [int(s) for s in input().split()]

if sys.platform =='ios':
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline

N, M = MAP()
# heapq.heappop（優先度『最小』の品物をO(logN)で取得）のため入力値をマイナスに変換
A = [int(s)*-1 for s in input().split()]

# 品物のリストをheapqのオブジェクトに変換
heapq.heapify(A)

while M > 0:
	# 以下、heapq　の計算誤差を防ぐため、(1) も (2) もそれぞれ -1 をかける
	# (1) 最小値を取り出す
	discount = heapq.heappop(A)*-1
	# (2) 最小値を2で切り捨て割ったものをAに戻す
	heapq.heappush(A, discount//2*-1)
	M -= 1

print(sum(A)*-1)

Measured memory_bytes: 14168
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

s = input()
n = len(s)
ans = inf
for i in range(n-3+1):
    t = int(s[i:i+3])
    ans = min(ans,abs(753-t))
print(ans)

Measured memory_bytes: 38256
N=int(input())
*p,=map(int,input().split())

l=[i for i,j in enumerate(p,start=1) if i==j]
n=len(l)
p=0
ans=0

if not l:
    print(0)
else:
    while p<n:
        if p<n-1:
            if l[p]+1==l[p+1]:
                p+=2
            else:
                p+=1
        else:
            p+=1
        ans+=1

    print(ans)

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

int main()
{
    long a, b;
    long v, w;
    long kyori;
    long speed, t;

    cin >> a >> v >> b >> w >> t;

    kyori = abs(b - a);
    speed = v - w;


    if (speed * t - kyori >= 0)
    {
        cout << "YES" << endl;
    }

    else
    {
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  int n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}


int main(){
  ll N,H;cin>>N>>H;
  vl a(N);
  vl b(N);
  rep(i,N)cin>>a[i]>>b[i];

 
  sort(all(a));
  reverse(all(a));
 
  sort(all(b));
  reverse(all(b));
  ll ans =0;
  rep(i,N){
    if(a[0]<=b[i]){H -= b[i];ans++;}
    if(H<=0)break;
  }

  if(H>0)ans +=(H+a[0]-1)/a[0];
    
  cout<<ans<<endl;
  
  
}
  


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;

int main(){
    int k; cin >> k;
    string s; cin >> s;
    if(s.size() <= k) cout << s << endl;
    else {
        string t = s.substr(0,k);
        t += "...";
        cout << t << endl;
    }
    return 0;
}

Measured memory_bytes: 3632
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <limits>
#include <list>
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define int_INF 2147483647
#define pint_INF 2000000000
#define ll_INF 	9223372036854775807
#define MOD 1000000007
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvll vector<vector<long long>>
#define vvc vector<vector<char>>
#define vll vector<long long>
#define pii pair<int,int>
#define vpii vector<pair<int,int>>
#define sysp system("PAUSE")
#define pno cout << "no" << endl
#define pyes cout << "yes" << endl
#define pYes cout << "Yes" << endl
#define pNo cout << "No" << endl
#define pNO cout << "NO" << endl
#define pYES cout << "YES" << endl
#define endl "\n"
#define pi 3.14159265358979
using namespace std;
using ll = long long;
#define int ll
signed main(){
    int n,a,b; cin >> n >> a >> b;
    vi vec(n); rep(i,n) cin >> vec[i];
    vi diff(n-1);
    for(int i = 0; i < n-1; i++){
        diff[i] = (vec[i+1] - vec[i]) * a;
    }

    int res = 0;
    for(auto d:diff){
        res += min(d,b);
    }
    cout << res << endl;
    sysp;
}

Measured memory_bytes: 4852
#include<bits/stdc++.h>
using namespace std;
#define LL long long
const int N = 1e5 + 11;
int n, k, q;
LL cha[N];
int read(){
    int x = 0;
    char ch = getchar();
    while(ch > '9' || ch < '0')ch = getchar();
    while(ch >= '0' && ch <= '9')x = 10 * x + ch - 48, ch = getchar();
    return x;
}
int main(){
    n = read(); k = read(); q = read();
    for(int i = 1;i <= q; i++){
        int x = read();
        cha[1]--;
        cha[x]++;
        cha[x+1]--;
        cha[n+1]++;
    }
    for(int i = 1;i <= n; i++)cha[i] += cha[i-1];
    for(int i = 1;i <= n; i++){
        cha[i] += k;
        if(cha[i] > 0)puts("Yes");
        else puts("No");
    }
    return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <string>

int main()
{
    int n,taro,hanako;
    std::cin >> n;

    taro=hanako=0;
    for (int i=0; i<n; i++) {
        std::string ts,hs;
        std::cin >> ts >> hs;
        size_t tl = ts.size();
        size_t hl = hs.size();
        for (int j=0; j<100; j++) {
            if (ts[j]>hs[j]){
                taro+=3;
                break;
            }
            else if (ts[j]<hs[j]){
                hanako+=3;
                break;
            }
            else if (j==tl-1 && j==hl-1) {
                taro++;
                hanako++;
                break;
            }
        }
    }
    std::cout << taro << " " << hanako << std::endl;

    return 0;
}



Measured memory_bytes: 3160
#include <stdio.h>

void gcd_and_lcm( int a, int b, int* g, int* l ){
	int tmp, ta=a, tb=b;
	
	if( ta<tb ){
		tmp=ta; ta=tb; tb=tmp;
	}
	
	while( ta != tb ){
		ta = ta - tb;
		if( ta<tb ){
			tmp=ta; ta=tb; tb=tmp;
		}
	}

	*g = ta;
	*l = a*(b/(*g));
	
}

int main(){
	int a, b, G, L;

	while( scanf("%d %d", &a, &b) != EOF ){
		gcd_and_lcm( a, b, &G, &L );
		printf("%d %d\n", G, L);
	}

	return 0;
}

Measured memory_bytes: 592