akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main {

    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int a=0;
        int b=0;
        int c=0;
        int d=0;
        for(int i=0; i<n; i++) {
            String s = sc.next();
            if(s.equals("AC")) a++;
            if(s.equals("WA")) b++;
            if(s.equals("TLE")) c++;
            if(s.equals("RE")) d++;
        }
        System.out.println("AC x " + a);
        System.out.println("WA x " + b);
        System.out.println("TLE x " + c);
        System.out.println("RE x " + d);

    }


}

Measured memory_bytes: 58728
#include <bits/stdc++.h>
using namespace std;
#define ll          long long int
#define pb          push_back
#define pll         pair<ll,ll>
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mode        998244353
#define mod         1000000007
#define inf         1000000000000000000LL
#define vl          vector<ll>
#define F           first
#define S           second
#define db          long double
#define sz(x)       (ll)x.size()
#define fix(n)      cout<<fixed<<setprecision(n)
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define all(x)      x.begin(),x.end()
#define mset(x)     memset(x,0,sizeof x)
#define pi          3.14159265358979323



void solve()
{
       ll n, k;
       cin>>n>>k;
       string s;
       cin>>s;
       ll cc[n+1];
       cc[0]=0;
       for(ll i=1; i<n; i++) cc[i] = cc[i-1] + (s[i] != s[i-1]);
       ll ans=0;
       for(ll i=0; i<n; i++)
       {
              ll j;
              if(s[i]=='0') j = lower_bound(cc, cc+n, cc[i] + 2*k) - cc;
              else j = lower_bound(cc, cc+n, cc[i] + 2*k + 1) - cc;
              ans = max(ans, j-i);
       }
       cout<<ans;
}

int main() {
	ll T = 1;
	speed_up
	//cin>>T;
	while(T--)
	    solve();
	return 0;
}


Measured memory_bytes: 1232
import java.util.Arrays;
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] mochi = new int[N];
		for (int i = 0; i < N ; i++) {
			mochi[i] = sc.nextInt();
		}
		Arrays.sort(mochi);

		int total = 1;
		for (int i = 0 ; i < N-1 ; i++) {
			if (mochi[i] < mochi[i+1]) {
				total += 1;
			}
			if (i+1 == N-1) {
				break;
			}
		}
		System.out.println(total);

	}
}


Measured memory_bytes: 22868
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public class C { public static void Main() => (new Solver()).Solve(); }

public class Solver
{
	public void Solve()
	{
		long N = GetLong();
		var adj = Range(0, N).Select(_ => new List<long>()).ToArray();
		for(long i = 0; i < N - 1; i++)
		{
			long a = GetLong() - 1;
			long b = GetLong() - 1;
			adj[a].Add(b);
			adj[b].Add(a);
		}
		var first = bfs(N, adj, 0);
		var firstMax = first.Max();
		var e = Array.FindIndex(first, x => x == firstMax);
		var second = bfs(N, adj, e);
		var L = second.Max();

		WriteLine((L % 3 != 1) ? "First" : "Second");
	}

	private long[] bfs(long N, List<long>[] adj, long s)
	{
		var res = Enumerable.Repeat(-1L, (int)N).ToArray();
		var queue = new Queue<long>();
		res[s] = 0;
		queue.Enqueue(s);
		while(queue.Count > 0)
		{
			long v = queue.Dequeue();
			foreach(var u in adj[v])
			{
				if(res[u] != -1)
					continue;

				res[u] = res[v] + 1;
				queue.Enqueue(u);
			}
		}
		return res;
	}
}

public static class MyIO
{
	private static string[] args = new string[0];
	private static int cnt = 0;
	private static IEnumerable<string> getArgs(long N) => Range(0, N).Select(_ => getArg());
	private static string getArg()
	{
		if(cnt == args.Length) { args = Console.ReadLine().Split(); cnt = 0; }
		return args[cnt++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static decimal GetDecimal() => decimal.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(long N) => getArgs(N).Select(int.Parse).ToArray();
	public static long[] GetLongs(long N) => getArgs(N).Select(long.Parse).ToArray();
	public static double[] GetDoubles(long N) => getArgs(N).Select(double.Parse).ToArray();
	public static decimal[] GetDecimals(long N) => getArgs(N).Select(decimal.Parse).ToArray();
	public static string[] GetStrings(long N) => getArgs(N).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T> { if(x.CompareTo(y) < 0) x = y; }
	public static void chmin<T>(ref T x, T y) where T : IComparable<T> { if(x.CompareTo(y) > 0)	x = y; }
	public static void swap<T>(ref T x, ref T y) { T tmp = x; x = y; y = tmp; }
	public static long rightShift(long x, long y) => (x >> (int)y);
	public static long leftShift(long x, long y) => (x << (int)y);
	public static bool contains(long s, long x) => (rightShift(s, x) & 1L) == 1L;
	public static long gcd(long x, long y) => (y == 0) ? x : gcd(y, x % y);
	public static long lcm(long x, long y) => (x / gcd(x,y)) * y;	
	public static IEnumerable<int> Range(long start, long count) => Enumerable.Range((int)start, (int)count);
	public static void Sort(this List<string> source) => source.Sort(StringComparer.Ordinal);
}


Measured memory_bytes: 72572
#include <bits/stdc++.h>
using namespace std;
const int N = 100010, M = N + N;
int n, m;
int h[N], e[M], ne[N], ide = 0;
int inde[N] = {0}, ans[N], cnt = 0;
int dp[N];
void add(int x, int y)
{
	e[ide] = y, ne[ide] = h[x], h[x] = ide++;
}
int main()
{
	scanf("%d %d", &n, &m);
	memset(h, -1, sizeof h);
	for (int i = 0; i < m; i++)
	{
		int a, b;
		scanf("%d %d", &a, &b);
		add(a, b);
		inde[b]++;
	}
	//	for(int i = 1; i <= n; i ++ ) printf("%d--%d\n", i, inde[i]);
	queue<int> q;
	for (int i = 1; i <= n; i++)
	{
		if (inde[i] == 0)
			q.push(i);
	}

	while (!q.empty())
	{
		int t = q.front();
		ans[cnt++] = t;
		q.pop();

		for (int i = h[t]; i != -1; i = ne[i])
		{
			int j = e[i];
			inde[j]--;
			if (inde[j] == 0)
			{
				q.push(j);
				dp[j] = dp[t] + 1;
			}
		}
	}
	int len = -1;
	for(int i = 1; i <= n; i ++) len = max(len, dp[i]);
	printf("%d\n", len);
	return 0;
}


Measured memory_bytes: 2816
#include <iostream>
#include <vector>
#include <deque>
#include <cmath>
#include <bits/stdc++.h>
#include <limits>
using namespace std;

int main(void){
    // Your code here!
    long long n, k;
    vector<vector<long long>> ab;
    long long count = 0;
    
    cin >> n >> k;
    for(int i = 0; i < n; i++){
        vector<long long> temp(2, 0);
        cin >> temp[0] >> temp[1];
        ab.push_back(temp);
    }
    
    sort(ab.begin(), ab.end(), [](vector<long long> a, vector<long long> b){ return a[0] < b[0]; });
    
    for(int i = 0; i < n; i++){
        count += ab[i][1];
        if(count >= k){
            cout << ab[i][0] << endl;
            return 0;
        }
    }
        
    return 0;
}

Measured memory_bytes: 6452
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		int[] vn = new int[n];
		int[] cn = new int[n];
		int vMax = 0;
		for(int i = 0; i < n; i++) {
			vn[i] = sc.nextInt();
		}
		for(int i = 0; i < n; i++) {
			cn[i] = sc.nextInt();
			if(vn[i] > cn[i]) {
				vMax += vn[i] - cn[i];
			}
		}
		System.out.println(vMax);
	}

}


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

int main() {
	int n,l; cin>>n>>l;
	vector<int> flavors(n);
	long long sum=0;
	for(int i=0; i<n; i++){
		flavors[i] = l+(i+1)-1;
		sum += flavors[i];
	}
	long long  rta = 1e12;
	for(int i=0; i<n; i++){
		long long x =  abs(sum - (sum-flavors[i]));
		rta = min(rta,x);
	}
	if(sum>=0)cout<<sum-rta<<endl;
	else cout<<sum+rta<<endl;
}

Measured memory_bytes: 256
#! /usr/bin/env python3

import sys
import math
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

A, B = map(float, readline().split())

ans = int(A) * int(B * 1000000) // 1000000

print(int(ans))

Measured memory_bytes: 27152
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <utility>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>

// 10000 1 2
//  

using namespace std;

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



int main() {
	ll N;
	cin >> N;
	
	for(int h = 1; h <= 3500; h++) {
		for(int n = 1; n <= 3500;n ++) {
			ll left = 4 * h * n - N * (n + h);
			ll right = N * h * n;

			if (left > 0 && right % left == 0) {
				cout << h << " " << n <<  " " << right / left << endl;
				return 0;
			}
		}
	}
	return 0;
}

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

N = int(input())
S = input()

wc = S.count('.')
bc = 0
ans = wc + bc
for s in S:
    if s == '.':
        wc -= 1
    else:
        bc += 1
    temp = wc + bc
    ans = min(temp, ans)
        
print(ans)

Measured memory_bytes: 3500
unittest
{
	assert( [ "5 2 4" ].parse.expand.solve == "Alice" );
	assert( [ "2 1 2" ].parse.expand.solve == "Borys" );
	assert( [ "58 23 42" ].parse.expand.solve == "Borys" );
}



import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto nab = input.front.split.to!( long[] );
	return tuple( nab[ 0 ], nab[ 1 ], nab[ 2 ] );
}

auto solve( long n, long a, long b )
{
	if( ( b - a ) % 2 == 0 ) return "Alice";
	else                     return "Borys";
}


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

int main() {
  int N;
  cin >> N;
  map<int, int> factor;
  for (int i = 1; i <= N; i++) {
    if (i == 1) continue;
    int num = i;
    for (int j = 2; j*j <= i; j++) {
      if (num == 1) break;
      while(true) {
        if (num % j == 0) {
          num /= j;
          factor[j]++;
        }
        else break;
      }
    }
    if (num != 1) factor[num]++;
  }
  ll ans = 1;
  for (auto p : factor) {
    auto value = p.second;
    ans *= (value+1);
    if (ans >= 1000000007) ans %= 1000000007;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3632
#! /usr/local/bin/python3
# coding: utf-8

class DoublyLinkedNode:

    def __init__(self, x):
        self.prev = None
        self.next = None
        self.value = x

    def print(self):
        print(self.value, end = "")

class DoublyLinkedList:

    def __init__(self, n):
        self.head = None
        self.tail = None

    def insert(self, x):
        node = DoublyLinkedNode(x)
        node.prev = None
        node.next = self.head
        if self.head is None:
            self.tail = node
        else:
            self.head.prev = node
        self.head = node

    def delete(self, x):
        node = self.head
        while node is not None:
            if node.value == x:
                break
            node = node.next
        else:
            return

        if node is self.head and node is self.tail:
            self.head = None
            self.tail = None
        elif node is self.head:
            self.head = node.next
            node.next.prev = None
        elif node is self.tail:
            self.tail = node.prev
            node.prev.next = None
        else:
            node.prev.next = node.next
            node.next.prev = node.prev

    def delete_first(self):
        self.head = self.head.next
        if self.head is None:
            self.tail = None
        else:
            self.head.prev = None

    def delete_last(self):
        self.tail = self.tail.prev
        if self.tail is None:
            self.head = None
        else:
            self.tail.next = None

    def print(self):
        node = self.head
        while node is not None:
            node.print()
            node = node.next
            if node is not None:
                print(" ", end = "")
        print()

def _main():
    n = int(input())
    dll = DoublyLinkedList(n)

    import sys

    for l in sys.stdin:
        line = l.split()
        if line[0] == "insert":
            dll.insert(int(line[1]))
        elif line[0] == "delete":
            dll.delete(int(line[1]))
        elif line[0] == "deleteFirst":
            dll.delete_first()
        elif line[0] == "deleteLast":
            dll.delete_last()

    dll.print()

if __name__ == "__main__":
    _main()


Measured memory_bytes: 203848
#include <iostream>
using namespace std;
int main(){
    int N, K, X, Y;
    cin >> N >> K >> X >> Y;
    int sum = 0;
    for(int i = 0; i < N; i++) {
        if(i < K) sum += X;
        else sum += Y;
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!
import collections

S = list(input())
c = collections.Counter(S)
if len(c.most_common()) == 2:
    if c.most_common()[0][1] == 2 and c.most_common()[1][1]:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Measured memory_bytes: 3316
#include<bits/stdc++.h>
#define long long long
using namespace std;
int n,m,u,v,w,dis[100005],f,vis[100005],dd[100005];
vector<pair<int,int> >adj[100005];
void dfs(int node,int d)
{
    if(vis[node]==0)
    {
        vis[node]=1;
        dis[node]=d;
    }
    else
    {
        if(dis[node]!=d)f=1;
        return ;
    }
    for(int i=0;i<adj[node].size();i++)
    {
        int v=adj[node][i].first;
        int w=adj[node][i].second;
        dfs(v,d+w);
    }
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin>>n>>m;
    for(int i=1;i<=m;i++)
    {
        cin>>u>>v>>w;
        adj[u].push_back({v,w});
        dd[v]++;

    }
    for(int i=1;i<=n;i++)
    {
        if(!dd[i])dfs(i,0);
    }
    for(int i=1;i<=n;i++)if(!vis[i])f=1;
    if(f)cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
    return 0;
}


Measured memory_bytes: 11648
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = 1; i <= n; i++)
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
using P = pair <int, int>;
 
ll MOD = 1000000007;
ll INF =1<<29;

int main() {
     int n;
     cin >> n;
     vector<int> a(n);
     vector<pair<int,int>> b(n);
     rep(i,n) cin >> a[i];
     rep(i,n) a[i]--;
     rep(i,n){
         b.at(i)=make_pair(a[i],i);
     }
     sort(b.begin(),b.end());
     rep(i,n-1){
         cout << b[i].second+1<<' ' ;
     }
     cout <<b[n-1].second+1<< endl;
}

Measured memory_bytes: 2048
#include <iostream>
#include <utility>
#include <map>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <array>
#include <math.h>
#include <numeric>
#include <sstream>
#include <queue>
typedef long long ll;
using namespace std;
int main(int argc, char const *argv[]) {
    int n;
    cin >> n;
    vector<string> s(n);
    ll b[5];
    for(int i = 0; i < 5; ++i) b[i] = 0;
    for (int i = 0; i < n; ++i) {
        cin >> s[i];
        char c = s[i][0];
        if (c == 'M') b[0]++;
        else if (c == 'A') b[1]++;
        else if (c == 'R') b[2]++;
        else if (c == 'C') b[3]++;
        else if (c == 'H') b[4]++;
    }
    vector<ll> A;
    for (int i = 0; i < 5; ++i) for (int j = i+1; j < 5; ++j) for (int k = j+1; k < 5; ++k) A.push_back(b[i]*b[j]*b[k]);
    ll ans = 0;
    for (auto x: A) ans += x;
    cout << ans << std::endl;
    return 0;
}

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

import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians, log10
if sys.version_info.minor >= 5: from math import gcd
else: from fractions import gcd 
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul, xor
from copy import copy, deepcopy
from functools import reduce, partial
from fractions import Fraction
from string import ascii_lowercase, ascii_uppercase, digits
from datetime import date

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def round(x): return int((x*2+1) // 2)
def fermat(x, y, MOD): return x * pow(y, MOD-2, MOD) % MOD
def lcm(x, y): return (x * y) // gcd(x, y)
def lcm_list(nums): return reduce(lcm, nums, 1)
def gcd_list(nums): return reduce(gcd, nums, nums[0])
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N,M,C=MAP()
B=LIST()

ans=0
for _ in range(N):
    A=LIST()
    sm=0
    for i in range(M):
        sm+=A[i]*B[i]
    sm+=C
    if sm>0:
        ans+=1
print(ans)


Measured memory_bytes: 6132
import java.io.*;
import java.util.*;

final class Solver {
	static final Solver INSTANCE = new Solver();

	void solve(Iterator<String> sc) {
		int K = Integer.parseInt(sc.next());
		int S = Integer.parseInt(sc.next());
		int sum = 0;
		for (int x = 0; x <= K && x <= S; x++) {
			int remaining = S - x;
			sum += Math.max(Math.min(remaining, K) - Math.max(remaining - K, 0) + 1, 0);
		}
		System.out.println(sum);
	}
}

class Main {
	public static void main(String... args) {
		try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {
			Iterator<String> tokens = reader.lines().map(s -> s.split(" ")).flatMap(Arrays::stream).iterator();
			Solver.INSTANCE.solve(tokens);
		} catch (IOException e) {
			throw new UncheckedIOException(e);
		}
	}
}

Measured memory_bytes: 28372
#include<stdio.h>
#define MAX 100000
#define NIL -1


typedef struct{
  int parent;
  int left;
  int right;
}Node;

Node T[MAX];

int n;

int getDep(int u){

  int d=0;
  while(T[u].parent!=NIL){
    u=T[u].parent;
    d++;
  }
  return d;
}

void print(int u){

  int i,c;

  printf("node %d: parent = %d, depth = %d, ",u,T[u].parent,getDep(u));

  if(T[u].parent==NIL) printf("root, ");
  else if(T[u].left==NIL) printf("leaf, ");
  else printf("internal node, ");

  printf("[");\

  for(c=T[u].left,i=0;c!=NIL;c=T[c].right,i++){
    
    if(i!=0)printf(", ");
    printf("%d",c);

  }
  printf("]\n");
}


int main(){
  int kazu,i,j,jisuu,setten,l,d,r;
  
  scanf("%d",&n);

  for(i=0;i<n;i++) T[i].parent=T[i].left=T[i].right=NIL;
  
  for(i=0;i<n;i++){
    scanf("%d%d",&setten,&jisuu);

    for(j=0;j<jisuu;j++){      
      scanf("%d",&kazu);
      
      if(j==0) T[setten].left=kazu;
      else T[l].right=kazu;

      l=kazu;
      T[kazu].parent=setten;
    }
  }
  for(i=0;i<n;i++){
    if(T[i].parent==NIL) r=i;
  }

  
  for(i=0;i<n;i++){
    print(i);
  }

  return 0;
  
}



Measured memory_bytes: 3028
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define M (998244353)
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;
 
vector<ll>g[10010];
bool visited[10010];
int main(void){
    ll n;
    cin>>n;
    vector<ll>c(n),ans(n);
    for(ll i=0;i<n-1;i++){
        ll a,b;
        cin>>a>>b;
        a--;
        b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    ll m = 0;
    for(ll i=0;i<n;i++){
        cin>>c[i];
        m+=c[i];
    }
    sort(c.begin(),c.end(),greater<ll>());
    cout<<m-c[0]<<endl;
    ans[0]=c[0];
    queue<ll>que;
    ll index = 1;
    que.push(0);
    visited[0]=true;
    while(!que.empty()){
        ll now = que.front();
        que.pop();
        for(ll i=0;i<g[now].size();i++){
            ll next = g[now][i];
            if(visited[next])continue;
            ans[next]=c[index];
            index++;
            visited[next]=true;
            que.push(next);
        }
    }
    for(int i=0;i<n;i++){
        if(i==n-1)cout<<ans[i]<<endl;
        else cout<<ans[i]<<" ";
    }
    return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
const int N = 200000 + 10;
int n, a[N], mid;
bool d(int x) { return a[x] >= mid; }
bool check() {
    for (int i = 1; i < n; i++) {
        if (d(n + i) == d(n + i - 1)) return d(n + i);
        if (d(n - i) == d(n - i + 1)) return d(n - i);
    }
    return d(1);
}
int main() {
    scanf("%d", &n);
    for (int i = 1; i <= 2 * n - 1; i++) scanf("%d", &a[i]);
    int l = 1, r = 2 * n - 1, ans = 0;
    while (l <= r) {
        mid = (l + r) >> 1;
        if (check())
            ans = mid, l = mid + 1;
        else
            r = mid - 1;
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <string>
#include <cstring>
#include <sstream>
#include <algorithm>
using namespace std;

const int Maxn = 305;

int n, m;
int B[Maxn][Maxn];
int pnt[Maxn];
int cnt[Maxn];
bool el[Maxn];
int res = Maxn;

int main()
{
	scanf("%d %d", &n, &m);
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			scanf("%d", &B[i][j]);
		}
		pnt[i] = 0; cnt[B[i][0]]++;
	}
	for (int i = 0; i < m; i++) {
		int cand = 1;
		for (int j = 1; j <= m; j++)
			if (cnt[j] > cnt[cand]) cand = j;
		res = min(res, cnt[cand]);
		el[cand] = true;
		for (int r = 0; r < n; r++)
			if (B[r][pnt[r]] == cand) {
				cnt[cand]--;
				while (pnt[r] < m && el[B[r][pnt[r]]]) pnt[r]++;
				if (pnt[r] < m) cnt[B[r][pnt[r]]]++;
			}
	}
	printf("%d\n", res);
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define P pair<int,int>

int n,u,v,m;
int ux[510],uy[510];
int vx[510],vy[510];
int uu[2],vv[2];
map<int,P> mu,mv;

int main(){
  cin>>n>>u>>v>>m;

  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      int a;
      cin>>a;
      mu[a]=P(i,j);
    }
  }

  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      int a;
      cin>>a;
      mv[a]=P(i,j);
    }
  }

  int uc=0,vc=0;

  while(m--){
    int a;
    cin>>a;
//    cout<<a<<endl;
    if(mu.find(a)!=mu.end()){
      P pu=mu[a];
      int x=pu.second,y=pu.first;
//      cout<<"u  "<<x<<' '<<y<<endl;
      ux[x]++;
      uy[y]++;
      if(ux[x]==n) uc++;
      if(uy[y]==n&&n!=1) uc++;
      if(x==y&&n!=1){
        uu[0]++;
        if(uu[0]==n) uc++;
      }
      if(x+y+1==n&&n!=1){
        uu[1]++;
        if(uu[1]==n) uc++; 
      }
    }

    if(mv.find(a)!=mv.end()){
      P pv=mv[a];
      int x=pv.second,y=pv.first;
//      cout<<"v   "<<x<<' '<<y<<endl;
      vx[x]++;
      vy[y]++;
      if(vx[x]==n) vc++;
      if(vy[y]==n&&n!=1) vc++;
      if(x==y){
        vv[0]++;
        if(vv[0]==n&&n!=1) vc++;
      }
      if(x+y+1==n){
        vv[1]++;
        if(vv[1]==n&&n!=1) vc++; 
      }
    }
//    cout<<uc<<' '<<vc<<endl;

    if(uc>=u&&vc>=v){
      cout<<"DRAW"<<endl;
      return 0;
    }
    if(uc>=u){
      cout<<"USAGI"<<endl;
      return 0;
    }
    if(vc>=v){
      cout<<"NEKO"<<endl;
      return 0;
    }
    
  }

  cout<<"DRAW"<<endl;


}



Measured memory_bytes: 21040
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

using namespace std;

int main() {
	vector<int> p(5);
	for (int i = 0; i < 5; i++) {
		cin >> p[i];
	}
	int sumx = 0;
	int rest = 0;
	for (int i = 0; i < 5; i++) {
		sumx += p[i];
		rest += (10 - p[i] % 10) % 10;
	}

	
	int minn = 10000000000;
	for (int i = 0; i < 5; i++) {
		minn = min(minn, sumx + rest - (10 - p[i] % 10) % 10);
	}

	cout << minn << endl;


	return 0;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define PI 3.14159265358979
#define EPS 1e-8
#define mod 1000000007
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define endl "\n"
	 
const ll INF=(ll)2e18;	
const int N=1e5+5;
 

 
long long binpow(long long a, long long b, long long m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
ll modinverse(ll a,ll m)
{
	return binpow(a,m-2,m);
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(0);
	
	ll n;
	cin>>n;
	
	cout<<n+n*n+n*n*n;
}


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

int main() {
  string s;
  cin >> s;
  int n=s.size();
  int i,j;
  for(int k=0;k<n;k++){
    if(s.at(k) == 'A'){
      i = k;
      break;
    }
  }
  for(int k=n-1;k>0;k--){
    if(s.at(k) =='Z'){
      j = k;
      break;
    }
  }
  cout << j-i+1 << endl;
  
  return 0;
}


Measured memory_bytes: 640
#pypyは内包表記使わない
def main():
    import sys
    #input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations
    #from itertools import accumulate, product
    from bisect import bisect_left,bisect_right
    from math import floor, ceil
    #from operator import itemgetter

    #mod = 1000000007

    N = int(input())
    res = 0
    for _ in range(N):
        l, r = map(int, input().split())
        res += r-l+1
    print(res)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3316
package main

import (
	"fmt"
	"io"
	"os"
)

const Mod = 1000000007

var empty = byte('.')

func main() {
	sc := NewScanner(os.Stdin, 1024*64*2)
	h, w := sc.Int(), sc.Int()

	grid := make([][]byte, h)
	for i := 0; i < h; i++ {
		grid[i] = sc.Bytes()
	}

	var dp [1001][1001]int
	dp[0][0] = 1

	for i := 0; i < h; i++ {
		for j := 0; j < w; j++ {
			if grid[i][j] != empty {
				continue
			}
			if i == 0 && j == 0 {
				dp[i][j] = 1
				continue
			}
			if i == 0 {
				dp[i][j] = dp[i][j-1]
				continue
			}
			if j == 0 {
				dp[i][j] = dp[i-1][j]
				continue
			}

			dp[i][j] = (dp[i-1][j] + dp[i][j-1]) % Mod
		}
	}

	fmt.Println(dp[h-1][w-1])
}

type Scanner struct {
	r   io.Reader
	buf []byte
	sep byte
	eof bool
	iniSize, maxSize,
	start, end int
}

func NewScanner(r io.Reader, size int) *Scanner {
	return &Scanner{
		r:       r,
		iniSize: size,
		maxSize: 64 * 1024,
		sep:     ' ',
	}
}

func (s *Scanner) Bytes() (b []byte) {
	s.shift()
	for ; s.end < len(s.buf) && !s.skip(); s.read() {
		s.end++
		if s.sep == 0 {
			break
		}
	}
	b = s.buf[s.start:s.end]
	s.start = s.end
	return
}

func (s *Scanner) Int() int { return ParseInt(s.Bytes()) }

func (s *Scanner) shift() {
	for s.read(); s.end < len(s.buf) && s.skip(); s.read() {
		s.start++
		s.end++
	}
}

func (s *Scanner) skip() bool {
	b := s.buf[s.end]
	return b == '\n' || b == s.sep
}

func (s *Scanner) read() {
	if s.eof || s.end < len(s.buf) {
		return
	}
	s.extend()
	_, err := s.r.Read(s.buf[s.end:])
	if err == io.EOF {
		s.eof = true
	}
}

func (s *Scanner) extend() {
	size := len(s.buf) * 2
	if size == 0 {
		size = s.iniSize
	}
	if size > s.maxSize {
		size = s.maxSize
	}
	b := make([]byte, size)
	copy(b, s.buf[s.start:s.end])
	s.buf = b
	s.end -= s.start
	s.start = 0
}

func ParseInt(b []byte) (n int) {
	var i int
	if b[0] == '-' {
		i++
	}
	for ; i < len(b); i++ {
		n *= 10
		n += int(b[i] - '0')
	}
	if b[0] == '-' {
		return -n
	}
	return
}


Measured memory_bytes: 9472
from bisect import bisect_left
from sys import stdin


def primes235(limit):
    yield 2; yield 3; yield 5
    if limit < 7: return
    modPrms = [7,11,13,17,19,23,29,31]
    gaps = [4,2,4,2,4,6,2,6,4,2,4,2,4,6,2,6]
    ndxs = [0,0,0,0,1,1,2,2,2,2,3,3,4,4,4,4,5,5,5,5,5,5,6,6,7,7,7,7,7,7]
    lmtbf = (limit + 23) // 30 * 8 - 1
    lmtsqrt = (int(limit ** 0.5) - 7)
    lmtsqrt = lmtsqrt // 30 * 8 + ndxs[lmtsqrt % 30]
    buf = [True] * (lmtbf + 1)
    for i in range(lmtsqrt + 1):
        if buf[i]:
            ci = i & 7; p = 30 * (i >> 3) + modPrms[ci]
            s = p * p - 7; p8 = p << 3
            for j in range(8):
                c = s // 30 * 8 + ndxs[s % 30]
                buf[c::p8] = [False] * ((lmtbf - c) // p8 + 1)
                s += p * gaps[ci]; ci += 1
    for i in range(lmtbf - 6 + (ndxs[(limit - 7) % 30])): # adjust for extras
        if buf[i]: yield (30 * (i >> 3) + modPrms[i & 7])


def main():
    input = lambda: stdin.readline()[:-1]
    X = int(input())

    p = list(primes235(100003))
    i = bisect_left(p, X)
    print(p[i])


main()


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

const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

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

int main(){
    int n;
    cin >> n;
    vi a(n);
    rep(i, n) cin >> a[i];
    RSORT(a);
    ll ans = 0;
    rep(i, n-1) {
        int i2 = (i + 1) / 2;
        ans += a[i2];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4048
#include<cstdio>
#include<algorithm>
using namespace std;
int main(void)
{
	char s[5];
	scanf("%s",s);
	if((s[0]==s[1] && s[1]==s[2])||(s[1]==s[2] && s[2]==s[3]))	printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 128
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H):
    '''
    H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right

# https://atcoder.jp/contests/abc113/tasks/abc113_c
N, M = read_ints()
cnts = [0] * N
YPI = []
for i in range(M):
    p, y = read_ints()
    YPI.append((y, p - 1, i))

YPI.sort()  # 年の昇順に
IDs = []
for y, p, i in YPI:
    cnts[p] += 1
    x = str(cnts[p])
    p = str(p + 1)

    IDs.append((i, p.zfill(6) + x.zfill(6)))

IDs.sort()
for i, iid in IDs:
    print(iid)


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

int main(int argc, char** argv){
  int n;
  while(std::cin >> n, n){
    std::map<char, char> trans;
    for(; n > 0; --n){
      char before, after;
      std::cin >> before >> after;
      trans[before] = after;
    }
    std::cin >> n;
    for(; n > 0; --n){
      char c;
      std::cin >> c;
      if(trans.count(c) == 1) c = trans[c];
      std::cout << c;
    }
    std::cout << std::endl;
  }
}

Measured memory_bytes: 1192
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using Graph = vector<vector<int>>;
const int INF = 1e9 + 1;
const ll LLINF = 1e18;
const int MOD = 1e9 + 7;

int main() {
    int N;
    cin >> N;
    vector<int> d(N);
    for(int i = 0; i < N; ++i)
        cin >> d[i];

    int ans = 0;
    for(int i = 0; i < N; ++i) {
        for(int j = 1; i + j < N; ++j) {
            ans += d[i] * d[i + j];
        }
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
  int N, n;
  cin >> N;
  for (int i = 0; i < N; i++){
    int l, r;
    cin >> l >> r;
    for (int j = 0 ; j < r - l + 1; j++){
      n++;
    }
  }
  cout << n << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

void swap(int * a, int * b) {
        int tmp;
        tmp = *b;
        *b = *a;
        *a = tmp;
}

int main(void) {
        int x, y, z;

        scanf("%d %d %d",&x,&y,&z);
        swap(&x,&y);
        swap(&x,&z);
        printf("%d %d %d\n",x,y,z);
        return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <bitset>

#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define INF 2000000000
#define rep(i,n) for(int i=0;i<(n);i++)
typedef pair<int, int> P;
const ll MOD=1000000007;
using Graph = vector<vector<int>>;

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


ull gcd(ull a, ull b) {
    while (a % b != 0) {
        ull tmp = b;
        b = a % b;
        a = tmp;
    }
    return b;
}

ull lcm(ull a, ull b) {
    if (a == b) return b;
    ull g = gcd(a, b);
    return (a / g) * b;
}



int main() {
    int a, b, c;
    cin >> a >> b >> c;
    cout << c <<" "<< a <<" "<< b << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    int a,b,c,N,i;
    scanf("%d",&N);
    for(i=0;i<N;i++){
        scanf("%d %d %d",&a,&b,&c);
        if(a*a==b*b+c*c){
            printf("YES\n");
        }
        else if(b*b==a*a+c*c){
            printf("YES\n");
        }
        else if(c*c==b*b+a*a){
            printf("YES\n");
        }
        else{
            printf("NO\n");
        }

        }
return 0;
}

Measured memory_bytes: 576
#include <iostream>
#include <stdio.h>

using namespace std;

int main(void){
    int n = 0;
    int l = 0;
    int taste[200] = {0};

    cin >> n;
    cin >> l;

    for(int i=0;i<n;i++){
        taste[i] = l+(i+1)-1;
    }

    int value   = 1000000;
    int num     = 1000000;

    for(int i=0;i<n;i++){
        int abs = 0;
        if(taste[i] < 0){
            abs = -taste[i];
        }else{
            abs = taste[i];
        }

        if(abs < value){
            value = abs;
            num = i;
        }
    }

    // cout << num << endl;
    int ans = 0;

    for(int i=0; i<n;i++){
        if(num == i){
            continue;
        }
        ans += taste[i];
        // cout << ans << endl;
    }

    cout << ans;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    
    int F,S,T;
    if(a<=b && a<=c){
        F = a;
        if(b<=c){
            S = b;
            T = c;
        }
        else if(c<=b){
            S = c;
            T = b;
        }
    }
    else if(b<=a && b<=c){
        F = b;
        if(a<=c){
            S = a;
            T = c;
        }
        else if(c<=a){
            S = c;
            T = a;
        }
    }
    else if(c<=a && c<=b){
        F = c;
        if(a<=b){
            S = a;
            T = b;
        }
        else if(b<=a){
            S = b;
            T = a;
        }
    }
    printf("%d %d %d\n",F,S,T);
    
    return 0;
}


Measured memory_bytes: 2716
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+5,M=1e6+5,inf=0x3f3f3f3f,mod=1e9+7;
#define mst(a) memset(a,0,sizeof a)
#define lx x<<1
#define rx x<<1|1
#define reg register
#define PII pair<int,int>
#define fi first 
#define se second
int main(){
	int n;	
	cin>>n;
	int x=(n+999)/1000;
	printf("%d\n",x*1000-n);
	return 0;
}

Measured memory_bytes: 3744
while True:
    try:
        inp = raw_input()
        i, msg = 0, ""
        while i < len(inp):
            if inp[i] == "@":
                msg += inp[i+2]*int(inp[i+1])
                i += 3
            else:
                msg += inp[i]
                i += 1
        print msg
    except:
        break

Measured memory_bytes: 4208
#import numpy as np
import math
import collections
import bisect


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

dp0 = [[1 for i in range(d + 1)] for j in range(c + 1)]
dp1 = [[0 for i in range(d + 1)] for j in range(c + 1)]
for i in range(c + 1):
    for j in range(d + 1):
        if j < b or i < a:
            dp0[i][j] = 0
            dp1[i][j] = 0
for i in range(a, c + 1):
    for j in range(b, d + 1):
        # print(i, j, dp[i][j])
        if a == i and b == j:
            continue
        dp0[i][j] = ((i * dp0[i][j - 1]) % 998244353 + dp1[i][j - 1]) % 998244353
        dp1[i][j] = (j * (dp0[i - 1][j] + dp1[i - 1][j]) % 998244353) % 998244353

print((dp0[c][d] + dp1[c][d]) % 998244353)


Measured memory_bytes: 231788
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define pb push_back
#define mod 1000000007
#define ff first
#define ss second
#define endl "\n"
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int main()
{
    IOS
    int n,k=0,f=1;
    cin>>n;
    set<string> s;
    string prev,curr;
    cin>>prev;
    s.insert(prev);
    while(++k < n)
    {
        cin>>curr;
        if(prev.back() == curr[0])
        {
            s.insert(curr);
            prev = curr;
        }
        else
        {
            f = 0;
            break;
        }
    }
    if(s.size() == n && f)
    {
        cout<<"Yes";
    }
    else
    cout<<"No";
    return 0;
}

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

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


int main(void){
    int n; cin >> n;
    vector<int> a( n );
    REP( i, n ) cin >> a[i];
    
    int cnt = 1, result = 1;
    REP( i, n + 2 ){
        if( a[i] == 1 ) cnt++;
        else{
            result = max( cnt, result );
            cnt = 1;
        }
    }
    
    cout << result << endl;
}


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

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

int main(){
  ll h,n;
  cin >> h >> n;
  rep(i,n){
    ll a; cin >> a;
    h -= a;
  }
  if(h<=0){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
typedef unsigned long long int ull;
typedef long long lint;

int main(void){
    lint N,K;
    cin >> N >> K;
    lint A[N];
    rep(i,N) cin >> A[i];
    rep(i,N) A[i]--;
    plint Sum[N+1]={};
    Sum[0].first=0,Sum[0].second=0;
    rep(i,N){
        Sum[i+1].first=Sum[i].first+A[i];
        Sum[i+1].second=i+1;
    }
    rep(i,N+1) Sum[i].first%=K;
    lint ans=0;
    sort(Sum,Sum+N+1);
    lint num=Sum[0].first,count=0;
    lint las=0,top=1;
    lint begsave=0;
    for(int i=0;i<=N;i++){
        if(Sum[i].first==num) count++,top=Sum[i].second;
        else{
            count=1,num=Sum[i].first;las=Sum[i].second;
            begsave=i;
            continue;
        }
        if(top-las>=K){
            while(top-las>=K){
                count--;
                begsave++;
                las=Sum[begsave].second;
            }
        }
        ans+=count-1;
    }
    cout << ans << endl;
}

Measured memory_bytes: 4992
#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;
	return gcd(b, a % 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 MOD2 = 998244353;
const long long INF = 1LL << 60;


const int MAX_N = 100010;

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int k, x; cin >> k >> x;
	if (500 * k >= x) {
		cout << "Yes" << endl;
	}
	else cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 764
import java.util.Scanner;

public class Main{
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[][] nums = new int[n][];
		
		for (int i = 0; i < n; i++) {
			nums[i] = new int[10];
			for (int j = 0; j < 10; j++) {
				nums[i][j] = sc.nextInt();
			}
		}
		boolean flag = true;
		for (int i = 0; i < nums.length; i++) {
			int fnum=0,snum=0;
			flag = true;
			for (int j = 0; j < nums[i].length; j++) {
				if(nums[i][j]>fnum) fnum = nums[i][j];
				else if(nums[i][j]>snum) snum=nums[i][j];
				else {
					flag = false;
					break;
				}
			}
			if(flag) System.out.println("YES");
			else System.out.println("NO");
			
		}
		
	}

}



Measured memory_bytes: 26300
#include <bits/stdc++.h>
#define speedup ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
using namespace std;
#define ll long long

class Timer { chrono::high_resolution_clock::time_point start_t, end_t; public: Timer() { start_t=chrono::high_resolution_clock::now(); } ~Timer() { end_t = chrono::high_resolution_clock::now(); auto duration = chrono::duration_cast<chrono::milliseconds>(end_t-start_t); cout<<"\nRunTime: "<<duration.count()<<"ms"<<'\n'; } };

void solve() {
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<max({a*c,b*d,a*d,b*c})<<endl;
}

int main()
{
    speedup;
    #ifndef ONLINE_JUDGE
    Timer timer;
    #endif
    solve();
return 0;
}


Measured memory_bytes: 3680
import numpy as np
if __name__ == "__main__":
    # 入力パターン．
    # 先に要素数Nが与えられて，その数読み込むパターン
    ### N
    ### a_1 a_2 a_3 ... a_N
    N = int(input())
    # int型のリスト
    line = np.array(list(map(int, input().rstrip().split(' '))))
    ans = np.zeros(N)
    for l in line:
        ans[l-1] += 1
    for a in ans:
        print(int(a))

Measured memory_bytes: 50912
#pragma GCC optimize ("Ofast")
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i=(a); i<(b); i++)
#define FORD(i, a, b) for (int i=(a); i>(b); i--)
#define PPC(x) __builtin_popcount(x)
#define MSB(x) (31 - __builtin_clz(x))
#define SZ(x) ((int)(x).size())
#define pb push_back
#define ALL(x) (x).begin(), (x).end()
#define ithBit(m, i) ((m) >> (i) & 1)
#define ft first
#define sd second
#define kw(a) ((a) * (a))
#ifdef DEBUG
#include "debug.h"
#else
#define dbg(...) 0
#endif
using namespace std;
	
const int maxN = 1 << 19, maxTS = maxN * 2, maxK = 300000;

struct Tree
{
	int offset, qbegin, qend;
	int T[maxTS], res;
	
	void qpriv(int v, int left, int right)
	{
		if (left >= qend or right <= qbegin)	
			return;
		if (left >= qbegin and right <= qend)
		{
			res = max(res, T[v]);
			return;
		}
		qpriv(v * 2, left, (left + right) / 2);
		qpriv(v*2+1, (left + right) / 2, right);
	}
	
	void updt(int v, int val)
	{
		for (v += offset; v != 0; v /= 2)
			T[v] = max(T[v], val);
	}
	
	void init(int n)
	{
		for (offset = 1; offset < n; offset *= 2);			
	}
	
	int query(int a, int b)
	{
		qbegin = a + offset;
		qend = b + offset + 1;
		res = 0;
		qpriv(1, offset, offset * 2);
		return res;
	}
}tree;

void solve()
{	
	int n, k;
	scanf ("%d%d", &n, &k);
	tree.init(maxK + 13);
	FOR(i, 1, n+1)
	{
		int x;
		scanf ("%d", &x);
		int a = max(0, x-k), b = min(maxK, x+k);
		int y = tree.query(a, b) + 1;
		tree.updt(x, y);
	}
	printf("%d\n", tree.query(1, maxK));
}

 
int main()
{
	int t = 1;
	//scanf ("%d", &t);
	FOR(tid, 1, t+1)
	{
		//printf("Case #%d: ", tid);
		solve();
	}
	return 0;
}





Measured memory_bytes: 6196
import java.util.*;

class Main {
  static Scanner sc = new Scanner(System.in);

  public static void main(String[] args) {
    int n = sc.nextInt();
    ArrayList<Integer> list = new ArrayList<Integer>();
    int count = 1;
    int kisu = 0;
    while (n >= count) {
      int a = sc.nextInt();
      list.add(a);
      if (a % 2 != 0 && count % 2 != 0) {
        kisu = kisu + 1;
      }
      count++;
    }
    System.out.println(kisu);
  }
}

Measured memory_bytes: 35700
#include <stdio.h>

int main(){
  double max, min;
  double x;
  scanf("%lf", &x);
  min = max = x;
  while(scanf("%lf", &x) != EOF){
    if(min>x){
      min = x;
    }
    if(max < x){
      max = x;
    }
  }
  printf("%.1f\n", max-min);
  return 0;
}

Measured memory_bytes: 652
#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>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    for(int i = 1; i <= 1005; i++){
        double tmp = (double)(i);
        if((int)(tmp*0.08) == a && (int)(tmp*0.1) == b){
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 256