akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#define pb push_back
#define mpr make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ll long long
#define ld long double
#define fi first
#define se second
#define all(arr) arr.begin(), arr.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define fo(i, l, r) for (int i = l; i <= r; i++)
#define INF 1000000001
#define inf1 1000000000000000001
#define MOD 1000000007
#define pie 3.14159265358979323846264338327950L
#define N 200009
#define M 1e6+9
#define mid(l, r) l + (r - l) / 2
#define vec vector<int>
#define vecl vector<ll>
#define umap unordered_map<ll,ll>
#define yes cout << "YES" << endl;
#define no cout << "NO" << endl;
#define endl "\n"
#define int long long
using namespace std;

int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};  
int ddx[8]={1,1,0,-1,-1,-1,0,1},ddy[8]={0,1,1,1,0,-1,-1,-1};
ll gcd(ll a,ll b){ if(!a)return b;return gcd(b%a,a);}
ll lcm(ll a, ll b) { return (a*b)/ gcd(a,b);}

const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++){
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}



long long COM(int n, int k){
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}



void test_case() {
	
    int n,k;
    cin>>n>>k;

    vec arr(n);
    rep(i,n) {
        cin>>arr[i];
    }

    sort(all(arr));


    int mi=0;
    int ma=0;
    
    int temp;

    COMinit();

    for(int i = 0;i < n-k+1;i++){
    temp = COM(n-i-1,k-1);
    // cout<<temp<<" ";
    mi += temp*arr[i]%MOD;
    // cout<<mi<<" ";
  }
  
  for(int i = k-1;i < n;i++){
    temp = COM(i,k-1);
    ma += temp*arr[i]%MOD;
  }
  
  ll res = ma-mi;
  res %= MOD;
  cout << res<<endl;;
}


signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cout<<fixed<<setprecision(20);

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


    int t = 1;
    // cin >> t;
    while(t--)
    {   
        test_case();
    }
}

Measured memory_bytes: 15844
#include <cstdio>
#include <cstdint>
#include <cassert>
#include <cctype>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <stdexcept>

struct Dimension: std::vector<int> {
  Dimension(size_t n=0): std::vector<int>(n) {}
  Dimension &operator +=(const Dimension &oth) {
    if (*this != oth) throw std::logic_error("mismatch");
    return *this;
  }
  Dimension &operator -=(const Dimension &oth) {
    if (*this != oth) throw std::logic_error("mismatch");
    return *this;
  }
  Dimension &operator *=(const Dimension &oth) {
    for (size_t i=0; i<size(); ++i)
      (*this)[i] += oth[i];

    return *this;
  }
  Dimension &operator /=(const Dimension &oth) {
    for (size_t i=0; i<size(); ++i)
      (*this)[i] -= oth[i];

    return *this;
  }
};

Dimension parse(
    const std::string &s, size_t &i,
    const std::map<std::string, Dimension> expr, size_t preced=0) {

  const std::vector<std::string> ops={"+-", "*/"};

  if (preced == ops.size()) {
    if (s[i] == '(') {
      Dimension res=parse(s, ++i, expr, 0);
      assert(s[i] == ')');
      ++i;
      return res;
    }
    if (isalpha(s[i])) {
      std::string name(1, s[i]);
      while (++i < s.length() && isalpha(s[i]))
        name += s[i];

      return expr.at(name);
    }
    assert(false);
  }

  Dimension lhs=parse(s, i, expr, preced+1);
  while (i < s.length()) {
    char op=s[i];
    if (!std::count(ops[preced].begin(), ops[preced].end(), op)) break;
    Dimension rhs=parse(s, ++i, expr, preced+1);
    if (op == '+') lhs += rhs;
    if (op == '-') lhs -= rhs;
    if (op == '*') lhs *= rhs;
    if (op == '/') lhs /= rhs;
  }
  return lhs;
}

int testcase_ends() {
  size_t n, m, p;
  scanf("%zu %zu %zu", &n, &m, &p);
  if (n == 0 && m == 0 && p == 0) return 1;

  std::map<std::string, Dimension> stod;
  std::map<Dimension, std::string> dtos;
  for (size_t i=0; i<m; ++i) {
    char buf[32];
    scanf("%s", buf);
    std::string s=buf;
    Dimension d(n);
    for (size_t j=0; j<n; ++j)
      scanf("%d", &d[j]);

    stod[s] = d;
    dtos[d] = s;
  }

  std::string s;
  {
    char buf[128];
    scanf("%s", buf);
    s = buf;
  }

  std::map<std::string, Dimension> expr;
  for (size_t i=0; i<p; ++i) {
    char buf[128];
    scanf("%s", buf);
    std::string lhs=buf;
    scanf("%s", buf);
    std::string rhs=buf;
    expr[lhs] = stod[rhs];
  }

  size_t i=0;
  try {
    Dimension res=parse(s, i, expr);
    printf("%s\n", dtos.at(res).c_str());
  } catch (std::out_of_range &e) {
    printf("undefined\n");
  } catch (std::logic_error &e) {
    printf("error\n");
  }

  return 0;
}
  
int main() {
  while (!testcase_ends()) {}
}



Measured memory_bytes: 3028
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb emplace_back
#define INF (1e9+1)

bool ok(string a, string b){
    rep(i,a.size()){
        if(a[i]!=b[i] && a[i]!='?')return false;
    }
    return true;
}

int main(){
    string a,b;
    cin>>a>>b;
    
    
    string ans = "*";
    rep(i,a.size()-b.size()+1){
        if(ok(a.substr(i,b.size()),b)){
            string s = a;
            for(int j = i;j<i+b.size();j++){
                s[j] = b[j-i];
            }
            rep(j,s.size())if(s[j]=='?')s[j] = 'a';
            if(ans=="*")ans = s;
            ans = min(ans,s);
        }
    }
    if(ans=="*")cout<<"UNRESTORABLE"<<endl;
    else cout<<ans<<endl;
}


Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
sum_=[a[0]]
num=a[0]
for i in range(1,n):
    num=num+a[i]
    sum_.append(num)
count={}
for i in range(n):
    if sum_[i] in count.keys():
        count[sum_[i]]+=1
    else:
        count[sum_[i]]=1
ans=0
for i in count.values():
    ans+=i*(i-1)//2
if 0 in count.keys():
    ans+=count[0]
print(ans)

Measured memory_bytes: 41092
import sys
import math
from collections import Counter, defaultdict, deque
from functools import reduce

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)


def I():
    return int(input())


def MI():
    return map(int, input().split())


def LI():
    return list(MI())


def LIN(n: int):
    return [I() for _ in range(n)]


inf = float("inf")
mod = 10 ** 9 + 7


def main():
    k = I()

    def gcd(a, b, c):
        return math.gcd(math.gcd(a, b), c)

    sum = 0
    for a in range(1, k + 1):
        for b in range(1, k + 1):
            for c in range(1, k + 1):
                sum += gcd(a, b, c)

    print(sum)


if __name__ == "__main__":
    main()


Measured memory_bytes: 68480
#include<bits/stdc++.h>
using namespace std;
long long a,b;
int main()
{
	scanf("%lld%lld",&a,&b);
	if(a>b)
	swap(a,b);
	if((a>0&&b>0)||(a<0&&b<0&&(b-a+1)%2==0))
	{
		printf("Positive");
		return 0;
	}
	if(a<=0&&b>=0)
	{
		printf("Zero");
		return 0;
	}
	printf("Negative");
	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);
    while(true){
      String S=sc.next();
      int n=S.length();
      int array[]=new int[n];
      int sum=0;
      for(int i=0;i<n;i++){
        array[i]=S.charAt(i)-'0';
      }
      if(n==1&&array[0]==0) break;
      for(int i=0;i<n;i++) sum+=array[i];
      System.out.println(sum);
    }
      sc.close();
  }
}


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

using namespace std;
long long int k,a,b;
int main()
{
	cin>>k>>a>>b;
	if(a<=b&&a<k)cout<<-1;
	else if(k<=a)cout<<1;
	else cout<<(k-a-1)/(a-b)*2+3;
	cout<<"\n";
    
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>

int main()
{
  int a;
  scanf("%d", &a);
  int cnt = 0;
  for (int i = 0; i < 3; i++)
  {
    if (a >> i & 1)
    {
      cnt++;
    }
  }
  printf("%d\n", cnt);
}

Measured memory_bytes: 256
/*
Author: Babin Dutta
*/
 
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long int
#define pb push_back
#define mp make_pair
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define f(i,n) for(int i=0;i<n;i++)
#define ff(i,a,b) for(int i=a;i<=b;i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define endl "\n"
#define inf 1e18
#define mm 998244353
 
ll power(ll x, ll y, ll p)
{
    ll res = 1;  
    x = x % p;  
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1; 
        x = (x*x) % p;  
    }
    return res;
}
ll modInverse(ll A,ll M)
{
    return power(A,M-2,M);
}

void solve(){
	int n; cin>>n;
	int ans = 0;
	int a[n];
	f(i,n){
		cin>>a[i];
		ans ^= a[i];
	}
	f(i,n){
		int x = ans ^ a[i];
		cout<<x<<" ";
	}
	cout<<endl;
}
 
int main(){
	#ifdef JUDGE
    freopen("input.txt", "rt", stdin);
    freopen("output.txt", "wt", stdout);
    #endif
	boost;
	int t=1; //cin>>t;
	for(int i=1;i<=t;i++) solve();
	return 0;
}

Measured memory_bytes: 4424
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<list>
#include<set>
#include<cstring>
using namespace std;
long long int mod = 1e9 + 7;
int inf = 1e9;

int main() {
  int n; cin >> n;
  vector<int> b(n);
  for(int i=0; i<n; i++){
    cin >> b[i];
    if(b[i] > i+1) {
      cout << -1 << endl;
      return 0;
    }
  }
  vector<int> a;
  for(int i=1; i<=n; i++) {
    int l = 0;
    int c = 0;
    for(int j=0; j<n; j++) {
      if(b[j] == -1) continue;
      if(b[j] == c+1) {
        l = j;
      }
      c++;
    }
    a.push_back(b[l]);
    b[l] = -1;
  }
  for(int i=0; i<n; i++) cout << a[n-1-i] << endl;

  return 0;
}


//EOF


Measured memory_bytes: 256
import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.PrintWriter
import java.util.*
import kotlin.math.abs
import kotlin.math.max
import kotlin.math.min

val br = BufferedReader(InputStreamReader(System.`in`))
val out = PrintWriter(System.out)

fun main() {
    br.use { out.use {
        solve()
        out.flush()
    } }
}

fun solve() {
    val n = readInteger()
    val alist = readLongList()
    val bList = readLongList()

    val asum = alist.sum()
    val bsum = bList.sum()
    if (asum > bsum) {
        out.println("No")
        return
    }

    val operationCount = bsum - asum
    var count = 0L
    var counr2 = 0L
    for ((a, b) in alist.zip(bList)) {
        if (a > b) count += a - b
        if (a < b) counr2 += (b - a + 1) / 2
    }

    val ans = if (count <= operationCount && counr2 <= operationCount) "Yes" else "No"
    out.println(ans)
}

fun readInteger() = Integer.parseInt(br.readLine())
fun readLong() = java.lang.Long.parseLong(br.readLine())
fun readStringList() = br.readLine()!!.split(' ')
fun readIntegerList() = readStringList().map(Integer::parseInt)
fun readLongList() = readStringList().map(java.lang.Long::parseLong)
fun readDoubleList() = readStringList().map(java.lang.Double::parseDouble)


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

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

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

    int dp[n][3] = {};

    for (int i = 0; i < n; i++) {
        if (i == 0) {
            dp[i][0] = a[i];
            dp[i][1] = b[i];
            dp[i][2] = c[i];
            continue;
        }

        dp[i][0] = max(dp[i - 1][1] + a[i], dp[i - 1][2] + a[i]);
        dp[i][1] = max(dp[i - 1][0] + b[i], dp[i - 1][2] + b[i]);
        dp[i][2] = max(dp[i - 1][0] + c[i], dp[i - 1][1] + c[i]);
    }

    cout << max({dp[n - 1][0], dp[n - 1][1], dp[n - 1][2]}) << endl;

    return 0;
}


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

int main() {
    int n;
    cin >> n;
    vector<int> a;
    rep(i,2*n) {
        int x;
        cin >> x;
        a.push_back(x);
    }
    sort(a.begin(), a.end());
    int ans = 0;
    rep(i,n) {
        ans += min(a[2*i], a[2*i+1]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T> using vec = std::vector<T>;

int main() {
    int N;
    cin >> N;
    
    set<ll> a;
    set<ll> b;
    rep(i, N) {
        int l,r;
        cin >> l >> r;
        a.insert(l-r);
        b.insert(abs(l+r));
    }

    ll c1 = *a.rbegin() -*a.begin();
    ll c2 = *b.rbegin() -*b.begin();

    cout << max(c1,c2) << endl;

}


Measured memory_bytes: 22364
#coding:utf-8
import sys
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = lambda *something : print(*something) if DEBUG else 0
DEBUG = False
def main(given = sys.stdin.readline):
    input = lambda : given().rstrip()
    LMIIS = lambda : list(map(int,input().split()))
    II = lambda : int(input())
    XLMIIS = lambda x : [LMIIS() for _ in range(x)]

    N,M = LMIIS()
    import heapq
    A = list(map(lambda x:-x,map(int,input().split())))
    heapq.heapify(A)
    for _ in range(M):
        a = -heapq.heappop(A) //2

        heapq.heappush(A,-a)

    print(-sum(A))
if __name__ == '__main__':
    main()

Measured memory_bytes: 68352
import bisect


def solve(ls) -> int:
  n = len(ls)
  assert(3 <= n <= 2 * 10**3)

  def n_possible_cs(a: int, b: int, first_ic: int) -> int:
    # def bin_search_le_rightmost(s: int, e: int, target: int):
    #   if s == e:
    #     if ls[s] > target:
    #       return None
    #     else:
    #       return s
    #
    #   mid = s + (e - s) // 2
    #
    #   if ls[mid] <= target and (mid + 1 < n and ls[mid + 1] > target):
    #     return mid
    #   elif ls[mid] <= target:
    #     return bin_search_le_rightmost(mid + 1, e, target)
    #   else:
    #     return bin_search_le_rightmost(s, mid, target)

    idx = bisect.bisect_left(ls, a + b, first_ic)
    return 0 if idx == first_ic else idx - first_ic

  ret = 0
  for ia in range(0, n - 2):
    for ib in range(ia + 1, n - 1):
      a, b = (ls[ia], ls[ib])
      x = n_possible_cs(a, b, ib + 1)
      ret += x
  return ret


n = int(input().strip())
ls = [int(l) for l in input().split()]

print(solve(sorted(ls)))


Measured memory_bytes: 3188
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.array;
import std.range;
import std.math;

void main(){
	auto z=readln.split.map!(to!int);

	auto A=z[0]+z[1];
	auto B=z[0]-z[1];
	auto C=z[0]*z[1];
	writeln(max(A,B,C));
}

Measured memory_bytes: 256
in_data = [int(i) for i in input().split()]
a = in_data[0]
b = in_data[1]
gcd = []
if a > b:
    large_number = a
    small_number = b
else:
    large_number = b
    small_number = a
    
while True:
    mod_result = large_number % small_number
    if mod_result == 0:
        answer = small_number
        break
    large_number = small_number
    small_number = mod_result
    
print(answer)


Measured memory_bytes: 5600
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 1e9 + 7;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }

int main(){
    int N, D;
    cin >> N >> D;
    int X[N][D];
    for(int i = 0; i < N; i++){
        cins(X[i], X[i] + D);
    }
    int ans = 0;
    for(int i = 0; i < N; i++){
        for(int j = i + 1; j < N; j++){
            int sum = 0;
            for(int k = 0; k < D; k++){
                sum += (X[i][k] - X[j][k]) * (X[i][k] - X[j][k]);
            }
            if(int(pow(round(sqrt(sum)), 2)) == sum){
                ans++;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include "iostream"
#include "string"
#include "cctype"
#include <stdio.h>

int main()
{
    char ch;
    while (1){
        scanf("%c", &ch);
        char temp;
        if (ch == '\n')
            break;
        if(islower(ch)){
            temp = toupper(ch);
            std::cout << temp;
        }
        else if (isupper(ch)){
            temp = tolower(ch);
            std::cout << temp;
        }
        else
            std::cout << ch;

    }
    std::cout << std::endl;
    return 0;
}

Measured memory_bytes: 3144
import java.util.*;
public class Main 
{
	public static void main(String[] args) 
	{
		Scanner stdIn = new Scanner(System.in);
		int t = stdIn.nextInt();
		while(t-- != 0)
		{
			int n = stdIn.nextInt();
			int pos = stdIn.nextInt();
			int up = 0, down = 0;
			for(int i = 1; i < n; ++i)
			{
				int a = stdIn.nextInt();
				if(pos > a && pos - a > down)
				{
					down = pos - a;
				}
				else if(pos < a && a - pos > up)
				{
					up = a - pos;
				}
				pos = a;
			}
			System.out.println(up + " " + down);
		}
	}
}

Measured memory_bytes: 27584
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>

#define DEBUG 0

using namespace std;

long long int pFunc(long long int left,long long int right){
	long long int retl = 1;
	for(long long int i = 0 ;i<right;i++){
		retl *= (left-i);
	}
	for(long long int i=1;i<=right;i++){
		retl /= i;
	}
	if(DEBUG){
		cout<<retl<<endl;
	}
	return retl;
}

long long int dp[110][110];

long long int nCr(int n,int r){
	if(n==r) return dp[n][r] = 1;
      if(r==0) return dp[n][r] = 1;
      if(r==1) return dp[n][r] = n;
      if(dp[n][r]) return dp[n][r];
      return dp[n][r] = nCr(n-1,r) + nCr(n-1,r-1);
}

int main(){

	int n;
	int p;
	int *a;
	int kisuu=0;
	int guusuu=0;
	long long int sum=0;
	long long int kSum=0;
	long long int gSum=0;
	cin>>n>>p;
	a = new int[n];
	for(int i=0;i<n;i++){
		cin>>a[i];
		if(a[i]%2==0){
			guusuu++;
		}
		else{
			kisuu++;
		}
	}
	if(DEBUG){
		cout<<"guusuu = "<<guusuu<<endl;
		cout<<"kisuu = "<<kisuu<<endl;
	}

	if(p==0){
		for(long long int i=0;i<=guusuu;i++){
			gSum += nCr(guusuu,i);
		}
		if(DEBUG){
			cout<<"gSum="<<gSum<<endl;
		}
		for(long long int i=0;i<=kisuu;i+=2){
			kSum += nCr(kisuu,i);
		}
		if(DEBUG){
			cout<<"kSum="<<kSum<<endl;
		}

		sum = gSum*kSum;

	}
	else{

		for(long long int i=0;i<=guusuu;i++){
			gSum += nCr(guusuu,i);
			if(DEBUG){
				cout<<"i="<<i<<"c="<<nCr(guusuu,i)<<endl;
			}
		}
		if(DEBUG){
			cout<<"gSum="<<gSum<<endl;
		}
		for(long long int i=1;i<=kisuu;i+=2){
			kSum += nCr(kisuu,i);
			if(DEBUG){
				cout<<"i="<<i<<"c="<<nCr(kisuu,i)<<endl;
			}
		}
		if(DEBUG){
			cout<<"kSum="<<kSum<<endl;
		}

		sum = gSum*kSum;

	}

	cout<<sum<<endl;

}



Measured memory_bytes: 256
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {n: u16, m: u16};

    let n_p = if n < 2 { 0 } else { n * (n - 1) / 2 };
    let m_p = if m < 2 { 0 } else { m * (m - 1) / 2 };

    println!("{}", n_p + m_p)
}


Measured memory_bytes: 2092
import java.util.Scanner;

/**
 * @author nakker
 */

class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int number = scanner.nextInt();
        String color = scanner.next();
        if (number < 3200) {
            color = "red";
        }
        System.out.println(color);
    }
}


Measured memory_bytes: 22740
#include <algorithm>
#include <iostream>
#include <iterator>
#include <vector>

int main(void) {
    int n;
    std::cin >> n;

    std::vector<int> vec{};
    for (int i = 0; i < n; ++i) {
        int a;
        std::cin >> a;
        vec.push_back(a);
    }

    int q;
    std::cin >> q;

    for (int j = 0; j < q; ++j) {
        int k;
        std::cin >> k;

        int location = std::distance(
            vec.begin(), std::lower_bound(vec.begin(), vec.end(), k));
        std::cout << location << std::endl;
    }
}


Measured memory_bytes: 3512
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		// N > 1 が保証されるはず
		int[] Max = new int[N];
		
		Max[N-1] = A[N-1];
		for(int i=N-2;i>=0;i--){
			Max[i] = Math.Max(Max[i+1],A[i]);
		}
		
		int M = 0;
		for(int i=0;i<N;i++){
			M = Math.Max(Max[i]-A[i],M);
		}
		
		int cnt = 0;
		Dictionary<int,int> D = new Dictionary<int,int>();
		for(int i=N-1;i>=0;i--){
//Console.WriteLine(i);
			if(D.ContainsKey(A[i]) == false)D.Add(A[i],0);
			D[A[i]]++;
			if(Max[i] - A[i] == M){
				cnt += D[(M + A[i])];
				D[(Max[i] + A[i])] = 0;
			}
		}
		
		Console.WriteLine(cnt);
		
	}
	int N,T;
	int[] A;
	public Sol(){
		var d = ria();
		N = d[0]; T = d[1];
		A = ria();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 18648
N,T = map(int,input().split())
c,t = [],[]
for i in range(N):
  c_i,t_i = map(int,input().split())
  c.append(c_i)
  t.append(t_i)
l = []
for i in range(N):
  if t[i] <= T:
    l.append(c[i])
if len(l) == 0:
  print("TLE")
else:
  print(min(l))


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

using namespace std;

#define int 		long long
#define endl 		"\n"
#define mod 		1000000007
#define inf 		1e12
#define IOS 		ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)


int32_t main() {

	IOS;

	int h, w, m;
	cin >> h >> w >> m;

	vector<int> row(h, 0), col(w, 0);
	set<pair<int, int>> target;
	int r, c;

	for (int i = 0; i < m; i++) {
		cin >> r >> c;
		r--, c--;

		row[r]++;
		col[c]++;
		target.insert({r, c});
	}

	int maxRow = 0, maxCol = 0;

	for (int x : row)
		maxRow = max(maxRow, x);

	for (int x : col)
		maxCol = max(maxCol, x);

	vector<int> rowCandidate, colCandidate;

	for (int i = 0; i < h; i++)
		if (row[i] == maxRow)
			rowCandidate.push_back(i);

	for (int j = 0; j < w; j++)
		if (col[j] == maxCol)
			colCandidate.push_back(j);

	int ans = maxRow + maxCol - 1;

	for (int r : rowCandidate) {
		for (int c : colCandidate) {
			if (target.find({r, c}) == target.end()) {
				ans++;
				break;
			}
		}
		if (ans == maxRow + maxCol)
			break;
	}

	cout << ans;

	return 0;
}

Measured memory_bytes: 34892
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#define rg register
using namespace std;
template<typename T>inline void in(T &a)
{
	T ch=getchar(),f=1;
	for(a=0;!isdigit(ch);ch=getchar())
	  ch=='-'?f=-1:f=f;
	for(;isdigit(ch);ch=getchar())
	  a=(a<<3)+(a<<1)+ch-'0';
	a*=f;
}
template<typename T>inline void print(T x)
{
	if(x<0)
	  x=-x,putchar('-');
	if(x>9)
	  print(x/10);
	putchar(x%10+'0');
}
long long p,n,tot;
long long a[10000000][2];
long long kk;
inline void prim()
{
	long long sq=sqrt(p)+1;
	for(rg long long i=2;i<=sq;i++)
	if(p%i==0)
    {  
       	kk=0;
       	tot++;
       	a[tot][1]=i;
	    while(p%i==0)  
        {
            a[tot][0]=++kk;
            p/=i;  
        } 
    }
}
inline int power(int a,int b)
{
	int ans=1;
	for(;b;b>>=1,a*=a)
	if(b&1) ans*=a;
	return ans;
}
signed main()
{
	cin>>n>>p;
	if(n==1)
	{
		cout<<p<<endl;
		return 0;
	}
	a[++tot][0]=n,a[tot][1]=1;
	prim();
	long long ans=1,tmp;
	for(rg long long i=tot;i>=1;i--)
	if(n<=a[i][0])
	{
		tmp=a[i][0]/n;
		ans*=power(a[i][1],tmp);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(x, to) for (int x = 0; x < (to); x++)
#define REP(x, a, to) for (int x = (a); x < (to); x++)
#define EPS (1e-14)
#define _PA(x,N) rep(i,N){cout<<x[i]<<" ";}cout<<endl;
#define _PA2(x,H,W) rep(i,(H)){rep(j,(W)){cout<<x[i][j]<<" ";}cout<<endl;}

using namespace std;

typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef complex<double> Complex;
typedef vector< vector<int> > Mat;

int N, K, L;
int p[100005];
int q[100005];
int r[100005];
int s[100005];

const int MAX_V = 200005;

map<PII, int> freq;

struct UnionFind {

	int n;
	int parent[MAX_V];

	void init(int m) {
		n = m;
		for (int i = 0; i < n; i++) {
			parent[i] = i;
		}
	}

	int find(int i) {
		if (i == parent[i]) return i;
		else return parent[i] = find(parent[i]);
	}

	void unite(int x, int y) {
		int a = find(x);
		int b = find(y);
		if (a == b) return;
		else {
			parent[a] = b;
		}
	}

	bool is_same(int x, int y) {
		return find(x) == find(y);
	}

};


UnionFind uf, uf2;

void solve() {

	uf.init(N);
	for (int i = 0; i < K; i++) {
		int u = p[i], v = q[i];
		uf.unite(u, v);
	}

	uf2.init(N);
	for (int i = 0; i < L; i++) {
		int u = r[i], v = s[i];
		uf2.unite(u, v);
	}

	for (int i = 0; i < N; i++) {
		freq[PII(uf.find(i), uf2.find(i))] += 1;
	}

	for (int u = 0; u < N; u++) {
		cout << freq[PII(uf.find(u), uf2.find(u))] << " ";
	} cout << endl;
}

int main() {
	cin >> N >> K >> L;
	for (int i = 0; i < K; i++) {
		cin >> p[i] >> q[i];
		p[i]--; q[i]--;
	}
	for (int i = 0; i < L; i++) {
		cin >> r[i] >> s[i];
		r[i]--; s[i]--;
	}
	solve();
	return 0;
}




Measured memory_bytes: 15104
#include <iostream>

using namespace std;

int main()
{
    int x, y;
    cin >> x >> y;
    int groupA[7] = {1, 3, 5, 7, 8, 10, 12};
    int groupB[4] = {4, 6, 9, 11};

    bool isMatch = false;
    for (int i = 0; i < 7; i++)
    {
        if (groupA[i] == x)
        {
            for (int j = 0; j < 7; j++)
            {
                if (groupA[j] == y)
                {
                    isMatch = true;
                    break;
                }
            }
            break;
        }
    }

    if (isMatch)
    {
        cout << "Yes" << endl;
    }
    else
    {
        for (int i = 0; i < 4; i++)
        {
            if (groupB[i] == x)
            {
                for (int j = 0; j < 4; j++)
                {
                    if (groupB[j] == y)
                    {
                        isMatch = true;
                        break;
                    }
                }
                break;
            }
        }

        cout << (isMatch ? "Yes" : "No") << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const  int maxx=1e5+100;
const int INF=1e9;
const int MOD=1e9+7;
typedef long long ll;
ll a[maxx];
ll mul[maxx];
int f[maxx];
ll n;
void init()
{
    mul[0]=1;
    for(int i=1; i<=n; i++){
        mul[i]= (mul[i-1]*i)%MOD;
    }
}
ll pow(ll a,ll b,ll MOD)
{
    ll ret=1;
    while(b){
        if(b&1)  ret=(ret*a)%MOD;
        a=a*a%MOD;
        b>>=1;
    }
    return ret%MOD;
}
ll C(ll a,ll b)
{
    if(b>a)  return 0;
    return (mul[a]*pow(mul[b]*mul[a-b]%MOD,MOD-2,MOD))%MOD;
}
int main()
{
    cin>>n;
    n++;
    init();
    int p1,p2,d;
    for(int i=1; i<=n; i++){
        cin>>a[i];
        if(f[a[i]]==0)  f[a[i]]=i;
        else{
            p1=f[a[i]];
            p2=i;
        }
    }
    d=p2-p1-1;
    ll m=n-d-2;
    //cout<<d<<" "<<m<<endl;
    //cout<<n-1<<endl;
    for(ll i=1; i<=n; i++){
        cout<< (C(n,i)-C(m,i-1)+MOD)%MOD <<endl;
    }
    //cout<<"1"<<endl;
    return 0;
}

Measured memory_bytes: 3200
N=int(input())
one,two,four=0,0,0
for a in map(int,input().split()):
    if a%4==0:
        four+=1
    elif a%2==0:
        two+=1
    else:
        one+=1
if two==0:
    if one<=four+1:
        print('Yes')
    else:
        print('No')
else:
    if one<=four:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 11480
/* Author : Aaryan Srivastava ^__^ */ 
#include <bits/stdc++.h>
#include <random>
#include <chrono>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define pb push_back
#define mp make_pair
#define ff first
#define ss second   
#define rep(i,n) for(int i = 0 ; i < (n) ; i++)
#define repA(i,x,y) for(int i = (x) ; i <= (y) ; i++)
#define repD(i,x,y) for(int i = (x) ; i >= (y) ; i--)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define setval(a,val) memset(a,val,sizeof(a))
#define Randomize mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define trav(x , a) for(auto &x : a)
#define sz(a) ((int)a.size())
typedef long long ll ; 
#define int ll
using namespace std;

const int N = 3e5 + 5 ;
const int mod = 1e9 + 7 ;
const ll inf = 1e18 ;
const int SZ = 101 ;
const long double eps = 1e-9 ;

using namespace __gnu_pbds;
using ordered_set =  tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ;

typedef pair<int, int> pii; 
typedef pair<int , pii> ipii ;
typedef pair<pii , int> piii ; 
typedef unsigned long long ull ;
typedef long double ld;

ll po(ll x,ll y,ll p = mod) {ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}

void solve()
{
    int h1 , m1 , h2 , m2 , k;
    cin >> h1 >> m1 >> h2 >> m2 >> k ;
    int t1 = 60*h1 + m1 ;
    int t2 = 60*h2 + m2 ;
    cout << t2 - t1 - k; 
}
     
int32_t main(int32_t argc, char *argv[])
{
    ios::sync_with_stdio(0);    
    cin.tie(0); cout.tie(0);
    int TC = 1, t = 0;
    //cin >> TC ;
    while(t++ < TC)
    {
        //cout << "Case #" << t << ": " ;
        solve();
        cout << "\n" ;
    }
    return 0;
}


Measured memory_bytes: 3652
#include <algorithm>
#include <cstdio>
#include <ctype.h>
#include <functional>
#include <iostream>
#include <cassert>
#include <cfloat>
#include <climits>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
#define int long long
using namespace std;

signed main() {
	int N;
	cin >> N;
	vector<int> A(N);
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	string res = "YES";
	int sum = 0;
	for (int i = 0; i < N; i++) {
		sum += A[i];
	}
	if (sum % (((N + 1)*N) / 2) != 0) {
		res = "NO";
	}
	else {
		int ave = sum / (((N + 1)*N) / 2);
		int x = A[0];
		int y = 0;
		for (int i = 1; i < N; i++) {
			if (((A[0] + ave*i) - A[i]) % N == 0) {
				if (((A[0] + ave*i) - A[i]) < 0){
					res = "NO";
				}
				else {
					if ((((A[0] + ave*i) - A[i]) / N) >= y) {
						y = (((A[0] + ave*i) - A[i]) / N);
					}
					
					else {
						res = "NO";
					}
				}
				
			}
			else {
				res = "NO";
			}
		}
	}
	cout << res << endl;

	return 0;
}

Measured memory_bytes: 1024
// 最適化
#pragma GCC target("avx")
#pragma GCC optimize("O3")

#include<iostream>
#include<string>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>

#define endl "\n"
#define ll long long
#define REP(i,a,b) for (int i = (a); i < (int)(b); ++i)
#define IN_NUMS_V(vec, N) REP(i, 0, N) cin >> vec.at(i); // 入力される複数の数値を vector に代入する
#define OUT_V(vec) REP(i, 0, vec.size()) cout << vec.at(i) << endl;
#define V_SORT(vec) sort(vec.begin(), vec.end())
#define V_REVERSE(vec) sort(vec.rbegin(), vec.rend())

using namespace std;

///////////// BEGIN_LIB //////////////////
void sayYes(bool f){ if (f) cout << "Yes" << endl; else cout << "No" << endl; } // print 'Yes' or 'No'
void sayYES(bool f){ if (f) cout << "YES" << endl; else cout << "NO" << endl; } // print 'YES' or 'NO'
int gcd(int a, int b){ if (a%b==0) return(b); else return(gcd(b,a%b)); }        // 最大公約数
int lcm(int a, int b){ return a*b/gcd(a,b); }                                   // 最小公倍数
int digitSum(int n) { return (n < 10) ? n : digitSum(n / 10) + n % 10; }        // 各桁の和
bool isprime(ll n){                                                             // 素数判定
    if (n < 2) return false;
    else if (n == 2) return true;
    else if (n % 2 == 0) return false;
    for (ll i = 3; i <= sqrt(n); i += 2){
        if (n % i == 0){
            return false;
        }
    }
    return true;
}
///////////// END_LIB //////////////////

//////////// BEGIN_SOLVE ///////////////

void solve() {
    int X;
    cin >> X;
    sayYes(X >= 30);
}

//////////// END_SOLVE ///////////////
int main() { ios::sync_with_stdio(false); std::cin.tie(nullptr); solve(); return 0;}

Measured memory_bytes: 3692
import math
a,b,c=map(int,input().split())

m=a*7+b

if c<a*7:
    print(math.ceil(c/a))
else:
    n=math.floor(c/m)
    p=c-m*n
    if p/a<7:
        x=n*7+math.ceil(p/a)
    else:
        x=n*7+7

    print(x)


Measured memory_bytes: 5668
#include <stdio.h>

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

int main(void) {
  int i, n, A[10000+1], q, key, sum = 0;
  scanf("%d",&n);
  for(i=0; i<n; i++) scanf("%d", &A[i]);
  scanf("%d",&q);
  for(i=0; i<q; i++) {
    scanf("%d", &key);
    if(search(A, n, key)) sum++;
  }
  printf("%d\n", sum);
  return 0;
}


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

void countingsort(vector<int>&a,vector<int>&b,int k){
	vector<int>c(k+1,0);
	for(int i=0;i<a.size();++i)++c.at(a.at(i));
	for(int i=1;i<=k;++i)c.at(i)+=c.at(i-1);
	for(int i=a.size()-1;i>=0;--i){
		b.at(c.at(a.at(i))-1)=a.at(i);
		--c.at(a.at(i));
	}
}

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n,k=0;
	cin>>n;
	vector<int>a(n),b(n);
	for(auto&i:a){
		cin>>i;
		k=max(k,i);
	}
	countingsort(a,b,k);
	cout<<b.at(0);
	for(int i=1;i<n;++i)cout<<" "s<<b.at(i);
	cout<<"\n"s;
}


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

const ll Mod = 1e9+7;
int n, m;

void solve() {
  if (abs(n-m) > 1) {
    cout << 0 << endl;
    return ;
  }
  ll ans = 1;
  rep(i, n) ans = ans * (ll)(i+1) % Mod;
  rep(i, m) ans = ans * (ll)(i+1) % Mod;
  if (n == m) ans = ans * 2LL % Mod;
  cout << ans << endl;
}
int main() {
  cin >> n >> m;
  solve();
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#define MOD 1000000007
typedef long long ll;
using namespace std;
vector<ll> fact, inv;


ll modpow(ll x, int n) {
  ll ans = 1;
  while (n > 0) {
    if (n & 1) {
      ans = ans * x % MOD;
    }
    x = x * x % MOD;
    n = n >> 1;
  }
  return ans;
}

ll comb(int n, int k) {
  if (k > n) {
    return 0;
  }
  return fact[n] * inv[k] % MOD * inv[n - k] % MOD;
}

int main(void) {
  int n, l, r;
  cin >> n;
  n++;
  vector<int> vec(n, -1);
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    if (vec[a - 1] >= 0) {
      l = vec[a - 1];
      r = i;
    } else {
      vec[a - 1] = i;
    }
  }
  int m = l + n - 1 - r;
  fact.push_back(1);
  inv.push_back(1);
  for (int i = 1; i <= n; i++) {
    fact.push_back(fact[i - 1] * i % MOD);
    inv.push_back(modpow(fact[i], MOD - 2));
  }
  for (int i = 1; i <= n; i++) {
    ll ans = (comb(n, i) - comb(m, i - 1) + MOD) % MOD;
    cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 3436
n,m=[int(i) for i in input().split()]
id=[[int(i) for i in input().split()]+[j] for j in range(m)]

pre_num=[0]*(n+1)
ans=[""]*m

id.sort(key=lambda x:x[1])

for p,y,i in id:
    pre_num[p]+=1
    ans[i]=str(p).zfill(6)+str(pre_num[p]).zfill(6)

print("\n".join(ans))


Measured memory_bytes: 34696
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define ALL(x) (x).begin(), (x).end()
#define REP(i ,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
typedef vector<int>vint;
typedef vector<ll>vll;
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename A,typename B>inline bool chmin(A &a,const B &b){if(a>b){a=b;return true;}else{return false;}}
template<typename A,typename B>inline bool chmax(A &a,const B &b){if(a<b){a=b;return true;}else{return false;}}

int main()
{
    int N;
    cin >> N;
    int cnt = 0;
    string ans = "No";
    REP(i,N){
        int d1, d2;
        cin >> d1 >> d2;
        if(d1 == d2){
            cnt++;
            if(cnt == 3){
                ans = "Yes";
            }
        }else{
            cnt = 0;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3456
n = gets.chomp.to_i
str = gets.chomp
z = [] #XとYの重複要素を格納

( 0..(n - 2) ).each do |i|
  x = str[0..i].split("")
  y = str[(i + 1)..(n - 1)].split("")
  z_ = x & y
  z_.uniq!
  z = z_ if z_.size > z.size
end

print z.size

Measured memory_bytes: 1916
#include <bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define INF 1e15
#define NASH 1e9+7
#define MAXN 200005
using namespace std;
ll n,k;
int main(){
    ios_base::sync_with_stdio(false),cin.tie(0);    
    cin>>n>>k;
    cout<<min(abs(n%k-k),max(0LL,k-abs(n%k-k)))<<endl;
}
/*
*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long ans[3001][6001];

int main()
{
    int n,t;
    cin>>n>>t;
    int a[n],b[n];
    for(int i=0; i<n; i++)
        cin>>a[i]>>b[i];
    vector<pair<int,int> > x;
    for(int i=0; i<n; i++)
        x.push_back(make_pair(a[i],b[i]));
    sort(x.begin(),x.end());
    memset(ans,0,sizeof(ans));
    for(int i=0; i<n; i++)
    {
        for(int j=0; j<=t+3000; j++)
        {
            if(0<=j-x[i].first && j-x[i].first<t)
                ans[i+1][j]=max(ans[i][j],ans[i][j-x[i].first]+x[i].second);
            else if(0<=j-x[i].first) ans[i+1][j]=max(ans[i+1][j-1],ans[i][j]);
            else ans[i+1][j]=ans[i][j];
        }
    }
    cout<<ans[n][t+3000]<<endl;
    return 0;
}


Measured memory_bytes: 141056
#include <stdio.h>
#include <iostream>
#include <string>

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

using namespace std;

int main()
{
    int A, B, C;

    scanf("%d %d %d", &A, &B, &C);

    string ans = A + B >= C ? "Yes" : "No";

    cout << ans << "\n";

    return 0;
}


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

using namespace std;

int mpow(int a, int b);

int main()
{
	int n, a, t = 0;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a;
		if (a % 2 == 0) {
			t++;
		}
	}
	
	cout << mpow(3, n) - mpow(2, t) << endl;

	return 0;
}

int mpow(int a, int b)
{
	int ans = 1;
	while (b != 0) {
		if ((b & 1) == 1) {
			ans *= a;
		}
		a *= a;
		b >>= 1;
	}

	return ans;
}

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define fore(i,x,n) for(int i=x;i<n;i++)
#define all(a) a.begin(),a.end()
#define pb push_back
#define ordenar(a) sort(all(a))
typedef long long ll;
typedef vector<int> vi;

int a[5], k;

int main(){
    IOS

    fore(i,0,5) cin>>a[i];
    cin>>k;

    fore(i,0,4){
        fore(j,i+1,5){
            if(a[j]-a[i] > k) {
                cout<<":(";
                return 0;
            }
        }
    }

    cout<<"Yay!";
    
    return 0;
}

Measured memory_bytes: 3648
#include <iostream>

using namespace std;

int main()
{   int K,X,s,t,d,o;
    cin>>K>>X;
    s=K-1;
    for(int i;i<K;i++){
            t=X-s;
        cout<<t<<" ";
        s--;
    }
    s=K-1;
    o=K-s;
    for(int j;j<K-1;j++){
        d=X+o;
        cout<<d<<" ";
        o++;
    }

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define dump(x) cout << (x) << endl
typedef long long ll;
typedef pair<int, int> P;


int main() {
  string s;
  cin >> s;
  if (s[0] != 'A') {
    dump("WA");
    return 0;
  }
  int cnt = 0;
  int n = (int)s.size();
  FOR(i, 2, n-1) {
    if (s[i] == 'C') {
      cnt++;
    }
  }
  if (cnt != 1) {
    dump("WA");
    return 0;
  }
  FOR(i, 2, n-1) {
    if (s[i] == 'C') {
      s.erase(s.begin()+i);
      break;
    }
  }
  s.erase(s.begin());
  REP(i, (int)s.size()) {
    if (!('a' <= s[i] && s[i] <= 'z')) {
      dump("WA");
      return 0;
    }
  }
  dump("AC");
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();

int main() {
    int n;
    string A, B, C;
    cin >> n >> A >> B >> C;
    int ans = 0;
    for(int i = 0; i < n; i++) {
        unordered_map<char, int> cnt;
        cnt[A[i]] += 1;
        cnt[B[i]] += 1;
        cnt[C[i]] += 1;
        ans += cnt.size()-1;
    }
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 256
n = int(input())
s = list(input())

a = []

for i in range(len(s)):
  b =  ord(s[i])
  b -= 65
  b += n
  b = b % 26
  b += 65
  b = chr(b)
  a.append(b)

  
a= ''.join(a)
  
print(a)

Measured memory_bytes: 3188
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[][] array = new int[2][n];
        int candySum = 0;
        for (int i = 0; i < 2; i++) {
            for (int j = 0; j < n; j++) {
                array[i][j] = sc.nextInt();
            }
        }
        int i, j;
        int max = 0;
      int t=n;
        for (; t >= 0; t--) {
            candySum = 0;
            for (i = 0; i < t; i++) {
                candySum += array[0][i];
            }
          if(i!=0) i-=1;
            for (j = i ; j < n; j++) {
                candySum += array[1][j];
             
            }
            if (candySum > max)
                max = candySum;
        }
        System.out.println(max);
    }
}


Measured memory_bytes: 22996
def solve(n):
    li = [0] * (n ** 3 + 1)
    for x in range(1, n + 1):
        for y in range(1, n + 1):
            for z in range(1, n + 1):
                li[x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x] += 1
    return li


N = int(input())
ans = solve(100)
[print(ans[i]) for i in range(1, N + 1)]


Measured memory_bytes: 17040
function main(input) {
  input=input.trim();
  const a = parseInt(input.split(" ")[0], 10);
  const b = parseInt(input.split(" ")[1], 10);
  const c = parseInt(input.split(" ")[2], 10);
  const d = parseInt(input.split(" ")[3], 10);
  var arr=[a,b,c,d]
  arr.sort(function(a,b){
    if( a < b ) return -1;
    if( a > b ) return 1;
    return 0;
  });
  if(b<=c||d<=a){
    console.log(0);
  }else{
    console.log(arr[2]-arr[1]);
  }
    

}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
#include<stdio.h>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>     
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define ld long double
#define rep(a,t) for(int a=0;a<t;a++) 
#define forever while(true)
#define Sort(a) sort(a.begin(),a.end())
#define Reverse(a) reverse(a.begin(),a.end())
#define pb push_back
int main()
{
	
	int a, b, n;
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	cin >> a >> b >> n;
	for (int i = a; i <= b; i++) {
		if (i  <=a+ (n-1) || b - (n-1) <= i) {
			cout << i << endl;
			//return 0;
		}
	}
	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;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  reverse(s.begin(), s.end());
  vector<string> str = {"dream", "dreamer", "erase", "eraser"};
  rep(i, 4) reverse(str[i].begin(), str[i].end());
  string t;
  rep(i, s.size()) {
    t += s[i];
    rep(j, 4) {
      if (t == str[j])
        t = "";
    }
  }
  if (t == "")
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}

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

int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin >> A.at(i);
  }
  long long res=1000;
  for(int i=0;i<N-1;i++){
    int S=A.at(i);
    int T=A.at(i+1);
    if(S<T){
      long long C=res/S;
      res%=S;
      res+=C*T;
    }
  }
  cout << res << endl;
}
    

Measured memory_bytes: 3604
#include <stdio.h>
#include <iostream>
#include <string>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <sstream>
#include <fstream>
#include <iomanip>

#define rep(i,a,b) for(long long i=a;i<b;i++)

using namespace std;


int main(void) {

	long long N = 0, D = 0, A = 0, B = 0, C = 0;
	long long x[100] = {0};
	//long long y[20] = {};
	string s;
	
	long long min = 0, min2 = 0;
	long long dif = 0;
	long long hoge = 0;
	long long sum = 0;

	cin >> N;
	
	rep(i, 0, N) {
		cin >> x[i];
	}

	rep(i, 0, N-1) {
		
		if (x[i] == x[i + 1]) {
			hoge++;
			i++;
		}
	}

		cout << hoge << endl;
		
	
	return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include<map>
#include<string>
#include<algorithm>
#include<sstream>
#include<cmath>
#include<typeinfo>
#include<queue>
#include<iomanip>
using namespace std;
int main(){
	int A, B;
	cin >> A >> B;
	cout << A * B;
}

Measured memory_bytes: 3596
def solve(string):
    from collections import deque
    n, m, *ab = map(int, string.split())
    p = [[] for _ in range(n)]
    for a, b in zip(*[iter(ab)] * 2):
        p[a - 1].append(b - 1)
        p[b - 1].append(a - 1)
    s, ans, d = deque([0]), [0] * n, [0] + [n] * (n - 1)
    while s:
        c = s.popleft()
        for t in p[c]:
            if d[c] + 1 < d[t]:
                d[t] = d[c] + 1
                ans[t] = c + 1
                s.append(t)
    return "Yes\n" + "\n".join(map(str, ans[1:]))


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))


Measured memory_bytes: 63104