akhauriyash/Code-Regression huggingface dataset:
import java.io.{BufferedReader, InputStream, InputStreamReader, PrintWriter}
import java.util.StringTokenizer

import scala.collection.mutable
import scala.util.Sorting
import math.{abs, max, min}
import scala.collection.mutable.{ArrayBuffer, ListBuffer}
import scala.reflect.ClassTag

object Main {
  val MOD = 1000000007
  val out = new PrintWriter(System.out)
  def solve(): Unit = {
    val sc = new InputReader(System.in)
    val N = sc.nextInt()
    val A = map(N)(_ => sc.nextInt())
    val ans = A.grpBy(identity).sumBy { case (num, as) =>
      val cnt = as.length
      if (cnt >= num) cnt - num
      else cnt
    }

    out.println(ans)
  }


  def main(args: Array[String]): Unit = {
    solve()
    out.flush()
  }


  class InputReader(val stream: InputStream) {
    private val reader = new BufferedReader(new InputStreamReader(stream), 32768)
    private var tokenizer: StringTokenizer = null

    def next: String = {
      while (tokenizer == null || !tokenizer.hasMoreTokens)
        tokenizer = new StringTokenizer(reader.readLine)
      tokenizer.nextToken
    }

    def nextInt(): Int = next.toInt
    def nextLong(): Long = next.toLong
    def nextChar(): Char = next.charAt(0)
  }

  private def rep(n: Int)(f: Int => Unit): Unit = {
    (0 until n) foreach f
  }

  private def map[@specialized A: ClassTag](n: Int)(f: Int => A): Array[A] = {
    val res = Array.ofDim[A](n)
    rep(n)(i => res(i) = f(i))
    res
  }

  private implicit class ArrayOpts[A](val as: Array[A]) extends AnyVal {
    def grpBy[K](f: A => K): mutable.Map[K, ArrayBuffer[A]] = {
      val map = mutable.Map.empty[K, ArrayBuffer[A]]
      rep { a =>
        val k = f(a)
        map.getOrElseUpdate(k, ArrayBuffer()) += a
      }
      map
    }

    def rep(f: A => Unit): Unit = {
      Main.rep(as.length)(i => f(as(i)))
    }
  }

  private implicit class TraversableOpts[A](val as: Traversable[A]) extends AnyVal {
    def sumBy[B](f: A => B)(implicit num: Numeric[B]): B = {
      as.foldLeft(num.zero)((acc, a) => num.plus(acc, f(a)))
    }

    def maxByOpt[B: Ordering](f: A => B): Option[A] = {
      if (as.nonEmpty) Some(as.maxBy(f)) else None
    }
  }
}


Measured memory_bytes: 54024
import sys
sys.setrecursionlimit(10 ** 9)

N,X = map(int,input().split())
L = [1 for _ in range(N+1)]
for i in range(1,N+1):
  L[i] = L[i-1] *2 + 3
#print(L)

def patty(l,x):
  if l == 0:
    res = 1
  else:
    if x == 1:
      res = 0
    elif 2 <= x <= L[l-1]+1:
      res = patty(l-1,x-1)
    elif x == L[l-1]+2:
      res = patty(l-1,L[l-1])+1
    elif L[l-1]+3 <= x <= L[l-1]*2+2:
      res = patty(l-1,L[l-1])+1+patty(l-1,x-L[l-1]-2)
    else:
      res = patty(l-1,L[l-1])*2+1
  return res

print(patty(N,X))


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

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

  bool flag = false;
  int a, b, c; cin >> a >> b >> c;
  for(int i = a; i <= a*b; i += a) {
    if(i%b == c) flag = true;
  }
  cout << (flag ? "YES" : "NO") << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <sstream>
#include <stack>
#include <deque>
using namespace std;
#define ll long long
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define pi pair<int,int>
#define pii pair<pi,int>
#define sqr(x) ((x)*(x))
#define FOR for(int i=0;i<n;i++)for(int j=0;j<m;j++)
const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	int n;
	cin>>n;
	if(n<105){puts("0\n");return 0;}
	else if(n<135){puts("1\n");return 0;}
	else if(n<165){puts("2\n");return 0;}
	else if(n<189){puts("3\n");return 0;}
	else if(n<195){puts("4\n");return 0;}
	else puts("5\n");
	return 0;
}
//105    135      165     189       195

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

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int N, M;
  ll K, p;
  cin>>N>>M>>K;
  vector<ll> a(N+1), b(M+1);
  a[0] = 0; b[0] = 0;
  for(int i =0; i<N; i++){
    cin>>p;
    a[i+1] = a[i]+p;
  }
  for(int i = 0; i<M; i++){
    cin>>p;
    b[i+1] = b[i]+p;
  }
  int ans =0 ,j = M;
  for(int i = 0; i<=N; i++){
    if(a[i]>K)
    break;
    while(b[j]>K-a[i]) j--;
    ans = max(ans, i+j);
  }
  cout<<ans;
}


Measured memory_bytes: 6336
def main():
    N = int(input())
    A = list(map(int, input().split(' ')))
    # A_j = (x_j + x_(j + 1)) // 2
    # -> x_1 = A_1 - A_2 + A_3 - .. + A_N
    x = [0 for _ in range(N)]
    x[0] = sum([((- 1) ** i) * A[i] for i in range(N)])
    for i in range(1, N):
        x[i] = 2 * A[i - 1] - x[i - 1]
    print(' '.join(map(str, x)))


if __name__ == '__main__':
    main()

Measured memory_bytes: 19100
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
int read(){
	int x=0,flag=1;
	char ch=getchar();
	while(ch!='-'&&(ch<'0'||ch>'9')) ch=getchar();
	if(ch=='-') flag=-1,ch=getchar();
	while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
	return x*flag;
}
const int MAXN=100005;
int N,M;
bool vis[MAXN];
int a[MAXN];
int main(){
	N=read(),M=read(),vis[1]=true;
	for(int i=1;i<=N;i++) a[i]=1;
	for(int i=1;i<=M;i++){
		int x=read(),y=read();
		if(!vis[y]&&vis[x]) vis[y]=true;
		if(vis[x]&&a[x]==1) vis[x]=false;
		a[x]--,a[y]++;
	}
	int ans=0;
	for(int i=1;i<=N;i++) if(vis[i]) ans++;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll A[MAX],B[MAX],C[MAX],cs[MAX];
int n;
int bs_c(int val)
{
    int l=0,r=n-1,ans=n;
    while(l<=r)
    {
        int mid=(l+r)>>1;
        if(C[mid]>val)
        {
            ans=mid;
            r=mid-1;
        }
        else
            l=mid+1;
    }
    return n-ans;
}
int bs_b(int val)
{
    int l=0,r=n-1,ans=-1;
    while(l<=r)
    {
        int mid=(l+r)>>1;
        if(B[mid]>val)
        {
            ans=mid;
            r=mid-1;
        }
        else
            l=mid+1;
    }
    return ans;
}
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    cin>>n;
    for(int i=0; i<n; i++)
        cin>>A[i];
    for(int i=0; i<n; i++)
        cin>>B[i];
    for(int i=0; i<n; i++)
        cin>>C[i];
    sort(C,C+n);
    sort(B,B+n);
    for(int i=0; i<n; i++)
    {
        cs[i]=bs_c(B[i]);
    }
    for(int i=n-1; i>=0; i--)
        cs[i]+=cs[i+1];
    ll sum=0;
    for(int i=0; i<n; i++)
    {
        int cur=bs_b(A[i]);
        if(cur!=-1)
            sum+=cs[cur];
    }
    cout<<sum<<endl;


    return 0;
}


Measured memory_bytes: 6796
import java.util.*;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int n = sc.nextInt();
   int a = sc.nextInt();
   int b = sc.nextInt();
   
   int planA = n * a;
   int planB = b;
   
   if(planA > planB){
   	System.out.print(planB);
   }else{
     System.out.print(planA);
   }
 }
}

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

int s, w;
int main() {
    cin >> s >> w;
    if(w >= s) cout << "unsafe" << endl;
    else cout << "safe" << endl;
}

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

using Graph = vector<vector<int>>;
vector<bool> seen;
vector<bool> in_gp;
vector<int> gp_p;
int ans[100010];

void dfs(const Graph &F, int v) {
    seen[v] = true;
    in_gp[v] = true;
    gp_p.push_back(v);
    for (auto next_v : F[v]) {
        if (seen[next_v] ) continue;
        dfs(F, next_v);
    }
}

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

    Graph F(N), B(N);

    rep(i, M) {
        int ai, bi;
        cin >> ai >> bi;
        ai--, bi--;
        F[ai].push_back(bi);
        F[bi].push_back(ai);
    }

    rep(i, K) {
        int ci, di;
        cin >> ci >> di;
        ci--, di--;
        B[ci].push_back(di);
        B[di].push_back(ci);
    }

    seen.assign(N, false);
    rep(i, N) {
        if (seen[i] == true) continue;

        in_gp.assign(N, false);
        gp_p.clear();

        dfs(F, i);

        for (auto v: gp_p) {
            ans[v] = gp_p.size() - F[v].size() - 1;
            for (auto b: B[v]) {
                if (in_gp[b]) ans[v]--;
            }
        }
    }

    rep(i, N) cout << ans[i] << " ";
    cout << endl;

    return 0;
}



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

struct Solver {
  long n, m;
  std::vector<std::array<long, 2>> xs;
  long q;
  std::vector<std::array<long, 3>> ys;
  Solver() {
    S002 reader;
    reader >= n >= m >m>= xs >= q >q>= ys;
  }
  long dist[112345];
  long color[112345];
  std::vector<long> graph[112345];
  void init() {
    for(long i = 0; i < 112345; ++i) {
      dist[i] = -1;
      color[i] = 0;
    }
    for(std::array<long, 2> t : xs) {
      graph[t[0]].push_back(t[1]);
      graph[t[1]].push_back(t[0]);
    }
  }
  void dfs(long v, long d, long c) {
    if( d < 0 ) return;
    if( dist[v] >= d ) return;
    dist[v] = d;
    if( color[v] == 0 ) color[v] = c;
    for(long vNext : graph[v]) {
      dfs(vNext, d - 1, c);
    }
  }
  void solve() {
    init();
    for(long i = (long)ys.size() - 1; i >= 0; --i) {
      long v = ys[i][0];
      long d = ys[i][1];
      long c = ys[i][2];
      dfs(v, d, c);      
    }
    for(long i = 1; i <= n; ++i) {
      printf("%ld\n", color[i]);
    }
  }
};

int main() {
  loop std::unique_ptr<Solver>(new Solver())->solve();
  return 0;
}

Measured memory_bytes: 12788
using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var j = int.Parse(line[0]);
        var y = int.Parse(line[1]);
        goDfs(0, 0, j, y, "");
    }
    static void goDfs(int a, int b, int j, int y, string s)
    {
        if (a == j && b == y) { Console.WriteLine(s); return; }
        if ((a == 5 && b <= 3) | (b == 5 && a <= 3)) return;
        if (a > j | b > y) return;
        goDfs(a + 1, b, j, y, s + "A");
        goDfs(a, b + 1, j, y, s + "B");
    }
}


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

bool solve(const string& s) {
  int n = s.size();
  for (int i = 0, j = s.size() - 1; i < j; ++i, --j)
    if (s[i] != s[j])
      return false;
  for (int i = 0, j = s.size() / 2 - 1; i < j; ++i, --j)
    if (s[i] != s[j])
      return false;
  return true;
}

int main() {
  string s;
  cin >> s;
  cout << (solve(s) ? "Yes\n" : "No\n");
  return 0;
}


Measured memory_bytes: 888
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoder
{
    class Program
    {
        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        static int Solve(int N, int[] A)
        {
            int cnt = 0;
            foreach (int a in A)
            {
                int n = a;
                while (n % 2 == 0)
                {
                    n /= 2;
                    ++cnt;
                }
            }
            return cnt;
        }
        static void Main(string[] args)
        {
            int N = ReadInt();
            int[] A = ReadInts();
            Console.WriteLine(Solve(N, A));
        }
    }
}


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

int main() {
    int n = {}, k = {};
    std::cin >> n >> k;
    long double result = {};
    for (int i = 1; i <= n; ++i) {
        if (i >= k)
            result += 1.l;
        else
            result += std::pow(0.5l, std::ceil(std::log2(static_cast<long double>(k) / i)));
    }
    std::cout << std::setprecision(12) << result / n << std::endl;
    return 0;
}

Measured memory_bytes: 256
# include <iostream>
# include <cstdio>
# include <algorithm>
using namespace std;
const int N = 3e5 + 12;
const int inf = 0x7fffffff;
int a[N],n,k,q,ans = inf,b[N],c[N];
int solve(int w)
{
	int l,r;c[0] = 0;
	for(int i = 1;i <= n;i = r + 1)
	{
		l = i;
		while(l <= n && a[l] < w)l++;
		r = l;
		while(r <= n && a[r] >= w)r++;r--;
		b[0] = 0;
		for(int j = l;j <= r;j++)
		b[++b[0]] = a[j];
		if(b[0] < k)continue;
		sort(b + 1,b + b[0] + 1);
		for(int j = 1;j <= b[0] - k + 1;j++)c[++c[0]] = b[j];
	}
	if(c[0] < q)return inf;
	sort(c + 1,c + c[0] + 1);
	return c[q] - w;
}
int main()
{
	scanf("%d %d %d",&n,&k,&q);
	for(int i = 1;i <= n;i++)scanf("%d",&a[i]);
	for(int i = 1;i <= n;i++)ans = min(ans,solve(a[i]));
	printf("%d\n",ans);
}

Measured memory_bytes: 256
import calendar as cal

i = input().split(' ')
a = int(i[0])
b = int(i[1])

year = 2018
n = 0

for month in range(1,a+1):
    for date in [item for subl in cal.monthcalendar(year, month) for item in subl]:
        if date == 0:
            continue
        if month == date:
            n = n+1
        if month >= a and date >= b:
            break

print(n)


Measured memory_bytes: 4720
import math
import sys,collections
from sys import stdin, stdout  
#MAXN = 10000001

def get_ints(): return map(int, sys.stdin.readline().strip().split())
def get_array(): return list(map(int, sys.stdin.readline().strip().split()))
def get_string(): return sys.stdin.readline().strip() 
def input(): return sys.stdin.readline().strip()
#spf = [0 for i in range(MAXN)] 
def file():
	sys.stdin = open('input.py', 'r')
	sys.stdout = open('output.py', 'w') 
def is_subsequence(x, y):
    """Test whether x is a subsequence of y"""
    x = list(x)
    for letter in y:
        if x and x[0] == letter:
            x.pop(0)

    return not x    
def sieve(): 
	spf[1] = 1
	for i in range(2, MAXN): 
		spf[i] = i 
	for i in range(4, MAXN, 2): 
		spf[i] = 2

	for i in range(3, mt.ceil(mt.sqrt(MAXN))): 
		if (spf[i] == i): 
			for j in range(i * i, MAXN, i): 
				if (spf[j] == j): 
					spf[j] = i 
def getFactorization(x): 
	ret = list() 
	while (x != 1): 
		ret.append(spf[x]) 
		x = x // spf[x] 

	return ret 
def getFloor(A, x):

    (left, right) = (0, len(A) - 1)

    ind,floor = -1,-1
    while left <= right:
        mid = (left + right) // 2
        '''if A[mid] == x:
            return mid'''
        if x < A[mid]:
            right = mid - 1
        else:
            floor = A[mid]
            ind=mid
            left = mid + 1
            
    return ind
def check(st) : 
  
    # Compute sum of digits 
    n = len(st) 
    digitSum = 0
      
    for i in range(0,n) : 
        digitSum = digitSum + (int)(st[i]) 
  
    # Check if sum of digits 
    # is divisible by 9. 
    return (digitSum % 9 == 0)     
#file()
#sieve() 
mod=(10**9)+7

def main():
	n=int(input())
	l=get_array()
	c=0
	for i in range(1,n):
		if(l[i]>=l[i-1]):
			continue
		else:
			diff=l[i-1]-l[i]
			c+=diff
			l[i]+=diff
	print(c)		

	





















	




















		
			


		

			

		





			

	























				

	















	

	










if __name__ == '__main__':
    main()

Measured memory_bytes: 33800
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <algorithm>
#include <set>
#include <string>
#include <queue>

using namespace std;
#define rep(i, N) for(int (i) = 0; (i) < (N); (i) ++)
typedef long long ll;

struct UnionFind{
    vector<int> ps;
    UnionFind(int n){
        ps = vector<int>(n, -1);
    }

    int root(int a){
        if(ps[a] < 0){
            return a;
        }
        return ps[a] = root(ps[a]);
    }

    bool isSame(int a, int b){
        return root(a) == root(b);
    }

    void unite(int a, int b){
        a = root(a);
        b = root(b);
        if(a == b){
            return ;
        }
        if(ps[a] > ps[b]){
            swap(a, b);
        }
        ps[a] += ps[b];
        ps[b] = a;
    }

};

int main(){
    int N, M;
    cin >> N >> M;
    UnionFind g(N + M);
    rep(i, N){
        int k;
        cin >> k;
        rep(j, k){
            int l;
            cin >> l;
            l --;
            g.unite(i, N + l);
        }
    }
    string ans = "YES";
    rep(i, N){
        if(! g.isSame(i, 0)){
            ans = "NO";
            break;
        }
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

long long n,k,current,answer,i;

int main()
{
    cin >> n;
    cin >> current;
    current--;
    answer = 1;
    for(i=2; i<=n; i++) {
        cin >> k;
        if(k>current) k--;
        if(k<current) {
            answer = 0;
            break;
        }
        current = k;
    }
    if(answer == 1) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;


    return 0;
}


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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  int i;
  for(i=0;i<n;i++){
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  cout << a[n-1]-a[0];
}


Measured memory_bytes: 256
def main():
    from sys import stdin, stdout

    def read():
        return stdin.readline().rstrip('\n')

    def read_array(sep=None, maxsplit=-1):
        return read().split(sep, maxsplit)

    def read_int():
        return int(read())

    def read_int_array(sep=None, maxsplit=-1):
        return [int(a) for a in read_array(sep, maxsplit)]

    def write(*args, **kwargs):
        sep = kwargs.get('sep', ' ')
        end = kwargs.get('end', '\n')
        stdout.write(sep.join(str(a) for a in args) + end)

    def write_array(array, **kwargs):
        sep = kwargs.get('sep', ' ')
        end = kwargs.get('end', '\n')
        stdout.write(sep.join(str(a) for a in array) + end)

    n, k = read_int_array()
    write(1 + n - k)

main()


Measured memory_bytes: 3064
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;

int main()
{
    int N; cin >> N;
    map<string, int> str2NumMap;
    for (int i = 0; i < N; ++i)
    {
        string Si; cin >> Si;
        ++str2NumMap[Si];
    }
    multimap<int, string> num2StrMap;
    for (const auto &kvp : str2NumMap)
    {
        num2StrMap.insert({ kvp.second, kvp.first });
    }
    int max = (--num2StrMap.end())->first;
    auto itr = num2StrMap.equal_range(max);
    set<string> ansStrSet;
    for (auto i = itr.first; i != itr.second; ++i)
    {
        ansStrSet.insert(i->second);
    }
    for (const auto &s : ansStrSet)
    {
        cout << s << endl;
    }
}


Measured memory_bytes: 47104
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
using namespace std; //std::の省略のため
using ll = long long;

string s;
ll ans = 0;

void sum_check(int l, ll sum, ll num)
{
  if (l == (int)s.size() - 1)
  {
    ans += sum + num;
    return;
  }

  sum_check(l + 1, sum + num, s[l + 1] - '0');
  sum_check(l + 1, sum, num * 10 + s[l + 1] - '0');
}

int main()
{
  cin >> s;

  sum_check(0, 0, s[0] - '0');

  cout << ans << endl;
}


Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ss second
#define ff first
#define pb push_back
int main(){
    ios_base::sync_with_stdio(0);
    ll a,b;
    cin>>a>>b;
    cout<<a*b/__gcd(a,b);
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define INF 1e9
#define pb push_back
#define mp  make_pair
#define loop(a,n) for(long long i=a;i<n;i++)
#define vil vector<long long int>
#define vi vector<int>
#define sz(v) v.size()
#define setbits(x)          __builtin_popcountll(x)
#define ff first
#define ss second
using namespace std;

int nCrevenoroddfinder(int n,int r)
{
    int a=r;
    int b=n-r;
    for(int i=0;i<30;i++)
    {
        int x=1<<i;
        if((x&a)&&(x&b))
        {
            return 0;//even
        }
    }
    return 1;//odd
}

ll gcd(ll a, ll b) {
  if (a == 0)return b;
  return gcd(b % a, a);
}
bool isperfect(ll n) {
  ll y = sqrt(n);
  if (n % y == 0 && y * y == n)return true;
  return false;
}
bool comp(pair<int,int> a, pair<int,int> b) {
    if(a.first == b.first) return a.second>b.second;
  return a.first < b.first;
}
 ll powi(ll a, ll b) {
  ll ans = 1;
  while (b > 0) {
    if (b & 1)ans = (ans * a);
    b = b >> 1;
    a = (a * a);
  }
  return ans;
}
bool isprime(ll n) {
  for (int i = 2; i * i <= n; i++) {
    if (n % i == 0)return false;
  }
  return true;
}
bool prime[10000000];
void seive() {

  prime[1] = true;
  for (int i = 2; i * i < 10000000; i++) {

    if (prime[i])continue;
    for (int j = i * i; j < 10000000; j += i) {
      prime[j] = true;
    }

  }
}
ll nax=1e6+2;
int main()
{
  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  ll n;cin>>n;
  ll dp[nax];
  
  for(int i=1;i<nax;i++) dp[i]=1;
  for(int i=2;i<nax;i++){
        for(int j=i;j<nax;j+=i){
             dp[j]++;
        }
  }
  ll ans=0;
  for(int i=1;i<n;i++)
  {
        ll x=dp[i];
       // x/=2;
       // cout<<i<<" "<<dp[i]<<endl;
        if(x<=2){
          ans+=x;     
        }
        else ans+=(x);
  }
  cout<<ans;
}



  

Measured memory_bytes: 11504
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt()*100;
        int b = sc.nextInt()*100;
        int c = sc.nextInt();
        int d = sc.nextInt();
        int e = sc.nextInt();
        int f = sc.nextInt();
        double max = 0;
        int[] ans = new int[2];
        ans[0] = a;
        for (int i = 0; i < 31; i++) {
            if(a*i > f) break;
            for (int j = 0; j < 31; j++) {
                double w = a*i + b*j;
                if(w > f) break;
                if(i + j == 0) continue;
                for (int k = 0; k < 1501; k++) {
                    if(w + c*k > f) break;
                    if(c*k > w /100 *e) break;
                    for (int l = 0; l < 1501; l++) {
                        if(k + l == 0) continue;
                        double s = c*k + d*l;
                        if(w + s > f) break;
                        if(s > w /100 *e) break;
                        double tmp = s / (w + s);
                        if(tmp > max){
                            max = tmp;
                            ans[0] = (int) (w + s);
                            ans[1] = (int) s;
                        }
                    }
                }
            }
        }

        System.out.println(ans[0] + " " + ans[1]);
        sc.close();
    }

}


Measured memory_bytes: 22868
MOD = 10 ** 9 + 7

n = int(input())

S = [0] * (n+1)

for i in range(1, n+1):
    n_i = i
    p = 2 
    while n_i > 1:
        while n_i % p == 0:
            n_i //= p
            S[p] += 1
        p += 1

ans = 1
for s in S:
    ans *= s+1

print(ans % MOD)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  int A,B,C;cin >> A >> B >> C;
  cout << max(0,C - (A-B)) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long int;
using ld=long double;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element((x).begin(),(x).end())
#define MIN(x) *min_element((x).begin(),(x).end())
#define SORTR(x) sort((x).rbegin(),(x).rend())
#define SORT(x) sort((x).begin(),(x).end())
#define SUM(x) (ll)accumulate((x).begin(),(x).end(), (ll)0)
#define FILL(x,a) fill(x.begin(),x.end(),a)
#define EACH(i,x) for(typeof((x).begin()) i=(x).begin(); i!=(x).end(); ++i)
using VI=vector<ll>;
using VD=vector<ld>;
using VVI=vector<VI>;
using VC=vector<char>;
using VVC=vector<VC>;
using VS=vector<string>;
using PLL =pair<ll,ll>;
using PLD=pair<ld,ld>;
using VPLL=vector<PLL>;
const int INF  = 1<<30;
const ld EPS   = 1e-10;
const int MOD  = int(1e9)+7;
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; }
template <class BidirectionalIterator>
bool next_partial_permutation(BidirectionalIterator first, BidirectionalIterator middle,BidirectionalIterator last){reverse(middle, last); return next_permutation(first , last);}
#define COUT(x) cout<<x<<"\n"

void Main()
{
	ll N,M;
	ll result=0;
	string S;
	cin>>N>>M;
	VI A(N);
	VPLL CB(M);
	priority_queue<PLL> pq;
	REP(i, N) {
		cin >> A[i];
		pq.push({A[i],1});
	}
	REP(i,M) {
		ll B, C;
		cin >> B >> C;
		pq.push({C,B});
	}
	while(1){
		PLL tmp=pq.top();
		pq.pop();
		if(N<=tmp.second){
			result+=N*tmp.first;
			break;
		}
		else {
			result+=tmp.first*tmp.second;
			N-=tmp.second;
		}
	}
	cout << result << "\n";
	return;
}

int main()
{
	std::cin.tie(0);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}


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

int main(){
	char b;
	cin >> b;
	if(b == 'A'){
	cout << 'T' << endl;
	}else if(b == 'C'){
	cout << 'G' << endl;
	}else if(b == 'G'){
	cout << 'C' << endl;
	}else if(b == 'T'){
	cout << 'A' << endl;
	}

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int x=0,y=0,z=0,w=0;
  for(int i=0;i<6;i++){
    int n;cin>>n;
    if(n==1)x++;
    else if(n==2)y++;
    else if(n==3)z++;
    else w++;
  }
  if(x*y*z*w==4)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}
  


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define All(v) (v).begin(),(v).end()
typedef long long ll;

int main(){
    int A,B,C,D,E,F;
    cin >> A >> B >> C >> D >> E >> F;
    vector<double> water,sugar;
    FOR(i,0,31){
        FOR(j,0,31){
            if(100*i*A+100*j*B<F)water.push_back(100*i*A+100*j*B);
        }
    }
    FOR(i,0,F+1){
        FOR(j,0,F+1){
            if(i*C+j*D<F)sugar.push_back(i*C+j*D);
        }
    }
    double maxdens = -1;
    int res1=0,res2=0;
    for(auto w:water){
        for(auto s:sugar){
            if(w+s!=0&&w+s<=F&&s<=E*(w/100)){
                double dens = 100*s/(w+s);
                if(dens>maxdens){
                    res1=w+s;
                    res2=s;
                    maxdens = dens;
                }
            }
        }
    }
    cout << res1 << " " << res2 << endl;
    return 0;
}

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

int charToInt(char c){
    char zero_num = '0';
    return (int)c - (int)zero_num;
}

signed main(){
    int D, G;cin>>D>>G;
    vec_int p(D), c(D);
    rep(i,D)cin>>p.at(i)>>c.at(i);

    int min_problem = INT_MAX;
    for(int pattern=0;pattern<pow(2,D);pattern++){
        int temp_score = 0;
        int num = 0;
        for(int i=0;i<D;i++){
            if((pattern/((int)pow(2,i)))%2==1){
                temp_score += 100*(i+1)*p.at(i) + c.at(i);
                num += p.at(i);
            }
        }

        while(temp_score<G){
            for(int i=D-1;i>=0;i--){
                if((pattern/((int)pow(2,i)))%2==1)continue; //ここはもう足したからパス
                //Gを超えられるかチェック
                if(temp_score+(100*(i+1))*(p.at(i)-1)>=G){
                    num+= ((G-temp_score)/(100*(i+1))+1);
                    if((G-temp_score)%(100*(i+1))==0)num=num-1;
                    temp_score = temp_score + ((G-temp_score)/(100*(i+1))+1)*(100*(i+1));
                    if((G-temp_score)%(100*(i+1))==0)temp_score = temp_score-100*(i+1);
                    break;
                }else{
                    num+= p.at(i)-1;
                    temp_score = temp_score + (100*(i+1))*(p.at(i)-1);
                }
            }
            break;
        }
        if(G<=temp_score){
        if(num<min_problem){
            min_problem = num;
        }
        }
    }

cout<<min_problem<<endl;


    return 0;
}

Measured memory_bytes: 4080
import java.util.*;

public class Main{
	
	public static void main(String args[]) {
		
		Scanner sc = new Scanner(System.in);
		
		long A =sc.nextLong();
		long B =sc.nextLong();
		long K =sc.nextLong();
		
		if(A > K) {
			A = A - K;
			System.out.print(A+" "+B);
		}else{
		 if(A+B > K) {
			 B = B - (K - A);
			 System.out.println(0+" "+B);
			 
		 }else {
			 System.out.print(0+" "+0);
		 }
			
		}
		
		
		
		
	}
	

}

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

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

int dp[2][4010];

int main(){
	string in1,in2;
	while(cin>>in1>>in2){
		int n = in1.size();
		int m = in2.size();
		int ret = 0;
		rep(i,2)rep(j,m+1)dp[i][j]=0;
		REP(i,1,n+1){
			int cur = i%2;
			int next = (i+1)%2;
			REP(j,1,m+1){
				if( in1[i-1]==in2[j-1] ){
					dp[next][j] = dp[cur][j-1] + 1;
					ret = max(ret,dp[next][j]);
				}
			}
			rep(i,m+1)dp[cur][i]=0;
		}
		printf("%d\n",ret);
	}
	return 0;
}

Measured memory_bytes: 964
#include <iostream>
#include <vector>

using namespace std;

int main(void){
	while(1){
		string str; cin >> str;
		if(str == "#") break;
		string left="yuiophjklnm";
		for(int i=0; i<str.size(); i++){
			if(left.find(str[i]) != left.npos) str[i] = '0';
			else str[i] = '1';
		}
		int ans = 0;
		for(int i=1; i<str.size(); i++){
			if(str[i-1] != str[i]) ans++;
		}
		cout << ans << endl;
	}

	return 0;
}


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

using namespace std;

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

  string s;
  int n, k;
  cin >> s >> k;
  n = (int) s.size();
  for (int i = 0; i < n; i++) {
    if (s[i] == 'a') {
      continue;
    }
    int x = s[i] - 'a';
    int need = 26 - x;
    if (need <= k) {
      k -= need;
      s[i] = 'a';
    }
  }
  int x = s[n - 1] - 'a';
  x = (x + k) % 26;
  s[n - 1] = (x + 'a');
  cout << s << "\n";
}


Measured memory_bytes: 592
#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define endl "\n"
const int MAX = 100005;
const long long mod = 1.0e9 + 7;

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

    ll n,w,i,j,k;
    cin>>n>>w;
    vector<pair<ll,ll> > v;
    for(i=0;i<n;i++)
    {
        cin>>j>>k;
        v.push_back(make_pair(j,k));
    }
    sort(v.begin(),v.end());
    ll dp[n+1][w+1];
    memset(dp,0,sizeof(dp));
    for(i=1;i<=n;i++)
    {
        for(j=1;j<=w;j++)
        {
            if(j>=v[i-1].first)
                dp[i][j]=max(dp[i-1][j],v[i-1].second+dp[i-1][j-v[i-1].first]);
            else
                dp[i][j]=dp[i-1][j];
        }
    }
    //cout<<dp[w]<<endl;
    cout<<dp[n][w]<<endl;
    //cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 79232
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

typedef long long int int64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

void run(void){
  int64 N;
  scanf("%lld",&N);
  const int m=3500;
  int h,n;
  for(h=1;h<=m;h++){
    for(n=h;n<=m;n++){
      int64 nu=4*h*n-N*(h+n);
      int64 de=n*h*N;
      if(nu>0 && de%nu==0 && de/nu<=m){
	int64 w=de/nu;
	printf("%d %d %lld\n",h,n,w);
	return;
      }
    }
  }
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
string S,T,U;
ll A,B;




int main(){
    cin >> S >> T >> A >> B >> U;
    if(S == U){
        A -= 1;
    }else{
        B -= 1;
    }
    
    
    cout << A << ' '<< B << endl;
    
}




Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <numeric>
#include <functional>
#include <string> 
#include <vector>
#include <bitset>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <random>

using namespace std;
using ll = long long;

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;

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

const ll MOD = (ll)1e9 + 7;
const ll HINF = (ll)1e18;
const ll LINF = (ll)1e9;
const long double PI = 3.1415926535897932384626433;

template<class T> void corner(bool flg, T hoge) {
	if (flg) {
		cout << hoge << endl;
		exit(0);
	}
	else return;
}

template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {
	o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;
}

template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {
	o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;
}

template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {
	o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;
}

template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {
	o << "{" << obj.first << ", " << obj.second << "}"; return o;
}

template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {
	o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;
}

void print(void) {
	cout << endl;
}

template <class Head> void print(Head&& head) {
	cout << head;
	print();
}

template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {
	cout << head << " ";
	print(forward<Tail>(tail)...);
}

void YN(bool flg) {
	cout << ((flg) ? "YES" : "NO") << endl;
}

void Yn(bool flg) {
	cout << ((flg) ? "Yes" : "No") << endl;
}

void yn(bool flg) {
	cout << ((flg) ? "yes" : "no") << endl;
}

int main() {
	string S,T = ""; cin >> S;
	int N = S.size();
	int cnt = 0;
	REP(i, N) if (S[i] == 'B') cnt++;
	REP(i, N) T.push_back('W');
	REP(i, cnt) T[N - 1 - i] = 'B';

	int j = N - 1;
	ll ans = 0;
	for(int i = N-1; 0 <= i; --i){
		while (0 <= j && S[j] != 'B') j--;
		if (0 <= j && T[i] == 'B') ans += abs(i - j);
		j--;
	}
	cout << ans << endl;
	
	





	return 0;
}



Measured memory_bytes: 776
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <queue>
#include <time.h>
#include <algorithm>
#include <iostream>
using namespace std;
#define repi(a,b) for (int i=a;i<=b;i++)
#define repj(a,b) for (int j=a;j<=b;j++)
#define repk(a,b) for (int k=a;k<=b;k++)
#define oo 123456789
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define fir first
#define sec second
#define endl '\n'
#define MLV 30
#define N 1005
#define ll long long

int h,w,n;
int f[N][N];
int col[1000005];

int main()
{
	cin>>h>>w;
	cin>>n;
	repi(1,n) cin>>col[i];
	
	int i=1,j=1,cnt=1,dir=1,now=0;
	
	for (int i=1;i<=h;i++)
	{
		if (dir==1)
		{
			repj(1,w)
			{
				f[i][j]=cnt;
				now++;
				if (col[cnt]==now) cnt++,now=0;
			}
			dir=2;
		}
		else
		{
			for (int j=w;j>=1;j--)
			{
				f[i][j]=cnt;
				now++;
				if (now==col[cnt]) cnt++,now=0;
			}
			dir=1;
		}
	}
	
	repi(1,h){
		repj(1,w) cout<<f[i][j]<<' ';
		cout<<endl;
	}
	
	return 0;
}

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

using namespace std;

int main() {
	int a, b, h, cnt;

	cnt = 0;
	cin >> h >> a >> b;
	for (int i = a; i <= b; ++i) {
		if (h%i == 0) {
			++cnt;
		}
	}
	cout << cnt << endl;

	return 0;
}


Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define fi first
#define se second
int main(){
    int k;
    vector<int> v(5);
    for(int i=0;i < 5;i++){
        cin >> v.at(i);
    }
    cin>>k;
    for(int i=0;i < 4;i++){
        for(int j=1;j < 5;j++){
            if(abs(v.at(i)-v.at(j))>k){
                cout << ":(" << endl;
                return 0;
            }
        }
    }
    cout << "Yay!" << endl;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
KA =[list(map(int, input().split())) for _ in range(n)]

cnt = [0]*m
for ka in KA:
  for a in ka[1:]:
    cnt[a-1] += 1

ans = 0
for i in cnt:
  if i == n:
    ans += 1
print(ans)


Measured memory_bytes: 9140
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF = 1e18+18;
const ll MAX = 200000;
const ll MOD = 1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;

int main(){
    string S;
    cin>>S;
    int N=S.size();
    bool Ans=true;
    rep(i, N/2){
        if(S.at(i)!=S.at(N-1-i)){
            Ans=false;
          	//cout<<1<<endl;
        }
    }
    rep(i, (N/2)/2){
        if(S.at(i)!=S.at(N/2-1-i)){
            Ans=false;
          	//cout<<2<<endl;
        }
        if(S.at(N/2+1+i)!=S.at(N-1-i)){
            Ans=false;
          	//cout<<3<<endl;
        }
    }
    Yes(Ans);
    return 0;

}



Measured memory_bytes: 256
/*package whatever //do not write package name here */

import java.util.*;
class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		String str = sc.nextLine(),ans="";
		for(int i=0 ; i<str.length() ; i++){
		    if(str.charAt(i)=='1'){
		        ans+=9;
		    }else{
		        ans+=1;
		    }
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 21972
#include<iostream>
#include<cstdlib>
using namespace std;
int main(){
	int n,k;
	short s[500][1000];
	cin>>n>>k;
	for(int i=0;i<k;i++)
	for(int j=0;j<n/2;j++)
	cin>>s[i][j];
	int box[1000];
	while(1){
		for(int i=0;i<n;i++){
			box[i]=rand()%2;
		}
		int j;
		for(j=0;j<k;j++){
			int sum=0;
			for(int l=0;l<n/2;l++){
				if(box[s[j][l]-1])
				sum++;
			}
			if(!(sum>=n/8&&sum<=n*3/8))
			break;
		}
		if(j==k){
			break;
		}
		/*for(int i=0;i<n;i++)
		cout<<box[i];
		cout<<endl;
		*/
	}
	for(int i=0;i<n;i++)
	cout<<box[i];
	cout<<endl;
	
	return 0;
}

Measured memory_bytes: 1688
def main(n):
	odd = "1"
	even= "0"
	if(n[0] =="0"):
		# zero mode
		odd = "0"
		even= "1"
	return sum((((i % 2 == 0) and (n[i] == even)) or ((i % 2 != 0) and n[i] == odd)) for i in range(1, len(n)))

print(main(input()))

Measured memory_bytes: 3188
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define INF 1e9
typedef long long ll;
using namespace std;

int main() {
    int n,m; cin >> n >> m;
    vector<int> v(n+1);
    rep(i,n){
        v[i]=0;
    }
    rep(i,m){
        int a,b; cin >> a >> b;
        v[a] += 1;
        v[b] += 1;
    }
    rep(i,n){
        cout << v[i+1] << endl;
    }

    return 0;
}

Measured memory_bytes: 256
# include <iostream>
# include <stdio.h>
# include <cstring>
# include <string>
# include <cctype>
#include <algorithm> //transformの関数はaslgorithmライブラリに入っているみたい。
using namespace std;
int main(){
  string t_str,h_str;
  int n,t,h;
  t = 0;
  h = 0;
  cin >> n;
  for(int i = 0;i<n;i++){
    cin >> t_str >> h_str;
    if(t_str == h_str){
      t++;
      h++;
    }else if(t_str < h_str){
      h+=3;
    }else if(t_str > h_str){
      t+=3;
    }
  }
  cout << t << ' ' << h << endl;
  return 0;
}


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

using namespace std;


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

    bool check = true;

    map<char, char> ma, ima;

    for(int i=0;i<S.length();i++) {
        char s = S[i];
        char t = T[i];

        if(ma.count(s)) if(ma[s] != t) check = false;
        if(ima.count(t)) if(ima[t] != s) check = false;
        ma[s] = t;
        ima[t] = s;
    }

    cout << ( check ? "Yes" : "No") << endl;

    return 0;
}


Measured memory_bytes: 776
#include <cstdio>
#include <cstring>
#include <cctype>

int main(){
  char c;
  int list[50] = {0};

  while (scanf("%c", &c) != EOF) {
    if (isalpha(c)) {
      c = tolower(c);
      list[c - 'a']++;
    }
  }

  for (int i = 0; i < 26; i++) {
    printf("%c : %d\n", i + 'a', list[i]);
  }

  return 0;
}


Measured memory_bytes: 2700
#include <iostream>
#include <algorithm>
#include <string>
#include <map>
#include <math.h>
#include <set>

using namespace std;
typedef long long  ll;

#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)
ll MOD = 1000000007;

int main() {
	ll A, B, C, X, Y; cin >> A >> B >> C >> X >> Y;
	ll a = X * A + Y * B;
	ll b = 2 * C * min(X, Y) + ((X - Y) > 0 ? A * (X - Y) : B * (Y - X));
	ll c = 2 * C * ((X - Y) > 0 ? X : Y);

	cout << min(a, min(b, c)) << endl;
	return 0;
}

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

int main(){
	int d, g, min = 0;
	cin >> d >> g;
	vector<int> p(d), c(d);
	for (int i=0; i < d; i++) {
		cin >> p[i] >> c[i];
		min += p[i];
	}
	for (int i=0; i<(1<<d) - 1; i++){
		int s = 0;
		int max0 = 0;
		int count = 0;
		for (int j=0; j<d; j++){
			if(i & 1<<j) {
				s += (j+1)* 100 * p[j] + c[j];
				count += p[j];
			} else {
				max0 = j;
			}
		}
		if(s < g && (p[max0] - 1) * (max0+1) * 100 + s >= g) {
			count += (g - s + (max0+1) * 100 - 1) / ((max0+1) * 100);
			s = g;
		}
		if(s >= g && count < min) min = count;
	}
	cout << min << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = ((int)(n)-1); i >= 0; i--)
#define all(x) (x).begin(),(x).end()
 
using namespace std;
using ll = long long;
 
struct edge { int to, cost; };
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> P;
 
const int INF = 1e9;
const int MOD = 1e9+7;
const double EPS = 1.0e-10;
const double PI = acos(-1.0);
 
const int mx4[] = {0,1,0,-1};
const int my4[] = {1,0,-1,0};
const int mx8[] = {0,1,1,1,0,-1,-1,-1};
const int my8[] = {1,1,0,-1,-1,-1,0,1};

int main() {
	int n;
	cin >> n;
	vi a(n);
	map<int,ll> mp;
	rep(i,n){
		cin >> a[i];
		mp[a[i]]++;
	}
	ll sum = 0;
	for(auto m : mp){
		sum += m.second*(m.second-1)/2;
	}
	rep(i,n){
		cout << sum-mp[a[i]]*(mp[a[i]]-1)/2+(mp[a[i]]-1)*(mp[a[i]]-2)/2 << endl;
	}
	return 0;
}

Measured memory_bytes: 10240
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();

		if(c - (a - b) >= 0)
			System.out.println(c - (a - b));
		else
			System.out.println(0);
	}
}


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

int main(){
	int A[3][10]={};
	int B[3][10]={};
	int C[3][10]={};
	int D[3][10]={};
	
	int n,b,f,r,v;
	cin >> n;
	while(n>0){
		cin >> b >> f >> r >> v;
		switch(b){
			case 1:A[f-1][r-1]+=v; break;
			case 2:B[f-1][r-1]+=v; break;
			case 3:C[f-1][r-1]+=v; break;
			case 4:D[f-1][r-1]+=v; break;
		}
		n--;
	}
	for(int i=0;i<sizeof(A)/sizeof(A[0]);i++){
		for(int j=0;j<sizeof(A[0])/sizeof(A[0][0]);j++){
			cout << " "<< A[i][j];
		}
		cout << "\n";
	}
	cout <<"####################\n";
	for(int i=0;i<sizeof(B)/sizeof(B[0]);i++){
		for(int j=0;j<sizeof(B[0])/sizeof(B[0][0]);j++){
			cout << " "<< B[i][j];
		}
		cout << "\n";
	}
	cout <<"####################\n";
	for(int i=0;i<sizeof(C)/sizeof(C[0]);i++){
		for(int j=0;j<sizeof(C[0])/sizeof(C[0][0]);j++){
			cout << " "<< C[i][j];
		}
		cout << "\n";
	}
	cout <<"####################\n";
	for(int i=0;i<sizeof(D)/sizeof(D[0]);i++){
		for(int j=0;j<sizeof(D[0])/sizeof(D[0][0]);j++){
			cout << " "<< D[i][j];
		}
		cout << "\n";
	}
}


Measured memory_bytes: 3076
import fractions

def antidiv(x,l,c,d):
    if x == l or x < 0:
        return l - (l // c) - (l // d) + 1
    else:
        return x - (x // c) - (x // d) 

a,b,c,d = map(int,input().split())

l = (c*d)//fractions.gcd(c,d)


aq = a // l
ar = a % l
bq = b // l
br = b % l
#print(br)

qq = bq - aq - 1
r1 = antidiv(l,l,c,d) - antidiv(ar-1,l,c,d)
r2 = antidiv(br,l,c,d)

if ar!=0:
    ans = qq * antidiv(l,l,c,d) + r1 + r2
else:
    ans = (qq+1) * antidiv(l,l,c,d) + r1 + r2


print(ans)


Measured memory_bytes: 5076