akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

#define LOG(...) fprintf(stderr,__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

int main() {
    int n;
    cin >> n;
    REP(i, n) {
        string steps;
        cin >> steps;

        char ss = '\0';
        int lr = 0; // -1: left, 0: both, 1: right
        REP(j, steps.size()) {
            char s = steps[j];
            if (s == ss) goto NO;
            if (lr > 0) {
                if (s == 'L') goto NO;
            } else if (lr < 0) {
                if (s == 'R') goto NO;
            } else {
                if (s == 'R') {
                    lr = 1;
                } else if (s == 'L') {
                    lr = -1;
                }
            }
            ss = s;
            lr = -lr;
        }
        cout << "Yes" << endl;
        continue;
    NO:
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3184
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;

public class Main {
	private static final int MOD = (int)Math.pow(10, 9);
	public static void main(String[] args) {
		FastReader sc = new FastReader();
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		
		if (a + b == c || a + c == b || b + c == a) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
	
	static class FastReader {
	    BufferedReader br;
	    StringTokenizer st;
	
	    public FastReader() {
	      br = new BufferedReader(new InputStreamReader(System.in));
	    }
	  
	    String next() { 
	      while (st == null || !st.hasMoreElements()) {
	        try {
	          st = new StringTokenizer(br.readLine());
	        } catch (IOException  e) {
	          e.printStackTrace();
	        }
	      }
	      return st.nextToken();
	    }
	
	    int nextInt() {
	      return Integer.parseInt(next());
	    }
	
	    long nextLong() {
	      return Long.parseLong(next());
	    }
	
	    double nextDouble() { 
	      return Double.parseDouble(next());
	    }
	
	    String nextLine() {
	      String str = "";
	        try{
	            str = br.readLine();
	        } catch (IOException e) {
	            e.printStackTrace();
	        }
	        return str;
	      }
	  }
}


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

using namespace std;

#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define mp make_pair
#define fi first
#define se second

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

lli n, h[800005], v[800005], lh[800005], lv[800005];

lli queryh(lli pos, lli l, lli r, lli x) {
	lli m = (l + r) / 2;
	if (lh[pos] < n) {
		h[pos] = min(h[pos], lh[pos]);
		if (l < r) {
			lh[(2 * pos) + 1] = min(lh[(2 * pos) + 1], lh[pos]);
			lh[(2 * pos) + 2] = min(lh[(2 * pos) + 2], lh[pos]);
		}
		lh[pos] = n;
	}
	if (l == r)
		return h[pos];
	if (x > m)
		return queryh((2 * pos) + 2, m + 1, r, x);
	return queryh((2 * pos) + 1, l, m, x);
}

lli queryv(lli pos, lli l, lli r, lli x) {
	lli m = (l + r) / 2;
	if (lv[pos] < n) {
		v[pos] = min(v[pos], lv[pos]);
		if (l < r) {
			lv[(2 * pos) + 1] = min(lv[(2 * pos) + 1], lv[pos]);
			lv[(2 * pos) + 2] = min(lv[(2 * pos) + 2], lv[pos]);
		}
		lv[pos] = n;
	}
	if (l == r)
		return v[pos];
	if (x > m)
		return queryv((2 * pos) + 2, m + 1, r, x);
	return queryv((2 * pos) + 1, l, m, x);
}

void updateh(lli pos, lli l, lli r, lli ql, lli qr, lli x) {
	lli m = (l + r) / 2;
	if (lh[pos] < n) {
		h[pos] = min(h[pos], lh[pos]);
		if (l < r) {
			lh[(2 * pos) + 1] = min(lh[(2 * pos) + 1], lh[pos]);
			lh[(2 * pos) + 2] = min(lh[(2 * pos) + 2], lh[pos]);
		}
		lh[pos] = n;
	}
	if ((r < ql) || (l > qr))
		return;
	if ((ql <= l) && (r <= qr)) {
		h[pos] = min(h[pos], x);
		if (l < r) {
			lh[(2 * pos) + 1] = min(lh[(2 * pos) + 1], x);
			lh[(2 * pos) + 2] = min(lh[(2 * pos) + 2], x);
		}
		return;
	}
	if (l < r) {
		updateh((2 * pos) + 1, l, m, ql, qr, x);
		updateh((2 * pos) + 2, m + 1, r, ql, qr, x);
	}
}

void updatev(lli pos, lli l, lli r, lli ql, lli qr, lli x) {
	lli m = (l + r) / 2;
	if (lv[pos] < n) {
		v[pos] = min(v[pos], lv[pos]);
		if (l < r) {
			lv[(2 * pos) + 1] = min(lv[(2 * pos) + 1], lv[pos]);
			lv[(2 * pos) + 2] = min(lv[(2 * pos) + 2], lv[pos]);
		}
		lv[pos] = n;
	}
	if ((r < ql) || (l > qr))
		return;
	if ((ql <= l) && (r <= qr)) {
		v[pos] = min(v[pos], x);
		if (l < r) {
			lv[(2 * pos) + 1] = min(lv[(2 * pos) + 1], x);
			lv[(2 * pos) + 2] = min(lv[(2 * pos) + 2], x);
		}
		return;
	}
	if (l < r) {
		updatev((2 * pos) + 1, l, m, ql, qr, x);
		updatev((2 * pos) + 2, m + 1, r, ql, qr, x);
	}
}

int main() {
	lli q, ans, a, b;
	scanf("%lld %lld", &n, &q);
	ans = (n - 2) * (n - 2);
	for (int i = 0; i < 800001; i++)
		h[i] = v[i] = lh[i] = lv[i] = n;
	while (q--) {
		scanf("%lld %lld", &a, &b);
		if (a == 1) {
			a = queryh(0, 2, n - 1, b);
			updatev(0, 2, n - 1, 2, a - 1, b);
		}
		else {
			a = queryv(0, 2, n - 1, b);
			updateh(0, 2, n - 1, 2, a - 1, b);
		}
		ans -= (a - 2);
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 28816
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
using Graph = vector<vector<int>>;

int main(){
  int n;
  cin >>n;
  int m=min(2*n,100003);
  vector<bool> IsPrime(m,true);
  IsPrime[0] = false;
  IsPrime[1] = false;
  for(int i=2; i<=m; ++i){
    if(IsPrime[i]){
      for(int j=2; i*j<=m; ++j) IsPrime[i*j] = false;
    }
  }
  int i=n;
  while(!IsPrime[i]) i++;
  cout<<i;
}


Measured memory_bytes: 256
object Main extends App {
  println(scala.io.StdIn.readLine.toList.foldLeft(Nil: List[Char]) { (list, char) ⇒
    char match {
      case 'B' ⇒ list match {
        case Nil    ⇒ Nil
        case h :: t ⇒ t
      }
      case _ ⇒ char :: list
    }
  }.reverse.foldRight("") { (char, prev) ⇒ char + prev })
}


Measured memory_bytes: 21460
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
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; }
const int INF=1001001001;
vector<pair<int64_t,int64_t>>prime_factorize(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p; 
}
const int MOD=1000000007;

int main() {
  int64_t A,B,C;
  cin>>A>>B>>C;
  if(A%2==0||B%2==0||C%2==0){cout<<0<<endl;}
  else{cout<<min({A*B,A*C,B*C})<<endl;}
  return 0;
}

Measured memory_bytes: 3564
#include<bits/stdc++.h>
using namespace std;
typedef int64_t ll;
typedef long double ld;
const ll MOD=1000000007;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
long long gcd(long long a,long long b){
    ll gcdmax=max(a,b);
    ll gcdmin=min(a,b);
    while(true){
        if(gcdmax%gcdmin==0)break;
        else gcdmax%=gcdmin;
        swap(gcdmin,gcdmax);
    }
    return gcdmin;
}
ll powerup(ll N,ll P,ll M){
    if(P==0)return 1;
    else if(P%2==0){
        ll t=powerup(N,P/2,M);
        return t*t%M;
    }
    else return N*powerup(N,P-1,M)%M;
}
vector<ll> find_divisor(ll N){
  ll k=1;
  while(k*k<=N){
    k++;
  }
  vector<ll> A(1);
  rep(i,k){
    if(i==1)A.at(0)=1;
    else if(i>=2){
      if(N%i==0)A.push_back(i);
    }
  }
  ll t=0;
  t=A.size();
  rep(i,t){
    if(A.at(t-i-1)*A.at(t-i-1)!=N)A.push_back(N/A.at(t-1-i));
  }
  return A;
}
int main()
{
  ll N,K;
  ll sum=0;
  cin>>N>>K;
  vector<ll> A(N+1);
  rep(i,N+1){
    A.at(i)=(N*i+N-i*(i+1)+1)%MOD;
  }
  for(ll i=K-1;i<=N;i++){
    sum=(sum+A.at(i))%MOD;
  }
  cout<<sum<<endl;
}

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

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

        static void A()
        {
            var N = ReadInt();
            var count = 0.0;
            foreach (var n in Range(1, N + 1))
            {
                if (n % 2 != 0) count++;
            }
            Println(count / N);
        }

        static List<long> ReadLines(long n)
        {
            var l = new List<long>();
            for (long i = 0; i < n; i++)
            {
                l.Add(ReadLong());
            }
            return l;
        }

        static void YESOrNO(bool e) => Println(e ? "YES" : "NO");

        static void YesOrNo(bool e) => Println(e ? "Yes" : "No");

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

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

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

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

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

        static long Gcd(long a, long b) => b == 0 ? a : Gcd(b, a % b);
        static long Lcm(long a, long b) => a / Gcd(a, b) * b;

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

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

            return true;
        }

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

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

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());
        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

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

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



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

//GCD,LCM
ll gcd(ll a, ll b){ return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){ return a/gcd(a,b)*b;}

ll destroy(ll h){
    if(h==1)return 1;
    else return destroy(h/2)*2+1;
}

int main()
{
    ll H,ans=0;
    cin>>H;

    cout<<destroy(H)<<endl;

    return 0;
}

Measured memory_bytes: 256
// Problem : A - Poor
// Contest : AtCoder Beginner Contest 155
// URL : https://atcoder.jp/contests/abc155/tasks/abc155_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/coder3101/cp-editor)

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

#define int long long
#define IOS ios::sync_with_stdio(false);cin.tie(nullptr);
#define endl "\n"
#define debug(x) cerr<<#x<<" = "<<(x)<<endl;

int32_t main()
{
	IOS;
	int t = 1;
	//cin >> t;	
	for(int msi = 1; msi <= t; msi++)
	{
		set<int> s;
		for(int i = 0; i < 3; i++){
			int x; cin >> x;s.insert(x);
		}
		if((int)s.size() == 2){
			cout <<"Yes";
		}else{
			cout <<"No";
		}
	}	
	return 0;
}


Measured memory_bytes: 256
package main

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

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

// Sort
type Val struct {
	id, num int
}
type ByNum []Val

func (a ByNum) Len() int           { return len(a) }
func (a ByNum) Less(i, j int) bool { return a[i].num < a[j].num }
func (a ByNum) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	x1, y1, x2, y2 := sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt()
	diffx, diffy := x2-x1, y2-y1
	x3, y3 := x2-diffy, y2+diffx
	x4, y4 := x3-diffx, y3-diffy

	fmt.Fprintln(wtr, x3, y3, x4, y4)
	wtr.Flush()
}


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

using namespace std;

long long dp[100010][110];
long long v[101];
long long w[101];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n, W;
    cin >> n >> W;

    for(int i = 1; i <= n; i++)
    {
        cin >> w[i] >> v[i];
        dp[w[i]][i] = v[i];
    }

    for(int i=0;i<=W;i++)
    {
        for(int j=1;j<=n;j++)
        {
            if(i>=w[j])dp[i][j]=max(dp[i][j-1],v[j]+dp[i-w[j]][j-1]);
            else dp[i][j]=dp[i][j-1];
        }
    }
    long long res=0;
    for(int i=0;i<=W;i++)
        res=max(res,dp[i][n]);
    cout<<res;

    return 0;
}


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

int main() {

	int n; string s; cin >> n >> s;
	int ans = 0;
	int x = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] == 'I') x++;
		else x--;
		ans = max(ans, x);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3556
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<queue>
#include<string>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>
#include<iomanip>

#define REP(i,n) for(int i=0;i<(n);i++)
#define EPS (1e-7)
#define INF (2e9)
// cout << setprecision(10)

using namespace std;
typedef long long int ll;

string s;
int main(void){
    cin >> s;
    if (s == "ABC") cout << "ARC" << endl;
    else cout << "ABC" << endl;
    return 0;
}



Measured memory_bytes: 3592
import java.util.Scanner;
import java.util.ArrayList;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		ArrayList<String> b = new ArrayList<String>();
		for(int i=0 ; i<a.length() ; i++) {
			if(a.charAt(i) == '0') {
				b.add(a.substring(i, i+1));
			}
			else if(a.charAt(i) == '1') {
				b.add(a.substring(i, i+1));
			}
			else if(!b.isEmpty()) {
				b.remove((b.size()-1));
			}
		}
		for(int i=0 ; i<b.size() ; i++) {
			System.out.print(b.get(i));
		}
		System.out.println("");
	}
}

Measured memory_bytes: 21844
import java.util.Scanner;
class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int n = sc.nextInt();
	int[] T = new int[n];
	for(int i = 0;i < n;i++){
	    T[i] = sc.nextInt();
	}
	int r = sc.nextInt();
	for(int i = 0;i < r;i++){
	    int v = sc.nextInt();
	    boolean flag = solve(T,0,v);
	    System.out.println(flag ? "yes":"no");
	}
    }

    public static boolean solve(int[] T,int k,int m){
	if(m == 0){
	    return true;
	}
	if(m < 0 || k >= T.length){
	    return false;
	}
	return solve(T,k+1,m) || solve(T,k+1,m-T[k]);
        
    }
}



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

int main() {
  int a,b;
  cin >> a;
  cin >> b;
  vector<string> arr(2);
  for (int i=0;i<a;i++){
    string B = to_string(b);
  	arr.at(0) += B;
  }
  for (int i=0;i<b;i++){
    string A = to_string(a);
  	arr.at(1) += A;
  }
  if (arr.at(0) < arr.at(1)) cout << arr.at(0);
  else cout << arr.at(1);
  
}

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

const int MX =  1000000007;

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

int main(){
    int m,n;
    cin >> m >> n;
    mint ans = mint(m).pow(n);
    cout << ans.x << endl;
}


Measured memory_bytes: 3108
//have fun
#include <bits/stdc++.h>
using namespace std;
#define mod 		1000000007
#define ll 		long long
#define mp 		make_pair
#define pb 		push_back
#define forn(i,n) 	for(int i=0;i<n;i++)
#define for1(i,n) 	for(int i=1;i<n;i++)
#define ford(i,n) 	for(int i=n-1;i>=0;i--)
#define vi 		vector<int>
#define vl 		vector<ll>
#define pii 		pair<int,int>
#define pll 		pair<ll,ll>
#define vpi 		vector<pair<int,int> >
#define vpl		vector<pair<ll,ll> >
#define vvi 		vector<vector<int> >
#define vvl 		vector<vector<ll> >
#define ull 		unsigned long long
#define IOS 		ios_base::sync_with_stdio(false);
#define PI 		3.1415926535897932384626
#define ff 		first
#define ss 		second
#define char2Int(c) 	(c-'0')
#define FOREACH(i,t) 	for (auto i=t.begin(); i!=t.end(); i++)
#define clr(a,x) 	memset(a,x,sizeof(a)) //set elements of array to some value
#define all(x)		(x).begin(),(x).end()//cout<<"Case #"<<zzz<<": ";
int dp[(int)1e5+1];
vvi edge;
int dfs(int x)
{
    if(dp[x]!=-1)return dp[x];
    forn(i,edge[x].size())
    {
        dp[x]=max(dp[x],dfs(edge[x][i]));
    }
    ++dp[x];
    return dp[x];
}
int main()
{
    IOS;cin.tie(NULL);
    int zz=1;
    for(int zzz=1;zzz<=zz;zzz++)
    {
        int n,m;cin>>n>>m;
        forn(i,n+1)dp[i]=-1;
        edge.resize(n+1);
        forn(i,m)
        {
            int x,y;cin>>x>>y;edge[x].pb(y);
        }
        int ans=0;
        for1(i,n+1)
        {
            if(dp[i]==-1)
            {
                ans=max(ans,dfs(i));
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 7552
import sys
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())
if v<=w:
    print('NO')
    sys.exit()
else:
    d=abs(a-b)
    s=v-w
    if d<=t*s:
        print('YES')
        sys.exit()
print('NO')

Measured memory_bytes: 9072
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rrep(i,n) for(ll i = 1; i <= (n); ++i)
#define drep(i,n) for(ll i = (n)-1; i >= 0; --i)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (ll)(x).size()
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
ll gcd(ll a,ll b){if(a%b==0){return b;}else{return(gcd(b,a%b));}}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const int INF=1e9;
const ll MX = 1e18;
const ll MOD=INF+7;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};
const double PI=acos(-1);
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
#define YN {puts("YES");}else{puts("NO");}
const ll MAX = 1000001;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {fac[0] = fac[1] = 1;finv[0] = finv[1] = 1;inv[1] = 1;for (ll 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;}}
long long COM(ll n, ll k){if (n < k) return 0;if (n < 0 || k < 0) return 0;return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;}
ll llpow(ll n,ll i){ll cnt=n;  for(ll j=0;j<i-1;j++){n*=cnt;}return n;}

int main() {
  string s;
  cin>>s;
  cout<<s[0]<<len(s)-2<<s[len(s)-1]<<endl;
}


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

int asc(const void *a, const void *b) {
  return *(char *)a - *(char *)b;
}

int desc(const void *a, const void *b) {
  return *(char *)b - *(char *)a;
}

int main() {
  char str_a[101], str_b[101];
  scanf("%s", str_a);
  scanf("%s", str_b);
  qsort(str_a, strlen(str_a), sizeof(char), asc);
  qsort(str_b, strlen(str_b), sizeof(char), desc);
  if(strcmp(str_a, str_b) < 0) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }
  return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;


public class Main { 
    public static void main(String[] args) {
       Scanner sc = new Scanner(System.in);
       int n = sc.nextInt();
       int m = sc.nextInt();
      
       int [] [] Arr1 = new int [n] [m];
       int [] [] Arr2 = new int [m][1];
       for(int j =0; j<n;j++){
           for(int i = 0; i<m; i++){
           Arr1 [j][i] = sc.nextInt();
           }
       }
       for(int i = 0; i<m; i++){
       Arr2[i][0] = sc.nextInt();
       }
       

       for(int j = 0; j<n; j++){
       int M = 0;
           for(int i = 0; i<m;i++){
           M = M +Arr2[i][0] * Arr1[j][i];}
       System.out.println(M);
       }
}}



Measured memory_bytes: 40436
from math import ceil,floor,comb,factorial,gcd,pow,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

k = INT()
s = list('00000000000')

for i in range(k):
    for j in range(len(s)):
        if s[j] != '9' and ( int("".join(s[j+1:])) == 0 or int(s[j]) < int(s[j+1]) + 1 ):
            s[j] = str(int(s[j]) + 1)
        else:
            continue

        while j > 0:
            j -= 1
            s[j] = str(max(0, int(s[j+1])-1))
        break

ans = int("".join(reversed(s)))
print(ans)

Measured memory_bytes: 9896
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>
using namespace std;
#define int long  long int
#define ll long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

signed main() {
	int H, N;
	cin >> H >> N;
	int sum = 0;
	rep(i, N) {
		int num;
		cin >> num;
		sum += num;
	}
	if (sum >= H)cout << "Yes";
	else cout << "No";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n; cin >> n;
	vector<ll> v;
	for(ll i = 0; i < n; ++i){
		ll x; cin >> x;
		v.push_back(x);
	}
	ll cnt = 0;
	for(ll i = 0; i < n; ++i){
		if(v[i] != i + 1) continue;
		if(i < n - 1)swap(v[i],v[i + 1]);
		else swap(v[i],v[i - 1]);
		cnt++;
	}
	cout << cnt << endl;
}

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

int main()
{
	int n, d = 0;
	int a[100];

	cin >> n;

	for (int i = 0; i < n; i++)
		cin >> a[i];

	sort(a, a + n, greater<int>());

	for (int i = 0; i < n; i++) {
		if (i % 2 == 0)
			d += a[i];
		else
			d -= a[i];
	}

	cout << d << endl;

	return 0;
}

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

int main() {
    int n, b, f, r, v;
    int num[4][3][10];
    for(b=0; b<4; b++){
        for(f=0; f<3; f++){
            for(r=0; r<10; r++){
                num[b][f][r]=0;
            }
        }
    }
    cin >> n;
    for(int i=0; i<n; i++){
        cin >> b >> f >> r >> v;
        num[b-1][f-1][r-1] += v;
    }
    for(b=0; b<4; b++){
        for(f=0; f<3; f++){
            for(r=0; r<10; r++){
                cout << " " << num[b][f][r];
            }
            cout << endl;
        }
        if(b<3){
            cout << "####################" << endl;
        }
    }
    return 0;
}

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

bool sortbysec(const pair<int, int> &x, const pair<int, int> &y){
    return x.second < y.second;
}

int main(){
    int n, m = 0, t, l, sum = 0;
    string res;
    cin >> n;
    vector<pair<int, int> > p;
    for (int i = 0; i < n; i ++){
        cin >> t >> l;
        sum += t;
        if (l > m) m = l;
        p.push_back(make_pair(t, l));
    }

    if (sum > m){
        res = "No";
        cout << res << endl;
        return 0;
    }
    sort(p.begin(), p.end(), sortbysec);
    sum = 0;

    for (int i = 0; i < n; i++){
        sum += p[i].first;
        if (sum > p[i].second){
            res = "No";
            cout << res << endl;
            return 0;
        }
    }
    res = "Yes";
    cout << res << endl;
    return 0;




}


Measured memory_bytes: 2548
#include <bits/stdc++.h>
#define i_love_u_Phuong ios_base::sync_with_stdio(0); cin.tie(0);

using ll = long long;
using namespace std;
typedef pair<int,ll> pii;
map<int,int> mp;

int main()
{
#ifndef RICARDO
    //freopen("input.txt", "r", stdin);
#endif // ONLINE_JUDGE
    i_love_u_Phuong;
    int n;
    cin >> n;
    int d2=0,d4=0,other=0;
    while (n--)
    {
        int k;
        cin >> k;
        k%=4;
        if (k==2) d2++; else
        if (k==0) d4++; else
        other++;
    }
   	if (d2>0) other++;
    if ( d4+1 >=other) cout << "Yes"; else cout << "No";
    return 0;
}



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

class Program
{
    static void Main(string[] args)
    {
        var N = long.Parse(Console.ReadLine());

        int count = GetCount("0", N);
        Console.WriteLine(count);

    }

    static int GetCount(string current, long N)
    {
        if (long.Parse(current) > N)
        {
            return 0;
        }

        var targets = new String[] { "7", "5", "3" };
        int count = 0;

        bool found = true;
        foreach (var ch in targets)
        {
            if (!current.Contains(ch))
            {
                found = false;
                break;
            }
        }

        if (found)
        {
            count++;
        }

        foreach (var ch in targets)
        {
            int currentCount = GetCount(current + ch, N);
            count += currentCount;
        }

        return count;
    }

}



Measured memory_bytes: 17232
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val s = readLine()!!

    val wsum = Array(n + 1) { 0 }
    val bsum = Array(n + 1) { 0 }

    for (i in 0 until n) {
        wsum[i + 1] = wsum[i] + (if (s[i] == '.') 1 else 0)
        bsum[i + 1] = bsum[i] + (if (s[i] == '#') 1 else 0)
    }

    var ans = Int.MAX_VALUE
    for (left in 0..n) {
        var tmp = 0
        tmp += bsum[left] - bsum[0]
        tmp += wsum[n] - wsum[left]

        ans = Math.min(ans, tmp)
    }

    println(ans)
}

Measured memory_bytes: 41160
#include <iostream>
#include <cstdint>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <iomanip>
#include <sstream>

int main(void)
{
    int64_t L, R;
    std::cin >> L >> R;

    int64_t l = L;
    int64_t r = R;

    if (R-L >= 2019) r = l+2019;

    std::vector<int64_t> mods;
    for (int64_t i = l; i <= r; ++i) {
        mods.push_back(i % 2019);
    }

    int64_t min = INT64_MAX;
    for (int64_t i = 0; i < mods.size()-1; ++i) {
        for (int64_t j = i+1; j < mods.size(); ++j) {
            min = std::min(min, (mods.at(i)*mods.at(j))%2019);
        }
    }
    std::cout << min << std::endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template <class T> void read(T &x){ x = 0; int f = 1; char ch = getchar(); while(ch < '0' || ch > '9'){ if(ch == '-') f = -1; ch = getchar(); } while(ch >= '0' && ch <= '9') x = (x << 3) + (x << 1) + ch - '0', ch = getchar(); x *= f; }

const int MAXN = 110000;
const int INF = 0x3f3f3f3f;
const int mod = 1e9 + 7;
char s[MAXN], t[MAXN], h[MAXN];
int p1[MAXN], p2[MAXN], v[MAXN];
int n;

struct Node{ int a, b;
	bool operator < (const Node &t) const { return a < t.a; }
}p[MAXN];

int Calc(int r, int a, int b){
//	printf("r:%d a:%d b:%d\n", r, a, b);
	int rnt = min(r, n - r) + n;
	if(b <= r) rnt = min(rnt, r + 2 * a);
	else rnt = min(rnt, 2 * (a + b) - r);
	r = n - r;
	if(a <= r) rnt = min(rnt, r + 2 * b);
	else rnt = min(rnt, 2 * (a + b) - r);
	return rnt;
}

int Solve(int rot){
	memset(p1, 0, sizeof(p1));
	memset(p2, 0, sizeof(p2));
	memset(v, 0, sizeof(v));
	
	for(int i = 0; i < n; ++ i) t[i] = h[(i + rot) % n];
	
	int cnt = 0, L, R;
	for(int i = 0; i < n; ++ i) cnt += (s[i] == '1' && t[i] == '0');
	
	for(int i = n - 1; i >= 0; -- i) if(s[i] == '1') L = i;
	for(int i = 0; i < n; ++ i) if(s[i] == '1') R = i;
	p1[0] = R - n, p2[n - 1] = n + L;
	if(s[0] == '1') p1[0] = 0;
	if(s[n - 1] == '1') p2[n - 1] = n - 1;
	for(int i = 1; i < n; ++ i) 
		p1[i] = s[i] == '1' ? i : p1[i - 1];
	for(int i = n - 2; i >= 0; -- i) 
		p2[i] = s[i] == '1' ? i : p2[i + 1];
	
	int q = 0;
	for(int i = 0; i < n; ++ i)
		if(t[i] == '1' && s[i] == '0'){
			p[++ q].a = i - p1[i],
			p[q].b = p2[i] - i;
		}
	sort(p + 1, p + q + 1);
	for(int i = q; i >= 1; -- i) v[i] = max(v[i + 1], p[i].b);
	
	int rnt = INF;
	for(int i = 0; i <= q; ++ i){
		int a = p[i].a, b = v[i + 1];
		rnt = min(rnt, Calc(rot, a, b));
	}
	return rnt + cnt + q;
}

int Check(char *s){
	int rnt = 0;
	for(int i = 0; i < n; ++ i) rnt += (s[i] == '1');
	return rnt;
}

int main(){
	scanf("%s%s", &h, &s);
	n = strlen(s);
	
	if(Check(h) == 0 && Check(s) == 0) return puts("0"), 0;
	else if(Check(s) == 0) return puts("-1"), 0;
	
	int ans = INF;
	for(int i = 0; i < n; ++ i) ans = min(ans, Solve(i));
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 1664
def check(s):
  n=len(s)
  if s!=s[::-1]:
    return "No"
  temp=s[:(n-1)//2]
  if temp!=temp[::-1]:
    return "No"
  temp=s[((n+3)//2)-1:]
  if temp!=temp[::-1]:
    return "No"
  return "Yes"
s=input()
print(check(s))

Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define IO ios::sync_with_stdio(0), cin.tie(0)
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 5;
const int inf = ~0u >> 1;
int main() {
    IO;
    int a, b;
    cin >> a >> b;
    cout << a * b << endl;
    return 0;
}

Measured memory_bytes: 3548
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n,k,i,c=0,mx=0,d=0;
    cin>>k>>n;
    long long int a[n+3];
    for(i=0; i<n; i++)
    {
        cin>>a[i];
    }
    mx=k-a[n-1]+a[0];
    for(i=0; i+1<n; i++)
    {
        d=a[i+1]-a[i];
        mx=max(mx,d);
    }
    c=k-mx;
    cout<<c<<endl;


}


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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
// #define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };




void solve() {
    int a, b, c; cin >> a >> b >> c;
    cout << max(c - (a-b), 0) << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
#define nl "\n" 
#define pb push_back
#define sz(a) (int)a.size()

const int INF=1e9+7;

void solve(){
	int n,k;
	cin >> n >> k;
	int h[n];
	for(int i=0;i<n;++i) cin >> h[i];
	vi dp(n,INF);
	dp[0]=0;
	for(int i=1;i<n;++i){
		for(int j=i-1;j>=i-k && j>=0;--j){
			dp[i]=min(dp[i],dp[j]+abs(h[i]-h[j]));
		}
	}
	cout << dp[n-1] << nl;
}
			
		

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);

	solve();
	
	return 0;
}







Measured memory_bytes: 4000
#include <algorithm>
#include <cassert>
// #include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
// #include <random>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
/*
unsigned seed1 = std::chrono::system_clock::now().time_since_epoch().count();
mt19937 g1.seed(seed1);
*/
using namespace std;

typedef unsigned long ul;
typedef pair<ul, ul> P;
map<int, int> dp;
#define REP(i,n) for(int i=0;i<n;i++)

int N, M;


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

    cin >> N >> M;
        cout << (N-1)*(M-1)<<  endl;

}

Measured memory_bytes: 888
#include <algorithm>
#include <cmath>
#include <complex>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#include <functional>
#include <cstring>
#include <regex>
#include <random>
#include <cassert>
#include <stack>
#include <climits>
#include <chrono>
using namespace std;

#pragma region

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, s, n) for (int i = (s); i < (int)(n); i++)
#define revrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define revrepr(i, s, n) for (int i = (n) - 1; i >= s; i--)
#define debug(x) cerr << #x << ": " << x << "\n"
#define popcnt(x) __builtin_popcount(x)

const double PI = acos(-1.0);

using ll = long long;
using P = pair<int, int>;

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

template<class T>
istream& operator >>(istream &is, vector<T> &v) {
    for (int i = 0; i < (int)v.size(); i++) cin >> v.at(i);
    return is;
}

template<class T, class U>
ostream& operator <<(ostream &os, pair<T, U> p) {
    cout << '(' << p.first << ", " << p.second << ')';
    return os;
}

template<class T>
void print(const vector<T> &v, const string &delimiter = " ") { rep(i, v.size()) cout << (0 < i ? delimiter : "") << v.at(i); cout << endl; }

template<class T>
void print(const vector<vector<T>> &vv, const string &delimiter) { for (const auto &v: vv) print(v, delimiter); }

#pragma endregion


int main() {
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    cin >> a;

    ll ng = 0;
    ll ok = 1000000000;

    auto is_ok = [&](int x){
        ll cnt = 0;
        rep(i, n) {
            cnt += (a[i] + x - 1) / x - 1;
        }
        return cnt <= k;
    };

    while (abs(ok - ng) > 1) {
        ll mid = (ok + ng) / 2;

        if (is_ok(mid)) ok = mid;
        else ng = mid;
    }

    cout << ok << endl;
}

Measured memory_bytes: 3984
#include <iostream>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;

int main(){
    int n;
    int d;
    int i=1;
    cin >> n >> d;
    while(i*(2*d+1)<n){
        i++;
    }
    cout << i << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>
#include<iomanip>

#define MOD 1e9+7;
#define INF 1e17+9;
#define PI acos(-1);

using namespace std;

int main() {
	long long n,a,b;
	cin >> n >> a >> b;
	long long ans = (n-2)*(b-a)+1;
	if(ans<0)ans=0;
	cout << ans << endl;
	return 0;
}



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

using namespace std;

#define INF (1 << 30)
#define INFL (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define EPS 1e-10

using ll = long long;
using ull = unsigned long long;

int main() {
    int n, maxv = 0;
    string s;
    map<string, int> mp;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> s;
        mp[s]++;
        maxv = max(maxv, mp[s]);
    }
    vector<string> ans;
    for (auto t : mp) {
        if (t.second == maxv) {
            ans.push_back(t.first);
        }
    }
    sort(ans.begin(), ans.end());
    for (auto t : ans) {
        cout << t << endl;
    }

    return 0;
}

Measured memory_bytes: 26868
fun readInts() = readLine()!!.split(' ').map(String::toInt)

fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val aa = readInts()
    val bb = IntArray(n)
    (n - 1 downTo 0).forEach {
        val i = it + 1
        val sum = (i + i - 1 until n step i).map { bb[it] }.sum()
        if (sum % 2 != aa[it]) {
            bb[it] = 1
        }
    }
    println(bb.count { it == 1 })
    bb.forEachIndexed { i, e ->
        if (e == 0) return@forEachIndexed
        print(i + 1)
        if (i != bb.size - 1) {
            print(' ')
        }
    }
}


Measured memory_bytes: 84340
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(final String[] args) {
        final FastScanner scanner = new FastScanner(System.in);
        final int a = scanner.nextInt();
        System.out.println(a + a * a + a * a * a);
    }

    private static class FastScanner {
        private final BufferedReader reader;
        private StringTokenizer tokenizer;

        FastScanner(final InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

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

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

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

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

            return tokenizer.nextToken("\n");
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}
    

Measured memory_bytes: 32608
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1 << 30;
const double PI = acos(-1.0);
#define MOD 1000000007LL
#define endl "\n"

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  srand((unsigned)time(NULL));
  ll N, K;
  cin >> N >> K;
  vll A(N);
  for(int i = 0; i < N; i++){
    cin >> A.at(i);
  }
  ll num = N - K;
  for(int i = K; i < N; i++){
    if(A.at(i) > A.at(i-K)) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}

Measured memory_bytes: 4760
// #pragma GCC target("avx")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
// #define BEGIN_STACK_EXTEND(size) void * stack_extend_memory_ = malloc(size);void * stack_extend_origin_memory_;char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);*stack_extend_dummy_memory_ = 0;asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
// #define END_STACK_EXTEND asm volatile("mov %%rax, %%rsp"::"a"(stack_extend_origin_memory_));free(stack_extend_memory_);

#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<unordered_map>
#include<complex>
using namespace std;
const long long mod=10007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const long double EPS=1e-9;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3100000;
const int UF_SIZE = 3100000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int pw_mod_int(int a,int b,int M){
		if(a<0)return 0;
		if(b<0)return 0;
		int ret=1;
		while(b){
			if(b%2)ret=(long long)ret*a%M;
			a=(long long)a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
	int UF[UF_SIZE];
	void init_UF(int n){
		for(int i=0;i<n;i++)UF[i]=-1;
	}
	int FIND(int a){
		if(UF[a]<0)return a;
		return UF[a]=FIND(UF[a]);
	}
	void UNION(int a,int b){
		a=FIND(a);b=FIND(b);if(a==b)return;
		if(UF[a]>UF[b])swap(a,b);
		UF[a]+=UF[b];UF[b]=a;
	}
}
// ここから編集しろ
int p[110000];
pair<int,int>ev[110000];
int v[110000];
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<a;i++){
		scanf("%d",p+i);
		ev[i]=make_pair(p[i],i);
	}
	std::sort(ev,ev+a);
	reverse(ev,ev+a);
	int ret=0;
	int cur=0;
	for(int i=0;i<a;i++){
		if(ev[i].first==0)break;
		int at=ev[i].second;
		v[at]=1;
		cur++;
		if(at&&v[at-1])cur--;
		if(at+1<a&&v[at+1])cur--;
		if(i==a-1||ev[i].first!=ev[i+1].first){
			ret=max(ret,cur);
		}
	}
	printf("%d\n",ret);
}


Measured memory_bytes: 4328