akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define all(x) x.begin(),x.end()
#define let auto const

template<typename... Types>
struct dynarr: std::vector<Types...> {
  using std::vector<Types...>::vector;
  using size_type = typename std::vector<Types...>::size_type;
  auto&& operator[](size_type i) { return this->at(i); }
  auto&& operator[](size_type i) const { return this->at(i); }
};

struct edge {
  i64 s;
  i64 t;
  i64 d;
};

int main() {
  i64 N, R;
  cin >> N >> R;
  vector<vector<edge>> G(N);
  rep(r,0,R) {
    i64 s, t, d;
    cin >> s >> t >> d;
    s--;
    t--;
    G[s].push_back({s, t, d});
    G[t].push_back({t, s, d});
  }

  vector<vector<i64>> dist(N, vector<i64>(N, 1e18));
  rep(i,0,N){
    using P = pair<i64, i64>;
    priority_queue<P, vector<P>, greater<P>> que;
    que.push({ 0, i });
    dist[i][i] = 0;
    while(!que.empty()) {
      i64 v = que.top().second;
      i64 d = que.top().first;
      que.pop();

      if(dist[i][v] > d) continue;
      for(auto e: G[v]) {
        if(dist[i][e.t] > d + e.d) {
          dist[i][e.t] = d + e.d;
          que.push({ dist[i][e.t], e.t });
        }
      }
    }
  }

  vector<i64> used(N, 0);

  i64 MAX = 0;
  rep(i,0,N) MAX = max(MAX, *max_element(all(dist[i])));

  rep(i,0,N) {
    queue<i64> que;
    vector<i64> vis(N);
    rep(j,0,N) {
      if(dist[i][j] == MAX) {
        que.push(j);
        vis[j] = true;
      }
    }
    while(!que.empty()) {
      i64 v = que.front();
      que.pop();
      used[v] = true;
      for(auto e: G[v]) {
        if(dist[i][e.t] + e.d == dist[i][e.s] && !vis[e.t]) {
          que.push(e.t);
          vis[e.t] = true;
        }
      }
    }
  }
  cout << std::count(all(used), false) << endl;
  rep(i,0,N) {
    if(!used[i]) {
      cout << i + 1 << endl;
    }
  }
}



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

const int N = 10;
int a[N];
      
int main() {
  int Tc;
  cin >> Tc;
  while(Tc--) {
    for(int i = 0; i < N; ++i) cin >> a[i];
    string res = "NO";
    for(int b = 0; b < (1<<N); ++b) {
      int pre[2] = {-1,-1};
      for(int i = 0; i < N; ++i) {
	int t = ((b>>i)&1);
	if(pre[t] != -1 && pre[t] > a[i]) {
	  break;
	}
	pre[t] = a[i];
	if(i+1 == N) res = "YES";
      }
    }
    cout << res << endl;
  }
  return 0;
}

Measured memory_bytes: 1200
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <set>
#include <string>
#include <vector>

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

const double Dist(const pair<double, double> &c1, const pair<double, double> &c2)
{
    return sqrt(pow(c1.first - c2.first, 2.0) + pow(c1.second - c2.second, 2.0));
}

int main()
{
    int N;
    cin >> N;
    vector<pair<double, double>> coords(N);
    for (auto &coord : coords)
    {
        cin >> coord.first >> coord.second;
    }
    double sum = 0.0;
    for (int i = 0; i < N; ++i)
    {
        for (int j = 0; j < N; ++j)
        {
            sum += Dist(coords[i], coords[j]);
        }
    }
    cout << setprecision(12) << sum * (N - 1) / (N * (N - 1)) << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  public static void main(String[] args) throws Exception {
    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.next());
    int a = Integer.parseInt(sc.next());
    int b = Integer.parseInt(sc.next());

    int sum = 0;
    int sumAll = 0;
    for (int i = 1; i <= n; i++) {
      int i1 = i % 10;
      int i10 = (i/10)%10;
      int i100 = (i/100)%10;
      int i1000 = (i/1000)%10;
      int i10000 = (i/10000)%10;
      sum = i1 + i10 + i100 + i1000 + i10000;
      if (a <= sum && sum <= b) {
        sumAll += i;
      }
    }

    System.out.println(sumAll);
  }
}


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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

const int dx[] = {0, -1, 1, 0};
const int dy[] = {-1, 0, 0, 1};

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

/*
 * 繰り返し自乗法
 */
//typedef long long LL;
LL power( LL x, LL n, int mod ) {
    LL res = 1;
    if( n > 0 ) {
        res = power( x, n / 2, mod );
        if( n % 2 == 0 ) res = ( res * res ) % mod;
        else res = ( ( ( res * res ) % mod ) * x ) % mod;

    }
    return res;
}

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

    int N;
    cin >> N;
    LL mi = 0, pl = 0;
    string s;
    cin >> s;
    reverse(all(s));
    int cnt = 0;
    for(int i = 0; i < s.size(); ++i) {
        if(s[i] == '1') ++cnt;
    }

    for(int i = 0; i < s.size(); ++i) {
        if(s[i] == '0') continue;
        if(cnt > 1) {
            mi += power(2, i, cnt - 1);
            mi %= (cnt - 1);
        }
        pl += power(2, i, cnt + 1);
        pl %= (cnt + 1);
    }

    for(int i = N - 1; i >= 0; --i) {
        if(s[i] == '0') {
            LL t = (pl + power(2, i, cnt + 1)) % (cnt + 1);
            int c = 1;
            while(t > 0) {
                LL tmp = t;
                int bi = 0;
                while(tmp > 0) {
                    bi += (tmp & 1);
                    tmp >>= 1;
                }
                t %= bi;
                ++c;
            }
            cout << c << endl;
        } else {
            if(cnt == 1) cout << 0 << endl;
            else {
                LL t = mi;
                t -= power(2, i, cnt - 1);
                while(t <= 0) t += (cnt - 1);
                t %= (cnt - 1);
                int c = 1;
                while(t > 0) {
                    LL tmp = t;
                    int bi = 0;
                    while(tmp > 0) {
                        bi += (tmp & 1);
                        tmp >>= 1;
                    }
                    t %= bi;
                    ++c;
                }
                cout << c << endl;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3780
use std::io;

fn main() {
    let mut s = String::new();
    io::stdin().read_line(&mut s).expect("Read failed");
    let ab: Vec<&str> = s.split(' ').collect();
    let a: i32 = ab[0].trim().parse().expect("");
    let b: i32 = ab[1].trim().parse().expect("");
    let ans = (a + b) % 24;
    println!("{}", ans);
}


Measured memory_bytes: 4352
/*
　　　  ∧＿∧　やあ
　　 （´・ω・｀)　　　　　/　　　　　ようこそ、バーボンハウスへ。
　　 ／∇y:::::＼　　　 [￣]　　　　　このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
　　 |:⊃:|:::::|　　　|──|
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|　うん、「また」なんだ。済まない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|￣　  仏の顔もって言うしね、謝って許してもらおうとも思っていない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣／|
　　　　∇　∇　∇　∇　　　／.／|　　　でも、この提出を見たとき、君は、きっと言葉では言い表せない
　　　　┴　┴　┴　┴　／ ／　  |　　　「ときめき」みたいなものを感じてくれたと思う。
￣￣￣￣￣￣￣￣￣￣|／　　  |　　　殺伐としたコンテストの中で、そういう気持ちを忘れないで欲しい
￣￣￣￣￣￣￣￣￣￣　　　　 |　　　そう思って、この提出を投げたんだ。
　　　(⊆⊇)　(⊆⊇)　(⊆⊇)　　|
　    ||　　 ||　　||　　|　　　 じゃあ、判定を聞こうか。
　　.／|＼　／|＼ ／|＼
*/

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define ALL(obj) (obj).begin(),(obj).end()
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef priority_queue<int> p_que;
typedef priority_queue<int, vector<int>, greater<int>()> p_que_rev;
// const int INF = INT_MAX;
const lint LINF = LLONG_MAX;
// const lint MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};


int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int a, b, c;
    cin >> a >> b >> c;
    if(a == b + c || b == a + c || c == b + a){
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 380
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);
    int N;
    LL P; cin >> N >> P;
    string S; cin >> S;
    reverse(S.begin(),S.end());


    LL ans = 0;
    if(P == 2 || P == 5){
        REP(i,N){
            if((S[i]-'0') % P == 0){
                ans += N-i;
            }
        }
        cout << ans << endl;
        return 0;
    }
    VL A(N+1);
    LL ten = 1;
    REP(i,N){
        //S[i+1] = S[i] * ten % P;
        A[i+1] = (A[i] + (S[i]-'0') * ten % P) % P;
        //dump(A[i+1])
        ten = ten * 10 % P;
    }
    map<LL,LL> mp;
    REP(i,N+1){
        ans += mp[A[i]];
        mp[A[i]]++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 2580
#include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std;
//using namespace atcoder;
#define ll long long
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rep1(i, n) FOR(i, 1, n+1)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define rwhole(x) (x).rbegin(), (x).rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define P pair<int, int>
#define debug(var) cerr << "[" << #var << "] " << var << endl
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define pr(s) cout << (s) << '\n'
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};
const int INF = 1001001001;
const ll INFll = 1E+18;

vector<ll> prime;

void setPrime(ll x) {
    for (ll i=2; i<=x; i++) {
        bool ok = true;
        for (ll e: prime) {
            if (i%e==0) {
                ok = false;
                break;
            }
            if (e*e>i) {
                break;
            }
        }
        if (ok) prime.push_back(i);
    }
}



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n, p;
    cin >> n >> p;
    setPrime(1000005);
    map<ll, ll> mp;
    ll now = p;
    for (ll e: prime) {
        if (e*e>now) break;
        if (now%e==0) {
            while (now%e==0) {
                now /= e;
                mp[e]++;
            }
        }
    }
    if (now!=1) {
        mp[now]++;
    }
    
    ll ans = 1;
    for (auto m: mp) {
        ll num = m.second;
        if (num<n) continue;
        while (num>=n) {
            num -= n;
            ans *= m.first;
        }
    }
    
    pr(ans);
    return 0;
}


Measured memory_bytes: 4212
using System;

namespace ABC123
{
    class Program
    {
        static int Main(string[] args)
        {
            Program.ProblemA();
            return 0;
        }

        static void ProblemA()
        {
            int[] input = new int[5];
            string a = Console.ReadLine();
            string b = Console.ReadLine();
            string c = Console.ReadLine();
            string d = Console.ReadLine();
            string e = Console.ReadLine();
            string k = Console.ReadLine();

            input[0] = int.Parse(a);
            input[1] = int.Parse(b);
            input[2] = int.Parse(c);
            input[3] = int.Parse(d);
            input[4] = int.Parse(e);

            string ans = "Yay!";

            for(int i = 0; i<5; i++)
            {
                for(int j = i+1; j < 5; j++)
                {
                    if (input[j] - input[i] > int.Parse(k))
                    {
                        ans = ":(";
                    }
                }
            }

            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 11092
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "iomanip"

using namespace std;

const long long int MOD = 1000000007;

long long int N, M, K, H, W, L, R;


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

	cin >> N;
	while (N) {
		vector<char>box(N);
		for (int i = 0; i < N; i++) {
			cin >> box[i];
		}
		vector<int>score(26);
		bool tie = true;
		for (int i = 0; i < N; i++) {
			score[box[i] - 'A']++;
			int bag = 0;
			for (int j = 0; j < 26; j++) {
				if (score[bag] < score[j]) {
					bag = j;
				}
			}
			int fig = !bag;
			for (int j = 0; j < 26; j++) {
				if (j == bag) {
					continue;
				}
				if (score[fig] < score[j]) {
					fig = j;
				}
			}
			if (score[fig] + N - i - 1 < score[bag] ) {
				cout << char(bag + 'A') << " " << i + 1 << endl;
				tie = false;
				break;
			}
		}
		if (tie) {
			cout << "TIE\n";
		}
		cin >> N;
	}

	return 0;
}

Measured memory_bytes: 3180
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
#define ll long long
char s[10];
map<char,int>m;
void slove()
{
    scanf("%s" ,s + 1);
    for (int i = 1; i <= 4; ++ i)
        m[s[i]] ++;
    int ct = 0;
    for (char x = 'A'; x <= 'Z'; ++ x)
    {
        if (m[x] == 2) ct ++;
    }
    if (ct == 2) puts("Yes");
    else puts("No");
    return ;
}
signed main()
{
    slove();
    return 0;
}


Measured memory_bytes: 256
//
// Created by kuroneko on 2019-07-06.
//

#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <iomanip>

typedef long long ll;
using namespace std;

ll GCD(ll a, ll b) {
    if (a < b) swap(a, b);
    if (b == 0) return a;
    return GCD(b, a%b);
}

int LCM(int a, int b) {
    int g = GCD(a, b);
    return a / g * b;
}

int main() {
    int N; cin >> N;
    vector<ll> A(N);
    int L[100000+7], R[100000+7];
    for (int i = 0; i < N; i++) cin >> A[i];

    L[0] = 0;
    R[N] = 0;
    L[1] = 0;
    R[N-1] = 0;
    for (int i = 1; i < N; i++) {
        L[i+1] = GCD(L[i], A[i-1]);
        R[N-i] = GCD(R[N-i+1], A[N-i]);
    }

    ll ans = 0;
    for (int i = 1; i <= N; i++) {
        ans = max(ans, GCD(L[i], R[i]));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()
template <class T> inline bool chmin(T &a, T b) {if (a > b){a = b;return true;}return false;}
template <class T> inline bool chmax(T &a, T b) {if (a < b){a = b;return true;}return false;}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string n;cin>>n;
    string ans = "No";
    rep(i,3){
        if(n[i]=='7') ans = "Yes";
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3656
#include<iostream>
#include<string>
#include<vector>
#include<unordered_map>
#include<algorithm>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<cstdlib>
using namespace std;

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

typedef long long ll;

int main() {
	
	string s;
	cin >> s;

	ll ans=0;

	REP(bit, 1 << (s.size() - 1)) {
		ll tmpans = 0;
		ll tmp = stoi(s.substr(0,1));

		FOR(i, 0, s.size() - 1) {
			if (bit & 1 << i) {
				tmpans += tmp;
				tmp = 0;
			}
			tmp = tmp * 10 + stoi(s.substr(i + 1, 1));
		}
		tmpans += tmp;

		ans += tmpans;

	}

	cout << ans << endl;

	//小数点以下の桁数表示;
	//cout << fixed << setprecision(15);

	return 0;
}

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

typedef long long ll;
typedef pair<int,int> pii;

long long MOD = 1000000000 + 7;
long long MAX = 1000000000000000000;

int main(){
  cout << setprecision(10);
  int N,M,R;
  cin >> N >> M >> R;

  vector<int> r(R);
  for(int i = 0; i < R; i++){
    cin >> r[i];
    r[i]--;
  }
  sort(r.begin(), r.end());


  vector<vector<int>> v(N);
  vector<vector<ll>> len(N, vector<ll>(N, MAX));

  for(int i = 0; i < M; i++){
    int tmp1, tmp2;
    ll C;
    cin >> tmp1 >> tmp2 >> C;
    tmp1--; tmp2--;
    v.at(tmp1).push_back(tmp2);
    v.at(tmp2).push_back(tmp1);
    len[tmp1][tmp2] = C;
    len[tmp2][tmp1] = C;
  }
  // ワーシャルフロイド

  for(int k = 0; k < N; k++){
    for(int i = 0; i < N; i++){
      for(int j = 0; j < N; j++){
        len[i][j] = min(len[i][j], len[i][k] + len[k][j]);
        len[j][i] = min(len[j][i], len[k][i] + len[j][k]);
      }
    }
  }

  auto dist = [&len](int x, int y){
    if(x > y){
      return len[y][x];
    }
    return len[x][y];
  };

  ll ans = MAX;
  do{
    ll tmp = 0;
    for(int i = 1; i < r.size(); i++){
      tmp += dist(r[i-1], r[i]);
    }
    ans = min(ans, tmp);

  } while(next_permutation(r.begin(), r.end()));

  cout << ans << endl;

}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
int main () {
  int n;
  cin >> n;
  vector<int> a(n);
  for ( int i = 0; i < n; i++) {
    cin >> a.at(i);
  }

  vector<int> ans(n);
  //string ans;
  int tmp;
  for ( int i = 0; i < n; i ++) {
    tmp = a.at(i);
    ans.at(tmp-1) = i+1;
  }

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


Measured memory_bytes: 1664
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = Integer.parseInt(sc.next());
        int B = Integer.parseInt(sc.next());

      	if (A > B) {
          System.out.println(A * 2 - 1);
        } else if (A == B) {
          System.out.println(A * 2);
        } else {
          System.out.println(B * 2 - 1);
        }
    }
}


Measured memory_bytes: 23764
import java.util.ArrayList;
import java.util.List;
import java.util.NavigableMap;
import java.util.Scanner;


public class Main {
    static int sum = 0;
    static void solve() {
        Scanner scan = new Scanner(System.in);

        int n = scan.nextInt();
        int d = scan.nextInt();
        int cnt = 0;
        for (int i = 0; i < n; i++) {
            long x = scan.nextInt();
            long y = scan.nextInt();

            double res = Math.sqrt(x*x + y*y);
            if(res <= d) {
                cnt++;
            }
        }
        System.out.println(cnt);

//        int t = scan.nextInt();
//        for (int i = 0; i < t; i++) {
//            int n = scan.nextInt();
//            int[] arr1 = new int[n];
//            for (int j = 0; j < n; j++) {
//                arr1[j] = scan.nextInt();
//            }
////            scase(n, arr1);
//        }


//        long t = scan.nextLong();

//        for (int i = 0; i < t; i++) {
//            int n = scan.nextInt();
////            scase(n);
//        }
    }


    static void solveCase(int t, int x, String s) {

    }

    static void scase(int[] arr1, int[] arr2) {
    }



    public static void main(String[] args)  {
        solve();
    }


    static class TreeNode {
        int val;
        TreeNode left;
        TreeNode right;

        TreeNode(int x) {
            val = x;
        }
    }

    static class ListNode {
        int val;
        ListNode next;

        ListNode() {
        }

        ListNode(int val) {
            this.val = val;
        }

        ListNode(int val, ListNode next) {
            this.val = val;
            this.next = next;
        }
    }
}

Measured memory_bytes: 49188
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
ll LGCD(ll x, ll y) {if (x % y == 0) return y;else return LGCD(y, x % y);}
int main() {
	ll x, y;
	cin >> x>> y;
	int z;
	if (x < y) {
		z = x;
		x = y;
		y = z;
	}
	cout<<LGCD(x, y) << endl;;
	return 0;
}


Measured memory_bytes: 3100
def A():
    r = int(input())
    contest = ['ABC','ARC','AGC']
    index = 0
    if r < 1200:
        index = 0
    elif r >= 1200 and r < 2800:
        index = 1
    else:
        index = 2
    print(contest[index])
    

if __name__ =='__main__':
    A()

Measured memory_bytes: 2940
#include <iostream>
#include <cstdio>

using namespace std;

int main()
{
	int x, y;

	while (1) {
		scanf("%d%d", &x, &y);
		if (x == 0 && y == 0) break;
		if (x > y) swap(x, y);
			printf("%d %d\n", x, y);
	}

	return (0);
}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
using namespace std;
const int MX = 1'000'000 + 1;

int main() {
  int n;
  cin >> n;
  vector<int> a(n), p(MX);
  for (int &i : a) {
    cin >> i;
    p[i]++;
  }
  int flg = 1;
  for (int i = 2; i < MX; i++) {
    int cnt = 0;
    for (int j = i; j < MX; j += i) cnt += p[j];
    if (cnt > 1) {
      flg = 0;
      break;
    }
  }
  if (flg) {
    cout << "pairwise coprime" << endl;
    return 0;
  }
  int g = 0;
  for (int i = 0; i < n; i++) g = gcd(g, a[i]);
  if (g == 1) {
    cout << "setwise coprime" << endl;
    return 0;
  }
  cout << "not coprime" << endl;
  return 0;
}

Measured memory_bytes: 11160
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
#include <functional>
#include <random>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vvvl> vvvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vvb> vvvb;
typedef vector<vvvb> vvvvb;
typedef vector<string> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<ll, ll> PL;
typedef vector<PL> vpl;
typedef vector<vector<PL>> vvpl;
typedef vector<vvpl> vvvpl;
const int INF = 1001001001;
const ll LINF = 1e17;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define RFOR(i, a, b) for(ll i = (a); i > b; i--)
#define rep(i, n) for(ll i = 0; i < n; i++)
#define rrep(i, n) for(ll i = n-1; i > -1; i--)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back
#define epb emplace_back
#define ALL(X) (X).begin(),(X).end()

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    sort(ALL(vec));
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}

inline ll popcnt(ll x){return __builtin_popcountll((unsigned long long)x);};
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
//friend bool operator<(const stc& lhs, const stc& rhs){
//    return std::tie(lhs.l, lhs.r) < std::tie(rhs.l, rhs.r);
//}



int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ll K, T; cin >> K >> T;
    vl A(T); rep(i, T) cin >> A[i];
    sort(ALL(A));
    ll sum = 0;
    rep(i, T-1) sum += A[i];
    ll ans = A.back() > sum ? A.back()-1-sum : 0;
    cout << ans << endstr;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll int64_t
#define ul unsigned long long int
#define vi vector<int>
#define vl vector<int64_t>
#define all(x) x.begin(),x.end()
#define pb push_back
#define fo(x,a,b) for(int x=a; x<b; x++)
#define rfo(x,a,b) for(int x=a; x>=b; x--)
#define fi first
#define sec second
#define mp make_pair
int sgn(int x) { return x>0 ? 1 : ( x<0 ? -1 : 0); }
typedef pair<int,int> pairs;
double pi = 3.14159265358979323846;
ll mod = 1000000007;

void solve()
{
    string s;
    cin>>s;
    int ans=0,len=0,n=s.size();
    fo(i,0,n)
    {
        if(s[i]=='R') len++;
        else len=0;
        ans=max(ans,len);
    }
    cout<<ans;
    cout<<"\n";
    return;
}
int main()
{
#ifdef _DEBUG
    freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll t;
    //cin>>t;
    //while(t--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3604
W,H,m,c[10][11];
DP[11][10][10][10][51];//cà[yÀW][xÀW][¶[][E[][_fcÊ]
#define Update(tgt,val) ((val)>(tgt)?tgt=(val):0)
CalcO(o,x,y){//_fcÊÌvZ
	if(c[x][y]>0){
		o+=c[x][y];
		if(o>m)
			o=m;
	}
	return o;
}
CalcF(f,x,y){//càÌvZ
	if(c[x][y]<0)
		f+=c[x][y];
	return f;
}
main(){
	int x,y,range,d,dx,f,o,xl,xr,fn,on,f0;
	for(;scanf("%d%d",&W,&H),W;){
		scanf("%d%d%d",&f0,&m,&o);
		for(y=1;y<=H;y++)
			for(x=0;x<W;x++)
				scanf("%d",&c[x][y]);
		f0++;//cà0ÅàDPÍ1ÆµÄANAÉÈéÌðh®
#if 1
		if(o>1){
			for(y=0,x=0;x<W;x++){
				fn=CalcF(f0,x,y+1);
				on=CalcO(o-1,x,y+1);
				Update(DP[y+1][x][x][x][on],fn);
			}
		}
#else
		for(y=0,x=0;x<W;x++)
			DP[y][x][x][x][o]=f0;
		y=0;
		for(x=0;x<W;x++){
			for(o=m;o>1;o--){
				if(f=DP[y][x][x][x][o]){
					//ºÖ@é
					fn=CalcF(f,x,y+1);
					on=CalcO(o-1,x,y+1);
					Update(DP[y+1][x][x][x][on],fn);
				}
			}//o
		}//x
#endif
		for(y=1;y<H;y++){
			for(range=0;range<W;range++){//¶EÉ@éL³
				for(o=m;o>1;o--){
					for(d=0;d<2;d++){//»ÝÊuxð³¹é
						for(xl=0;xl<W-range;xl++){//¶[
							for(dx=0;dx<=range;dx++){//xÏÊ
								xr=xl+range;
								x=d?xl+dx:xr-dx;
								if(f=DP[y][x][xl][xr][o]){
									//ºÖ@é
									fn=CalcF(f,x,y+1);
									on=CalcO(o-1,x,y+1);
									Update(DP[y+1][x][x][x][on],fn);
									if(y>0){
										if(x>0){
											if(x==xl){//¶Ö@é
												fn=CalcF(f,x-1,y);
												on=CalcO(o-1,x-1,y);
												Update(DP[y][x-1][x-1][xr][on],fn);
											}else{//¶ÖiÞ
												Update(DP[y][x-1][xl][xr][o-1],f);
											}
										}
										if(x<W-1){
											if(x==xr){//EÖ@é
												fn=CalcF(f,x+1,y);
												on=CalcO(o-1,x+1,y);
												Update(DP[y][x+1][xl][x+1][on],fn);
											}else{//EÖiÞ
												Update(DP[y][x+1][xl][xr][o-1],f);
											}
										}
									}
								}
							}//dx
						}//xl
					}//d
				}//o
			}//range
		}//y
		fn=0;
		for(x=0;x<W;x++){
			for(o=m;o>0;o--){
				f=DP[H][x][x][x][o];
				if(f>fn)
					fn=f;
			}
		}
		printf(fn?"%d\n":"NA\n",f0-fn);
		memset(DP,0,sizeof(DP));
	}
	//puts("");
	exit(0);
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
int main(){
   int n,l; cin>>n>>l;
   vector<string>v;
   string str;
   for(int i=0;i<n;i++){ cin>>str;
    v.push_back(str);
   }
   sort(v.begin(),v.end());
   str="";
   for(int i=0;i<n;i++)str=str+v[i];
   cout<<str;
}


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

using namespace std;

int main() {
	vector<int> furui(10005, 0);
	furui[0] = furui[1] = 1;
	for (int i = 2; i*i < 10005; i++) {
		if (furui[i] == 0) {
			for (int j = 2; i*j < 10005; j++) {
				furui[i*j] = 1;
			}
		}
	}
	int a;
	while (cin >> a) {
		int counter = 0;
		for (int i = 1; i <= a; i++) {
			if (furui[i] == 0) {
				if (furui[a+1-i] == 0) {
					counter++;
				}
			}
		}
		cout << counter << endl;
	}
	return 0;
}

Measured memory_bytes: 1232
n = int(input())
li = [list(map(lambda x:int(x),input().split())) for i in range(n)]
ok = True
for i in range(n-1):
    mo = (li[i+1][2] - li[i][2]) + (li[i+1][1] - li[i][1])
    ti = li[i+1][0] - li[i][0]
    if (mo%2)!=(ti%2) or mo>ti or (mo != 0 and ti == 0):
        ok = False
mo = (li[0][2] - 0) + (li[0][1] - 0)
ti = li[0][0] -0
if (mo%2)!=(ti%2) or mo>ti or (mo != 0 and ti == 0):
    ok = False
if ok :
    print("Yes")
else :
    print("No")

Measured memory_bytes: 27304
#[allow(unused_macros)]
macro_rules! input {
    ( $($t:ty),* ) => {{
        let mut s = String::new();
        std::io::stdin().read_line(&mut s);
        let mut splits = s.trim().split_whitespace();
        ($( { splits.next().unwrap().parse::<$t>().unwrap() },)*)
    }}
}

#[allow(unused_macros)]
macro_rules! invec {
    ( $ t : ty ) => {{
        let mut s = String::new();
        match std::io::stdin().read_line(&mut s) {
            Ok(0) => Vec::<$t>::new(),
            Ok(n) => s
                .trim()
                .split_whitespace()
                .map(|s| s.parse::<$t>().unwrap())
                .collect::<Vec<$t>>(),
            Err(_) => Vec::<$t>::new(),
        }
    }};
}

#[allow(dead_code)]
fn lis<T: Ord + Copy>(v: &Vec<T>) -> usize {
    let mut seq = vec![];
    fn push<T: Ord>(seq: &mut Vec<T>, pos: usize, val: T) {
        if seq.len() <= pos {
            seq.push(val);
        } else {
            let mut v = vec![];
            v.push(val);
            *seq = v;
        }
    }
    for val in v {
        if let Err(pos) = seq.binary_search(val) {
            push(&mut seq, pos, *val);
        }
    }
    return seq.len();
}

#[allow(dead_code)]
fn lds<T: Ord + Copy>(v: &Vec<T>) -> usize {
    let mut rev = v.clone();
    rev.reverse();
    return lis(&rev);
}

#[allow(unused_must_use)]
#[allow(unused_variables)]
fn solve() {
    let (n,) = input!(usize);
    let hs = invec!(u32);

    let mut current = hs[0];
    let mut count = 0;
    let mut max = 0;
    for &h in &hs[1..] {
        if h <= current {
            count += 1;
            max = std::cmp::max(count, max);
        } else {
            count = 0;
        }
        current = h;
    }

    println!("{}", max);
}

fn main() {
    solve();
}


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

#define pb push_back
#define F first
#define S second
#define fo(i,a,b)  for(int i = a; i < b; i++)

using ll = long long;
using ld = long double;
using ul = unsigned long long;
using ii = pair<int, int>;
#define Mosta     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ReadFile            freopen("input.in","r",stdin)
#define WriteFile           freopen("output.txt","w",stdout)
const ll mod7 = 1000000007,mod = 1000000000,OO = 0x3f3f3f3f;
const ld EPS = 1e-7;
double Pi=acos(-1);
const ld rad=Pi/180.0;
ll power(ll x, ll y, ll p)
{
    ll res = 1;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
ll nCr (ll n,ll m)
{
        return(m == 0)?1:n*nCr(n-1,m-1)/m;
}
/*****************************************************/

int main()
{
    int n;
    cin >> n;
    int a[n];
    ll ans = 0 , x = 0;
    for(int i = 1; i <= n; ++i)
        cin >> a[i];

    for(int i = 1; i <= n-1; ++i){
        if(a[i] >= a[i+1]){
            x++;
        }else{
            ans = max(ans , x);
            x = 0;
        }
    }
    if(x >= 1)
        ans = max(ans , x);
    cout << ans << "\n";

    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define pb push_back
#define all(v) (v).begin() , (v).end()
#define popcnt(x) __builtin_popcount(x)
#define inf 0x3f3f3f3f
#define watch(x) cout << (#x) << " is " << (x) << endl
#define rand() (rand() << 15 | rand())
using namespace std;
using namespace __gnu_pbds;

template<typename T>
using ordered_set =
tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long  ll;
#define EPS 1e-9
#define PI acos(-1.0)

int main() {
#ifndef ONLINE_JUDGE
#endif
   ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
   for(int i = 0 ; i < 5 ; ++i){
      int x;
      cin >> x;
      if(x == 0)
         cout << i + 1 << "\n";
   }
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define SZ(a) (int)((a).size())
using namespace std;
typedef long long ll;
typedef double db;
typedef pair <int, int> Pii;
typedef pair <ll, int> Pli;
typedef unsigned long long ull;
const double eps = 1e-8;
const ll infll = 0x7fffffffffffffff;
const int mod = (int)(1e9) + 7;
const int inf = 0x7fffffff;
const int maxn = (int)(2e5) + 7;
const int maxm = 300;

int a;

int main() {

	scanf("%d", &a);
	printf("%d\n", a + a * a + a * a * a);

	return 0;
}

Measured memory_bytes: 3824
import java.io.BufferedReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.TreeMap;

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

	public static void main(String[] args) throws Exception {
		int n = sc.nextInt();
		map = undirected(n);
		long[] ans = dfs(1, -1);
		System.out.println( (ans[0] + ans[1] ) %mod);
	}

	static long mod = 1000000007;
	static TreeMap<Integer, ArrayList<Integer>> map;

	public static long[] dfs(int cur, int par) {
		if (map.get(cur).size() == 0) {

			long[] ans = { 1, 1 };
			return ans;
		}

		long[] ans = { 1, 1 };
		for (int nbr : map.get(cur)) {
			if (nbr == par)
				continue;
			long[] temp = dfs(nbr, cur);
			long w = (temp[0] + temp[1])%mod;
			long b = temp[0]%mod;
			ans[0] = (ans[0] *  w )%mod;
			ans[1] = (ans[1] *b)%mod;
		}

		// System.out.println(ans[0]+" "+ans[1]);

		return ans;
	}

	public static TreeMap<Integer, ArrayList<Integer>> undirected(int n) throws Exception {
		TreeMap<Integer, ArrayList<Integer>> map = new TreeMap<>();
		for (int i = 1; i <= n; i++)
			map.put(i, new ArrayList<Integer>());
		for (int i = 1; i < n; i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			map.get(a).add(b);
			map.get(b).add(a);
		}
		return map;
	}

	public static long[] input(int n) throws Exception {

		long[] arr = new long[n];
		for (int i = 0; i < n; i++) {
			arr[i] = sc.nextLong();
		}
		return arr;
	}

	public static int[][] input(int n, int m) throws Exception {

		int[][] arr = new int[n][m];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {

				arr[i][j] = sc.nextInt();
			}
		}
		return arr;
	}

}


Measured memory_bytes: 89784
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;

int d[15],k;
bool check(int n) {
	while(n>0) {
		int c = n%10;
		for(int i=0;i<k;i++) {
			if(c==d[i]) return false;
		}
		n/=10;
	}
	return true;
}

int main(){
	int n;
	scanf("%d%d",&n,&k);
	for(int i=0;i<k;i++) scanf("%d",&d[i]);
	for(int i=n;i>0;i++) {
		if(check(n)){
			printf("%d\n",n);
			break;
		}else {
			n++;
		}
		
	}
} 

Measured memory_bytes: 256
from sys import stdin
import collections

# コンテスト外回答

n = int(stdin.readline())
v = [int(x) for x in stdin.readline().rstrip().split()]

# [【Python】 リストから一つおきにデータを取り出す \- 旅行好きなソフトエンジニアの備忘録](http://ni4muraano.hatenablog.com/entry/2017/07/16/212133)
# [start:stop:step]
v1 = v[0::2]
v2 = v[1::2]

tmp = len(v1) - len(v2)

v_c = collections.Counter(v)
v1_c = collections.Counter(v1)
v2_c = collections.Counter(v2)

if v1_c.most_common()[0][0] == v2_c.most_common()[0][0]:

    if len(v) == (v_c.most_common()[0][1]):
        ans = len(v) // 2

    else:
        ansA = len(v1) - v1_c.most_common()[0][1] + \
            len(v2) - v2_c.most_common()[1][1]

        ansB = len(v1) - v1_c.most_common()[1][1] + \
            len(v2) - v2_c.most_common()[0][1]

        ans = min(ansA, ansB)

else:
    ans = len(v1) - v1_c.most_common()[0][1] + \
        len(v2) - v2_c.most_common()[0][1]

print(ans)


Measured memory_bytes: 26716
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>
#define o 1000005
#define re register int
#define ll long long
#define g0(a) memset(a,0,sizeof(a))
#define gc(a,b) memcpy(a,b,sizeof(a))
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define REP(i,a,b) for(int i=a;i>=b;i--)
#define pa pair<int,int>
#define mpp make_pair
#define s1 first
#define s2 second
#define go(x) for(ll i=h[x];i;i=w[i].next)
using namespace std;
inline int read()
{
	register int data=0,w=1;
	char ch=0;
	while(ch!='-'&&(ch<'0'||ch>'9'))ch=getchar();
	if(ch=='-')w=-1,ch=getchar();
	while(ch>='0'&&ch<='9')data=(data<<1)+(data<<3)+(ch^48),ch=getchar();
	return data*w;
}
int n,a[o],Q,f[3005][3005];
const int mod=1e9+7,iv=(mod+1)>>1;
void fix(int x){
	x-=mod;x+=x>>31&mod;
}
int main()
{
	n=read();Q=read();
	FOR(i,1,n)a[i]=read();
	FOR(i,1,n)FOR(j,1,n)if(a[i]>a[j])f[i][j]=1;
	int s=1;
	while(Q--)
	{
		s=1ll*s*2%mod; 
		int x=read(),y=read();
		FOR(i,1,n)
		{
			if(i==x||i==y)continue;
			f[x][i]=f[y][i]=1ll*(f[x][i]+f[y][i])*iv%mod;
			f[i][x]=f[i][y]=1ll*(f[i][x]+f[i][y])*iv%mod;
		}
		f[x][y]=f[y][x]=1ll*(f[x][y]+f[y][x])*iv%mod;
	}
	int ans=0;
	FOR(i,1,n)FOR(j,i+1,n)ans=(ans+f[i][j])%mod;
	cout<<1ll*ans*s%mod<<'\n'; 
	return 0;
}

Measured memory_bytes: 38840
import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.IntStream;

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

  public static void main(String[] args) {
    new Main().run();
  }

  void run() {
    System.out.println(IntStream.rangeClosed(1, ni()).reduce(0, (a, b) -> a + b));
  }

  int ni() {
    return Integer.parseInt(sc.next());
  }

  void debug(Object... os) {
    System.err.println(Arrays.deepToString(os));
  }
}

Measured memory_bytes: 15940
h, w = map(int, input().split())
a = []
c = 0
for i in range(h):
    b = list(input())
    if "#" in b:
        a.append(b)
        c += 1
d = []
for i in range(w):
    e = []
    for j in range(c):
        e.append(a[j][i])
    else:
        d.append(e)
f = []
g = 0
for i in range(w):
    if "#" in d[i]:
        f.append(d[i])
        g += 1
h = []
for i in range(c):
    e = []
    for j in range(g):
        e.append(f[j][i])
    else:
        h.append(e)
for i in range(c):
    print(*h[i], sep="")

Measured memory_bytes: 4724
import sys
L, R = map(int,input().split())

new_list = []
for i in range(L,R):
    for j in range(i+1, R+1):
        new_list.append((i*j)%2019)
        
        if (i*j)%2019 == 0:
            print(0)
            sys.exit()
print(min(new_list))

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

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

vector<int> m[2];

void dfs(int node, vector<int> E[], int d, set<int>& open) {
    open.insert(node);
    m[d % 2].pb(node);

    REP(i, E[node].size()) {
        int next = E[node][i];
        if (open.count(next) > 0) continue;
        dfs(next, E, d + 1, open);
    }
}


int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    int N;
    cin >> N;

    vector<int> E[N];
    REP(i, N-1) {
        int a, b;
        cin >> a >> b;
        --a; --b;

        E[a].pb(b);
        E[b].pb(a);
    }

    REP(i, 2) m[i] = {};

    set<int> open = {};
    dfs(0, E, 0, open);


    vector<int> S(N);

    queue<int> q[3];
    FOR(i, 1, N+1) {
        q[i % 3].push(i);
    }

    if (m[0].size() <= q[0].size()) {
        REP(i, m[0].size()) {
            int k = m[0][i];
            S[k] = q[0].front();
            q[0].pop();
        }

        REP(i, m[1].size()) {
            int k = m[1][i];

            REP(j, 3) {
                if (!q[j].empty()) {
                    S[k] = q[j].front();
                    q[j].pop();
                    break;
                }
            }
        }
    } else if (m[1].size() <= q[0].size()) {
        REP(i, m[1].size()) {
            int k = m[1][i];
            S[k] = q[0].front();
            q[0].pop();
        }

        REP(i, m[0].size()) {
            int k = m[0][i];

            REP(j, 3) {
                if (!q[j].empty()) {
                    S[k] = q[j].front();
                    q[j].pop();
                    break;
                }
            }
        }
    } else {
        REP(i, m[0].size()) {
            int k = m[0][i];
            int a = 1;
            if(q[a].empty()) a = 0;

            S[k] = q[a].front();
            q[a].pop();
        }

        REP(i, m[1].size()) {
            int k = m[1][i];
            int a = 2;
            if (q[a].empty()) a = 0;

            S[k] = q[a].front();
            q[a].pop();
        }
    }

    REP(i, N) {
        if (i > 0) cout << " ";
        cout << S[i];
    }
    cout << endl;
}


Measured memory_bytes: 28144
#include<stdio.h>

int main(){
  int x,y,temp,d,*xi,*yj,*cd,i,j;

  scanf("%d%d",&x,&y);

  if(x<y){
    temp=y;
    y=x;
    x=temp;

  }
  d=x%y;
  while(d!=0){
    x=y;
    y=d;
    d=x%y;
  }

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

  return 0;

 }



Measured memory_bytes: 2144
//
// Created by watemus on 24.06.2020.
//

#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
#define FF first
#define SS second

using ll = long long;
using ld = long double;

template<typename T>
using vec = vector<T>;

template<typename T>
using uset = unordered_set<T>;

template<typename T1, typename T2>
using umap = unordered_map<T1, T2>;

#define int ll

constexpr ll INFL = 1'000'000'000'000'000'228;
constexpr int INFI = 1'000'000'228;
const ld PI = acos(-1);
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

vector<pair<int, int>> DD = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};

#ifdef LOCAL
#else
#endif

void run() {
    int legs, animals;
    cin >> animals >> legs;
    for (int i = 0; i < 1000; i++) {
        for (int j = 0; j < 1000; j++) {
            if (i * 2 + j * 4 == legs && i + j == animals) {
                cout << "Yes\n";
                return;
            }
        }
    }
    cout << "No\n";
}
/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
*/

signed main() {
#ifdef LOCAL
    std::freopen("input.txt", "r", stdin);
#else
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
#endif
    cout << fixed << setprecision(20);
    int t = 1;
//    cin >> t;
    while (t--) {
        run();
    }
    return 0;
}



Measured memory_bytes: 3560
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
//#include <math.h>
#include <algorithm>
#include <vector>
#pragma warning(disable:4996)

typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define MOD 1000000007
using namespace std;

typedef vector<vector<ll> > MAT;

long n;

MAT mult( const MAT& a, const MAT& b )
{
    MAT c(n, vector<ll>(n,0));
    long i, j, m;
    for(i=0; i<n; i++) {
        for(j=0; j<n; j++) {
            for(m=0; m<n; m++) {
                c[i][j] = (c[i][j] + a[i][m]*b[m][j] ) %MOD;
            }
        }
    }
    return c;
}

MAT pow0( MAT a, ll k )
{
    MAT ans(n, vector<ll>(n,0));
    long i;
    for(i=0; i<n; i++) {
        ans[i][i]=1;
    }
    while(k>0) {
        if(k & 1) {
            ans = mult( ans, a );
        }
        a = mult(a, a);
        k=k>>1;
    }
    return ans;
}

int main(int argc, char* argv[])
{
    ll k;
    scanf("%ld %lld", &n, &k );
    
    MAT a(n, vector<ll>(n,0));
    long i, j;
    for(i=0; i<n; i++) {
        for(j=0; j<n; j++) {
            scanf("%lld", &(a[i][j]));
        }
    }

    a = pow0( a, k );

    ll sum = 0;
    for(i=0; i<n; i++) {
        for(j=0; j<n; j++) {
            sum = (sum + a[i][j]) %MOD;
        }
    }

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

    return 0;
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner in = new Scanner(System.in)) {
			int h = in.nextInt();
			int w = in.nextInt();
			int n = in.nextInt();
			int sr = in.nextInt() - 1;
			int sc = in.nextInt() - 1;
			String s = in.next();
			String t = in.next();
			
			boolean ret = true;
			int ll = sc;
			int rr = sc;
			int uu = sr;
			int dd = sr;
			for (int i = 0; i < n; i++) {
				char ss = s.charAt(i);
				char tt = t.charAt(i);
				
				switch (ss) {
				case 'L':
					ll--;
					if (ll < 0) {
						ret = false;
						break;
					}
					break;
				case 'R':
					rr++;
					if (rr >= w) {
						ret = false;
						break;
					}
					break;
				case 'U':
					uu--;
					if (uu < 0) {
						ret = false;
						break;
					}
					break;
				case 'D':
					dd++;
					if (dd >= h) {
						ret = false;
						break;
					}
					break;
				}
				
				switch (tt) {
				case 'L':
					if (rr > 0) {
						rr--;
					}
					break;
				case 'R':
					if (ll < w - 1) {
						ll++;
					}
					break;
				case 'U':
					if (dd > 0) {
						dd--;
					}
					break;
				case 'D':
					if (uu < h - 1) {
						uu++;
					}
					break;
				}
			}

			System.out.println(ret ? "YES" : "NO");
		}
	}

}


Measured memory_bytes: 28248
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC167_B
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] arr = Console.ReadLine()
                .Split(' ')
                .Select(str => int.Parse(str))
                .ToArray();

            int A = arr[0];
            int B = arr[1];
            int C = arr[2];
            int K = arr[3];

            if (K <= A)
            {
                Console.WriteLine(K);
            }
            else if (A < K && K <= A + B)
            {
                Console.WriteLine(A);
            }
            else if (A + B < K && K <= A + B + C) {
                Console.WriteLine(A - (K - (A + B)));
            }
            Console.ReadLine();
        }

    }
}

Measured memory_bytes: 28312