akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class Main {

	public static void main(String[] args) {

		double inta = 0;
		double intb = 0;

		//?§£????????°
		double intd = 0;
		double intr = 0;
		double dbf = 0.0;

		try {
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			String strInput = br.readLine();

			ArrayList<Double> NumList = new ArrayList<Double>();

			String[] strNumList = strInput.split(" ", 0);

			for (int i = 0; i < strNumList.length; i++) {
				NumList.add(Double.parseDouble(strNumList[i]));
			}

			inta = NumList.get(0);
			intb = NumList.get(1);

			intd = inta / intb;
			intr = inta % intb;
			dbf = (double)inta / (double)intb;

			System.out.println((int)intd + " " + intr + " " + String.format("%.5f", dbf));
		} catch (IOException e) {
			System.out.println(e);
		}catch (NumberFormatException e) {
			System.out.println(e);
		}
	}

}

Measured memory_bytes: 24680
#include<cmath>
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>
using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)
#define eprintf(...) fprintf(stderr, __VA_ARGS__)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

int N;
LL D1, X;


void MAIN() {
    scanf("%d%lld%lld", &N, &D1, &X);


    double ans = 0;
    double L = D1+(2*N-1)*X / 2.0;
    for (int n=N; n>=1; n--) {
	ans += L;
	L *= (double)(1+n)/n;
    }
    printf("%.12f\n", (double)ans);
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



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

using u64 = unsigned long long;

int n, q, k;
std::vector<std::array<int, 2>> tree[100010];
u64 cost[100010];

void dfs(int v){
    for(auto& i: tree[v]){
        if(i[0] != k && !cost[i[0]]){
            cost[i[0]] = cost[v] + i[1];
            dfs(i[0]);
        }
    }
}

int main(){
    std::cin >> n;
    int a, b, c;
    for(int i = 0; i < n - 1; i++){
        std::cin >> a >> b >> c;
        tree[a].push_back({b, c});
        tree[b].push_back({a, c});
    }
    std::cin >> q >> k;
    cost[k] = 0;
    dfs(k);
    int x, y;
    for(int i = 0; i < q; i++){
        std::cin >> x >> y;
        std::cout << cost[x] + cost[y] << std::endl;
    }
    return 0;
}


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

int main() {
  
  int n;
  cin >> n;
  
  if (n < 600) cout << 8 << endl;
  else if (n < 800) cout << 7 << endl;
  else if (n < 1000) cout << 6 << endl;
  else if (n < 1200) cout << 5 << endl;
  else if (n < 1400) cout << 4 << endl;
  else if (n < 1600) cout << 3 << endl;
  else if (n < 1800) cout << 2 << endl;
  else if (n < 2000) cout << 1 << endl;

}

Measured memory_bytes: 3632
def solve():
    A, B, M = map(int, input().split())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    X = []
    Y = []
    for _ in range(M):
        x, y, c = list(map(int, input().split()))
        X.append([x-1, y-1, c])
        Y.append(a[x-1] + b[y-1] - c)

    normal = min(a) + min(b)
    return min(normal, min(Y))

print(solve())

Measured memory_bytes: 35960
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**15
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n,a,b = LI()
    if a+b > n+1:
        return -1
    t = n // b
    if n % b > 0:
        t += 1
    if a < t:
        return -1
    rr = []
    while n > 0:
        if n == a:
            rr.append(list(range(1,n+1)))
            break
        if n-b >= a-1:
            rr.append(list(range(n,n-b,-1)))
            n -= b
            a -= 1
            continue
        rr.append(list(range(n,a-1,-1)))
        rr.append(list(range(1,a)))
        break
    r = []
    rr.reverse()
    for c in rr:
        r.append(' '.join(map(str,c)))

    return ' '.join(r)


print(main())




Measured memory_bytes: 126740
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
  int N,K,sum=0,x;
  cin>>N>>K;
  for(int i=0;i<N;i++){
    cin >> x;
    sum += min(x,abs(x-K));
  }
  cout << 2*sum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
const ll ber = 1e18;
 
int main() {
  bool judge = false;
  int N;
  cin >> N;
  unsigned long long A[N];
  ll ans = 1;
  for(int i = 0; i < N; i++){
    cin >> A[i];
    if(A[i] == 0){//0の時点で終わり
      cout << 0 << endl;
      return 0;
    }
  }
  
  for(int j = 0; j < N; j++){
    //オーバーフロー対策
    if(log10(ans) + log10(A[j]) > 20 || ber/ans < A[j]){
      judge = true;
      break;
    }
    ans *= A[j];
  }
  if(judge || ans > ber){
      cout << "-1" << endl;
    }else{
  	  cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 4740
#include <iostream>

int main() {
  int A, B, C, X, Y;
  std::cin >> A >> B >> C >> X >> Y;
  long min_p = 1<<30;
  for (int c=0;c<=std::max(X,Y);c++) {
    int a = std::max(0, X - c);
    int b = std::max(0, Y - c);
    long p = A*a + B*b + 2*C*c;
    if (p<min_p)min_p=p;
  }
  std::cout << min_p << std::endl;
  return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;
import java.util.ArrayList;

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

    static class CInterpretation {
        public void solve(int testNumber, Scanner in, PrintWriter out) {

            int n = in.nextInt();
            int m = in.nextInt();
            UnionFindTree uf = new UnionFindTree(n);
            ArrayList<Integer>[] lang = new ArrayList[m];

            for (int i = 0; i < m; i++) {
                lang[i] = new ArrayList<>();
            }
            for (int i = 0; i < n; i++) {
                int k = in.nextInt();
                for (int j = 0; j < k; j++) {
                    lang[in.nextInt() - 1].add(i);
                }
            }
            for (int i = 0; i < m; i++) {
                for (int j = 1; j < lang[i].size(); j++) {
                    uf.union(lang[i].get(0), lang[i].get(j));
                }
            }


            for (int i = 1; i < n; i++) {
                if (!uf.same(0, i)) {
                    out.println("NO");
                    return;
                }
            }
            out.println("YES");

        }

    }

    static class UnionFindTree {
        private int[] parent;
        private int[] height;
        private int[] size;

        public UnionFindTree(int size) {
            this.parent = new int[size];
            this.height = new int[size];
            this.size = new int[size];

            for (int i = 0; i < size; i++) {
                makeSet(i);
            }
        }

        private void makeSet(int i) {
            parent[i] = i;
            height[i] = 0;
            size[i] = 1;
        }

        public int find(int x) {
            if (x != parent[x]) {
                parent[x] = find(parent[x]);
            }
            return parent[x];
        }

        public void union(int x, int y) {

            int rootX = find(x);
            int rootY = find(y);

            if (rootX == rootY) { //既に結合済み
                return;
            }

            if (height[rootX] > height[rootY]) {
                parent[rootY] = rootX;
                size[rootX] += size[rootY];

            } else if (height[rootX] < height[rootY]) {
                parent[rootX] = rootY;
                size[rootY] += size[rootX];

            } else {
                parent[rootY] = rootX;
                size[rootX] += size[rootY];
                height[rootX]++;
            }
        }

        public boolean same(int x, int y) {
            return find(x) == find(y);
        }

    }
}



Measured memory_bytes: 93520
#include<bits/stdc++.h>
using namespace std;
int main(){
    int A, B, K;
    cin >> A >> B >> K;

    int answer;
    for (int i = 100; i >= 1; i--)
    {
        answer = i;
        if(A%i == 0 && B%i == 0) K--;
        if(K==0){
            cout << answer << endl;
            break;
        } 
    }
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
static const int INF = 0x3f3f3f3f; static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
template<typename T, typename U> static void amin(T &x, U y) { if (y < x) x = y; }
template<typename T, typename U> static void amax(T &x, U y) { if (x < y) x = y; }

int main() {
	int K; int S;
	while (~scanf("%d%d", &K, &S)) {
		int ans = 0;
		const int pK = K, pS = S, pKK = pK * pK, pKS = pS * pK, pSS = pS * pS, pKKK = pKK * pK, pKKS = pKS * pK, pKSS = pSS * pK;
		if (3 * K + 3 <= S && S <= -3 && 0 <= K) ans += pKKK + pKK * 3 + pK * 3 + 1;
		if (3 * K + 3 <= S && S + 2 <= K && 0 <= K && -2 <= S) ans += pKKK - pKKS + pKK - pKS * 2 - pK - pS - 1;
		if (3 * K + 3 <= S && S + 1 <= 2 * K && 0 <= K && K <= S + 1) ans += (pKKK * 4 - pKKS * 4 + pKSS + pKK * 6 - pKS * 5 + pSS + pK * 2 - pS) / 2;
		if (S <= -3 && 2 * K + 2 <= S && 0 <= K && S <= 3 * K + 2) ans -= pKKK * 2 - pKKS + pKK * 5 - pKS * 2 + pK * 4 - pS + 1;
		if (S <= -3 && K + 1 <= S && 0 <= K && S <= 2 * K + 1) ans += (pKKK - pKKS * 2 + pKSS - pKS + pSS - pK + pS) / 2;
		if (2 * K + 2 <= S && S + 2 <= K && 0 <= K && S <= 3 * K + 2 && -3 <= 2 * K) ans += (pKKS * 2 - pKSS + pKK * 4 + pKS - pSS + pK * 6 - pS + 2) / 2;
		if (2 * K + 2 <= S && S + 2 <= K && 0 <= K && -2 <= S && -3 <= 2 * K) ans -= (pKKK * 3 - pKKS * 4 + pKSS + pKK * 2 - pKS * 5 + pSS - pK * 3 - pS - 2) / 2;
		if (2 * K + 2 <= S && S <= 3 * K) ans += (pKK * 9 - pKS * 6 + pSS + pK * 9 - pS * 3 + 2) / 2;
		if (S + 2 <= K && 0 <= S) ans += (pSS + pS * 3 + 2) / 2;
		if (2 * K + 1 <= S && 1 <= K && S <= 2 * K + 1) ans += (pKK + pK) / 2;
		if (K + 1 <= S && S <= 2 * K) ans -= (pKK * 3 - pKS * 4 + pSS + pK - pS) / 2;
		if (S + 1 <= K && 0 <= S && K <= S + 1) ans += (pSS + pS * 3 + 2) / 2;
		if (S + 1 <= 2 * K && K <= S) ans += (pKS * 2 - pSS + pK * 2 - pS) / 2;
		if (K <= S && 0 <= K && S <= 2 * K) ans += pK + 1;
		printf("%d\n", ans);
	}
	return 0;
}


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

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())#整数値　複数の入力
def S_MAP(): return map(str, input().split())#文字　複数の入力
def LIST(): return list(map(int, input().split()))#整数　複数の入力　配列
def S_LIST(): return list(map(str, input().split()))#文字　複数の入力　配列


x=S_LIST()


print(x.index("0")+1)

Measured memory_bytes: 9408
#10000a×5000b×1000c=Y(a+b+c=N)
#<=>(Y-10000a-5000b)/1000=N-c
N,Y=map(int,input().split())
buf=0
buf2=0
flag=0
for i in range(0,N+1):
 buf=Y-10000*i
 for j in range(0,N+1-i):
  buf2=buf-5000*j
  if (buf2/1000)==(N-i-j):
   print(i,j,N-i-j)
   flag=1
   break
 if flag==1:
  break

if flag==0:
 print("-1 -1 -1")

Measured memory_bytes: 40812
using System;
using System.Linq;
using System.Collections.Generic;

class Cmondai
{
    static void Main()
    {
        var N = Int64.Parse(Console.ReadLine());
        var A = Console.ReadLine().Split(' ').Select(x => Int64.Parse(x)).ToArray();
        var array = new long[N];
        for (long i=0;i<N;++i)
        {
            array[i]= A[i] - (i + 1);
        }
        array=array.OrderBy(x => x).ToArray();
        var num = (N + 1) / 2;
        var ans = 0L;
        if (N % 2 == 0)
        {
            num = (array[num - 1] + array[num]) / 2;
            ans=Math.Min(GetAns(N,A,num-1),
                Math.Min(GetAns(N,A,num),GetAns(N,A,num+1)));
        }
        else
        {
            num = array[num - 1];
            ans = GetAns(N, A, num);
        }
        Console.WriteLine(ans);
    }
    static long GetAns(long N,long[] A,long num)
    {
        var ans = 0L;
        for (long i = 0; i < N; ++i)
        {
            ans += Math.Abs(A[i] - (i + 1 + num));
        }
        return ans;
    }
}

Measured memory_bytes: 43200
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<queue>
#include<cmath>
#include<vector>
#include<stack>
#include<map>
#include<set>
#define Run(i,l,r) for(int i=l;i<=r;i++)
#define Don(i,l,r) for(int i=l;i>=r;i--)
#define ll long long
#define ld long double
#define inf 0x3f3f3f3f
#define mk make_pair
#define fir first
#define sec second
#define il inline
#define rg register
#define pb push_back
using namespace std;
const int N=100010;
int n,A[N],B[N],C[N],tot,ans;
ll sum;
bool cmp(int x,int y){return x>y;}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&A[i]);
	}
	for(int i=1;i<=n;i++){
		scanf("%d",&B[i]);
		if(A[i]>=B[i])C[++tot]=A[i]-B[i];
		else if(A[i]<B[i])sum+=A[i]-B[i],ans++;
	}
	sort(C+1,C+tot+1,cmp);
	for(int i=1;i<=tot;i++){
		if(sum>=0){
			cout << ans + i - 1 << endl;
			return 0;
		}
		sum += C[i];
	}
	if(sum>=0){
		cout << ans + tot << endl;
		return 0;
	}
	cout<<-1<<endl;
	return 0;
}//by tkys_Austin;


Measured memory_bytes: 1408
M = {}

N, W = [int(x) for x in input().split()]
items = []
for i in range(N):
    items.append(tuple(int(x) for x in input().split()))


def dfs(i, j):
    if (i, j) in M:
        return M[i, j]
    if i == N:
        return 0

    v, w = items[i]
    if w <= j:
        r = max(dfs(i+1, j), v + dfs(i+1, j-w))
    else:
        r = dfs(i+1, j)
    M[i, j] = r
    return r


print(dfs(0, W))

Measured memory_bytes: 133760
#include <stdio.h>

int main(void)
{
	int n, d;
	int count = 0;

	scanf("%d %d", &n, &d);

	//必要な人数を数える
	while (n > 0) {
		n = n - ((2 * d) + 1);
		count++;
	}

	printf("%d\n", count);

	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <iostream>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <stack>
#include <list>
#include <deque>
using namespace std;
int n, m, i, j, k, t;
char a[4]; 
int main(){
	cin>>a;
	if(a[0]==a[2]) cout<<"Yes";
	else cout<<"No";
	return 0;
}

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

typedef long long ll;

int main() {
  ll n, x;
  cin >> n >> x;
  vector<ll> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  ll ans = 0;
  for (int i = 0; i < n - 1; i++) {
    if (a[i] + a[i + 1] > x) {
      ll tmp = a[i] + a[i + 1] - x;
      ll cnt = min(a[i + 1], tmp);
      a[i + 1] -= cnt;
      ans += cnt;
      if (a[i] + a[i + 1] > x) {
        tmp = a[i] + a[i + 1] - x;
        cnt = min(a[i], tmp);
        a[i] -= cnt;
        ans += cnt;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;
using static System.Array;

class Program
{
    public static void Main()
    {
        var n = int.Parse(ReadLine());
        var s = ReadLine();
        if(s.Length <= n)
        {
            WriteLine(s);
        }
        else
        {
            WriteLine(s.Substring(0, n) + "...");
        }
    }
}


Measured memory_bytes: 17624
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>

#define _CRT_SECURE_NO_WARNINGS
#define TLong long long
#define TBMod 1000000007

int main(int argc, char const *argv[])
{
	int n,*point;
	int *pat,sum = 0,i = 1;
	scanf("%d",&n);
	point = (int *)malloc(sizeof(int) * (n + 7));
	pat = (int *)malloc(sizeof(int) * (n + 7));
	for (int i = 0; i < n; ++i)	pat[i] = 0;
	for (i = 1; (i <= n && sum < n); ++i)
	{
		sum += i;
		point[i] = i;
		pat[i] = 1;
	}
	if(sum != n)	pat[abs(sum - n)] = 0;
	for (int k = 1; k < i; ++k)
	{
		if(pat[k])	printf("%d\n",point[k]);
	}
	return 0;
}


Measured memory_bytes: 39296
import std.algorithm;
import std.concurrency;
import std.container;
import std.conv;
import std.functional;
import std.math;
import std.meta;
import std.random;
import std.range;
import std.stdio;
import std.string;
import std.traits;
import std.typecons;


auto solve(long A, long B) {
    return
        A >= 13 ? B :
        A >= 6  ? B / 2 : 0;
}


void main() {
    auto input = stdin.byLine.map!split.joiner;

    long A;
    A = input.front.to!long;
    input.popFront;

    long B;
    B = input.front.to!long;
    input.popFront;

    static if (is(ReturnType!solve == void))
        solve(A, B);
    else
        solve(A, B).writeln;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
template <typename T> using V = vector<T>;
constexpr int Mod = 998244353;
constexpr int mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;
template <typename T> constexpr bool chmax(T &a, const T &b) {
    if(a >= b) return false;
    a = b;
    return true;
}
template <typename T> constexpr bool chmin(T &a, const T &b) {
    if(a <= b) return false;
    a = b;
    return true;
}

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

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

    int n;
    cin >> n;
    V<int> s(1 << n);
    rep(i, 1 << n) cin >> s[i];
    sort(ALL(s));

    multiset<int> st;
    rep(i, (1 << n) - 1) st.insert(s[i]);
    V<int> vec;
    vec.push_back(s.back());

    rep(i, n) {
        sort(ALL(vec), greater<int>());
        rep(j, 1 << i) {
            auto it = st.lower_bound(vec[j]);
            if(it == st.begin()) {
                cout << "No" << endl;
                return 0;
            }
            it--;
            vec.push_back(*it);
            st.erase(it);
        }
    }

    cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 13568
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 tmp = n / k;
        int tmp2 = n % k;
        if(tmp2 == 0) System.out.println(tmp2);
        else System.out.println(Math.abs(1));
    }
}

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

int main() {
  string S;
  cin >> S;

  int c = 0;
  int N = S.size();
  for (int i = 0; i < N; i++) {
    if (i % 2 == 0) {
      if (S.at(i) == '0') c++;
    } else {
      if (S.at(i) == '1') c++;
    }
  }

  int ans = min(c, N - c);
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 512
N = int(input())
A = list(map(int, input().split()))
def divi(a, b):
    rem = b % a
    if rem == 0:
        return a
    else:
        return divi(rem, a)
A.sort()
all_d = divi(A[0], A[1])
max_d = max(all_d, max(divi(A[1],A[2]), divi(A[0],A[2]))) if N > 2 else A[1]
for i in range(2,N):
    d = divi(all_d, A[i])
    max_d = divi(max_d, A[i])
    if max_d < all_d:
        max_d = all_d
    all_d = d
print(max_d)

Measured memory_bytes: 14584
#include <iostream>
#include <stdio.h>
#include <iterator>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <unordered_map>

using namespace std;

void solve() {
    int n, k;
    string s;
    cin >> n >> k >> s;
    auto itr = s.begin() + k-1;
    transform(itr, itr+1, itr, ::tolower);
    cout << s << endl;
}

int main() {
    solve();
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  int sum = 0;
  int min_n = 1000;
  for(int i=0;i<n;i++){
    int a;
    cin >> a;
    if(a%10 && a<min_n)min_n = a;
    sum += a;
  }
  if(sum%10 == 0)if(min_n == 1000)sum = 0;
  else sum -= min_n;
  cout << sum << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <deque>

#define dump(x) cerr << #x << "=" << (x) << endl;
using namespace std;
using ll = long long;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define IN(x) int (x); cin >> x
#define INS(x) string (s); cin >> s
#define INL(x) ll (x); cin >> x
#define VINT(a,n) vector<int> a(n)
#define VIN(a,n) VINT(a,n); REP(i,n){cin >> a[i];}
#define ALL(x) (x).begin(),(x).end()


long long mod(long long val, long long m) {
  long long res = val % m;
  if (res < 0) res += m;
  return res;
}

vector<ll> mem(100001, -1);
ll temp;

ll count(queue<ll>& ng, ll current, ll n){
  
  if (!ng.empty()&&ng.front() == current){
    mem[current]=0;
    return 0;
  }
  else if (mem[current]!=-1)
    return mem[current];

  else if (current==n||current==n-1){
    mem[current]=1;
    return 1;
  }
  else if (!ng.empty()&&ng.front() == current+1){
    ng.pop();
    temp = count(ng, current+2, n);
    mem[current+1]=0;
    mem[current] = temp;
    return temp;
  }
  else if (!ng.empty()&&ng.front() == current+2){
    ng.pop();
    temp = count(ng, current+3, n);
    mem[current+2]=0;
    mem[current+1]=temp;
    
    mem[current]=temp;
    return temp;
  }
  else{
    temp= mod(count(ng, current+1, n)+count(ng, current+2, n), 1000000007);
    mem[current]=temp;
    return temp;
  }
}



int main () {
  IN(n);
  IN(m);
  queue<ll> ng;
  REP(i,m){
    IN(a);
    if(!ng.empty() && a==ng.front()+1){
      cout<<0<<endl;
      return 0;
    }
    ng.push((ll)a);
  }

  
  cout << count(ng, (ll)0, (ll)n) <<endl;
}


Measured memory_bytes: 7296
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using f80 = __float80;
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
static const int dy[4] = {0,1,0,-1}, dx[4] = {1,0,-1,0};
#define _overload3(_1,_2,_3,name,...) name
#define repi(i,start,end) for(i64 i=(start);i<(end);++i)
#define _rep(i,n) repi(i,0,n)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,start,end) for(i64 i=(start);i>end;--i)
#define pb push_back
#define rng(a) a.begin(),a.end()
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define sz(x) (i64)(x).size()
#define bit(n) (1LL<<(n))
#define fi first
#define se second
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define v(T) vector<T>
#define vv(T) v(v(T))
typedef v(i64) vi;
typedef v(vi) vvi;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}

i64 pow_mod(i64 n, i64 k, i64 m){
  i64 r = 1;
  for(;k;k>>=1){
    if(k&1) r=(r*n)%m;
    n=(n*n)%m;
  }
  return r;
}

struct uf{
  private:
    vi par, rank, size;
  public:
    uf(i64 n){ init(n); }
    void init(i64 n){
      par.resize(n);
      rank.resize(n,0);
      size.resize(n,1);
      rep(i,n) par[i] = i;
    }
    i64 root(i64 x){
      if(par[x] == x) return x;
      return par[x] = root(par[x]);
    }
    bool same(i64 x, i64 y){ return root(x) == root(y); }
    void unite(i64 x, i64 y){
      x = root(x), y = root(y);
      if(x==y) return;
      if(rank[x]==rank[y]) rank[x]++;
      if(rank[x]<rank[y]) swap(x,y);
      par[y] = x;
      size[x] += size[y];
    }
    i64 num(i64 x){ return size[root(x)]; }
};

void Main()
{
  i64 A,B;
  cin >> A >> B;
  rep(i,1,2000){
    if(i*8/100 == A && i/10 == B){
      cout << i << endl;
      return;
    }
  }
  cout << "-1\n";

}

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}


Measured memory_bytes: 256
#include <iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<math.h>
using namespace std;
typedef long long ll;
#define ds(q) scanf("%lld",&q)
ll ans[100];
int main()
{
    ll x,a;
    ll n;
    ll cnt=0;
    ds(n);
    ds(x);
    for(ll i=0;i<n;i++)
        {ds(a);
        if(a>=x)
            cnt++;}
    printf("%lld",cnt);
    return 0;

}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using lint = long long;
#define low lower_bound
#define upp upper_bound
#define rep(i, n) for (lint i = 0; i < lint(n); ++i)
#define Rep(i, n) for (lint i = lint(n); i >= 0; --i)
#define all(vec) (vec).begin(), (vec).end()
#define cend printf("\n");
#define prique(T) priority_queue<T, vector<T>, greater<T>>
#define prique2(T) priority_queue<T>

struct edge { int to; double cost; };
using P = pair<lint, lint>;
using D = pair<double, double>;
using DI = pair<double, int>;
//const lint mod = 998244353LL;
const lint mod = 1000000007LL;
const lint inf = 3LL * mod * mod;

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

lint modpow(lint x, lint n, lint m) {
	lint ans = 1;
	while (n > 0) {
		if (n & 1) {
			ans *= x;
			if (m <= ans) ans %= m;
		}
		x *= x;
		if (m <= x) x %= m;
		n >>= 1;
	}
	return ans;
}

lint fact[1000000];
void f_init(lint n) {
	if (1000000 <= n) return;
	fact[0] = fact[1] = 1;
	for (lint i = 2; i <= n; ++i) {
		fact[i] = i * fact[i - 1];
		if (mod <= fact[i]) fact[i] %= mod;
	}
	return;
}

lint inver[1000000]; bool inve[100000];
lint inv(lint x) {
	if (x == 0) return 0;
	else if (inve[x]) return inver[x];
	else {
		inve[x] = true;
		return inver[x] = modpow(x, mod - 2, mod);
	}
}

lint comb(lint n, lint r) {
	if (n < r) return 0;
	if (n == r) return 1;
	lint ans = fact[n] * inv(fact[n - r]) % mod * inv(fact[r]) % mod;
	if (ans < 0) return ans + mod;
	return ans;
}

lint nck[1010][1010];
void comb(lint n) {
	rep(i, n + 1) {
		rep(j, i + 1) {
			if (j == 0 || i == j) nck[i][j] = 1;
			else nck[i][j] = nck[i - 1][j - 1] + nck[i - 1][j];
		}
	}
}

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

lint lcm(lint a, lint b) { return a / gcd(a, b) * b; }

bool pri(lint p) {
	for (lint i = 2; i * i <= p; i == 2 ? ++i : i += 2) if (p % i == 0) return false;
	return p > 1;
}

map<lint, lint> factring(lint n) {
	map<lint, lint>ans;
	for (lint i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			n /= i;
			++ans[i];
		}
	}
	if (n != 1) ++ans[n];
	return ans;
}

double dis(D a, D b) { return sqrt((a.first - b.first) * (a.first - b.first) + (a.second - b.second) * (a.second - b.second)); }

lint n, a[3 * 100010], sum;
int main() {
	cin >> n;
	rep(i, n) {
		cin >> a[i];
	}
	rep(i, 64) {
		lint ze = 0, on = 0;
		rep(j, n) {
			if (a[j] & 1) ++on;
			else ++ze;
			a[j] /= 2;
		}
		sum += on * ze % mod * modpow(2, i, mod) % mod;
		sum %= mod;
	}
	cout << sum << endl;
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define  INF 1100000000
#define	 MOD 1000000007
using namespace std;

int vis[22][22];
char mp[22][22];

int dfs(int sh, int sw, int ans){
	if(mp[sh+1][sw] == '.' && vis[sh+1][sw] == 0){
		vis[sh+1][sw] = 1;
		ans++;
		ans = dfs(sh+1, sw, ans);
	}
	if(mp[sh-1][sw] == '.' && vis[sh-1][sw] == 0){
		vis[sh-1][sw] = 1;
		ans++;
		ans = dfs(sh-1, sw, ans);
	}
	if(mp[sh][sw-1] == '.' && vis[sh][sw-1] == 0){
		vis[sh][sw-1] = 1;
		ans++;
		ans = dfs(sh, sw-1, ans);
	}
	if(mp[sh][sw+1] == '.' && vis[sh][sw+1] == 0){
		vis[sh][sw+1] = 1;
		ans++;
		ans = dfs(sh, sw+1, ans);
	}
	return ans;
}

int main(){
	int W, H, ans, sw, sh;
	
	while(1){
		ans = 0;
		cin >> W >> H;
		if(W == 0 && H == 0) break;
		for(int i=0;i<22;i++){
			for(int j=0;j<22;j++){
				vis[i][j] = 1;
			}
		}
			
		for(int i=1;i<=H;i++){
			for(int j=1;j<=W;j++){
				cin >> mp[i][j];
				if(mp[i][j] == '@'){
					sh = i;
					sw = j;
					vis[i][j] = 1;
				}else{
					vis[i][j] = 0;
				}
			}
		}
		
		ans = dfs(sh, sw, ans);
		ans++;
		cout << ans << endl; 
	}
	return 0;
}


Measured memory_bytes: 3044
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#from __future__ import print_function
import time
import sys
import io
import re
import math
start = time.clock()
i = 0
m=int(raw_input())
n=map(int, raw_input().split())
o=int(raw_input())
p=map(int, raw_input().split())
for j in xrange(o):
    if int(p[j]) in n: i+=1
print i

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

int main(){
	int A, B;
	cin >> A >> B;
	int h = 100;
	int w = 100;
	int res[100][100];
	REP(i, h){
		REP(j, w){
			res[i][j] = (int)(i<50);
		}
	}
	A--;
	B--;
	REP(i, h){
		REP(j, w){
			if(i<50){
				if(i%2==1 && j%2==1 && A>0){
					res[i][j] = 0;
					A--;
				}
			}else{
				if(i%2==1 && j%2==1 && B>0){
					res[i][j] = 1;
					B--;
				}
			}
		}
	}
	cout << h << " " << w << endl;
	REP(i, h){
		REP(j, w){
			cout << (res[i][j]==0 ? '.' : '#');
		}
		cout << endl;
	}
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <stack>
#include <vector>
#include <queue>
#include <math.h>
#include <algorithm>
#include <numeric>
#include <set>

using namespace std;

void solve();

int main() {
	solve();
	return 0;
}

//////////////////////////////////////////////////
//////////////////////////////////////////////////

int N, M;
typedef pair<int, int> _pair;
vector<_pair> arr;

void solve() {
	cin >> N >> M;
	arr.resize(M);
	for (int i = 0; i < M; i++) {
		int a, b;
		cin >> a >> b;
		arr[i] = _pair(--b,--a);
	}
	sort(arr.begin(),arr.end());
	int ans = 0;
	int end = 0;
	for (int i = 0; i < M; i++) {
		if (arr[i].second >= end) {
			ans++;
			end = arr[i].first;
		}
	}
	cout << ans;
}

Measured memory_bytes: 1024
S = input()

s1 = int(S[:2])
s2 = int(S[2:])

if(s1 <= 12 and s2 <= 12 and s1 is not 0 and s2 is not 0):
    print('AMBIGUOUS')
elif(s1 <= 12 and s2 > 12 and s1 is not 0):
    print('MMYY')
elif(s1 > 12 and s2 <= 12 and s2 is not 0):
    print('YYMM')
elif(s1 is 0 and s2 <= 12 and s2 is not 0):
    print('YYMM')
elif(s1 <= 12 and s2 is  0 and s1 is not 0):
    print('MMYY')
else:
    print('NA')


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define ios       ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define forn(i,a,n) for (ll i = a; i < (ll)(n); i++)
#define fon(i,n) for (ll i = (ll)n-1; i >=0; i--)
#define vi          vector<ll>
#define vii vector<pair<ll,ll>>
#define all(a)      (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
#define se second
#define fi first
#define ciin(v) forn(i,0,v.size()) cin>>v[i]
#define coutt(v) forn(i,0,v.size()) cout<<v[i]<<" "
using namespace std;
int main(){
    ios
    ll test;
    test=1;
    // cin>>test;
    while(test--){
      ll n,w;
      cin>>n>>w;
      vi dp(w+1,0);
      forn(i,0,n){
        ll w1,v;
        cin>>w1>>v;
        for(ll i=w-w1;i>=0;i--){
            dp[i+w1]=max(dp[i+w1],dp[i]+v);
        }
      }
      ll ans=0;
      forn(i,0,w+1){
        ans=max(ans,dp[i]);
      }
      cout<<ans<<endl;

      
  }}  


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

using namespace std;


int main(){
    long long a, b, x, cnt = 0;
    scanf("%lld %lld %lld", &a, &b, &x);
    long long c1 = a/x;
    long long c2 = b/x;
    cnt = c2 - c1;
    if(a % x == 0) cnt++;
    printf("%lld\n", cnt);
    return 0;
}

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;
#define INF 100000000
ll euclidean_gcd(ll a, ll b) {
  while(1) {
    if(a < b) swap(a, b);
    if(!b) break;
    a %= b;
  }
  return a;
}
ll keta(ll a){
    return log10(a)+1;
}

int main() {
    ll n; 
    cin >> n;
    ll b = n;
    for (ll i = 2; i*i <= n; ++i) {
        if (n%i == 0) b = n/i; 
    }
    int keta = 0;
    while (b) {
        b /= 10;
        keta++;
    }
    cout << keta << endl;
    return 0;
}

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

ll INF = 1e15;
ll N;
double dat[2222222];
void init(ll n){
    N = 1;
    while(N < n) N *= 2;
    for(ll i=0;i<2*N-1;i++) dat[i] = 1e9;
}

void update(ll idx, double val){
    idx += N-1;
    dat[idx] = dat[idx]*val;
    while(idx>0){
        idx = (idx-1)/2;
        dat[idx] = (double)dat[idx*2 + 1] * dat[idx*2+2]/(1e9);
        //cerr << "dat " << dat[idx] << endl;
    }
}

// query(a,b,0,0,N) → [a,b)
double query(ll a, ll b, ll k, ll l, ll r){
    if(r<=a || b<=l) return 1e9;
    if(a<=l && r<=b) return dat[k];
    else{
        double vl = query(a,b,k*2+1,l,(l+r)/2);
        double vr = query(a,b,k*2+2,(l+r)/2,r);
        return (double)vl*vr/(1e9);
    }
}


signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);
    
    ll n;
    cin>>n;
    map<ll,ll> mp;
    ll t[n];
    double a[n];
    for(int i=0;i<n;i++){
        cin>>t[i]>>a[i];
        a[i] = (double)((10-a[i])*0.1);
        mp[t[i]]=0;
    }
    mp[-1]=0;
    mp[INF]=0;
    int cnt=0;
    int q;
    cin>>q;
    ll l[q],r[q];
    for(int i=0;i<q;i++){
        cin>>l[i]>>r[i];
        mp[l[i]]=0;
        mp[r[i]]=0;
    }
    for(auto &i:mp){
        i.second = cnt;
        cnt++;
    }
    init(cnt);
    for(int i=0;i<n;i++){
        update(mp[t[i]],a[i]);
    }
    for(int i=0;i<q;i++){
        cout << query(mp[l[i]],mp[r[i]],0,0,N) << "\n";
    }
}


Measured memory_bytes: 33392
#include <cmath>
    // #include <bits/stdc++.h>
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cassert>
#include <deque>
#include <queue>
#include <map>
#include <set>
#define FOR(j,k,n) for (int j = k; j < (int)(n); j++)
#define MAXN 100000000000000000
#define newl printf("\n")
#define test(t)  int t; cin>>t; for(int tes = 0; tes < t; tes++)
#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
typedef long long int lli;
const int MM = 1200000;
lli m,n,k,p1,p2,p3,p,f,a[MM];
string s,s1,s2;

int main(){
    fio;
    
    cin>>n>>k;
    cin>>a[0];
    m = a[0];
    p1 = a[0];
    for (int i=1; i<n; i++) {
        cin>>a[i];
        m = max(m,a[i]);
        p1 = __gcd(a[i],p1);
    }
    if(k%p1 == 0 && k <= m)
    {
        cout<<"POSSIBLE";
    }
    else{
        cout<<"IMPOSSIBLE";
    }
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main() {
	//cout << "" << endl; // prints
	int N;
	cin >> N;
	int D[N][2];
	for(int k = 0; k < N; k++){
		cin >> D[k][0] >> D[k][1];
	}
	int cnt = 0;
	for(int i = 0; i < N; i++){
		if(D[i][0] == D[i][1]){
			cnt++;
			if(cnt >= 3){
				cout << "Yes";
				return 0;
			}
		}else{
			cnt = 0;
		}
	}
	cout << "No";

	return 0;
}

Measured memory_bytes: 3628
#include <stdio.h>
 
int  Sort(int n, int *a){
    int f = 1, i, cou = 0;
     
    while(f){
        f = 0;
        for(i = 0; n-1 > i; i++){
            if(a[i] > a[i+1]){
                int buf = a[i+1];
                a[i+1] = a[i];
                a[i] = buf;
                f = 1;
                cou++;
            }
        }
    }
    return cou;
}
int main(void) {
    int n, a[100], i;
     
    scanf("%d", &n);
    for(i = 0; n > i; i++){
        scanf("%d", &a[i]);
    }
     
    int cou = Sort(n, a);
     
    for(i = 0; n > i; i++){
        printf("%d", a[i]);
        if(n - 1 > i) printf(" ");
    }
    printf("\n%d\n", cou);
    return 0;
}


Measured memory_bytes: 1968
def resolve():
    n = int(input())
    h = list(map(int, input().split()))
    res = 0
    for height in range(1, max(h) + 1):
        flag = False
        for i in range(n):
            if h[i] >= height and not flag:
                flag = True
                res += 1
            elif h[i] < height:
                flag = False
    print(res)


if __name__ == "__main__":
    resolve()


Measured memory_bytes: 3060
#include <iostream>

using namespace std;

int r, c;

int main(void) {
    while(cin >> r >> c) {
        if(r == 0 && c == 0) break;
        if(!(r % 2 == 1 && c % 2 == 1)) {
            cout << "yes" << endl;
        } else {
            cout << "no" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 0
/*
g++ -std=c++11 -o2 -Wall AGC028A.cpp -o .\out\AGC028A.out
.\out\AGC028A.out
*/

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

int chrs[100005];

int main(){
//  freopen("./input/input.txt", "r", stdin);
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  string s;
  string t;
  cin >> n >> m;
  cin >> s;
  cin >> t;
  function<ll(ll, ll)> gcd;
  gcd = [&gcd](ll a, ll b) {
      if (b == 0) return a;
      return gcd(b, a % b);
  };
  ll ans = -1ll;
  int g = gcd(n, m);
  ll l = 1ll * m / g * n;
  bool flag = true;
  for (int i = 0; i < g; ++i) {
    if (s[i * (int)(l / m)] != t[i * (int)(l / n)]) {
      flag = false;
    }
  }
  if (flag) {
    ans = l;
  }
  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define ll long long
#define endl "\n"

#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);

#define vi vector<int>
#define vl vector<ll>
#define vvi vector<vector<int>>
#define vvl vector< vector<long long>>
#define mi map<int,int>
#define pi pair<int,int>

#define Fori(i,a,b) for(int i=a; i<b; i++)
#define Ford(i, a, b) for(int i=a; i>=b; i--)

#define pb push_back
#define mp make_pair

#define read(a, n) for(int i=0; i<n; i++) cin >> a[i];
#define print(x) cout << "X: == " << x << endl;
#define printMap(a) for(auto it=a.begin() ; it!= a.end() ; it++) {cout << it->first << "  " << it->second << endl; }
#define printVector(a) for(auto it = a.begin() ; it!= a.end() ;it++) {cout << *it << endl;}

using namespace std;

int grid(vector<string> a, int x, int y) {
    if(x == 0 || y == 0) return -1;
    if(a[x-1][y-1] == '#') {
        return -1;
    }
    int result=0;
    if(x == 1 && y == 1) {
        return 0;
    }
    if(x > 0) {
        result =  grid(a, x-1, y);
    }
    if(y > 0) {
        result =  grid(a, x, y-1);
    }
    return result;
}

int main() {
    IOS
    int h, w;
    cin >> h >> w;
    vector<string> a(h);
    Fori(i, 0, h) {
        getline(cin >> ws, a[i]);
    }
    vvi dp(h+1, vi(w+1));
    Fori(i, 1, h+1) {
        Fori(j, 1, w+1) {
            if(i == 1 && j==1) {
                dp[i][j] = 1;
                continue;
            }
            if(a[i-1][j-1] == '#') {
                dp[i][j] = 0;
            } else {
                dp[i][j] = (dp[i-1][j] + dp[i][j-1]) % 1000000007;
            }
        }
    }
    cout << dp[h][w] << endl;
    return 0;
}

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

int main() {
    int n, x;
    cin >> n >> x;
    int d = 0;
    int cnt = 1;
    for (int i = 0; i < n; i++) {
        int l;
        cin >> l;
        d += l;
        if (d <= x) cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
n = int(input())
a = [int(i) for i in input().split()]
# aで嘘がある場合は出力0
# aは,nが奇数なら[0, 2, 2, 4, 4, 6, 6, ...]
# aは,nが偶数なら[1, 1, 3, 3, 5, 5, 7, ...]
valid = [i + (i+n+1) % 2 for i in range(n)]
a = sorted(a)
if a != valid:
    print(0)
else:
    # aが正しいなら答えはaに関係なくnのみで決まる
    # n==5->2**2, n==6->2**3, n==7->2**3, n==8->2**4
    # つまり答えは2**(int(n/2))
    out = 1
    for i in range(int(n/2)):
        out *= 2
        out %= 10**9+7
    print(out)

Measured memory_bytes: 13940
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int i = 1;
		while(i<=10000){
			int x = scan.nextInt();
			if(1<=x&&x<=10000){
				System.out.println("Case "+i+": "+x);
			}else if(x == 0){
				break;
			}
			i++;
		}

	}

}

Measured memory_bytes: 42452
#include<stdio.h>

int main(void)
{
  long long int n,k,sum1=0,sum2=0,sum3=0,i,j;
  
  scanf("%lld%lld",&n,&k);
  
  for(i=k;i<=n+1;i++){
    
    sum1 = i*(i-1)/2;
    
    sum2 = i*(2*n-i+1)/2;
    
    sum3+=(sum2-sum1+1);
  }
  
  printf("%lld", sum3%1000000007);
 
  return 0;
}


Measured memory_bytes: 1700
#include <iostream>

int main () {
  char c;
  std::cin >> c;
  if (c >= 'a' && c <= 'z') std::cout << 'a' << std::endl;
  else if (c >= 'A' && c <= 'Z') std::cout << 'A' << std::endl;
  return 0;
}

Measured memory_bytes: 3628
#include <stdio.h>
#include <string.h>
#define N 1000
 
int LCS(char *c1, char *c2){
 
  int i,j;
  int x = strlen(c1),y = strlen(c2);
  int A[x+1][y+1];
 
  for(i=1;i<=x;i++)
    A[i][0] = 0;
  for(j=0;j<=y;j++)
    A[0][j] = 0;
   
  for(i=1;i<=x;i++){
    for(j=1;j<=y;j++){
      if(c1[i-1] == c2[j-1])
    A[i][j] = A[i-1][j-1] + 1;
      else if(A[i-1][j] >= A[i][j-1]) 
    A[i][j] = A[i-1][j];
      else
    A[i][j] = A[i][j-1];
    }
  }
  return A[x][y];
}
 
 
int main(void){
 
  int i,j,n,x;
  char c1[N],c2[N];
 
  scanf("%d",&n);
 
  for(i=0;i<n;i++){
    scanf("%s %s",c1,c2);
    x = LCS(c1,c2);
    //printf("n = %d\n",n);
    //printf("i = %d x = %d\n",i,x);
    printf("%d\n",x);
  }
  return 0;
}

Measured memory_bytes: 4524
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <utility>
#include <cmath>
#include <string>
#include <bitset>
#include <queue>
#include <cstdio>
#include <cstring>
#include <deque>
#include <unordered_map>
#include <climits>
#include <map>
#include <iomanip>
#include <set>
#include <unordered_set>
#include <ctime>

#define ci(t) cin>>t
#define co(t) cout<<t
#define LL long long
#define fa(i,a,b) for(int i=a;i<b;++i)
#define fd(i,a,b) for(int i=a;i>b;--i)
#define setp pair<pair<int,int>,int>
#define setl pair<int,int>

using namespace std;

int gcd(int a, int b) { return a % b ? gcd(b, a % b) : b; }
pair <int, int> vu[4] = { {0,1}, {0,-1} , {1,0},{-1,0} }; // EWSN

const int max_v = 1e5 + 7;
const int INF = 1e7 + 7;

string s;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	ci(s);
	int n = s.size();
	bool ck = 1;
	fa(i, 0, (n/2))
	{
		if (s[i] != s[n - i - 1])
		{
			ck = 0; break;
		}
	}

	int p = (n / 2) / 2;
	int q = ((n / 2) + n) / 2;

	fa(i, 0, p)
	{
		if (s[i] != s[(n / 2) - i - 1])
		{
			ck = 0; break;
		}
	}

	fa(i, n / 2 + 1, q)
	{
		if (s[i] != s[n - i - 1])
		{
			ck = 0; break;
		}
	}

	if (ck) co("Yes");
	else co("No");

	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//#include<boost/multiprecision/cpp_dec_float.hpp>
//namespace mp=boost::multiprecision;
//#define mulint mp::cpp_int
//#define mulfloat mp::cpp_dec_float_100
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
//constexpr int MOD=1000000007;
constexpr int MOD=998244353;
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcountll(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
#define fi first
#define se second
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};
const int MAX_N=2e5+5;
//struct edge{lint to,num;};
//vector<int> bucket[MAX_N/1000];
lint dp[51][51][2501];

int main(void){
    int N,A;
    cin >> N >> A;
    int X[N];
    rep(i,N) cin >> X[i];
    dp[0][0][0]=1;
    rep(i,N){
        rep(j,N) rep(k,2501){
            dp[i+1][j][k]+=dp[i][j][k];
            if(j+X[i]<=2500) dp[i+1][j+1][k+X[i]]+=dp[i][j][k];
        }
    }
    lint ans=0;
    for(int i=1;i<=N;i++) ans+=dp[N][i][i*A];
    cout << ans << endl;
}

Measured memory_bytes: 53416
import sys, heapq
def LI(): return list(map(int, sys.stdin.readline().split()))
def LS(): return list(sys.stdin.readline())

N = int(input())
H = LI()

res = 0
cnt = 0
for i in range(N - 1):
    if H[i] < H[i + 1]:
        res = max(res, cnt)
        cnt = -1
    cnt += 1

res = max(res, cnt)
print(res)

Measured memory_bytes: 14204
n, a, b, k = gets.split(" ").map(&:to_i)
## 二項係数 C(n,k) mod pの計算 (pは素数)##
#適切な値に設定する
MOD = 998244353
MAX = n

$fact = Array.new(MAX + 1) # i! mod p
$finv = Array.new(MAX + 1) # (i!)^(-1) mod p
$inv = Array.new(MAX + 1) # i^(-1) mod p

def com_init()
  $fact[0] = $fact[1] = 1
  $finv[0] = $finv[1] = 1
  $inv[1] = 1
  2.upto(MAX) do |i|
    $fact[i] = $fact[i-1] * i % MOD
    $inv[i] = MOD - $inv[MOD % i] * (MOD/i) % MOD
    $finv[i] = $finv[i-1] * $inv[i] % MOD
  end
end

# C(n,k) mod p
def com(n,k)
  return 0 if n < k || n < 0 || k < 0
  $fact[n] * (($finv[n-k] * $finv[k]) % MOD )% MOD
end

com_init
sum = 0
0.upto(n) do |x|
  next if (k-a*x) % b != 0
  y = (k-a*x)/b
  sum = sum + com(n,x) * com(n,y) % MOD
end

puts sum % MOD


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

int main(){
  int n;
  cin >> n;
  vector<pair<pair<string, int>, int>> v(n);
  rep(i, n) {
    string s;
    int t;
    cin >> s >> t;
    v[i] = make_pair(make_pair(s, -t), i);
  }
  sort(v.begin(), v.end());
  rep(i, n) cout << v[i].second + 1 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long
const int INF = 1LL << 60;
int a[101][101], g[3][3];

signed main(){

  for(int i = 0; i < 3; i++){
    for(int j = 0; j < 3; j++){
      cin >> a[i][j];
    }
  }

  int n; cin >> n;
  for(int i = 0; i < n; i++){
    int b; cin >> b;
    for(int j = 0; j < 3; j++){
      for(int k = 0; k < 3; k++){
        if(a[j][k] == b) g[j][k] = 1;
      }
    }
  }

  bool judge = false;
  for(int i = 0; i < 3; i++){
    for(int j = 0; j < 3; j++){
      int res = 1;
      for(int k = 0; k < 3; k++){
        if(!g[(i + k) % 3][j]) res = 0;
      }
      if(res) judge = true;
      res = 1;
      for(int k = 0; k < 3; k++){
        if(!g[i][(j + k) % 3]) res = 0;
      }
      if(res) judge = true;
    }
  }
  if(g[0][0] && g[1][1] && g[2][2]) judge = true;
  if(g[0][2] && g[1][1] && g[2][0]) judge = true;

  cout << (judge ? "Yes" : "No") << endl;

  return 0;
}


Measured memory_bytes: 256
a, b, c, x, y = [int(i) for i in input().split()]

if a+b <= 2*c:
    ans = a * x + b * y
else:
    if x >= y:
        ans = c * 2 * y
        ans += (a if a <= 2*c else 2*c) * (x - y)
    else:
        ans = c * 2 * x
        ans += (b if b <= 2*c else 2*c) * (y - x)

print(ans)


Measured memory_bytes: 3064