akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCorder
{
	public class Program
	{
		const long MOD = 1000000007;
		static void Main(string[] args)
		{
			Scanner cin = new Scanner();
		
			int n = cin.Int();
			int m = cin.Int();
			string s = cin.Next();
			string t = cin.Next();

			if (n == m) {
				bool ok = true;
				for (int i = 0; i < n; i++) {
					if (s[i] != t[i]) {
						ok = false;
						break;
					}
				}

				if (ok) {
					Console.WriteLine(n);
				} else {
					Console.WriteLine(-1);
				}
			} else {
				//  ************************
				//12*-*-*-*-*-*-*-*-*-*-*-*-
				//08*--*--*--*--*--*--*--*--
				long gcd = GCD(n, m);
				long nd = n / gcd;
				long md = m / gcd;
				bool ok = true;
				for (int i = 0; i < gcd; i++) {
					if (s[i * (int)nd] != t[i * (int)md]) {
						ok = false;
						break;
					}
				}

				if (ok) {
					Console.WriteLine(LCM(n, m));
				} else {
					Console.WriteLine(-1);
				}
			}
		}

		public static long GCD(long a, long b)
		{
			if (a > b) {
				if (b == 0) {
					return a;
				}

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

				return GCD(a, b % a);
			}
		}

		public static long GCD(long[] values)
		{
			if (values.Length == 1) {
				return values[0];
			}

			long gcd = values[0];
			for (int i = 1; i < values.Length; ++i) {
				if (gcd == 1) {
					return gcd;
				}
				gcd = GCD(values[i], gcd);
			}

			return gcd;
		}

		public static long LCM(long a, long b)
		{
			return a / GCD(a, b) * b;
		}

		public static List<long> GetPrimeFactors(long value)
		{
			var factors = new List<long>();
			for (int i = 2; i * i <= value; ++i) {
				if (value % i == 0) {
					factors.Add(i);
					while (value % i == 0) {
						value /= i;
					}
				}
			}

			return factors;
		}
	}

	public class Scanner
	{
		private readonly char[] delimiter_ = new char[] { ' ' };
		private string[] buf_;
		private int index_;
		
		public Scanner()
		{
			buf_ = new string[0];
			index_ = 0;
		}

		public string Next()
		{
			if (index_ < buf_.Length) {
				return buf_[index_++];
			}

			string st = Console.ReadLine();
			while (st == "") {
				st = Console.ReadLine();
			}

			buf_ = st.Split(delimiter_, StringSplitOptions.RemoveEmptyEntries);
			if (buf_.Length == 0) {
				return Next();
			}

			index_ = 0;
			return buf_[index_++];
		}

		public int Int()
		{
			return int.Parse(Next());
		}
		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Int() + add;
			}
			return Array;
		}

		public long Long()
		{
			return long.Parse(Next());
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Long() + add;
			}
			return Array;
		}

		public double Double()
		{
			return double.Parse(Next());
		}

		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Double() + add;
			}
			return Array;
		}
	}
}


Measured memory_bytes: 12128
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}

#ifdef DEBUG
void debug() { cerr << "\n"; }
template <class T> void debug(const T &x) { cerr << x << "\n"; }
template <class T, class... Args> void debug(const T &x, const Args &... args) {
    cerr << x << " ";
    debug(args...);
}
template <class T> void debugVector(const vector<T> &v) {
    for(const T &x : v) {
        cerr << x << " ";
    }
    cerr << "\n";
}
#else
template <class T, class... Args>
void debug(const T &x, const Args &... args) {}
template <class T> void debugVector(const vector<T> &v) {}
#endif

using ll = long long;
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int d, t, s;
    cin >> d >> t >> s;
    int a = (d + s - 1) / s;
    cout << (a <= t ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3644
#coding:utf-8
H,W,D=map(int,raw_input().split())
A=[None]
for i in range(H):
    b=map(int,raw_input().split())
    A.append([None]+b)
Q=int(raw_input())
L=[];R=[]
for i in range(Q):
    l,r=map(int,raw_input().split())
    L.append(l);R.append(r)

P={}
for i in range(1,H+1):
    for j in range(1,W+1):
        P[A[i][j]]=(i,j)
C={}
for d in range(1,D+1):
    x=d
    cost=0
    C[d]=0
    while x+D<=H*W:
        n=x+D
        np=P[n];pp=P[x]
        distance=abs(np[0]-pp[0])+abs(np[1]-pp[1])
        cost+=distance
        C[n]=cost
        x=n
for l,r in zip(L,R):
    print(C[r]-C[l])
    



Measured memory_bytes: 45940
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#define mm(a,x) memset(a,x,sizeof(a))
#define sync std::ios::sync_with_stdio(false);std::cin.tie(0)
#define ll long long
using namespace std;
const int N=2e5+10;
int n,m;
int pre[N],sz[N];
inline void init()
{
    for(int i=1;i<=n;++i)
        pre[i]=i;
}
int find(int x)
{
    if(x!=pre[x])
        pre[x]=find(pre[x]);
    return pre[x];
}
bool unio(int x,int y)
{
    x=find(x),y=find(y);
    if(x==y)
        return false;
    pre[x]=y;
    return true;
}
int main(void)
{
    sync;
    cin>>n>>m;
    init();
    for(int i=0;i<m;++i)
    {
        int a,b;
        cin>>a>>b;
        unio(a,b);
    }
    for(int i=1;i<=n;++i)
        ++sz[find(i)];
    int res=0;
    for(int i=1;i<=n;++i)
        res=max(res,sz[i]);
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 7008
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
#define int long long

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

    int n,k; cin >> n >> k;
    int r,s,p; cin >> r >> s >> p;
    string t; cin >> t;

    vector<int> v(n);

    for(int i = 0;i <= n-k-1;i ++){

        if(v.at(i) == 1){
            continue;
        }

        if(t.at(i) == t.at(i+k)){
            v.at(i+k) = 1;
        }
    }

    int rsum = 0,ssum = 0,psum = 0;

    for(int i = 0;i < n;i ++){
        if(v.at(i) == 1){
            continue;
        }
        if(t.at(i) == 'r'){
            rsum ++;
        }else if(t.at(i) == 's'){
            ssum ++;
        }else{
            psum ++;
        }
    }
    cout << p * rsum + r * ssum + s * psum << endl;
}

Measured memory_bytes: 1232
import java.util.*;
import java.io.*;
import java.text.*;
public class Main{
    //SOLUTION BEGIN
    //Into the Hardware Mode
    void pre() throws Exception{}
    void solve(int TC) throws Exception{
        long l = nl(), r = nl();
        if(r-l+1 >= 2019)pn(0);
        else{
            long ans = IINF;
            for(long i = l; i<= r; i++){
                for(long j = i+1; j<= r; j++){
                    ans = Math.min(ans, ((i%2019)*(j%2019))%2019);
                }
            }
            pn(ans);
        }
    }
    //SOLUTION END
    void hold(boolean b)throws Exception{if(!b)throw new Exception("Hold right there, Sparky!");}
    long IINF = (long)1e18, mod = (long)998244353;
    final int INF = (int)1e9, MX = (int)2e5+5;
    DecimalFormat df = new DecimalFormat("0.00000000000");
    double PI = 3.141592653589793238462643383279502884197169399, eps = 1e-6;
    static boolean multipleTC = false, memory = false;
    FastReader in;PrintWriter out;
    void run() throws Exception{
        in = new FastReader();
        out = new PrintWriter(System.out);
        //Solution Credits: Taranpreet Singh
        int T = (multipleTC)?ni():1;
        pre();for(int t = 1; t<= T; t++)solve(t);
        out.flush();
        out.close();
    }
    public static void main(String[] args) throws Exception{
        if(memory)new Thread(null, new Runnable() {public void run(){try{new Main().run();}catch(Exception e){e.printStackTrace();}}}, "1", 1 << 28).start();
        else new Main().run();
    }
    long gcd(long a, long b){return (b==0)?a:gcd(b,a%b);}
    int gcd(int a, int b){return (b==0)?a:gcd(b,a%b);}
    int bit(long n){return (n==0)?0:(1+bit(n&(n-1)));}
    void p(Object o){out.print(o);}
    void pn(Object o){out.println(o);}
    void pni(Object o){out.println(o);out.flush();}
    String n()throws Exception{return in.next();}
    String nln()throws Exception{return in.nextLine();}
    int ni()throws Exception{return Integer.parseInt(in.next());}
    long nl()throws Exception{return Long.parseLong(in.next());}
    double nd()throws Exception{return Double.parseDouble(in.next());}

    class FastReader{
        BufferedReader br;
        StringTokenizer st;
        public FastReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public FastReader(String s) throws Exception{
            br = new BufferedReader(new FileReader(s));
        }

        String next() throws Exception{
            while (st == null || !st.hasMoreElements()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (IOException  e){
                    throw new Exception(e.toString());
                }
            }
            return st.nextToken();
        }

        String nextLine() throws Exception{
            String str = "";
            try{   
                str = br.readLine();
            }catch (IOException e){
                throw new Exception(e.toString());
            }  
            return str;
        }
    }
}

Measured memory_bytes: 25300
import java.util.*;

public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    for (int i=0; i<n; i++){
      switch (sc.next()){
        case "insert":
          Node.insert(sc.nextInt());
          break;
        case "print":
          Node.print();
          break;
        case "find":
          System.out.println(Node.find(sc.nextInt())?"yes":"no");
          break;
      }
    }
  }
}

class Node{
  private int key;
  private Node p;
  private int k=0;
  private Node l;
  private Node r;
  private static Node root;

  public void pre(){
    System.out.print(" "+key);
    if (l!=null) l.pre();
    if (r!=null) r.pre();
  }

  public void in(){
    if (l!=null) l.in();
    System.out.print(" "+key);
    if (r!=null) r.in();
  }

  public void post(){
    if (l!=null) l.post();
    if (r!=null) r.post();
    System.out.print(" "+key);
  }

  private Node(int key, Node l, Node r){
    this.key = key;
    this.l = l;
    this.r = r;
  }

  public static void insert(int v){
    insert(new Node(v,null,null));
  }

  private static void insert(Node z){
    Node y = null;
    Node x = root;
    while (x != null){
      y = x;
      if (z.key < x.key){
        x = x.l;
      } else {
        x = x.r;
      }
    }
    z.p = y;
    if (y==null){
      root = z;
    } else if (z.key<y.key){
      y.l = z;
    } else {
      y.r = z;
    }
  }

  public static boolean find(int k){
    Node x = root;
    while (x != null){
      if (k == x.key) return true;
      else if (k < x.key){
        x = x.l;
      } else {
        x = x.r;
      }
    }
    return false;
  }

  public static void print(){
    root.in();
    System.out.println();
    root.pre();
    System.out.println();
  }
}


Measured memory_bytes: 201020
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
int main() {
  int n;
  string s;
  cin>>n>>s;
  int ans=0;
  rep(i,n-1){
    vector<bool>a(26);
    rep(j,i+1){
      a[s[j]-'a']=true;
    }
    int answer=0;
    for(int k=i+1;k<n;k++){
      if(a[s[k]-'a']) {
        answer++;
        a[s[k]-'a']=false;
      }
    }
    ans=max(ans,answer);
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3604
package main

import (
  "fmt"
)

func stringIndex(ss []string, s string) int {
  i := -1
  for j := 0; j < len(ss); j++ {
    if ss[j] == s {
      i = j 
      break
    }
  }
  return i
}

func main() {
  w := []string{
    "Sunny",
    "Cloudy",
    "Rainy",
  }
  var s string
  fmt.Scan(&s)
  fmt.Println(w[(stringIndex(w, s)+1)%3])
}

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

int A[100005];
int B[100005];

int main(){
    int N;
    scanf("%d", &N);

    for(int i = 0; i < N; i ++){
        scanf("%d", &A[i]);
        B[i] = A[i];
    }

    sort(B, B+N);
    set<int> s;
    for(int i = 0; i < N; i += 2){
        s.insert(B[i]);
    }

    int ans = 0;
    for(int i = 0; i < N; i += 2){
        if(!s.count(A[i])){
            ans ++;
        }
    }

    printf("%d", ans);
    return 0;
}


Measured memory_bytes: 3328
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)

	n := nextInt()
	m := make(map[string]int)

	for i := 0; i < n; i++ {
		tmp := next()
		m[tmp]++
	}

	max := 0
	for _, count := range m {
		if count > max {
			max = count
		}
	}

	s := make([]string, len(m))

	i := 0
	for key, count := range m {
		if count == max {
			s[i] = key
			i++
		}
	}

	sort.Strings(s)

	for _, word := range s {
		if word != "" {
			fmt.Println(word)
		}
	}
}

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

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}


Measured memory_bytes: 21504
#include <bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(),(obj).end()
#define SORTD(s) sort((s).rbegin(),(s).rend())
#define rep(i,n) for(int i=0;i<(n);i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
#define PI 3.14159265358979323846264338327950L
const int mod=1000000007,MAX=200005,INF=1<<30;

int main() {
	int n;
  	cin>>n;
    string w;
  	cin>>w;
  
  	map<string,int> check;
  	check[w]++;
  
  	rep(i,n-1){
    	string s;cin>>s;
      	if(w[w.length()-1]!=s[0]||check[s]!=0){
        	cout<<"No"<<endl;
          	return 0;
        }
      
      w=s;
      check[s]++;
    }
	cout<<"Yes"<<endl;
  return 0;

}

Measured memory_bytes: 3640
n, k = map(int, input().split())
A = list(map(int, input().split()))
MOD = 10**9+7
cnt = 0
for _ in range(n):
    for i in range(n-1):
        if A[i] > A[i+1]:
            A[i], A[i+1] = A[i+1], A[i]
            cnt += 1
AA = A*2
nn = len(AA)
out_cnt = 0
for _ in range(nn):
    for i in range(nn-1):
        if AA[i] > AA[i+1]:
            AA[i], AA[i+1] = AA[i+1], AA[i]
            out_cnt += 1
ans = (k*cnt % MOD + out_cnt * (k*(k-1)//2) % MOD) % MOD
print(ans)


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

int main (){
  int ah=0, aa=0, bh=0, ba=0;
  cin >> ah >> aa >> bh >> ba;
  
  while (1){
    bh -= aa;
    if (bh <= 0) break;
    ah -= ba;
    if (ah <= 0) break;
  }
  if (bh <= 0) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 3592
#include <iostream>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <sstream>
#include <algorithm>
#include <math.h>
#include<string>
#include<vector>
using namespace std;
using ll = long long;
int main()
{
    int s,w;
    cin >> s >> w;
    if(w >= s){
        cout << "unsafe" << endl;
        return 0;
    }
    cout << "safe" << endl;
}

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

int main() {
    ll n, ans = 0;
    cin >> n;
    for (ll i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ll div = n / i;
            if (div - i >= 2) {
                ans += div - 1;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<map>
#include<list>

using namespace std;

#define int long long

list<bool*> fld;

list<bool*>::iterator GetHeight(int l, int r)
{
	list<bool*>::iterator itr = fld.begin();
	//fld.push_front((bool*)new bool[5]{});
	for (; itr != fld.end(); itr++)
	{
		for (int i = l; i < r; i++)
		{
			if ((*itr)[i] == true) return --itr;
		}
	}
	return --itr;
}

void PushFront()
{
	fld.push_front((bool*)new bool[5]);
	for (int i = 0; i < 5; i++)
	{
		(*fld.begin())[i] = false;
	}
}

bool IsFull(list<bool*>::iterator itr)
{
	for (int i = 0; i < 5; i++)
	{
		if ((*itr)[i] == false) return false;
	}
	return true;
}

bool IsEmpty(list<bool*>::iterator itr)
{
	for (int i = 0; i < 5; i++)
	{
		if ((*itr)[i] == true) return false;
	}
	return true;
}

void Drop(int d, int p, int q)
{
	if (!IsEmpty(fld.begin())) PushFront();
	int l = q - 1, r = (d == 1) ? l + p : l + 1;
	list<bool*>::iterator itr = GetHeight(l, r);

	int h = (d == 1) ? 1 : p;
	for (int i = 0; i < h; i++)
	{
		if (itr == fld.begin()) PushFront();
		for (int j = l; j < r; j++)
		{
			(*itr)[j] = true;
		}
		if (IsFull(itr))
		{
			delete *itr;
			itr = fld.erase(itr);
		}
		itr--;
	}
}

signed main()
{
	int N;
	while (cin >> N, N)
	{
		fld.clear();
		PushFront();
		for (int i = 0; i < N; i++)
		{
			int d, p, q;
			cin >> d >> p >> q;
			Drop(d, p, q);
		}
		int ans = 0;
		for (list<bool*>::iterator itr = fld.begin(); itr != fld.end(); itr++)
		{
			for (int i = 0; i < 5; i++)
			{
				ans += ((*itr)[i] == true);
			}
		}
		printf("%lld\n", ans);
	}
	return 0;
}

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

const int mod = 1e9 + 7;
const int K = 2e5 + 10;

int n , a , b , sum1 = 1 , sum2 = 1 , fac[K];

int Pow(int a , int k){
	if(k == 1) return a;
	int S = Pow(a , k >> 1);
	if(k & 1) return 1ll * S * S % mod * a % mod;
	else return 1ll * S * S % mod;
}

int main(){
	fac[0] = 1; for(int i = 1; i < K; i++)
		fac[i] = 1ll * fac[i - 1] * i % mod;
	scanf("%d %d %d" , &n , &a , &b);
	for(int i = n; i > n - a; i--)
		sum1 = 1ll * sum1 * i % mod;
	sum1 = 1ll * sum1 * Pow(fac[a] , mod - 2) % mod;
	for(int i = n; i > n - b; i--)
		sum2 = 1ll * sum2 * i % mod;
	sum2 = 1ll * sum2 * Pow(fac[b] , mod - 2) % mod;
	printf("%lld" , (1ll * Pow(2 , n) - sum1 - sum2 - 1 + 1ll * 10 * mod) % mod);
	return 0;
}

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

if len(set(a)) == 1:
    print(0)
    exit()

mi = min(a)
ma = max(a)

min_sum = 1000000000000000000

for i in range(mi, ma+1):
    sum = 0
    for j in range(n):
        sum += (a[j] - i)**2
    if sum < min_sum:
        min_sum = sum

print(min_sum)


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

import sys
from itertools import permutations
from math import hypot

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N = INT()
XY = []
for i in range(N):
    x, y = MAP()
    XY.append((x, y))

sm = cnt = 0
for perm in permutations(XY):
    dist = 0
    prev = (0, 0)
    for i, (x, y) in enumerate(perm):
        if i == 0:
            prev = (x, y)
        else:
            x2, y2 = prev
            dist += hypot(x-x2, y-y2)
    sm += dist
    cnt += 1
print(sm/cnt)


Measured memory_bytes: 3188
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct Node{
  int key;
  struct Node *right,*left,*parent;
};
 
struct Node *root,*NIL1;
 
struct Node* find(struct Node *u,int k){
  while(u != NIL1 && k != u -> key){
    if(k < u -> key) u = u -> left;
    else u = u -> right;
  }
  return u;
}
 
void insert(int k){
  struct Node *y = NIL1;
  struct Node *x = root;
  struct Node *z;
 
  z = (struct Node*)malloc(sizeof(struct Node));
  z -> key = k;
  
  z -> left = NIL1;
  
  z -> right = NIL1;
 
  while(x != NIL1){
    y = x;
    if(z -> key < x -> key){
      x = x -> left;
    } else{
      x = x -> right;
    }
  }
  z -> parent = y;
  if(y == NIL1){
    root= z;
  } else{
    if(z -> key < y -> key){
      y -> left = z;
    } else{
      y -> right = z;
    }
  }
}
 
void inorder(struct Node *u){
  if(u == NIL1) return ;
  inorder(u -> left);
  printf(" %d",u -> key);
  inorder(u -> right);
}
 
void preorder(struct Node *u){
  if(u == NIL1) return ;
  printf(" %d",u -> key);
  preorder(u -> left);
  preorder(u -> right);
}
 
int main(){
  int n,i,res;
  char st[7];
  struct Node *t;
   
  scanf("%d",&n);
 
  for(i = 0;i < n;i++){
    scanf("%s",st);
    if(strcmp(st,"find") == 0){
      scanf("%d",&res);
      t = find(root,res);
      if(t != NIL1) printf("yes\n");
      else printf("no\n");
    }
    else if(strcmp(st,"insert") == 0){
      scanf("%d",&res);
      insert(res);
    }
    else if(strcmp(st,"print") == 0){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
  return 0;
}

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

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

typedef long long ll;
typedef pair<int, int> P;

const int MAX = 1e5 + 5;
const int INF = 1001001001;
const int MOD = 1e9 + 7;

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

    reverse(S.begin(), S.end());
    S.push_back('0');
    int N = S.size();

    vector<vector<int>> dp(N+1, vector<int>(2, INF));
    dp[0][0] = 0;
    rep(i, N) {
        rep(j, 2) {
            int ni = i+1, nj = j;
            int n = S[i] - '0';
            if (j) n++;
            rep(k, 10) {
                int res = k;
                if (n <= k) {
                    res += k - n;
                    nj = 0;
                } else {
                    res = 10 + k - n;
                    nj = 1;
                }
                dp[ni][nj] = min(dp[ni][nj], dp[i][j] + res);
            }
        }
    }

    cout << min(dp[N][0], dp[N][1]) << endl;
}

Measured memory_bytes: 55940
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>

template <typename QvQ> inline QvQ Min(QvQ a,QvQ b){if(a<b) return a;return b;}
template <typename QvQ> inline QvQ Max(QvQ a,QvQ b){if(a>b) return a;return b;}

#define inf 0x7f7f7f7f
#define dinf 0x3f3f3f3f

#define ll long long
#define rei register int
#define inv inline void

#define bl putchar(' ')
#define ed putchar('\n')

#define read2(a,b) read(a),read(b)
#define write2(a,b) write(a),bl,write(b)
#define read3(a,b,c) read(a),read(b),read(c)
#define write3(a,b,c) write(a),bl,write(b),bl,write(c)

template <typename QvQ>inv read(QvQ &x)
{
	x=0;int f=1;
	char c=getchar();
	for(;c<'0'||c>'9';c=getchar()) if(c=='-') f=-1;
	for(;c>='0'&&c<='9';c=getchar()) x=(x<<1)+(x<<3)+(c^48);
	x=x*f;
}
template <typename QvQ>inv write(QvQ x)
{
	if(x<0) x=-x,putchar('-');
	if(x>9) write(x/10);
	putchar(x%10+48);
}
using namespace std;
#define MAXN 200050
int n;
int a[MAXN];
int main()
{
	__int128 m,z=1;
	read(n); double sum=0;
	for(rei i=1;i<=n;++i) read(a[i]),sum+=1.0/a[i];
	cout<<1.0/sum;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <utility>
#include <iomanip>
#include <cmath>
#include <set>
#include <functional>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
using ll = long long;
constexpr ll INF = 1LL << 60;
constexpr ll MOD = 1e4 + 7;

int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    int x,a;cin>>x>>a;
    if(x<a) cout << 0;
    else cout << 10;
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define rrep(i,x) for(ll i = (ll)(x)-1;0 <= i; i--)
#define reps(i,x) for(ll i = 1; i < (ll)(x)+1; i++)
#define rreps(i,x) for(ll i = (ll)(x); 1 <= i; i--)
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll INF = numeric_limits<ll>::max()/4;
const int n_max = 1e5+10;
#define int ll

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s;cin >> s;
    if(s == "ABC")cout << "ARC" << endl;
    else cout << "ABC" << endl;
}

Measured memory_bytes: 3608
a=-1,A=65,d;
char
*N="GKSOCNWLDFVTBRXHAJUPEMQI",
*E="PHLTIDOXQAGWECSUMBKVJFNR",
s[9];
main(c)
{
for(;c-48&&scanf("%s",s);a+=d/4+1)
{
(c=*s)<A?~a&&printf("%d\n",a),a=d=0:0;
if(c=='N')d=N[d]-A;
if(c=='E')d=E[d]-A;
if(c=='W')d=E[E[E[d]-A]-A]-A;
if(c=='S')d=N[N[N[d]-A]-A]-A;
if(c=='R')d=d&28|d%4+1&3;
if(c=='L')d=d&28|d%4+3&3;
}}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <string>
#include <utility>
#include <map>
using namespace std;
#define rep(i,n) for(int i=1;i<=(int)(n);i++)
#define Rep(i,n) for(int i=0;i<=(int)(n-1);i++)
typedef long long ll;
typedef pair<int,int> pint;
int dx[]={-1,0,1,0};
int dy[]={0,-1,0,1};
int inf=1e9+10;
 
int N;
ll a[100010];
ll b[100010];
map<ll,ll>mp;
 
int main() {
	cin>>N;
	Rep(i,N){cin>>a[i];
	mp[a[i]]++;
	}
	Rep(i,N){
		if(mp[a[i]]>=2) {b[i]=a[i]; mp[a[i]]-=2;}
		else b[i]=0;
	}
	sort(b,b+N);
	reverse(b,b+N);
  cout<<b[0]*b[1]<<endl;
	
 
	return 0;
}

Measured memory_bytes: 8064
#include <iostream>
#include <map>
#include <algorithm>
#include <string>
#include <vector> 
#include <numeric>
#include <cmath>
#include <queue>
#include <iomanip>
#include <functional>


#define CHMAX(a,b) a = std::max(a,b)
#define CHMIN(a,b) a = std::min(a,b)
#define MAXMIN(a,b,c) std::max(a,min(b,c))
#define CHABS(a) a = std::abs(a) 
#define COUT(a) std::cout << a << std::endl
#define CERR(a) std::cerr << a << std::endl
#define FOR(n) for(lli i = 0; i < n; i++)

using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;
using tlll = tuple<lli, lli, lli>;
using vll = vector<lli>;

lli mod197 = 1000000007LL;
lli INF = 10000000000000;

// ax + by = gcd(a,b) 最大公約数
template< typename T >
T extgcd(T a, T b, T& x, T& y) {
	T d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	else {
		x = 1;
		y = 0;
	}

	return d;
}

int arr[10] = {};

int main(void) {

	int a, b;
	cin >> a >> b;

	for (int i = 1; i <= 10000; i++) {
		if (int(1.08 * i) - i == a && (int)(1.1 * i) - i == b) {
			cout << i << endl;
			return 0;
		}
	}

	cout << -1 << endl;


	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
    string s;
    cin>>s;

    int fir=-1,las=-1;

    for(int i=0;i<s.size();i++){
        if(s[i]=='A'&&fir==-1)fir=i;
        if(s[i]=='Z')las=i;
    }
    cout<<las-fir+1<<endl;


    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
void ade(int &x,int y){x+=y;if(x>=mod)x-=mod;}
int n;
int nu[660];
int m;
bool book[660];
bool isx[660];
int a,b;
int dp[660][330][330];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n*2;++i)scanf("%d",&nu[i]);
	m=n*2;
	for(int i=1;i<=n;++i)
		if(nu[i*2]!=-1&&nu[i*2-1]!=-1)
		{
			m-=2;
			book[nu[i*2]]=book[nu[i*2-1]]=1;
		}
		else if(nu[i*2]==-1&&nu[i*2-1]==-1)a++;
		else
		{
			b++;
			isx[nu[i*2]+nu[i*2-1]+1]=1;
		}
	dp[0][0][0]=1;
	int x;
	int p=0;
	int v;
	for(int i=0;i<m;++i)
	{
		while(book[n*2-p])p++;
		x=n*2-p;p++;
		for(int j=0;j<=i&&j<=a+b;++j)
			for(int k=0;k<=i&&k<=b;++k)
			{
				if(!dp[i][j][k])continue;
				v=dp[i][j][k];
				if(isx[x])
				{
					if(j) ade(dp[i+1][j-1][k],v);
					ade(dp[i+1][j][k+1],v);
				}
				else
				{
					if(j) ade(dp[i+1][j-1][k],v);
					ade(dp[i+1][j+1][k],v);
					if(k) ade(dp[i+1][j][k-1],1ll*k*v%mod);
				}
			}
	}
	int fac=1;
	for(int i=1;i<=a;++i)fac=1ll*fac*i%mod;
	printf("%lld\n",1ll*fac*dp[m][0][0]%mod);
	return 0;
}


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

typedef long long ll;
typedef pair<int,int> ii;

const int mx=57;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	ll binom[mx][mx];
	for (int i=0; i<mx; i++) {
		binom[i][0]=binom[i][i]=1;
		for (int j=1; j<i; j++)
			binom[i][j]=binom[i-1][j]+binom[i-1][j-1];
	}
	map<int,int> ct;
	int n,p,a; cin>>n>>p;
	for (int i=0; i<n; i++)
		cin>>a, ct[a%2]++;
	ll zero=ct[0], one=ct[1];
	ll ret=0;
	for (int i=p; i<=one; i+=2)
		ret+=binom[one][i];
	ret<<=zero;
	cout << ret << endl;
	return 0;
}


Measured memory_bytes: 256
#pragma region template
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vvvld = vector<vvld>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template <typename T>
using pqrev = priority_queue<T, vector<T>, greater<T>>;
#define rep(i, n) for (ll i = 0, i##_end = (n); i < i##_end; i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for (ll i = (a), i##_end = (b); i < i##_end; i++)
#define reprb(i, a, b) for (ll i = (b)-1, i##_end = (a); i >= i##_end; i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
//*
constexpr ll MOD = 1e9 + 7;
/*/
constexpr ll MOD = 998244353;
//*/
constexpr ll INF = 1e+18;
constexpr ld EPS = 1e-12L;
constexpr ld PI = 3.14159265358979323846L;
constexpr ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
constexpr ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
template <typename S, typename T>
constexpr bool chmax(S &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename S, typename T>
constexpr bool chmin(S &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif
template <typename T>
bool print_(const T &a) {
  cout << a;
  return true;
}
template <typename T>
bool print_(const vector<T> &vec) {
  for (auto &a : vec) {
    cout << a;
    if (&a != &vec.back()) {
      cout << " ";
    }
  }
  return false;
}
template <typename T>
bool print_(const vector<vector<T>> &vv) {
  for (auto &v : vv) {
    for (auto &a : v) {
      cout << a;
      if (&a != &v.back()) {
        cout << " ";
      }
    }
    if (&v != &vv.back()) {
      cout << "\n";
    }
  }
  return false;
}
void print() { cout << "\n"; }
template <typename Head, typename... Tail>
void print(Head &&head, Tail &&... tail) {
  bool f = print_(head);
  if (sizeof...(tail) != 0) {
    cout << (f ? " " : "\n");
  }
  print(forward<Tail>(tail)...);
}
#pragma endregion

void Pr(bool f){
  cout << (f ? "Yes" : "No") << "\n";
  exit(0);
}

unordered_set<ll> st;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  ll n, x, m;
  cin >> n >> x >> m;
  ll ans = 0;
  vll a(1, x);
  st.emplace(x);
  vll b, cyc;
  while(1){
    ll y = (a.back()*a.back())%m;
    if(st.count(y)){
      bool cc = false;
      rep(i, SZ(a)){
        if(a[i] == y) cc = true;
        (cc ? cyc : b).emplace_back(a[i]);
      }
      break;
    }
    a.emplace_back(y);
    st.emplace(y);
  }
  dump(a, b, cyc);
  ans += accumulate(ALL(b), 0ll);
  ans += accumulate(ALL(cyc), 0ll) * ((n-SZ(b))/SZ(cyc));
  rep(i, (n-SZ(b))%SZ(cyc)){
    ans += cyc[i];
  }
  print(ans);
}


Measured memory_bytes: 6420
N = input()[::-1]
iv = 1
MOD = 10**9+7
dp = [0]*13
dp[0]=1
ls = [0]*13
for i in range(len(N)):
  x = N[i]
  
  if x=='?':
    for j in range(13):
      for h in range(10):
        ls[(h*iv+j)%13] += dp[j]
        
  else:
    x = int(x)
    for j in range(13):
      ls[(j+x*iv)%13]+=dp[j]
      
  for j in range(13):
    dp[j] = (ls[j]%MOD)
  ls = [0]*13
  iv *= 10
  iv %= 13
print(dp[5])

Measured memory_bytes: 42988
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> ans;
    while(abs(n) > 1) {
        ans.push_back(abs(n % -2));
        if(n < 0 and abs(n % -2) == 1) {
            n /= -2;
            n++;
        } else {
            n /= -2;
        }
    }
    if(n == 1) ans.push_back(1);
    else if(n == -1) {
        ans.push_back(1);
        ans.push_back(1);
    }
    if(ans.size() == 0) ans.push_back(0);

    FORR(i, ans.size() - 1, 0) cout << ans[i];
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
main = do
    line <- getLine
    let time = read line :: Int
    let s = time `mod` 60
    let m = time `div` 60 `mod` 60
    let h = time `div` 60 `div` 60 `mod` 60
    putStrLn $ show h ++ ":" ++ show m ++ ":" ++ show s

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

int main(){ 
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  int ok = 0;
  rep(i,n) if (a[i] & 1) ok++;
  if (ok & 1) cout << "NO" << endl;
  else cout << "YES" << endl;

  return 0;
} 

Measured memory_bytes: 1152
import java.util.Scanner;

public class Main {

	public static String Y = "Yes";
	public static String N = "No";
	public static long MOD = (long) (Math.pow(10, 9) + 7);
	public static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {

		int n = ni();
		int d = ni();

		for (int i = 1; i < 20; i++) {
			if (i * (2 * d + 1) >= n) {
				out(i);
				return;
			}
		}

	}

	/*
	 * 以下メソッド集
	 */

	public static void permutation(String q, String ans) {
		// Base Case
		if (q.length() <= 1) {
			System.out.println(ans + q);
		}
		// General Case
		else {
			for (int i = 0; i < q.length(); i++) {
				permutation(q.substring(0, i) + q.substring(i + 1),
						ans + q.charAt(i));
			}
		}
	}

	static char[][] same(char[][] c, int h, int w) {

		char[][] a = new char[h][w];
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				a[i][j] = c[i][j];
			}
		}
		return a;

	}

	static int countkuro(char[][] c) {

		int count = 0;
		for (char[] cc : c) {
			for (char ccc : cc) {
				if ('#' == ccc) {
					count++;
				}
			}
		}
		return count;
	}

	static void debug() {

		out("---");
	}

	static void debug(Object a) {

		out("-------");
		out(a);
		out("-------");
	}

	static int ketasuu(int n) {

		String str = "" + n;
		return str.length();
	}

	static int account(String str) {

		String target = "AC";
		int count = 0;
		int len = str.length();
		for (int i = 0; i < len - 1; i++) {
			if (target.equals(str.substring(i, i + target.length()))) {
				count++;
			}
		}
		return count;
	}

	static int ni() {

		return sc.nextInt();
	}

	static long nl() {

		return sc.nextLong();
	}

	static double nd() {

		return sc.nextDouble();
	}

	static String n() {

		return sc.next();
	}

	static char[] nc() {

		return sc.next().toCharArray();
	}

	static int kaijo(int n) {

		if (n == 0 || n == 1) {
			return 1;
		} else {
			return n * kaijo(n - 1);
		}
	}

	static int fib(int n) {

		return (n == 1 || n == 0) ? n : fib(n - 2) + fib(n - 1);
	}

	static long lcm(long m, long n) {

		return m * n / gcd(m, n);
	}

	static int lcm(int m, int n) {

		return m * n / gcd(m, n);
	}

	static long gcd(long a, long b) {

		return (b == 0) ? a : gcd(b, a % b);
	}

	static int gcd(int a, int b) {

		return (b == 0) ? a : gcd(b, a % b);
	}

	static void out(Object obj) {
		System.out.println(obj);
	}

	static void outn(Object obj) {
		System.out.print(obj);
	}

	static double max(double d, double e) {

		return Math.max(d, e);
	}

	static long max(long a, long b) {

		return Math.max(a, b);
	}

	static long min(long d, long e) {

		return Math.min(d, e);
	}

	static int min(int a, int b) {

		return Math.min(a, b);
	}
}

class XY {

	int h;
	int c;

	XY(int h, int c) {
		this.h = h;
		this.c = c;
	}
}


Measured memory_bytes: 36028
fun solve(A: List<List<Int>>, N: Int ,B: List<Int>) {
    val bingo = (0 until 3).map { IntArray(3) }

    // do
    B.forEach { b ->
        repeat(3 ){ i ->
            repeat(3) {j ->
                if (A[i][j] == b) {
                    bingo[i][j] = 1
                }
            }
        }
    }

    // check
    var ans = "No"
    /// horizon
    for (i in 0..2) {
        if (bingo[i].sum() == 3) {
            ans = "Yes"
        }
    }
    /// vertical
    for (j in 0..2) {
        var flg = true
        for (i in 0..2) {
            if (bingo[i][j] == 0) {
                flg = false
                break
            }
        }
        if (flg) {
            ans = "Yes"
        }
    }
    /// cross
    var x = 0
    for (i in 0..2) {
        x += bingo[i][i]
    }
    if (x == 3) {
        ans = "Yes"
    }
    x = 0
    for (i in 0..2) {
        x += bingo[i][2 - i]
    }
    if (x == 3) {
        ans = "Yes"
    }

    println(ans)
}

fun main() {
//    val S = readLine()!!
//    val N = readLine()!!.toInt()
//    val (N, M) = readLine()!!.split(" ").map { it.toInt() }
//    val A = readLine()!!.split(" ").map { it.toInt() }
    val A = (0 until 3).map { readLine()!!.split(' ').map { it.toInt() } }
    val N = readLine()!!.toInt()
    val B = (0 until N).map { readLine()!!.toInt() }
    solve(A, N ,B)
}

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

int main(){
  int n;cin>>n;
  string ans="No";
  for(int i=9;i>0;i--){
    if(n%i==0 && n/i<10){
      ans="Yes";
      break;
    }
  }
  cout<<ans;
}
    

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

int main(){
    while(1){
        int n,m;
        cin >> n >> m;
        if(n == 0) break;

        vector<string> e(n);
        for(int i=0; i<n; i++){
            cin >> e[i];
        }
        string t = "";
        for(int i=0; i<m; i++){
            string tmp;
            cin >> tmp;
            t += tmp;
        }

        vector<bitset<5000>> dp(1<<n);
        for(int i=0; i<n; i++){
            for(int j=0; j+e[i].length()-1<t.length(); j++){
                if(e[i] == t.substr(j, e[i].length())){
                    dp[1<<i][j+e[i].length()] = 1;
                }
            }
        }
        for(int p=0; p<(int)t.length(); p++){
            for(int i=1; i<(1<<n); i++){
                if(dp[i][p] == 0) continue;
                for(int j=0; j<n; j++){
                    if(i>>j&1) continue;
                    if(dp[1<<j][p+e[j].length()] == 1){
                        dp[i|(1<<j)][p+e[j].length()] = 1;
                    }
                }
            }
        }
        cout << dp[(1<<n)-1].count() << endl;
    }
    return 0;
}



Measured memory_bytes: 5552
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define int long long
using namespace std;

typedef pair<int, int> Pii;

template<typename T>
void readvec(vector<T> &a);
void readindex(vector<int> &a);



signed main(){

    int N, C;
    cin >> N >> C;
    int s, t, c;
    vector< vector<Pii> > tv(C, vector<Pii>(0));

    REP(i, N){
        cin >> s >> t >> c;
        c--;
        tv[c].push_back(Pii(s, t));
    }
    REP(i, C){
        SORT(tv[i]);
    }

    vector<int> num(100000 + 1, 0);

    REP(i, C){
        int endtime = -1;
        REP(j, tv[i].size()){
            if(tv[i][j].first == endtime){
                num[tv[i][j].first]++;
                num[tv[i][j].second]--;
            }else{
                num[tv[i][j].first - 1]++;
                num[tv[i][j].second]--;
            }
            endtime = tv[i][j].second;
        }
    }

    int ans = 0, tmp = 0;
    REP(i, num.size()){
        tmp += num[i];
        ans = max(ans, tmp);
    }

    cout << ans;
    
    return 0;
}


template<typename T>
void readvec(vector<T> &a){
    REP(i, a.size()){
        cin >> a[i];
    }
}
void readindex(vector<int> &a){
    REP(i, a.size()){
        cin >> a[i];
        a[i]--;
    }
}

Measured memory_bytes: 3456
#include <iostream>

using namespace std;

int main()
{
    int n,m;
    cin >> n >> m;
    int sum = 0;
    for (int i = 0; i < m; i++) {
        int temp;
        cin >> temp;
        sum+=temp;
    }
    
    if (sum > n) {
        cout << -1 << endl;
    } else {
        cout << n - sum << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<ll,ll> P;
#define M 1000000007
#define F first
#define S second
#define PB push_back
#define INF 100000000000000000
struct mono{
	ll x;
	void init(void){
		x=0;
	}
};
mono func(mono a,mono b){
		mono res;
		res.init();
		res.x=a.x+b.x;
		return res;
}
struct segtree{
	mono seg[1<<20];
	int sz;
	void init(int n){
		sz=1;
		while(sz<n)sz*=2;
		for(int i=0;i<sz*2;i++)seg[i].init();
	}
	void set(int a,mono x){
		a+=sz-1;
		seg[a]=x;
	}
	void build(int k,int l,int r){
		if(l==r)return;
		build(k*2+1,l,(l+r-1)/2);
		build(k*2+2,(l+r+1)/2,r);
		seg[k]=func(seg[k*2+1],seg[k*2+2]);
	}
	void up(int a,mono x){
		a+=sz-1;
		seg[a].x+=x.x;
		while(a>0){
			a=(a-1)/2;
			seg[a]=func(seg[a*2+1],seg[a*2+2]);
		}
	}
	mono query(int a,int b,int l,int r,int k){
		if(a<=l&&r<=b)return seg[k];
		mono res;
		res.init();
		if(r<a||b<l)return res;
		return func(query(a,b,l,(l+r-1)/2,k*2+1),query(a,b,(l+r+1)/2,r,k*2+2));
	}
};
int main(void){
    int n,q;
    scanf("%d%d",&n,&q);
    segtree seg;
    seg.init(n);
    while(q--){
		ll t,a,b;
		scanf("%lld%lld%lld",&t,&a,&b);
		if(t==0)seg.up(a-1,mono{b});
		else{
			printf("%lld\n",seg.query(a-1,b-1,0,seg.sz-1,0).x);
		}
	}
    
}



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

int main() {
  int N, K;
  cin >> N >> K;
  int64_t total = 0;
  for(int64_t i = K; i < N + 2; i++) {
    int64_t a = i * (N - i + 1) + 1;
    total += a % (1000000007);
  }
  cout << total % (1000000007) << endl;
}

Measured memory_bytes: 3608
#include <iostream>
#include <algorithm>
#include <string> 
#include <vector>
#include <iomanip>
#include <math.h>
using namespace std;

int main()
{
	int a, b;
	cin >> a >> b;
	if (a == 1) {
		a = 14;
	}
	if (b == 1) {
		b = 14;
	}
	if (a > b) {
		cout << "Alice" << endl;
	}
	else if (a < b) {
		cout << "Bob" << endl;
	}
	else {
		cout << "Draw" << endl;
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
    int a, h, m, s;
    scanf("%d\n",&a);
    h = a/3600;
    m = (a-(h*3600))/60;
    s = a-((m*60)+(h*3600));
    printf("%d:%d:%d\n",h,m,s);
    
    return 0;
}



Measured memory_bytes: 3232
#include <ext/pb_ds/assoc_container.hpp>
#include <bits/stdc++.h>
using namespace std;
using namespace __gnu_pbds;
template <class c, class cmp = less<c> > using ordered_set = tree<c, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 
#endif
template<class T> ostream& operator<<(ostream &os, vector<T> V) {os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {return os << "(" << P.first << "," << P.second << ")";}
template <typename T,typename U>pair<T,U> operator+(const pair<T,U> & l,const std::pair<T,U> & r) { return {l.first+r.first,l.second+r.second};}
typedef long long int ll;
const ll mod =1e9+7;
const int maxn = 100002;
#define endl '\n'
#define int ll
#define ld long double
#define all(x) (x).begin(),(x).end()
int num(vector<string> a,int mask,int h,int w){
  for(int i = 0;i<h;i++){
    if((mask>>i)&1){
      for(int j = 0;j<w;j++){
        a[i][j] = '!';
      }
    }
  }

  for(int i = h;i<h+w;i++){
    if((mask>>i)&1){
      for(int j = 0;j<h;j++){
        a[j][i-h] = '!';
      }
    }
  }

  int cnt = 0;
  for(int i = 0;i<h;i++){
    cnt += count(all(a[i]),'#');
  }
  return cnt;

}
int32_t main()
{ 
   IOS
  
  int h,w,k;
  cin >> h >> w >> k;
  vector<string> a(h);

  for(int i = 0;i<h;i++){
    cin>>a[i];
  }
  int ans = 0;
  for(int mask = 0;mask<(1ll<<(h+w));mask++){
    if(num(a,mask,h,w) == k){
      ans++;
    }
  }

  cout << ans << endl;


  
}

Measured memory_bytes: 3640
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		char c = a.toCharArray()[0];
		if (c <= 90) {
			System.out.println("A");
		} else {
			System.out.println("a");
		}
	}
}

Measured memory_bytes: 35672
import numpy as np

N = int(input())
a = np.zeros(10, dtype = int)
for i in range(10):
    for j in range(1, i + 2):
        a[i] += 26 ** j
for i in range(10):
    if N <= a[i]:
        keta = i + 1
        if i == 0:
            num = N
        else:
            num = N - a[i]
        break
else:
    keta = 11
    num = N - 146813779479510
num -= 1
ans = [0 for i in range(keta)]
for i in range(keta):
    ans[keta-i-1] = num % 26 + 97
    num //= 26
u = ''
for i in range(keta):
    u += chr(ans[i])
print(u)

Measured memory_bytes: 27132