akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define ALL(a) (a).begin(),(a).end()
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

using namespace std;

int main(){
  ll n;
  cin >> n;
  int ct = 0;
  while(n>1){
    n = ceil((double)n / 3);
    ct++;
  }
  cout << ct << endl;
  return 0;
}

Measured memory_bytes: 3072
#include <iostream>
#include <vector>
#include <iomanip>
#include <cmath>

using namespace std;

const double EPS = 1e-8;

int dcmp(double d) {
    if (fabs(d) < EPS) {
        return 0;
    } else {
        return d < 0 ? -1 : 1;
    }
}

struct Vector {
    double x, y;

    Vector(double x = 0, double y = 0) : x(x), y(y) {
    }
    
    bool operator<(const Vector& other) const {
        return dcmp(x - other.x) < 0 || (dcmp(x - other.x) == 0 && dcmp(y - other.y) < 0);
    }
};

typedef Vector Point;

Vector operator-(const Vector& a, const Vector& b) {
    return Vector(a.x - b.x, a.y - b.y);
}

Vector operator+(const Vector& a, const Vector& b) {
    return Vector(a.x + b.x, a.y + b.y);
}

Vector operator*(const Vector& a, const double& p) {
    return Vector(a.x * p, a.y * p);
}


double dot(const Vector& a, const Vector& b) {
    return a.x * b.x + a.y * b.y;
}

double length(const Vector& a) {
    return sqrt(dot(a, a));
}

double cross(const Vector& a, const Vector& b) {
    return a.x * b.y - a.y * b.x;
}

double ccw(const Point& a, const Point& b, const Point& c) {
    return cross(b - a, c - a);
}


Point lineIntesection(const Point& p, const Vector& v, const Point& q, const Vector& w) {
    Vector u = p - q;
    return p + v * (cross(w, u) / cross(v, w)); 
}


double area2(vector<Point>& p) {
    double area = 0;
    int n = p.size();
    for (int i = 1; i < n - 1; i++) {
        area += ccw(p[0], p[i], p[i+1]);
    }
    return area;
}

vector<Point> convexCut(const vector<Point>& p,const Point& a, const Point& b){
    vector<Point> res;
    int n = p.size();
    for(int i = 0 ; i < n ; i++){
        Point cp = p[i];
        Point np = p[(i + 1) % n];
        
        if (dcmp(ccw(a, b, cp)) >= 0) {
            res.push_back(cp);
        }
        if (dcmp(ccw(a, b, cp)) * dcmp(ccw(a, b, np)) < 0){
            res.push_back(lineIntesection(a, b - a, cp, np - cp));
        }
    }
    return res;
}



int main() {
    int n;
    cin >> n;
    vector<Point> p(n);
    for (int i = 0; i < n; i++) {
        cin >> p[i].x >> p[i].y;
    }
    
    int q;
    cin >> q;
    
    for (int i = 0; i < q; i++) {
        double x1, y1, x2, y2;
        cin >> x1 >> y1 >> x2 >> y2;
        Point a(x1, y1), b(x2, y2);
        
        vector<Point> newP = convexCut(p, a, b);
    
        cout << fixed << setprecision(8) << area2(newP) / 2 << endl;
    }

    return 0;
}

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

using namespace std;
#define ll long long
#define ld long double
#define PI 3.14159265358979323846264338327950L
const int INF = 1001001001;
const int N=2e5 + 5;
const ll mod = 1e9 + 7;

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

vector<int> adj[N];

int main()
{
    ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL);
    int k;
    string s;
    cin >> k >> s;
    int n = s.length();
    if(n <= k) cout << s << endl;
    else {
        cout << s.substr(0, k) + "..." << endl;
    }
    return 0;
}


Measured memory_bytes: 8328
import java.util.Scanner;

public class Main {

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

		Scanner sc =new Scanner(System.in);

		int a=sc.nextInt();
		int b=sc.nextInt();
		
		if(b==1) {
			System.out.println(0);
			return;
		}
		System.out.println((b-2)/(a-1)+1);






	}


}




Measured memory_bytes: 24020
# frozen_string_literal: true

m, d = gets.chomp.split(' ').map(&:to_i)

count = 0

(2..m).each do |month|
  (10..d).each do |day|
    day_split = day.to_s.scan(/./).map(&:to_i)
    next if day_split.include?(1)

    day_mul = 1
    day_split.each do |i|
      day_mul *= i
    end

    count += 1 if day_mul == month
  end
end

print count


Measured memory_bytes: 1916
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) 
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long c = sc.nextLong(); //circumference
		long[] x = new long[n];
		long[] v = new long[n];
		
		for(int i = 0; i < n; i++)
		{
			long pos = sc.nextLong();
			long val = sc.nextLong();
			
			x[i] = pos;
			v[i] = val;
		}
		
		long max = 0;
		long[] str = new long[n]; //if straight right into
		long[] maxstr = new long[n]; //if straight right into
		long cur = 0;
		for(int i = 0; i < n; i++)
		{
			cur += v[i];
			str[i] = cur - x[i];
			if(i>0)maxstr[i] = Math.max(maxstr[i-1], str[i]);
			else maxstr[i] = str[i];
			
			max = Math.max(max, str[i]);
		}
//		System.out.println(Arrays.toString(maxstr));
		
		long[] stl = new long[n]; //if straight left into
		long[] maxstl = new long[n]; //if straight left into
		cur = 0;
		for(int i = n-1; i >= 0; i--)
		{
			cur += v[i];
			stl[i] = cur - (c-x[i]);
			if(i<n-1)maxstl[i] = Math.max(maxstl[i+1], stl[i]);
			else maxstl[i] = stl[i];
			
			max = Math.max(max, stl[i]);
		}
		
		for(int i = 0; i < n-1; i++)
		{ //straight to here, then turn back!
			cur = str[i] + maxstl[i+1] - x[i];
			if(cur > max)
			{
				max = cur;
//				System.out.println("A Does " + cur + " at " + i);
			}
		}
		
		for(int i = n-1; i > 0; i--)
		{ //straight to here, then turn back!
			cur = stl[i] + maxstr[i-1] - (c-x[i]);
			if(cur > max)
			{
				max = cur;
//				System.out.println("B Does " + cur + " at " + i);
//				System.out.println(stl[i] + " " + maxstr[i-1] + " " + (c-x[i]));
			}
		}
		
		System.out.println(max);
	}

}


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

#define M 1000000
#define L 14

int insert(char *);
int find(char *);
int h2(int);
int h1(int);
long long getKey(char *);
int getChar(char);

char H[M][L]; 

int main(){
  static int cnt=0;
  int i, n, h;
  char str[L], com[9],*result1[M];
  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)){
	cnt++;
	result1[cnt-1]="yes";}
      else {
        cnt++;
	result1[cnt-1]="no";
      }
    }
  }
  for(i=0;i<cnt;i++){
    printf("%s\n",result1[i]);
  }
  return 0;
}


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


long long getKey(char str[]){
  long long sum = 0, p = 1, 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[]){
  long long key,j,h;
  key = getKey(str);
  for(j = 0;; j++){
    h = (h1(key) + j * h2(key)) % M;
    if(strcmp(H[h],str) == 0) return 1;
    else if(strlen(H[h]) == 0) return 0;
  }

}

int insert(char str[]){
  long long key,j,k;
  key = getKey(str);
  for(j = 0;; j++){
    k = (h1(key) + j * h2(key)) % M;
    if(strcmp(H[k],str) == 0) return 1;
    else if( strlen(H[k]) == 0){
      strcpy(H[k],str);
      return 0;
    }
  }
}


Measured memory_bytes: 18760
#include<iostream>

using namespace std;

int main(){

	string c;

	cin >> c;

	if(c[0] == 'a' || c[0] == 'i' || c[0] == 'u' || c[0] == 'e' || c[0] == 'o'){
		cout << "vowel" << endl;
	}else{
		cout << "consonant";
	}


	return 0;

}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int i=1;
        int j = sc.nextInt();
        while(j!=0){
            System.out.println("Case " + i + ": " + j);
            j = sc.nextInt();
            i++;
        }
    }
}


Measured memory_bytes: 42564
/*input

*/

#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <math.h>
#include <iomanip>
#include <utility>
#include <iostream>
#include <string.h>
#include <stdlib.h>
#include <algorithm>

using namespace std;
using ll = long long;
using ld = long double;

ll MOD = 1000000007;
const int SINF = 1000000009;
const ll INF =  1000000000000000018;

#define sp          cout << " "
#define nl          cout << "\n"
#define inv(a)      powr((a), (MOD - 2))
#define all(c)      (c).begin(),(c).end()
#define rep(i,a,b)  for(ll i = (a); i < (b); i ++)
#define prec(n)     cout << fixed << setprecision(n)
#define PI          3.14159265358979323846264338327951
#define ifalse      ios_base::sync_with_stdio(false), cin.tie(NULL)

template<typename T> void toInt(string s, T &a) { istringstream(s) >> a; }
ll gcd(ll a, ll b) { ll t; while(a) { t = a; a = b%a; b = t; } return b; }
ll sub(ll a, ll b) { a -= b; a = (a + MOD) % MOD; return a; }
ll mul(ll a, ll b) { return ((a % MOD) * (b % MOD)) % MOD; }
ll add(ll a, ll b) { a += b; a %= MOD; return a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a, b); }

ll powr(ll a, ll b) {
  ll x = 1LL;
  while(b) {
    if(b & 1) x = mul(x, a);
    a = mul(a, a), b >>= 1;
  }
  return x;
}

bool check(ll n)
{
  if(n == 1) return 0;
  if(n == 2 or n == 3) return 1;
  if(n%2 == 0 or n%3 == 0) return 0;
  for(ll i = 5; i*i <= n; i += 6) if(n%i == 0 or n % (i+2) == 0) return 0;
  return 1;
}

/*********************************START**********************************/
const int N = 100005;

int main()
{
  ifalse;
  int x, a;
  cin >> x >> a;
  int ans = 0;
  if(x < a) {
    ans = 0;
  } else {
    ans = 10;
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FIO ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define DEBUG(x)           cout << '>' << #x << ':' << x << endl;
#define forn(i,n)          for(int i=0;i<(int)n;++i)
#define for1(i,n)          for(int i=1;i<=(int)n;++i)
#define forr(i,n)          for(int i=(int)n-1;i>=0;--i)
#define forre(i,a,b)       for(int i=(int)b;i>=(int)a;--i)
#define fore(i,a,b)        for(int i=(int)a;i<=(int)b;++i)
#define input(arr,n)       for(int i=0;i<n;i++)cin>>arr[i]
#define output(arr,n)      for(int i=0;i<n;i++)cout<<arr[i]<<" "
#define for_each(arr)      for(auto& it:arr)cout<<it<<" "
#define ff                 first
#define ss                 second
#define PI                 acos(-1.0)
#define all(a)             a.begin(),a.end()
#define rall(a)            a.rbegin(),a.rend()
#define Unique(a)          sort(all(a)),a.erase(unique(all(a)),a.end())
#define pb(x)              push_back(x)
#define eb(x)              emplace_back(x) 
#define ppb(x)             pop_back(x)
#define pf(x)              push_front(x)
#define ppf(x)             pop_front(x)
#define in(x,y)            insert({x,y})
#define Sort(a)            sort(a.begin(),a.end())
#define mem(arr,a)         memset(arr,a,sizeof arr)
#define ins(a)             insert(a)
#define max2(a,b)          max(a,b)
#define max3(a,b,c)        max(a,max(b,c))
#define max4(a,b,c,d)      max(a,max3(b,c,d))
#define min2(a,b)          min(a,b)
#define min3(a,b,c)        min(a,min(b,c))
#define min4(a,b,c,d)      min(a,min3(b,c,d))
typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<char> vc;
typedef vector<double> vd;
/*inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void Set(int & n, int b) { n |= two(b); }
inline void Reset(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }*/
/*int fx1[]={+1,-1,+0,+0};
int fy1[]={+0,+0,+1,-1};
int fx2={+0,+0,+1,-1,-1,+1,-1,+1};
int fy2={-1,+1,+0,+0,+1,+1,-1,-1};
*/

ll a,b,c,n,ans,cn1,cn2,cn3,t;
string s,s1,s2;


int main()
{
    FIO;
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif*/
    
    cin>>a>>b;
    for(int i=0;i<a;i++){
    	cin>>c;
    	if(c>=b)++cn1;
    }
    cout<<cn1<<endl;

    
   	
    #ifdef ONLINE_JUDGE
    cerr<<"Time elapsed: "<<1.0*clock()/CLOCKS_PER_SEC<<"s.\n";
    #endif
   return 0;
}
 


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	int N, A[100], i, j, min, temp, num = 0;
	cin >> N;
	for (i = 0; i < N; i++)
		cin >> A[i];
	for (i = 0; i < N; i++)
	{
		min = i;
		for (j = i; j < N; j++)
			if (A[j] < A[min])
				min = j;
		if (min != i)
		{
			temp = A[i];
			A[i] = A[min];
			A[min] = temp;		
			num++;
		}
	}
	for (i = 0; i < N - 1; i++)
		cout << A[i] << ' ';
	cout << A[N - 1] << endl;
	cout << num << endl;
	return 0;
}


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

using namespace std;
typedef long long ll;

ll N;
vector<ll> C;
ll MOD = 1e9+7;

int main(){
    cin >> N;
    for(int i=0;i<N;i++){
        ll c;
        cin >> c;
        C.push_back(c);
    }
    sort(C.rbegin(), C.rend());
    ll ans = 0;
    ll t = 1;
    for(int i=0;i<N-1;i++){
        t *= 2;
        t %= MOD;
    }
    for(int i=0;i<N;i++){
        ll p = t * t;
        p %= MOD;
        p *= ll(i+2);
        p %= MOD;
        ans += p * C[i];
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2420
#include <stdio.h>
 
int main() {
  int a[101][101] = {0};
  int b[101] = {0};
  int d[101] = {0};
  int i,j,r,c;
  int x;
  int e = 0;
 
  scanf("%d %d" , &r,&c);
 
  for(j=0; j<r; j++) {
    for(i=0; i<c; i++) {
      scanf("%d",&x);
      a[j][i] = x;
    }
  }
 
  for(j=0; j<r; j++){
    for(i=0; i<c; i++) {
      b[i] += a[j][i];
    }
  }
 
  for(j=0; j<r; j++){
    for(i=0; i<c; i++){
      d[j] += a[j][i];
    }
  }
 
  for(j=0; j<r; j++) {
    for(i=0; i<c; i++) {
      printf("%d ",a[j][i]);
    }
    printf("%d\n", d[j]);
  }
  for(i =0; i<c; i++) {
    printf("%d " ,b[i]);
    e += b[i];
  }
  printf("%d\n", e);
 
  return 0;
}


Measured memory_bytes: 2132
#include <iostream>
#include <vector>
#include <string>

#define mod 1000000007

using namespace std;

int main(void)
{
	int N, M;
	unsigned long long int ans = 1;

	cin >> N >> M;

	if (abs(N-M)>1) {
		cout << "0" << endl;
		return 0;
	}

	if (!abs(N-M)) ans = 2;

	for (int i = 1; i <= N; i++) {
		ans *= i;
		ans = ans%mod;
	}
	for (int i = 1; i <= M; i++) {
		ans *= i;
		ans = ans%mod;
	}

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

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

int search(int A[], int n, int key){
	A[n] = key;
	int i = 0;
	while (A[i] != key){
		i++;
	}
	return i != n;
}

int main(){
	int A[10001], q, n, key, cnt=0;
	
	scanf("%d", &n);

	for (int i=0; i<n; i++){
		scanf("%d", &A[i]);
	}

	scanf("%d", &q);
	for (int i=0; i<q; i++){
		scanf("%d", &key);
		if (search(A, n, key)) cnt++;
	}
	printf("%d\n", cnt);

	return 0;
}

Measured memory_bytes: 1224
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <iomanip>
#include <random>
#include <complex>
#include <functional>
#include <tuple>
#include <new>

using namespace std;

#define EPS (1e-9)
#define INF (1e9)
#define MOD (ll)(1e9 + 7)
#define PI (acos(-1))
#define REP(i,a,n) for(int i=a;i<n;i++)
#define rep(i, n) REP(i,0,n)
#define allof(a) (a).begin(), (a).end()

#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" ; "IMPOSSIBLE")

using ll = long long int;

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

ll beki(ll a, ll b) {
    ll tmp = 1;
    rep(i, b) tmp *= a;
    return tmp;
}

ll modPow(ll x, ll a) {
    if (a == 1) return x;
    if (a % 2) return (x * modPow(x, a - 1)) % MOD;
    ll t = modPow(x, a / 2);
    return ((t % MOD) * (t % MOD)) % MOD;
}

ll modInv(ll x) {
    return modPow(x, MOD - 2);
}

int N;
int a[200010];
int sum = 0;

int main() {
    cin >> N;
    rep(i, N) {
        cin >> a[i];
    }

    rep(i, N) {
        sum ^= a[i];
        //cout << sum << endl;
    }

    rep(i, N) {
        cout << (sum ^ a[i]) << " ";
    }
}

Measured memory_bytes: 4368
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            int[] Arr = cin.ReadIntArray(2);
            int H = Arr[0];
            int A = Arr[1];
            int count = 0;
            for(int i = 0; H > 0; i++)
            {
                H = H -= A;
                count++;
            }
            Console.WriteLine(count);
        }   





    }


    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
        public double[] ReadDoubleArray(long N) { var ret = new double[N]; for (long i = 0; i < N; ++i) ret[i] = ReadDouble; return ret; }
    }
}


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

#include <math.h>
#include <stdlib.h>


#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

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

// const int INF = 1001001001;
// long long max => LLONG_MAX

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int a, b; 
    cin >> a >> b;
    if (a == b) cout << "Draw" << endl;

    else if(a == 1) cout << "Alice" << endl;
    else if(b == 1) cout << "Bob" << endl;
    else if(a > b) cout << "Alice" << endl;
    else cout << "Bob" << endl;

    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/**
 * for (int i = 0; i < N; i++) {}
 * System.out.println();
 * HashMap<Integer, Integer> hm = new HashMap<>();
 * int[] s = new int[M];
 * ArrayDeque<Integer> deq = new ArrayDeque<>();
 *
 */
public class Main implements Runnable { //クラス名はMain1

	public static void main(String[] args) {
		Thread.setDefaultUncaughtExceptionHandler((t, e) -> System.exit(1));
		new Thread(null, new Main(), "", 1024 * 1024 * 1024).start(); //16MBスタックを確保して実行
	}

	public void run() {
		FastScannerMain1 sc = new FastScannerMain1(System.in);

		try {
			//String S = sc.nextLine().trim();
			int N = sc.nextInt();
			int M = sc.nextInt();
			//int[] a = new int[N];
			//long l = sc.nextLong();
			//ArrayList<Integer> arr = new ArrayList<Integer>();
			//for (int i = 0; i < N; i++) {}

			long ans1 = 0;
			long ans2 = 0;
			if (N >= 2) {
				ans1 = calcCombination(N, 2);
			}
			if (M > 2) {
				ans2 = calcCombination(M, 2);
			}

			System.out.println(ans1 + ans2);

		} catch (Exception e) {
			e.printStackTrace();
		}

	}

	long calcCombination(int n, int m) {
		if (n < m || m < 0) {
			throw new IllegalArgumentException("引数の値が不正です ( n : " + n + ", m : " + m + ")");
		}
		long c = 1;
		m = (n - m < m ? n - m : m);
		for (int ns = n - m + 1, ms = 1; ms <= m; ns++, ms++) {
			c *= ns;
			c /= ms;
		}
		return c;
	}
}

//高速なScanner
class FastScannerMain1 {
	private BufferedReader reader = null;
	private StringTokenizer tokenizer = null;

	public FastScannerMain1(InputStream in) {
		reader = new BufferedReader(new InputStreamReader(in));
		tokenizer = null;
	}

	public String next() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public String nextLine() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken("\n");
	}

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

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

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

	public int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = nextInt();
		return a;
	}

	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nextLong();
		return a;
	}
}


Measured memory_bytes: 30420
N = int( input() )
S = [ input() for i in range(N) ]

initial = ['M', 'A', 'R', 'C', 'H']
sum_initials = [0]*5
for Si in S:
    for i in range(5):
        if Si[0] == initial[i]:
            sum_initials[i] += 1

sum_short = []
for i in range(5):
    if sum_initials[i] != 0: sum_short.append(sum_initials[i] )

ans = 0
if len( sum_short ) == 3:
    ans = sum_short[0]*sum_short[1]*sum_short[2]
elif len( sum_short ) == 4:
    for i in range(4):
        ans += sum_short[i]*sum_short[i-1]*sum_short[i-2]
elif len( sum_short ) == 5:
    for i in range(5):
        for j in range(i+1,5):
            for k in range(j+1,5):
                ans += sum_short[i]*sum_short[j]*sum_short[k]
print( ans )

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

int main()
{
	int n;cin>>n;
	for(int i=1;i<10;i++)
	for(int j=1;j<10;j++)
	if(i*j==n){
		cout<<"Yes"<<endl;
		return 0;
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<complex>
#include<vector>
#include<limits>
#include<algorithm>
using namespace std;
typedef complex<double> xy_t;
typedef vector<xy_t> Polygon;

constexpr double eps=numeric_limits<double>::epsilon();
double x,y;
int n;
Polygon p_set,convex;


double dot(xy_t a,xy_t b){
    return a.real()*b.real()+a.imag()*b.imag();
}

double cross(xy_t a,xy_t b){
    return a.real()*b.imag()-a.imag()*b.real();
}

int ccw(xy_t p0,xy_t p1,xy_t p2){
    /*
    counter clockwise:1
    clockwise:-1
    online back:2
    online front:-2
   */
    xy_t line1=p1-p0;
    xy_t line2=p2-p0;
    if(cross(line1,line2)>eps) return 1;
    else if(cross(line1,line2)<-eps) return -1;
    else if(dot(line1,line2)<-eps) return 2;
    else if(norm(line1)>norm(line2)) return -2;
    return 0;
}

bool myway(xy_t a,xy_t b){
    if(a.real()==b.real()){
        return a.imag()<b.imag();
    }
    return a.real()<b.real();
}

void print(Polygon a){
    cout<<a.size()<<endl;
    for(int i=0;i<a.size();++i){
        x=a[i].real();
        y=a[i].imag();
        cout<<x<<" "<<y<<endl;
    }
}

Polygon andrew(Polygon p){
    Polygon upper,lower;
    
    if(p.size()<3) return p;
    
    sort(p.begin(),p.end(),myway);
    upper.push_back(p[0]); upper.push_back(p[1]);
    lower.push_back(p[p.size()-1]); lower.push_back(p[p.size()-2]);

    for(int i=2;i<p.size();++i){
        
        for(int j=upper.size()-1;j>=1;--j){
            if(ccw(upper[j-1],upper[j],p[i])!=1){
                break;
            }
            else upper.pop_back();
        }
        for(int j=lower.size()-1;j>=1;--j){
            if(ccw(lower[j-1],lower[j],p[p.size()-i-1])!=1){
                break;
            }
            else lower.pop_back();
            
        }
        
        upper.push_back(p[i]);
        lower.push_back(p[p.size()-i-1]);
    }

    reverse(lower.begin(),lower.end());
    for(int i=upper.size()-2;i>=1;--i){
        lower.push_back(upper[i]);
    }
    
    Polygon ans;
    double min=10100.0;
    int min_index;
    for(int i=0;i<lower.size();++i){
        if(lower[i].imag()<min){
            min=lower[i].imag(); min_index=i;
        }
    }
    
    for(int i=0;i<lower.size();++i){
        ans.push_back(lower[(i+min_index)%lower.size()]);
    }
    return ans;
}

int main(){
    cin>>n;
    for(int i=0;i<n;++i){
        cin>>x>>y;
        p_set.push_back(xy_t(x,y));
    }

    convex=andrew(p_set);
    
    print(convex);
}


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

int a, b, c;

int main() {
	cin >> a >> b >> c;
	
	for (int i = 1; i <= b; i++) {
		if ((a * i) % b == c) {
			cout << "YES" << endl;
			return 0;
		}
	}
	cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int>P;

signed main() {
	string  o, e; cin >> o >> e;
	rep(i, o.size() + e.size()) {
		if (i % 2 == 0)cout << o[i / 2];
		else cout << e[i / 2];
	}
	cout << endl;
}

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

int N;
vector<int> X, Y;

int main(void) {
	cin >> N;
	X.resize(N);
	Y.resize(N);
	for (int i = 0; i < N; ++i)
		cin >> X[i] >> Y[i];

	double sum = 0.0;
	for (int i = 0; i < N - 1; ++i) {
		for (int j = i + 1; j < N; ++j) {
			int d2 = (X[j] - X[i]) * (X[j] - X[i]) + (Y[j] - Y[i]) * (Y[j] - Y[i]);
			double d = sqrt((double)d2);
			sum += d;
		}
	}

	int id = (N * N - N) / 2;
	double avr = sum / id;
	double ans = avr * (N - 1);

	cout << fixed << setprecision(10) << ans << '\n';
	return 0;
}


Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}
import Control.Monad
import Data.Array.Unboxed
import Data.Functor
import Data.List
import qualified Data.ByteString.Char8  as B
import qualified Data.IntMap.Strict     as IntMap
import qualified Data.Vector.Unboxed    as VU

main :: IO ()
main = do
  n <- readLn
  xs <- replicateM n get2Lines :: IO [(String, String)]
  mapM_ (print . uncurry rowdp') xs 

get2Lines :: IO (String, String)
get2Lines = do
  a <- getLine
  b <- getLine
  return (a, b)

rowdp' :: String -> String -> Int
rowdp' xs ys = last $ foldl' scanY headRow xs
  where
    m = length ys
    headRow = replicate (m + 1) 0 :: [Int]
    scanY :: [Int] -> Char -> [Int]
    scanY prevRow x = myscanl' f 0 yvprev
      where
        yvprev = zip3 ys prevRow $ tail prevRow
        f :: Int -> (Char, Int, Int) -> Int
        f v (y, a, b) = if x == y 
                        then 1 + a
                        else max b v

myscanl'           :: (b -> a -> b) -> b -> [a] -> [b]
myscanl' = scanlGo'
  where
    scanlGo'           :: (b -> a -> b) -> b -> [a] -> [b]
    scanlGo' f !q ls    = q : (case ls of
                            []   -> []
                            x:xs -> scanlGo' f (f q x) xs)



Measured memory_bytes: 7504
#include <iostream>
#include <algorithm>
using namespace std;
int n,i;
double v[51],media;
int main()
{
    cin>>n;
    for (i=1;i<=n;++i)
         cin>>v[i];
    sort(v+1,v+n+1);
    media=(v[1]+v[2])/2.0;
    for (i=3;i<=n;++i)
        media=(media+v[i])/2.0;
    cout<<media;
}



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

ll gcd(ll x,ll y) {return y ? gcd(y,x%y) : x;} 
ll lcm(ll x,ll y) {return x/gcd(x,y)*y;}

int main(){
    ll x;
    cin >> x;
    ll ans=0,num=0;
    while(1){
        ans+=x;
        num++;
        if(ans%360==0) break;
    }
    cout << num << endl;

    return 0;
}











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

int main(void)
{
	int n;
	int i;
	
	scanf("%d", &n);
	for(i = 0; i < n; i++) {
		double x1, x2, x3;
		double y1, y2, y3;
		double a, b, c, s, S;
		double A, B, f, g, h, i;
		double px, py, r;
		
		scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3);
		a = sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2));
		b = sqrt(pow(x2 - x3, 2) + pow(y2 - y3, 2));
		c = sqrt(pow(x3 - x1, 2) + pow(y3 - y1, 2));
		s = (a + b + c) / 2;
		S = sqrt(s * (s - a) * (s - b) * (s - c));
		r = (a * b * c) / (4 * S);
		
		f = 2 * (x1 - x2); g = 2 * (y1 - y2);
		h = 2 * (x1 - x3); i = 2 * (y1 - y3);
		A = x1 * x1 - x2 * x2 + y1 * y1 - y2 * y2;
		B = x1 * x1 - x3 * x3 + y1 * y1 - y3 * y3;
		px = (A * i - B * g) / (f * i - g * h);
		py = (A * h - B * f) / (g * h - f * i);
		printf("%.3f %.3f %.3f\n", px, py, r);
		
	}
	
	return 0;
}


Measured memory_bytes: 664
#include<bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define mp make_pair
using namespace std;

using ll = long long;
using ii = pair<int, int>;
const int INF = (int)10e9;
int dp[3][100005];

int main() {
    std::ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int N;
    cin>>N;
    vector<int> a(N), b(N), c(N);
    for(int i = 0; i < N; i++) {
        cin>>a[i]>>b[i]>>c[i];
    }

    dp[0][0] = a[0];
    dp[1][0] = b[0];
    dp[2][0] = c[0];
    for(int i = 1; i < N; i++) {
        dp[0][i] = a[i] + max(dp[1][i-1], dp[2][i-1]);
        dp[1][i] = b[i] + max(dp[0][i-1], dp[2][i-1]);
        dp[2][i] = c[i] + max(dp[0][i-1], dp[1][i-1]);
    }
    cout << max(max(dp[0][N-1], dp[1][N-1]), dp[2][N-1]) <<endl;

    return 0;
}

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

const int MAXN = 2e3 + 10, MOD = 1e9 + 7;
int s[MAXN], t[MAXN], n, m;
long long dp[MAXN][MAXN];

int main() {
	cin >> n >> m;
	for (int i = 0; i < n; i++)
		cin >> s[i], dp[i + 1][0] = 1;
	for (int j = 0; j < m; j++)
		cin >> t[j], dp[0][j + 1] = 1;
	dp[0][0] = 1;
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= m; j++) {
			dp[i][j] = dp[i - 1][j] + dp[i][j - 1] - dp[i - 1][j - 1];
			if (s[i - 1] == t[j - 1])
				dp[i][j] += dp[i - 1][j - 1];
			dp[i][j] %= MOD;
		}
	if (dp[n][m] < 0)
		dp[n][m] += MOD;
	cout << dp[n][m];
}

Measured memory_bytes: 31744
#include<iostream>
#include<cmath> 
#include<cstdlib>
#include<cstdio>
#include<string>
#include<cstring>
#include<algorithm>
#include<iomanip>
#include<vector>
#include<stack>
#include<queue>
using namespace std;
int main()
{
	string s,t;
	cin>>s>>t; 
	int cds=s.size(),cdt=t.size();
	int j=0,k=0;
	for(int i=0;i<cds+cdt;++i)
	{
		if(i%2==0)
		{
			cout<<s[j++];
		}
		else
		{
			cout<<t[k++];
		}
	}
	return 0;
} 

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

ll n,W;

int main(){
    cin >> n >> W;
    vector<ll> a[4];
    ll memo;
    for(ll i=0;i<n;i++){
        ll w,v;
        cin >> w >> v;
        if(i==0) memo=w;
        if(w-memo==0) a[0].push_back(v);
        if(w-memo==1) a[1].push_back(v);
        if(w-memo==2) a[2].push_back(v);
        if(w-memo==3) a[3].push_back(v);
    }
    for(ll i=0;i<4;i++){
        sort(a[i].begin(),a[i].end());
        a[i].push_back(0);
        reverse(a[i].begin(),a[i].end());
        for(ll j=0;j<a[i].size()-1;j++){
            a[i][j+1]=a[i][j]+a[i][j+1];
        }
    }
    ll res=0;
    for(ll i=0;i<a[0].size();i++){
        for(ll j=0;j<a[1].size();j++){
            for(ll k=0;k<a[2].size();k++){
                for(ll l=0;l<a[3].size();l++){
                    if((memo*(i+j+k+l)+j+2*k+3*l)<=W){
                        res=max(res,a[0][i]+a[1][j]+a[2][k]+a[3][l]);
                    }
                }
            }
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
#define R register

int n,m,a[105],tot=0;

int main()
{
    scanf("%d",&n);
    for(R int i=1;i<=n;i++)
	{
        scanf("%d",&a[i]);tot+=a[i];
    }
    scanf("%d",&m);
    for(R int i=m;i>=1;--i)
	{
        R int p,x;
        scanf("%d %d",&p,&x);printf("%d\n",tot-a[p]+x);
    }
    return 0;
}

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

int dp[2][1953130];
int fac[10];

int main(){

    fac[0] = 1;
    for(int i = 1; i < 10; i++){
        fac[i] = fac[i - 1] * 5;
    }

    while(1){
        int n; cin >> n;
        int win_number = (n - 1) / 2;
        if(!n) break;
        int m; cin >> m;
        vector<vector<int> > num(n, vector<int> (n));
        vector<vector<int> > winlose(n, vector<int> (n, 0));


        for(int i = 0; i < m; i++){
            int win, lose; cin >> win >> lose;
            win--;
            lose--;
            winlose[win][lose] = 1;
            winlose[lose][win] = -1;
        }

        int cnt = 1;
        for(int i = 0; i < n; i++){
            for(int j = i + 1; j < n; j++){
                num[i][j] = cnt;
                cnt++;
            }
        }

        memset(dp, 0, sizeof(dp));
        dp[0][0] = 1;
        int now = 0;
        int next = 1;
        for(int i = 0; i < n; i++){
            for(int j = i + 1; j < n; j++){

                for(int mem = 0; mem < 1953130; mem++) dp[next][mem] = 0;
                for(int bit = 0; bit <= fac[n]; bit++){
                    //i vs j
                    int next_num = next;
                    int now_num = now;
                    if(dp[now_num][bit] == 0) continue;

                    //jが勝つ
                    if(winlose[i][j] != 1){
                        int next_bit = bit;
                        int number = bit % fac[j + 1];
                        number = number / fac[j];
                        if(number < win_number){
                            next_bit += fac[j];
                            dp[next_num][next_bit] += dp[now_num][bit];
                        }
                    }

                    //iがかつ
                    if(winlose[j][i] != 1){
                        int next_bit = bit;
                        int number = bit % fac[i + 1];
                        number = number / fac[i];
                        if(number < win_number){
                            next_bit += fac[i];
                            dp[next_num][next_bit] += dp[now_num][bit];
                        }
                    }
                }

                swap(now, next);
            }
        }

        int ans_bit = 0;
        for(int i = 0; i < n; i++){
            ans_bit += fac[i] * win_number;
        }
        
        cout << dp[now][ans_bit] << endl;
    }

    return 0;
}


Measured memory_bytes: 18384
#include <bits/stdc++.h>
using namespace std;
#define int long long




signed main() {
   int n;
   cin>>n;
   int w[n],wa=0;
   for(int i=0;i<n;i++){
       cin>>w[i];
       wa+=w[i];
   }
   int ans=abs(wa-2*w[0]);
   int wb=w[0];
   for(int i=1;i<n;i++){
       wb+=w[i];
       ans=min(ans,abs(wa-2*wb));
   }
   cout<<ans;
   return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

typedef long long ll;

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

const int M = 50;
ll K;

int main() {

  cin >> K;

  ll ans[M];
  REP (i, M) ans[i] = M-1 + K/M;

  REP (i, K%M) ans[i] += M-K%M+1;
  FOR (i, K%M, M) ans[i] -= K%M;

  cout << M << endl << ans[0];
  FOR (i, 1, M) cout << " " << ans[i];
  cout << endl;

  return 0;

}

Measured memory_bytes: 256
S = input()

ans = float('inf')
for goal in S:
    dist = [float('inf')] * len(S)
    right = float('inf')
    for i in range(len(S))[:: -1]:
        if S[i] == goal:
            right = i
        dist[i] = min(dist[i], abs(i - right))

    cost = float('inf')
    for i in range(len(S)):
        cost = min(cost, max(i, max(dist[:len(S) - i])))
    ans = min(ans, cost)

print(ans)

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

#define debug(x) cout<<#x<<": "<<x<<endl
#define rep(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a);i<=(b);i++)
#define all(a) (a).begin(),(a).end()
using namespace std;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef long long ll;



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

	VI v(n);
	rep(i, n) cin >> v[i];
	sort(all(v));

	int sumA = 0, sumB = 0;
	rep(i, n) {
		if (i % 2) sumB += v[n - i - 1];
		else sumA += v[n - 1 - i];
	}
	cout << (sumA - sumB) << endl;
}


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

	solve(); 
	return 0;
}

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

int w[105];
int v[105];
ll dp[105][100005] = {0};

int main() 
{
    int n, k;
    cin >> n >> k;
    rep(i,n) cin >> w[i] >> v[i];


    rep(i,n+1) rep(sum_w,100001) {
        if (sum_w >= w[i]) dp[i+1][sum_w] = max(dp[i][sum_w], dp[i][sum_w -w[i]] + v[i]);
        else dp[i+1][sum_w] = dp[i][sum_w];
    }

    cout << dp[n][k] << endl;

    return 0;
}


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

int main(){
	int N;
	cin >> N;
	vector<int> A(N);
	rep(i,N){
		cin >> A[i];
	}
	
	ll ans = 1;
	
	map<int,int> mp;
	
	rep(i,N){
		if(A[i] == 0){
			ans *= (3-mp[0]);
			mp[0]++;
			ans %= MOD;
		}else{
			ans *= (mp[A[i]-1]-mp[A[i]]);
			ans %= MOD;
			mp[A[i]]++;
		}
	}
	
	cout << ans << endl;
	
    return 0;
}



Measured memory_bytes: 5376
#include <iostream>
#include <array>
#include <vector>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
using namespace std;

typedef  pair<int,int> P;
typedef long long LL;

const LL  INF=1<<31;



int main(){
     int h,w;
     cin>>h>>w;
     string x[100];
     for(int i=0;i<h;++i){
          cin>>x[i];
     }
     for(int i=0;i<2*h;++i){
          int y=i/2;
     cout<<x[y]<<"\n";
     }
     cout<<"\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

ll pow_mod(ll a, ll b, ll m){
    ll ret = 1;
    while (b > 0) {
        if (b & 1) {
            ret = ret * a % m;
        }
        a = a * a % m;
        b >>= 1;
    }
    return ret;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    string s;
    cin >> s;
    int n = (int)s.size();
    vector<ll> cnt(2019, 0);
    int cur = 0;
    cnt[0] = 1;
    for(int i = n - 1; i >= 0; i--) {
        ll tmp = (s[i] - '0') * pow_mod(10, n - 1 - i, 2019);
        (cur += tmp) %= 2019;
        cnt[cur]++;
    }
    ll ans = 0;
    rep(i, 2019) ans += cnt[i] * (cnt[i] - 1) / 2;
    output(ans);
    
    
    
    return 0;
}


Measured memory_bytes: 3748
#include <iostream>
#include <vector>
#include <cstdio>
using namespace std;

int N, M, Q; 
vector<vector<int>> sum;

int buildSumTable(vector<int> L, vector<int> R){
    sum = vector<vector<int>>(N + 1, vector<int>(N + 1, 0));
    for(int i=0; i<M; i++) sum[L[i]][R[i]]++;

    for(int i=1; i<=N; i++){
        for(int j=1; j<=N; j++){
            sum[i][j] += sum[i-1][j];
            sum[i][j] += sum[i][j-1];
            sum[i][j] -= sum[i-1][j-1];
        }
    }
}

int getSumRange(int L, int R){
    int ans = sum[R][R] - sum[R][L-1] - sum[L-1][R] + sum[L-1][L-1];
    return ans;
}

int main() {
    cin >> N >> M >> Q;
    vector<int> L(M), R(M);
    for(int i=0; i<M; i++) scanf("%d %d", &L[i], &R[i]); //cin >> L[i] >> R[i];
    vector<int> p(Q), q(Q);
    for(int i=0; i<Q; i++) scanf("%d %d", &p[i], &q[i]); //cin >> p[i] >> q[i];

    buildSumTable(L, R);

    for(int i=0; i<Q; i++){
        int ans = getSumRange(p[i], q[i]);
        printf("%d\n", ans); //cout << ans << endl;
    }
}


Measured memory_bytes: 5120
a = list(input())
b = list(input())
c = list(input())

n = a[0]
if len(a) < 1:
    del a[0]

while True:
    if n == "a":
        n = a[0]
        del a[0]
        if len(a) == 0:
            print("A")
            break
    elif n == "b":
        n = b[0]
        del b[0]
        if len(b) == 0:
            print("B")
            break
    elif n == "c":
        n = c[0]
        del c[0]
        if len(c) == 0:
            print("C")
            break


Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <bitset>
#include <vector>
#include <string>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#define Rep(i,a) for(int i = 0; i < (a); i++)
#define rep(i,a,b) for(int i = (a); i <= (b); i++)//(a)!
#define dep(i,a,b) for(int i = (a); i >= (b); i--)
#define ab(a) ((a) > 0 ? (a) : -(a))
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back(a)
using namespace std;
typedef long long LL;
typedef unsigned long long uLL;
const int N = 100010;
const LL inf = 1LL << 61;
int n, e, T;
LL mn[N][18], f[N], s[N], x[N];
int main() {
	scanf("%d%d%d",&n,&e,&T);
	rep(i,1,n) scanf("%lld",&x[i]);
	s[0] = f[0] - 2 * x[1] - x[0]; mn[0][0] = f[0] - x[0];
	rep(i,1,n) {
		int k = i - 1; f[i] = inf;
		dep(j,17,0) if (k - (1 << j) >= 0 && ((x[i] - x[k - (1 << j) + 1]) << 1) <= T ) 
			f[i] = min(f[i], mn[k][j] + x[i] + T), k -= 1 << j;
		if ((x[i] - x[k + 1]) * 2 <= T) f[i] = min(f[i], mn[k][0] + x[i] + T); else k++;

		if (k) f[i] = min(f[i], s[k - 1] + 3 * x[i]);
		s[i] = min(s[i - 1], f[i] - 2 * x[i + 1] - x[i]);
		mn[i][0] = f[i] - x[i];
		rep(j,1,17)if (i - (1 << j) + 1 >= 0) mn[i][j] = min(mn[i - (1 << (j - 1))][j - 1], mn[i][j - 1]);
	}
	printf("%lld\n",f[n] + e - x[n]);
	return 0;
}

Measured memory_bytes: 16640
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <cstdlib>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional> 
#include <iomanip>
#include <unordered_map>
#include <memory.h>
#include <cstring>
#include <fstream>

using namespace std;


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

	int n;

	cin >> n;

	int x = (n * 100) / 108;

	int res = -1;
	for (int i = x; i <= n; i++)
	{
		int y = i * 1.08;
		if (y == n)
		{
			res = i;
			break;
		}
	}

	if (res == -1)
	{
		cout << ":(" << '\n';
	}
	else
	{
		cout << res << '\n';
	}

	return 0;
}

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

    int main (){
    int n,k;
    cin >> n >> k;
    int ans = 0;
    rep(i,n){
        int x;
        cin >> x;
        if(abs(k-x)>x){
            ans+=x*2;
        }
        else{
            ans+=abs(k-x)*2;
        }
    }
        cout << ans << endl;
        return 0;

       
    }

Measured memory_bytes: 3572
#ifdef DEBUG

#else

#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus < 201703L
#        pragma GCC target("avx")
#    else
#        pragma GCC target("avx2")
#    endif

#endif

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;
typedef long double Ld;

using namespace std;
using Graph = vector<vector<Int>>;

const Ld pi = M_PI;
const Int MOD = 1000000007;
const Int INF = 1LL << 61;

Int Floor(Int a, Int b) {
    return (a - (a % b)) / b;
}

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

    Int n;
    cin >> n;

    vector<Int> a(n + 1, 1);
    for (Int i = 2; i <= n; i++) {
        for (Int j = i; j <= n; j += i) {
            a[j]++;
        }
    }

    Int ans = 0;
    for (Int i = 1; i < n + 1; i++) {
        ans += i * a[i];
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 81248
/******************************************************************************

Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.

*******************************************************************************/
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdio>
#include <iostream>
#include <math.h>
#include <string>
#include <limits>

using namespace std;

#define MAXV 100010
#define MAXVALUE 100000000010
#define MOD 998244353 

typedef unsigned long long ll;
typedef vector<pair<ll, ll>> vec_int_pairs;
typedef vector<ll> vecint;
typedef vector<vector<ll>> vecint2;
typedef vector<vector<vector<ll>>> vecint3;
typedef vector<vector<pair<ll, ll>>> vet_2_int_pairs;
typedef map<ll, ll> int_int_map;


int main()
{
	int n, k;
	
	cin >> n >> k;
	
	vecint a(n);
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	
	vector<bool> dp(k + 1, false);
	
	for (int i = 1; i <= k; ++i) {
		bool win = false;
		for (auto v : a) {
			if (v <= i) {
				if (!dp[i - v]) {
					win = true;
					break;
				}
			}
		}
		dp[i] = win;
	}
	
	if (dp[k]) {
		cout << "First" << endl;
	} else {
		cout << "Second" << endl;
	}

    return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

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

		new Main().run();
	}

	private void run() throws IOException {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		Pair[] pairs = new Pair[n];
		for (int i = 0; i < n; i++) {
			int a = scanner.nextInt();
			int b = scanner.nextInt();
			pairs[i] = new Pair(a, b);
		}
		Arrays.sort(pairs);
		PriorityQueue<Pair> pq = new PriorityQueue<Pair>();
		long sum = 0;
		long ret = 0;
		for (Pair p : pairs) {
			pq.offer(new Pair(p.s, p.f));
			sum += p.f;
			while (!pq.isEmpty()) {
				Pair pair = pq.peek();
				long a = pair.f * pq.size();
				if (a >= sum)
					break;
				sum -= pq.poll().s;
			}
			ret = Math.max(ret, pq.size());
		}
		System.out.println(ret);

	}

	class Pair implements Comparable<Pair> {
		long f, s;

		@Override
		public String toString() {
			return "Pair [f=" + f + ", s=" + s + "]";
		}

		public Pair(long f, long s) {
			super();
			this.f = f;
			this.s = s;
		}

		@Override
		public int compareTo(Pair o) {
			return (int) (f - o.f);
		}

	}
}

Measured memory_bytes: 195688