akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.io.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        int n = sc.nextInt();
        TreeMap<String,Integer> map = new TreeMap<String,Integer>();
        for(int i = 0; i < n; i++){
            String s = sc.next();
            map.put(s,map.getOrDefault(s,0)+1);
        }
        int now = 0;
        ArrayList<String> ans = new ArrayList<>();
        for(Map.Entry<String,Integer> e : map.entrySet()){
            if(now < e.getValue()){
                now = e.getValue();
                ans.clear();
            }else if(now > e.getValue()){
                continue;
            }
            ans.add(e.getKey());
        }
        for(String a : ans){
            pw.println(a);
        }
        pw.flush();
    }

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

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

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

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

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

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

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

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

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


Measured memory_bytes: 56400
#include <bits/stdc++.h>
#define sz(arr) (int)arr.size()

using namespace std;

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

  int ans = 700;
  for (auto e : str) {
    if (e == 'o') ans += 100;
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    
    int N[100], len;
    int i, t;
    
    scanf("%d", &len);
    for(i = 0; i < len; i++){
        scanf("%d", &N[i]);
    }
    
    for(t = len - 1; 0 < t; t--){
        printf("%d ", N[t]);
    }
    
    printf("%d\n", N[0]);
    
    return 0;
    
}

Measured memory_bytes: 596
#include<stdio.h>
	int main(){
      int m,n,count;
      double rest;
      scanf("%d %d",&m,&n);
      rest=m*1.0/n;
      count=m/n;
      if(rest==count){
        printf("%d\n",count);
      }else{
        printf("%d\n",count+1);
      }
      return 0;
    }

Measured memory_bytes: 128
def get_prime_fact(n):
    primes = []
    append = primes.append
    while n % 2 == 0:
        append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        append(n)
    return primes


def get_knu(a):
    before = 1
    n = 2
    while True:
        knum = (n * (n + 1)) // 2
        if a == knum:
            return n
        elif knum > a > before:
            return n - 1
        else:
            n += 1
            before = knum


D = int(input())
p = get_prime_fact(D)

if len(p) != len(set(p)):
    res = 0
    for n in set(p):
        count = p.count(n)
        if count == 1:
            res += 1
        else:
            add = get_knu(count)
            res += add

    print(res)
else:
    print(len(p))

Measured memory_bytes: 9144
N = int(input())
A = list(map(int,input().split()))

temp_max = A[0]
ans = 0
for i in range(1,len(A)):
    if A[i] < temp_max:
        temp_ans = temp_max - A[i]
        ans += temp_ans
    
    else:
        temp_max = A[i]

print(ans)

Measured memory_bytes: 32296
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 100000007
typedef long long ll;
using namespace std;
char c[1010][1010];
int h,w;
char mem[2][2],z[3]={'J','O','I'};
int main(){
  cin>>h>>w;
  lol(i,h)lol(j,w)cin>>c[i][j];
  lol(i,2)lol(j,2)cin>>mem[i][j];
  int cnt=0;
  lol(i,h-1)lol(j,w-1){
    bool ok=true;
    lol(f,2)lol(g,2){
      if(c[i+f][j+g]!=mem[f][g])ok=false;
    }
    if(ok)cnt++;
  }
  int ans=0;
  lol(i,h)lol(j,w){
    lol(k,3){
      int bef=0,aft=0;
      for(int y=max(0,i-1);y<=i&&y+1<h;y++){
	for(int x=max(0,j-1);x<=j&&x+1<w;x++){
	  bool ok=true;
	  lol(f,2)lol(g,2){
	    if(c[y+f][x+g]!=mem[f][g])ok=false;
	  }
	  if(ok)bef++;
	}
      }
      swap(z[k],c[i][j]);
      for(int y=max(0,i-1);y<=i&&y+1<h;y++){
	for(int x=max(0,j-1);x<=j&&x+1<w;x++){
	  bool ok=true;
	  lol(f,2)lol(g,2){
	    if(c[y+f][x+g]!=mem[f][g])ok=false;
	  }
	  if(ok)aft++;
	}
      }
      swap(z[k],c[i][j]);
      ans=max(ans,cnt+aft-bef);
    }
  }
  cout<<ans<<endl;
  return 0;
}

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

int main() {
  int64_t n, k;
  cin >> n >> k;
  int64_t sum = 0;
  int p = 1000000007;
  
  for(int i = k; i <= n+1; i++){
    sum = (sum + (i*(n-i+1) +1) %p) %p;
  }
  
  cout << sum << endl;
  
  return 0;
  
}

Measured memory_bytes: 3628
#D AC
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c = Counter(a)#出現回数を辞書で取り出す
val=0
for i in c.values():#辞書に含まれる値をすべて取り出す
    # print(i)  #1,2,3･･･の回数
    val += i * (i - 1) // 2  #整数が同じボールを選ぶ組み合わせ
    # val+=sum(range(i-1))
for i in range(n):
    b = c[a[i]]  #i番目の出現回数
    print(val - b + 1)  #bを除いたボールから整数が同じボールを選ぶ組み合わせ

Measured memory_bytes: 25900
#include <algorithm> //STLͨ���㷨
#include <cmath> //������ѧ����
#include <cstdio> //��������/�������
#include <iostream> //����������/���
#include <cstring> //�ַ�������
#include <string> //�ַ�����
#include <ctime> //�������ʱ��ĺ���
#define itn int
#define fro for
#define ll long long
#define reg register
#define inf 1234567890
#define rep(i,a,b,c) for (int i=a;i<=b;i+=c)
/*#include <bitset> //STLλ������
#include <cstype> //�ַ�����
#include <cerrno> //���������
#include <complex> //������
#include <clocale> //���屾�ػ�����
#include <cstdlib> //������������ڴ���亯��
#include <deque> //STL˫�˶�������
#include <exception> //�쳣������
#include <fstream> //�ļ�����/���
#include <functional> //STL�������㺯��(���������)
#include <limits> //�����������������ֵ����
#include <list> //STL�����б�����
#include <map> //STLӳ������
#include <iomanip> //����������/���
#include <ios> //��������/���֧��
#include <iosfwd> //����/���ϵͳʹ�õ�ǰ������
#include <istream> //����������
#include <ostream> //���������
#include <queue> //STL��������
#include <set> //STL��������
#include <sstream> //�����ַ�������
#include <stack> //STL��ջ����
#include <stdexcept> //��׼�쳣��
#include <streambuf> //�ײ�����/���֧��
#include <utility> //STLͨ��ģ����
#include <vector> //STL��̬��������
#include <cwchar.h>//���ַ�����������/���
#include <cwctype.h> //���ַ�����*/

using namespace std;

int ans;

int max(int x,int y){return x>y?x:y;}

int min(int x,int y){return x<y?x:y;}

int abs(int x){return x>0?x:-x;}

int gcd(int x,int y){return (!y)?x:gcd(y,x%y);}

void exgcd(int a,int b,int &d,int &x,int &y){if (!b){d=a,x=1,y=0;}else{exgcd(b,a%b,d,y,x);y-=x*(a/b);}}

int quick_power(ll a,int b){ll r=1;for (;b;b>>=1,a=a*a)if (b&1) r=r*a;return r;}

inline char read() {
	static const int IN_LEN = 1000000;
	static char buf[IN_LEN], *s, *t;
	return (s == t ? t = (s = buf) + fread(buf, 1, IN_LEN, stdin), (s == t ? -1 : *s++) : *s++);
}
template<class T>
inline void read(T &x) {
	static bool iosig;
	static char c;
	for (iosig = false, c = read(); !isdigit(c); c = read()) {
		if (c == '-') iosig = true;
		if (c == -1) return;
	}
	for (x = 0; isdigit(c); c = read()) x = x * 10 + (c ^ '0');
	if (iosig) x = -x;
}

char sr[10000000],z[20];int C=-1,Z=0;
void Ot(){fwrite(sr,1,C+1,stdout),C=-1;}
void print(int x){
	if (x<0) sr[++C]='-',x=-x;
    while(z[++Z]=x%10+48,x/=10);
    while(sr[++C]=z[Z],--Z);sr[++C]='\n';
}
//int find(int x){return fa[x]=fa[x]==x?x:find(fa[x]);}

//void add(int x,int y,int z){to[++cnt]=y;v[cnt]=z;Next[cnt]=head[x];head[x]=cnt;}

#define mid (l+r>>1)
int a[2048];

int main()
{
	int n;
	read(n);
	for (int i=1;i<=n;i++) read(a[i]);
	sort(a+1,a+n+1);
	/*
	for (int i=1;i<=n;i++)
		for (int j=i+1;j<=n;j++)
			for (int k=j+1;k<=n;k++)
				if (a[i]+a[j]>a[k]&&a[i]+a[k]>a[j]&&a[j]+a[k]>a[i]) ans++;
	*/
	for (int i=1;i<=n;i++)
	{
		for (int j=i+1;j<=n;j++)
		{
			int l=j+1,r=n;
			int tmp=j;
			while (l<=r)
			{
				if (a[i]+a[j]>a[mid]) tmp=mid,l=mid+1;
				else r=mid-1;
			}
			ans+=tmp-j;
		}
	}
	cout<<ans;
	return 0;
}









Measured memory_bytes: 2432
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;cin>>n;
  int a[n+2];
  for(int i=1;i<=n;i++)cin>>a[i];
  a[0]=0;
  a[n+1]=0;
  int sum=0;
  for(int i=0;i<=n;i++){
    sum+=abs(a[i+1]-a[i]);
  }
  for(int i=1;i<=n;i++){
    int ans=sum;
    ans-=abs(a[i]-a[i-1]);
    ans-=abs(a[i+1]-a[i]);
    ans+=abs(a[i+1]-a[i-1]);
    cout<<ans<<endl;
  }
}

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

int main()
{
  ios::sync_with_stdio(0);
  int n, a[100100];
  cin >> n;
  for (int i = 1; i <= n; i++)
    cin >> a[i];

  int ans = 0;
  for (int i = 1; i < n; i++)
    if (a[i] == i)
    {
      swap(a[i], a[i + 1]);
      ans++;
    }

  if (a[n] == n)
    ans++;

  cout << ans << endl;
}

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

#define int long long
#define ll long long
#define f1(i,a,b) for(int i=a;i<b;i++)
#define f2(i,a,b) for(int i=a;i>=b;i--)
#define endl '\n'
#define pb push_back
#define gp " "
#define ff first
#define ss second
#define mp make_pair
#define ld long double

const int mod = 1000000007;
const ld PI = acosl(-1.0);
ll temp;

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int d, t, s;
    cin>>d>>t>>s;
    if((d + s - 1) / s <= t)
    cout<<"Yes"<<endl;
    else
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <iomanip>
#include <cstdlib>
#include <cctype>
#define ll long long
#define PI 3.14159265358979323846
using namespace std;
const int maxn = 1e6+7;

int main(){
	string str;
	cin>>str;
	/*string::iterator end=str.end();
	end--;
	string::iterator begin=str.begin();
	*/
	ll sum=0;
	for(int i=0,j=str.length()-1;i<str.length()/2;i++){
//		cout<<str[i]<<" "<<str[j]<<endl;
		if(str[i]!=str[j]){
			sum++;
		}
		j--;
	}
	cout<<sum<<endl;
	return 0;
}


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

class Procon
{
    public Procon() { }
    static void Main(string[] agrs)
    {
        new Procon().Do();
    }

    Scanner cin;

    public void Do()
    {
        cin = new Scanner();
        int A = cin.nextInt();
        int B = cin.nextInt();
        int C = cin.nextInt();

        int min = A + B;
        if (A + C < min)
        {
            min = A + C;
        }
        if (B + A < min)
        {
            min = B + A;
        }
        if (B + C < min)
        {
            min = B + C;
        }
        if (C + A < min)
        {
            min = C + A;
        }
        if (C + B < min)
        {
            min = C + B;
        }

        Console.WriteLine(min);
    }

    long calcDenominator(long K)
    {
        long b = 1;
        while (true)
        {
            b *= 2;
            if (b > K)
            {
                break;
            }
        }
        return b;
    }
}

class Scanner
{
    string[] s;
    int i;
    int max_i;

    public Scanner()
    {
        s = new string[0];
        max_i = 0;
        i = 0;
    }

    public string nextString()
    {
        if (i >= s.Length)
        {
            s = Console.ReadLine().Split(' ');
            max_i = s.Length;
            i = 0;
            if (max_i == 0)
            {
                return "";
            }
            return s[i++];
        }
        else
        {
            return s[i++];
        }
    }

    public int nextInt()
    {
        return int.Parse(nextString());
    }

    public long nextLong()
    {
        return long.Parse(nextString());
    }

    public double nextDouble()
    {
        return double.Parse(nextString());
    }

    public string[] arrayString()
    {
        return Console.ReadLine().Split(' ');
    }

    public int[] arrayInt()
    {
        string[] str = Console.ReadLine().Split(' ');
        int[] array = new int[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = int.Parse(str[i]);
        }
        return array;
    }

    public long[] arrayLong()
    {
        string[] str = Console.ReadLine().Split(' ');
        long[] array = new long[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = long.Parse(str[i]);
        }
        return array;
    }

    public double[] arrayDouble()
    {
        string[] str = Console.ReadLine().Split(' ');
        double[] array = new double[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = double.Parse(str[i]);
        }
        return array;
    }
}


Measured memory_bytes: 11092
// 5/18
// 過去問ガリガリ
#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>;
using Graph = vector<vector<int>>;

int main() {
    char C;
    cin >> C;
    
    string alphabet = "abcdefghijklmnopqrstuvwxyz";
    for (int i = 0; i < 25; i++) {
        if (C == alphabet[i]) cout << alphabet[i + 1] << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int high[1000] = {};
    int a, b;


    cin >> a >> b;
    for (int i = 1; i <= 999; i++) {
        high[i] = high[i - 1] + i;
    }

    b -= a;

    for (int i = 2; i <= 999; i++) {
        if (high[i] - high[i - 1] == b) {
            cout << high[i - 1] - a << endl;

            break;
        }
    }


    return 0;
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define MOD 1000000007

typedef long long int ll;

const ll INF=(ll)1e19;
//const int INF=(1<<30);

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

  vector<int> x(N),y(N);
  vector<int> xaxis(N),yaxis(N);


  REP(i,N){
    cin >> x[i] >> y[i];
    xaxis[i] = x[i];
    yaxis[i] = y[i];
  }

  sort(ALL(xaxis));
  sort(ALL(yaxis));

  ll ans = INF;

  REP(xi,N)FOR(xj,xi+1,N)REP(yi,N)FOR(yj,yi+1,N){
    int lx,rx,ly,ry;
    lx=xaxis[xi]; rx=xaxis[xj];
    ly=yaxis[yi]; ry=yaxis[yj];

    int cnt=0;
      REP(i,N){
        if(lx <= x[i] && x[i] <= rx && ly <= y[i] && y[i] <= ry)cnt++;
      }
      if(cnt >= K){
        ans = min(ans, 1LL*(rx-lx)*(ry-ly));
      }
  }

  cout << ans << endl;

}



Measured memory_bytes: 256
<?php
# スペース区切りの整数の入力
fscanf(STDIN, "%d %d", $count, $moto);

$saisho = 0;
$kazu = 0;

for($i =0; $i < $count; $i++) {
  fscanf(STDIN, "%d", $ryo);
  $moto -= $ryo;
  if($saisho > $ryo || $saisho === 0){
    $saisho = $ryo;
  }
  $kazu ++;
}

$kazu += floor($moto / $saisho);

echo($kazu);
?>

Measured memory_bytes: 4604
fn main() {
    let (x, y) = {
        let v = read_vec::<u64>();
        (v[0], v[1])
    };

    println!("{}", solve(x, y));
}

fn solve(x: u64, y: u64) -> u64 {
    let mut cnt: u64 = 1;
    let mut c = x;
    while c <= y {
        if 2 * c <= y {
            cnt += 1;
            c = 2 * c;
            continue;
        }
        break;
    }
    cnt
}

#[test]
fn test1() {
    assert_eq!(solve(3, 20), 3);
}

#[test]
fn test2() {
    assert_eq!(solve(25, 100), 3);
}

#[test]
fn test3() {
    assert_eq!(solve(314159265, 358979323846264338), 31);
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}


Measured memory_bytes: 4352
/// a.cpp

# include <stdio.h>
# include <bits/stdc++.h>
using namespace std;
const pair < int , int > DD[] = {{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};
# define fi cin
# define fo cout
# define x first
# define y second
# define ll long long
# define IOS ios_base :: sync_with_stdio(0);cin.tie(0)
# define p(v) cerr << #v << " = " << v << '\n'
# define p2(v) cerr << #v << " = " << (complex < __typeof(v.x) > (v.x,v.y)) << '\n'
# define vi vector < int >
# define vl vector < ll >
# define pll pair < ll , ll >
# define pii pair < int , int >
# define mp make_pair
# define db long double
# define fail puts("-1")
# define yes puts("YES")
# define no puts("NO")
# define PP puts("Possible")
# define II puts("Impossible")
# define vii vector < pii >
# define vll vector < pll >
# define pb push_back
# define pdd pair < db , db >
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}
int main(void)
{
    #ifdef CF
    freopen("input","r",stdin);
    #endif // CF
    srand(time(0));
    fo << fixed << setprecision(7);
    cerr << fixed << setprecision(7);
    ll n,m;
    fi>>n>>m;
    auto get = [&](ll N,ll M)
    {
        return 1ll * N * M;
    };
    ll ans = 1e18;
    if (n >= 3)
        smin(ans,((bool)(n % 3)) * m);
    if (m >= 3)
        smin(ans,((bool)(m % 3)) * n);
    for (int cs = 0;cs < 2;++cs)
    {
        swap(n,m);
        for (int i = 1;i < n;++i)
            smin(ans,max({1ll * i * m,get(n - i,m / 2),get(n - i,(m + 1) / 2)}) - min({1ll * i * m,get(n - i,m / 2),get(n - i,(m + 1) / 2)}));
    }
    fo << ans << '\n';
    cerr << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
    return 0;
}


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

int main()
{
  int64_t N, ma = 0;
  cin >> N;
  vector<int64_t> X(N), Y(N);
  for (int i = 0; i < N; i++)
  {
    cin >> X.at(i) >> Y.at(i);
  }

  for (int i = 0; i < N; i++)
  {
    for (int j = 0; j < N; j++)
    {
      if (i == j)
        continue;
      int64_t p = X[j] - X[i], q = Y[j] - Y[i], cnt = 0;
      for (int k = 0; k < N; k++)
      {
        for (int l = 0; l < N; l++)
        {
          if (k == l)
            continue;
          if (X[k] + p == X[l] && Y[k] + q == Y[l])
            cnt++;
        }
      }
      ma = max(ma, cnt);
    }
  }
  cout << N - ma << endl;
}

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

using namespace std;
int main() {
	int q;
	scanf("%d", &q);
	while (q--) {
		int a, b;
		scanf("%d %d", &a, &b);
		int r = sqrt(1LL * a * b);
		int res = 2 * r;
		if (1LL * r * r == 1LL * a * b) { // square root not counted
			res -= 2 + (a < r) + (b < r);
		} else if (r * (r + 1LL) >= 1LL * a * b || a == r + 1 || b == r + 1) { // square root counted once
			res -= 1 + (a <= r) + (b <= r);
		} else {
			res -= (a <= r) + (b <= r);
		}
		printf("%d\n", res);
	}
	return 0;
}


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

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

	bool good = true;
	for (int i = 0; i < s.size(); i++) {
		if (i % 2 == 0 && s[i] == 'L' || i % 2 ==1 && s[i] == 'R' ) {
			good = false;
		}		
	}	

	if (good) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repr(i, s, e) for(int i=s; i>=e; i--)
#define reps(i, s, e) for(int i=s; i<e; i++)
#define inf 1e18
#define vsort(v) sort(v.begin(), v.end())
#define vsortr(v) sort(v.begin(), v.end(), greater<ll>())
#define sz(x) x.size()
#define ceil(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T &a, T b){ if(a<b){ a=b; return true; } return false; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a){ a=b; return true; } return false; }
template<typename T> T gcd(T a, T b){ if(b==0) return a; return gcd(b, a%b); }
template<typename T> T lcm(T a, T b){ return a*b/gcd(a, b); }
template<typename T> void vdebug(vector<T> v){ for(auto vv : v){ cout << vv << " "; } cout << endl; }
template<typename T> void adebug(T arr[], int n){ rep(i, n){ cout << arr[i] << " "; } cout << endl; }
void ans(bool b){ if(b) cout << "Yes" << endl; else cout << "No" << endl; }
void ans2(bool b){ if(b) cout << "YES" << endl; else cout << "NO" << endl; }
int keta(ll num){ int k=0; while(num>0){ num/=10; k++; } return k; }
int dx[] = {1, -1, 0, 0, 1, -1, 1, -1};
int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};


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

    int a, b;
    cin >> a >> b;
    
    int res = (a-b*2) > 0 ? a-b*2 : 0;
    cout << res << endl;

    return 0;
}


Measured memory_bytes: 892
def resolve():
    n = int(input())
    A = list(map(int, input().split()))
    sm = sum(A) % (10**9 + 7)

    ans = 0
    for a in A:
        sm -= a
        ans += sm * a
        ans %= (10**9 + 7)
    print(ans)

resolve()

Measured memory_bytes: 31560
n=int(input())
h=list(map(int,input().split()))
ans,flg=0,0
while sum(h)>0:
    for i in range(n):
        if flg==0:
            if h[i]==0:
                continue
            else:
                flg=1
                h[i]-=1
        else:
            if h[i]>0:
                h[i]-=1
            else:
                flg=0
                ans+=1
    if flg==1:
        ans+=1
        flg=0
print(ans)

Measured memory_bytes: 3064
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<algorithm>
using namespace std;
//luoxuejieshihaoren
int a[10];
 int main()
 {
     int p,q,r;
     scanf("%d%d%d",&p,&q,&r);
     a[1]=p;
     a[2]=q;
     a[3]=r;
     sort(a+1,a+4);

     printf("%d\n",a[1]+a[2]);
     return 0;
 }


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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 namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
//const long long MOD = 998244353;
const long long INF = 1LL << 60;


const int MAX_N = 100010;

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	int ma = 0;
	VE a(n);
	rep(i, n) {
		cin >> a[i]; chmax(ma, a[i]);
	}
	int tmp = 0;
	rep(i, n) {
		if(ma!=a[i])chmax(tmp, min(ma - a[i], a[i]));
	}
	rep(i, n) {
		if (ma != a[i] && tmp == min(ma - a[i], a[i])) {
			cout << ma << " " << a[i] << endl; return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 1024
import sys
def input(): return sys.stdin.readline().strip()
sys.setrecursionlimit(10**9)

def main():
    N, M = map(int, input().split())
    repn = [[] for _ in range(N)]
    for _ in range(M):
        a, b = map(int, input().split())
        repn[a - 1].append(b - 1)
        repn[b - 1].append(a - 1)

    visited = [0] * N
    visited[0] = 1
    ans = [0]

    def stroke(u):
        #print("now={}, vis={}".format(u, visited))
        if visited == [1] * N:
            ans[0] += 1
            return
        for v in repn[u]:
            if visited[v] == 1: continue
            visited[v] = 1
            stroke(v)
            visited[v] = 0

    stroke(0)
    print(ans[0])

if __name__ == "__main__":
    main()


Measured memory_bytes: 74840
package main

import (
	"fmt"
	"math"
)

var N, K int

type AB struct {
	A, B int
}

func main() {
	fmt.Scan(&N, &K)

	if N*(N-1)/2-(N-1) < K {
		fmt.Println(-1)
	} else {
		a := make([]AB, 0, N)

		// スター型
		for i := 2; i <= N; i++ {
			a = append(a, AB{1, i})
		}

		cnt := (N - 1) * (N - 2) / 2

		for i := 2; i < N; i++ {
			for j := i + 1; j <= N; j++ {
				if cnt == K {
					break
				}
				a = append(a, AB{i, j})
				cnt--
			}
		}
		fmt.Println(len(a))
		for _, ans := range a {
			fmt.Println(ans.A, ans.B)
		}
	}
}

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

func gcd(x, y uint64) uint64 {
	if x%y == 0 {
		return y
	} else {
		r := x % y
		return gcd(y, r)
	}
}

func combination(x, y int) int {
	return permutation(x, y) / permutation(y, y)
}

func permutation(x, y int) int {
	var ans int = 1
	for i := x - y; 0 < i; i-- {
		ans *= i
	}
	return ans
}

func max(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Max(float64(x[i]), float64(res)))
	}
	return res
}

func min(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Min(float64(x[i]), float64(res)))
	}
	return res
}
func pow(x, y int) int { return int(math.Pow(float64(x), float64(y))) }
func abs(x int) int    { return int(math.Abs(float64(x))) }
func floor(x int) int  { return int(math.Floor(float64(x))) }

type XY struct {
	x int
	y int
}

type SortBy [][]int

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


Measured memory_bytes: 1024
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef long double D;
typedef complex<D> P;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;


template<typename T,typename U>istream & operator >> (istream &i,pair<T,U> &A){i>>A.F>>A.S; return i;}
template<typename T>istream & operator >> (istream &i,vector<T> &A){for(auto &I:A){i>>I;} return i;}
template<typename T,typename U>ostream & operator << (ostream &o,pair<T,U> &A){o<<A.F<<" "<<A.S; return o;}
template<typename T>ostream & operator << (ostream &o,vector<T> &A){ll i=A.size(); for(auto &I:A){o<<I<<(--i?" ":"");} return o;}
template<typename T>vector<T> & cset(vector<T> &A,T e=T()){for(auto &I:A){I=e;} return A;}


int main(){
    ll n,k;
    cin>>n>>k;
    if((n-1)*(n-2)/2<k){cout<<-1<<endl; return 0;}
    if(n==2){cout<<1<<endl<<1<<" "<<2<<endl; return 0;}
    vector<pll> edge;
    for(int i=1;i<n;i++){edge.push_back({0,i});}
    ll cnt=(n-1)*(n-2)/2;
    for(int i=1;i<n;i++){
        for(int j=i+1;j<n;j++){
            if(cnt>k){
                cnt--;
                edge.push_back({i,j});
            }
        }
    }
    cout<<edge.size()<<endl;
    for(auto &I:edge){
        I.F+=1; I.S+=1;
        cout<<I<<endl;
    }
    
    
    return 0;
}


Measured memory_bytes: 512
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner scan = new Scanner(System.in);
        String str = scan.nextLine();
        String str2 = scan.nextLine();

        String c = str2.substring(0, str.length());


        if (str.equals(c)) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

        scan.close();
    }
}

Measured memory_bytes: 26968
#include<iostream>
#include<algorithm>

using namespace std;

int main(){

	int A,B,C,X,Y;
	cin>>A>>B>>C>>X>>Y;

	int minNum = min(X,Y);
	int maxNum = max(X,Y);

	int result = 0;
	if (A+B > 2*C) {
		result += 2*C*minNum;
	} else {
		result += (A+B)*minNum;
	}

	int remainderMoney,remainderNum;
	if (X>Y) {
		remainderMoney = A;
		remainderNum = X - minNum;
	} else {
		remainderMoney = B;
		remainderNum   = Y - minNum;
	}

	
	if (remainderMoney > 2*C) {
		result += 2*C*remainderNum;
	} else {
		result += remainderMoney*remainderNum;
	}

	cout << result << endl;

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
char str[111111];
int mark[111111];
char s[111111];
bool check(int n){
	for(int i=1;i+i<=n;i++){
		if(s[i]!=s[n-i+1])return 0;
	}
	return 1;
}
int main()
{
	scanf("%s",str+1);
	int n=strlen(str+1);
	int step=0;	
	for(int i=1;i<=n;i++){
		if(str[i]=='x')mark[step]++;
		else {
			s[++step]=str[i];
		}
	}
	if(check(step)){
		int l=0,r=step;
		int ans=0;
		while(l<r){
			ans+=abs(mark[l]-mark[r]);
			l++;
			r--;
		}
		printf("%d\n",ans);
	}
	else printf("-1\n");
	return 0;
}

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

int main() {
    int n; cin >> n;
    vector<double> p(n);
    for(int i = 0; i < n; ++i) {
        cin >> p[i];
    }

    vector<double> dp(n + 1);
    dp[0] = 1;
    for(int i = 0; i < n; ++i) {
        vector<double> nxt(n + 1);
        for(int j = 0; j < n; ++j) {
            nxt[j + 1] += dp[j] * p[i];
            nxt[j] += dp[j] * (1 - p[i]);
        }
        dp = move(nxt);
    }

    double ans = 0;
    for(int i = (n + 1) / 2; i <= n; ++i) {
        ans += dp[i];
    }

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  int score=0;
  for(int i=0; i<n-1; i++){
    if(s.at(i) == s.at(i+1)) score++;
  }
  if(score+2*k < n-1){
    cout << score+2*k << endl;
  }else{
    cout << n-1 << endl;
  }
  return 0;
}


Measured memory_bytes: 512
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cctype>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include <cstdio>
#include <numeric>
#include <functional>
#include <cstdlib>
#include <regex>
#include <list>
int main() {
	int a;
	std::cin >> a;
	if (a % 111 == 0) {
		std::cout << a << std::endl;
	}
	else {
		std::cout << (a / 111 + 1) * 111 << std::endl;
	}
		return 0;
	
}



Measured memory_bytes: 256
a = 5.times.map{gets.to_i}
if a.map{|v|v % 10}.all?{|v|v == 0}
    puts a.inject(&:+)
else
	puts a.map{|v|((v + 9) / 10) * 10}.inject(&:+) + a.map{|v|v % 10}.delete_if{|v|v == 0}.min - 10
end

Measured memory_bytes: 1788
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define all(a) (a).begin(), (a).end()
 
 
int main() {
  int X, A, B;
  cin >> X >> A >> B;
  cout << (X -A) % B << endl;
}

Measured memory_bytes: 256
n, K = map(int, input().split())
MOD = 10**9+7
ans = 0
for k in range(K, n+2):
    L = k*(k-1)//2
    R = (n+n-k+1)*k//2
    ans += (R-L+1)%MOD
    ans %= MOD
print(ans)

Measured memory_bytes: 63688
#include <bits/stdc++.h>
using namespace std;
int n,a[200001];
long long pre[200001],ans=0x3f3f3f3f3f3f3f3f;
long long sum;
void check(int x,pair<int,int> &ret) {
    int low=1,high=x-1;
    while (low!=high) {
        int med=(low+high)/2;
        if (pre[med]<pre[x]-pre[med]) low=med+1;
        else high=med;
    }
    if (low!=1 and abs(pre[x]-pre[low]-pre[low])>abs(pre[x]-pre[low-1]-pre[low-1])) low--;
    ret.first=low;
    low=x+1; high=n-1;
    while (low!=high) {
        int med=(low+high)/2;
        if (pre[med]-pre[x]<pre[n]-pre[med]) low=med+1;
        else high=med;
    }
    if (low!=x+1 and abs(pre[n]-pre[low]-pre[low]+pre[x])>abs(pre[n]-pre[low-1]-pre[low-1]+pre[x])) low--;
    ret.second=low;
}
int main() {
    cin>>n;
    for (int i=1; i<=n; i++) {
        cin>>a[i];
        pre[i]=pre[i-1]+a[i];
    }
    for (int i=2; i<=n-2; i++) {
        pair<int,int> x;
        check(i,x);
        long long b=pre[x.first],c=pre[i]-pre[x.first],d=pre[x.second]-pre[i],e=pre[n]-pre[x.second];
        long long mx=max(max(b,c),max(d,e)),mn=min(min(b,c),min(d,e));
        ans=min(ans,mx-mn);
    }
    cout<<ans<<'\n';
}

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

int main(){
  int a, b;
  cin >> a >> b;
  
  if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0) {
    cout << "Possible" << endl;
  } else {
    cout << "Impossible" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int k, s, z , count=0;
    cin >> k>> s;
    for (int x= 0; x<=k; x++){
        for (int y=0;y<=k ; y++ ){
            z=s-x-y;
            if(z>=0 && z<=k){
                count++;

            }
        }
    }
    cout << count;

    return 0;
}


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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)

typedef long long i64;
typedef pair<i64,i64> P;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }


int n,m,a[101010];

int main(){
	cin >> m >> n;
	i64 ans = 0;
	for(int i = 0; i < n; i++){
		cin >> a[i];
		ans+= a[i];
	}
	
	if(ans >= m){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
	
	return 0;
}

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

int main(){
    int i;

    cin >> i;

    if( ( i % 10 ) == 7 ||
        ( i / 100 ) == 7 ||
        ( ( i % 100 ) / 10 ) == 7
    ){
        cout << "Yes\n";
    }
    else{
        cout << "No\n";
    }
}

Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include<cstring>
#include<cstdlib>
#include<string>
#include<algorithm>
#include <iomanip>
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef double db;
typedef vector<db> vdb;
#define INF 10000000000
int main() {
	ll n, e, t;
	cin >> n >> e >> t;
	vl x(n + 10, 0);
	for (int i = 1; i <= n; i++) {
		cin >> x[i];
	}
	int l = 0;
	vi p(n + 1);
	for (int i = 0; i <= n; i++) {
		while ((x[i] - x[l]) * 2 > t)l++;
		p[i] = l;
	}
	vl dp(n + 10, INF);
	dp[0] = e;
	vl dp2(n + 10, INF);
	dp2[0] = INF; dp2[1] = INF; dp2[2] = e-2*x[1];
	for (int i = 1; i <= n; i++) {
		ll mi = INF;
		dp[i] = dp[max(0,p[i]-1)] + t;
		/*for (int j = 0; j+1<p[i]; j++) {
			mi = min(mi, dp[j] -2 *  x[j + 1]);
		}*/
		mi = dp2[p[i]];
		dp[i] = min(dp[i],mi+2*x[i]);
		dp2[i + 2] = min(dp2[i + 1], dp[i] - 2 * x[i + 1]);
		/*for (int i = 0; i <= n; i++) {
		cout << dp[i] << " ";
		}cout << endl;*/
	}
	cout << dp[n] << endl;
	return 0;

}



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

typedef long long ll;

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

    string s;
    cin >> s;
    for(int i=0;i<s.size()-8;i++) cout << s[i];
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
/**
 *   author: malviyanshiv
 *   created: 10 August 2019  18:30:17
**/

#include <bits/stdc++.h>

using namespace std;

#define REP(i, a, b) for(int i = a; i < b; i++)
#define RREP(i, a, b) for(int i = a-1; i >= b; i--)
#define FORE(a) for(auto ele : a )
#define ALL(a) begin(a), end(a)
#define RPB(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define PB push_back
#define MP make_pair
#define MOD 1000000007
#define INF 0x7fffffff
#define LINF 2000000000000000007
#define F first
#define S second
#define TC int t; cin >> t; while(t--)
#define SET(a,b) memset(a,b,sizeof(a))

#define TRACE

#ifdef TRACE
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

#else

#define trace1(x)
#define trace2(x, y)
#define trace3(x, y, z)
#define trace4(a, b, c, d)
#define trace5(a, b, c, d, e)
#define trace6(a, b, c, d, e, f)

#endif

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


void optimizeIO(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
}

#define MAX 2503

vector<vector<ll>> dp(MAX, vector<ll>(MAX, 0));
vector<pair<ll, pair<ll, ll> > > edges;
vector<ll> dist(MAX, LINF);
vector<bool> rechable(MAX, false);
vector<bool> vis(MAX, false);
vector<int> adj[MAX];

void dfs(int n){
    vis[n] = true;
    for(auto ne : adj[n])
        if(!vis[ne])
            dfs(ne);
}

int main(){
    optimizeIO();

    ll n, m, p;
    cin >> n >> m >> p;

    ll a, b, w;
    REP(i, 0, m){
        cin >> a >> b >> w;
        edges.push_back(make_pair(-1*(w-p), make_pair(a, b)));
        adj[a].push_back(b);
    }
    dist[1] = 0;
    REP(i, 0, n){
        for(auto edge : edges){
            if(dist[edge.S.F] != LINF && dist[edge.S.F] + edge.F < dist[edge.S.S])
                dist[edge.S.S] = dist[edge.S.F] + edge.F;
        }
    }
    REP(i, 1, n+1){
        REP(i, 0, MAX)
            vis[i] = false;
        dfs(i);
        if( vis[n] )
            rechable[i] = true;
    }
    
    bool has_cycle = false;
    for(auto edge : edges){
        if(dist[edge.S.F] != LINF && dist[edge.S.F] + edge.F < dist[edge.S.S] && rechable[edge.S.S]){
            has_cycle = true;
            break;
        }
    }
    if( has_cycle ){
        cout << -1 << endl;
    }else{
        cout << max(0ll, -1*dist[n]) << endl;
    }
    return 0;
}

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

int main()
{
    int n;
    scanf("%d ",&n);
    char s[100], leftHalf[100], rightHalf[100];
    int length, mid, i, k;

    gets(s);
    mid = n/2;
    if (n &1!=0)
        printf("No\n");
    else
    {

        for(i = 0; i < mid; i++)
        {
            leftHalf[i]= s[i];
        }
        leftHalf[i] = '\0';

        for(i = mid, k = 0; i <= n; i++, k++)
        {
            rightHalf[k]= s[i];
        }
        if (strcmp(leftHalf,rightHalf)==0)
            printf("Yes\n");
        else
            printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 128
"use strict";
function main(input) {
    let line = input.split(/\r?\n/g);
    let arr = line[0].split(" ");
    const a = parseInt(arr[0]), b = parseInt(arr[1]);
    console.log(a < b ? String(a).repeat(b) : String(b).repeat(a))
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
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;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int n;
    cin >> n;
    vector<int> a(n);
    REP(i, n) cin >> a[i];
    int q;
    cin >> q;
    int k;
    while (q--) {
        cin >> k;
        cout << (binary_search(ALL(a), k) ? 1 : 0) << endl;
    }
}



Measured memory_bytes: 3368
#include <iostream>
#include <map>

int a, b, c;

int main() {
    std::cin >> a >> b >> c;
    std::map<int,int> cnts;
    cnts[a]++;
    cnts[b]++;
    cnts[c]++;
    if (cnts.size() == 2){
        std::cout << "Yes";
    } else {
        std::cout << "No";
    }
}

Measured memory_bytes: 3548
#include <bits/stdc++.h>
using namespace std;
#define _MACRO(_1, _2, _3, NAME, ...) NAME
#define _repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define _rep(i,n) _repl(i,0,n)
#define rep(...) _MACRO(__VA_ARGS__, _repl, _rep)(__VA_ARGS__)
#define mp make_pair
#define pb push_back
#define all(x) begin(x),end(x)
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cerr<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cerr<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream &o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream &o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

int main(){
  long n,k;
  cin>>n>>k;

  // int a = 0;
  // rep(i,1,n+1) rep(j,1,n+1) if(i%j>=k) a++;
  // dbg(a);

  if(k==0){
    cout << n*n << endl;
    return 0;
  }

  long ans = 0;
  rep(i,k+1,n+1){
    ans += (i-k)*(n/i);
    ans += max(0L, n%i - k + 1);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using std::min;
int n,m,a[305];
long long dp[305][305][305],ans;
int main(){
	scanf("%d%d",&n,&m);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	memset(dp,0x3f,sizeof(dp));
	dp[0][0][0]=0;
	for (int i=0;i<n;i++)
		for (int j=0;j<=i;j++)
			for (int k=0;k<=m;k++){
				if (dp[i][j][k]>10000000000000) continue;
				dp[i+1][j][k+1]=min(dp[i+1][j][k+1],dp[i][j][k]);
				dp[i+1][i+1][k]=min(dp[i+1][i+1][k],dp[i][j][k]+std::max(0,a[i+1]-a[j]));
			}
	ans=1000000000000;
	for (int i=0;i<=m;i++)
		for (int j=0;j<=n;j++) ans=min(ans,dp[n][j][i]);
	printf("%lld\n",ans);
} 

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#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=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-9;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // cout<<setprecision(10)<<fixed;
  int n, a[252521];
  cin>>n;
  int x=0;
  REP(i, n){
    cin>>a[i];
    x^=a[i];
  }
  REP(i, n){
    cout<<(x^a[i])<<" \n"[i==n-1];
  }
  return 0;
}


Measured memory_bytes: 4344
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author alireza_kaviani
 */

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef pair<ld, ld> pld;
typedef pair<string, string> pss;

#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define X                           first
#define Y                           second
#define Mp                          make_pair
#define tab                         '\t'
#define sep                         ' '
#define endl                        '\n'
#define debug(x)                    cerr << #x << " = " << x << endl
#define SZ(x)                       ll(x.size())
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_io                     freopen("in.txt" , "r+" , stdin) ; freopen("out.txt" , "w+" , stdout);
#define set_random                  mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

inline ll input() {
    ll n;
    cin >> n;
    return n;
}

ll poww(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * poww(a * a % md, b / 2, md) % md : poww(a * a % md, b / 2, md) % md));
}

set_random;

const ll MAXN = 110;
const ll MAXK = 1e5 + 10;
const ll INF = 1e18;
const ll MOD1 = 998244353;
const ll MOD2 = 1e9 + 7;
const ll MOD3 = 1e9 + 9;

ll n , w , ans , dp[MAXK];
pll p[MAXN];

int main() {
    fast_io;
    fill(dp , dp + MAXK , INF);

    cin >> n >> w;
    for(ll i = 0 ; i < n ; i++) cin >> p[i].X >> p[i].Y;

    dp[0] = 0;
    for(ll i = 0 ; i < n ; i++)
    {
        for(ll j = MAXK - 1 ; j >= 0 ; j--)
        {
            if(j + p[i].Y < MAXK)
            {
                dp[j + p[i].Y] = min(dp[j + p[i].Y] , dp[j] + p[i].X);
            }
        }
    }
    for(ll i = 0 ; i < MAXK ; i++)
    {
        if(dp[i] <= w)  ans = i;
    }
    cout << ans << endl;

    return 0;
}
/*
todo :
    1- set constants
    2- check TimeLimit and MemoryLimit
    3- check special test cases
    4- don't forget BS can help you that is good idea(use for loop for floats)
    5- don't forget printf and scanf can help you in your code speed
*/


Measured memory_bytes: 1024