akhauriyash/Code-Regression huggingface dataset:
#include <cassert>

#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define Sort(v) sort(all(v))
#define INF 1000000000
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define MP make_pair
#define MOD 1000000007LL;
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};

void printv(vector<int> v){
    rep(i,0,v.size())cout<<v[i]<<" ";
    cout<<endl;
}

int main(){
    string s,t;
    cin>>s>>t;
    vector<int> v(26,0),vv(26,0);
    rep(i,0,s.size())v[s[i]-'a']++;
    rep(i,0,t.size())vv[t[i]-'a']++;
    Sort(v); Sort(vv);
    rep(i,0,26){
        //cout<<v[i]<<" "<<vv[i]<<endl;
        if(v[i]!=vv[i]){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;



    return 0;
}


Measured memory_bytes: 776
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

func readLine(r *bufio.Reader) []byte {
	buf := make([]byte, 0, 1024)
	for {
		l, p, e := r.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return buf
}
func main() {
	r := bufio.NewReaderSize(os.Stdin, 4096)

	var H, W int
	fmt.Scan(&H, &W)
	a := make([]string, H)
	for i := 0; i < H; i++ {
		a[i] = string(readLine(r))
	}
	for x := 0; x < W+2; x++ {
		fmt.Print("#")
	}
	fmt.Println()
	for y := 0; y < H; y++ {
		fmt.Printf("#%s#\n", a[y])
	}
	for x := 0; x < W+2; x++ {
		fmt.Print("#")
	}
	fmt.Println()
}


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

int main() {
    int n, q;
    string s;
    int l[101000];
    int r[101000];
    int p[101000];
    
    cin >> n >> q >> s;
    
    for (int i = 0; i < q; i++) {
        cin >> l[i] >> r[i];
    }
    
    for (int i = 1; i < n; i++) {
        if ((s[i - 1] == 'A') && (s[i] == 'C')) {
            p[i + 1] = p[i] + 1;
        }
        else {
            p[i + 1] = p[i];
        }
    }
    
    for (int i = 0; i < q; i++) {
        cout << (p[r[i]] - p[l[i]]) << endl;
    }
    
    return 0;
}

Measured memory_bytes: 2304
#include <cstdio>
#include <set>
using namespace std;
main(){
	int n,x,y,x1,y1,x2,y2,dx,dy;
	for(;scanf("%d",&n),n;){
	set<pair<int,int> >s;
	for(;n;n--){
		scanf("%d%d",&x,&y);
		s.insert(make_pair(x,y));
	}
	n=0;
	set<pair<int,int> >::iterator it1,it2;
	for(it1=s.begin();it1!=s.end();it1++){
		x1=it1->first,y1=it1->second;
		for(it2=it1,it2++;it2!=s.end();it2++){
			x2=it2->first,y2=it2->second;
			dx=x2-x1,dy=y2-y1;
			if(dx*dx+dy*dy>n&&(
				(s.find(make_pair(x1-dy,y1+dx))!=s.end()&&s.find(make_pair(x2-dy,y2+dx))!=s.end())||
				(s.find(make_pair(x1+dy,y1-dx))!=s.end()&&s.find(make_pair(x2+dy,y2-dx))!=s.end())
			))n=dx*dx+dy*dy;
		}
	}
	printf("%d\n",n);
	}
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1000000007;
string u="abcdefghijklmnopqrstuvwxyz";
map<LL,LL> mp;
stack<LL> st;

int main(){
    int N;
    cin >> N;
    int p[N];
    for(int i=1;i<=N;i++){
        cin >> p[i];
        mp[p[i]]=i;
    }
    int sum=0;
    for(auto p:mp){
        sum+=p.second;
        cout << sum << " ";
    }
    cout << "\n";
    sum=0;
    for(auto p=mp.rbegin();p!=mp.rend();p++){
        sum+=p->second;
        st.push(sum);
    }
    while(st.size()!=0){
        cout << st.top() <<" ";
        st.pop();
    }
    cout << "\n";
    return 0;
}

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

typedef long long ll;
typedef long double ld;



int main(){
	ios::sync_with_stdio(false);
    cin.tie(0);
    ll n;
    cin >> n;
    ll arr[n];
    ll i;
    for(i=0;i<n;i++)
        cin >> arr[i];
    ll score[n]={0};
    score[0]=0;
    score[1]=abs(arr[1]-arr[0]);
    for(i=2;i<n;i++){
        score[i] = min(score[i-1]+abs(arr[i]-arr[i-1]), score[i-2] + abs(arr[i]-arr[i-2]));
    }
    cout << score[n-1] << "\n";

}


Measured memory_bytes: 5120
#include<iostream>
#include<algorithm>
#include<cmath>
#include<set>
#include<numeric>
#include<vector>

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

int retketasum(ll K) {
	int ans = 0;
	while (K > 0) {
		ans += (K % 10);
		K /= 10;
	}
	return ans;
}

int main() {

	int K;
	cin >> K;
	set<ll> ans;
	vector<P> destination;
	
	for (int i = 0; i < 9; i++)ans.insert(i + 1), destination.push_back(P(i + 1, 1));
	
	//A=(p)999999 9を最後尾でn個含む
	for (int n = 13; n >= 1; n--){ 
		int limit_p = 1;
		for (; limit_p <= min(9 * n + (ll)(9 * (log10(limit_p) + 1)) - 1,
			(ll)(pow(10, 15 - n) - 1)); limit_p++);

		limit_p--;
		//nごとのpの限界値を調べた

		for (; limit_p >= 1; limit_p--) {
			double tmp = (double)(pow(10, n) - 1 + limit_p * pow(10, n)) /
				(double)(9.0 * n + retketasum(limit_p));
			if (destination.size() == 9) {
				ans.insert(pow(10, n) - 1 + pow(10, n) * limit_p);
				destination.push_back(P(pow(10, n) - 1 + pow(10, n) * limit_p, tmp));
				continue;
			}
			auto tmp_find = lower_bound(destination.begin(), destination.end(),
				P(pow(10, n) - 1 + pow(10, n) * limit_p, 0));

			if (tmp_find == destination.end())tmp_find = --destination.end();

			if ((*tmp_find).second >= tmp) {

				//cout << "number = " << pow(10, n) - 1 + pow(10, n) * limit_p << endl;
				//cout << "raito = " << tmp << endl;

				ans.insert(pow(10, n) - 1 + pow(10, n) * limit_p);
				destination.push_back(P(pow(10, n) - 1 + pow(10, n) * limit_p, tmp));
				sort(destination.begin(), destination.end());
			}
		}
	}
	auto itr = ans.begin();
	for (int i = 0; i < K; i++) {
		cout << *itr << endl;
		itr++;
	}
	return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <string>

int main()
{
	char in = 0;
	char boin[] = "aiueo";
	std::string out = "consonant";

	scanf( "%c", &in );

	for (auto& work : boin)
	{
		if (work == in)
		{
			out = "vowel";
			break;
		}
	}

	printf( "%s", out.c_str() );

	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define MOD (1000000007)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()

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; }

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

const ll INF = 1LL << 60;

int main(){
  int n; cin >> n;
  vi a(n); rep(i, n) cin >> a[i];

  ll ans = 0;
  rep(i, n){
    if(i == n-1) ans += a[i]/2;
    else{
      if(a[i]%2 == 1 && a[i+1] >= 1){
        a[i]++; a[i+1]--;
      }
      ans += a[i]/2;
    }
  }
  std::cout << ans << '\n';
}


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

namespace contest_Csharp
{
    class Program
    {
        static long power(long a, long b, long modulo)
        {
            long result = 1;
            long buff = a;
            for (long i = 1; i <= b; i *= 2)
            {
                result = result * ((b / i % (2) == 1) ? buff : 1) % modulo;
                buff = (buff * buff) % modulo;
            }
            return result % modulo;
        }
        
        static void Main(string[] args)
        {
            var vals = Console.ReadLine().Split(' ')
                .Select(x => double.Parse(x)).ToList();
            var A = vals[0];
            var B = vals[1];
            var H = vals[2];
            var M = vals[3];
            double x = A * Math.Cos(2 * Math.PI * (H / 12 + M / 12 / 60))
                - B * Math.Cos(2 * Math.PI * (M / 60));
            double y = A * Math.Sin(2 * Math.PI * (H / 12 + M / 12 / 60))
                - B * Math.Sin(2 * Math.PI * (M / 60));
            double ans =Math.Sqrt(x*x+y*y);

            
            
            Console.WriteLine(ans.ToString("F12"));
        }



    }
    class PriorityQueue<T> where T : IComparable<T>
    {
        private List<T> heap = new List<T>();
        private int lastindex = -1;
        private void swap(int n, int m)
        {
            T wait = heap[n];
            heap[n] = heap[m];
            heap[m] = wait;
        }
        public int Count()
        {
            return lastindex + 1;
        }
        public void Enqueue(T data)
        {
            int p;
            if (lastindex + 1 < heap.Count())
            {
                heap[lastindex + 1] = data;
            }
            else
            {
                heap.Add(data);
            }
            lastindex++;
            p = lastindex;

            while (true)
            {
                if (p > 0 && heap[p].CompareTo(heap[(p - 1) / 2]) <= -1)
                {
                    swap(p, (p - 1) / 2);
                    p = (p - 1) / 2;
                }
                else
                {
                    break;
                }
            }
        }
        public T Peek()
        {
            return heap[0];
        }
        public T Dequeue()
        {
            T result = Peek();
            heap[0] = default(T);
            swap(0, lastindex);
            lastindex--;
            int p = 0;
            while (true)
            {
                int np;
                if (2 * p + 1 > lastindex)
                {
                    break;
                }
                else
                {
                    np = ((2 * p + 1 == lastindex) || heap[2 * p + 1].CompareTo(heap[2 * p + 2]) <= -1)
                        ? (2 * p + 1) : (2 * p + 2);
                }
                if (heap[p].CompareTo(heap[np]) >= 1)
                {
                    swap(p, np);
                    p = np;
                }
                else
                {
                    break;
                }
            }

            return result;
        }





    }
}


Measured memory_bytes: 28716
#include <algorithm>
#include <iostream>
#include <stdio.h>
#include <string>

using namespace std;

int main() {
  int N, A, B, C, D;
  string S;
  cin >> N >> A >> B >> C >> D >> S;
  A = A - 1;
  B = B - 1;
  C = C - 1;
  D = D - 1;
  if (C < D) {
    int i = A;
    while (i < C) {
      while (i < C && S[i] == '.') {
        ++i;
      }
      int _cnt_r = 0;
      while (i < C && S[i] == '#') {
        ++i;
        ++_cnt_r;
      }
      if (_cnt_r > 1) {
        printf("No\n");
        return 0;
      }
    }
    i = B;
    while (i < D) {
      while (i < D && S[i] == '.') {
        ++i;
      }
      int _cnt_r = 0;
      while (i < D && S[i] == '#') {
        ++i;
        ++_cnt_r;
      }
      if (_cnt_r > 1) {
        printf("No\n");
        return 0;
      }
    }
    printf("Yes\n");
  } else {
    int i = B - 1;
    int cnt_s = 0;
    while (i <= D + 1) {
      int _cnt_s = 0;
      while (i <= D + 1 && S[i] == '.') {
        ++i;
        ++_cnt_s;
      }
      cnt_s = max(cnt_s, _cnt_s);
      int _cnt_r = 0;
      while (i <= D + 1 && S[i] == '#') {
        ++i;
        ++_cnt_r;
      }
      if (_cnt_r > 1) {
        printf("No\n");
        return 0;
      }
    }
    if (cnt_s <= 2) {
      printf("No\n");
      return 0;
    }
    i = A;
    while (i < C) {
      while (i < C && S[i] == '.') {
        ++i;
      }
      int _cnt_r = 0;
      while (i < C && S[i] == '#') {
        ++i;
        ++_cnt_r;
      }
      if (_cnt_r > 1) {
        printf("No\n");
        return 0;
      }
    }
    printf("Yes\n");
  }
}

Measured memory_bytes: 3196
import sys


def main():
    input = sys.stdin.buffer.readline
    n, W = map(int, input().split())
    v = [0] * (n + 1)
    w = [0] * (n + 1)
    for i in range(1, n + 1):
        v_i, w_i = map(int, input().split())
        v[i], w[i] = v_i, w_i
    # dp[i][j]:=i個目までの品物から重さの総和がj以下になるように選ぶときの，価値の合計の最大理
    dp = [[0] * (W + 1) for _ in range(n + 1)]
    for i in range(1, n + 1):
        for j in range(W + 1):
            if j - w[i] >= 0:
                dp[i][j] = max(dp[i - 1][j], dp[i][j - w[i]] + v[i])
            else:
                dp[i][j] = dp[i - 1][j]
    print(dp[n][W])


if __name__ == "__main__":
    main()



Measured memory_bytes: 15680
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
const ll mod = 1e9 + 7;

const int N = 100010;
string s[N];

struct trie {
  trie *next[26];
  int chcnt;
  int len;
  int cnt;
  int occ;
  trie() {
    chcnt = 0;
    len = 1;
    cnt = 0;
    occ = 0;
    REP(i, 0, 26) {
      next[i] = NULL;
    }
  }
  void compact() {
    if (chcnt == 1 && !occ) {
      // compact
      int ch = -1;
      REP(i, 0, 26) {
	if (next[i]) {
	  ch = i;
	}
      }
      assert (ch >= 0);
      next[ch]->compact();
      trie *tmp = next[ch];
      chcnt = tmp->chcnt;
      len = tmp->len + 1;
      assert (cnt == tmp->cnt);
      occ = tmp->occ;
      REP(i, 0, 26) {
	next[i] = tmp->next[i];
      }
      return;
    }
    REP(i, 0, 26) {
      if (next[i]) {
	next[i]->compact();
      }
    }
  }
  void add(const string &s, int idx) {
    if (idx >= s.length()) {
      cnt++;
      occ = 1;
      return;
    }
    int ch = s[idx] - 'a';
    if (next[ch] == NULL) {
      next[ch] = new trie;
      chcnt++;
    }    
    next[ch]->add(s, idx + 1);
    cnt++;
  }
  void dump(int lv = 0) {
    if (occ) {
      REP(j, 0, lv) {
	cout << "-";
      }
      REP(j, 0, len - 1) {
	cout << "=";
      }
      cout << "*" << endl;
    }
    REP(i, 0, 26) {
      if (next[i]) {
	REP(j, 0, lv) {
	  cout << "-";
	}
	REP(j, 0, len - 1) {
	  cout << "=";
	}
	cout << (char)('a' + i) << endl;
	next[i]->dump(lv + len);
      }
    }
  }
  int calc(const VI &perm, const VI &invp, const string &s, int idx) {
    int sum = 0;
    if (idx + len - 1 >= s.length()) {
      assert (occ);
      return 0;
    }
    int pc = perm[s[idx + len - 1] - 'a'];
    REP(i, 0, pc) {
      if (next[invp[i]]) {
	sum += next[invp[i]]->cnt;
      }
    }
    sum += next[s[idx + len - 1] - 'a']->calc(perm, invp, s, idx + len);
    return sum + occ;
  }
};

int main(void){
  int n;
  cin >> n;
  trie t;
  REP(i, 0, n) {
    cin >> s[i];
    t.add(s[i], 0);
  }
  t.compact();
  int q;
  cin >> q;
  REP(loop_cnt, 0, q) {
    int k;
    cin >> k;
    k--;
    string perm;
    cin >> perm;
    assert (perm.length() == 26);
    VI p(26), invp(26);
    REP(i, 0, 26) {
      p[perm[i] - 'a'] = i;
      invp[i] = perm[i] - 'a';
    }
    cout << t.calc(p, invp, s[k], 0) + 1 << endl;
  }
}


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

int n,cnt,x,y,nw,hd[100010];
long long sA,sB,sum,ans;
pair<int,int> A[200010];

int main()
{
	scanf("%d",&n),sA=sB=0,cnt=0;
	for (int i=1; i<=n; i++) 
	{
		scanf("%d%d",&x,&y),sA+=x,sB+=y;
		A[++cnt]=make_pair(x,i);
		A[++cnt]=make_pair(y,i);
	}
	sum=0,ans=min(sA,sB);
	sort(A+1,A+1+cnt),nw=0;
	memset(hd,0,sizeof(hd));
	for (int i=1; i<=n; i++)
	{
		if (!hd[A[i].second]) hd[A[i].second]=i,nw++;
		sum+=A[i].first;
	}
	if (nw==n)
	{
		for (int i=n+1; i<=2*n; i++)
			if (A[i].second==A[n].second) ans=min(ans,sum-A[n-1].first+A[i].first);
			else ans=min(ans,sum-A[n].first+A[i].first);
	} else ans=min(ans,sum);
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 2176
#include <iostream>

using namespace std;

int main(int argc, char const *argv[]) {
  long long int a, b;
  cin >> a >> b;
  long long int height[999];
  height[0] = 1;
  for (size_t i = 1; i < 999; i++) height[i] = height[i-1] + (i+1);
  long long int ans = 0;
  ans = height[b-a-1] - b;
  cout << ans << endl;
  return 0;
}


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

int main() {

    string s;
    cin >> s;

    rep(i, s.size())
    {
        cout<<'x';
    }

    return 0;
}


Measured memory_bytes: 256
using System;

public class my
{
	public static void Main()
	{
		var n = my.GetInt();
		var dept = 100000.0;
		
		for(int i = 0; i < n; i++) {
			dept *= 1.05;
			dept /= 1000.0;
			dept = Math.Ceiling(dept);
			dept *= 1000.0;
		}
		
		Console.WriteLine((long)dept);
	}
	
	private static int GetInt()
	{
		return int.Parse(Console.ReadLine());
	}
}

Measured memory_bytes: 9088
#include<bits/stdc++.h>
using namespace std;
int main(){
int one = 0,two = 0,th = 0,fr = 0;
  int a,b;
  for(int i = 0; i < 3; i++){
  	cin>>a>>b;
    if(a == 1) one++;
    if(a == 2) two++;
    if(a == 3) th++;
    if(a  == 4) fr++;
    
      if(b == 1) one++;
    if(b == 2) two++;
    if(b == 3) th++;
    if(b  == 4) fr++;
  }
  if(one > 2 || two > 2 || th > 2 || fr > 2){
    cout<<"NO"<<"\n";
    return 0;
  }
  
  
  
  cout<<"YES"<<"\n";
  return 0;
}

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

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(), (x).end()

using namespace std;

template <typename T> T &chmin(T a, const T &b) {return a = min(a, b);}
template <typename T> T &chmax(T a, const T &b) {return a = max(a, b);}

using ll = long long;
using ld = long double;

int W, H;
string mass[75][75];
string res[70][70];

bool f(const string &a, const string &b){
	if(a.size() != b.size()) return a.size() > b.size();
	REP(i, a.size()) if(a[i] != b[i]) return a[i] > b[i];
	return false;
}

string dfs(int h, int w){
	if(res[h][w] != "") return res[h][w];
	if(mass[h][w] == "*") return res[h][w] = "";
	if(mass[h+1][w] == "*" and mass[h][w+1] == "*") return res[h][w] = mass[h][w];
	if(mass[h+1][w] == "*") return res[h][w] = mass[h][w].append(dfs(h, w+1));
	if(mass[h][w+1] == "*") return res[h][w] = mass[h][w].append(dfs(h+1, w));
	string str1 = dfs(h+1, w); string str2 = dfs(h, w+1);
	if(f(str1, str2)) return res[h][w] = mass[h][w].append(str1);
	return res[h][w] = mass[h][w].append(str2);
}

int main(){
	while(cin >> W >> H and W + H){
		REP(i, 75) REP(j, 75) mass[i][j] = "*";
		REP(i, 70) REP(j, 70) res[i][j] = "";
		REP(i, H){
			string tmp; cin >> tmp;
			REP(j, W) mass[i][j] = ('0' <= tmp[j] and tmp[j] <= '9' ? string(&tmp[j], 1) : "*");
		}
		vector<string> strs;
		REP(i, H) REP(j, W) dfs(i, j);

		REP(i, 70) REP(j, 70){
			int fr = 0;
			while(fr < res[i][j].size() and res[i][j][fr] == '0') fr++;
			if(fr == res[i][j].size()) continue;
			strs.push_back(res[i][j].substr(fr, res[i][j].size() - fr));
		}
		sort(ALL(strs), f);
		cout << strs[0] << endl;
	}
	return 0;
}

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

using namespace std;

int main()
{
	int N;
	cin >> N;
	
	vector<double> a; a.reserve(N);
	
	copy_n(istream_iterator<double>(cin), N, back_inserter(a));
	double total = 0;
	for (auto x : a)
		total += 1/x;
	cout << setprecision(5) << fixed << 1/total << '\n';
}


Measured memory_bytes: 256
N,M,X,Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
xr = max(x)
yl = min(y)

for i in range(X+1,Y+1):
    if(xr < i <= yl):
        print('No War')
        exit()

print('War')

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << setprecision(20) << fixed;

  int K;
  cin >> K;
  int A, B;
  cin >> A >> B;
  for(int i = A; i <= B; i++){
    if(i % K == 0){
      cout << "OK" <<endl;
      return 0;
    }
  }
  cout << "NG" <<endl;
}

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

int main() {

	int a, b, c, x;
	cin >> a >> b >> c >> x;

	int res = 0;
	for (int i = 0; i <= a; i++) {
		for (int j = 0; j <= b; j++) {
			for (int k = 0; k <= c; k++) {
				int sum = i * 500 + j * 100 + k * 50;
				if (sum == x) {
					res++;
				}
			}
		}
	}
	cout << res << endl;
}

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

namespace AtCoder
{
    class Program
    {

        static void Main()
        {

            //ここまで
            int[] str = ReadLineToIntArray();
            int N = str[0];
            int M = str[1];

            List<bool> A = new List<bool>();
            for(int i = 0; i < M; i++)
            {
                A.Add(true);
            }

            for(int i = 0; i < N; i++)
            {
                List<int> temp = ReadLineToIntList();
                temp.RemoveAt(0);
                for(int j = 0; j < M; j++)
                {
                    if (!temp.Any(t => t == j+1))
                    {
                        A[j] = false;
                    }
                }
            }

            int ans = A.Where(a => a == true).Count();

            Console.WriteLine(ans);
            Console.ReadKey();
        }


        static public void Swap<T>(ref T a,ref T b) { T temp = a;a = b;b = temp; }
        static public long GCD(int a, int b){ return b != 0 ? GCD(b, a % b) : a;}
        static public long LCM(int a, int b){ return (long)a * b / GCD(a, b); }



        
        static public string ReadLineToString(){return Console.ReadLine();}
        static public int ReadLineToInt(){return int.Parse(Console.ReadLine());}
        static public long ReadLineToLong() { return long.Parse(Console.ReadLine()); }
        static public string[] ReadLineToStringArray(){return Console.ReadLine().Split(' ').ToArray();}
        static public int[] ReadLineToIntArray(){return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();}
        static public long[] ReadLineToLongArray() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
        static public List<string> ReadLineToStringList(){return Console.ReadLine().Split(' ').ToList();}
        static public List<int> ReadLineToIntList(){return Console.ReadLine().Split(' ').Select(int.Parse).ToList();}
        static public List<long> ReadLineToLongList() { return Console.ReadLine().Split(' ').Select(long.Parse).ToList(); }



    }
}


Measured memory_bytes: 13652
#include<stdio.h>
int main()
{
    int c=0;
    char a[10][10];
    for(int i=0; i<2; i++)
    {
        for(int j=0; j<3; j++)
        {
            scanf(" %c",&a[i][j]);
        }
    }
    if(a[0][0]==a[1][2])
        c++;
    if(a[0][1]==a[1][1])
        c++;
    if(a[0][2]==a[1][0])
        c++;
    if(c==3)
        printf("YES\n");
    else
        printf("NO\n");
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cmath>

using namespace std;

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

    int count = 0;
    for (int i = 0; i < N; i++) {
        if (s[i] == 'R') {
            count++;
        } else {
            count--;
        }
    }
    if (count > 0) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

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

#define MP make_pair
#define PB push_back
#define ALL(x)  (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define RANGEBOX(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
#define RANGE(x, l, r) ((l) <= (x) && (x) <= (r))
#define rep(i, N)  for (int i = 0; i < (int)(N); i++)
#define rrep(i, N) for (int i = N - 1; i >= 0; i--)
#define REP(i, init, N)  for (int i = (init); i < (int)(N); i++)
#define RREP(i, N, last) for (int i = (init - 1); i >= last; i--)
#define PB push_back

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVi;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int    INF  = 0x3f3f3f3f;
const LL     INFL = 0x3f3f3f3f3f3f3f3fLL;
const double DINF = 0x3f3f3f3f;

int main(){
	ios::sync_with_stdio(false);
    string s;
    int K;
    cin>>s>>K;
    int i=0;
    while(i<s.size()){
        if(s[i] == 'a')
            i++;
        else{
            if('z'-s[i]<K){
                K=K-('z'-s[i]+1);
                s[i]='a';
                // if(s[i] == 'z'){
                //     s[i] = 'a';
                //     K--;
                //     i++;
                // }
                // else{
                //     s[i]=(char)(s[i]+1);
                //     K--;
                // }

            }
            else{
                i++;
            }
        }
    }
    i=0;
    K=K%26;
    while(i<K){
        if(s[i] == 'z'){
            s[i] = 'a';
            i++;
        }
        else{
            s[s.size()-1]=(char)(s[s.size()-1]+1);
            i++;
        }
    }
    cout<<s<<endl;

    return 0;
}


Measured memory_bytes: 592
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		int a = 0;
		int b = 0;

		Scanner sc = new Scanner(System.in);
		a = sc.nextInt();
		b = sc.nextInt();

		boolean aFlag = false;

		if (a < b) {
			aFlag = true;
		} else {
			aFlag = false;
		}

		if (aFlag) {
			for (int i = 0; i < b; i++) {
				System.out.print(a);
			}
		} else {
			for (int i = 0; i < a; i++) {
				System.out.print(b);
			}
		}

	}

}


Measured memory_bytes: 21204
#152_D
n = int(input())
dp = [[0 for _ in range(10)] for _ in range(10)]
for i in range(1, n+1):
    s = str(i)
    dp[int(s[0])][int(s[-1])] += 1
    
ans = 0
for i in range(1, 10):
    for j in range(i, 10):
        if i == j:
            ans += dp[i][j] * dp[j][i]
        else:
            ans += 2 * dp[i][j] * dp[j][i]
print(ans)

Measured memory_bytes: 3064
N=int(input())
a1=list(map(int, input().split()))
a2=list(map(int, input().split()))

maxc=0

for i in range(N):
    c=0
    for j in range(i+1):
        c+=a1[j]
    for j in range(i,N):
        c+=a2[j]
    maxc=max(maxc,c)
    
print(maxc)

Measured memory_bytes: 3060
# coding: utf-8
import sys
# from operator import itemgetter
sysread = sys.stdin.readline
read = sys.stdin.read
sys.setrecursionlimit(10 ** 7)
from heapq import heappop, heappush
#from collections import OrderedDict, defaultdict
#import math
#from itertools import product, accumulate, combinations, product
#import bisect# lower_bound etc
#import numpy as np
#from copy import deepcopy
#from collections import deque
#import numba

def sum_between(a, b):
    if a > b:a, b = b, a
    return (b-a+1) * (b+a) // 2

def run():
    N = int(input())
    n_dots = 0
    for i in range(1, N+1):
        n_dots += (1+i) * i // 2
    #print(n_dots)
    ans = (N-1) * (N+1) * N // 2
    #print(ans)
    for i in range(N-1):
        u, v = map(int, input().split())
        l, r = min(u, v), max(u, v)
        tmp = 0
        if l > 1: tmp += sum_between(r-1, r-l+1)
        tmp += r-l
        tmp += sum_between(N-l, 1)
        #print(tmp)
        ans -= tmp

    print(n_dots - ans)


    ans = (N-1) * N * N


if __name__ == "__main__":
    run()

Measured memory_bytes: 9004
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>    // bitset
#include <deque>     // deque
#include <iomanip>   //setprecsion
#include <iostream>  // cout, endl, cin
#include <map>       // map
#include <queue>     // queue, priority_queue
#include <set>       // set
#include <stack>     // stack
#include <string>    // string, to_string, stoi
#include <tuple>     // tuple, make_tuple
#include <utility>   // pair, make_pair
#include <vector>    // vector

#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>  //sin, cos, tan

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define mt(p, q, r) make_tuple(p, q, r)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<ll> vll;
typedef vector<ld> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<vector<ll>> vvll;
typedef vector<vector<ld>> vvd;
typedef vector<vector<bool>> vvb;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;
typedef vector<pair<ll, ll>> vpll;
typedef vector<tuple<ll, ll, ll>> vtlll;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

template <typename T>
void fin(T a)
{
  cout << a << endl;
  exit(0);
}

void Main()
{
  ll x; cin >> x;
  for(ll i = 0;i <= 1000;i++)
  {
    for(ll j = 0;j <= 1000;j++)
    {
      if(i * i * i * i * i + j * j * j * j * j == x)
      {
        cout << i << " -" << j << endl;
        return;
      }
      if(i * i * i * i * i - j * j * j * j * j == x)
      {
        cout << i << " " << j << endl;
        return;
      }
    }
  }
}

//前処理
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  //cout << setfill('0') << internal << setw(4); 0埋め４桁
  Main();
  return 0;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define erep(i, n) for (ll i = 0; i <= (ll)(n); ++i)
#define FOR(i,a,b) for (ll i = (a); i < (ll)(b); ++i)
#define EFOR(i,a,b) for (ll i = (a); i <= (ll)(b); ++i)

typedef pair<int, int> P;

bool check(vector<P> v) {
    int h = 0;
    for (P p : v) {
        int b = h+p.first;
        if(b < 0) return false;
        h += p.second;
    }
    return true;
}


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

    // 最下層がkey, 最終的な層の位置がval
    vector<P> ls, rs;

    int sum = 0;
    rep(_, n) {
        string s; cin >> s;
        int h = 0, b = 0;
        for(char c : s) {
            if(c == '(') ++h; else --h;
            b = min(b, h);
        }
        sum += h;
        if(h > 0) ls.emplace_back(b, h);
        else rs.emplace_back(b-h, -h);
    }
    sort(ls.rbegin(), ls.rend());
    sort(rs.rbegin(), rs.rend());

    if(check(ls) && check(rs) && sum == 0) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;

}



Measured memory_bytes: 18748
#include<iostream>
#include<map>
#include<algorithm>
#include <iomanip>
#include <cmath>
#include <sstream>
#include <unordered_map>
#include <unordered_set>
#include <deque>
#include <vector>
#include <bitset>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <cstring>

using namespace std;

int main() {

	int n, q; cin >> n >> q;

	string s; cin >> s;

	int a[s.size()];
	memset(a, 0, sizeof(a));

	for (int i = 0; i < s.size() - 1; i++) {
		if (s[i] == 'A') {
			if (s[i + 1] == 'C') {
				a[i + 1] += 1;
			}
		}
	}

	for (int i = 0; i < s.size() - 1; i++) {
		a[i + 1] = a[i] + a[i + 1];
	}

	for (int i = 0; i < q; i++) {
		int l, r; cin >> l >> r;

		cout << a[r - 1] - a[l - 1] << endl;
	}



}

Measured memory_bytes: 1408
a,b,m = map(int,input().split())
a_li = list(map(int,input().split()))
b_li = list(map(int,input().split()))
x_li=[list(map(int,input().split())) for _ in range(m)]
minprice = min(a_li) + min(b_li)
for i in x_li:
    price = a_li[i[0]-1] + b_li[i[1]-1] - i[2]
    minprice = min(minprice,price)
print(minprice)

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

using namespace std;

int n;
tuple<int,int,int> query[100000];

int main() {
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
        scanf("%d%d%d", &get<0>(query[i]), &get<1>(query[i]), &get<2>(query[i]));
    sort(query, query + n);

    int t = 0, x = 0, y = 0;
    bool can = 1;
    for (int i = 0; i < n && can; i++) {
        int a,b,c; tie(a,b,c) = query[i];
        int dist = abs(b - x) + abs(c - y);
        if (dist > a - t)
            can = 0;
        else
            can = ((a - t) - dist) % 2 == 0;
    }
    if (can) printf("Yes\n");
    else printf("No\n");

    return 0;
}

Measured memory_bytes: 1408
#include <stdio.h>

int main(){
	int m,mo,year,n,ri,te,smone;
	int A,B,Z,R;
	double nenri;
	int i,j,k,l;
	int max,mn;

	scanf("%d",&m);
	for(i=0; i<m; i++){
		scanf("%d %d %d",&smone,&year,&n);
		max=0;
		for(j=0; j<n; j++){
			scanf("%d %lf %d",&ri,&nenri,&te);
			A=smone;
			if(ri==1){
				for(k=0; k<year; k++){
					B=A*nenri;
					A+=B;
					A-=te;
				}
			}
			if(ri==0){
				R=0;
				for(k=0; k<year; k++){
					B=A*nenri;
					R+=B;
					A-=te;
					//printf("i:%d j:%d k:%d A:%d B:%d R:%d\n",i,j,k,A,B,R);
				}
				A+=R;
			}
			if(max<A){
				max=A;
				mn=j;
			}
		}
		printf("%d\n",max);
	}

	return 0;
}

Measured memory_bytes: 628
import java.util.*;
public class Main {
    public static void main(String[] args){
      // 入力
      Scanner sc = new Scanner(System.in);
      int X = sc.nextInt();
      
      // 算出
      int K = 1;
      int deg = X;
      while(deg % 360 != 0){
        deg += X;
        K++;
      }
      
      // 出力
      System.out.println(K);
    }

}

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

namespace CSharp_practice
{
    class Program
    {
        static void Main(string[] args)
        {
            int max = 700000;
            int mod = 1000000007;
            long[] fac = new long[max];
            long[] finv = new long[max];
            long[] inv = new long[max];

            long[] input = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
            long x = input[0];
            long y = input[1];

            if ((x + y) % 3 != 0)
            {
                Console.WriteLine(0);
            }
            else
            {
                long m = (2 * x - y) / 3;
                long n = (2 * y - x) / 3;
                COMinit(max, mod, fac, finv, inv);
                Console.WriteLine(COM(mod, fac, finv, inv, m + n, n));
            }
        }

        static void COMinit(int max, int mod, long[] fac, long[] finv, long[] inv)
        {
            fac[0] = fac[1] = 1;
            finv[0] = finv[1] = 1;
            inv[1] = 1;
            for (int i = 2; i < max; i++)
            {
                fac[i] = fac[i - 1] * i % mod;
                inv[i] = mod - inv[mod % i] * (mod / i) % mod;
                finv[i] = finv[i - 1] * inv[i] % mod;
            }
        }

        static long COM(int mod, long[] fac, long[] finv, long[] inv, long n, long k)
        {
            if (n < k) return 0;
            if (n < 0 || k < 0) return 0;
            return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
        }
    }
}


Measured memory_bytes: 29536
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define X first
#define Y second
#define mkp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<", ";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}
template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;

const ll MAXn=1e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=0x3f3f3f3f;

typedef pair<pair<string,ll>,ll> iii;
vector<iii> v;
int main(){
    IOS();
    ll n;
    cin >> n;
    REP (i,n) {
        string s;
        ll x;
        cin >> s >> x;
        v.eb(pair<string,ll>(s,-x),i+1);
    }
    sort(ALL(v));
    REP (i,n) cout << v[i].Y << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define li long long int
#define vll vector<ll>
using namespace std;

void solve()
{
  li n;
  cin>>n;

  vector<li> v(n);

  long double aa = 1e18;

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

  sort(v.begin(),v.end());
  
  li prod = v[0];
  
  if(prod==0)
  {
    cout<<0<<endl;
    return;
  }
  for(li i=1;i<n;i++)
  {
    li ele = v[i];
    long double temp = aa/prod;
    if(ele<=temp)
      prod*=ele;
    else
    {
      cout<<-1<<endl;
      return;
    }
  }

  cout<<prod<<endl;
}

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

Measured memory_bytes: 4052
/* Author rumoisen */
/* created 2018/10/24 */

#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <cmath>
#include <iomanip>
#include <numeric>
#include <cmath>
 
using namespace std;
 
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define INF (ll)1e18
#define MOD (ll)1e9 + 7
#define pb push_back

void no(){cout<<"No"<<endl;exit(0);}
void yes(){cout<<"Yes"<<endl;exit(0);}
void No(){cout<<"NO"<<endl;exit(0);}
void Yes(){cout<<"YES"<<endl;exit(0);}

typedef long long ll;
typedef long long int llt;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

using namespace std;

int ketasu(long long int n)
{
    int a=0;
    while(n>0){
        a++;
        n/=10;
    }
    return a;
}
int main()
{
    string s;
    cin>>s;
    if(s.size()==2) cout<<s<<endl;
    else{
        reverse(s.begin(),s.end());
        cout<<s<<endl;
    }
    return 0;
}

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

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

	const string acgt = "ACGT";
	int ans = 0;
	int d = 0;
	for (int i = 0; i < (int)S.size(); i++) {
		if (find(acgt.begin(), acgt.end(), S[i]) == acgt.end()) {
			d = 0;
		}
		else
			d++;

		ans = max(ans, d);
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <list>

using ll = long long;
using ld = long double;
using namespace std;
const int INF = 1e9+100;
const ll INF64 = 7e18l;
const int mod = 1000000007;
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(), (a).end()
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

bool primejudge(long long a){
    if(a <= 1) return false;
    for(long long i = 2; i * i <= a; i++){
        if(a % i == 0) return false;
    }
    return true;
}


int main(){
    FIN;
    int q; cin >> q;
    vector<int> sum(100001,0);
    int cur = 0;
    for(int i=3;i<=100000;i+=2){
        bool a = primejudge(i);
        bool b = primejudge((i+1)/2);
        if(a and b) cur++;
        sum[i] = cur;
    }

    for(int i=0;i<q;i++){
        int l,r; cin >> l >> r;
        int flag = 0;
        bool a = primejudge(l);
        bool b = primejudge((l+1)/2);
        if(a and b) flag++;
        cout << sum[r] - sum[l] + flag << endl;
    }


    return 0;
}


Measured memory_bytes: 3724
import sys


def solve():
    step = input()
    
    for i in range(len(step)):
        if i % 2 == 0:
            if step[i] != 'R' and step[i] != 'U' and step[i] != 'D':
                print('No')
                sys.exit()
        else:
            if step[i] != 'L' and step[i] != 'U' and step[i] != 'D':
                print('No')
                sys.exit()
    
    print('Yes')


if __name__ == '__main__':
    solve()

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <string>
#include <map>

using namespace std;

int main() {
	int num;
	char blood[2];
	char row[1000];
	map<string, int> type;
	//type.insert(make_pair("A", 0));
	//type.insert(make_pair("B", 0));
	//type.insert(make_pair("O", 0));
	//type.insert(make_pair("AB", 0));
	while(cin>>row){
		if(cin.eof()) break;
		sscanf(row,"%d,%s", &num, &blood);
		type[blood]++;
	}
	cout<<type["A"]<<endl;
	cout<<type["B"]<<endl;
	cout<<type["AB"]<<endl;
	cout<<type["O"]<<endl;
	return 0;
}

Measured memory_bytes: 1252
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
using namespace std;
int main(){
    string s;
    while(cin>>s){
        int len=s.size();
        if(len<5||len>9) printf("NO\n");
        else{
            if(s=="KIHBR") printf("YES\n");
            else if(s=="AKIHBR") printf("YES\n");
            else if(s=="AKIHABR") printf("YES\n");
            else if(s=="AKIHBAR") printf("YES\n");
            else if(s=="AKIHBRA") printf("YES\n");
            else if(s=="AKIHABAR") printf("YES\n");
            else if(s=="AKIHABRA") printf("YES\n");
            else if(s=="AKIHBARA") printf("YES\n");
            else if(s=="AKIHABARA") printf("YES\n");
            else if(s=="KIHABR") printf("YES\n");
            else if(s=="KIHBAR") printf("YES\n");
            else if(s=="KIHBRA") printf("YES\n");
            else if(s=="KIHABAR") printf("YES\n");
            else if(s=="KIHABRA") printf("YES\n");
            else if(s=="KIHBARA") printf("YES\n");
            else if(s=="KIHABARA") printf("YES\n");
            else printf("NO\n");
        }
    }
return 0;}


Measured memory_bytes: 256
N = int(input())
S = [list(input()) for _ in range(N)]

ans = 0
cntM = 0
cntA = 0
cntR = 0
cntC = 0
cntH = 0
for i in range(N):
    cntM += (1 if S[i][0] == 'M' else 0)
    cntA += (1 if S[i][0] == 'A' else 0)
    cntR += (1 if S[i][0] == 'R' else 0)
    cntC += (1 if S[i][0] == 'C' else 0)
    cntH += (1 if S[i][0] == 'H' else 0)
cntlst = [cntM, cntA, cntR, cntC, cntH]

for i in range(3):
    for j in range(i + 1, 4):
        for k in range(j + 1, 5):
            ans += cntlst[i] * cntlst[j] * cntlst[k]
print(ans)

Measured memory_bytes: 20292
function main(input) {
  input = input.trim();
  const a = input.split(" ");
  const ans =a[0].substring(0,1)+a[1].substring(0,1)+a[2].substring(0,1);
  
  console.log(ans.toUpperCase());
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 29608
c=[list(map(int,input().split())) for i in range(3)]
if (c[0][0]+c[1][1]+c[2][2])*2==c[0][1]+c[0][2]+c[1][0]+c[1][2]+c[2][0]+c[2][1]:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 9192
import atexit
import io
import sys

# _INPUT_LINES = sys.stdin.read().splitlines()
# input = iter(_INPUT_LINES).__next__
# _OUTPUT_BUFFER = io.StringIO()
# sys.stdout = _OUTPUT_BUFFER
#
#
# @atexit.register
# def write():
#     sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())

import math
R = lambda : map(int,input().split())
ans = sys.maxsize
n,k = R()
for i in range(n,k):
    for j in range(i+1,k+1):
        ans = min(ans,(i*j)%2019)
        if ans==0:
            print(ans)
            exit()

print(ans)

Measured memory_bytes: 3060