akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
using ll = long long;
using namespace std;
//LLONG_MAX = 90^18
#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define LOWER_BOUND(v,a) (lower_bound((v).begin(), (v).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((v).begin(), (v).end(), (a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
void YesNo(bool b) { cout << (b ? "Yes" : "No"); }
void Yes() { cout << "Yes"; }
void No() { cout << "No"; }
//max_element


signed main()
{
	int N, A, B;
	cin >> N >> A >> B;

	if (A == 0)
	{
		cout << A << endl;
		return 0;
	}

	int cnt = (N / (A + B));
	int m = (cnt > 0) ? N % (cnt * (A + B)) : N;
	int ans = cnt * A;
	ans += min(m, A);

	cout << ans << endl;
}




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

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

using namespace std;
using ll = long long;

int main(){
	int k, a, b; cin >> k >> a >> b;

	int cnt = 0;
	for(int i = a; i <= b; ++i){
		if(i % k == 0){
			cnt++;
			break;
		}
	}

	cout << ((cnt > 0) ? "OK" : "NG") << endl;

	return 0;
}

Measured memory_bytes: 3648
function main(input) {
  const a = Number(input.split(" ")[0]);
  const b = Number(input.split(" ")[1]);
  var sum = 1
  var tapCount = 0
  while(true){
    if(sum >= b){
      break;
    }
    sum = sum - 1 + a;
    tapCount++;
  }
  console.log(tapCount);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 7372
def bubble_sort(A, N):
    flag = 1
    c = 0
    while flag:
        flag = 0
        for j in range(1, N):
            if A[j-1] > A[j]:
                A[j], A[j-1] = A[j-1], A[j]
                flag = 1
                c += 1
        N -= 1
    return A, c

N = int(input())
A = list(map(int, input().split()))
A, c = bubble_sort(A, N)
print(' '.join(map(str, A)))
print(c)


Measured memory_bytes: 5600
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
counter = 0

for i in range(N):
    A = list(map(int, input().split()))
    mul = [a*b for a, b in zip(A, B)]
    mul.append(C)
    if sum(mul) > 0:
        counter += 1

print(counter)


Measured memory_bytes: 3060
n = int(input())
a = list(map(int, input().split()))
a = [i % (10**9 + 7) for i in a]
val = sum(a[1:])
l = [val]
for i in range(1, n):
    val -= a[i]
    l.append(val)
ans = 0
for i in range(n - 1):
    ans += a[i]*l[i]
    ans %= 10**9 + 7
print(ans)

Measured memory_bytes: 117584
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

class UnionFind():
    def __init__(self, n):
        self.n = n
        # parents[i]: 要素iの親要素の番号
        # 要素iが根の場合、parents[i] = -(そのグループの要素数)
        self.parents = [-1] * n
    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x
    # 要素xが属するグループの要素数を返す
    def size(self, x):
        return -self.parents[self.find(x)]
    def same(self, x, y):
        return self.find(x) == self.find(y)
    # 要素xが属するグループに属する要素をリストで返す
    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]
    # 全ての根の要素をリストで返す
    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]
    # グループの数を返す
    def group_count(self):
        return len(self.roots())
    # 辞書{根の要素: [そのグループに含まれる要素のリスト], ...}を返す
    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}
    # print()での表示用
    # all_group_members()をprintする
    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


N, Q = MAP()
uf = UnionFind(N)

for _ in range(Q):
    t, u, v = MAP()
    if t == 0:
        uf.union(u, v)
    else:
        print(1 if uf.same(u, v) else 0)


Measured memory_bytes: 81616
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second

ll n,arr[100005],arr1[100005],arr2[100005];

int main()
{
    cin>>n;
    for(ll i=0;i<n;i++) cin>>arr[i]>>arr1[i]>>arr2[i];
    for(ll i=1;i<n;i++)
    {
        arr[i]+=max(arr1[i-1],arr2[i-1]);
        arr1[i]+=max(arr[i-1],arr2[i-1]);
        arr2[i]+=max(arr[i-1],arr1[i-1]);
    }
    cout<<max(arr[n-1],max(arr1[n-1],arr2[n-1]))<<endl;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;



int main() {
	ios::sync_with_stdio(false); cin.tie(0);
	vector<ll> d[2];
	for (int i = 0; i < 2; ++i) {
		ll x;
		cin >> x;
		for (ll p = 2; p*p <= x; ++p) {
			if (x % p == 0) {
				d[i].push_back(p);
				while (x % p == 0) {
					x /= p;
				}
			}
		}
		if (x > 1) {
			d[i].push_back(x);
		}
	}
	int ans = 0;
	int i = 0, j = 0;
	while (i < d[0].size() && j < d[1].size()) {
		if (d[0][i] < d[1][j]) {
			++i;
		} else if (d[0][i] > d[1][j]) {
			++j;
		} else {
			++ans;
			++i;
			++j;
		}
	}
	cout << 1+ans << endl;
}

Measured memory_bytes: 256
h,w=[int(i) for i in input().split()]
s=[[i for i in input()] for _ in range(h)]
ans=True
for i in range(h):
    for j in range(w):
        if s[i][j]=="#":
            black=False
            try:
                if s[i-1][j]=="#":
                    black=True
            except:
                pass
            try:
                if s[i+1][j]=="#":
                    black=True
            except:
                pass
            try:
                if s[i][j-1]=="#":
                    black=True
            except:
                pass
            try:
                if s[i][j+1]=="#":
                    black=True
            except:
                pass
            if not black:
                ans=False
                break
print("Yes" if ans else "No")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define forn(i, n) for(int i = 0; i < (int) n; i++)
#define forin(i, a, b) for(int i = a; i < (int) b; i++) 
#define rofin(i, a, b) for(int i = a; i > b; i--)
#define v vector
#define crap ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define debug(i) cout << #i << ": " << i << endl
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

int main() {
    crap;
    double r;
    cin >> r;
    double circum = 2 * M_PI * r;
    printf("%.20g\n", circum);

}

Measured memory_bytes: 3800
using System;
using System.Linq;

namespace ABC070B_TwoSwitches
{
    class Program
    {
        static void Main(string[] args)
        {
            var inputs = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var A = inputs[0];
            var B = inputs[1];
            var C = inputs[2];
            var D = inputs[3];
            var result = 0;
            
            var index = A >= C ? A : C;
            result = Math.Max(0, Math.Min(B, D) - index);
            
            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 13396
#include <iostream>
using namespace std;
int main(){
  int n5=0, n7=0, d;
  for (int i=0; i<3 ; ++i){
    cin >> d;
    if(d==5) ++n5;
    if(d==7) ++n7;
  }
  if(n5==2 and n7==1) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 256
const main = stdin => {
  const input = stdin.trim().split('\n')

  const [P, Q, R] = input[0].split(' ').map(x => parseInt(x))

  console.log(P + Q + R - Math.max(P, Q, R))

}
// 標準入力
main(require("fs").readFileSync("/dev/stdin", "utf8"))


Measured memory_bytes: 29532
#include <bits/stdc++.h>
	#include <cstdio>
	#include <cstring>
	#include <cmath>
	#include <cstring>
	#include <chrono>
	#include <complex>
	#define endl "\n"
	#define ll long long int
	#define vi vector<int>
	#define vll vector<ll>
	#define vvi vector < vi >
	#define pii pair<int,int>
	#define pll pair<long long, long long>
	#define mod 1000000007
	#define inf 1000000000000000001;
	#define all(c) c.begin(),c.end()
	#define mp(x,y) make_pair(x,y)
	#define mem(a,val) memset(a,val,sizeof(a))
	#define eb emplace_back
	#define f first
	#define s second
	
	using namespace std;
	int main()
	{
		std::ios::sync_with_stdio(false);
		ll n;
		cin>>n;
		ll count = 0;
		for(ll i=1; i<=n; i++) {
			ll x;
			cin>>x;
			if(x%2 != 0 && i%2!=0) {
				count++;
			}
		}
		cout<<count<<endl;
		return 0;
	}


Measured memory_bytes: 3648
#include <stdio.h>

#define MIN(X, Y) (((X) < (Y)) ? (X) : (Y))

int main(void) {
	int N, T, X = 0;
	
	scanf("%d %d", &N, &T);
	
	int arr[N];
	
	for (int i = 0; i < N; i++) {
		scanf("%d", &arr[i]);
	}
	
	for (int i = 0; i < N - 1; i++) {
		X += MIN(T, (arr[i + 1] - arr[i]));
	}

	X += T;
	
	printf("%d\n", X);
	return 0;
}

Measured memory_bytes: 896
import std.stdio;
import std.algorithm;
import std.string;
import std.range;
import std.array;
import std.conv;
import std.complex;
import std.math;
import std.ascii;
import std.bigint;
import std.container;
import std.typecons;

auto readInts() {
	return array(map!(to!int)(readln().strip().split()));
}
auto readInt() {
	return readInts()[0];
}
auto readLongs() {
	return array(map!(to!long)(readln().strip().split()));
}
auto readLong() {
	return readLongs()[0];
}

const real eps = 1e-10;

bool isBalanced(string s) {
	DList!(string) t;
	while(!s.empty) {
		switch(s[0..1]) {
			case "[":
				t ~= "[";
				break;
			case "(":
				t ~= "(";
				break;
			case ")":
				if(!t.empty && t.back == "(") {
					t.removeBack;
					break;
				} else {
					return false;
				}
			case "]":
				if(!t.empty && t.back == "[") {
					t.removeBack;
					break;
				} else {
					return false;
				}
			default:
				break;
		}
		s = s[1..$];
	}
	return t.empty;
}
void main(){
MainLoop:
	while(true) {
		auto s = readln.chomp;
		if(s == ".") {
			return;
		}
		writeln(isBalanced(s) ? "yes": "no");
	}
}

Measured memory_bytes: 3204
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
#define pi 3.14159
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
#define mp make_pair
#define pq priority_queue
#define mod 1000000007
#define f first
#define s second
#define pii pair< int, int >
#define vi vector<int>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define tc int t; cin >> t; while(t--)

using namespace std;
string repeat(string s, int n) {
    string s1 = "";
    for (int i=0; i<n;i++)
        s1+=s;
    return s1;
}
string getString(char x) {
    string s(1, x);
    return s;
}

void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
int gcd(int a, int b){
    if (a == 0)  return b;
    return gcd(b % a, a);
}
void  solve(){
  int n;
  cin>>n;
  vector<int> primes;
  rep(i,2,n/2+1){
    int flag=1;
    rep(j,2,i-1){
      if(i%j==0) flag=0;
    }
    if(flag)primes.pb(i);
  }
  // debug(primes);
  vector<pii> pr;
  for(auto i:primes){
    int c=0;
    rep(j,2,n+1){
      int temp=j;
      while(temp%i==0) c++,temp/=i;
    }
    pr.pb({i,c});
  }
  // rep(i,0,pr.size()){
  //   cout<<pr[i].f<<" "<<pr[i].s<<endl;
  // }
  ll c4=0,c2=0;
  rep(i,0,pr.size()){
    if(pr[i].s>=4) c4++;
    else if(pr[i].s>=2) c2++;
  }
  // cout<<c2<<c4<<endl;
  ll ans=((c4*(c4-1))/2)*c2+(c4*(c4-1)*(c4-2))/2;

  ll c24=0;c2=0;
  rep(i,0,pr.size()){
    if(pr[i].s>=24) c24++;
    else if(pr[i].s>=2) c2++;
  }
  // cout<<c24<<" "<<c2<<endl;
  ans+= (c24*c2+(c24*(c24-1)));

  ll c14=0;c4=0;
  rep(i,0,pr.size()){
    if(pr[i].s>=14) c14++;
    else if(pr[i].s>=4) c4++;
  }
  ans+= (c14*c4+(c14*(c14-1)));

  ll c74=0;
  rep(i,0,pr.size()){
    if(pr[i].s>=74) c74++;
  }
  ans+= c74;
  cout<<ans<<endl;
}
int main(){
    optimizeIO();
    // tc
    { solve();
    }
}


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

int main(void) {
  int N, D;
  cin >> N >> D;
  vector<vector<int> > X(N, vector<int>(D));
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < D; j++) {
      cin >> X[i][j];
    }
  }
  int ans = 0;
  for (int i = 0; i < N; i++) {
    for (int j = i + 1; j < N; j++) {
      double dis = 0;
      for (int k = 0; k < D; k++) {
        dis += pow(X[i][k] - X[j][k], 2);
      }
      dis = sqrt(dis);
      if (floor(dis) == ceil(dis)) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

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

int main(){
  int h,w;
  while(cin>>h>>w, h+w){
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
	if(i==0 || j==0 || i==h-1 || j==w-1)
	  cout<<"#";
	else
	  cout<<".";
      }
      cout<<endl;
    }
    cout<<endl;
  }
  return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <cstdio>
#include <vector>
#include <map>
#include <queue>
#include <string>
#include <set>
#include <algorithm>
#include <utility>
#include <cstring>
#include <cmath>
#include <cassert>
using namespace std;
#define int64_t long long


int main() {
    int n,l;
    cin>>n>>l;
    int sum=0;
    int ci=0;
    for(int i=0;i<n;++i){
        sum+=l+i;
        if(abs(l+i)<abs(l+ci))
            ci=i;
    }
    cout<<(sum-(l+ci))<<endl;
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;

#define F first
#define S second
#define PB push_back
#define MP make_pair


int main() {
  ios::sync_with_stdio(0); cin.tie(0);
  
  vector<string> s;
  int N, L;
  string curr, out="";
  
  cin >> N >> L;
  
  while(N--){
    cin >> curr;
    s.PB(curr);
  }
  
  sort(s.begin(), s.end());
  
  for(auto pp : s){
    out += pp;
  }
  
  cout << out << "\n";
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
const int MOD = 1000000007;
const int INF = numeric_limits<int>::max() / 2;
typedef pair<int,int> P;

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

  int N;
  cin >> N;
  int A[N];
  rep(i,N) cin >> A[i];
  int cnt = INF;
  int ans = 0;
  rep(i,N){
    if(cnt > A[i]){
      cnt = A[i];
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <array>
using namespace std;
using ULL = unsigned long long;
using UL = unsigned;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)


struct Forest_Uni {
	vector<UL> v;
	void init(UL n) {
		v.clear();
		rep(i, n) v.push_back(i);
	}
	void add() { v.push_back(v.size()); }
	UL root(UL p) {
		if (v[p] == p) return p;
		return v[p] = root(v[p]);
	}
	void unite(UL d, UL s) {
		UL S = root(s);
		UL D = root(d);
		if (S != D) {
			v[S] = D;
		}
	}
};

struct Problem {

	pair<double, double> L, R, U, D, X, Y;

	double f(double x) {
		double Mx = max(max(double(X.second), R.second + x), L.second - x);
		double mx = min(min(double(X.first), R.first + x), L.first - x);
		double My = max(max(double(Y.second), U.second + x), D.second - x);
		double my = min(min(double(Y.first), U.first + x), D.first - x);
		return (Mx - mx) * (My - my);
	}

	void Solve() {
		L = R = U = D = X = Y = { 1e8, -1e8 };
		UL N; cin >> N;
		rep(i, N) {
			double x, y; char d; cin >> x >> y >> d;
			if (d == 'U') {
				X = { min(X.first, x), max(X.second, x) };
				U = { min(U.first, y), max(U.second, y) };
			}
			if (d == 'D') {
				X = { min(X.first, x), max(X.second, x) };
				D = { min(D.first, y), max(D.second, y) };
			}
			if (d == 'L') {
				L = { min(L.first, x), max(L.second, x) };
				Y = { min(Y.first, y), max(Y.second, y) };
			}
			if (d == 'R') {
				R = { min(R.first, x), max(R.second, x) };
				Y = { min(Y.first, y), max(Y.second, y) };
			}
		}
		vector<double> div = { 0.0 };
		if (U.first < Y.first) div.push_back(Y.first - U.first);
		if (U.second < Y.second) div.push_back(Y.second - U.second);
		if (D.first > Y.first) div.push_back(D.first - Y.first);
		if (D.second > Y.second) div.push_back(D.second - Y.second);
		if (D.first > U.first) div.push_back((D.first - U.first) / 2);
		if (D.second > U.second) div.push_back((D.second - U.second) / 2);
		if (R.first < X.first) div.push_back(X.first - R.first);
		if (R.second < X.second) div.push_back(X.second - R.second);
		if (L.first > X.first) div.push_back(L.first - X.first);
		if (L.second > X.second) div.push_back(L.second - X.second);
		if (L.first > R.first) div.push_back((L.first - R.first) / 2);
		if (L.second > R.second) div.push_back((L.second - R.second) / 2);
		div.push_back(3.0e8);
		sort(div.begin(), div.end());
		double ans = 1e18;
		rep(i, div.size() - 1) {
			double l = div[i], r = div[i + 1];
			double fl = f(l), fr = f(r);
			double e = 1e-14;
			//cout << "l=" << l << " r=" << r << endl;
			//cout << "fl=" << fl << " fr=" << fr << endl;
			while (l * (1.0 + e) < r && l + e < r) {
				double m = (l + r) / 2;
				double fm = f(m);
				//cout << "l=" << l << " r=" << r;
				//cout << " fl=" << fl << " fr=" << fr;
				//cout << " m=" << m << "; fm=" << fm << endl;
				if (fl < fm && fm > fr) break;
				if (fl > fr) { l = m; fl = fm; }
				else { r = m; fr = fm; }
			}
			ans = min(ans, min(fl, fr));
		}
		cout << ans << endl;
	}


	Problem();
};
int main() {
	unique_ptr<Problem> p(new Problem());
	p->Solve();
	return 0;
}
Problem::Problem() {
	cout << fixed << setprecision(10);
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define repp(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ppb pop_back()
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;

signed main(){
    int h,w; cin >> h >> w;
    int s[h][w];
    rep(i,h){
        rep(j,w){
            cin >> s[i][j];
        }
    }
    vector<pair<P,P>> v;
    int cnt=0;
    rep(i,h){
        rep(j,w){
            if(i%2==0){
                if(s[i][j]%2==1){
                    s[i][j]--;
                    if(j!=w-1){
                        s[i][j+1]++; cnt++;
                        P p={i,j},q={i,j+1};
                        v.pb({p,q});
                    }
                    else if(i!=h-1){
                        s[i+1][w-1]++; cnt++;
                        P p={i,j},q={i+1,w-1};
                        v.pb({p,q});
                    }
                    else s[i][j]++;
                }
            }else{
                if(s[i][w-1-j]%2==1){
                    s[i][w-1-j]--;
                    if(w-1-j!=0){
                        s[i][w-1-j-1]++; cnt++;
                        P p={i,w-1-j},q={i,w-1-j-1};
                        v.pb({p,q});
                    }
                    else if(i!=h-1){
                        s[i+1][0]++; cnt++;
                        P p={i,w-1-j},q={i+1,0};
                        v.pb({p,q});
                    }
                    else s[i][w-1-j]++;
                }
            }
        }
    }
    cout << cnt << endl;
    rep(i,v.size()){
        cout << v[i].fi.fi+1 << " "  << v[i].fi.se+1 << " " << v[i].se.fi+1 << " " << v[i].se.se+1 << endl;
    }

}


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

int main(){
long int sum,buf1,buf2;
int c;

while(cin >> buf1 >> buf2){
	c = 1;
	sum = buf1 + buf2;
	
	while(sum/10 != 0){
		sum /= 10;
		c++;
	}
	cout << c << endl;
}
return 0;
}

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

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount

using namespace std;

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

template <typename T> T id(T b) {return b;};
template <class It> bool all(It f,It l){return std::all_of(f,l,id<bool>);}
template <class It> bool any(It f,It l){return std::any_of(f,l,id<bool>);}
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}

const int MAX_N = 100000;
int n;
int a[MAX_N];

int main()
{
#ifdef FASTIO
  ios_base::sync_with_stdio(false); cin.tie(nullptr);
#endif

  cin >> n;
  forn(i,n) cin >> a[i];

  sort(a,a+n);

  int res = -a[0] + a[n-1];
  for (int i = 1; i < n-1; i++)
    res += abs(a[i]);

  cout << res << endl;

  int i = n-2;
  int prev = a[0];
  while (i > 0 && a[i] >= 0) {
    cout << prev << " " << a[i] << "\n";
    prev -= a[i];
    i--;
  }

  cout << a[n-1] << " " << prev << "\n";
  prev = a[n-1] - prev;

  while (i > 0) {
    cout << prev << " " << a[i] << "\n";
    prev -= a[i];
    i--;
  }

  return 0;
}


Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
int main(){
    // Your code here!
    ll h,w;
    cin>>h>>w;
    char a[h][w];
    for(ll i=0;i<h;i++)
    {
        for(ll j=0;j<w;j++)
        {
            cin>>a[i][j];
        }
    }
    ll dp[h][w];
    for(ll i=0;i<h;i++)
    {
        for(ll j=0;j<w;j++)
        {
            dp[i][j]=0;
        }
    }
    for(ll i=0;i<h;i++)
    {
        if(a[i][0]=='#')
        {
            break;
        }
        dp[i][0]=1;
    }
    for(ll i=0;i<w;i++)
    {
        if(a[0][i]=='#')
        {
            break;
        }
        dp[0][i]=1;
    }
    for(ll i=1;i<h;i++)
    {
        for(ll j=1;j<w;j++)
        {
            if(a[i][j]=='#')
            {
                continue;
            }
            dp[i][j]=(dp[i-1][j]+dp[i][j-1])%mod;
        }
    }
    cout<<(dp[h-1][w-1])%mod;
    return 0;
}


Measured memory_bytes: 9088
#include<stdio.h>
#include<math.h>
int main(void){
  double n;
  int i,j,count=0,ans=0;

  scanf("%lf",&n);
  for(j=1;j<=n;j++){
    count=0;
    for(i=1;i<=j;i++){
      if(j%i==0){
	count++;
      }
    }
    if(count==8 && j%2!=0){
      ans++;
    }
  }

  printf("%d\n",ans);

  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <stdio.h>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <numeric>
#include <queue>
#include <numeric>
#include <iomanip>
#include <sstream>

#define rep(i,n) for((i)=0;i<(int)(n);i++)
#define max(a,b) (a < b ? b : a)
#define min(a,b) (a > b ? b : a)

using namespace std;


int main() {
	string S;
	long long K;
	cin >> S >> K;
	long long ans = 0;
	long long ansO = 0, ansX = 0;
	int nextO;
	int nextX;
	int N = S.length();
	int i;
	for (i = 1; i < N; i++) {
		if (S[i] == S[i - 1])
			ansO++, i++;
	}
	if (S[0] != S[N - 1]) {
		cout << ansO * K;
		return 0;
	}
	if (i != N) {
		nextO = 1;
		cout << ansO * K;
		return 0;
	}
	nextO = -1;
	ansX++;
	for (i = 2; i < N; i++) {
		if (S[i] == S[i - 1]) {
			ansX++;
			i++;
		}
	}
	if (i == N) {
		nextX = -1;
		ans = ansO + ansX * (K - 1);
		cout << ans;
		return 0;
	}
	nextX = 1;
	ans = (K- K / 2) * ansO + ( K / 2) * ansX;
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int gcd(int x, int y) {
  if (x % y == 0) return y;
  return gcd(y, x % y);
}
int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  int n, k; cin >> n >> k;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  if (n == 1) {
    cout << (a[0] == k ? "POSSIBLE" : "IMPOSSIBLE") << "\n";
    return 0;
  }
  sort(a, a + n);
  int g = gcd(a[0], a[1]);
  for (int i = 2; i < n; i++) g = gcd(g, a[i]);
  for (int i = n - 1; a[i] >= k and i >= 0; i--) {
    if ((a[i] - k) % g == 0) {
      cout << "POSSIBLE" << "\n";
      return 0;
    }
  }
  cout << "IMPOSSIBLE" << "\n";
  return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <math.h>

int ipow(int e,int x){
    int a=e;
    if(x==0)return 1;
    for(int i=0;i<x-1;i++){
        e*=a;
    }
    return e;
}

int tjudge(int a){
    int i;
    for(i=0;a/ipow(10,i) != 0;i++);
    return i;
}

int main(){
    int N,i;
    scanf("%d",&N);
    i=0;
    for(;N>0;N--){
        if(tjudge(N)%2==1)i++;
    }
    printf("%d",i);
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#define debug printf("\n-------------\n")
using namespace std;
typedef long long ll;
const int INF1=(~0u>>2);
const ll INF2=(~0ull>>2),P1=10007,P2=998244353,P3=1000000007;
int a,b;
int main()
{
	scanf("%d %d",&a,&b);
	if(a>b)
		swap(a,b);
	for(int i=1;i<=b;i++)
		printf("%d",a);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  double x,p;cin>>x>>p;
  int y=x;
  double iti=(100-2*p)/(double)100;
  if((int)y%2==1)x+=iti;
  double ans=x/(1-iti);
  if((int)y%2==1){
    ans+=1.0;
  }
  cout<<fixed<<setprecision(12)<<ans<<endl;
}
  

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;

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

	if ((D+S-1) / S <= T) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}


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

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

 
typedef pair<int,int> P;
typedef long long ll;
 
const int INF = 1001001001;
const int MOD = 1000000007;
const double PI=acos(-1);

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

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    int d = gcd(a,b);
    if (c%d==0) {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }
}


Measured memory_bytes: 3596
x1, y1, x2, y2 = map(int, input().split())

dx = x2 - x1
dy = y2 - y1
x3 = x2 - dy
y3 = y2 + dx
x4 = x1 - dy
y4 = y1 + dx

print(x3, y3, x4, y4)

Measured memory_bytes: 3060
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<iomanip>
#include<utility>
#include<string>
#include<map>
#include<unordered_map>
#include<queue>

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;

typedef long long ll;
typedef pair<int, int> P;
int gcd(int a, int b){return b ? gcd(b, a%b) : a;}
int lcm(int a, int b){return a*b / gcd(a, b);}


int main(){
    int H, W, K;
    cin >> H >> W >> K;
    vector<string> c(H);
    for(int i = 0; i < H; i++) cin >> c[i];

    
    int ans = 0;
    for(int i = 0; i < (1<<H); i++){
        for(int j = 0; j < (1<<W); j++){
            int cnt = 0;

            for(int k = 0; k < H; k++){
                for(int l = 0; l < W; l++){
                    if(i & (1<<k)) continue;
                    if(j & (1<<l)) continue;
                    if(c[k][l] == '#') cnt++;
                }
            }
            if(cnt == K) ans++;
        }
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3616
package main

import "fmt"

func main() {
	var x int
	fmt.Scan(&x)
	sho := x / 500
	var oldresult int = 0
	var amari int
	var yen50 int
	var result int
	for i := 0; i < sho+1; i++ {
		amari = x - sho*500
		yen50 = amari / 5
		result = i*1000 + yen50*5
		if result > oldresult {
			oldresult = result
		}
		if result < oldresult {
			break
		}
	}
	fmt.Println(oldresult)
}


Measured memory_bytes: 512
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
Max = sys.maxsize
def l(): #intのlist
	return list(map(int,input().split()))
def m(): #複数文字
	return map(int,input().split())
def onem(): #Nとかの取得
	return int(input())
def s(x): #圧縮
	a = []
	aa = x[0]
	su = 1
	for i in range(len(x)-1):
		if aa == x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a
def jo(x): #listをスペースごとに分ける
	return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
	return max(map(max,x))

n,m = m()

if (n+m)/2 == (n+m)//2:
	print((n+m)//2)
else:
	print("IMPOSSIBLE")

Measured memory_bytes: 38384
import java.util.Scanner;

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

		double r = sc.nextDouble();
		double pi = Math.PI;

		double area = pi * r *r;
		double length = 2 * pi *r;

		System.out.printf("%.6f %.6f",area,length);
	}
}


Measured memory_bytes: 28216
import scala.io.StdIn

object Main extends App {

  var head = 0
  var tail = 0

  val Array(n, q) = StdIn.readLine().trim.split(' ').map(_.toInt)
  val max  = n + 1 
  val myqueue = Array.fill(max)(ProceesInfo("", 0))

  case class ProceesInfo(name: String, time: Int) 
  
  def isEmpty() = head == tail
  
  def isFull() = head == ((tail + 1) % max)
  
  def enqueue(p: ProceesInfo) = {
    if(isFull()) throw new RuntimeException
    else {
      myqueue(tail) = p
      if(tail + 1 == max){
        tail = 0
      } else {
        tail += 1
      }
    }
  }
  
  def dequeue(): ProceesInfo = {
    if(head == tail) throw new RuntimeException
    else {
      val ret = myqueue(head)
      if(head + 1 == max){
        head = 0
      } else {
        head += 1
      }
      ret
    }
  }
  
  (0 until n).foreach{ _ =>
    val Array(ename, etime) = StdIn.readLine().trim.split(' ')
    enqueue(ProceesInfo(ename, etime.toInt))
  }
  
  var executeTime: Int = 0
  while(head != tail){
    val current = dequeue()
    val remaintime = if((current.time - q) < 0) 0 else current.time - q
    
    executeTime  += (if((current.time - q) < 0) current.time else q)
    
    val executed = ProceesInfo(current.name, remaintime)  
    if(executed.time == 0){
      println(executed.name + " " + executeTime)
    } else {
      enqueue(executed)
    }
  }
  
}



Measured memory_bytes: 108744
N = int(input())
r = 55555

mp = [1]*(r+1)
i = 2

while 2*i <= r:
  j = 2
  while i*j <= r:
    mp[i*j] = 0
    j += 1
  i += 1
  
k = 0
l = 1
rlt = []
while k < N:
  if mp[30*l-1] == 1:
    rlt.append(30*l-1)
    k += 1
  l += 1

print(' '.join(map(str,rlt)))


Measured memory_bytes: 65740
N, H = map(int, input().split())
A, B = [], []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
B.sort()
B.reverse()
Am = max(A)

lo = 0
hi = N-1
while hi - lo > 1:
    mid = (hi+lo)//2
    if B[mid] < Am:
        hi = mid
    else:
        lo = mid
if B[hi] > Am:
    p = hi+1
else:
    p = lo+1

count = 0
for x in B[:p]:
    H-=x
    count += 1
    if H <= 0:
        print(count)
        exit()
count += (H+Am-1)//Am
print(count)


Measured memory_bytes: 11804
#include <iostream>
#include <algorithm>
#include <string>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

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

using ll = long long;

const ll mod = 1000000007;

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

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

ll N;
std::string S;
mint dp[5010][5010];

int main()
{
  std::cin >> N >> S;

  dp[0][0] = 1;

  rep( i, N ) rep( j, i+1 )
  {
    dp[i+1][j+1] += dp[i][j];

    if( j-1 >= 0 )
      dp[i+1][j-1] += dp[i][j]*2;
    else
      dp[i+1][0] += dp[i][0];
  }

  printf( "%lld\n", dp[N][S.size()].x );

  return 0;
}

Measured memory_bytes: 196480
N = int(input())
s = [int(input()) for _ in range(N)]
if sum(s) % 10 != 0: print(sum(s)); exit()
else:
  s.sort()
  for i in range(N):
    if (sum(s)-s[i])%10 != 0: print(sum(s)-s[i]); exit()
print(0)

Measured memory_bytes: 63716
"""
プラン
目的: 1の街から開始して、全ての街を通れればよしとする
1. 街を作る。街はそれぞれ繋がっている街のデータを持つ
2. 初期値を1の街とし、今まで通った街のデータを記録する
3. もし街のデータが四つ揃えば、完了
"""

village_dict = {}
for i in range(4):
    village_dict[i + 1] = []

for i in range(3):
    line = [int(i) for i in input().split()]
    village_dict[line[0]].append(line[1])
    village_dict[line[1]].append(line[0])




def move(village_dict):
    position = 1
    visit_log = []
    visit_log.append(position)
    for i in range(3):
        if len(village_dict[position]) == 1:
            position = village_dict[position][0]
            visit_log.append(position)
        elif len(village_dict[position]) == 2:
            #village_dict[position].remove(position)
            for pos in village_dict[position]:
                if pos in visit_log:
                    village_dict[position].remove(pos)
            position = village_dict[position][0]
            visit_log.append(position)
    return len(visit_log)

if move(village_dict) == 4:
    print("YES")
else:
    print("NO")


Measured memory_bytes: 3064
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String N = sc.next();
		if (N.equals("Sunny")) {
			System.out.println("Cloudy");
		} else if (N.equals("Cloudy")) {
			System.out.println("Rainy");
		} else {
			System.out.println("Sunny");
		}
	}
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
map<string,int> t;
int n,maxi=0;
string s;
int main() {
	cin>>n;
	for(int i=1;i<=n;i++) {
		cin>>s;
		t[s]++;
	}
	for(auto it:t)
		maxi=max(maxi,it.second);
	for(auto it:t) {
		if(maxi==it.second)
			cout<<it.first<<'\n';
	}
	return 0;
}

Measured memory_bytes: 25216
/* 88-D Grid Repainting */
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <queue>
 
using namespace std;
typedef unsigned long DWORD;
typedef unsigned short WORD;
typedef bool	BOOL;
typedef pair<WORD, WORD> PAIR;
 
#define TRUE		true;
#define GOAL_X	(W-1)
#define GOAL_Y	(H-1)
#define INF		(10000)
 
WORD H, W;
 
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
vector<vector<WORD>> field(50, vector<WORD>(50,INF));
queue<PAIR> que;
 
int main()
{
#ifdef FOR_IDE
	ifstream in("input.txt");
  cin.rdbuf(in.rdbuf());
#endif
 
	cin >> H >> W;
 
	vector<vector<char>> input_char(H, vector<char>((W+1), 0));
	WORD black_num = 0;
	WORD field_all = H * W;
	int ans;
 
	for (WORD i = 0; i < H; i++){
		for (WORD j = 0; j < W; j++){
			cin >> input_char[i][j];
			if (input_char[i][j] == '#') {
				black_num ++;
			}
		}
	}
 
	que.push(PAIR(0,0));
	field[0][0] = 1;
 
	while (que.size()){
	
		PAIR p = que.front();
		que.pop();
	
		if (p.first == GOAL_X && p.second == GOAL_Y) break;
		
		for (int i = 0; i < 4; i++) {
			int nx = p.first + dx[i];
			int ny = p.second + dy[i];
 
			if (0 <= nx && nx <= GOAL_X && 0 <= ny && ny <= GOAL_Y && input_char[ny][nx] != '#' && field[nx][ny] == INF) {
				que.push(PAIR(nx, ny));
				field[nx][ny] = field[p.first][p.second] + 1;
			}
		}
	}
 
	if (field[GOAL_X][GOAL_Y] == INF) {
		ans = -1;
	} else {
		ans = field_all - black_num - field[GOAL_X][GOAL_Y];
	}
	cout << ans << endl;
 
	return 0;
}

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

//#pragma GCC optimize ("Ofast")
//#pragma GCC target ("avx,avx2")

#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define dbg(x) cerr<<#x<<" : "<<x<<endl

typedef long long int ll;
typedef long double ld;
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vii;
const ll INF = 1e18+1;
const ll MOD = 1000000007L;
clock_t time_p=clock();
void timer(){time_p=clock()-time_p;cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";}

template <typename Arg1> ostream& operator << (ostream& out, const vector<Arg1> &a) {out<<"[ ";for(const auto &x:a)out<<x<<" ";return out<<"]";}


int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    vi a(n);
    ll sum=0;
    rep(i,n){
        cin>>a[i];
        sum+=a[i];
    }
    a.pb(a[0]);

    bool ans = true;
    ll s1 = (n*(n+1))/2;
    if(sum % s1 != 0) ans = false;
    else {
        ll betasum = 0;
        ll alpha = sum/s1;
        rep(i,n){
            if(a[i+1] > a[i] ) {
                if(a[i+1] - a[i] != alpha) {
                    ans = false;
                    break;
                }
            } else {
                ll beta = (a[i]-a[i+1]+alpha)/n;
                if(beta * n != a[i]-a[i+1]+alpha){
                    ans = false;
                    break;
                }
                betasum += beta;
            }
        }
        if(betasum != alpha){
            ans = false;
        }
    }
    if(ans) cout<<"YES\n";
    else cout<<"NO\n";



    timer();
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, a, b) for (ll i = (a); i < (b); i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
#define PRINT(V) for (auto v:(V)) {cerr << v << " ";} cerr << endl
#define dump(x) cerr << #x << " : " << (x) << endl
#define dump2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")" << endl
const ll MOD = 1000000007;
const ll INF = 100000000000000000LL;
inline ll GCD(ll a, ll b){return b ? GCD(b, a % b) : a;}
inline ll LCM(ll a, ll b){return a / GCD(a, b) * b;}
inline ll powint(ll x, ll y){ll r=1;while(y){if(y&1)r*=x;x*=x;y>>=1;}return r;}
inline ll powmod(ll x, ll y, ll m = MOD){ll r=1;while(y){if(y&1)r*=x;x*=x;r%=m;x%=m;y>>=1;}return r;}
/* END OF TEMPLATE */

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll l, r;
    cin >> l >> r;
    ll ans = 2018;
    repr(i, l, r){
        repr(j, i+1, r+1){
            ans = min(ans, (i*j)%2019);
            if(ans == 0){
                goto res;
            }
        }
    }
    res:
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,k;
    scanf("%d%d",&n,&k);
    int p[n];
    for(int i=0;i<n;i++)
        scanf("%d",&p[i]);
    int x=0,ma=0;
    for(int i=0;i<k;i++)
        x+=p[i];
    ma=x;
    for(int i=0;i+k<n;i++){
        x+=p[i+k]-p[i];
        ma=max(ma,x);
    }
    printf("%f",double(ma+k)/2);
    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <math.h>

#define PI 3.141592653589

double distance(double x1, double y1, double x2, double y2);

int main(void){
  double a, b, c, s, l, h;

  scanf("%lf%lf%lf", &a, &b, &c);
  h = b * sin(PI * c / 180);
  l = a + b + distance(a, 0, b * cos(PI * c / 180), b * sin(PI * c / 180));
  s = a * h / 2;
  printf("%f\n%f\n%f\n", s, l, h);
  return 0;
}


double distance(double x1, double y1, double x2, double y2){
  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1- y2));
}

Measured memory_bytes: 2924
import std.algorithm;
import std.array;
import std.container;
import std.conv;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

double calc(int[][] a) {
    a.sort();
    double ans = 0;
    int n = 0;
    foreach (e; permutations(a)) {
        for (int i = 1; i < e.length; i++) {
            double x1 = e[i - 1][0];
            double y1 = e[i - 1][1];
            double x2 = e[i][0];
            double y2 = e[i][1];
            ans += sqrt((x1 - x2) ^^ 2 + (y1 - y2) ^^ 2);
        }
        n++;
    }
    return ans / n;
}

double calc2(int[][] a) {
    double d = 0;
    for (int i = 0; i < a.length; i++) {
        for (int j = i + 1; j < a.length; j++) {
            double x1 = a[i][0];
            double y1 = a[i][1];
            double x2 = a[j][0];
            double y2 = a[j][1];
            d += sqrt((x1 - x2) ^^ 2 + (y1 - y2) ^^ 2);
        }
    }
    return d * 2 / a.length;
}

void main() {
    int n = readint;
    int[][] a;
    foreach (_; 0..n) {
        a ~= readints;
    }

    // auto ans = calc(a);
    auto ans = calc2(a);
    writefln("%.8f", ans);
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
#include <sstream>
#define IOS ios_base::sync_with_stdio(0); cin.tie(0);
#define mod 1000000007
#define eps 1e-6
#define ll long long
#define INF 0x3f3f3f3f
#define MEM(x,y) memset(x,y,sizeof(x))
#define pb push_back
#define mk make_pair
#define pi pair<int, int>
#define rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define per(i,a,b) for(int i=a;i>=(b);--i)
using namespace std;
int dt[][2]= {{1,0},{-1,0},{0,1},{0,-1},{0,0}};
//typedef pair<int, int> P;
//priority_queue<int, vector<int>, greater<int> > q;
int main()
{
   IOS;
   int n,x,t;
   cin >> n >> x >> t;
   if(n % x == 0)
   {
       cout << (n/x)*t;
   }
   else
   {
       cout << (n/x+1)*t;
   }
   
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i < (n); i++)
typedef double D;      // ??§?¨?????????????double???long double?????????
typedef complex<D> P;  // Point
typedef pair<P, P> L;  // Line
typedef vector<P> VP;
const D EPS = 1e-9;    // ?¨±??????????????????????????£????????????
#define X real()
#define Y imag()
#define LE(n,m) ((n) < (m) + EPS)
#define GE(n,m) ((n) + EPS > (m))
#define EQ(n,m) (abs((n)-(m)) < EPS)
D dot(P a, P b) {return (conj(a)*b).X; }
D cross(P a, P b) {  return (conj(a)*b).Y;}
int ccw(P a, P b, P c) {
  b -= a;  c -= a;
  if (cross(b,c) >  EPS) return +1;  // counter clockwise
  if (cross(b,c) < -EPS) return -1;  // clockwise
  if (dot(b,c)   < -EPS) return +2;  // c--a--b on line
  if (norm(b) < norm(c)) return -2;  // a--b--c on line or a==b
  return 0;                          // a--c--b on line or a==c or b==c
}
namespace std {
  bool operator<(const P a, const P b) {
    return a.X != b.X ? a.X < b.X : a.Y < b.Y;
  }
}
// ???????§???¢?????´?????????????????????
pair<int, int> convexDiameter(const VP& ps) {
  int n = ps.size();
  int i = min_element(ps.begin(), ps.end()) - ps.begin();
  int j = max_element(ps.begin(), ps.end()) - ps.begin();
  int maxI, maxJ;
  D maxD = 0;
  rep(_, 2*n) {
    if (maxD < norm(ps[i]-ps[j])) {
      maxD = norm(ps[i]-ps[j]);
      maxI = i;
      maxJ = j;
    }
    if (cross(ps[i]-ps[(i+1) % n], ps[(j+1) % n]-ps[j]) <= 0) j = (j+1) % n;
    else                                                      i = (i+1) % n;
  }
  return make_pair(maxI, maxJ);
}
double dis(P a,P b){
  return sqrt((a.X-b.X)*(a.X-b.X)+(a.Y-b.Y)*(a.Y-b.Y));
}
int main(){
  int n;
  cin>>n;
  VP v;
  while(n--){
    double a,b;
    cin>>a>>b;
    v.push_back(P(a,b));
   }
   pair<int,int>p=convexDiameter(v);
   int x=p.first,y=p.second;
   printf("%.10f",dis(v[x],v[y]));
}

Measured memory_bytes: 5000
import java.util.*;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {//change to Main
    static int INF = Integer.MAX_VALUE;
    static int[][] near = {{0,0,1,-1},{1,-1,0,0}};
    static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));//
    static StringTokenizer st;
    static StringBuilder sb;
    static String line;


    public static void main(String[] args) throws Exception {

        //int T = Integer.parseInt(in.readLine());//number of messages
        int T =1;
        for (int t = 0; t < T; t++) {
            solve();
            //st = new StringTokenizer(in.readLine());
            //int x = Integer.parseInt(st.nextToken());

        }//forLoop#1
    }//main


    public static void solve() throws Exception{
        int w,n;
        w= Integer.parseInt(in.readLine());
        n= Integer.parseInt(in.readLine());

        int[] A = new int[w]; //array
        for (int i = 0; i < w; i++) {
            A[i] = i+1;
        }

        for (int i = 0; i < n; i++) {
            st = new StringTokenizer(in.readLine(),",");
            int a,b,temp;
            a = Integer.parseInt(st.nextToken())-1;
            b = Integer.parseInt(st.nextToken())-1;
            temp = A[a];
            A[a] = A[b];
            A[b] = temp;
        }

        for (int i = 0; i < w; i++) {
            System.out.println(A[i]);
        }



    }
}//class

Measured memory_bytes: 24196