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

namespace _0092
{
    public class Program

    {

        const int SENT = 1;

        public static void Main(string[] args)
        {
            while (true)
            {
                int n = RInt();
                if (n == 0) break;

                int[,] dp = new int[n + SENT, n + SENT];
                for (int i = 0 + SENT ; i < n + SENT ; i++)
                {
                    string line = RSt();
                    for (int j = 0 + SENT ; j < n + SENT ; j++)
                    {

                        if (line[j - 1] == '*')
                        {
                            dp[i, j] = 0;
                        }
                        else
                        {
                            dp[i, j] = Math.Min(Math.Min(dp[i - 1, j], dp[i, j - 1]), dp[i - 1, j - 1]) + 1;
                        }
                    }
                }

                int ans = 0;
                for (int i = 0 + SENT ; i < n + SENT ; i++)
                {
                    for (int j = 0 + SENT ; j < n + SENT ; j++)
                    {
                        ans = Math.Max(ans, dp[i, j]);
                    }
                }
                Console.WriteLine(ans);
            }
        }

        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RStAr(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }

}



Measured memory_bytes: 33144
while True:
    x=input().split()
    a=int(x[0])
    b=int(x[1])
    if a ==0 and b==0:
        break
    print("#"*b)
    for i in range(a-2):
        print("#"+"."*(b-2)+"#")
    print("#"*b)
    print("")


Measured memory_bytes: 5612
class Node
  attr_accessor :go, :come

  def initialize(id)
    @id = id
    @go = []
    @come = []
  end
end

class Arrow
  attr_accessor :source, :sink, :label
  
  def initialize(source, sink, label)
    @source = source
    @sink = sink
    @label = label
    source.go << self
    source.come << self
  end
end

class Result
  attr_accessor :target, :spell

  def initialize(target, spell)
    @target = target
    @spell = spell
  end
end

def advance(table, nodes, arrows)
  next_table = {}
  nodes.each do |node|
    best = table[node]
    node.go.each do |arrow|
      result = table[arrow.sink]
      next unless result
      test = Result.new(arrow.sink, arrow.label + result.spell)
      if !best || test.spell < best.spell
        best = test
      end
    end
    next_table[node] = best if best
  end
  next_table
end

def check(table, node)
  used = {}
  loop do
    result = table[node]
    return false unless result
    node = result.target
    return true unless node
    return false if used[node]
    used[node] = true
  end
end

def work(nodes, arrows, start, goal)
  table = {goal => Result.new(nil, '')}
  (nodes.size*7).times do
    table = advance(table, nodes, arrows)
  end
  puts check(table, start) ? table[start].spell : 'NO'
end

while line = STDIN.gets
  n, a, s, g = line.split.map(&:to_i)
  break if n == 0 && a == 0 && s == 0 && g == 0

  nodes = (0...n).map{|i| Node.new(i)}

  arrows = (0...a).map do |i|
    x, y, lab = STDIN.gets.split
    x = x.to_i
    y = y.to_i
    Arrow.new(nodes[x], nodes[y], lab)
  end

  start = nodes[s]
  goal = nodes[g]

  work(nodes, arrows, start, goal)
end

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

int main() {
  int n;
  string s;
  cin >> n >> s;
  s = s[n-1]+s+s[0];
  vector<bool>ss(n+2),sw(n+2),ws(n+2),ww(n+2);
  ss[0] = 1;ss[1] = 1;
  sw[0] = 1;sw[1] = 0;
  ws[0] = 0;ws[1] = 1;
  ww[0] = 0;ww[1] = 0;
  vector<bool>v(n+2);
  rep(i,0,4){
    if(i == 0) v = ss;
    if(i == 1) v = sw;
    if(i == 2) v = ws;
    if(i == 3) v = ww;
    rep(j,1,n+1){
      if(s[j] == 'o'){
        if(v[j]) v[j+1] = v[j-1];
        else v[j+1] = !v[j-1];
      }
      else{
        if(v[j]) v[j+1] = !v[j-1];
        else v[j+1] = v[j-1];
      }
    }
    if(v[0] == v[n] && v[1] == v[n+1]){
      rep(j,1,n+1){
        if(!v[j]) cout << 'W';
        else cout << 'S';
      }
      cout << endl;
      return 0;
    }
  }
  cout << -1 << endl;
}

Measured memory_bytes: 3736
PROGRAM piyo
      IMPLICIT NONE
      INTEGER,PARAMETER :: p = 16
      integer(p) :: n,ans,i
      integer(p),allocatable :: a(:)
      
      read*,n
      allocate( a(n) )
      read*,a
      
      ans = 0
      do i = 1,n
        if( mod(i,2)==1 .and. mod(a(i),2)==1 )then
          ans = ans + 1
        end if
      end do
      
      print*,ans
      
      
      stop
      !debugg
      
      
      
      END PROGRAM

Measured memory_bytes: 2680
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1LL << 40;
#define FOR(i,k,n) for(int i=(k);i<(n);++i)
#define all(x) ((x).begin(),(x).end())

int main(){
    string s;cin >> s;
    bool f = true;
    FOR(i,0,s.size()){
        FOR(j,0,s.size()){
            if(i!=j && s[i]==s[j]){
                f = false;
                break;
            }
        }
    }
    if(f)cout << "yes" << endl;
    else cout << "no" << endl;
    return 0;
}

Measured memory_bytes: 384
# https://atcoder.jp/contests/abc129/tasks/abc129_e
MOD = (10**9) + 7
a = 1
b = 0
gets.chomp.bytes do |c|
  if c == 49
    b = (a + b * 3)%MOD
    a = (a * 2)%MOD
  else
    b = (b * 3)%MOD
  end
end

puts (a+b)%MOD

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

class Text {
public:
    void show(), append(string& s), exec_cmd(char c);
    Text(){
        _buf.clear();
        _col = _row = 0;
    }
private:
    vector<string> _text;
    string _buf;
    int _col, _row;
    void a(), e(), p(), n(), f(), b(), d(), k(), y();
};

void Text::show()
{
    for (vector<string>::iterator it = _text.begin(); it != _text.end(); it++){
        cout << *it << endl;
    }
}
void Text::append(string& s)
{
    _text.push_back(s);
}
void Text::exec_cmd(char c)
{
    switch (c){
      case 'a': a(); break;
      case 'e': e(); break;
      case 'p': p(); break;
      case 'n': n(); break;
      case 'f': f(); break;
      case 'b': b(); break;
      case 'd': d(); break;
      case 'k': k(); break;
      case 'y': y(); break;
    }
}
void Text::a(){ _col = 0; }
void Text::e(){ _col = _text[_row].size(); }
void Text::p(){ if (_row > 0) _row--; a(); }
void Text::n(){ if (_row < _text.size() - 1) _row++; a(); }
void Text::f(){
    if (_col < _text[_row].size()) _col++;
    else if (_row < _text.size() - 1){
        a();
        _row++;
    }
}
void Text::b(){
    if (_col > 0) _col--;
    else if (_row > 0){
        _row--;
        e();
    }
}
void Text::d(){
    if (_col < _text[_row].size()) _text[_row].erase(_col, 1);
    else if (_row < _text.size() - 1){
        _text[_row] += _text[_row + 1];
        _text.erase(_text.begin() + _row + 1);
    }
}
void Text::k(){
    if (_col < _text[_row].size()){
        _buf = _text[_row].substr(_col, _text[_row].size() - _col);
        _text[_row] = _text[_row].substr(0, _col);
    }
    else if (_row < _text.size() - 1){
        d();
        _buf = "\n";
    }
}
void Text::y(){
    if (!_buf.empty()){
        if (_buf == "\n"){
            _text.insert(_text.begin() + _row + 1, _text[_row].substr(_col, _text[_row].size() - _col));
            _text[_row].erase(_col, _text[_row].size() - 1);
            _row++;
            a();
        }
        else {
            _text[_row].insert(_col, _buf);
            _col += _buf.size();
        }
    }
}

int main()
{
    Text text;

    string in;
    while (getline(cin, in), in != "END_OF_TEXT"){
        text.append(in);
    }

    char cmd;
    while (cin >> cmd, cmd != '-'){
        text.exec_cmd(cmd);
    }
    text.show();

    return (0);
}

Measured memory_bytes: 1220
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
#define PAUSE \
	int t;    \
	cin >> t
#define int long long
#define vi vector<long long>
#define mapii map<long long, int>
#define mapci map<char, int>
#define append(x) push_back(x)
#define tcase          \
	long long t;       \
	scanf("%lld", &t); \
	while (t--)
#define prq priority_queue
#define fio                           \
	ios_base::sync_with_stdio(false); \
	cin.tie(NULL)
// #define debug(x, y) cout<<"case #"<<x<<" at itr #"<<y<<endl
#define debug(x) cout << "case #" << x << endl
#define ff first
#define ss second
#define range(ini, x) for (int itr = ini; itr < x; itr++)
#define takearr(x)    \
	for (auto &i : x) \
	cin >> i
#define print(x)     \
	for (auto i : x) \
		cout << i << " ";
#define FOR(x, y) for (int i = x; i < y; i++)
#define for0(i, n) for (int i = 0; i < n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
#define foreach(i, x) for (auto i : x)
#define vi2d vector <array<int,2>>
#define setbitcount __builtin_popcount
//******************/
// #ifndef ONLINE_JUDGE
// 	freopen("input.txt", "r", stdin);
// 	freopen("output.txt", "w", stdout);
// #endif
//******************/
// #define range(ini, x, step) for( int itr = ini, i < x; itr += step )
using namespace std;
// using namespace __gnu_pbds;
// template < class type > using oset=tree<type, null_type,less<type>, rb_tree_tag,tree_order_statistics_node_update>;
const int mmx = 1e5 + 5;
const int mnx = 1e4 + 1;
const int mmod = 1e9 + 7;

int dp[105][mmx];
int n, w;
vi2d arr;

int func( int index, int weight ){

if( dp[index][weight] != -1 ) return dp[index][weight];

if( index >= n ){
	dp[index][weight] = 0;
	return dp[index][weight];
}
if( weight <= 0 ){
	dp[index][weight] = 0;
	return dp[index][weight];
}

int a = 0, b = 0;
if( arr[index][0] <= weight ){
	a = ( arr[index][1] ) + func( index + 1, weight - arr[index][0] );
}

	dp[index][weight] =  max( a, func( index + 1, weight ) );
	return dp[index][weight];

}

signed main()
{

	memset( dp, -1, sizeof dp );

	cin>>n>>w;
	for0(i,n){
		int x, y;
		cin>>x>>y;
		arr.push_back({ x, y });
	}

	cout<<func(0,w);

	return 0;
}

Measured memory_bytes: 82304
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    ll X;
    cin >> X;

    ll ans = X / 500 * 1000;
    ll xm = X % 500;
    ans += xm / 5 * 5;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
char c[201][201];
int d[201][201];
int e[201];
bool dfs(int id){
	for(int i=1; i<=n ;i++){
		if(c[id][i]=='0') continue;
		if(e[id]==e[i]) return false;
		if(e[i]!=0) continue;
		e[i]=3-e[id];
		if(!dfs(i)) return false;
	}
	return true;
}
int main(){
	ios::sync_with_stdio(false);
	cin >> n;
	for(int i=1; i<=n ;i++){
		for(int j=1; j<=n ;j++){
			cin >> c[i][j];
			d[i][j]=1e9;
			if(c[i][j]=='1') d[i][j]=1;
		}
		d[i][i]=0;
	}
	e[1]=1;
	if(!dfs(1)) return cout << "-1\n",0;
	for(int k=1; k<=n ;k++)
	for(int i=1; i<=n ;i++){
		for(int j=1; j<=n ;j++){
			d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
		}
	}
	int ans=0;
	for(int i=1; i<=n ;i++){
		for(int j=1; j<=n ;j++){
			ans=max(ans,d[i][j]);
		}
	}
	cout << ans+1 << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//#include <boost/math/common_factor_rt.hpp>
#define USE_MATH_DEFINES
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;
// namespace mp = boost::multiprecision;
// namespace mt = boost::math
// using Bint = mp::cpp_int;

int main() {
    long long l, r, ans = 999999999;
    cin >> l >> r;
    for (int i = l; i < r && i < l + 2019; i++) {
        for (int j = i + 1; j <= r && j < i + 2020; j++) {
            if (ans > ((i % 2019) * (j % 2019)) % 2019)
                ans = ((i % 2019) * (j % 2019)) % 2019;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
#include <numeric>
using namespace std; using ll = long long; using ld = long double;  using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
using vs = vector<string>; using tll = tuple<ll, ll, ll>; using vtll = vector<tll>;
const ld PI = 3.1415926535897932;
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define co(i) cout << i << endl;
#define co2(i,j) cout << i << " " << j << endl;
#define co3(i) cout << i << " ";
#define po(i) cout << i.first << " " << i.second << endl;
void in() {}
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop, bitSearch, bitList, nod//
//gcdlcm, isPrime, eratos, primeFactorize, Npow, combination, divisor, modinv, doubling, digitDP//
//dfs, bfs, dijkstra, WarshallFloyd, BellmanFord, UnionFind, Kruskal, RMQ, LCA//
ll i, j, k, l; ll N, M, K, H, W, L, X, Y, Z, R, Q;
ll MOD = 1000000007, INF = 1LL << 60, ans = 0, z = 0, o = 1;
vll flag, D; vpll path;
//***********//
ll Npow(ll x, ll n) {
	if (n == 0) return 1;
	if (n % 2 == 0) return Npow(x * x % MOD, n / 2);
	else return x * Npow(x, n - 1) % MOD;
}
ll modinv(ll a, ll m) {
	ll b = m, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
//main内でCOMinit(N+1)を忘れずに！
vl fac, finv, inv;
void COMinit(ll N) {
	fac.resize(N);
	finv.resize(N);
	inv.resize(N);
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (ll i = 2; i < N; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}
ll COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main() { 
	cin >> K;
	string S;
	cin >> S;
	N = S.length();
	COMinit(N + K + 1);
	for (k = N; k <= N+K; k++) {
		(ans += ((COM(k - 1, N - 1) * Npow(25,k-N))%MOD * Npow(26, K+N-k))%MOD)%=MOD;
	}
	cout << ans;
	//681708971
}

Measured memory_bytes: 51200
def main():
    X, N = map(int, input().split())
    A = list(map(int, input().split()))
    A_s = set(A)
    candidate = []
    for i in range(-1, 102):
        if i not in A_s:
            candidate.append(i)

    ans = 10**6
    ans_val = 0
    for c in candidate:
        temp = abs(c-X)
        if temp < ans:
            ans = temp
            ans_val = c
    print(ans_val)

        
if __name__ == "__main__":
    main()

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

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define N_MAX 100
int n, x, a[N_MAX], i, m;
int main()
{
	scanf("%d %d", &n, &x);
	for (i = 0; i < n; ++i)
		scanf("%d", &a[i]);
	std::sort(a, a + n);
	for (i = 0; i < n - 1 && x >= a[i]; ++i)
		x -= a[i], ++m;
	m += x == a[n - 1];
	printf("%d\n", m);
	return 0;
}

Measured memory_bytes: 256
using System;

class Program
{
    static void Main(string[] args)
    {
        var nm = Console.ReadLine().Split();
        var n = int.Parse(nm[0]);
        var m = int.Parse(nm[1]);

        var a = new bool[n, n];
        for (int i = 0; i < n; i++)
        {
            var s = Console.ReadLine();
            for (int j = 0; j < n; j++)
            {
                a[i, j] = s[j] == '#';
            }
        }

        var b = new bool[m, m];
        for (int i = 0; i < m; i++)
        {
            var s = Console.ReadLine();
            for (int j = 0; j < m; j++)
            {
                b[i, j] = s[j] == '#';
            }
        }

        for (int i = 0; i < n - m + 1; i++)
        {
            for (int j = 0; j < n - m + 1; j++)
            {
                var all = true;
                for (int x = 0; x < m; x++)
                {
                    for (int y = 0; y < m; y++)
                    {
                        all &= a[i + x, j + y] == b[x, y];
                    }
                }
                if (all)
                {
                    Console.WriteLine("Yes");
                    return;
                }
            }
        }

        Console.WriteLine("No");
    }
}


Measured memory_bytes: 11092
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();
		System.out.printf("%d %d %.10f\n", a/b,a%b,(double)a/(double)b);
	}
}



Measured memory_bytes: 26440
import java.util.Scanner;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int N = sc.nextInt();
   int K = sc.nextInt();
   int Q = sc.nextInt();
   int[] A = new int[N];
   for(int i=0;i<Q;i++ )
   {
     int ia = sc.nextInt();
     A[ia-1]++; 
   }
   for(int i=0;i<N;i++ )
   {
     if(A[i]>Q-K) System.out.println("Yes");
     else System.out.println("No");
   }
 
   
 }
}

Measured memory_bytes: 57388
N, K = map(int, input().split())
ans = 0
for i in range(1, N+1):
  if (i <= K-1):
    cnt = 0
    while (i <= K-1):
      i = i * 2
      cnt += 1
    ans += 1 / N * (1 / 2)**cnt
  else:
    ans += (N - (i - 1)) / N
    break
    
print(ans)
 

Measured memory_bytes: 2940
n,m,x,y = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
ans = "War"
am = max(a)
bm = min(b)
for z in range(x+1,y+1):
    if am<z and bm>=z:
        ans = "No War"
        break
print(ans)

Measured memory_bytes: 3064
N=int(input())
l=list(list(map(int,input().split())) for i in range(N))
dp=[[0]*3 for _ in range(N)]
for i,I in enumerate(l):
    if i==0:
        dp[0]=l[0]
    else:
        for k in range(3):
            dp[i][k]=max(dp[i-1][j]+l[i][k]  if j!=k else 0 for j in range(3))
print(max(dp[N-1]))


Measured memory_bytes: 74968
#include<iostream>
#include<algorithm>
using namespace std;
void elec() {
    int n, k; cin >> n >> k;
    int x[n - 1];
    long long sum = 0;
    int bef;
    for (int i = 0; i < n; ++i) {
        int nex; cin >> nex;
        if (i) {
            x[i - 1] = abs(nex - bef);
            sum += x[i - 1];
        }
        bef = nex;
    }
    sort(x, x + n - 1, greater<int>());
    for (int i = 0; i < min(k - 1, n - 1); ++i) {
        sum -= x[i];
    }
    cout << sum << endl;
}
int main() {
    int n; cin >> n;
    for (int i = 0; i < n; ++i) {
        elec();
    }
    return 0;
}



Measured memory_bytes: 3540
#include <cstdio>
#include <cstring>
#include <iostream>
#include <set>

using namespace std;
#define DEBUG(X) cerr<<__LINE__<<" "<<#X<<": "<<X<<endl;
#define sci(x) int x;scanf("%d",&x);
#define scii(x, y) int x,y;scanf("%d%d",&x,&y);
typedef long long ll;
int main() {
  scii(A,B) sci(C)
  ll sum=0;
  set<int> st;
  while(true) {
    sum+=A;
    int m = sum%B;
    if (m == C) {
      printf("YES\n");
      return 0;
    } else if (st.find(m) == st.end()) {
      st.insert(m);
    } else {
      printf("NO\n");
      return 0;
    }
  }
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int A = s.nextInt();
		int B = s.nextInt();
		int count = 0;

		for (int i = A; i <= B; i++) {
			String str = String.valueOf(i);
			if (str.substring(0, 1).equals(str.substring(4, 5))) {
				if (str.substring(1, 2).equals(str.substring(3, 4))) {
					count++;
				}

			}
		}
		System.out.println(count);
	}
}

Measured memory_bytes: 36820
import sys
input = sys.stdin.readline
L, R = [int(x) for x in input().strip().split()]
MODL, MODR = L % 2019, R % 2019
if R - L >= 2019 or MODL > MODR:
  print(0)
else:
  print(min([(i * j) % 2019 for i in range(L, R) for j in range(i+1, R+1)]))


Measured memory_bytes: 75420
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
  int a, b;
  cin >> a >> b;
  int c = a + b;
  if(c % 2 == 0){
    cout << c/2 << endl;
  }else{
    cout << "IMPOSSIBLE" << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//#define rep(i,n) for (int i=0;i<(n);++i)
int gcd(int p,int q){
    if(p%q==0)return q;
    return gcd(q,p%q);
}

int main(){
//srandom((unsigned long)time(NULL));


long long k;
cin>>k;
vector<long long> a;
vector<long long> b;
vector<long long> c;
for(long long i=1;i<=k;i++){
    a.emplace_back(i);
    b.emplace_back(i);
    c.emplace_back(i);
}

long long ans=0;
for(long long x:a){
    for(long long y:b){
        for(long long z:c){
            ans+=gcd(gcd(x,y),z);
        }
    }
}
cout<<ans<<endl;

return 0;
}



Measured memory_bytes: 3644
import java.util.*;

class Main {
	Scanner sc;
	String N;
	int K;
	
	private void calc() {
		sc = new Scanner(System.in);
		N = sc.next();
		K = sc.nextInt();

		switch (K) {
		case 1:
			System.out.println(case1(N));
			break;
		case 2:
			System.out.println(case2(N));
			break;
		case 3:
			System.out.println(case3(N));
		}
	}

	private int case1(String n) {
		int s = 0;
		int len = n.length();
		int d = n.charAt(0) - '0';
		s = d; // 最上位桁のみある場合
		// 最上位桁が 0 ならいずれかの桁が 1～9
		s += 9 * (len-1);
		return s;
	}

	private int case2(String n) {
		// K=2 の場合
		int s = 0;
		int len = n.length();
		int d = n.charAt(0) - '0';
		// 最上位桁が1以上で小さい場合
		s = (d-1)*(len-1)*9;
		// 最上位桁が一致する場合, 残った数字に対して K=1 を適用
		s += case1(trim(n));
		// 最上位桁が0の場合 nCr(len-1,2) * 9^2
		if (len > 2) s += (len-1)*(len-2)/2*9*9;
		return s;
	}

	private int case3(String n) {
		int s = 0;
		int len = n.length();
		int d = n.charAt(0) - '0';
		s = (d-1)*(len-1)*(len-2)/2*9*9;
		s += case2(trim(n));
		if (len > 3) s += (len-1)*(len-2)*(len-3)/6*9*9*9;
		return s;
	}

	private String trim(String n) {
		int i = 1;
		for (; i < n.length(); i++) {
			if (n.charAt(i) != '0') break;
		}
		if (i == n.length()) return "0";
		return n.substring(i);
	}
	
	public static void main(String[] args) {
		new Main().calc();
	}
}


Measured memory_bytes: 23124
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long a = sc.nextLong();
    long b = sc.nextLong();
    long c = sc.nextLong();
    long d = sc.nextLong();
    sc.close();
    long ans = Long.MIN_VALUE;
    ans = Math.max(ans, a * c);
    ans = Math.max(ans, a * d);
    ans = Math.max(ans, b * c);
    ans = Math.max(ans, b * d);
    System.out.println(ans);
  }
}

Measured memory_bytes: 35684
#include<bits/stdc++.h>
using namespace std;
long long read()
{
	char ch=getchar();long long x=0,ff=1;
	while(ch<'0'||ch>'9') {if(ch=='-') ff=-1;ch=getchar();}
	while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
	return x*ff;
}
void write(long long aa)
{
	if(aa<0) putchar('-'),aa=-aa;
	if(aa>9) write(aa/10);
	putchar(aa%10+'0');
	return;
}
long long n,len,qwq,now;
long long emm;
long long a[205];
int main()
{
	n=read();
	for(long long i=1;i<=41;++i) if((1ll<<i)>n) break;else qwq=i;
	now=qwq;emm++;
	n-=(1ll<<qwq);
	if(n&1) now++,a[++len]=now;
	for(long long i=1;i<=qwq;++i)
	{
		a[++len]=i;
		if(n&(1ll<<i)) now++,a[++len]=now;
	}
	for(long long i=1;i<=qwq;++i) a[++len]=i;//cout<<"111"<<endl;
	for(long long i=now;i>qwq;--i) a[++len]=i;
	for(long long i=1;i<=emm;++i) now++,a[++len]=now,a[++len]=now;
	write(len);puts("");
	for(long long i=1;i<=len;++i) write(a[i]),putchar(' ');
	return 0;
}

Measured memory_bytes: 256
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e5+1;
const int INF = 2e9;
vector<int> adj[N];
int ans[N],dp[N],ar[N];
int n;
int lb(int val){
	int l=0,r=n;
	while(l < r){
		int m = (l+r)/2;
		if(dp[m] >= val) r = m;
		else l = m+1;
	}
	return r;
}
void dfs(int nw = 0, int par = -1){
	int idx = lb(ar[nw]);
	int temp = dp[idx];
	dp[idx] = ar[nw];
	int sz = lb(INF);
	ans[nw] = sz;
	for(auto ch : adj[nw]){
		if(par == ch) continue;
		dfs(ch,nw);
	}
	dp[idx] = temp;
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cin >> n;
	for(int i=0;i<n;i++) cin >> ar[i];
	for(int i=0;i<=n;i++) dp[i] = INF;
	for(int i=1;i<n;i++){
		int u,v;cin >> u >> v;
		u--,v--;
		adj[u].emplace_back(v);
		adj[v].emplace_back(u);
	}
	dfs();
	for(int i=0;i<n;i++) cout << ans[i] << '\n';
}


Measured memory_bytes: 31256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <queue>
#include <numeric>
#include <climits>
#include <iterator>
#include <functional>
using ll = long long;
const ll mod = 1000000007;

using namespace std;

typedef std::pair<std::string,double> P;

struct less {
	bool operator()(const P& x, const P& y) const {
        if(x.second==y.second){
            return x.first < y.first;
        }
		return x.second > y.second;
	}
};


struct data{
    int c;
    int s;
    int f;
};
    
int N; 
int main() {
    cin >> N;
    vector<data> v;
    for(int i=0; i<N; ++i){
        int a, b, c; cin >> a >> b >> c;
        data t = {a, b, c};
        v.push_back(t);
    }
    for(int i=0; i<N; ++i){
        int cnt=0;
        for(int j=i; j<N-1; ++j){
            if(cnt<v[j].s) cnt = v[j].s;
            if(cnt%v[j].f!=0) cnt+=v[j].f-(cnt%v[j].f);

            cnt += v[j].c;
        }
                    cout << cnt << endl;
    }
    //cout << 0 << endl;
	return 0;
}

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

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using   P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

// 汎用マクロ
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(i,q) for (auto &i : q)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#define SZ(x) ((int)(x).size())
template <class T>inline bool chmin(T &a, const T b) {if (a > b) { a = b; return true;} return false;}
template <class T>inline bool chmax(T &a, const T b) {if (a < b) { a = b; return true;} return false;}
template <class T>inline void line_out(const vector<T> vec) {int n = SZ(vec); rep(i, n) { cout << vec[i]; if(i < n-1) cout << " ";}cout << endl;}
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 55;
const int mod = 1000000007;
//const int mod = 998244353;
struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

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

int main()
{
  int n; cin >> n;
  vector<string> s(n);
  rep(i, n) cin >> s[i];
  map<char, ll> mp;
  rep(i, n) ++mp[s[i].front()];
  char x[5] = {'M', 'A', 'R', 'C', 'H'};
  ll ans = 0;
  rep(i, 5) for(int j = i+1; j < 5; ++j) for(int k = j+1; k < 5; ++k) ans += mp[x[i]] * mp[x[j]] * mp[x[k]];
  cout << ans << endl;

}


Measured memory_bytes: 6368
#include<iostream>
#include<vector>
#include<string>
#define swap(a,b) ((a != b) && (a += b,b = a - b,a -= b))
using namespace std;


int gcd(int a,int b){
    if(a<b)swap(a,b);
    if(a%b==0)return b;
    return gcd(b,a%b);
}

int main()
{
    int n;
    double a;
    string s;
    cin >> n;

    double sum=0;
    for(int i=0;i<n;i++){
        cin >> a >> s;
        if(s=="JPY"){
            sum+=a;
        }else{
            sum+=380000*a;
        }
    }

    cout<<sum<<endl;
    return 0;
}






Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;

int main() {
    
    int N,M;
    cin >> N >> M;
    
    long long ans = 1;
    for ( int i = 0; i < M; i++ ) {
        ans *= 2;
    }
    
    ans *= 1900*M + 100*(N-M);
    
    cout << ans << endl;
    
    
    
    
    
    return 0;
}

Measured memory_bytes: 256
import numpy as np
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    N = int(readline())
    X = [int(i) for i in readline().split()]
    X = np.array(X)

    ans = np.min(np.sum((X - np.arange(1,101).reshape(100, 1))**2, axis=1))
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 13232
a=int(input())
b=int(input())
c=int(input())
x=int(input())

cnt=0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if i*500+j*100+k*50 == x:
                cnt+=1
print(cnt)

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

using namespace std;
 
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef int64_t ll; typedef vector<int> VI; typedef pair<int,int> pii;
const ll mod = 1e9+7;

void dbg(){ cerr << "\n"; }  
template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }

int main()
{
 
	//cin.tie(0); ios_base::sync_with_stdio(false);
	
	int n;
	cin >>n;
	VI t(n), x(n), y(n);
	rep(i, n) cin >>t[i] >>x[i] >>y[i];
	int cx=0, cy=0, ct=0;
	bool ok = true;
	rep(i, n){
		int dx = abs(x[i] - cx), dy = abs(y[i] - cy);
		int dt = t[i] - ct;
		if(dx+dy > dt) ok=false;
		if((dx+dy - dt)%2 ) ok=false;
		cx=x[i]; cy=y[i]; ct = t[i];
	}
	cout <<(ok? "Yes": "No") <<"\n";
	return 0;
}


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

int main(){
    int n;
    cin >> n;

    long long y, left;
    cin >> y;
    for(int i=n;i>=0;i--){
        for(int j=n;j>=0;j--){
            if(i+j>n or i*1000+j*5000>y)continue;
            left = y-(i*1000LL+j*5000LL);
            if( left%10000 == 0 and left/10000 + i + j == n ){
                cout << left/10000 << ' ' << j << ' ' << i << endl;
                return 0;
            }
        }
    }
    cout << "-1 -1 -1";
    return 0;
}

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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "cycle"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 1e5 + 5;

map<pii, int> cnt;

ll ans[10];

void solve(){
	int n, x, y, w, h;
	scanf("%d%d%d", &h, &w, &n);
	REP(i, 0, n){
		scanf("%d%d", &y, &x);
		REPN(x1, x - 2, x){
			REPN(y1, y - 2, y){
				if (x1 >= 1 && x1 + 2 <= w && y1 >= 1 && y1 + 2 <= h){
					cnt[mp(x1, y1)]++;
				}
			}
		}
	}
	FA(it, cnt){
		ans[it->second]++;
	}
	ans[0] = (ll)(w - 2) * (ll)(h - 2);
	REP(i, 1, 10){
		ans[0] -= ans[i];
	}
	REP(i, 0, 10){
		printf("%lld\n", ans[i]);
	}
}	

int main(){

	//freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();	
	}
}

Measured memory_bytes: 56448
# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0
# abcde	s=input()	s='abcde'
# abcde	s=list(input())	s=['a', 'b', 'c', 'd', 'e']
# 5(1つだけ)	a=int(input())	a=5
# 1 2	x,y = map(int,input().split())	x=1,y=2
# 1 2 3 4 5 ... n 　	li = input().split()	li=['1','2','3',...,'n']
# 1 2 3 4 5 ... n 　	li = list(map(int,input().split()))	li=[1,2,3,4,5,...,n]
# FFFTFTTFF 　	li = input().split('T')	li=['FFF', 'F', '', 'FF']

# 3
# hoge
# foo
# bar
# n=int(input())
# string_list=[input() for i in range(n)]
S=input()
ans = 753
for i in range(len(S)-2):
    num = int(S[i:i+3])
    if(abs(753-num)<ans):
        ans = abs(753-num)
print(ans)

Measured memory_bytes: 2940
#include<iostream>
#include <cmath>
using namespace std;
using ll = long long;
int main(){
    ll N,A,B,C;
    cin >> N >> A >> B >> C;
    int l[8] = {};
    for(int i = 0; i < N; i++) cin >> l[i];
    int d[8];
    ll ans = 10000000000;
    
    for(int i = 0; i < 4; i++){
        d[0] = i;
        for(int j = 0; j < 4; j++){
            d[1] = j;
            for(int k = 0; k < 4; k++){
                d[2] = k;
                for(int m = 0; m < 4; m++){
                    d[3] = m;
                    for(int n = 0; n < 4; n++){
                        d[4] = n;
                        for(int o = 0; o < 4; o++){
                            d[5] = o;
                            for(int p = 0; p < 4; p++){
                                d[6] = p;
                                for(int q = 0; q < 4; q++){
                                    d[7] = q;
                                    ll a = 0,b = 0,c = 0,interim = 0;
                                    for(int z = 0; z < N; z++){
                                        if(d[z] == 0){
                                            a += l[z];
                                            interim += 10;
                                        }
                                        else if(d[z] == 1){
                                            b += l[z];
                                            interim += 10;
                                        }
                                        else if(d[z] == 2){
                                            c += l[z];
                                            interim += 10;
                                        }
                                    }
                                    if(a == 0 || b == 0 || c == 0) continue;
                                    interim += (abs(A-a) + abs(B-b) + abs(C-c) - 30);
                                    if(ans > interim) ans = interim;
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    cout << ans << "\n";
    return 0;
}


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

int V,R;
vector<P> A;
vector< vector<double> > G;
double ans=0;

double distance(int I,int J){
  P from=A[I];
  P to=A[J];
  P base=to-from;

  int left=0,right=0;
  for(int i=0;i<V;i++){
    if(i==I||i==J)continue;
    P p=conj(base)*(A[i]-from);
    if(p.imag()<0)left=1;
    if(p.imag()>0)right=1;
  }

  double res=abs(base);
  if(left==0||right==0){
    ans+=res;
    res=0;
  }
  return res;
}

int main(){
  cin>>V>>R;
  A.resize(V);
  for(int i=0;i<V;i++){
    double x,y;
    cin>>x>>y;
    A[i]=P(x,y);
  }

  G.resize(V);
  for(int i=0;i<V;i++){
    G[i].resize(V);
    for(int j=0;j<i;j++){
      
      double value=distance(i,j);
      if(value==0)G[i][j]=G[j][i]=0;
      else G[i][j]=G[j][i]=1e9;
    }
  }

  for(int i=0;i<R;i++){
    int I,J;
    cin>>I>>J;
    I--,J--;
    if(G[I][J]==0)continue;
    double value=distance(I,J);
    G[I][J]=value;
    G[J][I]=value;
  }
  
  vector<double> d(V,1e9);
  vector<int> visited(V,0);
  d[0]=0;
  
  while(1){
    int pos=-1;
    for(int i=0;i<V;i++)
      if(visited[i]==0)
        if(pos==-1||d[i]<d[pos])
          pos=i;
    if(pos==-1)break;
    visited[pos]=1;
    ans+=d[pos];
    for(int to=0;to<V;to++){
      d[to]=min(d[to],G[pos][to]);
    }
  }

  printf("%.10f\n",ans);
  return 0;
}

Measured memory_bytes: 3428
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>

using namespace std;

int main() {
  int n;
  cin >> n;

  vector<long> a(n);
//   vector<int> w(1000000000, 0);
  map<long, int> w;

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

  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (w[a[i]] == 0) {
      w[a[i]] = 1;
    } else {
      w.erase(a[i]);
    }
  }

  for (auto i = w.begin(); i != w.end(); i++) {
    ans += i->second;
  }

  cout << ans << endl;

  return 0;
}


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

int main() {
    int N, Q; cin >> N >> Q;
    string str; cin >> str;
    
    vector<int> s(N+1, 0);
    for(int i = 0; i < N; ++i) {
        if(i+1 < N && str[i] == 'A' && str[i+1] == 'C') s[i+1] = s[i] + 1;
        else s[i+1] = s[i];
    }
    
    for(int q = 0; q < Q; ++q) {
        int l, r; cin >> l >> r;
        --l, --r;
        cout << s[r] - s[l] << endl;
    }
}


Measured memory_bytes: 1408
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
const long long mod = 1e9+7;


long long mod_fact(int x){
    static int size = 1;
    static vector<long long> fact = {1, 1};
    if(x < 0)return 0; //
    if(x <= size) return fact[x];
    fact.resize(x+1);
    for(int i = size+1; i <= x; i++) fact[i] = fact[i-1] * i % mod;
    return fact[size = x];
}

long long mod_pow(long long a, long long b){
    long long res = 1;
    a %= mod;
    while(b > 0){
        if(b%2 == 1) (res *= a) %= mod;
        (a *= a) %= mod;
        b /= 2;
    }
    return res;
}

long long mod_inv(long long a){
    return mod_pow(a, mod-2);
}

long long mod_inv_fact(int x){
    static int size = 1;
    static vector<long long> inv_fact = {1, 1};
    if(x < 0)return 0; //
    if(x <= size) return inv_fact[x];
    inv_fact.resize(x+1);
    inv_fact[x] = mod_inv(mod_fact(x));
    for(int i = x-1; i > size; i--) inv_fact[i] = inv_fact[i+1] * (i+1) % mod;
    return inv_fact[size = x];
}

long long mod_comb(int a, int b){
    if(b < 0 || a < b)return 0;
    return mod_fact(a) * mod_inv_fact(a-b) % mod * mod_inv_fact(b) % mod;
}

int main(void){
    int s;
    cin >> s;
    long long ans = 0;
    for(int i=1;;i++){
        int t = s - i*3;
        if(t < 0) break;
        ans += mod_comb(i+t-1, t);

    }
    cout << ans%mod << endl;
}


Measured memory_bytes: 3208
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define fi first
#define se second
#define eb emplace_back
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 2e5 + 233;
int main()
{
	int l,r,d;cin>>l>>r>>d;
	int cnt = 0 ;
	for(int i=l;i<=r;i++)if(i%d==0)cnt++;
	cout << cnt << endl;
}


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

int main()
{
  int cnt[101] = {0};
  int data, ma = 0;
  priority_queue<int, vector<int>, greater<int> > q;
  while( cin >> data ) {
    cnt[data]++;
    ma = max(ma, cnt[data]);
  }

  for(int i=1; i<=100; i++) {
    if( cnt[i] == ma ) {
      q.push( i );
    }
  }

  while( !q.empty() ) {
    cout << q.top() << endl;
    q.pop();
  }
}

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
using P = pair<int, int>;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
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;
}
int vector_finder(std::vector<ll> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}
struct edge {
  ll to, cost;
};

const ll INF = 1000000001;
const ll MAX_V = 100010;
int V, E, r;
vector<edge> G[MAX_V];
int d[MAX_V]; // スタート地点から各ノードまでの最短距離

void dijkstra(int s) {
  priority_queue<P, vector<P>, greater<P>> q;
  fill(d, d + V, INF); // dをすべてINFで埋める
  d[s] = 0; // スタート地点の重みは0
  q.push(P(0, s));
  while(!q.empty()) {
    P p = q.top(); q.pop(); // 先頭から値を取り出す
    int v = p.second; // 次の行き先
    if(d[v] < p.first) continue;

    for(int i = 0; i < G[v].size(); ++i) {
      edge e = G[v][i]; // あるノートsから伸びる全ノードを確認する
      if(d[e.to] > d[v] + e.cost) {
        d[e.to] = d[v] + e.cost;
        q.push(P(d[e.to], e.to));
      }
    }
  }
}

int main() {
  cin >> V >> E;
  cin >> r;
  REP(i, E) {
    int s, t, d; cin >> s >> t >> d;
    edge e = {t, d};
    G[s].push_back(e);
  }
  dijkstra(r);
  for(int i = 0; i < V; ++i) {
    if(d[i] == INF) cout << "INF" << endl;
    else cout << d[i] << endl;
  }
}


Measured memory_bytes: 18044
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

int main(){
    int N, X, Y;
    cin >> N >> X >> Y;
    vector<int> v(N);
    int l = 0;
    for(int i=1; i<N; i++){
        for(int j=i+1; j<N+1; j++){
            l = min(j-i, abs(X-i)+abs(Y-j)+1);
            v[l]++;
        }
    }
    for(int i=1; i<N; i++){
        cout << v[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#[doc = " https://github.com/hatoo/competitive-rust-snippets"]
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};
#[allow(unused_imports)]
use std::iter::FromIterator;
mod util {
    use std::fmt::Debug;
    use std::io::{stdin, stdout, BufWriter, StdoutLock};
    use std::str::FromStr;
    #[allow(dead_code)]
    pub fn line() -> String {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    }
    #[allow(dead_code)]
    pub fn chars() -> Vec<char> {
        line().chars().collect()
    }
    #[allow(dead_code)]
    pub fn gets<T: FromStr>() -> Vec<T>
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|t| t.parse().unwrap())
            .collect()
    }
    #[allow(dead_code)]
    pub fn with_bufwriter<F: FnOnce(BufWriter<StdoutLock>) -> ()>(f: F) {
        let out = stdout();
        let writer = BufWriter::new(out.lock());
        f(writer)
    }
}
#[allow(unused_macros)]
macro_rules ! get { ( [ $ t : ty ] ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; line . split_whitespace ( ) . map ( | t | t . parse ::<$ t > ( ) . unwrap ( ) ) . collect ::< Vec < _ >> ( ) } } ; ( [ $ t : ty ] ; $ n : expr ) => { ( 0 ..$ n ) . map ( | _ | get ! ( [ $ t ] ) ) . collect ::< Vec < _ >> ( ) } ; ( $ t : ty ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; line . trim ( ) . parse ::<$ t > ( ) . unwrap ( ) } } ; ( $ ( $ t : ty ) ,* ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; let mut iter = line . split_whitespace ( ) ; ( $ ( iter . next ( ) . unwrap ( ) . parse ::<$ t > ( ) . unwrap ( ) , ) * ) } } ; ( $ t : ty ; $ n : expr ) => { ( 0 ..$ n ) . map ( | _ | get ! ( $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ ( $ t : ty ) ,*; $ n : expr ) => { ( 0 ..$ n ) . map ( | _ | get ! ( $ ( $ t ) ,* ) ) . collect ::< Vec < _ >> ( ) } ; }
#[allow(unused_macros)]
macro_rules ! debug { ( $ ( $ a : expr ) ,* ) => { eprintln ! ( concat ! ( $ ( stringify ! ( $ a ) , " = {:?}, " ) ,* ) , $ ( $ a ) ,* ) ; } }
const BIG_STACK_SIZE: bool = true;
#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}
fn solve() {
    let (n, x, y) = get!(usize, usize, usize);
    println!("{} {}", min(x, y), if x + y > n { x + y - n } else { 0 });
}


Measured memory_bytes: 8572
#include <cstdio>
int n, ans, last, len, now;
int main() {
    scanf("%d%d",& n,& last);
    for (int i = 0; i < n - 1; i++) {
        scanf("%d",& now);
        if (now <= last) {
            len++;
            
        }
        else {
            len = 0;
        }
        if (len > ans) ans = len;
        last = now;
    }
    printf("%d", ans);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define FOR(i, a, n) for(int (i) = (int)(a); (i) < (int)(n); ++(i))
#define FORe(i, a, n) for(int (i) = (int)(a); (i) <= (int)(n); ++(i))
#define rFOR(i, a, n) for(int (i) = (int)(n)-1; (i) >= (int)(a); --(i))
#define rFORe(i, a, n) for(int (i) = (int)(n); (i) >= (int)(a); --(i))
#define REP(i, n) FOR((i), 0, (n))
#define REPe(i, n) FORe((i), 1, (n))
#define REPo(i, n) FORe((i), 0, (n))
#define rREP(i, n) rFOR((i), 0, (n))
#define rREPe(i, n) rFORe((i), 1, (n))
#define rREPo(i, n) rFORe((i), 0, (n))
#define rep(i, n) FOR((i), 0, (n))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define fi first
#define se second
#define dup(x, y) (((x)+(y)-1)/(y))
#define vc(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using P = pair<int,int>;
using T = tuple<int,int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using vp = vector<P>;
using vt = vector<T>;

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() {
  int a, b, c, k;
  cin >> a >> b >> c >> k;
  int xa = min(a,k);
  k -= xa;
  int xb = min(b,k);
  k -= xb;
  int xc = k;
  int ans = xa - xc;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3636