akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,j,k) for(ll i=(ll)j;i<(ll)k;i++)
#define itrep(i,x) for(auto i=(x).begin(); i!=(x).end();i++)
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vec vector
#define INF INT_MAX
#define INFL 1e18
#define MOD 1000000007
#define pb push_back
#define MP make_pair
#define PI 3.1415926535
typedef long long int ll;
typedef std::pair<int,int> P;
int D=1;
int dx[4]={0,1,0,-1},dy[4]={-1,0,1,0};

using namespace std;

int main(){
    int x; cin>>x;
    if(x==1){
        cout<<1<<endl;
        return 0;
    }
    int ans=0;
    rep(i,2,1000){
        int t=i*i;
        while(t*i<=x){
            t*=i;
        }
        if(t<=x)ans=max(ans,t);
    }
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 256
NM = list(map(int, input().split()))
score = list(map(int, input().split()))

cutter = 0
all = 0
for i in range(len(score)):
    all += score[i]

candidate = 0
criteria = 4 * NM[1]
for i in range(len(score)):
    if (all <= (score[i] * criteria)):
        candidate += 1

if (candidate >= NM[1]):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3060
// in case of multiple test cases and N=1e5 don't intialize arrays as global except for graph vector-array
// always check whether or not you are doing mod of a negative number
// always use 1LL instead of 1
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>
 
using namespace __gnu_pbds;
using namespace std;

// using long doubles saves you from corner cases but is very time consuming
#define double      	long double
#define int         	long long
#define pb          	push_back
#define pii         	pair<int,int>
#define vi          	vector<int>
#define vii         	vector<pii>
#define mi          	map<int,int>
#define mii         	map<pii,int>
#define all(a)      	(a).begin(),(a).end()
#define sz(x)       	(int)x.size()
// just comment the line below in case of interactive problems
#define endl        	"\n"
#define repp(i,a,b) 	for(int i=a;i<b;i++)
#define rep(i,a,b) 		for(int i=a;i<=b;i++)
#define brep(i,a,b)     for(int i=a;i>=b;i--)
#define deb1(x)      	cout << #x << "=" << x << endl
#define deb2(x, y)  	cout << #x << "=" << x << "," << #y << "=" << y << endl
#define deb3(x, y, z)  	cout << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define trace(v) 		for(auto it=v.begin();it!=v.end();it++)cout<<*it<<" ";cout<<endl;
#define tracearr(a,l,r) for(int iii=l;iii<=r;iii++)cout << a[iii] << " ";cout << endl;
#define PI          	3.1415926535897932384626
#define F 				first
#define S 				second
#define clr(x,y) 		memset(x, y, sizeof(x))
#define IOS         	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);


typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
// *s.find_by_order(1) - gives the 2nd samllest element in set
// s.order_of_key(x)   - gives the number of elements in the set which are strictly smaller than x


const int N=1e5 + 5;
const int MOD=1e9 + 7;

int32_t main()
{
	IOS;
	int T=1;
	//cin >> T;
	// int numOfSetBits = __builtin_popcountll(n);
	std::cout << std::fixed << std::setprecision(12);
	while(T--)
	{
		int x;
		cin >> x;
		int ans = x^1;
		cout << ans;
	}
}

Measured memory_bytes: 3636
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<queue>
#include<string>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>
#include<iomanip>

#define REP(i,n) for(int i=0;i<(n);i++)
#define EPS (1e-7)
#define INF (2e9)
// cout << setprecision(10)

using namespace std;
typedef long long int ll;
const ll MOD = 1000000007;

map< ll, int > prime_factor(ll n) {
  map< ll, int > ret;
  for(ll i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

ll N;
int main(void){
    cin >> N;
    map< ll, int > v = prime_factor(N);
    ll count = 0;
    for(auto a:v){
        // cout << a.first << ' ' << a.second << endl;
        ll n = a.second;
        for(int i = 1;i<50;i++){
            if(n - i >= 0){
                n -= i;
                count++;
            }else break;
        }
    }
    cout << count << endl;
    return 0;
}



Measured memory_bytes: 3628
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException {

		int				value;
		BufferedReader	reader = new BufferedReader(new InputStreamReader(System.in));
		List<String>	listStrings = new ArrayList<String>();
		List<Integer>	listMaxIntegers = new ArrayList<Integer>();

		while((value = Integer.parseInt(reader.readLine())) != 0){
			listMaxIntegers.add(value);
			for(int i = 0; i < value; i++)	listStrings.add(reader.readLine());
		}

		value = 0;
		for(int max : listMaxIntegers){
			int sum = 0;
			int[][] list = new int[max][max];

			for(int i = value; i - value < max;i++){
				String[] 	split = listStrings.get(i).split(" ");
				int 		sumOf = 0;

				for(int j = 0; j < max; j++){
					sumOf += Integer.parseInt(split[j]);
					list[i - value][j] = Integer.parseInt(split[j]);
					System.out.printf("%5d", Integer.parseInt(split[j]));
				}

				System.out.printf("%5d\n", sumOf);
			}

			int[] listSum = new int[max];
			for(int j = 0; j < max; j++){
				int sumOf = 0;

				for(int k = 0; k < max; k++){
					sumOf += list[k][j];
				}

				System.out.printf("%5d", sumOf);
				listSum[j] = sumOf;
				sum+= sumOf;
			}

			System.out.printf("%5d\n", sum);

			value += max;
		}
	}
}

Measured memory_bytes: 12000
#include <cstdint>
#include <cstdio>
#include <map>
#include <vector>

int main() {
  size_t n;
  int m;
  scanf("%zu %d", &n, &m);

  std::vector<int> a(n);
  for (auto& ai: a) scanf("%d", &ai);

  a.insert(a.begin(), 0);
  for (size_t i = 1; i <= n; ++i)
    a[i] = (a[i-1] + a[i]) % m;

  std::map<int, intmax_t> count;
  for (auto ai: a) ++count[ai];

  intmax_t res = 0;
  for (auto const& p: count) {
    res += p.second * (p.second-1) / 2;
  }

  printf("%jd\n", res);
}


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

using namespace std;
using pii = pair<int, int>;
template <class T> using pq_gt = priority_queue<T, vector<T>, greater<T>>;

template <typename S, typename T>
std::ostream &operator<<(std::ostream &os, std::pair<S, T> &p) {
  os << '(' << p.first << ", " << p.second << ')';
  return os;
}

int main(int argc, char const *argv[]) {
  int n, m;
  cin >> n >> m;
  vector<pair<int, int>> v(n);

  for (int i = 0; i < n; i++) {
    cin >> v[i].first >> v[i].second;
  }

  sort(v.begin(), v.end());

  priority_queue<int, vector<int>> q;

  int iv = 0;
  int ret = 0;

  for (int i = 1; i <= m; i++) {
    while (iv < n && v[iv].first <= i) {
      q.push(v[iv].second);
      iv++;
    }

    if (!q.empty()) {
      ret += q.top();
      q.pop();
    }
  }
  cout << ret << endl;

  return 0;
}


Measured memory_bytes: 1660
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a;
  cin >> a;
  if(a==25) cout <<"Christmas"<<endl;
  else if(a==24) cout << "Christmas Eve"<<endl;
  else if(a==23) cout << "Christmas Eve Eve"<<endl;
  else cout << "Christmas Eve Eve Eve" <<endl;
  return 0;
}

Measured memory_bytes: 256
import collections
A = input()
for i in range(len(A)-1):
    B = A[i:i+2]
    C = collections.Counter(B)
    if C.most_common()[0][1] == 2:
        print(i+1,i+2)
        exit()
for i in range(len(A)-2):
    B = A[i:i+3]
    C = collections.Counter(B)
    if C.most_common()[0][1] == 2:
        print(i+1,i+3)
        exit()
print(-1,-1)

Measured memory_bytes: 3444
a = input()
dict1 = dict()
dict2 = dict()
counter = 0
b = input().split()
for i in b:
	if counter % 2 == 0:
		if i not in dict1:
			dict1[i] = 1
		else:
			dict1[i] += 1
	elif counter % 2 == 1:
		if i not in dict2:
			dict2[i] = 1
		else:
			dict2[i] += 1
			
	counter += 1

dict1list = []
for i in dict1.keys():
	dict1list.append([i, dict1[i]])

dict2list = []
for i in dict2.keys():
	dict2list.append([i, dict2[i]])

dict1list.sort(key = lambda x: x[1])
dict2list.sort(key = lambda x: x[1])
if dict1list[-1][0] == dict2list[-1][0] and len(dict2list) > 1 and dict1list[-1][1]  > dict2list[-1][1]:
	print(len(b) - dict1list[-1][1] - dict2list[-2][1])
elif dict1list[-1][0] == dict2list[-1][0] and len(dict2list) == 1 and dict1list[-1][1]  > dict2list[-1][1]:
	print(len(b) - dict1list[-1][1])
elif dict1list[-1][0] == dict2list[-1][0] and len(dict1list) > 1 and dict1list[-1][1]  < dict2list[-1][1]:
	print(len(b) - dict1list[-2][1] - dict2list[-1][1])
elif dict1list[-1][0] == dict2list[-1][0] and len(dict1list) == 1 and dict1list[-1][1]  < dict2list[-1][1]:
	print(len(b) - dict2list[-1][1])
elif dict1list[-1][0] == dict2list[-1][0] and dict1list[-1][1]  == dict2list[-1][1]:
	if len(dict1list) == 1 and len(dict2list) == 1:
		print(len(b) - dict2list[-1][1])
	elif len(dict1list) == 1 and len(dict2list) > 1:
		print(len(b) - dict2list[-2][1] - dict1list[-1][1])
	elif len(dict1list) > 1 and len(dict2list) == 1:
		print(len(b) - dict2list[-1][1] - dict1list[-2][1])
	else:
		if (dict2list[-2][-1] >= dict1list[-2][-1]):
			print(len(b) - dict2list[-2][1] - dict1list[-1][1])
		elif (dict2list[-2][-1] < dict1list[-2][-1]):
			print(len(b) - dict2list[-1][1] - dict1list[-2][1])
else:
	print(len(b) - dict1list[-1][1] - dict2list[-1][1])


Measured memory_bytes: 26084
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll vis[105]={0};
int main()
{
    ll x,n,ans,minim;
    cin>>x>>n;
    for (int i=0;i<n;i++)
    {
        cin>>ans;
        vis[ans]=1;
    }
    ans=1e9;
    minim=1e9;
    for (int i=0;i<=101;i++)
    {
        if(!vis[i])
        {
        if(abs(i-x)<=minim)
        {
            if(abs(i-x)==minim)
            {
                if(i<ans)
            {
            ans=i;
            }
            }
          else
          {
              minim=abs(i-x);
              ans=i;
          }
          
        }
        }
    }
    cout<<ans<<'\n';
    return 0;

}

Measured memory_bytes: 3592
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>

using namespace std;

const int nmax = 1e9 + 7;
typedef long long ll;

int main(){
  int N; cin >> N;
  
  vector <int> B(N - 1);
  for (int i = 0; i < N - 1; i++){
    cin >> B[i];
  }

  int sum = 0;
  for (int i = 0; i < N; i++){
    if (i == 0){
      sum += B[0];
    }else if(i == N - 1){
      sum += B[N - 2];
    }else{
      sum += min(B[i - 1], B[i]);
    }
  }

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pii pair<int, int>
#define x first
#define y second
using namespace std;

const int N = 705;

int n, m;
bool g[N][N];

int c2(int x) { return x * (x - 1) / 2; }

int main() {
    scanf("%d %d", &n, &m);
    for(int i = 1; i <= n; ++i) g[i][i] = true;
    for(int i = 0, u, v; i < m; ++i) {
        scanf("%d %d", &u, &v); 
        g[u][v] = g[v][u] = true;
    }
    vector<int> col(N);
    bitset<N> chk[2]; chk[0][0] = true;
    bool st = false;
    auto f = [&](int v) {
        for(int i = n - v; ~i; --i) if(chk[st^1][i]) chk[st][i+v] = true;
    };
    for(int i = 1; i <= n; ++i) if(!col[i]) {
        st ^= 1;
        chk[st] = bitset<N>();
        queue<int> Q; Q.emplace(i); col[i] = 1;
        int cnt1 = 0, cnt2 = 0;
        while(!Q.empty()) {
            int u = Q.front(); Q.pop();
            if(col[u] == 1) cnt1++;
            if(col[u] == 2) cnt2++;
            for(int v = 1; v <= n; ++v) if(!g[u][v]) {
                if(!col[v]) col[v] = col[u] ^ 3, Q.emplace(v);
                if(col[v] == col[u]) return !printf("-1\n");
            }
        }
        f(cnt1), f(cnt2);
    }
    int mn = 1e9;
    for(int i = 0; i <= n; ++i) if(chk[st][i]) mn = min(mn, c2(i) + c2(n-i));
    printf("%d\n", mn);
}


Measured memory_bytes: 768
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
using namespace std;
const int inf=1e9+10;
int n,m,c[20],a[20][20],v[20],X;
int ans=inf;
void dfs(int x,int now)
{
	if (x==n+1)
	{
		bool ff=1;
		for (int i=1;i<=m;i++) if (v[i]<X) ff=0;
		if (ff) ans=min(ans,now);
		return;
	}
	for (int i=1;i<=m;i++) v[i]+=a[x][i];
	dfs(x+1,now+c[x]);
	for (int i=1;i<=m;i++) v[i]-=a[x][i];
	dfs(x+1,now);
}
int main()
{
	scanf("%d%d%d",&n,&m,&X);
	for (int i=1;i<=n;i++)
	{
		scanf("%d",&c[i]);
		for (int j=1;j<=m;j++) scanf("%d",&a[i][j]);
	}
	dfs(1,0);
	printf("%d\n",ans==inf?-1:ans);
return 0;
}

Measured memory_bytes: 3864
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
set<string> st;
string s;

int main()
{
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    ll k;
    cin >> s >> k;
    for (ll i = 1; i <= min<ll>(k, s.size()); i++)
    {
        for (ll j = 0; j + i <= s.size(); j++)
        {
            st.insert(s.substr(j, i));
        }
    }
    ll cnt = 1;
    for (auto v : st)
    {
        if (cnt == k)
        {
            cout << v << endl;
            return 0;
        }
        cnt++;
    }
}


Measured memory_bytes: 1664
# E
N = int(input())
AandB = [list(map(int, input().split())) for _ in range(N)]
A = [AandB[i][0] for i in range(N)]
B = [AandB[i][1] for i in range(N)]

A_sorted = sorted(A)
B_sorted = sorted(B)

if N % 2 != 0:
    n = N // 2
    a = A_sorted[n]
    b = B_sorted[-(n+1)]
    print(b-a+1)
else:
    n = N // 2
    a1 = A_sorted[n-1]
    a2 = A_sorted[n]
    b1 = B_sorted[-n]
    b2 = B_sorted[-n-1]
    a = (a1 + a2) / 2
    b = (b1 + b2) / 2
    print(int((b-a)*2 + 1))

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using ll = long long;
int mod = 1000000000+7;

int main(){

	int x,n;
	cin>>x>>n;
	int p[n];
	rep(i,n)cin>>p[i];

	int min=mod,flag,ans=0;
	for(int i=-3;i<=101;i++){
		flag=0;
		rep(j,n){
			if(i==p[j])flag=1;
		}
		if(min>abs(x-i)&&flag==0){
			min=abs(x-i);
			ans=i;
		}
	}

	cout<<ans<<endl;

	return 0;
}


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

int main() {
  int n; cin >> n;
  map<int, int> mp;
  for (int i = 0; i < (n); ++i){
    int x;
    cin >> x;
    mp[x]++;
  }
  int ans = 0;
  for (const auto &kv:mp){
    if(kv.second%2 != 0) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4992
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.*;
import java.util.*;

public class Main {
	public static void main(String[] args) throws IOException {
		FastReader in = new FastReader(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int n = in.nextInt();
		int h = in.nextInt();
		int w = in.nextInt();
		int ct = 0;
		for (int i = 0; i < n; i++) {
			int x = in.nextInt();
			int y = in.nextInt();
			if (x >= h && y >= w) {
				++ct;
			}
		}
		out.println(ct);
		out.flush();
		out.close();

	}

	static class FastReader {
		StringTokenizer st;
		BufferedReader br;

		public FastReader(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public FastReader(FileReader fileReader) {
			br = new BufferedReader(fileReader);
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public boolean ready() throws IOException {
			return br.ready();
		}
	}

}

Measured memory_bytes: 25300
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main(void){
  int N,i,count;
  char str[100];
  
  fgets(str,sizeof(str),stdin);
  N=atoi(str);
  
  i=1,count=0;
  
  while(i<=N){
    if((0<i && i<10) || (99<i && i<1000) || (9999<i && i<100000)){
      count++;
    }
    i++;
  }
  
  printf("%d\n",count);
  
  return 0;
}

Measured memory_bytes: 128
#include<cstdio>
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
int main(){
	int num;
	int sum1 = 0,sum2 = 0;
	for(int i = 0;i<4;i++){
		cin >> num;
		if(i<2) sum1+=num;
		else sum2+=num;
	}
	if(sum1 > sum2) printf("Left\n");
	else if(sum1 == sum2) printf("Balanced\n");
	else printf("Right\n");
	return 0;
}

Measured memory_bytes: 256
def main():
    a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
    n = int(input())
    print(a[n-1])



if __name__ == '__main__':
    main()


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

int main() {
	int n, m, s[5], c[5], num[3];
	bool ans = true;
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		cin >> s[i] >> c[i];
	}
	for (int i = 0; i < 3; i++) {
		num[i] = -1;
	}
	for (int i = 0; i < m; i++) {
		if (num[s[i] - 1] == -1) {
			if (n > 1 && s[i] == 1 && c[i] == 0) {
				ans = false;
			}
			else{
				num[s[i] - 1] = c[i];
			}
		}
		else {
			if (num[s[i] - 1] == c[i]) {
				continue;
			}
			ans = false;
			break;
		}
	}
	for (int i = 0; i < 3; i++) {
		if (num[i] == -1) {
			num[i] = 0;
		}
	}
	if (n > 1 && num[0] == 0) {
		num[0] = 1;
	}
	if (ans) {
		for (int i = 0; i < n; i++) {
			cout << num[i];
		}
		cout << endl;
	}
	else
	{
		cout << -1 << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm> 
#include <functional>
#include <unordered_map>
#include <unordered_set>
#include  <ctime>
#include <iomanip>
using namespace std;

#define ll                    long long int
#define ull                   unsigned long long int
#define loop(i,a,b)           for(int i=(int)a;i<(int)b;++i)
#define rloop(i,a,b)          for(int i=(int)a;i<=(int)b;++i)
#define loopl(i,a,b)          for(ll i=(ll)a;i<(ll)b;++i)
#define loopr(i,a,b)          for(int i=(int)a;i>=(int)b;--i)
#define count_1(n)            __builtin_popcountll(n)
#define pb                    push_back
#define eb                    emplace_back
#define ab(a)                 (a<0)?(-1*a):a
#define pc                    putchar
#define gc                    getchar
#define mset(a,b,c)           loop(i,0,b) a[i]=c
#define mp                    make_pair
#define itoc(c)               ((char)(((int)'0')+c))
#define all(p)                p.begin(),p.end()
#define max(x,y)              ((x>y)?x:y)
#define min(x,y)              ((x<y)?x:y)
#define mid(s,e)              (s+(e-s)/2)
#define vi                    vector<int>
#define vvi                   vector<vector<int>>
const ll MOD = 1000000007;

ll modpow(ll a, ll b, ll mod) { ll res = 1; for (; b; b >>= 1) { if (b & 1)res = res * a; res%=mod; a = a * a; a%=mod; }return res; }
ll p(ll a, ll b) { ll res = 1; for (; b; b >>= 1) { if (b & 1)res = res * a;a = a * a; }return res; }

bool mysort(const ll& a, const ll& b) {
    return (abs(a) > abs(b));
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    /* code */
    ll a,b,c,d; cin >> a >> b >> c >> d;
    ll ans = -1e18;
    ans = max(ans,a*c);
    ans = max(ans,a*d);
    ans = max(ans,b*c);
    ans = max(ans,b*d);
    cout << ans << "\n";
    /* end code */
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define INF 1e9
using namespace std;

int N;

int main(void)
{

    cin >> N;

    int ac = 0, wa = 0, tle = 0, re = 0;

    string s;

    rep(i, N)
    {
        cin >> s;

        if (s == "AC")
        {
            ac++;
        }
        else if (s == "WA")
        {
            wa++;
        }
        else if (s == "TLE")
        {
            tle++;
        }
        else if (s == "RE")
        {
            re++;
        }
    }

    cout << "AC x " << ac << endl;
    cout << "WA x " << wa << endl;
    cout << "TLE x " << tle << endl;
    cout << "RE x " << re << endl;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define pb push_back
#define MOD 1000000007

//  ---------------------Template---------------------------
using namespace std;
typedef long long int ll;

void InputSetup()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	#ifdef LOCAL
	freopen("in", "r", stdin);
	freopen("out", "w", stdout);
	#endif
}
//  ---------------------Template---------------------------

void solve()
{
	int n; cin >> n;
	int k = n*(n+1)/2;
	int prime = -1;
	for (int i = 2; i <= n; ++i)
	{
		if (k%i == 0)
		{
			prime = i;
			break;
		}
	}
	int bucket_sum = k/prime;
	int buckets = prime;
	vector<int> v[buckets+1];
	set<array<int, 2>> s;
	for (int i = 0; i < buckets; ++i)
	{
		s.insert({0, i});
	}
	for (int i = n; i >= 1; --i)
	{
		auto it = s.rbegin();
		while (it != s.rend())
		{
			auto x = *it;
			if (x[0] + i <= bucket_sum)
			{
				s.erase(*it);
				if (x[0] + i < bucket_sum) s.insert({x[0] + i, x[1]});
				v[x[1]].pb(i);
				break;
			}
			++it;
		}
	}
	int adj[n+1][n+1];
	for (int i = 0; i < n+1; ++i)
	{
		for (int j = 0; j < n+1; ++j)
		{
			adj[i][j] = 1;
		}
	}
	int edges = 0;
	for (int i = 0; i < buckets; ++i)
	{
		edges += v[i].size() * (n - v[i].size());
		for (auto it : v[i])
		{
			for (auto it2 : v[i])
				adj[it][it2] = 0;
		}
	}
	cout << edges/2 << '\n';
	for (int i = 1; i < n+1; ++i)
	{
		for (int j = i+1; j < n+1; ++j)
		{
			if (adj[i][j]) cout << i << ' ' << j << '\n';
		}
	}
}

int main(void)
{
	auto start = chrono::high_resolution_clock::now();

	InputSetup();
	solve();

	auto finish = chrono::high_resolution_clock::now();
	cerr << "Time elapsed: " << (chrono::duration<long double>(finish-start)).count() << "s\n";
}	

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

using namespace std;
typedef long long ll;

#define out(ans) cout << ans << endl
#define in(n) cin >> n
#define floop(i, N) for (ll i = 0; i < N; i++)
#define floop1(i, N) for (ll i = 1; i <= N; i++)
#define floopi(i, j, N) for (ll j = i + 1; j < N; j++)

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

constexpr ll inf = 1e18;

void solve();

int main()
{
    solve();
}

void solve()
{
    string s;
    in(s);
    int slen = s.size();
    ll ans = 0;

    floop(i, slen / 2)
    {
        if (s[i] != s[slen - i - 1])
            ans++;
    }
    out(ans);
}

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

using namespace std;

#define S scanf
#define P printf
#define G getline
#define SZ size()
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define FI first
#define SE second
#define PI acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB push_back
#define PPF pop_front()
#define PPB pop_back()
#define MP make_pair
#define LL long long int
#define ULL unsigned long long int
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>
#define PLI pair<long long int,int>
#define PLL pair<long long int,long long int>
#define MII map<int,int>
#define MSI map<string,int>
#define MIS map<int,string>
#define MLI map<long long int,int>
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

LL big_mod(LL val,LL pow,LL mod);
LL mod_inverse(LL val,LL mod);
string sum_of_two_strings(string a,string b);





map<char,int>mp;

int main()
{
    FAST();

//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);

    string s;
    cin >> s;
    int cnt=0;
    for(int i=0;i<4;i++)
    {
        if(mp[s[i]] == 0)
        {
            ++cnt;
            mp[s[i]]++;
        }
    }
    if(cnt == 2)
    {
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }
    return 0;
}








LL big_mod(LL val,LL pow,LL mod)
{
    LL res = 1;
    val = val % mod;
    while(pow > 0)
    {
        if(pow & 1)
        {
            res = (res*val) % mod;
        }
        pow = pow >> 1;
        val = (val*val) % mod;
    }
    return res;
}

LL mod_inverse(LL val,LL mod)
{
    LL mod1 = mod;
    if(mod == 1)
    {
        return 0;
    }
    LL y = 0;
    LL x = 1;
    LL quotient,temp;
    while(val > 1)
    {
        quotient = val / mod;
        temp = mod;
        mod = val % mod;
        val = temp;
        temp = y;
        y = x - quotient * y;
        x = temp;
    }
    if(x < 0)
    {
        x += mod1;
    }
    return x;
}

string sum_of_two_strings(string a,string b)
{
    reverse(a.B,a.E);
    reverse(b.B,b.E);
    char c;
    string ans="";
    int length_of_a=a.SZ,length_of_b=b.SZ;
    int i,carry=0,sum,length=max(length_of_a,length_of_b);
    for(i=0; i<length; i++)
    {
        if(i >= length_of_a)
        {
            sum=(b[i]-48)+carry;
        }
        else if(i >= length_of_b)
        {
            sum=(a[i]-48)+carry;
        }
        else
        {
            sum=(a[i]-48)+(b[i]-48)+carry;
        }
        carry=sum/10;
        sum%=10;
        c=sum+48;
        ans+=c;
    }
    if(carry > 0)
    {
        ans+=(carry+48);
    }
    reverse(ans.B,ans.E);
    return ans;
}


Measured memory_bytes: 256
while True:
    line = input().split()
    a = int(line[0])
    op = line[1]
    b = int(line[2])

    if op == "+":
        print(a + b)
    elif op =="-":
        print(a - b)
    elif op =="*":
        print(a * b)
    elif op =="/":
        print(a // b)
    else:
        break





Measured memory_bytes: 5596
#include <stdio.h>

int main()
{
    int h,a;
  scanf("%d %d",&h,&a);
        int i,c=0;
        for(i=1;h>0;i++)
            {
              c=c+1;
              h=h-a;
            }
        printf("%d",c);

    return 0;
}

Measured memory_bytes: 128
// In The Namw Of Allah
#include <bits/stdc++.h>
using namespace std;

const int N = 3e3 + 10;
typedef pair <int, int> pii;
typedef long long ll;

string s[N];
int cnt[2][N], col[N][30], row[N][30];
char t[N][N];

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> s[i];
	int ans = 0;
	for (int k = 0; k < n; k++) {
		bool ok = true;
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				int ii = i, jj = (j + k) % n;
				t[ii][jj] = s[i][j];
			}
		}
		for (int i = 0; i < n; i++)
			for (int j = 0; j < n; j++)
				if(t[i][j] != t[j][i])	ok = 0;
		ans += ok;
	}
	cout << ans * n << "\n";
}

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

using namespace std;
  
int main() {
  int n;
  cin >> n;
  unordered_map<int, int> cnts;
  int arr[n];
  long sum(0);
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
    cnts[arr[i]]++;
  }
  for (const auto& p: cnts) {
    sum += (long) p.second * (p.second - 1) / 2;
  }
  for (int i = 0; i < n; ++i) {
    cout << sum - (cnts[arr[i]] - 1) << '\n';
  }
  return 0;
}

Measured memory_bytes: 8392
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = Long.parseLong(sc.next());
		long m = Long.parseLong(sc.next());
		long c = 0;
		if (n * 2 <= m) {
			c = n;
			m -= n * 2;
		}
		else {
			c = m / 2;
			m = 0;
		}
		c += m / 4;
		System.out.println(c);
	}
}

Measured memory_bytes: 21844
# A
N = int(input())
S = list(input())

LARGE = 10**9 + 7
count_dict = dict()
for i in range(N):
    s = S[i]
    if s in count_dict.keys():
        count_dict[s] += 1
    else:
        count_dict[s] = 1
        
res = 1
for c in count_dict.values():
    res = res*(c+1) % LARGE
    
print((res - 1) % LARGE)

Measured memory_bytes: 3956
#include<iostream>
#include<algorithm>
#include<climits>
#include<cmath>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define scan(arg) cin>>arg
#define prin(arg) cout<<arg<<"\n"
#define prin2(arg1,arg2) cout<<arg1<<" "<<arg2<<"\n"
using namespace std;
typedef long long ll;
const int NMAX=1<<17;
int n,z,w;
int a[2010];
int main(){
  cin>>n>>z>>w;
  rep(i,n){
    scan(a[i]);
  }
  if(n==1){
    prin(abs(a[0]-w));
  }
  else{
    int res=max(abs(a[n-1]-w),abs(a[n-1]-a[n-2]));
    prin(res);
  }

  
  

  return 0;
}


Measured memory_bytes: 256
#include <cstdio>

inline void cmin(int&x, const int&y) {x > y && (x = y);}
inline void cmax(int&x, const int&y) {x < y && (x = y);}

const int N = 2003;
int arr[N], brr[N];
char str[N];
int a[N][N];
int fl[N][N], fr[N][N];
int n, m;

int main() {
	scanf("%d%d",&n,&m);
	scanf("%s", str+1);
	for(int i=1;i<=m;++i) arr[i] = str[i] == '#';
	for(int i=1;i<n;++i) {
		scanf("%s", str+1);
		for(int j=1;j<=m;++j) brr[j] = str[j] == '#';
		for(int j=1;j<m;++j) a[i][j] = !(arr[j] xor arr[j+1] xor brr[j] xor brr[j+1]);
		for(int j=1;j<=m;++j) arr[j] = brr[j];
	}
	
	int Ans = n > m ? n : m; --n, --m;
	for(int i=1;i<=n;++i) {
		for(int j=1;j<=m;++j) if(a[i][j])
			fl[i][j] = fl[i][j-1] + 1;
		for(int j=m;j;--j) if(a[i][j])
			fr[i][j] = fr[i][j+1] + 1;
	}
	
	
	for(int i=0;i<n;++i)
	for(int j=1;j<=m;++j) if(!a[i][j]) {
		int ml = 1e9, mr = 1e9;
		for(int k=i+1;k<=n;++k) {
			if(!a[k][j]) break;
			cmin(ml, fl[k][j]), cmin(mr, fr[k][j]);
			cmax(Ans, (ml+mr) * (k-i+1));
		}
	}
	
	printf("%d\n", Ans);
	return 0;
}

Measured memory_bytes: 47232
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional> 
#define int long long 
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
using namespace __gnu_pbds; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> hashing;
int pow(int x,int n,int mod){int res = 1;while (n){if (n&1){res = (res*x)%mod;n--;}else{x = (x*x)%mod;n/=2;}}return res;}
const int MOD = 1e9 + 7;

/////////////////////////////////////" Please Don't ruin it "//////////////////////////////////////


int32_t main(){

    string s,t;
    cin>>s>>t;

    int n = s.length();
    bool ans = 1;

    for (int i=0;i<n;i++)
        if (s[i]!=t[i]) ans = 0;

    if (ans)
        cout<<"Yes\n";
    else
        cout<<"No\n";

    return 0;

}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
#define MAX 1e9
#define rep(i,n) for(int i=0;i<n;i++)
int main(void){
    int n;
    int count=0;
    cin>>n;
    vector<int> v(n,0);
    rep(i,n){
        cin>>v[i];
    }
    rep(i,n-1){
        if(v[i]==i+1){
            swap(v[i],v[i+1]);
            count++;
        }
    }
    if(v[n-1]==n)count++;
    cout<<count<<endl;
}


Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int x = sc.nextInt();
		int t = sc.nextInt();
		sc.close();

		int aa = n/x;
		if(n%x==0) {
			System.out.println(aa*t);
		}else {
			System.out.println((aa+1)*t);
		}



	}
}


Measured memory_bytes: 35672
#include <iostream>
#include <bitset>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
#include <numeric>
#include <array>
#include <queue>
#include <set>
using namespace std;
using ll = long long int;
#define REP(i,n) for(int i=0;i<n;i++)

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

    vector<int> memo(100, 0);
    REP(i, 4)
    {
        memo[S[i] - 'A']++;
    }

    bool ok = true;
    REP(i, 'Z'-'A'+1)
    {
        if (memo[i] != 0 and memo[i] != 2)
            ok = false;
        
    }

    if (ok)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    
}

Measured memory_bytes: 256
while str = gets do
    a, b, c, d, e, f = str.chomp.split(" ").map(&:to_f)
    y = (c * d - a * f) / (b * d - a * e)
    x = (c - b * y) / a
    puts sprintf("%.3f",x.round(3)) + " " + sprintf("%.3f", y.round(3))
end

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

#define ll long long
#define INF 99999999
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

int main()
{
    int n,k;
    string s;
    cin >> n >> k >> s;
    int tmp;
    vector<int> Nums;
    int ans = 0;

    int now = 1;
    int cnt = 0;

    rep(i,s.size())
    {
        tmp = (int)s[i] - 48;
        if(tmp == now) cnt++;
        else
        {
            Nums.push_back(cnt);
            now = 1 - now;
            cnt = 1;
        }
    }
    if(cnt != 0) Nums.push_back(cnt);

    if(Nums.size() % 2 == 0) Nums.push_back(0);
    
    int Add = 2 * k + 1;

    vector<int> sum(Nums.size() + 1);
    rep(i,Nums.size()) sum[i + 1] = sum[i] + Nums[i];


    for(int i = 0;i < Nums.size();i += 2)
    {
        int left = i;
        int right = min(i + Add,(int)Nums.size());

        int tmp = sum[right] - sum[left];
        ans = max(tmp,ans);
    }
    cout << ans << endl;
}


Measured memory_bytes: 1272
#line 2 "header.hpp"

//%snippet.set('header')%
//%snippet.fold()%
#ifndef HEADER_H
#define HEADER_H

// template version 2.0
using namespace std;
#include <bits/stdc++.h>

// varibable settings
const long long INF = 1e18;
template <class T> constexpr T inf = numeric_limits<T>::max() / 2.1;

#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define _rrep(i, n) rrepi(i, 0, n)
#define rrepi(i, a, b) for (ll i = (ll)((b)-1); i >= (ll)(a); --i)
#define r_rep(...) _overload3(__VA_ARGS__, rrepi, _rrep, )(__VA_ARGS__)
#define each(i, a) for (auto &&i : a)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(...) make_tuple(__VA_ARGS__)
#define ub upper_bound
#define lb lower_bound
#define lpos(A, x) (lower_bound(all(A), x) - A.begin())
#define upos(A, x) (upper_bound(all(A), x) - A.begin())
template <class T> inline void chmax(T &a, const T &b) { if ((a) < (b)) (a) = (b); }
template <class T> inline void chmin(T &a, const T &b) { if ((a) > (b)) (a) = (b); }
template <typename X, typename T> auto make_table(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto make_table(X x, Y y, Z z, Zs... zs) { auto cont = make_table(y, z, zs...); return vector<decltype(cont)>(x, cont); }

#define cdiv(a, b) (((a) + (b)-1) / (b))
#define is_in(x, a, b) ((a) <= (x) && (x) < (b))
#define uni(x) sort(all(x)); x.erase(unique(all(x)), x.end())
#define slice(l, r) substr(l, r - l)

typedef long long ll;
typedef long double ld;
using vl = vector<ll>;
using vvl = vector<vl>;
using pll = pair<ll, ll>;

template <typename T>
using PQ = priority_queue<T, vector<T>, greater<T>>;
void check_input() { assert(cin.eof() == 0); int tmp; cin >> tmp; assert(cin.eof() == 1); }

#if defined(PCM) || defined(LOCAL)
#else
#define dump(...) ;
#define dump_1d(...) ;
#define dump_2d(...) ;
#define cerrendl ;
#endif

#endif /* HEADER_H */
//%snippet.end()%
#line 2 "solve.cpp"
template<class T=ll> using vec = vector<T>;
struct Fast { Fast() { std::cin.tie(0); ios::sync_with_stdio(false); } } fast;


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

    vec<int> ans(10001);
    rep(x, 1, 101){
        rep(y, 1, 101){
            rep(z, 1, 101){
                int v = x*x+y*y+z*z+x*y+y*z+z*x;
                if (v<=10000) ans[v]++;
            }
        }
    }

    rep(i, 1, n+1){
        cout << ans[i] << endl;
    }

    return 0; 
}


int main(){/*{{{*/
    solve();
    check_input();
    return 0;
}/*}}}*/


Measured memory_bytes: 3652
/*input
HASFJGHOGAKZZFEGA
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}

//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}
int main()
{
	IOS;
	string s;
	cin>>s;

	int pre=-1;
	int ans=0;
	REP(i,SZ(s)){
		if(s[i]=='A'&&pre==-1) pre=i;
		else if(s[i]=='Z'){
			if(pre>-1){
				ans=max(ans,i-pre);
			}
		}
	}
	cout<<ans+1<<'\n';
	return 0;
}


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

int main() {
  string s,t;
  cin >> s >> t;
  if(s.size() + 1 == t.size()) {
    for(int i=0; i<s.size(); i++) {
      if(s.at(i) == t.at(i)) {
        if(i != s.size()-1)
          continue;
      cout << "Yes" << endl;
      }
      else {
        cout << "No" << endl;
        break;
      }
    }
  }
  else
    cout << "No" << endl;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define re return
#define ll long long
#define ld long double
#define f first
#define s second
#define pi acos(-1)
#define oo (int)1e9
#define OO (ll)1e18
#define EPS 1e-7
#define FX(n) fixed<<setprecision(n)
#define mm(o,k) memset(o,k,sizeof o)
#define IO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
const int maxn=105;
int c[3][3],ok;
void check(int a0,int a1,int a2){
    int a[]={a0,a1,a2};
    int b[]={c[0][0]-a0,c[0][1]-a0,c[0][2]-a0};
    for(int i=0;i<3;++i)
        for(int j=0;j<3;++j)
            if(c[i][j]!=a[i]+b[j])re ;
    ok=true;
}
int main()
{
    IO;
    for(int i=0;i<3;++i)
        for(int j=0;j<3;++j)
            cin >> c[i][j];
    for(int a0=0;a0<=100;++a0)
        for(int a1=0;a1<=100;++a1)
            for(int a2=0;a2<=100;++a2)
                check(a0,a1,a2);
    if(ok)puts("Yes");
    else puts("No");
    re 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
int n;
  scanf("%d",&n);
  long h[n];
  for(int i=0;i<n;i++){
	scanf("%ld",&h[i]);
  //  printf("%d",h[i]);
  }
  int c=0,max=0;
  for(int i=0;i<n-1;i++){
     //printf("%ld\n",h[i]);
    	if(h[i]>=h[i+1]){
          //printf("%ld %ld\n",h[i],h[i+1]);
		c++;
        }
    	else {//printf("aa\n");
              if(c>max)max=c;
              c=0;
             }
        }
  if(c>max)max=c;
printf("%d",max);
    return 0;
  }

Measured memory_bytes: 896
#include<bits/stdc++.h>
#define MAX_N 100001
#define INF_INT 2147483647
#define INF_LL 9223372036854775807
#define REP(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
const int MOD = 1000000007;

int main()
{
  int x;
  cin >> x;
  cout << (x < 1200 ? "ABC" : "ARC")<< endl;
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    int L, R;
    cin >> L >> R;

    if(R-L+1 >= 2019){
        cout << 0 << endl;
        return 0;
    }
    // L %= 2019;
    // R %= 2019;
    long long ans = 2020;
    long long tmp;
    for(long long i = L; i < R; ++i){
        for(long long j = i+1; j <= R; ++j){
            tmp = (i*j)%2019;
            if(tmp < ans){
                ans = tmp;
            }
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <map>
const int MOD = 1e9+7;
typedef long long ll;
using namespace std;

int main(){
	int n;
	ll sum1 = 0, sum2 = 0;
	cin >> n;
	vector<ll> a(n+1);
	vector<ll> r(n+1);
	for (int i = 1; i <= n; i++){
		cin >> a[i];
		sum1 += a[i];
	}
	for (int i = 2; i <= n-1; i+=2){
		sum2 += a[i];
	}
	r[1] = sum1 - 2*sum2;

	for (int i = 2; i <= n; i++){
		r[i] = 2*a[i-1] - r[i-1];
	}

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

Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c;
  cin>>a>>b;
  if(a<b){
    c = 2*b-1;
    cout << c<<endl;
  }
  else if (b < a){
    c = 2 *a-1;
    cout << c <<endl;
  }
  else if(a=b){
    c = b + a;
    cout << c <<endl;
  }
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(1000000)

N = int(input())

G = {k: [] for k in range(N+1)}
for _ in range(N-1):
    a, b = map(int, input().split())
    # 無向グラフ
    G[a].append(b)
    G[b].append(a)


def dfs(v, p, c, distance):  # 現在の頂点v, vの親p, 現在の距離c
    distance[v] = c
    for nv in G[v]:
        if visited[nv] is False:
            if nv == p:
                continue
            dfs(nv, v, c+1, distance)
    return


distance_f = [-1]*(N+1)
visited = [False] * (N+1)
dfs(1, -1, 0, distance_f)

distance_s = [-1]*(N+1)
visited = [False] * (N+1)
dfs(N, -1, 0, distance_s)

# print(distance_f)
# print(distance_s)

c = 0
for i in range(2, N):
    if distance_f[i] <= distance_s[i]:
        c += 1
    elif distance_f[i] > distance_s[i]:
        c -= 1

if c > 0:
    print('Fennec')
elif c <= 0:
    print('Snuke')


Measured memory_bytes: 127460
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define repi(i,a,b) for(int i = (a);i < (b); i++)
#define rep(i,a) repi(i,0,a)
#define repd(i,a,b) for(int i = (a); i >= (b); i--)
#define repit(i,a) for(__typeof((a).begin()) i = (a).begin(); i != (a).end(); i++)

#define all(u) (u).begin(),(u).end()
#define rall(u) (u).rbegin(),(u).rend()
#define UNIQUE(u) (u).erase(unique(all(u)),(u).end())

#define pb push_back
#define mp make_pair
#define INF 1e9
#define EPS 1e-9
#define PI acos(-1.0)

using namespace std;

typedef long long ll;
typedef vector<int> vi;

char trump;
char lead;
struct card {
  int id;
  int num;
  char mark;
  bool operator<(const card &o) const {
    if(mark == trump) {
      if(o.mark == trump) return num < o.num;
      return false;
    } 
    if(o.mark == trump) return true;
    if(mark != lead && o.mark == lead) return true;
    if(mark == lead && o.mark != lead) return false;
    return num < o.num;
  }
};

int main(){
  map<char, int> tbl;
  tbl['A'] = 14;
  tbl['2'] = 2;
  tbl['3'] = 3;
  tbl['4'] = 4;
  tbl['5'] = 5;
  tbl['6'] = 6;
  tbl['7'] = 7;
  tbl['8'] = 8;
  tbl['9'] = 9;
  tbl['T'] = 10;
  tbl['J'] = 11;
  tbl['Q'] = 12;
  tbl['K'] = 13;

  while(cin >> trump, trump != '#') {
    vector<vector<card> > cards(13);
    rep(i, 13) cards[i].resize(4);
    rep(j, 4) rep(i, 13) {
      string ts;
      cin >> ts;
      cards[i][j] = (card){j, tbl[ts[0]], ts[1]};
    }
    
    int leader = 0;
    int ew = 0;
    int ns = 0;
    rep(i, 13) {
      vector<card> v;
      lead = cards[i][leader].mark;
      rep(j, 4) v.pb(cards[i][j]);
      sort(all(v));
      if(v[3].id == 0 || v[3].id == 2) {
	ns++;
      } else {
	ew++;
      }
      //      cout << v[3].id<< " ";
      leader = v[3].id;
    }
    if(ns > ew) cout << "NS ";
    else {
      swap(ns, ew);
      cout << "EW ";
    }

    cout << ns - 6 << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1212
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
typedef pair<int, int> P;
const int inf = 1<<30;
int dist[100010][3];

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  int N, M; cin >> N >> M;
  vector<vector<int>> to(N);
  for(int i = 0; i < M; i++) {
    int a, b; cin >> a >> b;
    a--, b--;
    to[a].push_back(b);
  }

  for(int i = 0; i < N; i++) {
    for(int j = 0; j < 3; j++) {
      dist[i][j] = inf;
    }
  }

  int S, T; cin >> S >> T; S--, T--;
  queue<P> q;
  q.push(P(S, 0));
  dist[S][0] = 0;
  while(!q.empty()) {
    int v = q.front().first;
    int l = q.front().second;
    q.pop();
    for(int u : to[v]) {
      int nl = (l+1) % 3;
      if(dist[u][nl] != inf) continue;
      dist[u][nl] = dist[v][l] + 1;
      q.push(P(u, nl));
    }
  }
  int ans = dist[T][0];
  if(ans == inf) ans = -1;
  else ans /= 3;
  cout << ans << endl;
  return 0;
}


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

using namespace std;
int n , h[100000] , dp[100000] , k;
int main()
{
cin >> n >>k ;
for(int i = 0 ; i < n ; i++){
    cin >> h[i] ;
}
dp[0] = 0 ;
for(int i =1 ; i <= k ; i++){
        dp[i] = dp[i-1]+abs(h[i]-h[i-1]) ;
    for(int j =2 ; j <= i ; j++){
        dp[i] = min( dp[i] , dp[i-j]+abs(h[i]-h[i-j]) ) ;
    }
}
for(int i =k+1 ; i < n ; i++){
    dp[i] = dp[i-1]+abs(h[i]-h[i-1]) ;
    for(int j = 2 ; j <= k ; j++ ){
        dp[i] = min(dp[i] , dp[i-j]+abs(h[i] -h[i-j]) ) ;
    }
}
cout << dp[n-1] ;
    return 0;
}


Measured memory_bytes: 1024
from math import factorial
N, K = map(int, input().split())

# 逆元を利用した組み合わせの計算
#############################################################
def cmb(n, r, mod):
    if (r < 0 or r > n):
        return 0
    r = min(r, n - r)
    return g1[n] * g2[r] * g2[n - r] % mod

mod = 10**9 + 7
NN = 2500

g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]

for i in range(2, NN + 1):
    g1.append((g1[-1] * i) % mod)
    inverse.append((-inverse[mod % i] * (mod // i)) % mod)
    g2.append((g2[-1] * inverse[-1]) % mod)
#############################################################
"""
x_1 + x_2 + ... x_k = n
x_i >= 0
k個の箱にn個のボールを入れる重複組み合わせ　n+k-1_C_k-1
n個の玉とk-1個の仕切りを並べる

x_1 + x_2 + ... x_k = n
x_i >= 1
k個の箱にn個のボールを1個以上入れる重複組み合わせ　n-1_C_k-1
n個の玉の仕切りn-1個の中に、k-1箇所仕切りを入れる
"""

"""
まず赤だけ並べ、赤の間、左端、右端のN-K+1箇所から、i箇所を選ぶ -> N-K+1_C_i
選んだi箇所について、青を1個以上配置する -> 青の間K-1箇所からi-1箇所選ぶ -> K-1_C_i-1
"""

# i = 1,2,...,K
for i in range(1, K + 1):
    # まず赤だけ並べ、赤の間、左端、右端のN-K+1箇所から、i箇所を選ぶ
    c1 = cmb(N - K + 1, i, mod)
    # i箇所について、青を1個以上配置する、青の間K-1箇所からi-1個選ぶ
    c2 = cmb(K - 1, i - 1, mod)

    ans = (c1 * c2) % mod
    print(ans)


Measured memory_bytes: 73564
#include<bits/stdc++.h>
using namespace std;
int n;
int a[2010];
int main(){
	cin>>n;
	for(int i=0;i<n;i++)cin>>a[i];
	sort(a,a+n);
	long long cnt=0;
	for(int i=0;i<n-2;i++){
		for(int j=i+1;j<n-1;j++){
			int y=upper_bound(a,a+n,a[i]+a[j]-1)-a;
			if(y==j)y--;
			cnt+=max(0,y-(j+1));
		}
	}
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 256
#AGC040-A
s = list(input())

ans = [0 for _ in range(len(s)+1)]

for i in range(len(s)):
    if s[i] == '<':
        ans[i+1] = ans[i]+1

for j in range(len(s)-1,-1,-1):
    if s[j] == '>':
        tmp = ans[j+1] + 1
        if tmp > ans[j]:
            ans[j] = tmp
                
print(sum(ans))

Measured memory_bytes: 27700
#include<bits/stdc++.h>
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int mod = 1000000007;
const int INF = 1001001001;

int main() {
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  rep(i, n) cin >> a[i];
  rep(i, n) cin >> b[i];

  ll cost = 0;
  int ans = 0;

  rep(i, n) {
    if (a[i] < b[i]) {
      cost -= a[i] - b[i];
      ans++;
    }
    
  }

  vector<int> stock;
  rep(i, n) if (a[i] > b[i]) stock.push_back(a[i] - b[i]);

  int m = stock.size();
  sort(stock.rbegin(), stock.rend());
  // cout << cost << endl;

  rep(i, m) {
    if (cost <= 0) break;
    cost -= stock[i];
    ans++;
  }
  if (cost > 0) ans = -1;

  cout << ans << endl;

}

Measured memory_bytes: 4380