akhauriyash/Code-Regression huggingface dataset:
# -*- coding: utf-8 -*-

import sys
import math

debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
#        for line in sys.stdin:
#            lines.append(line)
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]
    


    h = int(lines[0])

    return (h, )

def solve(h, ):

    current_h = h
    total_count = 1
    current_count = 1
    while True:
        
        if current_h == 1:
            break

        current_h = current_h // 2
        current_count = 2 * current_count
        total_count = total_count + current_count


    result = total_count 

    return result

def main():
    # 出力
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r)
    else:
        print("%s" % result)

if __name__ == '__main__':

    main()
	

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

int main(){
    string S;
    string A = "ABC";
    cin >> S;

    int size, N = 1000000007;
    size = (int)S.size();
    vector< vector<long long> > dp;
    dp = vector< vector<long long> >(size + 1, vector<long long>(4,0));
    dp[size][3] = 1;
    for(int i=1;i<3;i++){
        dp[size][i] = 0;
    }
    for(int i=size - 1;i>=0;i--){
        if(S[i] == '?') dp[i][3] = (3 * dp[i+1][3])%N;
        else dp[i][3] = dp[i+1][3];
    }
    for(int j=2;j>=0;j--){
        for(int i=size -1;i>=0;i--){
            if(S[i] == '?'){
                dp[i][j] =3 * dp[i+1][j] + dp[i+1][j+1];
            }else if(S[i] == A[j]){
                dp[i][j] =dp[i+1][j] + dp[i+1][j+1];
            }else{
                dp[i][j] = dp[i+1][j];
            }
            dp[i][j] %= N;
        }
    }
    cout << dp[0][0]<< "\n";

}


Measured memory_bytes: 7424
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

score = sum(B)
for a, b in zip(A, A[1:]):
  if a == b-1:
    score += C[a-1]  
    
print(score)    

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <iostream>
typedef long long ll;
#define rep(i,a,b) for(ll i =a ;i <= b;i++)
#define per(i,a,b) for(ll i =a ;i >= b;i--)
using namespace std;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;

vvi graph;
vi h;
int n,m;
vector<bool> tallest,visited;

void dfs(int index)
{
	//cout<<index<<" \n";
	if(visited[index])
		return;
	visited[index] = true;
	for(auto edge: graph[index])
	{
		if(h[edge] >= h[index]){
			//cout<<index<<" Rejected\n";
			tallest[index] = false;
			break;
		}
	}
	for(auto edge: graph[index])
		dfs(edge);
	

}

int main(int argc, char const *argv[])
{
	//ifstream cin("input.txt");
	int x,y;
	cin>>n>>m;
	h = vi(n);
	graph = vvi(n);
	tallest = vector<bool>(n,true);
	visited = vector<bool>(n,false);
	rep(i, 0, n-1)
		cin>>h[i];

	rep(i, 0, m-1)
	{
		cin>>x>>y;
		x--;
		y--;
		graph[x].push_back(y);
		graph[y].push_back(x);
	}
	rep(i, 0, n -1)
		if(!visited[i])
			dfs(i);

	cout<<count(tallest.begin(), tallest.end(), true);
	
}

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

using namespace std;

int main()

{


   int n;
   cin>>n;

   int arr[n];

   for(int i=0;i<n;i++)
   {
       cin>>arr[i];
   }

    bool bol = true;
    arr[n-1]++;
    for(int i=n-1;i>=1;i--)
    {
        if(arr[i]==arr[i-1])
          continue;
        if(arr[i]>arr[i-1])
        {
            arr[i-1]++;
            continue;
        }
        if(arr[i]<arr[i-1])
        {
            bol = false;
            break;
        }

    }

     if(bol)
        cout<<"Yes"<<endl;
     else
        cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

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

	for (size_t i = 0; i < N; i++) {
		int a;
		cin >> a;
		A.push_back(a);
	}

	int ans = ((N-1) + (K-2)) / (K-1);

	cout << ans << endl;
}


Measured memory_bytes: 892
def p_d():
    N = int(input())
    A = list(map(int, input().split()))
    B = [0] * N
    ans = []

    for i in reversed(range(1, N + 1)):
        target = N // i
        v = sum([B[i * j - 1] for j in range(1, target + 1)])
        if v % 2 != A[i - 1]:
            B[i - 1] = 1
            ans.append(i)

    print(len(ans))
    if ans:
        print(" ".join(map(str, ans)))


if __name__ == '__main__':
    p_d()


Measured memory_bytes: 19888
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>

using namespace std;

typedef long long ll;

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

int main() {
    int A, B; cin >> A >> B;
    if (A < 9 && B < 9) cout << "Yay!" << endl;
    else cout << ":(" << endl;
}


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

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

using namespace std;
using ll = long long;
int mod = 1000000007;

int main(void){
    int N; cin >> N;
    int A[N]; rep(i, N) cin >> A[i];
    sort(A, A+N);
    if(A[N-1]-A[0] >= 2){
        cout << "No" << endl;
    }
    else if(A[N-1]-A[0] == 1){
        // 2 2 3 3 3はあり得るか? -> ある a b c c c

        // a a a ... a a+1 a+1 a+1 ... a+1
        // a+1同士は同じ色でないといけないか?そんなことはないはず
        // aとa+1は同じ色だとまずいか?
        // aとa+1から見ると,お互い以外は見ているものが同じなのに見える色の種類が1違う
        // a+1側から見るとaは他のどれとも違う色で,a側から見るとa+1は他のどれかと同じ色でなくてはいけない
        // すると、aは互いに異なる色である必要があることがわかる
        // aの個数をkとすると、k <= a+1
        // 残りのa+1-k種類をa+1で頑張る
        // a+1-k=0 -> 
        // 2 2 2 3は? -> むり
        // 3 3 3 3 4は?
        int k = 1;
        int i = 0;
        while(A[i] == A[i+1]){k++; i++;}
        if(k <= A[N-1]){
            int rem = A[N-1]-k;
            if(rem == 0) cout << "No" << endl;
            else if((N-k)/rem >= 2) cout << "Yes" << endl;
            else cout << "No" << endl;
        }
        else{
            cout << "No" << endl;
        }
    }
    else{
        if(N/A[0] >= 2 || A[0] == N-1) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <fstream>
#include <chrono>
#include <random>
#include <bitset>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) ((int)(x).size())
#define pb push_back
using ll = long long;
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
const ll mod = 1000000007;

int main(){
  string L; cin >> L;
  int N = sz(L);
  ll dp1[101000];
  ll dp2[101000];
  dp1[0] = 0;
  dp2[0] = 1;
  rep(i,N){
    if(L[i]=='0'){
      dp1[i+1] = dp1[i]*3;// + dp2[i];
      dp2[i+1] = dp2[i];
    }
    if(L[i]=='1'){
      dp1[i+1] = dp1[i]*3 + dp2[i];
      dp2[i+1] = dp2[i]*2;
    }
    dp1[i+1]%=mod;
    dp2[i+1]%=mod;
    //cout << dp1[i+1]+dp2[i+1] << endl;
  }
  cout << (dp1[N]+dp2[N])%mod << endl;
  return 0;
}


Measured memory_bytes: 5320
#include<bits/stdc++.h>
#define Q 1000000007
#define N 2010
using namespace std;
int dp[N+N][N],k;
bool chk[N+N][N];
int solve(int lv,int num){
	if(lv==0) return num?0:1;
	if(chk[lv][num]) return dp[lv][num];
	chk[lv][num]=true;
	for(int i=0;i<=num&&i<k;i++){
		dp[lv][num]+=solve(lv-1,num-i);
		if(dp[lv][num]>=Q) dp[lv][num]-=Q;
	}
	return dp[lv][num];
}
int main(){
	int n,m,ans=0;
	scanf("%d%d%d",&n,&m,&k);
	int lv=(n+m-1)/(k-1);
	for(int i=0;m-i*(k-1)>0;i++){
		ans=(ans+solve(lv-i,m-i*(k-1)))%Q;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 37888
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
   /* #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif*/
        /* 
        Ofcourse it's Hard.
        It's supposed to be Hard.
        If it's easy everyone would do it.
        HARD IS WHAT MAKES IT GREAT

        YESTERDAY U SAID TOMORROW

        SLOWLY BECOMING THE PERSON I 
        SHOULD HAVE BEEN A LONG TIME AGO

        SAME TASK CAN'T BE FOUND DIFFICULT TWICE

        BTBHWSITW

        SPRH TU KAB P

        CP IS ALL ABOUT THINKING 
        YOU HAVE MUCH MORE POTENTIAL THAN U THINK

        AJIT SHIDDAT 10

        UR DAILY ROUTINE 


        */

fast();
//ll t;cin>>t;while(t--)
{
    ll a;
    cin>>a;
    if(a<1000)
        cout<<"ABC"<<endl;
    else
        cout<<"ABD"<<endl;
    
    
}
return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            A();
        }

        static void A()
        {
            var abx = ReadSplitLong();
            var a = abx[0];
            var b = abx[1];
            var x = abx[2];
            var c = a == 0 ? -1 : (a - 1) / x;

            long ans = 0;
            if (a == 0)
            {
                ans = b / x + 1;
            }
            else
            {
                ans = b / x - (a - 1) / x;
            }
            Println(ans);
        }

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int SumDigits(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static int Gcd(int a, int b) => b == 0 ? a : Gcd(b, a % b);

        static bool IsPrime(int x)
        {
            if (x <= 1 || (x != 2 && x % 2 == 0)) return false;
            if (x == 2) return true;

            for (int i = 3; i < x; i += 2)
                if (x % i == 0) return false;

            return true;
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
        static List<long> ReadSplitLong() => Read().Split().Select(long.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());

        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}


Measured memory_bytes: 13396
using System;
class Program
{
	static void Main(string[] args)
	{
		// スペース区切りの整数の入力
		string[] input = Console.ReadLine().Split(' ');
        int i = 1;
		foreach(string str in input)
        {
         	if(str == "0")
            {
           		Console.WriteLine(i);
              	break;
            }
          i++;
        }
	}
}

Measured memory_bytes: 25932
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	int h[50];
	int cnt=0;
	int yn=1;
	for(int i=0;i<n;i++){
		yn=1;
		cin>>h[i];
		for(int j=0;j<i;j++){
			if(h[i]<h[j]){
				yn=0; 
				break;
			}
		}
		if(yn==1){
			cnt++;
		}
	}
	cout<<cnt;
	return 0;
} 

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.TreeSet;

public class Main {
	void run() {
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		TreeSet<Integer> set = new TreeSet<Integer>();
		
		for (int i = a; ; i += a) {
			if (i % b == c) {
				System.out.println("YES");
				return;
			} else if (!set.contains(i % b)) {
				set.add(i % b);
			} else {
				break;
			}
		}
		System.out.println("NO");
	}

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


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

using namespace std;

int main() {
  int a, b;
  cin >> a >> b;
  if (a > b) {
    swap(a, b);
  }
  if (a == 1) {
    if (b == 1) {
      cout << 1 << endl;
    } else {
      cout << b - a - 1 << endl;
    }
  } else {
    cout << 1LL * (a - 2) * (b - 2) << endl;
  }
}


Measured memory_bytes: 256
N,Y = map(int,input().split())

for x in range(N+1):
  for y in range(N+1):
    z = N - x - y
    if z < 0:
      continue
    if 10000 * x + 5000 * y + 1000 * z == Y:
      print(x,y,z)
      exit()

print(-1,-1,-1)


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

using namespace std;
#define NUMMAX 1500
#define CMAX (NUMMAX * (NUMMAX + 1) / 2)

void makecvec(vector<int>& in, vector<int>& out) 
{
    for (int ni = 0; ni < (int)in.size(); ni++) {
        for (int pi = 0; pi < (int)in.size() - ni; pi++) {
            int sum = 0;
            for (int si = 0; si < ni + 1; si++)
                sum += in[pi + si];
            out.push_back(sum);
        }
    }
}

int main(void)
{
    int n, m;
    while (cin >> n >> m) {
        if (!n && !m) break;
        vector<int> h(n), w(m);
        for (int i = 0; i < n; i++) cin >> h[i];
        for (int i = 0; i < m; i++) cin >> w[i];

        vector<int> hs, ws;
        hs.reserve(CMAX), ws.reserve(CMAX);
        makecvec(h, hs), makecvec(w, ws);
        sort(hs.begin(), hs.end()), sort(ws.begin(), ws.end());

        int result = 0;
        int hi = 0, wi = 0;
        while (hi != (int)hs.size() && wi != (int)ws.size()) {
            if (hs[hi] == ws[wi]) {
                int hn = 0, wn = 0;
                while (hi != (int)hs.size() && hs[hi] == hs[hi-hn]) 
                    hi++, hn++;
                while (wi != (int)ws.size() && ws[wi] == ws[wi-wn]) 
                    wi++, wn++;
                result += wn * hn;
            } else if (hs[hi] < ws[wi]) 
                hi++;
            else 
                wi++;
        }
        cout << result << endl;
    }

    return 0;
}

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

int main(){

    string a,b;
    cin >> a >> b;
    a += b;
    int new_num = atoi(a.c_str());
    int sqrt_num = (int)sqrt((double)new_num);
    if(sqrt_num*sqrt_num == new_num){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

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

int main() {
    int A, B;
    string S;
    cin >> A >> B;
    cin >> S;
    
    for (int i=0; i<S.size(); i++) {
        if (i != A && S[i] == '-') {
            cout << "No" << endl;
            return 0;
        }
        else if (i == A && S[i] != '-'){
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
}


Measured memory_bytes: 256
from __future__ import division, print_function

''' Hey stalker :) '''
INF = 10 ** 10
TEST_CASES = False

def main():
    n = get_int()
    starts = []
    ends = []
    for i in range(n):
        x, y = get_list()
        starts.append(x)
        ends.append(y)
    starts.sort()
    ends.sort()
    flo = n//2
    if n%2==0:
        a = starts[flo] + starts[flo-1]
        b = ends[flo] + ends[flo-1]
    else: a,b = starts[flo], ends[flo]
    print(b-a+1)


''' FastIO Footer: PyRival Library, Thanks @c1729 and contributors '''
import os
import sys
from bisect import bisect_left, bisect_right
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip
BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
# else:
#     sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")
get_int = lambda: int(input())
get_list = lambda: list(map(int, input().split()))

if __name__ == "__main__":
    if TEST_CASES:
        [main() for _ in range(int(input()))]
    else:
        main()


Measured memory_bytes: 104276
import java.util.Arrays;
import java.util.Scanner;
 
public class Main {
    static String[] a;
    static String[] b;
    static String temp;
 
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        a = scanner.nextLine().split(" ");
        b = scanner.nextLine().split(" ");
        char[] c = { 'E', 'E', 'E', 'N', 'W', 'W', 'W', 'S' };
         
        boolean flag = false;
        for(int i=0;i<3;i++){
            for(char d:c){
                roll(d);
                if(Arrays.equals(a, b)){
                    flag=true;
                    break;
                }
            }
        }
        if(flag)
            System.out.println("Yes");
        else
            System.out.println("No");
    }
 
    public static void roll(char c) {
        switch (c) {
        case 'E':
            temp = a[0];
            a[0] = a[3];
            a[3] = a[5];
            a[5] = a[2];
            a[2] = temp;
            break;
        case 'N':
            temp = a[0];
            a[0] = a[1];
            a[1] = a[5];
            a[5] = a[4];
            a[4] = temp;
            break;
        case 'W':
            temp = a[0];
            a[0] = a[2];
            a[2] = a[5];
            a[5] = a[3];
            a[3] = temp;
            break;
        default:
            temp = a[0];
            a[0] = a[4];
            a[4] = a[5];
            a[5] = a[1];
            a[1] = temp;
            break;
        }
    }
 
}


Measured memory_bytes: 26244
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int H=sc.nextInt(),W=sc.nextInt();
		String[][] map = new String[H][W];
		boolean[] getH = new boolean[H];
		boolean[] getW = new boolean[W];

 		for(int i=0;i<H;i++) {
 			map[i]=sc.next().split("");
			for(int j=0;j<W;j++) {
				if(map[i][j].equals("#")) {
					getH[i]=true;
					getW[j]=true;
				}
			}
		}

 		for(int i=0;i<H;i++) {
 			if(getH[i]) {
 				for(int j=0;j<W;j++) {
 					if(getW[j]) {
 						System.out.print(map[i][j]);
 					}
 				}
 				System.out.println();
 			}
 		}
	}
}

Measured memory_bytes: 27912
s = input()
a = [0 for i in range(len(s))]

cnt = 0
for i in range(len(s)):
  if s[i]=='R':
    cnt += 1
    if i==len(s)-1:
      a[i] += cnt
  else:
    if i>0:
      a[i-1] += cnt
    cnt = 0

cnt = 0
for i in range(len(s)-1, -1, -1):
  if s[i]=='L':
    cnt += 1
    if i==0:
      a[i] += cnt
  else:
    if i<len(s)-1:
      a[i+1] += cnt
    cnt = 0

for i in range(len(s)-1):
  if s[i:i+2]=="RL":
    t1 = (a[i]+1)//2 + a[i+1]//2
    t2 = a[i]//2 + (a[i+1]+1)//2
    a[i], a[i+1] = t1, t2
print(*a)

Measured memory_bytes: 48148
<?php

 sscanf(fgets(STDIN), "%d %d", $N, $D);
 $ans = 0;
 $psec = 0;
 foreach(preg_split("/\s/", fgets(STDIN)) as $value){
  if(empty($value) && $value !== "0") continue;
  $value = intval($value);
  $sub = $value - $psec;
  if($sub > 0 && $sub < $D){
    $ans -= $D - $sub;
  }
  $ans += $D;
  $psec = $value;
 }
 echo $ans;
?>


Measured memory_bytes: 40948
#include <bits/stdc++.h>
#define rep(i, a) for(int i = 0; i < a; i++)
#define all(v) v.begin(), v.end()
#define dcout cout << fixed << setprecision(15)
#define arep(i, a) for(auto i : a)
#define F first
#define S second
#define VE vector<int>
#define pb(x) push_back(x)
#define MOD 1000000007
#define INF 10000000000
#define int long long
#define KETA(n) floor(log10(n) + 1)
using namespace std;
signed main() {
    int a, b, c;
    string s;
    cin >> a;
    cout << a * a * a + a * a + a;
    return 0;
}

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

/* 繰り返し自乗法. */
int modPow(long long a, long long n, long long p) {
	if (n == 0) return 1; // 0乗にも対応する場合.
	if (n == 1) return a % p;
	if (n % 2 == 1) return (a * modPow(a, n - 1, p)) % p;
	long long t = modPow(a, n / 2, p);
	return (t * t) % p;
}

signed main() {
    int a, b;
    cin >> a >> b;

    if (a > b) {
        rep (i, a) cout << b;
    } else {
        rep (i, b) cout << a;
    }
    cout << endl;
}



Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
int x,a,b,c,ans;
int main(){
	cin>>a>>b>>c>>x;
	for(int i=0;i<=a;i++)
		for(int j=0;j<=b;j++)
			for(int k=0;k<=c;k++)
				if(i*500+j*100+k*50==x)
					ans++;
	cout<<ans<<"\n";
	return 0;
}

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

int main() {
	int A, B, C, D;
	cin >> A >> B >> C >> D;
	cout << (ceil((double)A / D) >= ceil((double)C / B) ? "Yes" : "No") << endl;
	return 0;
}

Measured memory_bytes: 3588
#include "bits/stdc++.h"

using namespace std;

#define sp(x) cout<<setprecision(x);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define all(a) (a).begin(), (a).end()
#define inf 10000000
#define linf INT64_MAX*0.99
#define print(s) cout<<(s)<<endl
#define lint long long
#define yes "Yes"
#define no "No"

typedef pair<int, int> P;
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    vector<int> a(5);
    REP(i,5) cin>>a[i];
    int ans = 0;
    int minimum = inf;
    REP(i,5){
        ans += (a[i]+9)/10;
        a[i]%=10;
        if(a[i]!=0) minimum = min(minimum,a[i]);
    }
    ans*=10;
    if(minimum == inf) minimum = 10;
    ans +=minimum-10;
    print(ans);
    return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define For(i, a, b) for (i = a; i <= b; i++)
#define Tree(u) for (int e = adj[u], v; e; e = nxt[e]) if ((v = go[e]) != fu)

inline int read()
{
	int res = 0; bool bo = 0; char c;
	while (((c = getchar()) < '0' || c > '9') && c != '-');
	if (c == '-') bo = 1; else res = c - 48;
	while ((c = getchar()) >= '0' && c <= '9')
		res = (res << 3) + (res << 1) + (c - 48);
	return bo ? ~res + 1 : res;
}

const int N = 3005, M = N << 1;

int n, a[N], ecnt, nxt[M], adj[N], go[M];
bool f[N];

void add_edge(int u, int v)
{
	nxt[++ecnt] = adj[u]; adj[u] = ecnt; go[ecnt] = v;
	nxt[++ecnt] = adj[v]; adj[v] = ecnt; go[ecnt] = u;
}

void dfs(int u, int fu)
{
	f[u] = 0;
	Tree(u)
	{
		dfs(v, u);
		if (a[v] < a[u]) f[u] |= !f[v];
	}
}

int main()
{
	int i, x, y;
	n = read();
	For (i, 1, n) a[i] = read();
	For (i, 1, n - 1)
		x = read(), y = read(), add_edge(x, y);
	For (i, 1, n) if (dfs(i, 0), f[i]) printf("%d ", i);
	std::cout << std::endl;
	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef double db;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pw(x) (1ll << (x))
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define rep(i,l,r) for(int i=(l);i<(r);++i)
#define per(i,l,r) for(int i=(r)-1;i>=(l);--i)
#define dd(x) cout << #x << " = " << x << ", "
#define de(x) cout << #x << " = " << x << endl

//-----
const int N = 1e3 + 7;
bool dp[N];
int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	dp[1] = true;
  rep(i, 2, N) for (int j = i * i; j < N; j *= i) dp[j] = true;
	int n; cin >> n; while (!dp[n]) n--;
	cout << n;
	return 0;
}

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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int A, B, C, K;
	cin >> A >> B >> C >> K;
	
	int ans = 0;
	if (A <= K) ans += A, K -= A;
	else ans += K, K = 0;

	if (B <= K) K -= B;
	else K = 0;

	if (C <= K) ans -= C, K -= C;
	else ans -= K, K = 0;

	cout << ans << '\n';

	return 0;
}

Measured memory_bytes: 3620
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System;

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = new List<int>();
        for (int i = 0; i < n; i++)
            a.Add(int.Parse(line[i]));
        getAns(a);
    }
    static void getAns(List<int> a)
    {
        var ans = new List<int>();
        while (a.Count() > 0)
        {
            var ac = a.Count();
            var find = false;
            for (int i = ac - 1; i >= 0; i--)
            {
                if (a[i] == i + 1)
                {
                    ans.Add(a[i]);
                    a.RemoveAt(i);
                    find = true;
                    break;
                }
            }
            if (!find) { Console.WriteLine(-1); return; }
        }
        ans.Reverse();
        var sb = new StringBuilder();
        foreach (var x in ans) sb.Append(string.Format("{0}\n", x));
        Console.Write(sb);
    }
}

Measured memory_bytes: 13396
def fact(k, mod):
    a = [0] * (k + 1)
    a[0] = 1
    for i in range(1, k + 1):
        a[i] = a[i - 1] * i      
        a[i] = a[i] % mod
    return a
def power(a, n, mod):    
    if n == 0:
        return 1
    if n == 1:
        return a % mod
    if n % 2 == 0:
        return power((a * a) % mod, n // 2, mod) % mod
    else:
        return ((a % mod) * power(a % mod, n - 1, mod)) % mod
def inv(a, mod):
    c = [0] * (len(a))
    for i in range(len(a)):
        c[i] = power(a[i], mod - 2, mod)
    return c
n, m, k = [int(i) for i in input().split()]
mod = 998244353
res = fact(n - 1, mod)
res2 = inv(res, mod)
total = 0
base = power(m - 1, n - 1 - k, mod)
dp = [0] * (k + 1)
dp[0] = base
for i in range(1, k + 1):
    dp[i] = dp[i - 1] * (m - 1)
    dp[i] = dp[i] % mod
for i in range(k + 1):
    fact = (res2[i] * res2[n - 1 - i] * m) % mod
    total += (res[n - 1] * fact * dp[k - i]) % mod
    total = total % mod
print(total)

Measured memory_bytes: 77788
#include <stdio.h>

#define N 100
#define INF 1000000000
#define NIL -1

int nm;
int X[N][N], d[N], pi[N], mincost;
int color[N]; // color 0:white 1:gray 2:black

void init(){
    int i, j;

    for(i = 0; i < N; i++){
        for(j = 0; j < N; j++){
            X[i][j] = INF;              // all index set 'infinity'
        }
    }
}

void Sinit(int s){
    int i;

    for(i = 0; i < nm; i++){
        color[i] = 0;                   // all color set 'white'
        d[i] = INF;                     // all root set 'infinity'
        pi[i] = NIL;                    // all parent set '-1'
    }
    d[s] = 0;
}

void dijkstra(int s){
    int i, v, u;

    Sinit(s);

    while(1){
        mincost = INF;
        for(i = 0; i < nm; i++){
            if(color[i] != 2 && d[i] < mincost){
                mincost = d[i];
                u = i;
            }
        }

        if(mincost == INF) break;

        color[u] = 2;

        for(v = 0; v < nm; v++){
            if(color[v] != 2 && X[u][v] != INF){
                if(d[u] + X[u][v] < d[v]){
                    d[v] = d[u] + X[u][v];
                    pi[v] = u;
                    color[v] = 1;
                }
            }
        }
    }
}

int main(){
    init();
    int i, j, nnm, nq, cnm, w;
    scanf("%d", &nm);
    for(i = 0; i < nm; i++){
        scanf("%d%d", &nnm, &nq);
        for(j = 0; j < nq; j++){
            scanf("%d%d", &cnm, &w);
            X[nnm][cnm] = w;
        }
    }

    dijkstra(0);

    for(i = 0; i < nm; i++){
       printf("%d %d\n", i, d[i]);
    }
    return 0;
}


Measured memory_bytes: 2112
#include <iostream>
#include <math.h>
#include <vector>
#include <queue>
#include <stdio.h>
#define inf 1e9
#define eps 1e-10

using namespace std;
typedef pair<double, int> P;

struct edge{
	int to;
	double cost;
	edge(int a, double b){
		to = a, cost = b;
	}
};

struct vec2d{
	double x, y;
	vec2d(){}
	vec2d(double x, double y){
		this->x = x, this->y = y;
	}
	double add(double a, double b){
		if(fabs(a+b) < eps * (fabs(a) + fabs(b))) return 0;
		return a+b;
	}
	vec2d operator+(vec2d ope){
		return vec2d(add(x, ope.x), add(y, ope.y));
	}
	vec2d operator-(vec2d ope){
		return vec2d(add(x, -ope.x), add(y, -ope.y));
	}
	vec2d operator*(double t){
		return vec2d(x*t, y*t);
	}
	double dot(vec2d ope){
		return add(x*ope.x, y*ope.y);
	}
	double cross(vec2d ope){
		return add(x*ope.y, -y*ope.x);
	}
};

double distPP(vec2d p, vec2d q)
{
	return sqrt( (p-q).dot(p-q) );
}

bool onSeg(vec2d p, vec2d q, vec2d x)
{
	return (p-x).cross(q-x) == 0 && (p-x).dot(q-x) <= 0;
}

bool isCross(vec2d p, vec2d q, vec2d r, vec2d s)
{
	double t = (r-p).cross(s-r) / (q-p).cross(s-r);
	vec2d x = p + (q-p)*t;
	return onSeg(p, q, x) && onSeg(r, s, x);
}

int NA, NB;
vec2d PA[1005], PB[1005];
vector<edge> G[1005];
double dist[1005];

void dijkstra()
{
	for(int i = 0; i < max(NA, NB); i++) dist[i] = inf;
	dist[0] = 0;
	
	priority_queue< P, vector<P>, greater<P> > Q;
	Q.push( make_pair(0, 0) );
	
	int v; double d;
	while(Q.size()){
		d = Q.top().first;
		v = Q.top().second;
		Q.pop();
		if(dist[v] < d) continue;
		for(int i = 0; i < G[v].size(); i++){
			if(dist[G[v][i].to] > d + G[v][i].cost){
				dist[G[v][i].to] = d + G[v][i].cost;
				Q.push( make_pair(dist[G[v][i].to], G[v][i].to) );
			}
		}
	}
}

int main(void)
{
	cin >> NA >> NB;
	for(int i = 0; i < NA; i++){
		cin >> PA[i].x >> PA[i].y;
	}
	for(int i = 0; i < NB; i++){
		cin >> PB[i].x >> PB[i].y;
	}
	
	double ans = inf;
	for(int i = 0; i < NA; i++){
		for(int j = 0; j < NA; j++){
			if(i >= j) continue;
			if(isCross(PB[0], PB[1], PA[i], PA[j])) continue;
			G[i].push_back( edge(j, distPP(PA[i], PA[j])) );
			G[j].push_back( edge(i, distPP(PA[i], PA[j])) );
		}
	}
	dijkstra();
	ans = min(ans, dist[1] + distPP(PB[0], PB[1]));
	
	for(int i = 0; i < NA; i++) G[i].clear();
	for(int i = 0; i < NB; i++){
		for(int j = 0; j < NB; j++){
			if(i >= j) continue;
			if(isCross(PA[0], PA[1], PB[i], PB[j])) continue;
			G[i].push_back( edge(j, distPP(PB[i], PB[j])) );
			G[j].push_back( edge(i, distPP(PB[i], PB[j])) );
		}
	}
	dijkstra();
	ans = min(ans, dist[1] + distPP(PA[0], PA[1]));
	
	if(ans >= inf) cout << -1 << endl;
	else printf("%.11f\n", ans);
	return 0;
}

Measured memory_bytes: 20652
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4.2")
#include <bits/stdc++.h>

using namespace std;
 
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef int64_t ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = 1e9+7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; } template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }

int main()
{
	
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n, m;
	cin >>n >>m;
	VI x(m), df(m-1);
	rep(i, m) cin >>x[i];
	if(n>=m){ puts("0");return 0;}
	sort(all(x));
	rep(i, m-1) df[i] =x[i+1]-x[i];
	sort(all(df));
	//for(auto x :df) printf("%d, ",x); puts("");
	ll ans = accumulate(df.begin(),df.end()-n+1,0LL);
	cout << ans <<endl;
	return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int[] v = new int[n];
		for (int i = 0; i < n; i++) {
			v[i] = sc.nextInt();
		}
		int sum = 0;
		for (int i = 0; i < n; i++) {
			int c = sc.nextInt();
			if (c < v[i])
				sum += (v[i] - c);
		}
		System.out.println(sum);
	}

}


Measured memory_bytes: 21844
#include <stdio.h>

int main(void)
{
	int a[101][101] = {0};
	int r, c;			//r???c???.

	int i, j;

	scanf("%d %d", &r, &c);

	//??\???.
	for(i = 0; i < r; i++)
		for (j = 0; j < c; j++)
			scanf("%d", &a[i][j]);

	//???????¨?????¨????
	for(i = 0; i < r; i++)
		for (j = 0; j < c; j++)
			a[i][c] += a[i][j];

	//???????¨?????¨????.
	for (j = 0; j < c; j++)
		for (i = 0; i < r; i++)
			a[r][j] += a[i][j];

	//????¨?????¨????.
	for (i = 0; i < r; i++)
		for (j = 0; j < c; j++)
			a[r][c] += a[i][j];

	//??????.
	for (i = 0; i <= r; i++)
		for (j = 0; j <= c; j++) {
			printf("%d", a[i][j]);
			if (j == c)
				printf("\n");
			else
				printf(" ");
		}

	return 0;
}

Measured memory_bytes: 652
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        int count = 0;
        
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int mochiArray[] = new int[n];
        
        for (int i=0; i < n; i++){
            int scale = sc.nextInt();
            boolean exist = true;
            
            for (int mochi : mochiArray) {
                if (mochi == scale) {
                    exist = false;
                    break;
                }
            }
            if (exist) count++;
            mochiArray[i] = scale;
        }
        
        System.out.println(count);
        sc.close();
    }
}


Measured memory_bytes: 21844
N,K=map(int,input().split())
MOD=int(1e9)+7
dp=[0]*(K+1)
for ii in range(K):
    i=K-ii
    dp[i]+=pow(K//i,N,MOD)
    j=2*i
    while j<=K:
        dp[i]=(dp[i]-dp[j]+MOD)%MOD
        j+=i
ans=0
for i in range(1,K+1):
    ans+=dp[i]*i
    ans%=MOD
print(ans)

Measured memory_bytes: 68924
#include <iostream>
#include <cstring>
#include <string>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <set>

using namespace std;

int main() {
    long long int A, B;
    char op;

    cin >> A >> op >> B;

    switch (op) {
        case '+':
            cout << A + B << endl;
            break;
        case '-':
            cout << A - B << endl;
            break;
        default:
            break;
    }

    return 0;
}

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repp(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perr(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)

typedef long long LL;
typedef long double LD;

struct color{
  double l;
  double a;
  double b;
};

int main(){
  int n,m;
  cin >> n >> m;
  vector<color> c(n);
  rep(i,n){
    cin >> c[i].l >> c[i].a >> c[i].b;
  }
  vector<int> ch(n,1);
  rep(i,n-m) ch[i]=0;
  double ans=0;
  do{
    vector<int> cc;
    rep(i,n) if(ch[i]) cc.push_back(i);
    double tmp=0;
    rep(i,m){
      repp(j,i+1,m){
        tmp+=(c[cc[i]].l-c[cc[j]].l)*(c[cc[i]].l-c[cc[j]].l)
        +(c[cc[i]].a-c[cc[j]].a)*(c[cc[i]].a-c[cc[j]].a)
        +(c[cc[i]].b-c[cc[j]].b)*(c[cc[i]].b-c[cc[j]].b);
      }
    }
    ans=max(ans,tmp);
  }while(next_permutation(all(ch)));
  cout << fixed << setprecision(10) << ans << endl;
  return 0;
}



Measured memory_bytes: 3292
#!/usr/bin/perl
use Data::Dumper;
use POSIX qw(floor ceil);

# 引数取り込み
my @a;
while ( my $line = <STDIN> ) {
    chomp($line);
    push @a, $line;
}

my ( $b, $c ) = split( / /, $a[0] );
my ( $e, $f ) = split( / /, $a[1] );

if( $a[2] eq $b ) {
    $e = $e - 1;
}
else {
    $f = $f - 1;
}

# 処理開始
print "$e $f";
1;

Measured memory_bytes: 7284
#include <iostream>
#include <map>
#include <string>
using namespace std;
int main(){
	long long ans;
	string s;
	int i,n;
	map <string,long long> mp;
	cin >> n;
	for(i=0;i<n;i++){
		cin >> s;
		if(s[0]=='M'){
			mp["m"]++;
		}else if(s[0]=='A'){
			mp["a"]++;
		}else if(s[0]=='R'){
			mp["r"]++;
		}else if(s[0]=='C'){
			mp["c"]++;
		}else if(s[0]=='H'){
			mp["h"]++;
		}
	}
		ans = mp["m"]*(mp["a"]*mp["r"]+mp["a"]*mp["c"]+mp["a"]*mp["h"]+mp["r"]*mp["c"]+mp["r"]*mp["h"]+mp["c"]*mp["h"])+mp["a"]*mp["r"]*mp["c"]+mp["a"]*mp["r"]*mp["h"]+mp["a"]*mp["c"]*mp["h"]+mp["r"]*mp["c"]*mp["h"];
		
		cout << ans << endl;
}
		
			

Measured memory_bytes: 256
H,W=map(int,input().split())
A=[]
for i in range(0,H):
    a=input()
    A.append(a)

alphabetlist=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']

count=[0 for i in range(0,26)]

for i in range(0,H):
    for j in range(0,W):
        count[alphabetlist.index(A[i][j])]+=1

data=[0 for i in range(0,4)]

for i in range(0,26):
    data[count[i]%4]+=1

if H%2==0 and W%2==0:
    if data[1]==0 and data[2]==0 and data[3]==0:
        print('Yes')
    else:
        print('No')
elif H%2==0 and W%2==1:
    h=H//2
    if data[1]==0 and data[3]==0 and h>=data[2]:
        print('Yes')
    else:
        print('No')
elif H%2==1 and W%2==0:
    w=W//2
    if data[1]==0 and data[3]==0 and w>=data[2]:
        print('Yes')
    else:
        print('No')
else:
    if data[1]+data[3]>1:
        print('No')
    elif data[1]==1:
        h=(H-1)//2
        w=(W-1)//2
        if h+w>=data[2]:
            print('Yes')
        else:
            print('No')
    else:
        h=(H-1)//2
        w=(W-1)//2
        if h+w>=data[2]+data[3]:
            print('Yes')
        else:
            print('No')

Measured memory_bytes: 38640
#include<stdio.h>

int main()
{
	int k,s,x,y,z,n;
	
	n=0;
	scanf("%d %d",&k,&s);
	
	for(x=0;x<=k;x++)
	{
		if(x>s) break;
		for(y=0;y<=k;y++)
			{if(y>s) break;
				if((s-x-y)<=k && s-x-y>=0)
				{
					n++;
				}		
			}
	}
	printf("%d",n);
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	void run() {
		Scanner sc = new Scanner(System.in);

		while (true) {
			//すごろくのマス目
			int n = sc.nextInt();
			//サイコロを振った回数
			int m = sc.nextInt();

			if ((n | m) == 0) {
				break;
			}

			//初期入力
			int[] map = new int[n];
			for (int i = 0; i < n; i++) {
				map[i] = sc.nextInt();
			}
			int[] dice = new int[m];
			for (int i = 0; i < m; i++) {
				dice[i] = sc.nextInt();
			}

			int x = 0;
			int cnt = 1;

			for (int i = 0; i < m; i++) {
				x += dice[i];
				if (x >= n - 1) {
					break;
				}

				x += map[x];
				if (x >= n - 1) {
					break;
				}
				cnt++;
			}

			System.out.println(cnt);
		}

	}

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

}

Measured memory_bytes: 27604
#include<stdio.h>

int main(void){
	int N;
	scanf("%d",&N);
	if(N==1){
		printf("Hello World");
		}else if(N==2){
			int A,B;
			scanf("%d %d",&A,&B);
			printf("%d",A + B);
		}
	
	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		int Q = sc.nextInt();
		int A[] = new int[N];
		for(int i = 0; i < N; i++) {
			A[i] = K - Q;
		}
		for(int i = 0; i < Q; i++) {
			A[sc.nextInt()-1]++;
		}
		for(int i = 0; i < N; i++) {
			if(A[i] > 0) {
				System.out.println("Yes");
			}else {
				System.out.println("No");
			}
		}
		sc.close();
	}
}


Measured memory_bytes: 72004
//AtCoder 
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;

ll calc_max_min(ll s1,ll s2,ll s3){
	ll smax = max(s1, s2);
	smax = max(smax, s3);
	ll smin = min(s1, s2);
	smin = min(smin, s3);
    return smax-smin;
}

ll check_func(ll h, ll w){
    ll ret=INT64_MAX;
    for(ll y=1;y<h;++y){
        ll s1=y*w;
		ll rest = h - y;
		{//横
			ll y2 = rest / 2;
			ll y3 = h - y - y2;
			if(y2 > 0 && y3 > 0) {
				ll s2 = y2 * w;
				ll s3 = y3 * w;
				ret = min(ret, calc_max_min(s1, s2, s3));
			}
		}
        {//縦
            ll x2 = w/2;
            ll x3 = w-x2;
            if (x2>0&&x3>0&&rest>0){
                ll s2 = x2 * rest;
                ll s3 = x3 * rest;
                ret = min(ret, calc_max_min(s1, s2, s3));
            }
        }
	}
    return ret;
}

int main() {
#if LOCAL&01
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
    ll H,W;
    cin>>H>>W;
    ll ans = min(check_func(H,W),check_func(W,H));
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*; 
 
class Main{
public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
  
  		int[] p=new int[m];
        String[] s=new String[m];
  
  		for(int a=0;a<m;a++){
        p[a]=sc.nextInt();
        s[a]=sc.next();
        }
 	 
  		int ac=0;
  		int wa=0;
  		
        int[] w=new int[n];
  		int[] a=new int[n];
  
      for(int c=0;c<m;c++){
      if(s[c].equals("WA")&&a[p[c]-1]==0){
       w[p[c]-1]++;
      }else if(s[c].equals("AC")&&a[p[c]-1]==0){
       a[p[c]-1]++;
       
      }
      }
  	for(int d=0;d<n;d++){
      ac+=a[d];
      if(a[d]==1){
      	 wa+=w[d];

      }
    }
  		  System.out.println(ac);
    	  System.out.println(wa);
}
}

Measured memory_bytes: 70180
def main():
    N, T = map(int, input().split())
    mc = 1001
    for _ in range(N):
        c, t = map(int, input().split())
        if T >= t and mc > c:
            mc = c
    if mc == 1001:
        print('TLE')
    else:
        print(mc)


if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int a[200005];
int main(){
	int n,k;
	cin>>n>>k;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	for(int i=0;i<n-k;i++){
		if(a[i]<a[i+k]) cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 4372
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace Tasks
{
    public class B
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var N = Scanner.Scan<int>();
            var A = Scanner.ScanEnumerable<ulong>().ToArray();
            const ulong limit = (ulong)1e18;
            if (A.Contains(0UL))
            {
                Console.WriteLine(0);
                return;
            }
            var answer = 1UL;
            var ok = true;
            for (var i = 0; i < N && ok; i++)
            {
                try
                {
                    checked
                    {
                        answer *= A[i];
                    }
                }
                catch
                {
                    ok = false;
                }
                if (answer > limit) ok = false;
            }

            Console.WriteLine(ok ? answer.ToString() : "-1");
        }

        public static class Scanner
        {
            private static Queue<string> queue = new Queue<string>();
            public static T Next<T>()
            {
                if (!queue.Any()) foreach (var item in Console.ReadLine().Trim().Split(" ")) queue.Enqueue(item);
                return (T)Convert.ChangeType(queue.Dequeue(), typeof(T));
            }
            public static T Scan<T>() => Next<T>();
            public static (T1, T2) Scan<T1, T2>() => (Next<T1>(), Next<T2>());
            public static (T1, T2, T3) Scan<T1, T2, T3>() => (Next<T1>(), Next<T2>(), Next<T3>());
            public static (T1, T2, T3, T4) Scan<T1, T2, T3, T4>() => (Next<T1>(), Next<T2>(), Next<T3>(), Next<T4>());
            public static (T1, T2, T3, T4, T5) Scan<T1, T2, T3, T4, T5>() => (Next<T1>(), Next<T2>(), Next<T3>(), Next<T4>(), Next<T5>());
            public static IEnumerable<T> ScanEnumerable<T>() => Console.ReadLine().Trim().Split(" ").Select(x => (T)Convert.ChangeType(x, typeof(T)));
        }
    }
}


Measured memory_bytes: 44880