akhauriyash/Code-Regression huggingface dataset:
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(I, a, b) for (int i = (a); i < (b); ++i)
using namespace std;
using ll = long long;

int main() {
  int n;
  cin >> n;
  vector<int> d(n);
  REP(i,n) cin >> d[i];
  sort(d.begin(),d.end());
  int c,e;
  
  if(n % 2 == 0){
    int aa = n/2;
    c = d[aa-1];
    e = d[aa];
  }
  else cout << 0 << endl;
  
  
  if(e == c) cout << 0 << endl;
  else cout << e - c << endl;
  
}

Measured memory_bytes: 3844
#include<cstdio>
char s[100001];
long long const mod=1e9+7;
int main(){
    int n,cnt[26]={};
    scanf("%d%s",&n,s);
    for(int i=0;i<n;i++)cnt[s[i]-'a']++;
    long long ans=1;
    for(int i=0;i<26;i++)ans=(ans*(cnt[i]+1))%mod;
    printf("%lld\n",ans-1);
    return 0;
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/abc110/tasks/abc110_b

#include <bits/stdc++.h>
#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for (int(i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for (int(i) = (m); (i) < (n); i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;

int main()
{
  /* Magic word */
  // cin.tie(0);
  // ios::sync_with_stdio(false);
  /* ---------- */

  int n, m, x, y, t;
  vector<int> xx, yy;

  cin >> n >> m >> x >> y;

  REP(i, n)
  {
    cin >> t;
    xx.push_back(t);
  }

  REP(i, m)
  {
    cin >> t;
    yy.push_back(t);
  }

  sort(ALL(xx));
  sort(ALL(yy));

  string r = max(x, xx.back()) < min(y, yy.front()) ? "No War" : "War";

  cout << r << '\n';

  return 0;
}


Measured memory_bytes: 256
s = list(input())
cnt = 0
i = 0
j = len(s)-1
for t in range(len(s)):
    if s[t] == "A":
        break
    i += 1
for t in range(len(s)):
    if s[j] == "Z":
        break
    j -= 1
print(j-i+1)
        
    
        

Measured memory_bytes: 4840
var a,b,c:array[0..50] of integer;
    dp:array[0..50, 0..500, 0..500] of integer;
    n,ma,mb,i,ca,cb,ans:integer;

Function min(a,b:integer):integer;
    Begin
        if a < b then exit(a)
        else exit(b);
    End;

BEGIN
    readln(n,ma,mb);
    for i:=0 to n-1 do
        readln(a[i],b[i],c[i]);

    for i:=0 to n do
        for ca:=0 to 400 do
            for cb:=0 to 400 do
                dp[i,ca,cb] := maxint;

    dp[0,0,0] := 0;
    for i:=0 to n-1 do
        for ca:=0 to 400 do
            for cb:=0 to 400 do
                if dp[i,ca,cb] <> maxint then
                    Begin
                        dp[i+1, ca, cb] := min(dp[i,ca,cb], dp[i+1, ca, cb]);
                        dp[i+1, ca+a[i], cb+b[i]] := dp[i,ca,cb] + c[i];
                    End;

    ans := maxint;
    for ca:=1 to 400 do
        for cb:=1 to 400 do
            if ma * cb = mb * ca then
                ans := min(ans, dp[n,ca,cb]);
    
    if ans = maxint then writeln(-1)
    else writeln(ans);
END.

Measured memory_bytes: 40576
(let ((n (read))
      (k (read))
      (ans (list)))
  (if (> k (floor (* (1- n) (- n 2)) 2))
      (princ -1)
      (progn (dotimes (i (1- n))
               (setf ans (append ans (list (1+ i) n))))
             (setf k (- (floor (* (1- n) (- n 2)) 2) k))
             (loop for i from 1 upto (1- n) while (> k 0) do
                   (loop for j from (1+ i) upto (1- n) while (> k 0) do
                         (setf ans (append ans (list i j)))
                         (decf k)))
             (format t "~a~%~{~a ~a~%~}" (floor (length ans) 2) ans))))


Measured memory_bytes: 59748
import java.util.*;
import java.io.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        int n = sc.nextInt();
        long mod = (long)1e9+7;
        long[] arr = sc.nextLongArray(n);
        long[] cum = new long[n];
        cum[0] = arr[0];
        for(int i = 1; i < n; i++){
            cum[i] = cum[i-1] + arr[i];
        }
        long ans = 0;
        for(int i = 0; i < n-1; i++){
            ans += (arr[i]*((cum[n-1]-cum[i])%mod))%mod;
            ans %= mod;
        }
        pw.println(ans);
        pw.flush();
    }

    static class GeekInteger {
        public static void save_sort(int[] array) {
            shuffle(array);
            Arrays.sort(array);
        }
 
        public static int[] shuffle(int[] array) {
            int n = array.length;
            Random random = new Random();
            for (int i = 0, j; i < n; i++) {
                j = i + random.nextInt(n - i);
                int randomElement = array[j];
                array[j] = array[i];
                array[i] = randomElement;
            }
            return array;
        }
 
    }
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

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

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public double nextDouble() {
         return Double.parseDouble(next());
    }
    
    public String[] nextArray(int n) {
        String[] a = new String[n];
        for (int i = 0; i < n; i++)
            a[i] = next();
        return a;
    }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    } 
}


Measured memory_bytes: 56016
using System.Numerics;
using System;

public class Hello
{
    public static void Main()
    {
        var a = new string[] { "", "Man", "Oku", "Cho", "Kei", "Gai", "Jo", "Jou", "Ko", "Kan", "Sei", "Sai", "Gok", "Ggs", "Asg", "Nyt", "Fks", "Mts" };
        while (true)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            var m = int.Parse(line[0]);
            var n = int.Parse(line[1]);
            if (m == 0 && n == 0) break;
            var s = BigInteger.Pow(m, n).ToString();
            getAns(a, s);
        }
    }
    static void getAns(string[] a, string s)
    {
        var c1 = s.Length / 4;
        var c2 = s.Length % 4;
        var ans = "";
        if (c2 > 0) ans = s.Substring(0, c2) + a[c1];
        for (int i = 0; i < c1; i++)
        {
            var w = int.Parse(s.Substring(c2 + 4 * i, 4));
            if (w != 0) ans += w.ToString()+ a[c1 - i - 1];
        }
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 16072
A, B, C = map(int,input().split())

ans = 0
while A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
    if A == B and A == C:
        print(-1)
        exit()
    a = (B+C)//2
    b = (A+C)//2
    c = (A+B)//2
    A = a
    B = b
    C = c
    ans += 1

print(ans)

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

int main(){
  map<int, int> node;
  int N;

  cin >> N;
  int num;
  for(int i = 0; i < N; i++){
    cin >> num;
    // 存在しなければ(0が返る)/存在すれば(1が返る)
    if(!node.count(num)){
      node[num] = 1;    // ノードを追加して初期値を設定
    }else{
      node[num] += 1;   // ノードを更新
    }
  }

  // ゲーム終了後に紙に書かれている数字をカウント
  int cnt = 0;
  for(auto itr = node.begin(); itr != node.end(); itr++){
    //cout << "Key = " << itr->first << ", val = " <<itr->second << endl;
    cnt += itr->second % 2;
  }

  cout << cnt << endl;
}

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

using namespace std;

using vi = vector<int>; using vvi = vector<vi>;
using ii = pair<int,int>; using vii = vector<ii>;
using l = long long; using vl = vector<l>; using vvl = vector<vl>;
using ll = pair<l,l>; using vll = vector<ll>; using vvll = vector<vll>;
using lu = unsigned long long;
using vb = vector<bool>; using vvb = vector<vb>;
using vd = vector<double>; using vvd = vector<vd>;
const int INF = numeric_limits<int>::max();
const double EPS = 1e-10; static constexpr auto PI = acos(-1);
const l e0=1, e3=1000, e5=100000, e6=10*e5, e7=10*e6, e8=10*e7, e9=10*e8;
#define ALL(x) begin(x), end(x)
#define F(a,b,c) for (l a = l(b); a < l(c); a++)
#define B(a,b,c) for (l a = l(b); a > l(c); a--)

// #define ONLINE_JUDGE
#if defined ONLINE_JUDGE
const bool enable_log = false;
#else
const bool enable_log = true;
#endif
struct VoidStream { void operator&(std::ostream&) { } };
#define LOG !(enable_log) ? (void) 0 : VoidStream() & cerr

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);
  string s1, s2;
  while (cin >> s1 >> s2) {
    vl acc1(s1.size() + 1);
    F(i, 0, s1.size()) acc1[i + 1] = acc1[i] + (s1[i] == 'A' ? 2 : 1);
    vl acc2(s2.size() + 1);
    F(i, 0, s2.size()) acc2[i + 1] = acc2[i] + (s2[i] == 'A' ? 2 : 1);
    l q; cin >> q;
    while (q--) {
      l a, b, c, d; cin >> a >> b >> c >> d;
      if ((acc1[b] - acc1[a - 1]) % 3 == (acc2[d] - acc2[c - 1]) % 3) {
        cout << "YES\n";
      } else {
        cout << "NO\n";
      }
    }
  }
}


Measured memory_bytes: 2512
-- Try AtCoder
-- author: Leonardone @ NEETSDKASU

main = putStrLn . unwords . solve . tail . words =<< getContents

odds o e []     = (o, e)
odds o e (x:xs) = evens (x:o) e xs

evens o e []     = (o, e)
evens o e (x:xs) = odds o (x:e) xs

solve a = ans where
    n = length a
    (o, e) = odds [] [] a
    ans = if even n then e ++ reverse o else o ++ reverse e


Measured memory_bytes: 92412
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
const int inf=1e9+7;
const ll INF=1e18;

int main(){
    ll n,k;cin>>n>>k;
    ll ans=n*n;
    if(k!=0){
        ans-=n*k;
        rep2(i,k+1,n+1)ans-=(n/i)*k+min(n%i,k-1);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif // LOCAL_
#define dumpl(x1) fprintf(stderr, "#%s.%d (%s) = (%ld)\n", __func__, __LINE__, #x1, x1);
#define dumpll(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%ld, %ld)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumpd(x1) fprintf(stderr, "#%s.%d (%s) = (%lf)\n", __func__, __LINE__, #x1, x1);
#define dumpdd(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%lf, %lf)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define loop for(;;)
 
struct S002 {
  int n;
  S002& operator > (long& x) {
    n = x;
    return *this;
  }
  S002& operator > (long&& x) {
    n = x;
    return *this;
  }
  S002& operator >= (long& x) {
    if( scanf("%ld", &x) <= 0 ) exit(0);
    return *this;
  }
  S002& operator >= (double& x) {
    if( scanf("%lf", &x) <= 0 ) exit(0);
    return *this;
  }
  S002& operator >= (std::string& s) {
    if( not (std::cin >> s) ) exit(0);
    return *this;
  }
  template<typename a>
  S002& operator >= (std::vector<a>& v) {
    v.resize(n);
    for(long i = 0; i < n; ++i) {
      *this >= v[i];
    }
    return *this;
  }
  template<typename a, std::size_t s>
  S002& operator >= (std::array<a, s>& x) {
    for(long i = 0; i < (long)s; ++i) {
      *this >= x[i];
    }
    return *this;
  }
};

struct Solver {
  long n;
  Solver() {
    S002 reader;
    reader >= n;
  }
  void solve() {
    long t = 0;
    for(long i = 1; i < 10000000; ++i) {
      t += i;
      if( n <= t ) {
        printf("%ld\n", i);
        return;
      }
    }
  }
};
 
int main() {
  for(;;) std::unique_ptr<Solver>(new Solver())->solve();
  return 0;
}

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

int n;
int a[1000000];
int b[1000000];
long long ans;

int main(){
    cin >> n;
    for(int i=0;i<(n+1);i++){
        cin >> a[i];
    }
    for(int i=0;i<n;i++){
        cin >> b[i];
    }
    ans = 0;
    int diff =0;
    for(int i=0;i<n;i++){
        ans += min(a[i],b[i]+diff);
        int c = a[i]-diff;
        if(c<0){
            c = 0;
        }
        diff = b[i] - c;
        if(diff<0){
            diff = 0;
        } 
    }
    ans += min(a[n],diff);
    cout << ans <<endl;
    return 0; 
}

Measured memory_bytes: 4736
<?php
$num = trim(fgets(STDIN));
$ct = explode(" ",$num);
$answer = 0;

for($i = 0; $i < $ct[0]; $i++){
    $num = trim(fgets(STDIN));
    $pt = explode(" ",$num);
    $pt1 = pow($pt[0],2);
    $pt2 = pow($pt[1],2);
    $cu = sqrt($pt1 + $pt2);
    if($cu <= $ct[1]){
        $answer++;
    }
}
echo $answer;

Measured memory_bytes: 15992
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl

using namespace std;

typedef long long int ll;

template<typename T>
vector<T> make_v(size_t a, T b) {
    return vector<T>(a, b);
}

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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<ll> A(N), B(N);
    ll sumA = 0, sumB = 0;
    REP(i, 0, N) {
        cin >> A[i];
        sumA += A[i];
    }
    REP(i, 0, N) {
        cin >> B[i];
        sumB += B[i];
    }

    if (sumA < sumB) {
        cout << -1 << endl;
        return 0;
    }

    sumA = 0;
    sumB = 0;
    vector<ll> x;
    int cnt = 0;

    REP(i, 0, N) {
        if (A[i] < B[i]) {
            sumA += B[i] - A[i];
            cnt++;
        } else {
            x.push_back(A[i] - B[i]);
        }
    }

    sort(rbegin(x), rend(x));
    REP(i, 0, x.size()) {
        if (sumA <= 0) {
            cout << cnt + i << endl;
            return 0;
        }
        sumA -= x[i];
    }

    if (sumA <= 0) {
        cout << N << endl;
    } else {
        cout << -1 << endl;
    }

    return 0;
}


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

namespace abc060_a
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            if (str[0].Substring(str[0].Length - 1) == str[1].Substring(0, 1) && str[1].Substring(str[1].Length - 1) == str[2].Substring(0, 1))
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
        }
    }
}


Measured memory_bytes: 25868
#include <iostream>
using namespace std;
struct Card { char suit, value; };
void bubbleSort(struct Card a[], int n)
{
	for (int i = 0; i < n; i++)
	{
		for (int j = n - 1; j > i; j--)
		{
			if (a[j].value<a[j - 1].value)
			{
				Card t = a[j];
				a[j] = a[j-1];
				a[j-1] = t;
			}
		}
	}
}

void selectionSort(struct Card a[], int n)
{
	for (int i = 0; i < n; i++)
	{
		int min = i;
		for (int j = i; j < n; j++)
		{
			if (a[j].value < a[min].value)
			{
				min=j;
			}
		}
		Card t = a[i];
		a[i] = a[min];
		a[min] = t;
	}
}

void print(struct Card a[], int n)
{
	for (int i = 0; i < n; i++)
	{
		if (i > 0)
			cout << " ";
		cout << a[i].suit << a[i].value;
	}
	cout << endl;
}

bool isStable(struct Card a1[], struct Card a2[], int n)
{
	for (int i = 0; i < n; i++)
	{
		if (a1[i].suit != a2[i].suit)
			return false;
	}
	return true;
}

int main()
{
	Card a1[100], a2[100];
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> a1[i].suit >> a1[i].value;
	}
	for (int i = 0; i < n; i++)
	{
		a2[i] = a1[i];

	}
	bubbleSort(a1, n);
	selectionSort(a2, n);
	print(a1, n);
	cout << "Stable" << endl;
	print(a2, n);
	if (isStable(a1, a2, n))
	{
		cout << "Stable" << endl;
	}
	else
	{
		cout << "Not stable" << endl;
	}
	return 0;
}


Measured memory_bytes: 3116
N,M=gets.split.map(&:to_i)

as = []
N.times do
    as << gets.chomp
end

bs = []

M.times do
    bs << gets.chomp
end

0.upto(N-M) do |i|
    0.upto(N-M) do |j|
        # p as[i...i+M].map{|a| a[j...j+M]}
        if bs.zip(as[i...i+M]).all? {|b,a| a[j...j+M]==b}
            puts 'Yes'
            exit
        end
    end
end

puts 'No'

Measured memory_bytes: 1916
#include<bits/stdc++.h>
using namespace std;
int main() {
    vector<int> dp(1000001, 1e9);
    vector<int> dpo(1000001, 1e9);

    dp[0] = dpo[0] = 0;
    for (int i = 1; i <= 200; i++)
    {
        int l = i * (i + 1) * (i + 2) / 6;
        for (int j = 0; j+l <= 1000000; j++)
        {
            dp[j+l] = min(dp[j+l], dp[j] + 1);
        }
        if(l % 2 == 1){
            for (int j = 0; j+l <= 1000000; j++)
            {
                dpo[j+l] = min(dpo[j+l], dpo[j] + 1);
            }
        }
    }

    int n;
    for(;;){
        int n;
        cin >> n;
        if(n == 0) break;
        cout << dp[n] << " " << dpo[n] << endl;
    }
}


Measured memory_bytes: 10484
#include <stdio.h>

int main() {
	int N, a[1001];
	scanf("%d", &N);
	for (int i = 0; i < N; i++) {
		scanf("%d", &a[i]);
	}
	int min = 2000, max = 0;
	for (int i = 0; i < N; i++) {
		if(min > a[i]) min = a[i];
		if(max < a[i]) max = a[i];
	}
	printf("%d\n", max - min);
	return 0;
}


Measured memory_bytes: 128
N=int(input())
if N==1:
  print(1)
  exit()
  
A=[list(map(int,input().split())) for i in range(N)]
B={}
for a,b in A:
  for c,d in A:
    e=a-c
    f=b-d
    if e!=0 or f!=0:
      if (e,f) in B:
        B[(e,f)]+=1
      else:
        B[(e,f)]=1
a=max(B.values())
print(N-a)

Measured memory_bytes: 3444
use std::cmp;
use std::collections::HashSet;
use std::fmt::Debug;
use std::str::FromStr;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where
    T: FromStr,
    <T as FromStr>::Err: Debug,
{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim()
        .split_whitespace()
        .map(|c| T::from_str(c).unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_as_string() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn gcd(a: u64, b: u64) -> u64 {
    if b == 0 {
        return a;
    } else {
        return gcd(b, a % b);
    }
}

fn calc_primes(x: u64) -> Vec<u64> {
    if x == 1 {
        return vec![];
    }
    if x == 2 {
        return vec![2];
    }
    let mut x = x;
    let mut primes = vec![];

    for div in 2..=(x as f64).sqrt().floor() as u64 {
        if x % div == 0 {
            primes.push(div);

            while x % div == 0 {
                x /= div;
            }
        }
    }

    if x > 1 {
        primes.push(x);
    }
    return primes;
}

fn is_pariwise(a: &[u64]) -> bool {
    let mut hash: HashSet<u64> = HashSet::new();
    let mut founds: Vec<bool> = vec![false; 1_000_001];
    for ax in a {
        if *ax == 1 {
            continue;
        }

        // check if `ax` has already appeared
        if founds[(*ax) as usize] {
            return false;
        } else {
            founds[(*ax) as usize] = true;
        }

        let primes = calc_primes(*ax);
        for px in primes {
            if let Some(_) = hash.get(&px) {
                return false;
            } else {
                hash.insert(px);
            }
        }
    }
    return true;
}

fn is_setwise(a: &[u64]) -> bool {
    let mut ans = a[0];

    for elem in a {
        ans = gcd(ans, *elem);
    }

    if ans == 1 {
        true
    } else {
        false
    }
}

fn main() {
    let n: usize = read_as_vec()[0];
    let a: Vec<u64> = read_as_vec::<u64>();

    if is_pariwise(&a) {
        println!("pairwise coprime");
    } else if is_setwise(&a) {
        println!("setwise coprime");
    } else {
        println!("not coprime");
    }
    // println!("{:?}", calc_primes(19));
    // println!("{:?}", calc_primes(1));
    // println!("{:?}", calc_primes(18));
}


Measured memory_bytes: 18108
cmap = {
  "11" => "a", "12" => "b", "13" => "c", "14" => "d", "15" => "e",
  "21" => "f", "22" => "g", "23" => "h", "24" => "i", "25" => "j",
  "31" => "k", "32" => "l", "33" => "m", "34" => "n", "35" => "o",
  "41" => "p", "42" => "q", "43" => "r", "44" => "s", "45" => "t",
  "51" => "u", "52" => "v", "53" => "w", "54" => "x", "55" => "y",
  "61" => "z", "62" => ".", "63" => "?", "64" => "!", "65" => " "
}

while (line = gets)
  str = line.strip

  dec = ''
  if str.length % 2 == 0
    for dd in str.scan(/\d\d/)
      ch = cmap[dd]
      if ch.nil?
        dec = 'NA'
        break
      end
      dec += ch
    end
  else
    dec = 'NA'
  end

  puts dec
end

Measured memory_bytes: 6096
#include <stdio.h>
#include<math.h>
#include <algorithm>
using namespace std;


int main(){

   char buf[1010];
   fgets(buf,1010,stdin);

   for(int i=0;buf[i] != '\0';i++){
	 if(i >= 4 && buf[i] == 'e' && buf[i-1] == 'l' && buf[i-2] == 'p' &&
			   buf[i-3] == 'p' && buf[i-4] == 'a'){
		   buf[i-4] = 'p';
		   buf[i-3] = 'e';
		   buf[i-2] = 'a';
		   buf[i-1] = 'c';
		   buf[i] = 'h';
	   }else if(i >= 4  && buf[i] == 'h' && buf[i-1] == 'c' && buf[i-2] == 'a' &&
			   buf[i-3] == 'e' && buf[i-4] == 'p'){
		   buf[i-4] = 'a';
		   buf[i-3] = 'p';
		   buf[i-2] = 'p';
		   buf[i-1] = 'l';
		   buf[i] = 'e';
	   }
   }

   printf("%s",buf);

    return 0;
}

Measured memory_bytes: 2692
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

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

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

//a[s][t] = 0 <= i < s, 0 <= j < t
template <typename T>
class cumulative{
    public:
        int h, w;
        vector<vector<T>> c, a;

        cumulative(const vector<vector<T>>& c, int h, int w)
            : h(h), w(w), c(c), a(h+1, vector<T>(w+1)) {
                for(int i = 1; i <= h; i++){
                    for(int j = 1; j <= w; j++){
                        a[i][j] += c[i-1][j-1] + a[i-1][j] + a[i][j-1] - a[i-1][j-1];
                    }
                }
            }

        T query(int i, int j, int k, int l){
            return a[k][l] - a[k][j] - a[i][l] + a[i][j];
        }
};

signed main(){
    int n, m, q;
    cin >> n >> m >> q;

    vector<vector<int>> a(n+1, vector<int>(n+1));
    rep(i, m){
        int l, r;
        cin >> l >> r;
        a[l][r]++;
    }

    cumulative<int> c(a, n+1, n+1);
    rep(i, q){
        int s, t;
        cin >> s >> t;
        cout << c.query(s, s, t+1, t+1) << endl;
    }

    return 0;
}


Measured memory_bytes: 6912
using System;

namespace atcoderA
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            int[] line1 = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            int[] line2 = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            int H = line1[0];
            int W = line1[1];
            int h = line2[0];
            int w = line2[1];
            Console.WriteLine((H - h) * (W - w));
        }
    }
}

Measured memory_bytes: 13140
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)


using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<ll, ll>;



int main(){
    int n;
    cin >> n;
    VEC(ll, a, n);

    ll res = 0;

    vector<ll> sum(n, 0);
    rep(i, n){
        //if(a[i] == 0)res++;
        if(i == 0)sum[i] = a[i];
        else sum[i] = sum[i - 1] + a[i];
    }
    map<ll, ll> mp;
    rep(i, n){
      //cout << sum[i] << endl;
        mp[sum[i]]++;
    }

    for(auto m : mp){
      //cout << m.first << " " << m.second << endl;
      if(m.first == 0)res += m.second;
        res += (m.second * (m.second - 1) / 2);
    }
    cout << res << endl;
}

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> ans(N);
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    ans.at(a-1)++;
    ans.at(b-1)++;
  }
  for (int i = 0; i < N; i++) {
    cout << ans.at(i) << endl;
  }
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static void Main()
    {
        var input = Console.ReadLine().Split(' ').Select(x => x.Substring(0, 1).ToUpper()).ToList();
        Console.WriteLine(input[0] + input[1] + input[2]);
    }
}

Measured memory_bytes: 13268
import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner scanner = new Scanner(System.in);
		double x1 = scanner.nextDouble();
		double y1 = scanner.nextDouble();
		double x2 = scanner.nextDouble();
		double y2 = scanner.nextDouble();

		double answer = Math.sqrt((x2 - x1) * (x2 - x1) + (y2- y1) * (y2 - y1));
		System.out.println(answer);

                scanner.close();
	}
}	

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

const int maxn=(1<<16)-1;

int n;
bool bl[maxn+5];
long long dp[maxn+5];
long long gp[maxn+5];
long long a[32][32];

int main(){
	cin>>n;
	int N=(1<<n)-1;
	//cout<<N<<'\n';
	for(int i=0;i<n;++i){
		for(int j=0;j<n;++j){
			cin>>a[i][j];
		}
	}
	for(int i=0;i<=N;++i){
		for(int j=0;j<n;++j){
			int tt=((1<<j)|i);
			if(tt==i||bl[tt]) continue;
			else{
				bl[tt]=1;
				gp[tt]=gp[i];
				for(int k=0;k<n;++k){
					if((i|(1<<k))==i) gp[tt]+=a[j][k];
				}
			} 
		}
	}
	for(int i=0;i<=N;++i){
		dp[i]=gp[i];
		for(int k=i;k;k=(k-1)&i){
			dp[i]=max(dp[i],dp[i^k]+dp[k]);	
		}
	}
	cout<<dp[N]<<"\n";
	return 0;
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; i++)
#define PI 3.1415926535897932384626433832795028
#define INF (1<<29)
#define LINF (1LL<<60)
using namespace std;
using INT = long long;
using P = pair<int,int> ;

int main(){
    int a,b,c,k;
    cin >> a >> b >> c >> k;
    int s = k;
    k = k - a;
    if(k<=0){
        cout << s;
        return 0;
    }
    k = k - b;
    if(k<=0){
        cout << a;
        return 0;
    }
    
    cout << a - k;
    
	return 0;
}



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

int main(){
    int N;
    cin >> N;

    vector<int> t(N), x(N), y(N);
    for(int i = 0; i < N; ++i){
        cin >> t[i] >> x[i] >> y[i];
    }

    bool check = true;
    if(abs(x[0]) + abs(y[0]) > t[0] || 
    (abs(x[0]) + abs(y[0]) - t[0]) % 2 != 0){
        check = false;
    }
    for(int i = 1; i < N; ++i){
        if(abs(x[i] - x[i-1]) + abs(y[i] - y[i-1]) > t[i] - t[i-1] || 
        (abs(x[i] - x[i-1]) + abs(y[i] - y[i-1]) - (t[i] - t[i-1])) % 2 != 0){
            check = false;
            break;
        }
    }
    cout << (check ? "Yes" : "No") << endl;
}

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

int n;
string s;
vector<int> v, tmp;

int solve();

int main() {
  cin >> n >> s;
  for(int i = 0; i < n; ++i) v.push_back(s[i] - '0');
  cout << solve() << endl;
  return 0;
}

int solve() {
  bool ch = 0;
  for(int i = 0; i < n; ++i)
    if(--v[i] == 1) ch = 1;
  if(ch) {
    ch = 0;
    for(int i = 0; i < n; ++i)
      if(v[i] == 1) ch ^= ((n - 1) & i) == i;
    return ch;
  }
  ch = 0;
  for(int i = 0; i < n; ++i)
    if(v[i] == 2) ch ^= ((n - 1) & i) == i;
  return ch * 2;
}


Measured memory_bytes: 7804
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def ii(): return int(stdin.readline())
def li(): return map(int, stdin.readline().split())
def ns(): return stdin.readline().rstrip()
N = ii()
S = ns()
K = ii()
sym = S[K-1]

new = [ s if s == sym else "*" for s in S]
print(''.join(new))


Measured memory_bytes: 3060
N, *XL = map(int, open(0).read().split())

A = sorted(((x + l, x - l) for x, l in zip(*[iter(XL)] * 2)), key=lambda x: x[0])

ans = 0
cur = -10 ** 9
for t, s in A:
    if cur <= s:
        cur = t
        ans += 1

print(ans)

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
#define REPi(i, a, b) for(int i=int(a); i<int(b); i++)
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; }
const ll MOD = 1e9+7;

int main(){
    int N = 0;
    cin >> N;

    vector<int> ans;

    if(N < 4){
        ans.push_back(2);
        ans.push_back(5);
        ans.push_back(63);
        //if(N <= 4) ans.push_back(20);
        //if(N <= 5) ans.push_back(30);
    }
    else{
        ll sum = 0;
        ans.push_back(2); 
        ans.push_back(3); 
        sum += 5;
        int num = 2;
        for(int x = 4; x < 30000; x++){
            if(N - num == 2) break;
            if(x % 2 != 0 && x % 3 != 0) continue;
            ans.push_back(x);
            sum += x;
            num++;
        }

        int rem = sum % 6;
        if(rem == 0){
            ans.push_back(30000);
            ans.push_back(30000-6);
        }
        else if(rem == 1){
            ans.push_back(30000-3);
            ans.push_back(30000-4);
        }
        else if(rem == 2){
            ans.push_back(30000);
            ans.push_back(30000-2);
        }
        else if(rem == 3){
            ans.push_back(30000);
            ans.push_back(30000-3);
        }
        else if(rem == 4){
            ans.push_back(30000);
            ans.push_back(30000-4);
        }
        else if(rem == 5){
            ans.push_back(30000-3);
            ans.push_back(30000-2);
        }
    }

    for(auto&& x : ans){
        printf("%d ", x);
    }
    printf("\n");

    return 0;
}


Measured memory_bytes: 512
#include<stdio.h>
#include<string.h>
int main(void) {
	int N, B[100], i, j, ans = 0, M[100], A[100];
	for (i = 0; i < 100; i++)M[i] = 0;
	scanf("%d", &N);
	for (i = 0; i < N; i++)scanf("%d", &B[i]);
	for (i = 0; i < N; i++) {
		if (B[i] > i + 1)ans++;
	}
	if (ans)printf("%d\n", -1);
	else {
		for (i = 0; i < N + 1; i++) {
			for (j = N - i - 1; j > -1; j--) {
				if (B[j] == j + 1) {
					M[i] = j + 1;
					break;
				}
			}
			for (j = M[i] - 1; j < N - i - 1; j++) {
				B[j] = B[j + 1];
			}
		}
		for (i = N - 1; i >= 0; i--)printf("%d\n", M[i]);
	}
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <set>

namespace cplib {
    struct UnionFind {
        std::vector<int> par, size;
        
        UnionFind(int n): par(n), size(n) {
            for (int i = 0; i < n; i++) {
                par[i] = i;
                size[i] = 1;
            }
        }

        int root(int i) {
            if (par[i] == i) {
                return i;
            } else {
                par[i] = root(par[i]);
                return par[i];
            }
        }
        bool is_same(int i, int j) {
            return root(i) == root(j);
        }
        void unite(int i, int j) {
            if (!is_same(i, j)) {
                if (size[i] < size[j]) {
                    std::swap(i, j);
                }
                size[root(i)] += size[root(j)];
                par[root(j)] = root(i);
            }
        }
        int get_size(int i) {
            return size[root(i)];
        }
    };
}

int main() {
    int n, m, k;
    std::cin >> n >> m >> k;

    cplib::UnionFind uf(n);
    std::vector<std::set<int>> fr(n), bl(n);
    for (int i = 0; i < m; i++) {
        int a, b;
        std::cin >> a >> b;
        a--;
        b--;
        uf.unite(a, b);
        fr[a].insert(b);
        fr[b].insert(a);
    }
    for (int i = 0; i < k; i++) {
        int c, d;
        std::cin >> c >> d;
        c--;
        d--;
        bl[c].insert(d);
        bl[d].insert(c);
    }

    for (int i = 0; i < n; i++) {
        if (i > 0) {
            std::cout << " ";
        }

        int ans = uf.get_size(i) - fr[i].size() - 1;
        for (int j: bl[i]) {
            if (uf.is_same(i, j)) {
                ans--;
            }
        }

        std::cout << ans;
    }
    std::cout << std::endl;

    return 0;
}


Measured memory_bytes: 29696
#include <iostream>
#include <cmath>
#include <iomanip>

using namespace std;

int main() {
    double a, b, x;
    cin >> a >> b >> x;

    double PI = 3.14159265358979;
    double ans = 0;    
    if (x >= a*a*b/2) {
        ans = atan((2*a*a*b - 2*x)/(a*a*a)) * (180.0f / PI);
    } else {
        ans = atan((a*b*b)/(2*x)) * (180.0f / PI);
    }

    cout << fixed << setprecision(10) << ans << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
	int n,m;
	cin>>n>>m;
	vector<int> w(n),v(n);
	LL dp[102020][2]={};
	FOR(i,0,n)cin>>w[i]>>v[i];
	int idx=0;
	FOR(i,1,100001){
		dp[i][idx]=mod;
	}
	FOR(i,0,n){
		FOR(j,0,102001){
			dp[j][idx^1]=mod;
		}
		FORQ(j,0,100001){
			dp[j+v[i]][idx^1]=min(dp[j+v[i]][idx^1],dp[j][idx]+w[i]);
			dp[j][idx^1]=min(dp[j][idx^1],dp[j][idx]);
		}
		idx^=1;
	}

	LL ans=0;
	FOR(i,0,100001){
		if(dp[i][idx]<=m)ans=max(ans,i*1LL);
	}
	cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int) n; i++)
using ll = long long;
template <class T>
using vt = std::vector<T>;
using vvi = std::vector<vt<int>>;

int main(){
  ll A,B,N;
  std::cin >> A >> B >> N;
  ll ans;
  if(N >= B)
    ans = (ll)A*(B-1)/B;
  else
    ans = A*N/B;

  std::cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 3592
#include<stdio.h>

static const int N = 1000;

void trace(int A[], int n){
  int i;
  for ( i = 1; i <= n; i++ ){
    if ( i > 1 ) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
}

void insertion(int A[],int n){
  int i,j ,v;

  for(i = 1;i<=n;i++){
    v = A[i];
    j = i -1;
  
    while(j >= 0 && A[j] > v){
      A[j+1] = A[j];
      j--;
    }
    A[j+1]=v;
    trace(A,n);
  }
}

int main(){
  int n, i, j;
  int A[N+1];
  scanf("%d", &n);

  for ( i = 1; i <= n; i++ ) scanf("%d", &A[i]);
  
  insertion(A,n);
  
  return 0;
}

Measured memory_bytes: 608
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#define rep(i, n) for (int i = 0; i < n; i++)
#define rep1(i, n) for (int i = 1; i <= n; i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl;

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<long long, long long> pll;

const int INF = 1 << 30;
const long long INFL = 1LL << 62;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 1000;

int main() {
	int x, y, z, k;
	cin >> x >> y >> z >> k;
	ll a[N], b[N], c[N];
	for(int i = 0; i < x; i++) cin >> a[i];
	for(int i = 0; i < y; i++) cin >> b[i];
	for(int i = 0; i < z; i++) cin >> c[i];
	sort(a, a + x, greater<ll>());
	sort(b, b + y, greater<ll>());
	sort(c, c + z, greater<ll>());

	vector<ll> v;
	for(int i = 0; i < x; i++) {
		for(int j = 0; j < y; j++) {
			if((i + 1) * (j + 1) > k) break;
			for(int l = 0; l < z; l++) {
				if((i + 1) * (j + 1) * (l + 1) > k) break;
				v.push_back(a[i] + b[j] + c[l]);
			}
		}
	}

	sort(v.begin(), v.end(), greater<ll>());
	for(int i = 0; i < k; i++) cout << v[i] << endl;
}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>   // popen, pclose, fgets
#include <cstdlib> 
using namespace std;
#define rep0(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける
using vvvi = vector<vvi>;
using ll = long long; //long longをllだけにした
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll =vector<vvll>;
const double PI=3.14159265358979323846;
//小数点以下を指定したい時　　→→→→  cout << fixed << setprecision();
//int→string
//string→int   int num = atoi(numStr.c_str());

int main() {
    string s;cin>>s;
    string year=s.substr(0,4);
    string month=s.substr(5,2);
    string day=s.substr(8,2);
    string kei=year+month+day;
    int k=atoi(kei.c_str());
    if(k>20190430){
        cout<<"TBD"<<endl;
    }
    else{
        cout<<"Heisei"<<endl;
    }
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define ANS cout << ans << endl
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))
#define int long long
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define VIin(a) for(int i=0; i<a.size(); i++) cin >> a[i]
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
/*最大公約数*/int gcd(int x, int y) { return y ? gcd(y,x%y) : x;}
/*最小公倍数*/int LCM(int a, int b) { int g = gcd(a, b); return a / g * b; }
//----------------------------------------------
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n; cin >> n;
    VI v(n); VIin(v);
    VI c(n); VIin(c);
    int value = 0,cost = 0;
    rep(i,n){
        if(v[i] >= c[i]){
            value += v[i];
            cost += c[i];
        }
    }
    cout << value - cost << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll            long long
#define nl            "\n"
#define PB            push_back
#define fi            first
#define se            second
#define _SAD()        ios::sync_with_stdio(0),cin.tie(0), cout.tie(0);
#define rep(i,n)      for(int i=0;i<n;i++)
#define repn(i,n)     for(int i=1;i<=n;i++)
#define rrep(i,n)      for(int i=n-1;i>=0;i--)
#define SZ(s)         s.size()
#define SRT(x,y)      sort(x,x+y)
#define REV(a,b)      reverse(a,a+b)
#define VSRT(x)       sort(x.begin(),x.end())
#define VREV(x)       reverse(x.begin(),x.end())
/*-----------------------------------------------------------------------------------------------*/
const int N = 1e5+10;
int n,k;
string s;
int main()
{
    _SAD()
    cin>>n>>k>>s;
    s[k-1]+=32;
    cout<<s<<nl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define M 1000000007
#define sz(a) (ll)a.size()
#define rep(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define sep(i,a,b) for(ll i=(ll)a;i>=(ll)b;i--)
#define mll map<ll,ll>
#define vl vector<ll>
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pii pair<ll,ll> 
#define mod 1000000007LL
ll pre[100002][2];
ll fact[1000002];
ll inv(ll a,ll b){
   ll res=1;
   while(b){
    if(b%2) res=(res*a)%mod;
    a=(a*a)%mod;
    b/=2;
   }
   return res;
}
ll ncr(ll n,ll r){
  if(r<0 or r>n) return 0;
  return (((fact[n]*inv(fact[r],mod-2))%mod)*inv(fact[n-r],mod-2))%mod;
}
ll dp[100002][13];
int main() {
       ios::sync_with_stdio(false);
       cin.tie(0);
       cout.tie(0);
      string s;
      cin>>s;
      ll i,j,k;
      ll m=1;
      ll rem=0;
      vector<ll> v;
      for(i=sz(s)-1;i>=0;i--){
           if(s[i]!='?')
           rem=(rem+((s[i]-'0')*m)%13)%13;
           else 
           v.pb(m);
           m=(m*10)%13;
      }
      dp[0][rem]=1;
      for(i=1;i<=sz(v);i++){
         for(j=0;j<13;j++){
          for(k=0;k<10;k++)
          dp[i][(j+v[i-1]*k)%13]=(dp[i][(j+v[i-1]*k)%13]+dp[i-1][j])%mod;
         }
      }
      cout<<dp[sz(v)][5];
}


Measured memory_bytes: 11460
/***********************************************
 *                   _ooOoo_                   *
 *                  o8888888o                  *
 *                  88" . "88                  *
 *                  (| -_- |)                  *
 *                  O\  =  /O                  *
 *               ____/`---'\____               *
 *             .'  \\|     |//  `.             *
 *            /  \\|||  :  |||//  \            *
 *           /  _||||| -:- |||||-  \           *
 *           |   | \\\  -   * |    |           *
 *           | \_|  ''\---/''  |   |           *
 *           \  .-\__  `-`  ___/-. /           *
 *         ___`. .'  /--.--\  `. . __          *
 *      ."" '<  `.___\_<|>_/___.'  >'"".       *
 *     | | :  `- \`.;`\ _ /`;.`/ - ` : | |     *
 *     \  \ `-.   \_ __\ /__ _/   .-` /  /     *
 *======`-.____`-.___\_____/___.-`____.-'======*
 *                   `=---='                   *
 *^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

             佛祖保佑       永无BUG

   本程序已经经过开光处理，绝无可能再产生bug
 **********************************************/
#include<algorithm>
#include <iostream>
#include  <cstdlib>
#include  <cstring>
#include   <string>
#include   <vector>
#include   <cstdio>
#include    <queue>
#include    <stack>
#include    <ctime>
#include    <cmath>
#include      <map>
#include      <set>
#define ll long long
#define INF 0x3f3f3f3f
#define pii pair<int,int>
#define mkp(a,b) make_pair(a,b)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define db1(x) cout<<#x<<"="<<(x)<<endl
#define db2(x,y) cout<<#x<<"="<<(x)<<", "<<#y<<"="<<(y)<<endl
#define db3(x,y,z) cout<<#x<<"="<<(x)<<", "<<#y<<"="<<(y)<<", "<<#z<<"="<<(z)<<endl
#define getchar()(p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<22,stdin),p1==p2)?EOF:*p1++)
using namespace std;

char s[100];

int main()
{
    #ifdef test
    freopen("in.txt","r",stdin);
    //freopen("in.txt","w",stdout);
    clock_t start=clock();
    #endif //test

    scanf("%s",s);
    if(s[0]=='S')printf("Cloudy\n");
    else if(s[0]=='C')printf("Rainy\n");
    else printf("Sunny\n");


    #ifdef test
    clockid_t end=clock();
    double endtime=(double)(end-start)/CLOCKS_PER_SEC;
    printf("\n\n\n\n\n");
    cout<<"Total time:"<<endtime<<"s"<<endl;        //s为单位
    cout<<"Total time:"<<endtime*1000<<"ms"<<endl;    //ms为单位
    #endif //test
    return 0;
}


// ━━━━━━神兽出没━━━━━━
//      ┏┓       ┏┓
//     ┏┛┻━━━━━━━┛┻┓
//     ┃           ┃
//     ┃     ━     ┃
//     ????━????   ┃
//     ┃           ┃
//     ┃    ┻      ┃
//     ┃           ┃
//     ┗━┓       ┏━┛
//       ┃       ┃
//       ┃       ┃
//       ┃       ┗━━━┓
//       ┃           ┣┓
//       ┃           ┏┛
//       ┗┓┓┏━━━━━┳┓┏┛
//        ┃┫┫     ┃┫┫
//        ┗┻┛     ┗┻┛
//
// ━━━━━━感觉萌萌哒━━━━━━


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
 
int main(int argc, char* argv[])
{
    long n;
    scanf("%ld", &n);

    long p[10];

    long max = 0;
    long sum = 0;
    long i;
    for(i=0; i<n; i++) {
        scanf("%ld", &(p[i]));

        sum += p[i];
        if(max<p[i]) {
            max = p[i];
        }
    }

    sum -= max / 2;

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

    return 0;
}


Measured memory_bytes: 128
from fractions import gcd
a,b=map(int,input().split())
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append((i, cnt))
    if temp!=1:
        arr.append((temp, 1))

    return arr
arr=factorization(gcd(a,b))
print(1+len(arr))

Measured memory_bytes: 5432
#include<iostream>
#include<cstdio>

using namespace std;

int main(){

	int n; cin >> n;

	int x = n % 10;
	if(x == 2 || x == 4 || x == 5 || x == 7 || x == 9){
		cout << "hon" << endl; 
	}
	else if (x == 0 || x == 1 || x == 6 || x == 8)
	{
		cout << "pon" << endl;
	}
	else if ( x == 3) {
		cout << "bon" << endl;
	}
}

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

#define PI 3.141592653
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define descSort(a) sort(a.begin(),a.end(),std::greater<int>())
using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;
ll gcd(ll x,ll y){
    if(x%y==0)return y;
    return gcd(y,x%y);
}

int main(void){
    int n,m;
    cin>>n>>m;
    vector<ll> h(n);
    rep(i,0,n)cin>>h[i];
    vector<vector<int>> g(n);
    rep(i,0,m){
        int a,b;
        cin>>a>>b;
        a--;b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    int ans=0;
    rep(i,0,n){
        bool tmp=true;
        for(int j=0;j<g[i].size();j++){
            int to=g[i][j];
            if(h[i]<=h[to]){tmp=false;break;}
        }
        ans+=tmp;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 9028
#include <iostream>
#include <string>
#include <math.h>
#include <cmath>
#include <string.h>
#include <cstring>
#include <vector>
#include <map>
#include <unordered_map>
#include <iomanip>
#include <queue>
#include <stack>
#include <algorithm>
#define INF 1000000000
#define rep(i,n) for(int (i) = 0; (i) < (n); (i)++)
#define sove(v) sort((v).begin(),(v).end());
typedef long long int ll;
using namespace std;
int main(){

	int n, r; cin >> n >> r;
	if (n < 10) { cout << r + (100 * (10 - n)) << endl; }
	else { cout << r << endl; }

	return 0;
}

/*#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main(void) {

	int n; cin >> n;
	string s[110];
	string ans;
	for (int i = 0; i < n; i++) { cin >> s[i]; }
	ans += s[0];
	for (int i = 1; i < n; i++) {
		int dabu = 0;
		for (int j = 0; j <= min(ans.size(), s[i].size()); j++) {
			string r, l;
			int mae = ans.size()- j;
			for (int k = 0; k < j; k++) {
				l.push_back(ans[mae + k]);
				r.push_back(s[i][k]);
			}
			cout << l << " "  << r << endl;

			if (l == r) { dabu = j; }
		}
		for (int j = dabu; j < s[i].size(); j++) {
			ans.push_back(s[i][j]);
		}
	}
	cout << ans << endl;

	return 0;
}*/

Measured memory_bytes: 256