akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n));
#define Vec(a,n) vector<string> (a)((n));
#define twovec(a,n,m) vector<vector<int>> a(n,vector<int>(m,0));
#define Twovec(a,n,m) vector<vector<double>> a(n,vector<double>(m,0));
#define P pair<int,int>
#define All(a) (a).begin(),(a).end()
#define Sort(a) sort(All(a));
#define Reverse(a) reverse(All(a));
#define PQ(n) priority_queue<P,vector<P>,greater<P>> (n)
#define pq(n) priority_queue<int> (n)
#define print(a) cout << (a) << endl
#define printD(a) cout << setprecision(15) << (a) << endl;
using namespace std;
int max_int = 2147483647;
int prime = 998244353;
void Debug(auto a);
double PI = 3.14159265358979;
void input(vector<auto>& a,int n);
int n;


signed main(){
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    cin >> n;
    vec(a,n);
    input(a,n);
    int ans = 0;
    REP(i,n){
        FOR(j,i+1,n){
            ans += a[i]*a[j];
        }
    }
    print(ans);



    return 0;
}

void Debug(auto a){
    cout << "{ ";
    for(auto b: a){
        cout << b << " ";
    }
    cout << "}" << endl;
}

void input(vector<auto>& a,int n){
    REP(i,n){
        cin >> a[i];
    }
}


Measured memory_bytes: 3616
/*==============================================*\
Codeforces ID:    mdshihab
                                                  |
Name:     Md. Shihabul Minhaz                     |
Study:      CSE, JKKNIU                           |
Address:  Trishal, Mymensingh, Bangladesh         |
                                                  |
 mail:   mdshihabul20171@gmail.com                |
 FB  :   fb.com/mdshihabul.minhaz.7               |
 github: Shihabulminhaz                           |
stopstalk :  mdshihab                             |
                                                  |
@uthor   Md. Shihabul Minhaz (shihab)             |
\*===============================================*/


#include<bits/stdc++.h>
using namespace std;
#define fi(a) scanf("%d",&a);
#define fli(a) scanf("%ld",&a);
#define fll(a) scanf("%lld",&a);
#define pi(a) printf("%d\n",a);
#define ppi(i,a) printf("Case %d: %d\n",i,a);
#define ll long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
void FI()
{
#ifndef ONLINE_JUDGE
    freopen("C:\\Users\\SHIHAB\\Desktop\\input.in","r",stdin);
#endif // ONLINE_JUDGE
}

int main()
{
    fast
    //FI(); /// skip this line for compile
    int t,n,x=0;
    cin >> n;
    while(x<n){
        x+=1000;
    }
    cout << abs(x-n) << endl;
    return 0;
}



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

int a[100005];
int dp[100005];

int f(int i, int n) {
    if(dp[i] != -1) return dp[i];
    if(i == n-1) return 0;
    
    int x = abs(a[i] - a[i+1]) + f(i+1, n);
    int b;
    if(i < n-2)
        b = abs(a[i] - a[i+2]) + f(i+2, n);
    else b = INT_MAX;
    
    return dp[i] = min(x, b);
}


int main() {
	// your code goes here
	int n;
	cin >> n;
	memset(dp, -1, sizeof dp);
	for(int i = 0; i < n; i++) {
	    cin >> a[i];
	}
	cout << f(0, n);
	return 0;
}


Measured memory_bytes: 5760
#include<iostream>
#include<cstdio>
#include<string.h>
#include<vector>
#include<queue>
#include<map>
using namespace std;

#define ll long long
void read(__int128 &x)
{
    x = 0;
    char ch;
    int flag = 1;
    while ((ch = getchar()))
    {
        if (ch == '-') flag = -1;
        if (ch >= '0' && ch <= '9') break;
    }
    x = ch - '0';
    while ((ch = getchar()) >= '0' && ch <= '9')
    {
        x = x * 10 + ch - '0';
    }
    x *= flag;
}

void out(__int128 x)
{
    if (x < 0)
    {
        x = -x;
        putchar('-');
    }
    if (x >= 10) out(x / 10);
    putchar(x % 10 + '0');
}
ll sum[1000005];
const ll mod = 1000000007;

ll quick(ll a, ll b)
{
    ll ans = 1;
    while(b)
    {
        if(b & 1)
            ans = (ans * a) % mod;
        b >>= 1;
        a = (a * a) % mod;
    }
    return ans;
}
int main()
{
    string s;
    cin >> s;
    string s1 = "ABC";
    string s2 = "ARC";
    if(s == s1)
        cout << s2 << endl;
    else
        cout << s1 << endl;

}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <functional>
#include <queue>
#include <map>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
const int INF = 100000000;
const int mod = 1000000007;

int main(){
    int n, k;
    cin >> n >> k;
    vector<vector<ll>> v(n+1, vector<ll>(n+1, 0));
    for(int i = 0;i <v.size(); i++){
        v[i][0]=1;
        v[i][i]=1;
    }
    for(int k = 1;k <v.size();k++){
        for(int j = 1;j<k;j++){
            v[k][j]=(v[k-1][j-1]+v[k-1][j])%mod;
        }
    }
    for(int i = 1; i <= k; i++){
        cout << v[n-k+1][i]*v[k-1][i-1]%mod << endl;
    }
}

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

#define M 1046527
#define L 14

char H[M][L];

int getChar(char ch){
  if ( ch == 'A') return 1;
  else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  else if ( ch == 'T') return 4;
  else return 0;
}

/* convert a string into an integer value */
long long getKey(char str[]){
  long long sum = 0, p = 1;
  unsigned int i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}

int h1(int key){ return (key % M); }
int h2(int key){ return 1 + key %( M - 1 ); }

int find(char str[]){
	int key = getKey(str);
	int _h1 = h1(key);
	int _h2 = h2(key);
	int i= 0;
//	printf("== %s -> %d , h1 = %d, h2 = %d\n",str,key,_h1,_h2);
	while(i <= M){
		int h = (_h1 + i * _h2) % M;
		if(strlen(H[h])==0){
//			printf("H[%d] : no value\n",h);
			return -1;
		}else if(strcmp(H[h],str)==0){
//			printf("H[%d] = %s, tgt = %s (hit)\n",h,str,H[h]);
			return h;
		}else{
//			printf("H[%d] = %s, tgt = %s (collision)\n",h,str,H[h]);
		}
		i++;
	}
	return -1;
}

int insert(char str[]){
	int key = getKey(str);
	int _h1 = h1(key);
	int _h2 = h2(key);
	int i= 0;
//	printf("%s -> %d , h1 = %d, h2 = %d\n",str,key,_h1,_h2);
	while(i <= M){
		int h = (_h1 + i * _h2) % M;
		if(strlen(H[h])==0){
//			printf("H[%d] : %s (null) <= insert %s\n",h,H[h],str);
			strcpy(H[h],str);
			return 1;
		}
//		printf("H[%d] : %s (not null) <= could not insert %s\n",h,H[h],str);
		i++;
	}
	return -1;
}

int main(){
    int i, n;
    char str[L], com[9];
    for ( i = 0; i < M; i++ ) H[i][0] = '\0';

    scanf("%d", &n);

    for ( i = 0; i < n; i++ ){
	scanf("%s %s", com, str);

	if ( com[0] == 'i' ){
	    insert(str);
	} else {
	    if (find(str) >= 0){
		printf("yes\n");
	    } else {
		printf("no\n");
	    }
	}
    }

    return 0;
}



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

from fractions import gcd
# from math import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement

N = int(input())
A = [int(input()) for i in range(N)]

c = Counter(A)

ret = 0
for key, item in c.items():
    if item % 2 == 1:
        ret += 1

print(ret)

Measured memory_bytes: 21728
#include <stdio.h>

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }

template <typename T, typename V>
void __print(const pair<T, V> &x) {
    cerr << '{';
    __print(x.first);
    cerr << ',';
    __print(x.second);
    cerr << '}';
}
template <typename T>
void __print(const T &x) {
    int f = 0;
    cerr << '{';
    for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
    cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
    __print(t);
    if (sizeof...(v)) cerr << ", ";
    _print(v...);
}
#ifdef LOCAL
#define debug(x...)               \
    cerr << "[" << #x << "] = ["; \
    _print(x)
#else
#define debug(x...)
#endif

#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)

typedef long long ll;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll A, B, M;
    cin >> A >> B >> M;
    vector<ll> a(A);
    ll a_min = 10000000;

    REP(i, A) {
        cin >> a[i];
        if (a[i] < a_min) a_min = a[i];
    }

    ll b_min = 10000000;
    vector<ll> b(B);
    REP(i, B) {
        cin >> b[i];
        if (b[i] < b_min) b_min = b[i];
    }

    ll ans = a_min + b_min;

    ll used_x = -1;
    ll used_y = -1;
    ll discount = -1;
    REP(i, M) {
        ll x, y, c;
        cin >> x >> y >> c;
        if (a[x-1] + b[y-1] - c < ans) {
            ans = a[x-1] + b[y-1] - c;
            used_x = x;
            used_y = y;
            discount = c;
        }
    }
    debug(a_min, b_min, used_x, used_y, discount, ans);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <set>
using namespace std;
typedef long long ll;


int main(void){
  int n,i;
  char c;
  set<char> s;
  
  cin >> n;
  for (i=0;i<n;i++){
    cin >> c;
    s.insert(c);
  }
  
  if (s.size()==3) cout << "Three" << endl;
  else cout << "Four" << endl;
  
  return 0;
}

Measured memory_bytes: 256
n = gets.strip.to_i
count = 0
(1..n - 1).each do |a|
  max_b = (n - 1) / a
  (a..max_b).each do |b|
    if n > a * b
      if a == b
        count += 1
      else
        count += 2
      end
    end
  end
end

puts count


Measured memory_bytes: 14284
#include <bits/stdc++.h>
#define err(args...) {}
#ifdef DEBUG
#include "_debug.cpp"
#endif
using namespace std;
using ll = long long;
int n, m;
int put(int mask, int x, int i) {
    return (mask & ~(0b11 << 2 * x)) | (i << 2 * x);
}
int where(int mask, int x) {
    return (mask >> 2 * x) & 0b11;
}
int highest(int mask, int i) {
    int ans = 0;
    for(int x = 1; x <= n; x++) {
        ans = where(mask, x) == i ? x : ans;
    }
    return ans;
}
bool can(int mask, int from, int to) {
    return highest(mask, from) > highest(mask, to);
}
int shift(int mask, int from, int to) {
    return put(mask, highest(mask, from), to);
}
bool win(int mask) {
    return (highest(mask, 1) == n and not highest(mask, 2) and not highest(mask, 3))
        or (highest(mask, 3) == n and not highest(mask, 2) and not highest(mask, 1));
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    while(cin >> n >> m and n and m) {
        int start = 0;
        for(int i = 1; i <= 3; i++) {
            int sz;
            cin >> sz;
            while(sz--) {
                int x;
                cin >> x;
                start = put(start, x, i);
            }
        }
        queue<int> q({start});
        map<int, int> d = {{start, 0}};
        int ans = -1;
        while(not q.empty()) {
            int mask = q.front(); q.pop();
            if(win(mask)) {
                ans = d[mask] < m ? d[mask] : -1;
                break;
            }
            for(int i = 1; i <= 2; i++) {
                if(can(mask, i, i + 1) and not d.count(shift(mask, i, i + 1))) {
                    d[shift(mask, i, i + 1)] = d[mask] + 1;
                    q.push(shift(mask, i, i + 1));
                }
                if(can(mask, i + 1, i) and not d.count(shift(mask, i + 1, i))) {
                    d[shift(mask, i + 1, i)] = d[mask] + 1;
                    q.push(shift(mask, i + 1, i));
                }
            }
        }
        cout << ans << endl;
    }
    return 0;
}



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

const double PI = 3.14159265358979323846;
//using namespace boost::multiprecision;
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 1e15;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

std::istream &operator>>(std::istream &in, set<int> &o) {
    ll a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
const int mod = 1000000007;
//const ll mod = 1e10;
typedef priority_queue<long long, vector<long long>, greater<long long> > PQ_ASK;

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

    vector<ll> cards(n);
    rep(i, n) cin >> cards[i];
    map<ll, ll> count;
    for (ll c : cards) count[c]++;
    ll eat = 0;
    for (auto e : count) {
        eat += (e.second - 1);
    }

    if (eat % 2 == 0) {
        cout << count.size() << endl;
    } else {
        cout << count.size() - 1 << endl;
    }

}

Measured memory_bytes: 7296
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
template<class T> inline bool chmin(T&x,T y){if(x>y){x=y;return true;}return false;}
template<class T> inline bool chmax(T&x,T y){if(x<y){x=y;return true;}return false;}
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    istream& in(cin);
    ostream& out(cout);
    ll n;
    string s;
    in>>n>>s;
    ll ans=n*(n-1)*(n-2)/6;
    int c[256]={};
    fr(i,n) c[s[i]]++;
    ll r=c['R'],g=c['G'],b=c['B'];
    ans-=r*(r-1)/2*(n-r);
    ans-=g*(g-1)/2*(n-g);
    ans-=b*(b-1)/2*(n-b);
    ans-=r*(r-1)*(r-2)/6;
    ans-=g*(g-1)*(g-2)/6;
    ans-=b*(b-1)*(b-2)/6;
    fr(i,n) fr(j,i){
        int k=i+(i-j);
        if(k<n&&s[i]!=s[j]&&s[j]!=s[k]&&s[i]!=s[k]) --ans;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3624
using System;

namespace AtCoder.ABC097
{
    public class A
    {
        public static void Solve()
        {
            string[] input = Console.ReadLine().Split(' ');
            int a = int.Parse(input[0]);
            int b = int.Parse(input[1]);
            int c = int.Parse(input[2]);
            int d = int.Parse(input[3]);

            var res = "No";
            
            if (Math.Abs(a - c) <= d)
            {
                res = "Yes";
            }
            else
            {
                if (Math.Abs(a - b) <= d)
                {
                    if (Math.Abs(b - c) <= d)
                    {
                        res = "Yes";
                    }
                }
            }
        
            Console.WriteLine(res);
        }    
    }
}

namespace AtCoder {
    class Program
    {
        static void Main(string[] args)
        {
            ABC097.A.Solve();
        }
    }
}


Measured memory_bytes: 11092
def solve(s1, s2):
    n = len(s1)
    c = 0
    for i in range(n):
        c += s1[i] != s2[i]
    return c


def main(istr, ostr):
    s1 = istr.readline().strip()
    s2 = istr.readline().strip()
    result = solve(s1, s2)
    print(result, file=ostr)


if __name__ == "__main__":
    import sys

    main(sys.stdin, sys.stdout)


Measured memory_bytes: 9372
import java.util.*;

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

        int n = sc.nextInt();
        int m = sc.nextInt();
        int k = sc.nextInt();

        long[] a = new long[n + 1];
        long[] b = new long[m + 1];

        for(int i = 1; i < n + 1; i++){
            a[i] = a[i - 1] + sc.nextInt();
        }

        for(int i = 1; i < m + 1; i++){
            b[i] = b[i - 1] + sc.nextInt();
        }

        int t = m;
        int ans = 0;
        for(int i = 0; i < n + 1; i++){
            for(int j = t; j >= 0; j--){
                if(a[i] + b[j] <= k){
                    ans = Math.max(ans, i + j);
                    t = j;
                    break;
                }
            }
        }

        System.out.println(ans);
    }
}


Measured memory_bytes: 63340
n = gets.to_i
points = []
n.times do
  points.push gets.split(/\s/).map{|x| x.to_i}
end
result = true
points.each do |point|
  sum = point[1] + point[2]
  cond1 = (point[0].odd? && sum.odd?) || (point[0].even? && sum.even?)
  cond2 = point[0] >= sum
  unless cond1 && cond2
    result = false
    break
  end
end
puts result ? "Yes" : "No"

Measured memory_bytes: 12028
S = list(input())
N = len(S)
ans = 0
for pt in range((1 << (N-1))):#1 == 線あり 0 == 線なし　とする
    # if "11" in bin(pt): continue
    tmpS = S.copy()
    # v = []
    inscnt = 1
    for i in range(N-1):
        if (1 << i) & pt:
            tmpS.insert(i+inscnt,'+')
            inscnt+=1
    # print(tmpS)
    tmpsum=eval("".join(tmpS))
    # print(tmpsum)
    ans+=tmpsum
    # print(v)
print(ans)


Measured memory_bytes: 3060
#include<stdio.h>
int main(){
 int N,i,j,count,x=0;
  scanf("%d",&N);
for(i=1;i<=N;i+=2){
  count=0;
  for(j=1;j<=i;j++)
    if(i%j==0)
      count++;
  if(count>=8)
    x++;
}
  
  printf("%d\n",x);
  return 0;
}


Measured memory_bytes: 128
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = 0;
        for (int i=0;i<n;i++){
            m+= -sc.nextInt()+sc.nextInt()+1;
        }
        System.out.println(m);
    }
}


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

int main()
{
	int n,d,x,a[100];
	cin>>n>>d>>x;
	for(int i=0;i<n;i++) cin>>a[i];
	
	int v=0;
	for(int i=0;i<n;i++){
		for(int j=1;j<=d;j+=a[i]) v++;
	}
	
	cout<<x+v<<endl;
	
	return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:108777216")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("fast-math")
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <vector>
#include <bitset>
#include <queue>
#include <deque>
#include <utility>
#include <algorithm>
#include <ctime>
using namespace std;

int const MAX_N = 512;

char s[MAX_N][MAX_N];
vector<pair<int,int> > ms;

int main() {
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
 
	int a,b;
	cin>>a>>b;
	
	int swap_colors = 0;
	if (a < b) {
		swap(a,b);
		swap_colors = 1;
	}
	b--;

	int n = 100, m = 100;
	for (int i=0; i<n; i++)
		for (int j=0; j<m; j++)
			s[i][j] = '#';

	for (int i=0; i+3<n && a>0; i+=4)
		for (int j=0; j+3<m && a>0; j+=4) {
			s[i][j] = '.';
			a--;
			ms.push_back(make_pair(i,j));
		}

	for (int i=0; i<(int) ms.size() && b>0; i++) {
		int x = ms[i].first;
		int y = ms[i].second;
		s[x+1][y] = s[x+1][y+1] = s[x+1][y+2] = s[x][y+2] = '.';
		if (x > 0)
			s[x-1][y] = s[x-1][y+1] = s[x-1][y+2] = '.';
		b--;
	}

	if (swap_colors)
		for (int i=0; i<n; i++)
			for (int j=0; j<m; j++)
				if (s[i][j]=='.') s[i][j] = '#';
				else if (s[i][j] == '#') s[i][j] = '.';

	printf("%d %d\n",n,m);
	for (int i=0; i<n; i++) {
			for (int j=0; j<m; j++)
				printf("%c",s[i][j]);
			printf("\n");
	}
    return 0;
}  


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<typename T> inline bool chmax(T& a,T b) { if (a < b) { a = b; return true; } return false; }
template<typename T> inline bool chmin(T& a,T b) { if (a > b) { a = b; return true; } return false; }
const long long INF = 1e18;

int main() {
    int n;
    cin >> n;
    int c[n-1], s[n-1], f[n-1], time[n][n] = {0};
    for (int i = 0; i < n-1; i++) {
        cin >> c[i] >> s[i] >> f[i];
    }

    for (int st = 0; st < n; st++) {
        for (int i = st; i < n-1; i++) {
            time[st][i] = max(s[i], ((time[st][i] + f[i] - 1) / f[i]) * f[i]);
            time[st][i+1] = time[st][i] + c[i];
        }
    }

    for (int i = 0; i < n; i++) {
        cout << time[i][n-1] << endl;
    }
    return 0;
}

Measured memory_bytes: 1280
aa, bb = map(int,input().split())

a = aa
b = bb
r = 0
# 最大公約数を求める
while 1:
    a, b = max(a,b), min(a,b)
    a = a % b
    if a == 0:
        r = b
        break

print(aa//r*bb)


Measured memory_bytes: 60948
n=int(input())
l =list(map(int,input().split()))
l.sort()
ans=0
for p in range(0,n-2):
    for q in range(p,n-1):
        if l[p]==l[q]:
            continue
        for r in range(q,n):
            if l[q]==l[r]:
                continue
            if l[p]+l[q]>l[r]:
                ans+=1
            else:
                break
print(ans)

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

int main()
{
  int n, m;
  cin >> n >> m;
  map<int, int> mp;
  M mm;
  int ac = 0, wa = 0;
  int q;
  string r;
  rep(i, m){
    cin >> q >> r;
    if(mp[q] == 0){
      if(r == "AC"){
        wa += mm[q];
        mp[q]++;
        ac++;
      }
      else{
        mm[q]++;
      }
    }
  }
  cout << ac << " " << wa << endl;
      
    
  return 0;
}


Measured memory_bytes: 12976
//Amumu-style
#include<bits/stdc++.h>
#define ll long long
#define IOSF ios::sync_with_stdio(false)
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define ini(a,b) memset(a,b,sizeof(a))
#define ms multiset
#define um unordered_map
using namespace std;
int a[200];
int main() {
	int n;
	cin>>n;
	for(int i=0; i<n; i++) cin>>a[i];
	sort(a,a+n);
	int sum=0;
	for(int i=0; i<n-2; i++) {
		for(int j=i+1; j<n-1; j++) {
			for(int k=j+1; k<n; k++) {
				if(a[i]+a[j]>a[k]&&a[i]!=a[j]&&a[j]!=a[k]) sum++;
			}
		}
	}
	cout<<sum;
	return 0;
}
//当年陈刀仔！

Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <list>
#include <map>
#include <set>

#define REP(i, N) for (int i = 0; i < (N); i++)
#define REPP(i, a, N) for (int i = (a); i < (N); i++)

using namespace std;


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

    int N;
    string S;
    cin >> N;
    cin >> S;
    set<char> right,left;
    set<char>::iterator it;
    set<char>::iterator rightIt;
    int count;
    int m = 0;

    REPP(i,1,N+1){
        count = 0;
        REPP(l,0,i) right.insert(S[l]);
        REPP(l,i,N) left.insert(S[l]);
        for(rightIt = right.begin() ; rightIt != right.end(); rightIt++){
            it = left.find(*rightIt);
            if(it != left.end()) count++;
        }
        m = max(count,m);
        right.clear();
        left.clear();
    }
    cout << m << endl;


    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <array>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <bitset>
#include <tuple>
#include <cmath>
#include <complex>
#include <algorithm>
#include <utility>
#include <regex>
#include <cstdint>
#include <numeric>
#include <functional>
#include <cassert>

using namespace std;
using ll = int64_t;
using ull = uint64_t;

constexpr ll INF = numeric_limits<ll>::max() / 4;
namespace utils{
    template<class T, class Compare> using p_queue = priority_queue<T, vector<T>, Compare>;
    template<class T> using min_queue = p_queue<T, greater<T>>;
    template<class T> using max_queue = p_queue<T, less<T>>;

    template<class T> bool min_update(T& X, const T& A){ if(X > A) {X = A; return true;} return false; }
    template<class T> bool max_update(T& X, const T& A){ if(X < A) {X = A; return true;} return false; }
    using V_Set = unordered_set<int>;
    using E_Set = unordered_map<int, V_Set>;

#define ALL(x) begin(x), end(x)
#define rALL(x) rbegin(x), rend(x)
}
using namespace utils;


void sub_main(istream &is) {
    ll N;
    is >> N;
    if(!is) return;
    cout << 3 * N * N ;

}

int main(int argc, char *argv[]) {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << setprecision(16) << scientific;
#ifdef DEBUG
    string test_cases = "test_A.txt";
    cerr << "DEBUG MODE" <<  endl;
    cerr << test_cases << " -->" << endl;
    auto fs = fstream(test_cases, fstream::in);
    int lp = 0;
    while(fs) {
        lp++;
        cout << lp <<  "#------\n";
        sub_main(fs);
    }
    cout << "------#" << endl;
    if(lp <= 1) sub_main(cin);
#else
    sub_main(cin);
#endif
    return 0;
}


Measured memory_bytes: 892
#include <algorithm>
#include <cstdint>
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int64_t n, k;
    cin >> n >> k;

    vector<pair<int64_t, int64_t>> vec(n);
    for (auto &p : vec) {
        cin >> p.first >> p.second;
    }
    sort(vec.begin(), vec.end());

    auto left = k;
    auto res = 0;

    for (const auto &p : vec) {
        left -= p.second;
        if (left <= 0) {
            res = p.first;
            break;
        }
    }

    cout << res << "\n";
    return 0;
}


Measured memory_bytes: 1792
a,b,c,x,y = gets.chomp.split.map(&:to_i)
if x>=y
  if a+b>=2*c
    if a>=2*c
      puts 2*c*x
    else
      puts 2*c*y+a*(x-y)
    end
  else
    if a>=2*c
      puts (a+b)*y+2*c*(x-y)
    else
      puts (a+b)*y+a*(x-y)
    end
  end
else
  if a+b>=2*c
    if b>=2*c
      puts 2*c*y
    else
      puts 2*c*x+b*(y-x)
    end
  else
    if b>=2*c
      puts (a+b)*x+2*c*(y-x)
    else
      puts (a+b)*x+b*(y-x)
    end
  end
end

Measured memory_bytes: 14312
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

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

  public void run() {

    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int n = Integer.parseInt(br.readLine());
      Graph graph = new Graph(n);
      int[] ajacent;
      String[] vInfo;
      int id,degree;

      for(int i=0,v=0; i<n; i++) {
        vInfo  = br.readLine().split(" ");
        id     = Integer.parseInt(vInfo[0]);
        degree = Integer.parseInt(vInfo[1]);
        ajacent = new int[degree];
        for(int j=0; j<degree; j++) {
          ajacent[j] = graph.convIdToIndex( Integer.parseInt(vInfo[j+2]) );
        }
        graph.setVertex(id, ajacent);
      }

      graph.vertexSearch();

      graph.dispReport();
    }
    catch (IOException e) {
      System.err.println(e);
    }
  }

  class Graph {

    Vertex[] vertices;
    int time;

    public Graph(int size ) {
      vertices  = new Vertex[size];
      time = 0;
    }

    public void setVertex(int id) {
      vertices[convIdToIndex(id)] = new Vertex(id);
    }
    public void setVertex(int id, int[] ajacent) {
      setVertex(id);
      setAjacent(id, ajacent);
    }
    public void setAjacent(int id, int[] ajacent) {
      vertices[convIdToIndex(id)].ajacent = ajacent;
    }
    public void vertexSearch() {
      for (Vertex v : vertices) {
        if(v.state == Vertex.WHITE)
          depthFirstSearch(v.index);
      }
    }
    public void dispReport() {
      StringBuilder buf = new StringBuilder();

      for (Vertex v : vertices) {
          buf.append(v.id).append(" ")
             .append(v.findTime).append(" ")
             .append(v.doneTime).append("\n");
      }

      System.out.print(buf);
    }
    public int convIdToIndex(int id) {
      return id-1;
    }

    private void depthFirstSearch(int index) {
      vertices[index].state = Vertex.GRAY;
      vertices[index].findTime = ++time;
      
      for(int ajcIndex: vertices[index].ajacent) {
        if(vertices[ajcIndex].state == Vertex.WHITE)
          depthFirstSearch(ajcIndex);
      }
      vertices[index].state = Vertex.BLACK;
      vertices[index].doneTime = ++time;
    }

    class Vertex {

      static final int WHITE = 0;
      static final int GRAY  = 1;
      static final int BLACK = 2;
      int id;
      int index;
      int state;
      int[] ajacent;
      int findTime;
      int doneTime;

      public Vertex(int id) {
        this.id = id;
        index = id-1;
        state = WHITE;
      }
    }
  }
}


Measured memory_bytes: 24236
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int num=sc.nextInt();
        int[] w = new int[num];
        for(int i=0;i<w.length;i++){
            w[i]=i+1;
        }
        int n=sc.nextInt();
        for(int i=0;i<n;i++){
            String str = sc.next();
            String[] ab = str.split(",");
            int a = Integer.parseInt(ab[0])-1;
            int b = Integer.parseInt(ab[1])-1;
            int tmp;
            tmp=w[a];
            w[a]=w[b];
            w[b]=tmp;
        }
        for(int i=0;i<w.length;i++){
            System.out.println(w[i]);
        }
    }
}



Measured memory_bytes: 25916
#include "bits/stdc++.h"

#define fastread std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl '\n'
#define pb push_back
#define mp make_pair
#define ceel(x, y) (x+y-1)/y
#define print(a) for(auto x:a) cout<<x<<' ';cout<<endl;
#define printM(b) for(auto y:b) {print(y);}
#define printP(p) cout<<p.first<<' '<<p.second<<endl;
#define inp(ar, l, r) for(int i=l ; i<r ; ++i) cin>>ar[i];
#define inpar(ar) for(int i=0 ; i<n ; ++i) cin>>ar[i];
#define debug(ar, n) for(int i=0 ; i<n ; ++i) cout<<ar[i]<<' ';cout<<endl;
#define debugar(ar) for(int i=0 ; i<n ; ++i) cout<<ar[i]<<' ';cout<<endl;
#define qwer cout<<endl;
#define MOD 1000000007

using namespace std;

typedef long long int ll;
typedef long double ld;
typedef unsigned long long ull;

#define pll pair<ll,ll>

const int N = 3001;
ll dp[2][N+1][N+1];
ll ar[N+1], n;

ll calc(int left, int right, bool player, ll score1, ll score2)
{
    if(left > right) return 0;

    if(dp[player][left][right] != -1)
        return dp[player][left][right];
    
    if(player%2 == 0)
    {
        ll temp1 = calc(left+1, right, player^1, score1+ar[left], score2);
        ll temp2 = calc(left, right-1, player^1, score1+ar[right], score2);

        dp[player][left][right] = max(ar[left]+temp1, ar[right]+temp2);
    }
    else
    {
        ll temp1 = calc(left+1, right, player^1, score1, score2+ar[left]);
        ll temp2 = calc(left, right-1, player^1, score1, score2+ar[right]);

        dp[player][left][right] = min(temp1-ar[left], temp2-ar[right]);
    }
    return dp[player][left][right];
}

void solve()
{
    cin>>n;

    for(int i=0 ; i<n ; ++i)
        cin>>ar[i];
    
    memset(dp, -1, sizeof(dp));

    cout<<calc(0, n-1, 0, 0, 0)<<endl;
}

void preCompute() {}

int main()
{
	fastread;

    preCompute();
	
    ll t = 1, tc;
    
    //cin>>t;
    for(tc=1 ; tc<=t ; ++tc) {
        solve();
    }
    
    return 0;
}

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

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

    int r;

    cin >> r;

    cout << 3 * r * r;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<fstream>
#include<vector>
#include<initializer_list>
#include<string>
#include<stdio.h>
using namespace std;
  int main(){
int A,B,C;
scanf("%d%d%d",&A,&B,&C);

if(A+B+C>=22)
{printf ("bust\n");}
else if (A+B+C<=21)
{printf ("win\n");}}

Measured memory_bytes: 256
def iln(): return list(map(int, input().split()))
N, A, B = iln()

# N, A, B = [6, 2, 4]
# N, A, B = [8, 0, 4]
# N, A, B = [8, 3, 4]

S = A + B
quot, remainder = divmod(N, S)

blue_balls = A
if remainder < A:
    blue_balls = remainder

blue_balls += quot * A
print(blue_balls)



Measured memory_bytes: 2940
using System;
using System.IO;
using System.Linq;

namespace AtCoder.R167.B
{
    public static class Solver
    {
        public static void Main()
        {
            using (var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false })
            {
                Solve(Console.In, sw);
            }
        }

        public static void Solve(TextReader tr, TextWriter tw)
        {
            WriteAnswer(tw, Parse(tr));
        }

        private static void WriteAnswer(TextWriter tw, int answer)
        {
            tw.WriteLine(answer);
        }

        private static int Parse(TextReader tr)
        {
            var w = tr.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
            return Calc(w[0], w[1], w[2], w[3]);
        }

        public static int Calc(int a, int b, int c, int k)
        {
            var res = 0;
            if (a >= k)
                return k;
            res += a;
            k -= a;
            if (b >= k)
                return res;
            k -= b;
            return res - k;
        }
    }
}


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

int main() {
  char b;
  cin>>b;
  if(b=='A')
    cout<<'T'<<endl;
  else if(b=='T')
    cout<<'A'<<endl;
  else if(b=='C')
    cout<<'G'<<endl;
  else
    cout<<'C'<<endl;
}

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  string S;
  cin >> S;
  int N = S.size();

  vector<int> ans(N);

  int j;
  for (int i = 0; i < N; i++) {
    if (S.at(i) == 'R') j = i;
    else ans.at(j + (i - j) % 2)++;
  }
  for (int i = N - 1; i >= 0; i--) {
    if (S.at(i) == 'L') j = i;
    else ans.at(j - (j - i) % 2)++;
  }

  for (int i = 0; i < N; i++) cout << ans.at(i) << "\n";
}

Measured memory_bytes: 1104
#include <iostream>

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

  if (N == 2) {
    int A, B;
    std::cin >> A >> B; 
    std::cout << A + B << std::endl;
  } else {
    std::cout << "Hello World" << std::endl;
  }

  return 0;
}


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

#define za ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define mod %1000000007
#define moz 1000000007
#define nl "\n"
#define S second
#define F first
#define PB push_back
#define MP make_pair
#define V vector
#define P pair
#define LEN length()
#define SZ size()
#define loop(i,a,b) for(int i=(a);i<=(b);i++)
typedef long long ll;
typedef complex<ll> C;
#define X real()
#define Y imag()

int n,a,b,c;

int main()
{
    za;
    int a,b,c,d;
    cin >>a >>b >> c >> d;
    cout << max(min(b,d)-max(a,c),0) << nl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using lint = long long;
template<typename T = lint>inline T in() { T x; cin >> x; return x; }
#define INF           1e9
#define INFL          static_cast<lint>(INF)
#define REP(i,n)      for(lint i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)     for(lint i=1,i##_len=(n);i<=i##_len;++i)
#define REPI(i,ini,n) for(lint i=(ini),i##_len=(n);i<i##_len;++i)
#define REPC(i,obj)   for(auto i:obj)
#define R_UP(a,b)     (((a)+(b)-1)/(b))
#define ALL(obj)      (obj).begin(),(obj).end()
int main()
{
	int n = in();
	vector<int>a(n);
	REP(i, n)a[i] = in();
	int m = in();
	vector<int>b(m);
	REP(i, m)b[i] = in();
	bool flag = true;
	REP(i, min(n, m))
	{
		if (a[i] != b[i])
		{
			flag = false;
			if (a[i] < b[i])cout << 1 << endl;
			else cout << 0 << endl;
			break;
		}
	}
	if (flag)cout << (a.size() < b.size() ? 1 : 0) << endl;
}


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

int main(){
    using namespace std;
    unsigned long N;
    cin >> N;
    vector<pair<unsigned long, unsigned long>> task(N);
    for(auto& i : task)cin >> i.second >> i.first;
    sort(task.begin(), task.end());
    unsigned long time{0};
    for(const auto i : task)if((time += i.second) > i.first)return 0 & puts("No");
    puts("Yes");
    return 0;
}

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

using namespace std;
typedef long long ll;

int main(){
    ll n;
    cin >> n;
    string s;
    vector<string> v(n);
    ll i,j,k;
    for(i=0;i<n;i++){
        cin >> s;
        sort(s.begin(),s.end());
        v[i]=s;
    }
    sort(v.begin(),v.end());
    ll ret=0;
    ll cnt =1;
    for(i=0;i<n-1;i++){
        if(v[i]==v[i+1]){
            ret+=cnt;
            cnt++;
        }else{
            cnt=1;
        }
    }
    cout << ret << endl;
    return 0;
}

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

int main()
{
    int n;
    cin >> n;
    int tmp;
    REP(i, n)
    {
        cin >> tmp;
        if (tmp % 2 == 0 && tmp % 3 != 0 && tmp % 5 != 0)
        {
            cout << "DENIED"<< "\n";
            return 0;
        }
    }
    cout << "APPROVED"<< "\n";
    return 0;
}


Measured memory_bytes: 256
import Data.Int
import Control.Monad

main = do
  n <- readLn :: IO Int -- 3 <= n <= 100
  let m | even n = n + 1
        | otherwise = n
  print $ n * (n - 1) `quot` 2 - (m - 1) `quot` 2
  forM_ [1..n-1] $ \i -> do
    forM_ [i+1..n] $ \j -> do
      when (i + j /= m) $ putStrLn $ show i ++ " " ++ show j


Measured memory_bytes: 1020
/*
ID: amagica1
TASK: ariprog
LANG: C++
*/
#include <bits/stdc++.h>
using namespace std;
#define INF 0x3f3f3f3f
#define NINF -INF
#define mp make_pair
#define boost() cin.tie(0); cin.sync_with_stdio(0)
#define For(i, a, b) for(int i=a; i<b; i++)
#define FOR(i, a, b) for(int i=a; i<=b; i++)
#define Rev(i, a, b) for(int i=a; i>b; i--)
#define REV(i, a, b) for(int i=a; i>=b; i--)
typedef long long ll;
typedef long double ld;
typedef int64_t l;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, ll> pll;
const int MOD = 1e9 + 7;
const int MAXN = 100005;
ll gcd(ll a, ll b){return b == 0 ? a : gcd(b, a % b);}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
ll fpow(ll  b, ll exp, ll mod){if(exp == 0) return 1;ll t = fpow(b,exp/2,mod);if(exp&1) return t*t%mod*b%mod;return t*t%mod;}
ll divmod(ll i, ll j, ll mod){i%=mod,j%=mod;return i*fpow(j,mod-2,mod)%mod;}
int a, b, c;
int main() {
    //-----------FILE------------//
    // freopen("ariprog.in", "r", stdin);
    // freopen("ariprog.out", "w", stdout);
    //----------------------------//
    cin >> a >> b >> c;
    if(a > b) swap(a, b);
    if(c >= a && c <= b) printf("Yes\n");
    else printf("No\n");
}

Measured memory_bytes: 256
import sys 
input = sys.stdin.readline
# readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)

MOD = 10**9 + 7

def calc_combination(n, k, MOD):
    if k > n - k:
        k = n - k
    ans = 1
    for i in range(1, k + 1):
        ans *= n + 1 - i
        ans *= pow(i, MOD - 2, MOD)
        ans %= MOD
    return ans
 
 
x, y = map(int, input().split())
m = 2 * y - x
n = 2 * x - y
 
if m < 0 or n < 0:
    ans = 0
elif m % 3 != 0 or n % 3 != 0:
    ans = 0
else:
    m //= 3
    n //= 3
    ans = calc_combination(m + n, n, MOD)

print(ans)

Measured memory_bytes: 3188
#include "bits/stdc++.h"

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define pb push_back

using namespace std;

using ll = long long;
using P = pair<int,int>;

const int mod=1e9+7,INF=1<<30;
const double EPS=1e-12,PI=3.1415926535897932384626;
const ll LINF=1LL<<60, lmod = 1e9+7;

const int MAX_N = 100005;
ll fact[MAX_N];
int right[2*MAX_N];
vector<P> vec;

int main(){
  ll N; cin >> N;
  rep(i,N){
    int a; scanf("%d",&a);
    vec.pb(P(a,1));
  }
  rep(i,N){
    int a; scanf("%d",&a);
    vec.pb(P(a,-1));
  }
  sort(ALL(vec));
  ll ans = 1LL;
  ll cnt = 0;
  int pre;
  rrep(i,2*N-1){
    if(cnt==0){
      pre = vec[i].second;
    }
    if(vec[i].second==pre){
      cnt++;
    }else{
      (ans *= cnt) %= lmod;
      cnt--;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 2420
#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;}
typedef long long ll;
ll mod=1e9+7;
void add(ll &x,ll y){
	x+=y;
	x%=mod;
}
ll dp[5001][5001];
int main(){
	int N,K;
	string s;
	cin>>N>>s;
	K=s.size();
	dp[0][0]=1;
	rep(i,N) rep(j,i+1) if(dp[i][j]){
		add(dp[i+1][j+1],dp[i][j]*2);
		add(dp[i+1][max(j-1,0)],dp[i][j]);
	}
	ll i2=(mod+1)/2;
	ll ans=dp[N][K];
	rep(i,K) ans=ans*i2%mod;
	cout<<ans<<endl;
}

Measured memory_bytes: 193792
# -*- coding: utf-8 -*-
import sys

[L, R] = [int(i) for i in input().split()]

between_list = []
for lr in range(L, R+1):
    lr_mod = lr % 2019
    if lr_mod == 0:
        print(0)
        sys.exit()
    between_list.append(lr % 2019)

#あとは総当たり戦
min_number = 2019
for i in range(len(between_list)-1):
    for j in range(i+1, len(between_list)):
        #print(str(i) + ', ' + str(j))
        #print(str(between_list[i]) + ', ' + str(between_list[j]))
        if (between_list[i] * between_list[j]) % 2019 < min_number:
            min_number = (between_list[i] * between_list[j]) % 2019

print(min_number)


Measured memory_bytes: 3064
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
//#include <utility>
//#include <memory>
//#include <functional>
//#include <deque>
//#include <cctype>
//#include <ctime>
//#include <numeric>
//#include <list>
//#include <iomanip>

//#if __cplusplus >= 201103L
//#include <array>
//#include <tuple>
//#include <initializer_list>
//#include <forward_list>
//
//#define cauto const auto&
//#else

//#endif

using namespace std;


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

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

void mainmain(){
	string s;
	cin>>s;
	int n = s.size();
	ll ans = 0;
	if(s.size()==1){
		cout<<s<<endl;
		return;
	}
	rep(i,1<<(n-1)){
		ll t = 0;
		rep(j,n){
			t *= 10;
			t += s[j]-'0';
			if(i&(1<<j) || j == n-1){
				ans += t;
				t = 0;
			}
		}
	}
	cout<<ans<<endl;
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(20);
    mainmain();
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>

#define RepG(i, x) for (int i = head[x]; i; i = edge[i].next)
#define Rep(i, n) for (int i = 1; i <= n; i ++)
#define v edge[i].to

using namespace std;

const int N = 100010;

struct Edge{ int to, next;} edge[N * 2];
int head[N], num;
void add_edge(int a, int b){ edge[++ num] = (Edge){b, head[a]}, head[a] =num;}

bool g[N], flag;

void dfs(int x, int f)
{
	int cnt = 0, tt = 0;
	RepG(i, x) if (v != f) {
		dfs(v, x); tt ++;
		if (g[v]) cnt ++;
	}
	if (cnt >= 2) flag = true;
	else if (!cnt) g[x] = true;
//	printf("%d %d\n", x, g[x]);
}

int main()
{
	int n;
	scanf("%d", &n);
	Rep(i, n - 1) {
		int a, b;
		scanf("%d%d", &a, &b);
		add_edge(a, b); add_edge(b, a);
	}
	dfs(1, 0);
	if (flag || g[1]) printf("First\n");
	else printf("Second\n");
	
	return 0;
}

Measured memory_bytes: 2176
import sys
from itertools import combinations, product
n = int(input())
red_ls = []
blue_ls = []
for j in range(n):
    a, b = [int(i) for i in sys.stdin.readline().split()]
    red_ls.append([1+j, a, b])
for j in range(n):
    c, d = [int(i) for i in sys.stdin.readline().split()]
    blue_ls.append([n+1+j, c, d])

graph = {i : [] for i in range(2*n+2)}
edge_ls = []
cnt = 0
for i in range(1, n+1):
    edge_ls.append([i, 1, None])
    graph[0].append(cnt)
    cnt += 1
for i in range(n+1, 2*n+1):
    edge_ls.append([2*n+1, 1, None])
    graph[i].append(cnt)
    cnt += 1

for (r_ind, r_x, r_y), (b_ind, b_x, b_y) in product(red_ls, blue_ls):
    if r_x < b_x and r_y < b_y:
        edge = [b_ind, 1, cnt+1]
        edge_rev = [r_ind, 0, cnt]
        graph[r_ind].append(cnt)
        graph[b_ind].append(cnt + 1)
        edge_ls += [edge, edge_rev]
        cnt += 2

def dfs(s, g, flow):
    if s==g:
        return flow
    used[s] = True
    for _next in graph[s]:
        t, c, rev = e = edge_ls[_next]
        if not used[t] and c > 0:
            flow = min(flow, c)
            d = dfs(t, g, flow)
            if d:
                edge_ls[_next][1] -= d
                if rev is not None:
                    edge_ls[rev][1] += d
                return d
    return 0


flow = 0
INF = 10**18
f = INF
while f:
    used = [0 for i in range(2*n+2)]
    f = dfs(0, 2*n+1, INF)
    flow += f
print(flow)

Measured memory_bytes: 46556
#include <iostream>
#include<sstream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<iomanip>
#define  mem(a,b) memset(a,b,sizeof(a))

const int mo=1000000007;
const int inf=0x3f3f3f3f;
double pi=3.14159265358979323846;
double e= 2.71828182845904523536;
typedef long long ll;
using namespace std;

int main()
{
    ll m,n;
    cin>>n>>m;
    cout<<abs((m-2)*(n-2))<<endl;
    return 0;
}




Measured memory_bytes: 256