akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	int cnt=700;
	if(s[0]=='o')cnt+=100;
	if(s[1]=='o')cnt+=100;
	if(s[2]=='o')cnt+=100;
	cout<<cnt; 
	return 0;
}

Measured memory_bytes: 256
import math


def main():
    # S = input()
    # N = int(input())
    A,B,H,M = list(map(int, input().split(' ')))
    # print(S, W)
    
    A_zure = H / 12 * 360
    B_zure = M / 60 * 360
    
    A_zure += (30 / 60) * M
    
    theta = abs(B_zure - A_zure)
    theta = min(360-theta, theta)
    # print(A_zure, B_zure, theta, math.cos(math.radians(theta)), (30 / 60) * M)
    # print(theta, math.radians(theta), math.cos(theta))
    C = A**2 + B**2 - 2 * A * B * math.cos(math.radians(theta))
    # print(A, B, math.cos(math.radians(theta)), A**2, B**2, 2 * A * B * math.cos(math.radians(theta)), C)
    print(C** 0.5)
    
    

main()

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

void print_info(int array[][10]);

int main (void)
{
	int input,n,m;
	int A[100][100],B[100],C[100];
	int i,j;
	int sum = 0;
	
	scanf("%d %d",&n,&m);
	for(i = 0 ; i < n ; i++)
	{
		for(j = 0 ; j < m ; j++)
		{
			scanf("%d",&A[i][j]);
		}
	}
	for(i = 0 ; i < m ; i++)
	{
		scanf("%d",&B[i]);
	}
	for(i = 0 ; i < n ; i++)
	{
		sum = 0;
		for(j = 0 ; j < m ; j++)
		{
			sum += A[i][j] * B[j];
		}
		C[i] = sum;
	}
	for(i = 0 ; i < n ; i++)
	{
		printf("%d\n",C[i]);
	}
	return 0;
}


Measured memory_bytes: 2084
#include <stdio.h>

int main()
{
    int t[5],mini,min = 10,ans = 0;
    for (int i = 0; i < 5; i++)
    {
        scanf("%d",&t[i]);
        if(t[i] % 10 != 0)
        {
            if(min > t[i] % 10)
            {
                min = t[i] % 10;
                mini = i;
            }
        }
    }
    
    for (int i = 0; i < 5; i++)
    {
        if(mini == i)
        {
            ans += t[i];
        }
        else
        {
            if(t[i] % 10 == 0)
            {
                ans += t[i];
            }
            else
            {
                ans += t[i] + 10 - t[i] % 10;
            }
        }
    }
    
    printf("%d\n",ans);
}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
typedef long long  ll;

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

ll getLength(const char *s) {
	ll i = 0;
	while (*s++) {
		i++;
	}
	return i;
}

int main()
{
	char sa[101], sb[101], sc[101];
	ll a = 0, b = 0, c = 0;
	cin >> sa >> sb >> sc;
	ll len_a = getLength(sa);
	ll len_b = getLength(sb);
	ll len_c = getLength(sc);

	ll s = a;
	char t = sa[0];

	while (1) {
		if (t == 'a') {
			if (len_a == a) {
				cout << "A" << endl;
				break;
			}
			t = sa[a];
			a++;
		}
		else if (t == 'b') {
			if (len_b == b) {
				cout << "B" << endl;
				break;
			}
			t = sb[b];
			b++;
		}
		else if (t == 'c') {
			if (len_c == c) {
				cout << "C" << endl;
				break;
			}
			t = sc[c];
			c++;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,sse3,sse4,popcnt,abm,mmx")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define F first
#define S second
#define ins insert
#define mp make_pair
#define fo(i, n1, n, x) for(int i = n1; i <= n; i += x)
#define foo(i, n, n1, x) for(int i = n; i >= n1; i -= x)
#define bit __builtin_popcount
#define md (l + ((r - l) / 2))
#define all(x) x.begin(),x.end()
#define eb emplace_back
#define ub upper_bound
#define lb lower_bound
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

const int N = 1e5 + 11, mod = 1e9 + 7, mod2 = 998244353;
const int MAX = 3e5 + 11;
const int INF1 = 2e9 + 11;
const ll INF2 = 2e18 + 11;
const double INF3 = 1e8 + 11;
const int base = 500;
const int P = 31;
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};
const double EPS = 1e-6;
const double PI = acos(-1.0);


template<typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
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> pii;
typedef pair <ll, ll> pll;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define int ll
int n,ans;
main() {
    file("snakes");
    ios;
    cin>>n;
    map<string,int> cnt;
    fo(i,1,n,1) {
        string s;
        cin>>s;
        sort(all(s));
        ans+=cnt[s]++;
    }
    cout<<ans;
    return 0;
}
/**

*/


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

int main()
{
    int a, b, k;
    cin >> a >> b >> k;
    
    auto ans = 0;
    auto counter = 0;
    for(auto i = min(a,b); i > 0; --i){
        if(a % i == 0 && b % i == 0){
            counter ++;
            if(counter == k){
                ans = i;
                break;
            }
        }
    }
    cout << ans;
    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int a, b, c, k, maior, soma;
  scanf("%d %d %d %d", &a, &b, &c, &k);
  maior=a;

  if(b>maior)
    maior=b;

  if(c>maior)
    maior=c;

  soma=a+b+c-maior;

  while(k--)
    maior=maior*2;

    printf("%d\n", soma+maior);

  return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <queue>
#include <cstring>

using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define FIND(x, target) find(x.begin(),x.end(),target)
#define pb(x) push_back(x)
#define output(x) cout<<x<<endl
#define ERASE(x, n) erase(x.begin(), x.begin+n)
// #define int long long
#define P pair<int, int>
typedef long long ll;

const long long int MOD = 1e9+7;
const int INF = -1;

signed main(void) {
  	int N;
  	cin >> N;
  	if (N <= 2) {
  		cout << "No" << endl;
  	} else {
  		int remain = N-3;
  		bool even = false;
  		if (remain%2 == 0) {
  			even = true;
  		}
  		bool find = true;

  		if (even == false) {
  			find = false;
  			for (int i=2; i<N; i++) {
  				int a = int(i^1^N);
  				if (2<=a && a<N) {
  					int b = i;
  					if (b%2==0) { b+=N;}
  					if (a%2==0) { a+=N;}
  					cout << "Yes" << endl;
  					cout << N << " " << a << endl;
  					// cout << a << " " << N+1 << endl;
  					// cout << N+1 << " " << b << endl;
  					cout << b << " " << N*2 << endl;
  					find = true;
  					break;
  				}
  			}	
  		} else {
  			cout << "Yes" << endl;
  		}

  		if (find) {
  			cout << "1 2" << endl;
	  		cout << "2 3" << endl;
	  		cout << "3 " << N+1 << endl;
	  		cout << N+1 << " " << N+2 << endl;
	  		cout << N+2 << " " << N+3 << endl;

	  		rep(i, remain/2) {
	  			cout << i*2+4 << " " << i*2+5 << endl;
	  			cout << i*2+5 << " " << N+1 << endl;
	  			cout << N+1 << " " << i*2+4+N << endl;
	  			cout << i*2+4+N << " " << i*2+5+N << endl;
	  		}
  		} else {
  			cout << "No" << endl;
  		}
  	}
 	
	return 0;
}


Measured memory_bytes: 2816
#include <bits/stdc++.h>
#define LL long long
#define FOR(i,c) for(__typeof(c.begin()) i = c.begin(); i != c.end(); i++)
#define F first
#define S second
using namespace std;

const LL mod = 1e9 + 7;

template<typename T> T gcd(T a, T b) { return b == 0?a: gcd(b, a % b); }
template<typename T> T LCM(T a, T b) { return a*(b/gcd(a, b)); }
template<typename T> T expo(T base, T e, T mod) { T res = 1;
  while(e > 0) { if(e&1) res = res * base % mod; base = base * base % mod; e >>= 1; }
  return res;
}
template<typename T, typename S> T expo(T b, S e){if(e <= 1)return e == 0?1: b;\
	return (e&1) == 0?expo((b*b), e>>1): (b*expo((b*b), e>>1));}
template<typename T, typename S> T modinv(T a, S mod) { return expo(a, mod-2, mod); }
template<class T, class S> std::ostream& operator<<(std::ostream &os, const std::pair<T, S> &t) {
	os<<"("<<t.first<<", "<<t.second<<")";
	return os;
}
template<class T> std::ostream& operator<<(std::ostream &os, const std::vector<T> &t) {
	os<<"["; FOR(it,t) { if(it != t.begin()) os<<", "; os<<*it; } os<<"]";
	return os;
}

const int MAXN = 1e5 + 10;
LL R, C, n;
bool vis[MAXN];

struct data {
	LL x1, y1, x2, y2;
} arr[MAXN];

struct point {
	LL x, y;
	int idx;
	bool operator<(const point &other) const {
		if(isRight() != other.isRight()) return isRight();
		return x * other.y - y * other.x < 0;
	}
	bool operator==(const point &other) const {
		return !((*this < other) or (other < *this));
	}
	bool isRight() const {
		return x == 0 ? y > 0 : x > 0;
	}
};

bool onEdge(LL x, LL y) {
	if(x == 0 || y == 0 || x == R || y == C) return true;
	return false;
}

int main() {
  ios_base::sync_with_stdio(false);
	cin >> R >> C >> n;
	int cx = R/2, cy = C/2;
	vector<point> v;
	for(int i = 0; i < n; i++) {
		cin >> arr[i].x1 >> arr[i].y1;
		cin >> arr[i].x2 >> arr[i].y2;
		if(onEdge(arr[i].x1, arr[i].y1) && onEdge(arr[i].x2, arr[i].y2)) {
			v.push_back({arr[i].x1 - cx, arr[i].y1 - cy, i});
			v.push_back({arr[i].x2 - cx, arr[i].y2 - cy, i});
		}
	}
	sort(v.begin(), v.end());
	stack<int> s;
	bool ok = true;
	for(auto &elem: v) {
		int idx = elem.idx;
		if(vis[idx]) {
			if(s.empty() || s.top() != idx) {
				ok = false;
				break;
			} else {
				s.pop();
			}
		} else {
			s.push(idx);
			vis[idx] = true;
		}
	}
	if(ok) cout << "YES" << endl;
	else cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 10864
#-swank
(unless (member :child-sbcl *features*)
  (quit
	:unix-status
	(process-exit-code
	  (run-program *runtime-pathname*
				   `("--control-stack-size" "128MB"
					 "--noinform" "--disable-ldb" "--lose-on-corruption" "--end-runtime-options"
					 "--eval" "(push :child-sbcl *features*)"
					 "--script" ,(namestring *load-pathname*))
				   :output t :error t :input t))))

(let ((n (read)))
  (princ 
	(loop repeat n sum
		  (let ((money (read))
				(kind (read)))
			(* money (if (eq kind 'JPY) 1 380000))))))


Measured memory_bytes: 15928
#include<iostream>
#include<cstdio>
#include<cstring>
#define ll long long
#define N 100100
#define M 1000000007
using namespace std;

ll n,a[N],c[N],wh[N],wq[N],ans;
char str[N];

inline ll qh(ll u,ll v)
{
	return (u+v)*(v-u+1)/2%M;
}

inline ll po(ll u,ll v)
{
	if(v<0) return 0;
	ll res=1;
	for(;v;)
	{
		if(v&1) res=res*u%M;
		u=u*u%M;
		v>>=1;
	}
	return res;
}

int main()
{
	int i,j;
	scanf("%s",str+1);
	n=strlen(str+1);
	for(i=1;i<=n;i++)
	{
		a[i]=a[i-1]+(str[i]=='A');
		wq[i]=wq[i-1]+(str[i]=='?');
	}
	for(i=n;i>=1;i--)
	{
		c[i]=c[i+1]+(str[i]=='C');
		wh[i]=wh[i+1]+(str[i]=='?');
	}
	for(i=1;i<=n;i++)
	{
		if(str[i]!='B'&&str[i]!='?') continue;
		ans=(ans+(a[i-1]*po(3,wq[i-1])%M+po(3,wq[i-1]-1)*wq[i-1]%M)%M*(c[i+1]*po(3,wh[i+1])%M+po(3,wh[i+1]-1)*wh[i+1]%M)%M)%M;
//		cout<<ans<<endl;
	}
	cout<<ans;
}

Measured memory_bytes: 3456
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9+7;

int main(void){
    int N;
    cin>>N;

    vector<ll> D(N+1,0);

    for (int i=2;i<=N;i++){
        int T = i;
        int d = 2;
        while (T >= d*d) {
            if (T%d == 0) {
                D[d] = (D[d]+1)%mod;
                T /= d;
            }
            else {
                d++;
            }
        }
        D[T] = (D[T]+1)%mod;
    }

    ll ans = 1;

    for (int i=0;i<D.size();i++) {
        ans *= D[i]+1;
        ans %= mod;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
import sys
import os
import math
import bisect
import itertools
import collections
import heapq
import queue
import array

# 時々使う
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
# from decimal import Decimal
# from collections import defaultdict, deque

# 再帰の制限設定
sys.setrecursionlimit(10000000)


def ii(): return int(sys.stdin.buffer.readline().rstrip())
def il(): return list(map(int, sys.stdin.buffer.readline().split()))
def fl(): return list(map(float, sys.stdin.buffer.readline().split()))
def iln(n): return [int(sys.stdin.buffer.readline().rstrip())
                    for _ in range(n)]


def iss(): return sys.stdin.buffer.readline().decode().rstrip()
def sl(): return list(map(str, sys.stdin.buffer.readline().decode().split()))
def isn(n): return [sys.stdin.buffer.readline().decode().rstrip()
                    for _ in range(n)]


def lcm(x, y): return (x * y) // math.gcd(x, y)


MOD = 10 ** 9 + 7
INF = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    S = iss()
    if S[-1] == 's':
        print(S + 'es')
    else:
        print(S + 's')


if __name__ == '__main__':
    main()


Measured memory_bytes: 9656
#include <iostream>

using namespace std;
// int n = 7;  int a[] = {4,2,5,3,5,8,3}; sort(a,a+n)
int main() {
    string s;
    cin >> s;
        int g = s.length();
    for(int i = 0; i < g ; i++){
        cout << "x";
    }
    return 0;
}

Measured memory_bytes: 3648
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<string>
using namespace std;

int main(void){
        int i;
        int n;
        long long sum, j;

        scanf("%d",&n);
        sum=0;
        for(i=1;i<=n;i++){
                if((i%3)!=0 && (i%5)!=0){
                        j=i;
                        sum += j;
                }
        }

        printf("%lld\n",sum);

        return 0;
}



Measured memory_bytes: 1732
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
using namespace __gnu_pbds;
using namespace std;
#define mod 1000000007
#define endl "\n"
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define lb lower_bound
#define f(i,p,n) for(ll i=p;i<n;i++)
#define debug(x) cout<<"["<<#x<<": "<<x<<"]"<<endl
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;

ll exp(ll a,ll b,ll m);

int main()
{
 ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
 	/*
 	#ifndef ONLINE_JUDGE
        freopen("/home/savish/Desktop/2019/io/input.txt", "r", stdin);
        freopen("/home/savish/Desktop/2019/io/output.txt", "w", stdout);
    #endif
        */
    ll n;
    cin>>n;
    double a[n];
    f(i,0,n) cin>>a[i];

    double dp[n+1]={0},ans = 0;
    dp[0] = 1.00;

    f(i,0,n)
    {
    	for(ll j = i+1;j>=0;j--)
    	{
    		dp[j] = dp[j]*(1-a[i]) + (j>0 ?dp[j-1]:0)*a[i];
    	}
    }

    f(i,0,n+1)
    {
    	if(i>n-i) ans+=dp[i];
    }
    cout<<setprecision(10);
    cout<<fixed;
    cout<<ans<<endl;
    
    
return 0;
}

ll exp(ll a,ll b,ll m)
{
	if(b==0)
	{
		return 1;
	}
	ll temp =exp(a,b/2,m);
	temp=(temp*temp)%m;
	if(b&1)
	{
		return (temp*(a%m))%m;
	}
	return temp;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
#include <set>

using namespace std;

typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define Fst first
#define Snd second
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)
#define repv(t,it,v) for(vector<t>::iterator it = v.begin() ; it != v.end() ; ++it)

int N;
int A[100010];
int d[100010];

int main(){
	scanf("%d%d" , &N , A);
	if(N == 1){
		printf("YES\n");
		return 0;
	}
	int m = 0;
	repp(i,1,N){
		scanf("%d" , A + i);
		d[i-1] = A[i] - A[i-1];
		m = max(m , d[i-1]);
	}
	d[N-1] = A[0] - A[N-1];
	m = max(m , d[N-1]);
	repp(i,0,N){
		d[i] = m - d[i];
		if(d[i] % N != 0){
			printf("NO\n");
			return 0;
		}
		d[i] /= N;
		A[0] -= (N-i) * d[i];
	}
	printf("%s\n" , A[0] == 0 ? "YES" : "NO");
	return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
#define MOD 1000000007
#define int long long

bool pr[(int)1e6];

signed main(){
    fill(pr,pr+(int)1e6,true);
    pr[0]=false,pr[1]=false;
    int x;cin>>x;
    for(int i=2;i*i<=2*x;i++)for(int j=i*2;j<2*x;j+=i)pr[j]=false;
    for(int i=x;;i++)
        if(pr[i]){cout<<i<<endl;return 0;}
}


Measured memory_bytes: 1280
def solve():
    from itertools import cycle
    from sys import stdin
    f_i = stdin
    m_i = map(lambda x: x.rstrip(), f_i)
    
    while True:
        m, n = map(int, next(m_i).split())
        if m == 0:
            break
        
        player = list(range(1, m + 1))
        ans = ('FizzBuzz' if i % 15 == 0 else 'Fizz' if i % 3 == 0 else
               'Buzz' if i % 5 == 0 else str(i) for i in range(1, n + 1))
        
        while len(player) > 1:
            for p, a in zip(cycle(player), ans):
                n -= 1
                if next(m_i) != a:
                    break
            else:
                break
            idx = player.index(p)
            player = player[idx+1:] + player[:idx]
        while n:
            next(m_i)
            n -= 1
        player.sort()
        print(*player)

solve()


Measured memory_bytes: 6160
lists=[]
while True:
    a,b=map(int,input().split())
    if a==0 and b==0:
        break
    if a>b:
        lists.append(b)
        lists.append(a)
    else:
        lists.append(a)
        lists.append(b)

j=0

for i in lists:
    print("{0} {1}".format(lists[2*j],lists[2*j+1]))
    j=j+1
    if j==len(lists)//2:
        break
    
    


Measured memory_bytes: 5868
#include <iostream>
#include <string>
using namespace std;
int main() {
	string str;
	int e=0, w=0, s=0, n=0;
	cin >> str;
	for (int i = 0; i < str.length(); i++) {
		switch (str[i]) {
			case 'E':
				e++;
				break;
			case 'W':
				w++;
				break;
			case 'S':
				s++;
				break;
			case 'N':
				n++;
				break;
		}
	}
	if (e > 0 && w == 0 || w > 0 && e == 0) cout << "No" << endl;
	else if (s > 0 && n == 0 || n > 0 && s == 0) cout << "No" << endl;
	else cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main (){
	int n, sama = 0;
	scanf ("%d", &n);
	char str[n + 1];
	scanf ("%s", &str);
	for (int i = 0, j = n/2; i < n/2; i++, j++){
		if (str[i] == str[j]){
			sama++;
		}
	}
	if (n % 2 != 0 || sama != n/2){
		printf ("No");
	} else if (sama == n/2){
		printf ("Yes");
	}
return 0;
}

Measured memory_bytes: 1668
import math
import queue

N,M = map(int,input().split())
Map = [[] for i in range(N)]
for i in range(M):
  a,b = map(int,input().split())
  Map[a-1].append(b-1)
  Map[b-1].append(a-1)

# キューの定義
q = queue.Queue()
# キューにデータを挿入
q.put(0)
    
# キューからデータがなくなるまで取り出しを行う
flag = [0]*N 
flag[0]  = 1
ans_list = [0]*N

while(1):
  if(q.empty()):
    break
  num = q.get()
  for n in Map[num]:
    if(flag[n] != 1): # 訪問済みでないなら
      flag[n] = 1 # 訪問済みに
      ans_list[n] = num #　接続ノード(n)の1つ前のノードを今のノード(now)に
      q.put(n) # queueに接続ノードを入れる

print('Yes')
for i in range(1,N):
  print(ans_list[i]+1)

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

int main() {
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    
    int g=min(b,d)-max(a,c);
    if(g>=0)
        cout<<g<<endl;
    else
        cout<<"0"<<endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
num = [n for n in range(1,4801)]
kind = 0
kindlist = [0]*8
gekiyabacount=0

for i in a:
  if i in num[:400] and kindlist[0] == 0:
    kind += 1
    kindlist[0] = 1
  elif i in num[399:799] and kindlist[1] == 0:
    kind += 1
    kindlist[1] = 1
  elif i in num[799:1199] and kindlist[2] == 0:
    kind += 1
    kindlist[2] = 1
  elif i in num[1199:1599] and kindlist[3] == 0:
    kind += 1
    kindlist[3] = 1  
  elif i in num[1599:1999] and kindlist[4] == 0:
    kind += 1
    kindlist[4] = 1
  elif i in num[1999:2399] and kindlist[5] == 0:
    kind += 1
    kindlist[5] = 1
  elif i in num[2399:2799] and kindlist[6] == 0:
    kind += 1
    kindlist[6] = 1
  elif i in num[2799:3199] and kindlist[7] == 0:
    kind += 1
    kindlist[7] = 1
  elif i in num[3199:]:
    gekiyabacount += 1
    
if sum(kindlist) >= 1:
  print(sum(kindlist),sum(kindlist)+gekiyabacount)
else:
  print(1,gekiyabacount)

    

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
int main(){
	int N,A,B,c=0;
	cin>>N>>A>>B;
	rep(i,N){
		int x;
		cin>>x;
		if(x<A||B<=x) c++;
	}
	cout<<c<<endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void) {
	int X,A,B;
	cin >> X >> A >> B;
	if (A >= B) {
		cout << "delicious" << endl;
	}
	else {
		if (X >= (B-A)) {
			cout << "safe" << endl;
		}
		else {
		cout << "dangerous" << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <numeric>
using namespace std;
using ll = long long;

void dfs(vector<bool>& seen, vector<vector<ll>>& dic, map<vector<ll>, ll>& mp, ll s, vector<ll>& ans) {
	seen.at(s) = true;
	ll color = ans.at(s);

	vector<ll> list = dic.at(s);
	ll size = list.size();
	for (ll i = 0; i < size; i++) {
		ll j = list.at(i);
		ll u = min(j, s);
		ll v = max(j, s);
		ll w = mp[{u, v}];
		if (!(seen.at(j))) {
			if (w % 2 == 0) ans.at(j) = color;
			else ans.at(j) = 1 - color;
			dfs(seen, dic, mp, j, ans);
		}
	}

}

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

	vector<vector<ll>> dic(n);
	map<vector<ll>, ll> mp;
	for (int i = 0; i < n - 1; i++) {
		ll u, v, w;
		cin >> u >> v >> w;
		u = u - 1;
		v = v - 1;
		dic.at(u).push_back(v);
		dic.at(v).push_back(u);
		mp[{u, v}] = w;
	}

	vector<bool> seen(n, false);
	vector<ll> ans(n, -1);
	ans.at(1) = 0;
	dfs(seen, dic, mp, 1, ans);

	for (int i = 0; i < n; i++) {
		cout << ans.at(i) << endl;
	}

	return 0;

}


Measured memory_bytes: 30640
#include<bits/stdc++.h>
using namespace std;
vector<int> cost;
vector<vector<int>> v;
int func(int idx, vector<int> arr)
{
  bool ok = true;
  for(auto it: arr)
  {
    if(it > 0)
      ok = false;
  }
  if(ok)
    return 0;
 if(idx==-1)
    return 0x3f3f3f3f;
  vector<int> arr1 = arr;
  for(int i=0;i<(int)arr1.size();i++)
  	arr1[i] -= v[idx][i];   
  int ans1 = cost[idx] + func(idx-1,arr1);
  int ans2 = func(idx-1,arr);
  return min(ans1,ans2);
}
int main()
{
  int n,m,x;
  cin>>n>>m>>x;
  cost.resize(n);
  v.resize(n,vector<int> (m));
  for(int i=0;i<n;i++)
  {
    for(int j=0;j<m+1;j++)
    {
      if(!j)
        cin>>cost[i];
      else
        cin>>v[i][j-1];
    }
  }
  vector<int> arr(m,x);
  int ans = func(n-1,arr);
  if(ans == 0x3f3f3f3f)
      ans = -1;
  cout<<ans;
  return 0;
}


Measured memory_bytes: 3620
while 1:
    n, k = [int(i) for i in input().split()]
    if n == 0 and k == 0:
        break
    a = [int(input()) for i in range(n)]
    s = sum(a[0:k])
    M = s
    
    for i in range(k, n):
        s = s + a[i] - a[i - k]
        if s > M:
            M = s
            
    print(M)


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

using namespace std;
const int N = 1e5 + 3, MOD = 1e9 + 7;
int n, k;
char s[N];
int main() {
#ifndef ONLINE_JUDGE
//	freopen("input.in", "r", stdin);
#endif
	scanf("%d %d %s", &n, &k, s);
	vector<int> seg;
	int c = 1, res = 0;
	for (int i = 1; i <= n; ++i) {
		res += s[i] == s[i - 1];
		if (s[i] == s[i - 1]) {
			++c;
		} else {
			seg.push_back(c);
			c = 1;
		}
	}
	for (int i = 2; k && i <= seg.size(); i += 2, --k) 
		if (i == seg.size())
			++res;
		else
			res += 2;
	printf("%d\n", res);
	return 0;
}


Measured memory_bytes: 1020
program main
   integer :: x(3),r(3),t(3) = (/ 4, -9, 5 /)
   read(*, *)n,m
   id = n - m/1000
   dmin = id/4.d0
   dmax = id*2.d0/9.d0
   k = floor(dmax)
   r = (/-id, 2*id, m/1000/)
   x = r + k*t
   if(any(x < 0)) x = -1
   write(*, *) x
end

Measured memory_bytes: 256
import itertools
import os
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")

MOD = 10 ** 9 + 7

N, M = list(map(int, sys.stdin.readline().split()))
X = list(map(int, sys.stdin.readline().split()))
Y = list(map(int, sys.stdin.readline().split()))

xd = [b - a for a, b in zip(X[:-1], X[1:])]
yd = [b - a for a, b in zip(Y[:-1], Y[1:])]

#  あるエリアが何回カウントされるか
xc = itertools.accumulate(range(len(xd), -len(xd), -2))
yc = itertools.accumulate(range(len(yd), -len(yd), -2))

x = 0
for d, c in zip(xd, xc):
    x = (x + d * c) % MOD
y = 0
for d, c in zip(yd, yc):
    y = (y + d * c) % MOD

print(x * y % MOD)


Measured memory_bytes: 22252
n,m=map(int,input().split())
num=m//n

def make_divisors(n):
    divisors=[]
    for i in range(1,int(n**0.5)+1):
        if n%i==0:
            divisors.append(i)
            if i!=n//i:
                divisors.append(n//i)
    return divisors
make=make_divisors(m)
make.sort()
import bisect
ans=bisect.bisect_right(make,num)
print(make[ans-1])

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

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

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

struct Ps{
  int r,c;
  Ps():r(0),c(0){}
  Ps(int r,int c):r(r),c(c){}
  Ps operator+(const Ps&p)const
  { return Ps(r+p.r,c+p.c);  }
  friend istream& operator>>(istream&is,Ps&p)
  {is >> p.r >> p.c; return is;  }
};

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int h,w; cin >> h >> w;
  Ps s,g; cin >> s >> g;
  s = s+Ps(-1,-1);
  g = g+Ps(-1,-1);
  bitset<1000> mz[1000];
  for(int i = 0; i < h; ++i)for(int j = 0; j < w; ++j)
      mz[i][j] = []{char c; cin >> c; return c;}() == '.';
  optional<int> distance[1000][1000];
  deque<pair<Ps,int>> dq;
  dq.emplace_front(s,0);
  constexpr int mr[] = {0,0,1,-1};
  constexpr int mc[] = {1,-1,0,0};
  constexpr int nr[] = {-2,-2,-2,-2,-2,-1,-1,-1,-1, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2};
  constexpr int nc[] = {-2,-1, 0, 1, 2,-2,-1, 1, 2,-2, 2,-2,-1, 1, 2,-2,-1, 0, 1, 2};
  while(!dq.empty()){
    auto [ps,di] = dq.front();
    dq.pop_front();
    if(distance[ps.r][ps.c])continue;
    distance[ps.r][ps.c] = di;
    mz[ps.r][ps.c] = 0;
    if(ps.r==g.r && ps.c==g.c)break;
    for(int i = 0; i < 4; ++i){
      Ps nps = ps + Ps(mr[i],mc[i]);
      if(nps.r < 0 || nps.c < 0 || nps.r >= h || nps.c >= w)continue;
      if(!mz[nps.r][nps.c])continue;
      mz[nps.r][nps.c] = 0;
      dq.emplace_front(move(nps),di);
    }
    for(int i = 0; i < 20; ++i){
      Ps nps = ps + Ps(nr[i],nc[i]);
      if(nps.r < 0 || nps.c < 0 || nps.r >= h || nps.c >= w)continue;
      if(!mz[nps.r][nps.c])continue;
      dq.emplace_back(move(nps),di+1);
    }
  }
  cout << (distance[g.r][g.c] ? distance[g.r][g.c].value() : -1) << endl;
}


Measured memory_bytes: 12128
#include<stdio.h>

int main(){
	
	char s[4];
	scanf("%s",&s);
	getchar();
	
	if(s[0] == s[1] && s[1] == s[2] && s[2] == s[0]){
		printf("No");
	}
	else{
		printf("Yes");
	}
	
	
	return 0;
}

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

using namespace std;

int n;
long long v[3002];
long long dp[3002][3002];

void calc(int l,int r) {
  if(dp[l][r] != -1) return;
  calc(l + 1, r);
  calc(l, r - 1);
  long long x = v[l] - dp[l + 1][r];
  long long y = v[r] - dp[l][r - 1];
  dp[l][r] = max(x, y);
}

int main()
{
  cin >> n;
  for(int i = 1; i <= n; i++)
    cin >> v[i];
  for(int i = 1; i <= n;i++) {
    for(int j =1; j <= n; j++)
      dp[i][j] = -1;
  }
  for(int i = 1; i <= n; i++) {
    dp[i][i] = v[i];
  }
  calc(1, n);
  cout << dp[1][n];
  return 0;
}


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

const int N = 1e3+100;
char arr[N][N];
int n, m, counter = 0;
int memo[N][N];
const int K = 1e9+7;

bool valid(int i, int j){
    return i < n && j < m && arr[i][j] != '#';
}
long long solve(int i, int j) {

    memo[n-1][m-1] = 1;
    for (int i = n - 1; i >= 0; --i) {
        for (int j = m - 1; j >= 0; --j) {
            if (valid(i, j + 1)) {
                memo[i][j] += (memo[i][j + 1]);
            }
            if (valid(i + 1, j)) {
                memo[i][j] += (memo[i + 1][j]);
            }
            memo[i][j] %= K;
        }
    }
    return (memo[0][0]) % K;
}
int main() {
    scanf("%d %d", &n, &m);
    for(int i = 0 ; i < n ; ++i)
        for(int j = 0 ; j < m ; ++j)
            cin >> arr[i][j];

    printf("%lld", solve(0, 0));
    return 0;
}


Measured memory_bytes: 5632
n,y = map(int,input().split())
yukichi=-1
ichiyo=-1
hideo=-1
for yi in range(n+1):
  for ii in range(n-yi+1):
    hi = n-(yi+ii)
    if (yi*10000)+(ii*5000)+(hi*1000)==y:
      yukichi,ichiyo,hideo=yi,ii,hi
print(yukichi,ichiyo,hideo)


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

int main(){
  int x,i,j;
  cin>>x;
  int mi=1000;
  for(i=1;i<=32;i++){
    for(j=2;j<=9;j++){
      if(x>=(int)pow(i,j)){
        mi=min(mi,x-(int)pow(i,j));
      }else break;
    }
  }
  cout<<x-mi;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")

#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
#include <string>
#include <string_view>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
using namespace std;

/*----------macros----------*/

//output================
#define endl '\n'
#define fcout(a) cout << fixed << setprecision((int)(a))

//typedef===============
typedef long long       ll;
typedef long double     ld;
typedef vector<int>     Vi;
typedef vector<ll>      Vl;
typedef pair<int, int>  Pii;
typedef pair<ll, ll>    Pll;

//const number==========
constexpr ll INF9   = (ll)1e9 + 1;
constexpr ll INF18  = (ll)1e18 + 1;
constexpr ll MOD1    = 1000000007;
constexpr ll MOD2   = 998244353;
constexpr ld PI     = 3.141592653589793L;

//member================
#define psb push_back
#define epb emplace_back
#define psf push_front
#define mkp make_pair
#define fst first
#define scd second

//others================
#define all(x)          (x).begin(), (x).end()
#define rall(x)         (x).rbegin(), (x).rend()
#define rep(i, n)       for(int i = 0; (i) < (n); ++(i))
#define reps(i, n)      for(int i = 1; (i) <= (n); ++(i))
#define rrep(i, n)      for(int i = n - 1; (i) >= 0 ; --(i))
#define repbit(bit, n)  for(int bit = 0; (bit) < (1 << (n)); ++(bit))
#define ifbit(bit, i)   if((bit) & (1 << (i)))
#define CtoI(c)         int((c)) - int('0')
#define ItoC(c)         char((c) + '0')

//functions=============
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

//vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
//vector<int> dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };

/*--------additional--------*/



/*----------main------------*/

int main(int argc, char *argv[]) {
/*----------fastio----------*/
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);
/*----------solve-----------*/

    int a, b, k; cin >> a >> b >> k;
    bool takahashi = true;
    while(k > 0){
        if(takahashi){
            if(a%2 != 0){
                a -= 1;
            }
            b += a/2;
            a /= 2;
        }
        else if(!takahashi){
            if(b%2 != 0){
                b -= 1;
            }
            a += b/2;
            b /= 2;
        }
        --k;
        takahashi ^= 1;
    }

    cout << a << " " << b << endl;

return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define M 100001
using namespace std;
int main() {
  int v,w,N,W,answer=0;
  cin >> N >> W;
  vector<vector<int>> dp(N+1,vector<int>(M,W+1));
  dp[0][0] = 0;
  for (int i = 0; i < N; i++) {
    cin >> w >> v;
    for (int j = 0; j <= M; j++) {
      dp[i+1][j] = min(dp[i][j],dp[i+1][j]);
    }
    for (int j = 0; j+v <= M; j++) {
      dp[i+1][j+v] = min(dp[i+1][j+v],dp[i][j]+w);
    }
  }
  for (int i = 1; i < M; i++) {
    if (dp[N][i] <= W) {
      answer = max(answer,i);
    }
  }
  cout << answer;
}

Measured memory_bytes: 43388
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
    int N, i, j, k, count = 1;
    char S[200000][11];
    scanf("%d", &N);
    for (i = 0; i < N; i++)
        scanf("%s", S[i]);

    qsort(S, N, sizeof(S[0]), strcmp);

    for (i = 1; i < N; i++)
        if (strcmp(S[i - 1], S[i])) count++;

    printf("%d\n", count);
    return 0;
}

Measured memory_bytes: 5736
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vint = vector<int>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vchar = vector<char>;
using vvchar = vector<vchar>;

#define rep(i, n) for (int i = 0; i < n; ++i)
#pragma region Debug
istream &operator>>(istream &is, P &a)
{
    return is >> a.first >> a.second;
}
ostream &operator<<(ostream &os, const P &a) { return os << "(" << a.first << "," << a.second << ")"; }

template <typename T>
void view(const std::vector<T> &v)
{
    for (const auto &e : v)
    {
        std::cout << e << " ";
    }
    std::cout << std::endl;
}
template <typename T>
void view(const std::vector<std::vector<T>> &vv)
{
    for (const auto &v : vv)
    {
        view(v);
    }
}
#pragma endregion

#pragma region UnionFind
struct UnionFind
{
    vector<int> d;
    // d[x] is the index of the parent of x
    // d[x] is -size if x is a root

    UnionFind(int n) : d(vector<int>(n, -1)) {}
    int root(int x)
    {
        if (d[x] < 0)
        {
            return x;
        }
        return d[x] = root(d[x]);
    }

    bool unite(int x, int y)
    {
        x = root(x);
        y = root(y);
        if (x == y)
        {
            return false;
        }
        if (d[x] > d[y])
            swap(x, y); // x always bigger tree

        d[x] += d[y];
        d[y] = x;
        return true;
    }

    bool same(int x, int y)
    {
        return root(x) == root(y);
    }
    int size(int x) { return -d[root(x)]; }
};
#pragma endregion

struct edge
{
    int s, t, d;
    edge(int ss = 0, int tt = 0, int dd = 0) : s(ss), t(tt), d(dd) {}
    bool operator>(const edge &r) const { return d > r.d; }
};

struct town
{
    int x, y, i;
    town(int xx = 0, int yy = 0, int ii = 0) : x(xx), y(yy), i(ii) {}
};

int INF = 1 << 30;

int main()
{
    int n;
    cin >> n;
    vector<town> xs(n), ys(n);
    rep(i, n)
    {
        cin >> xs[i].x >> xs[i].y;
        xs[i].i = i;
        ys[i] = xs[i];
    }
    sort(xs.begin(), xs.end(), [](town a, town b) { return a.x > b.x; });
    sort(ys.begin(), ys.end(), [](town a, town b) { return a.y > b.y; });

    priority_queue<edge, vector<edge>, greater<edge>> q;
    rep(i, n - 1)
    {
        edge x(xs[i].i, xs[i + 1].i, abs(xs[i].x - xs[i + 1].x)),
            y(ys[i].i, ys[i + 1].i, abs(ys[i].y - ys[i + 1].y));

        q.push(x);
        q.push(y);
    }

    UnionFind uft(n);
    ll ans = 0;
    while (q.size())
    {
        edge e = q.top();
        q.pop();
        if (uft.unite(e.s, e.t))
        {
            ans += e.d;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 7156
#include <bits/stdc++.h>
#define int long long
#define double long double
using namespace std;
const int MOD = 1000000007;
const int INF = 1e18;
using Graph = vector<vector<int>>;

signed main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for( int i = 0; i < N; i++ ) cin >> A[i];
  sort(A.rbegin(), A.rend());

  int ans = A[0];
  int cnt = 0;
  int now = 1;
  for ( int i = 2; i < N; i++ ){
    cnt++;
    if( cnt <= 2 ) ans += A[now];
    else{
      cnt = 1;
      now++;
      ans += A[now];
    }
  }
  cout << ans << endl;

 }

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

int d[10];

int main() {
	int i, a, b;
	for (i = 1; i <= 3; ++i) scanf("%d%d", &a, &b), ++d[a], ++d[b];
	sort(d + 1, d + 4 + 1);
	if (d[1] == 1 && d[2] == 1 && d[3] == 2 && d[4] == 2) puts("YES");
	else puts("NO");
	return 0;
}

Measured memory_bytes: 256
if isfile("mystdin.txt");mystdin=open("mystdin.txt","r");redirect_stdin(mystdin);end
n,d=parse.(Int,split(readline()))
isok(x::Int,y::Int)=x^2+y^2<=d^2
function main()
  ans=0
  for i=1:n
    ans+=Int(isok(parse.(Int,split(readline()))...))
  end
  println(ans)
end
main()
if isdefined(Base, :mystdin);close(mystdin);end

Measured memory_bytes: 209744
s = list(input())
n = len(s)
m = []
m.append(s[0])
del s[0]
count = 0
while count < n:
    try:
        if m[-1] == s[count]:
            m.append(s[count] + s[count + 1])
            count += 2
        else:
            m.append(s[count])
            count += 1
    except:
        m[-1] = m[-1] + s[-1]
        count += 2
print(len(m))

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

char s[34];
int c[26],e[26],u[26];

int f(int i){
    return (i==u[i])?i:(u[i]=f(u[i]));
}

int main(){
    int n,i;
    for(;scanf("%d",&n),n;puts(i<26?"NG":"OK")){
        int a,b;
        for(i=0;i<26;i++){
            c[i]=e[i]=0;
            u[i]=i;
        }
        for(i=0;i<n;i++){
            scanf("%s",s);
            a=s[0]-'a';
            b=s[strlen(s)-1]-'a';
            c[a]++;
            c[b]--;
            e[a]=e[b]=1;
            u[f(a)]=f(b);
        }
        for(i=0;i<26;i++){
            if(e[i]&&(c[i]||f(a)!=f(i)))break;
        }
    }
    return 0;
}

Measured memory_bytes: 588
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cmath> 
#include <queue>
#include <functional>

using namespace std;
typedef long long ll;
//typedef pair<int, int> P;
//static const int dx[4] = {1, -1, 0, 0};
//static const int dy[4] = {0, 0, 1, -1};

//const ll MOD = 1e+9 + 7;
//const int MAX = 10001;

int main() {

    ll L , R; cin >> L >> R;

    ll mod = 2019;

    if (R - L >= mod) {
        cout << 0 << '\n';
        return 0;
    }

    ll ans = 2020;
    for (ll i = L; i <= R ; i++) {
        for (ll j = i+1; j <= R ; j++) {
            ans = min(ans, i * j % mod);
        }
    }

    cout << ans << '\n';

}



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

from collections import deque

neig = [(1, 0), (-1, 0), (0, 1), (0, -1)]

H, W = map(int, input().split())

F = []
nW = 0
for _ in range(H):
    F.append(list(input()))
    nW += sum([1 for s in F[-1] if s == '.'])

ans = -1
q = deque()
q.append((0, 0, 1))
F[0][0] = 'V' # Visited

while q:
    y, x, count = q.popleft()
    if y == H - 1 and x == W - 1:
        ans = nW - count
        break
    for n in neig:
        ny, nx = y + n[0], x + n[1]
        if 0 <= ny < H and 0 <= nx < W:
            if F[ny][nx] == '.':
                q.append((ny, nx, count + 1))
                F[ny][nx] = 'V' # Visited

print(ans)


Measured memory_bytes: 3316
package main

import "fmt"

type container struct {
	data []int
}

func (c *container) queue(v int) {
	c.data = append(c.data, v)
}
func (c *container) dequeue(p *int) bool {
	if p == nil || len(c.data) == 0 {
		return false
	}
	*p = c.data[0]
	c.data = c.data[1:len(c.data)]
	return true
}

func main() {
	var n int
	fmt.Scan(&n)
	g := make([][]int, n+1) // 1-indexed
	d := make([]int, n+1)   // 1-indexed
	for i := 1; i <= n; i++ {
		d[i] = -1
		var u, k, v int
		fmt.Scan(&u, &k)
		for j := 0; j < k; j++ {
			fmt.Scan(&v)
			g[u] = append(g[u], v)
		}
	}

	var q container
	d[1] = 0
	q.queue(1)

for len(q.data) > 0  { // 幅優先探索
		var v int
		q.dequeue(&v)
		for i := 0; i < len(g[v]); i++ {
			nv := g[v][i]
		if d[nv] == -1 { // 未訪問
				q.queue(nv)
				d[nv] = d[v] + 1
			}
		}
	}
	for i := 1; i <= n; i++ {
		fmt.Printf("%d %d\n", i, d[i])
	}
}



Measured memory_bytes: 1200
s = input().rstrip()
ss = s[::-1]
n = len(s)
res = 0
for i in range(n):
    if s[i] == 'A':
        res -= i - 1
        break
for i in range(n):
    if ss[i] == 'Z':
        res += n - 1 - i
        break
print(res)

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

int main() {
    int n;
    scanf("%d",&n);
    printf("%d",10-n/200);
}

Measured memory_bytes: 1732
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong(), b = sc.nextLong(), c = sc.nextLong(), d = sc.nextLong();
        if(c < d) {
            long t = c;
            c = d;
            d = t;
        }
        long ans = (b - a + 1) - ((b / c - (a - 1) / c) + (b / d - (a - 1) / d)
                 - (b / lcm(c, d) - (a - 1) / lcm(c, d)));
        System.out.println(ans);
    }
    static long lcm(long m, long n) {
        return m * n / gcd(m, n);
    }
    static long gcd(long m, long n) {
        long r = m % n;
        while(r > 0) {
            m = n;
            n = r;
            r = m % n;
        }
        return n;
    }
}


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

int main(){
  int N;
  string S;
  cin >> N >> S;
  int count = 0;
  int flag = 0;
  for (int i=0; i<N; i++) {
    if (S.at(i) == 'A') {
      flag = 1;
    }
    else if (S.at(i) == 'B' && flag == 1) {
      flag = 2;
    }
    else if (S.at(i) == 'C' && flag == 2) {
      count++;
      flag = 0;
    }
    else flag = 0;
  }
  cout << count << endl;
}

Measured memory_bytes: 256
// INCLUDES
#include <bits/stdc++.h>
#include<assert.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
//DEFINES
#define MAX 1000001
#define pii pair<int, int>
#define F first
#define S second
#define all(s) begin(s),end(s)
#define MIN3POS(a, b, c) (a) =< (b) ? ((a) =< (c) ? 1 : 3) : ((b) =< (c) ? 2 : 3)
#define MAX3POS(a,b,c) (a) >= (b) ? ((a) >= (c) ? 1 : 3) : ((b) >= (c) ? 2:3)
#define endl '\n'
#define int long long
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define FOR(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define IOS   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);}
//NAMESPACES
using namespace __gnu_pbds; 
using namespace std;
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#ifdef XOX
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif
//HELPERS

vector<int> powers2(32,0);void initialize(){ for(int i=1;i<powers2.size();i++) powers2[i] = powers2[i-1]*2;}
int32_t main()
{
IOS
int n,k;
cin>>n>>k;
vector<int> v(n+1,0);
FOR(i,0,k) {
    int d;
    cin>>d;
    FOR(j,0,d) {
        int val;
        cin>>val;
        v[val]++;
    }
}
int cnt = 0;
FOR(i,1,n+1) if(v[i] == 0) cnt++;
cout<<cnt;
return 0;
}
// Use emplace back in place of pushback
// Use tie function , for object destructuring

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

int dp[1002][1002];

int main() {
  vector <int> cost,ne;
  int w;
  int n;
  int count = 0;
  while(1) {
    count++;
    cin >> w;
    if(w == 0) break;
    cin >> n;

    string str,a;
    cost.resize(n);
    ne.resize(n);
    for(int i=0;i<n;i++) {
      cin >> str;

      int flg = 0,b,c;
      a.clear();
      cost[i] = ne[i] = 0;
      for(int j=0;j<str.size();j++) {
	if(str[j] == ',') {
	  c= 1;
	  for(int k=j-1;k>=0;k--) {
	    ne[i] += (str[k]-'0')*c;
	    c *= 10;
	  }
	  b = j;
	  continue;
	}
	a += str[i];
      }
      c = 1;
      for(int k=str.size()-1;k>b;k--) {
	cost[i] += (str[k]-'0')*c;
	c *= 10;
      }
    }
    
    for(int i=0;i<=n;i++)
      for(int j=0;j<=w;j++)
	dp[i][j] = -1;
   
    for(int i=0;i<=n;i++) dp[i][0] = 0;

    for(int i=1;i<=n;i++) {
      for(int j=0;j<=w;j++) {
	if(dp[i-1][j] != -1 && cost[i-1]+j <= w) { 
	  dp[i][cost[i-1]+j] =max(ne[i-1] + dp[i-1][j],dp[i][j+cost[i-1]]);
	}
	dp[i][j] =max(dp[i][j], dp[i-1][j]);
      }
    }
    
    /*    for(int i=0;i<=n;i++){
      for(int j=0;j<=w;j++)
	cout << dp[i][j] <<" ";
	  cout << endl;
	  } */

    
    int   ans = -1,ans2;
    for(int i=0;i<=w;i++)
      if(ans < dp[n][i] )
	ans = dp[n][i],ans2 = i;
    
    cout <<"Case "<< count <<":"<<endl;
    cout << ans <<endl;
    cout << ans2 <<endl;
    
    
  }
  return 0;
}

Measured memory_bytes: 5148
import Control.Monad
import Control.Monad.Trans.State.Strict
import Data.Char (isSpace)
import Data.Maybe (fromJust)
import qualified Data.ByteString.Lazy.Char8 as B
import Data.List
--
type Parser a = StateT B.ByteString Maybe a

parseInt :: Parser Int
parseInt = StateT (B.readInt . B.dropWhile isSpace)

parseInt2 :: Parser (Int,Int)
parseInt2 = liftM2 (,) parseInt parseInt

parse :: Parser [(Int,Int)]
parse = do
    (_,m)<-parseInt2
    replicateM m parseInt2

main=B.getContents>>=print.f 0 0.sortOn snd.fromJust.evalStateT parse

f n _ [] = n
f n x ((a,b):abs)
    | a<x  = f n x abs
    | True = f (n+1) b abs


Measured memory_bytes: 33148
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
//解説AC
int main() {
	long long n,k;
	cin>>n>>k;
	vector<long long>p(n),c(n);
	rep(i,n){
		cin>>p[i];
		p[i]--;
	}
	rep(i,n)cin>>c[i];
	long long kotae=-LLONG_MAX;//答えはマイナスになることもあるので0で初期化は不可
	rep(start,n){
  	    long long x=start;
		long long wa=0;
		vector<long long>to;
		while(1){
			x=p[x];
			to.push_back(c[x]);
			wa+=c[x];
			if(x==start)break;
		}
		int saikuru=to.size();
		long long sum=0;
    	rep(i,saikuru){//ここからの部分が書けなかった
			sum+=to[i];
			if(i+1>k)break;
			long long saidai=sum;
    		if(wa<0){
	    	}else{
		    	long long kaisuu=(k-(i+1))/saikuru;//ここが難しい
			    saidai+=kaisuu*wa;
		    }
    		kotae=max(kotae,saidai);
		}
	}
	cout<<kotae<<endl;
	return 0;
}

Measured memory_bytes: 3824