akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
    int count, temp = 0;
    cin >> count;
    int A[count + 1];
    for (int i = 0; i < count; i++)
    {
        cin >> A[i];
    }

    for (int i = 0; i < count; i++)
        for (int j = count - 1; j > i; j--)
        {
            if (A[j] < A[j - 1])
            {
                swap(A[j], A[j - 1]);
                temp++;
            }
        }
    for (int i = 0; i < count; i++)
    {
        if (i < count - 1)
            cout << A[i] << " ";
        else
            cout << A[i];
    }
    cout << endl;
    cout << temp << endl;
    return 0;
}


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

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;



int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n; cin >> n;
	vi v(n);
	REP(i, n)cin >> v[i];
	int sum = 0;
	REP(i, n)sum += v[i];
	int t = INF;
	REP(i, n)t = min(t, abs(sum - n * v[i]));
	REP(i, n) {
		if (t == abs(sum-v[i]*n)) {
			cout << i << endl;
			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 dim = Integer.parseInt(sc.nextLine());
      
      //declare vectors
      double[] x = new double[dim];
      double[] y = new double[dim];
      
      //initialize x
      String[] input = sc.nextLine().split(" ");
      for(int i = 0; i < dim; i ++) {
         x[i] = Integer.parseInt(input[i]);
      }
      
      //initialize y
      input = sc.nextLine().split(" ");
      for(int i = 0; i < dim; i ++) {
         y[i] = Integer.parseInt(input[i]);
      }
      
      printDistance(1.0, x, y);
      printDistance(2.0, x, y);
      printDistance(3.0, x, y);
      printChebyshev(x, y);
      
   }
   
   public static void printDistance(double p, double[] x, double[] y) {
      double distance = 0;
      int dim = x.length;
      
      for(int i = 0; i < dim; i ++) {
         double temp = Math.abs(x[i] - y[i]);
         temp = Math.pow(temp, p);
         distance += temp;
      }
      distance = Math.pow(distance, 1.0 / p);
      
      System.out.println(distance);
   }
   
   public static void printChebyshev(double[] x, double[] y) {
      double max = Math.abs(x[0] - y[0]);
      int dim = x.length;
      
      for(int i = 1; i < dim; i ++) {
         double temp = Math.abs(x[i] - y[i]);
         if (temp > max) {
            max = temp;
         }
      }
      
      System.out.println(max);
   }
   
}


Measured memory_bytes: 26364
#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;

int main(){
	int N,M;
	cin >> N >> M;
	map<pair<int,int>,int> mp;
	rep(i,M){
		int a,b;
		cin >> a >> b;
		a--;b--;
		mp[make_pair(a,b)]++;
		mp[make_pair(b,a)]++;
	}
	
	vector<int> d;
	rep(i,N){
		d.push_back(i);
	}
	
	int ans = 0;
	
	do{
		bool ok = true;
		if(d[0] != 0) continue;
		//間に辺がなかったらアウト
		rep(i,N-1){
			if(mp[make_pair(d[i], d[i+1])] == 0) ok = false;
		}
		if(ok) {
			ans++;
		}
	}while(next_permutation(d.begin(),d.end()));
	
	cout << ans << endl;
    return 0;
}




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

// syntax sugar: `for (int i = 0; i < N; ++i)`
#define rep(i, N) for (int i = 0; i < (int)(N); ++i)
#define rep2(i, startValue, N) for (int i = (int)(startValue); i < (int)(N); ++i)
// syntax sugar: `for (int i = 0; i < N; ++i)`
#define REP(type, name, beginValue, endCondValue) \
  for (type name = beginValue; name < endCondValue; ++name)
// syntax sugar: 多次元vector
#define VECTOR_DIM3(T, name, d1, d2, d3, initValue) \
    std::vector<std::vector<std::vector<T>>> name(d1, std::vector<std::vector<T>>(d2, std::vector<int>(d3, initValue)));
#define VECTOR_DIM2(T, name, d1, d2, initValue) \
    std::vector<std::vector<T>> name(d1, std::vector<T>(d2, initValue));
#define VECTOR_DIM1(T, name, d1, initValue) \
    std::vector<T> name(d1, initValue);
#define ll long long
#define ld long double
#define DUMP(v) "," #v ":" << v


int main(){
  ll a, b, c, d;
  cin >> a >> b >> c >> d;

  vector<ll> ans;
  ans.push_back(a * c);
  ans.push_back(a * d);
  ans.push_back(b * c);
  ans.push_back(b * d);
  sort(ans.begin(), ans.end(), std::greater<ll>());

  cout << *ans.begin() << endl;
  return 0;
}


Measured memory_bytes: 3624
s = input()
A, B, C, D = s[0], s[1], s[2], s[3]
ans = 7
siki = [[] for _ in range(2**3)]
for i in range(2 ** 3):
    for j in range(3):
        if (i >> j) & 1:
            siki[i].append("+")
        else:
            siki[i].append("-")

for o1, o2, o3 in siki:
    temp = A + o1 + B + o2 + C + o3 + D
    if eval(temp) == ans:
        print(temp + "=7")
        break

Measured memory_bytes: 3064
import java.util.*;
import java.io.*;
public class Main
{
    public static void main(String []args) throws IOException {
    	FastScanner in  = new FastScanner(System.in);
    	PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), false);
    	solve(in, out);
    	in.close();
    	out.close();
    }
    static long gcd(long a, long b){ return (b==0) ? a : gcd(b, a%b); }
    static int gcd(int a, int b){ return (b==0) ? a : gcd(b, a%b); }
    static class FastScanner{
	BufferedReader reader;
	StringTokenizer st;
	FastScanner(InputStream stream){reader=new BufferedReader(new InputStreamReader(stream));st=null;}
	String next(){while(st == null || !st.hasMoreTokens()){try{String line = reader.readLine();if(line == null){return null;}
	     st = new StringTokenizer(line);}catch (Exception e){throw new RuntimeException();}}return st.nextToken();}
	String nextLine()  {String s=null;try{s=reader.readLine();}catch(IOException e){e.printStackTrace();}return s;}
	int    nextInt()   {return Integer.parseInt(next());}
	long   nextLong()  {return Long.parseLong(next());}
	double nextDouble(){return Double.parseDouble(next());}
	char   nextChar()  {return next().charAt(0);}
	int[]  nextIntArray(int n)         {int[] arr= new int[n];   int i=0;while(i<n){arr[i++]=nextInt();}  return arr;}
	long[] nextLongArray(int n)        {long[]arr= new long[n];  int i=0;while(i<n){arr[i++]=nextLong();} return arr;}
	int[]  nextIntArrayOneBased(int n) {int[] arr= new int[n+1]; int i=1;while(i<=n){arr[i++]=nextInt();} return arr;}
	long[] nextLongArrayOneBased(int n){long[]arr= new long[n+1];int i=1;while(i<=n){arr[i++]=nextLong();}return arr;}
	void   close(){try{reader.close();}catch(IOException e){e.printStackTrace();}}
    }
    
    /********* SOLUTION STARTS HERE ************/
    
    private static void solve(FastScanner in, PrintWriter out){
        int n = in.nextInt();
        int a[] = new int[n];
        int b[] = new int[n];
        for(int i=0;i<n;i++){
            a[i]=in.nextInt();
            b[i]=a[i];
        }
        int f=0;
        for(int i=0;i<n;i++){
            int ind=i;
            for(int j=i+1;j<n;j++){
                if(a[j]<a[ind]) ind = j;
            }
            if(ind!=i){
                int tmp = a[i];
                a[i] = a[ind];
                a[ind]=tmp;
                f++;
            }
        }
        out.println(f<2?"YES":"NO");
    }
    /************* SOLUTION ENDS HERE **********/
}

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

using System.Collections;

class Program
{
    static void Main()
    {
        int N = int.Parse(Console.ReadLine());
        int[] AList = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();

        int[] GCD_Ruiseki_L = new int[N];
        int[] GCD_Ruiseki_R = new int[N];
        
        //Lには、i番目よりも左側にある数のGCDをiに入れる。
        //Rには、i番目よりも右側にある数のGCDをiに入れる。

        for(int i = 1; i < N; i++)
        {
            GCD_Ruiseki_L[i] = getGCD(GCD_Ruiseki_L[i - 1], AList[i - 1]);
            GCD_Ruiseki_R[N - 1 - i] = getGCD(GCD_Ruiseki_R[N - 1 - i + 1], AList[N - 1 - i + 1]); 
        }

        Console.WriteLine(Enumerable.Range(0, N).Max(n => getGCD(GCD_Ruiseki_R[n], GCD_Ruiseki_L[n])));
    }

    static int getGCD(int num1, int num2)
    {
        if (num1 < num2)
        {
            var tmp = num1;
            num1 = num2;
            num2 = tmp;
        }

        if (num2 == 0)
        {
            return num1;
        }
        int rem;
        Math.DivRem(num1, num2, out rem);
        
        return getGCD(num2, rem);
    }
}

Measured memory_bytes: 27100
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#include<climits>
#include<set>
#include<utility>
using namespace std;
typedef long long int ll;

int main(){

	int a, b, c;
	cin >> a >> b >> c;

	int x[3];
	x[0]=a, x[1]=b, x[2]=c;
	sort(x, x+3);

	int s=x[2]-x[1];
	int t=x[2]-x[0];
	int u=s+t;
	if(u%2==0){
		cout << u/2 << endl;
	} else {
		cout << (u+3)/2 << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define in(x) cin >> x
#define out(str) cout << str << endl

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

int N,K,mini;

int main(){
    cin>>N>>K;
    int dp[N],h[N];
    rep(i,N){
        cin>>h[i];
    }
    dp[0]=0;
    repi(i,1,N){
        mini=dp[i-1]+abs(h[i-1]-h[i]);
        repi(j,1,K+1){
            if((i-j)<0)break;
            mini=min(mini,dp[i-j]+abs(h[i-j]-h[i]));
        }
        dp[i]=mini;
    }
    out(dp[N-1]);
}


Measured memory_bytes: 1024
#include <stdio.h>

#define DSIZE 20000
#define PSIZE 10000

int top = 0, dipth[DSIZE] = {0};

typedef struct {
  int posi;
  int area;
} puddle_t;

puddle_t p[PSIZE];

int isEmpty(){
  return top == 0;
}
 
int isFull(){
  return DSIZE - 1 <= top;
}
 
int push(int posi){
  if (isFull())
    puts("over flow");
  top++;
  dipth[top] = posi;
  return 0;
}
 
int pop(){
  if (isEmpty())
    puts("under flow");
  top--;
  return dipth[top + 1];
}

int calculate(int width){
  if (width == 2)
    // triangle
    return width * 1 / 2;
  else
    // trapezoid
    return (width + width - 2) * 1 / 2;
}

int main(void){
  char c;
  int allArea = 0, posi = 0, i = 0, x, j;

  while ((c = fgetc(stdin)) != '\n') {
    switch (c) {
    case '\\':
      push(posi);
      break;
    case '/':
      if (isEmpty())
	break;
      x = pop();
      p[i].posi = x;
      p[i].area = calculate(posi + 1 - x);
      if (i == 0 || p[i - 1].posi < x)
	i++;
      else {
	for (; x < p[i - 1].posi; i--)
	  p[i - 1].area += p[i].area;
	i++;
      }
      break;
    case '_':
      break;
    default:
      puts("Non definition symbol!");
      break;
    }
    posi++;
  }
  
  // output
  for (j = 0; j < i; j++)
    allArea += p[j].area;
  printf("%d\n", allArea);

  printf("%d", i);
  for (j = 0; j < i; j++)
    printf(" %d", p[j].area);
  puts("");
  return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define i_love_u_Phuong ios_base::sync_with_stdio(0); cin.tie(0);

using ll = long long;
using namespace std;
const ll mod = 1e9+7;

ll lt(ll x,ll y)
{

}

int main()
{
#ifndef RICARDO
    //freopen("input.txt", "r", stdin);
#endif // ONLINE_JUDGE
    i_love_u_Phuong;
    map<string, int> mp;
    int n;
    cin >> n;
    vector<string> a;
    for(int i=0; i<n; ++i)
    {
        string st;
        cin >> st;
        sort(st.begin(),st.end());
        if (mp[st]==0) a.push_back(st);
        mp[st]++;
    }
    ll ans=0;
    for(int i=0; i<a.size(); ++i)
    {
        ll id = mp[a[i]];
        ans+=(id*(id-1))>>1;
    }
    cout  << ans;
    return 0;
}



Measured memory_bytes: 16628
import java.io.PrintWriter;
import java.util.*;

import static java.lang.Math.*;

public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in); 
		PrintWriter out=new PrintWriter(System.out);
		double money = 100000;
		final double tax = 1.05;
		int n= sc.nextInt();
		for(int i=0;i<n;i++){
			money*=tax;
			money/=1000;
			money=ceil(money);
			money*=1000;
		}
		out.println((int)money);
		out.flush();
	}

}


	

Measured memory_bytes: 17196
#include <bits/stdc++.h>
#define r(i,a,n) for(int i=a;i<n;i++)
#define INF 1<<29
using namespace std;
main(){
  int m,n;
  while(cin>>m>>n,n){
    int a1[n][n],a2[n][n],q,w,e,r;
    r(i,0,n)r(j,0,n){
      if(i==j)a2[i][j]=a1[i][j]=0;
      else a2[i][j]=a1[i][j]=INF;
    }
    while(m--){
      scanf("%d%d%d%d",&q,&w,&e,&r);q--;w--;
      a1[q][w]=a1[w][q]=e;
      a2[q][w]=a2[w][q]=r;
    }
    r(k,0,n)r(i,0,n)r(j,i+1,n){
      a1[i][j]=a1[j][i]=min(a1[i][j],a1[i][k]+a1[k][j]);
      a2[i][j]=a2[j][i]=min(a2[i][j],a2[i][k]+a2[k][j]);
    }
    cin>>e;
    while(e--){
      scanf("%d%d%d",&q,&w,&r);q--;w--;
      if(r)cout<<a2[q][w]<<endl;
      else cout<<a1[q][w]<<endl;
    }
  }
}

Measured memory_bytes: 3176
#include <iostream>
#include <unordered_set>
#include <vector>

int main() {
    int N;
    std::cin >> N;
    std::unordered_set<int> aa;
    std::unordered_set<int> dups;
    std::vector<int> A(N);
    for (int i = 0; i < N; ++i) {
        int a;
        std::cin >> a;
        A[i] = a;
        if (aa.find(a) != aa.end()) {
            dups.insert(a);
        } else {
            aa.insert(a);
        }
    }

    std::unordered_set<int> others(A.begin(), A.end());
    int ans = 0;
    for (int a : A) {
        if (dups.find(a) != dups.end()) {
            continue;
        }
        others.erase(a);
        int i = 1;
        bool ok = true;
        for (i = 1; i * i <= a; ++i) {
            if (a % i == 0) {
                if (others.find(i) != others.end() ||
                    others.find(a / i) != others.end()) {
                    ok = false;
                    break;
                }
            }
        }
        if (ok) {
            ++ans;
        }
        others.insert(a);
    }
    std::cout << ans << std::endl;
}


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

const ll logx=30;
const ll N=4e5+5;
const ll M=3e5+5;
const ll mod=1e9+7;
const ll INF=1e18+5;
const double PI = 3.14159265358979323846;

#define ints(n) scanf("%d",&n)
#define intp(n) printf("%d\n",n)
#define longs(n) scanf("%intd",&n)
#define longp(n) printf("%intd\n",n)

inline ll mul(ll a, ll b){ return (a * 1ll * b) % mod; }
inline ll sub(ll a, ll b){ ll c = a - b; if(c < 0) c += mod; return c; }
inline ll add(ll a, ll b){ ll c = a + b; if(c > mod) c -= mod; return c; }

#define f first
#define s second
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define mp(x,y) make_pair(x,y)
#define GCD(a,b) __gcd((a),(b))
#define all(v) v.begin(),v.end()
#define bits(x) __builtin_popcount(x)
#define LCM(a,b) ((a)*(b))/GCD((a),(b))
#define ms(dp,val) memset(dp,val,sizeof(dp))
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
template<typename T> T power(T x,T y,ll m){T ans=1;while(y>0){if(y&1LL) ans=(ans*x)%m;y>>=1ll;x=(x*x)%m;}return ans%m;}

#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl

ll n,a[N],dp[N][2];

ll F(ll idx,ll f)
{
  ll maxi=-INF;
  if(idx==n-1)
  {
    if(f){return -a[idx];}
    return a[idx];
  }
  if(dp[idx][f]!=-1){return dp[idx][f];}
  if(f)
  {
    maxi=max(maxi,a[idx]+F(idx+1,1));
    maxi=max(maxi,(-a[idx])+F(idx+1,0));
  }
  else
  {
    maxi=max(maxi,a[idx]+F(idx+1,0));
    maxi=max(maxi,(-a[idx])+F(idx+1,1));
  }
  return dp[idx][f]=maxi;
}

int main()
{
  cin>>n;
  ms(dp,-1);
  for(ll i=0;i<n;i++){cin>>a[i];}
  cout<<max(a[0]+F(1,0),(-a[0])+F(1,1))<<endl;
}


Measured memory_bytes: 13056
from collections import Counter
from collections import deque
from functools import reduce
from pprint import pprint
# import statistics
import bisect
import copy
import fractions
import math
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers): return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers): return reduce(LCM, numbers)
def LCM(m, n): return (m * n // fractions.gcd(m, n))
def unite(x, y):
    # それぞれのノードの根を求める
    x = root(x)
    y = root(y)
    if x == y:
        return
    # node[x]の根をyに変更する
    node[x] = y
def same(x,y): return bool(root(x) == root(y))
def root(x):
    if node[x] == x:  # xが根の場合
        return x
    else:
        node[x] = root(node[x])  # 経路圧縮
        return node[x]
def dfs(v):
    # ノードに訪れた
    visited[v] = True
    for v2 in range(n):
        if graph[v][v2] == False:  # そもそもvとv2が辺でつながっていない
            continue
        if visited[v2] == True:  # もう見た
            continue
        dfs(v2)


n = II()
a = sorted(LI(), reverse=True)
print(sum(a[::2]) - sum(a[1::2]))



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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

// For modular arithmetic when a modular is specified per input case.
// Verified: ABC129F
struct ModInt {
 private:
  static int64 M;
  int64 x;
 public:
  static void SetMod(int64 mod) {
    M = mod;
  }
  ModInt(int64 input_x) : x(input_x % M) {}
  ModInt() : x(0) {}
  int64 Value() { return x; }
  inline ModInt operator+(ModInt o) {
    ModInt r(*this); r += o; return r;
  }
  inline ModInt operator-(ModInt o) {
    ModInt r(*this); r -= o; return r;
  }
  inline ModInt operator* (ModInt o) {
    ModInt r(*this); r *= o; return r;
  }
  inline void operator+= (ModInt o) { x = (x + o.x) % M; }
  inline void operator-= (ModInt o) { x = (x + M - o.x) % M; }
  inline void operator*= (ModInt o) { x = (x * o.x) % M; }
};
int64 ModInt::M = 1;  // Do not forget to add this line.

template<typename T>
vector<vector<T>> MakeVector2D(int d1, int d2, T default_value) {
  return vector<vector<T>>(d1, vector<T>(d2, default_value));
}

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

  int n;
  cin >> n;
  int m;
  cin >> m;
  ModInt::SetMod(m);

  const int BASE = n;
  auto dp = MakeVector2D<ModInt>(3 * n + 1, 2 * n + 1, ModInt(0));
  dp[0][BASE] = 1;
  for (int i = 0; i < 3 * n; i++) {
    for (int k = 0; k <= 2 * n; k++) {
      if (dp[i][k].Value() == 0) continue;
      // Size 1
      dp[i + 1][min(k + 1, 2 * n)] += dp[i][k];

      // Size 2
      if (k > 0 && i + 2 <= 3 * n) {
        dp[i + 2][k - 1] += dp[i][k] * (i + 1);
      }

      // Size 3
      if (i + 3 <= 3 * n) {
        dp[i + 3][k] += dp[i][k] * (i + 1) * (i + 2);
      }
    }
  }

  ModInt ans = 0;
  for (int k = BASE; k <= 2 * n; k++) {
    // cout << dp[3 * n][k].Value() << endl;
    ans += dp[3 * n][k];
  }
  cout << ans.Value() << endl;
}

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

using namespace std;
#define pi 3.14159265358979323846
int main(){
	int a,b,h,m;
	cin>>a>>b>>h>>m;
	m=60*h+m;
	double ds=m/2.0,df=(m%60)*6.0;
	double dc=fabs(ds-df);
	if(dc>=180)dc=360-dc;
	cout<<fixed<<setprecision(20)<<sqrt(a*a+b*b-2*a*b*cos(dc*pi/180));
	return 0;
}

Measured memory_bytes: 4228
#include<bits/stdc++.h>
using namespace std ;
#define ll long long
#define ld long double
#define ff first
#define ss second
const ll mod =   1e9+7 ;
ll multiply(ll a, ll b ){ return ((a % mod) * (b % mod)) % mod; }
ll add(ll a, ll b) {     return ((a % mod) + (b % mod)) % mod; }
ll sub(ll a, ll b) { return ((a%mod) - (b % mod)+ mod) % mod ; }
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
void solve(){
    int n , m ;
    cin >> n >> m ;
    vector < int > a(n) ;
    int sum = 0 ;
    for( int i = 0 ; i < n ; i++) cin >> a[i] , sum+=a[i];
    sort(a.rbegin(),a.rend());
    int k = ceil( (1.0*sum) / (4*m) ) ;
    for( int i = 0 ; i < n ; i++){
        if(a[i]>=k){
            m--;
        }
    }
    if(m<=0){
        cout << "Yes\n";
    }
    else
        cout << "No\n";
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t ;
    t = 1 ;

    //cin >> t ;
    while(t--){
        solve( );
    }
}


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

namespace Lsk {
#define _auto_ template <typename T>

// fast io
#define writesp(x) (write(x), putchar(' '))
#define writeln(x) (write(x), putchar('\n'))
_auto_ inline void read(T &x) {
	x = 0; bool sgn = false; char ch = getchar();
	while(!isdigit(ch)) (ch == '-') && (sgn = true), ch = getchar();
	while(isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
	if(sgn) x = -x;
}
_auto_ inline void write(T x) {
	if(x < 0) putchar('-'), x = -x;
	static char buf[40]; int o = 0;
	for(x; x > 9; x /= 10, ++o) buf[o] = x % 10 + '0'; buf[o] = x + '0';
	for(o; ~o; --o) putchar(buf[o]);
	return;
}

// cmin / cmax / swap
_auto_ inline void cmin(T &u, const T v) { if(u > v) u = v; }
_auto_ inline void cmax(T &u, const T v) { if(u < v) u = v; }
_auto_ inline T min(const T u, const T v) { return u < v ? u : v; }
_auto_ inline T max(const T u, const T v) { return u > v ? u : v; }
_auto_ inline void swap(T &u, T &v) { T tmp(u); u = v, v = tmp; }

// math
const int mod = 998244353, mod_2 = 1996488706;
//const int mod = 1000000007, mod_2 = 2000000014;
//const int mod = 1000000009, mod_2 = 2000000018;
_auto_ inline T abs(T x) { return x > 0 ? x : -x; }
_auto_ inline T gcd(T u, T v) {	return v ? gcd(v, u % v) : u; }
_auto_ inline T Mod(T u) { return u >= mod_2 ? u % mod : (u > mod ? u - mod : u); }
_auto_ inline T inmod(T u) { return u >= mod ? u - mod : (u < 0 ? u + mod : u); }
inline long long fpm(long long base, long long mi) {
	long long res = 1;
	while(mi) {
		if(mi & 1) res = Mod(res * base);
		base = Mod(base * base), mi >>= 1;
	}
	return res;
}

} using namespace Lsk;
#define N 200005
using std :: sort;

int n;
int a[N], f[N];
long long K;

inline bool check(long long mid) {
	long long res = 0;
	for(int i = 1; i <= n; ++i) {
		long long to = mid / f[i];
		if(to < a[i]) res += a[i] - to;	
	}
	return res <= K;
}

int main() {
	read(n), read(K);
	for(int i = 1; i <= n; ++i) read(a[i]);
	for(int i = 1; i <= n; ++i) read(f[i]);
	
	sort(a + 1, a + 1 + n);
	sort(f + 1, f + 1 + n, std :: greater<long long>());
	
	long long l = 0, r = 1e12, mid, minp = 1e18;
	while(l <= r) {
		mid = l + r >> 1;
		//writesp(l), writeln(r);
		if(check(mid)) {
			cmin(minp, mid);
			r = mid - 1;
		} else {
			l = mid + 1;
		}
	}
	
	writeln(minp);
	return 0;
}

Measured memory_bytes: 1792
import java.util.Scanner;

class Main
{
  public static void main(String[] args)
  {
	  int l,w;
	  boolean t=true;
	  Scanner in=new Scanner(System.in);
	  
	  while(t)
      { l=in.nextInt();
	    w=in.nextInt();
		
		if(l==0 && w==0)
		{       
			break;
		}
		
        for(int i=0;i<l;i++)
        {
		    for(int j=0;j<w;j++)
		    {
				if(i==0 || i==l-1 || j==0 || j==w-1)
			      System.out.print("#");
			    else
				  System.out.print(".");
		    }
		    System.out.println("");
	    }
		System.out.println("");
		
	  }		
	  

    
  }

}

Measured memory_bytes: 33048
#include <bits/stdc++.h>
using namespace std;
int main(){
  int64_t N, P, ans = 0;
  string S;cin >> N >> P >> S;
  reverse(S.begin(), S.end());
  if (P == 2 || P == 5){
    for (int i = 0; i < N; i++){
      int sint = S[i] - '0';
      if (sint % P == 0)
        ans += N - i;
    }
  }
  else{
    vector<int64_t> Count(10000, 0);
    Count[0]++;
    int64_t num = 1, cur = 0;
    for (int i = 1; i <= N; i++){
      int sint = S[i - 1] - '0';
      cur = (cur + sint * num) % P;
      ans += Count[cur];
      Count[cur]++;
      num *= 10;num %= P;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 640
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define each(i, mp) for(auto& i:mp)

int main() {
    string s;
    cin >> s;
    map<ll, ll> mp;
    mp[0] = 1;
    reverse(s.begin(), s.end());
    ll now = 0, ten = 1;
    each(e, s){
        now = (now + (e - '0') * ten) % 2019;
        ten *= 10;
        ten %= 2019;
        mp[now]++;
    }
    ll ans = 0;
    each(e, mp){
        ans += e.second * (e.second - 1) / 2; //組み合わせの数
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

int main() {

	string s;
	cin >> s;
	int a,b,c,d;
	a = s[0]-48; b = s[1] - 48; c = s[2] - 48; d = s[3] - 48;
	int i, j, k;
	int sumi,sumj,sumk;
	for (i = 0; i < 2; i++) {
		if (i == 0) { sumi = a + b; }
		else { sumi = a - b; }
		for (j = 0; j < 2; j++) {
			if (j == 0) { sumj = sumi + c; }
			else { sumj = sumi - c; }
			for (k = 0; k < 2; k++) {
				if (k == 0) { sumk = sumj + d; }
				else { sumk = sumj - d; }
				if (sumk == 7) {
					cout << a << (i == 0 ? "+" : "-") << b << (j == 0 ? "+" : "-") << c << (k == 0 ? "+" : "-") <<d << "=7" <<endl;
					return 0;
				}

			}
		}
	}

}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <vector>
#include <math.h>
using namespace std;

typedef long long ll;

/*
const ll M = 1000000007;
vector<ll> fac(3001);
vector<ll> ifac(3001);
ll mpow(ll x, ll n){
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % M;
        x = x*x % M;
        n = n >> 1;
    }
    return ans;
}
 
ll comb(ll a, ll b){
    if(a == 0 && b == 0)return 1;
    if(a < b || a < 0 || b < 0)return 0;
    ll tmp = ifac[a-b]* ifac[b] % M;
    return tmp * fac[a] % M;
}
*/


ll lcm(ll a,ll b){
 
  ll r, x, tmp;
  x = a * b;
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return x/b;
}

ll gcd(ll a ,ll b){
    if(a==0){return b;}
    else if(b==0){return a;}
    else{
    ll tmp,r;
    if(a<b){
        tmp = a;
        a = b;
        b = tmp;
    }
    
    r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
    }
}

bool sosu(ll p){
    bool ans = true;
    double psqrtd = pow(p, 0.5);
    ll psqrt = psqrtd;
    for(ll i = 2; i <= psqrt; i++){
        if(p%i==0)ans = false;
    }
    if(p==1)ans = false;
    return ans;
}

vector< bool > prime_table(ll n) {
  vector< bool > prime(n + 1, true);
  if(n >= 0) prime[0] = false;
  if(n >= 1) prime[1] = false;
  for(int i = 2; i * i <= n; i++) {
    if(!prime[i]) continue;
    for(int j = i + i; j <= n; j += i) {
      prime[j] = false;
    }
  }
  return prime;
}

int main(void){
    ll n,a,b;
    cin >> a >> b;
    ll ans = 0;
    ans = a * b;
    if(a>=10||b>=10)ans = -1;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#include<iomanip>
#include<math.h>
#define rip(i,n) for(int i=0;i<n;i++)
#define ll long long
#define lb long double
#define vec vector<int>
#define set setprecision
#define pi 3.141592653589793238
using namespace std;
int main() {
	while (true) {
		int  m, t, r;
		cin >> m >> t >> r;
		if ((m == -1) && (t == -1) && (r == -1))break;
		if (m == -1 || t == -1)cout << "F" << endl;
		else {
			if (m + t >= 80)cout << "A" << endl;
			else if (m + t >= 65)cout << "B" << endl;
			else if (m + t >= 50)cout << "C" << endl;
			else if (m + t >= 30 && r >= 50)cout << "C" << endl;
			else if (m + t >= 30)cout << "D" << endl;
			else cout << "F" << endl;
		}
	}
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
#define itn int
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) x.begin(), x.end()
#define pb  push_back
#define mb  make_pair
#define fi  first
#define se  second

typedef vector<int> vi;
typedef long long ll;
typedef pair<int, int> pii;
const ll mod = 1000000007;


void solve()
{
    ll a, b, c;
    cin >> a >> b >>c;

    ll i = a%b, j;
    if(c >= b)
        j = b-1;
    else
        j = c;

    cout << (a/b)*j + (i*j)/b;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    solve();
	return 0;
}


Measured memory_bytes: 3628
import java.util.*;
class Main{
	public static void main(String[]args){
    	Scanner in = new Scanner(System.in);
      	int h = in.nextInt();
      	int a = in.nextInt();
      	int i = 0;
        while(h>0){
        	h-=a;i++;
        }
      	System.out.println(i);
    }
}

Measured memory_bytes: 22868
open List 
(* 1行読み込みする関数 *)
(* i_inp : 1行読み込んで整数に変換, f_inp, s_inpもある *)
let inp : unit -> string = fun () -> 
	input_line stdin
 
(* 1行読み込んで、空白で分割する関数 *)
let inp_list : unit -> string list = fun () ->
	Str.split (Str.regexp " ") (inp ())
let i_inp_list : unit -> int list = fun () ->
	map (fun x -> int_of_string x) (inp_list ())
      
(* 関数本体 *)
let () =
  let [n; x] = i_inp_list () in
  let l = i_inp_list () in
  let rec loop total list n =
    match list with
      [] -> n
    | y :: rest ->
       let total' = y + total in
       if total' > x then n
       else loop total' rest (n + 1)
  in
  print_int (loop 0 l 1);
  print_newline ()


Measured memory_bytes: 384
#include <iostream>
#include <numeric>
#include <string>
#include <algorithm>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <utility>

#define repd(i,a,b); for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define ll long long int
 
 
using namespace std;
int main() {
  int n; cin >> n;
  int h[n+1];
  h[0] = 0;
  rep(i,n){
    cin >> h[i+1];
  }
  
  int ans = 0;
  int mn =1000;
  int zcnt =0;
  bool chk = true;
  
  for(int j=0;;j++){
    
   mn = 1000;
   zcnt = 0;
  
   /* hが全て0なら、ansを出力 */
   chk = true;
   rep(p,n+1){
     if(h[p] != 0){
       chk = false;
     }
   }
   if(chk){
     cout << ans;
     exit(0);
   }
   
   
   /* hの0でない最小値を調べる */
    rep(k,n+1){
      if(h[k] != 0){
      mn = min(mn, h[k]);
      }
    }

  
    /*　hの区間数を調べる */
  
    
    for(int q=0; q<n; q++){
      if(h[q] == 0 && h[q+1] != 0){
        zcnt++;
      }
    }
    
   
    /* ansに区間数*最小値を加える */
  
    ans += zcnt*mn;
  
    /* hを全て最小値分減らす */
   
    
    rep(o,n+2){
      if(h[o] != 0){
        h[o] -= mn;
      }
    }
  }
 
 return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string.h>
#include<queue>
using namespace std;
struct cube {
	int cut;
	int floppy[31];
};
int ans,dd,tt;
queue<cube> Q;
int a(cube);
cube cg(cube,int,int,int,int,int,int,int,int,int,int);
int main(){
	int i,j,m,n;
	cube s;
	cube t;
	cin>>n;
	for(i=0;i<n;i++){
		for(j=1;j<31;j++){
			cin>>s.floppy[j];
		}
		s.cut=0;
		Q.push(s);
		while(!Q.empty()){
			t=Q.front();
			Q.pop();
			if(1==a(t))break;
		}
		cout<<ans<<endl;
		while(!Q.empty()){
			Q.pop();
		}
	}
	return 0;
}
int a(cube w){
	if(w.floppy[1]==w.floppy[2]&&w.floppy[1]==w.floppy[4]&&w.floppy[1]==w.floppy[6]&&w.floppy[1]==w.floppy[3]&&w.floppy[1]==w.floppy[5]&&w.floppy[16]==w.floppy[17]&&w.floppy[16]==w.floppy[18]){
		ans=w.cut;
		dd=1;
		return dd;
	}
	else{
		Q.push(cg(w,1,28,2,29,3,30,15,16,19,21));
		Q.push(cg(w,1,24,4,27,7,30,10,21,16,18));
		Q.push(cg(w,3,22,6,25,9,28,13,15,12,19));
		Q.push(cg(w,7,22,8,23,9,24,18,13,10,12));
		dd=0;
		return dd;
	}
}
cube cg(cube p,int a1,int a2,int b1,int b2,int c1,int c2,int d1,int d2,int e1,int e2){
	swap(p.floppy[a1],p.floppy[a2]);
	swap(p.floppy[b1],p.floppy[b2]);
	swap(p.floppy[c1],p.floppy[c2]);
	swap(p.floppy[d1],p.floppy[d2]);
	swap(p.floppy[e1],p.floppy[e2]);
	p.cut+=1;
	/*cout<<p.cut<<endl;
	for(tt=1;tt<31;tt++){
		cout<<" "<<p.floppy[tt];
	}
	cout<<endl;
	*/
	return   p;
}

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

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;

  if (a+b < c+d) {
    cout << "Right" << endl;
  }
  if (a+b == c+d) {
    cout << "Balanced" << endl;
  }
  if (a+b > c+d)
  cout << "Left" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rank asfanf
#define N 101
using namespace std;
typedef pair<int,int> P;
int n,r[N];

map<int,int> mkRank(vector<int> A){
  map<int,int> rank,tmp;
  for(int a:A) rank[-a]++;
  tmp = rank;
  
  for(auto it=rank.begin(),it2=++rank.begin();it2!=rank.end();it++,it2++)
    it2->second += it->second;

  for(P const &p:rank) rank[-p.first] = rank[p.first]-tmp[p.first];
  return rank;
}

int getScore(map<int,int> rank,int a){return r[rank[a]];}

vector<int> calcTotalScore(vector<int> a,vector<int>b,vector<int>c){
  vector<int> res(n,0);
  map<int,int> A = mkRank(a);
  map<int,int> B = mkRank(b);
  map<int,int> C = mkRank(c);
  for(int i=0;i<n;i++) res[i] = getScore(A,a[i]) + getScore(B,b[i]) + getScore(C,c[i]);
  return res;
}

int calc(vector<int> a,vector<int>b,vector<int>c){
  int ans = 1e9;
  for(int i=0;i<200;i++){
    a[0] += i;
    vector<int> total = calcTotalScore(a,b,c);
    map<int,int> rank = mkRank(total);
    //cout<<i<<" "<<rank[total[0]]<<" "<<total[0]<<endl;
    if(rank[total[0]] <= 7) ans = min(ans,i);
    a[0] -= i;
  }
  return ans;
}

int main(){
  cin>>n;
  for(int i=0;i<n;i++) cin>>r[i];
  vector<int> a(n),b(n),c(n);
  for(int i=0;i<n;i++)cin>>a[i]>>b[i]>>c[i];
  
  int ans = min(calc(a,b,c),min(calc(b,a,c),calc(c,a,b)));
  if(ans == 1e9) cout<<"Saiko"<<endl;
  else cout<<ans<<endl;
  return 0;
}

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

int main() {
  int n, d;
  cin >> n >> d;
  int cnt = 0;
  rep(i, n){
    ll x, y;
    cin >> x >> y;
    double dis =  sqrt(x * x + y * y);
    if (dis <= d){
      cnt++;
    }
  }
  cout << cnt << endl;
}


Measured memory_bytes: 3640
#include <iostream>

using namespace std;

int main() {
	char a;
	cin >> a;
	char b;
	switch(a) {
		case 'A':
			b = 'T';
			break;
		case 'T':
			b = 'A';
			break;
		case 'G':
			b = 'C';
			break;
		case 'C':
			b = 'G';
			break;
	}
	cout << b << endl;

}


Measured memory_bytes: 888
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;

int main() {
    int N;
    cin >> N;
    int mini = 1000, maxi = 0;
    for (int i = 0; i < N; i++) {
        int a;
        cin >> a;
        if (mini > a) {
            mini = a;
        }
        if (maxi < a) {
            maxi = a;
        }
    }
    cout << maxi - mini << endl;
}

Measured memory_bytes: 256
N, L = list(map(int, input().split()))
t = []
for i in range(N):
    t.append(L+i)
# print(t)
base = sum(t)
ans = -1
r = float('inf')
for j in range(N):
    if abs(t[j]) < r:
        r = abs(t[j])
        ans = j
print(base-t[ans])

Measured memory_bytes: 3064
//Nihal Mittal - nihal_47
//Strike First , Strike Hard , No Mercy !!

/**⠀⠀⠀⠀⠀⠀⣀⣤⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣰⣿⣿⣿⣿⠿⠿⣿⣿⣿⣿⣿⣿⣿⣧⢀⠀⠀⠀⠀
⠀⠀⠀⣿⣿⣿⠋⠀⠀⠀⠀⠀⠙⠀⠙⣿⣿⣿⣷⢳⢀⠀⠀⠀
⠀⠀⣠⣿⣿⣿⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⢀
⠀⠀⣸⣿⣿⣿⠸⠀⠀⠀⠒⠒⠒⠐⠀⠀⢿⣿⣿⣿⣿⣿⠀⠀
⠀⣴⣿⣿⣿⡿⠀⠒⣋⣙⡒⢰⠀⠤⣖⠒⢾⣿⣿⣿⣿⣧⠀⠀
⢺⣿⣿⣿⣿⢀⠀⠀⠉⠉⠉⠸⠀⡇⠉⠉⠀⢿⣿⣿⣿⣄⠀⠀
⠀⠙⣿⣿⣧⢻⠀⠀⠀⠀⠀⠠⠀⠰⠀⠀⠀⣸⠸⣿⣿⠿⠰⠀
⠀⠀⠀⠹⣿⣿⣿⣷⠀⡠⠙⣲⣔⣅⢡⣰⣷⣿⣿⣿⣧⠀⠀⠀
⠀⠀⠀⣼⣿⣿⣿⣿⠀⡿⠭⠭⠭⠭⢿⠀⣿⢻⣿⣿⠃⠀⠀⠀
⠀⠀⠀⠙⠛⣿⢻⠹⣿⠐⠙⠛⠟⠉⢀⣴⡟⢿⣿⡏⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⡟⠀⠀⠻⣦⣤⣶⠾⠋⠀⠀⠁⡦⢄⢀⠀⠀⠀
⠀⠀⠀⠀⡠⠁⡇⠑⢄⠀⠀⠀⠀⠀⠀⠔⠀⠀⠁⠀⠀⠀⠉⠁
⠀⠔⠊⠁⠀⠀⣇⠀⠀⠀⠑⡤⠤⢎⠁⠀⠀⡘⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⢢⠠⠀⡠⢆⠀⠀⡠⠙⢄⠀⡸⠀
**/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define l long
#define mk make_pair
#define pb push_back
#define in insert
#define se second
#define fi first
#define mod 1000000007
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define all(v) (v).begin(),(v).end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
#define pii pair<int,int>
#define maxn 100005
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
using namespace std;
using namespace __gnu_pbds;

signed main()
{
    fast;
    
    ll r , n;
    cin>>n>>r;
    if(n>=10) cout<<r;
    else
    {
    	ll lr = r + 100 * (10 - n);
    	cout<<lr;
    }
}

Measured memory_bytes: 256
#include<string>
#include<iostream>
#include<cctype>
using namespace std;
int b[26];
int main(){
    string a;
    char c[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
    while(getline(cin,a)){
    for(int i=0;i<a.size();i++){
        for(int j=0;j<26;j++){
            if(a[i]==c[j] || a[i]==toupper(c[j])){
                b[j] += 1;
            }
        }
    }
    }
    for(int i=0;i<26;i++){
        cout<<c[i]<<" : "<<b[i]<<endl;
    }
    return 0;
}



Measured memory_bytes: 3144
/* basic header */
#include <bits/stdc++.h>
/* define */
#define ll long long
#define pb emplace_back
#define mp make_pair
#define eps 1e-8
#define lson (curpos<<1)
#define rson (curpos<<1|1)
/* namespace */
using namespace std;
/* header end */

const ll inf = 1LL << 60;
ll n, k;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> k;
    vector<ll>a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    sort(a.begin(), a.end());
    ll u = inf, d = -inf;
    while (d + 1 < u) {
        ll m = u + d >> 1, c = 0;
        for (int i = 0; i < n; i++) {
            if (a[i]*a[i] <= m) c--;
            if (a[i] < 0) {
                ll mn = (m / a[i]) - 5;
                while (mn * a[i] > m) mn++;
                ll pos = lower_bound(a.begin(), a.end(), mn) - a.begin();
                c += n - pos;
            } else if (a[i] > 0) {
                ll mx = (m / a[i]) + 5;
                while (mx * a[i] > m) mx--;
                ll pos = upper_bound(a.begin(), a.end(), mx) - a.begin();
                c += pos;
            } else {
                if (m >= 0) c += n;
            }
        }
        c /= 2;
        if (c >= k) u = m; else d = m;
    }
    cout << u << endl;
    return 0;
}

Measured memory_bytes: 1792
N = int(input())
H = list(map(int, input().split()))

H[0] -= 1
result = True
for i in range(1, N):
    diff = H[i] - H[i-1]
    # print('i:{}, diff:{}'.format(i, diff))
    if diff < 0:
        result = False
        break
    elif diff == 0:
        pass
    elif 0 < diff:
        H[i] -= 1

if(result):
    print('Yes')
else:
    print('No')
# print(H)


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

using namespace std;
using ll = long long;

template <typename K,typename V>
using umap = unordered_map<K,V>;
template <typename V>
using uset = unordered_set<V>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define REP(i,n) for(int i=0;i<n;i++)
#define REPD(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define ALL(v) v.begin(),v.end()

#define INF 1'000'000'000'000 //10^12
#define MOD 1'000'000'007
//グリッドグラフの範囲チェック
bool range_validation(int y,int x,int h,int w){
    return y>=0 && y<h && x>=0 && x < w;
}
//ビットカウント
int popcount(long bits){
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int gcd(ll a, ll b){
  if(b == 0){
    return a;
  }else{
    return gcd(b,a%b);
  }
}

vector<ll> sieve(ll n){
  vector<bool> is_prime(n+1,true);
  vector<ll> res;
  for(int i=2;i<=n;i++){
    if(is_prime[i]){
      res.push_back(i);
      for(int j=2*i;j<=n;j+=i){
        is_prime[j] = false;
      }
    }
  }
  return res;
}

vector<ll> divisor(ll n){
  vector<ll> list;
  for(int i=2;i*i<=n;i++){
    if(n%i==0){
      list.push_back(i);
      if(n/i != i){
        list.push_back(n/i);
      }
    }
  }
  return list;
}

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

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  int n;
  cin >> n;
  int x[n],y[n],h[n];
  int idx = -1;
  REP(i,n){
    cin >> x[i] >> y[i] >> h[i];
    if(idx == -1 && h[i] > 0){
      idx = i;
    }
  }
  if(idx == -1){
    cout << "Error" << endl;
    return 0;
  }
  int H;
  REP(i,101){
    REP(j,101){
      H = h[idx] + abs(i-x[idx]) + abs(j-y[idx]);
      bool ok = true;
      for(int k=0;k<n && ok ;k++){
        if(max(0,H-abs(i-x[k])-abs(j-y[k])) != h[k]){
          ok = false;
        }
      }
      if(ok){
        cout << i << " " << j << " " << H << endl;
        return 0;
      }
    }
  }
  
  return 0;
}


Measured memory_bytes: 3656
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <tuple>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;

int gcd(int a, int b) {
    return b != 0 ? gcd(b, a % b) : a;
}

//逆元を求める関数
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 solve() {
	long long a; cin >> a;
	long long b; cin >> b;
	long long c; cin >> c;
	long long d; cin >> d;
	long long cd = (c * d) / gcd(c , d);
	long long target = b - a + 1;
	long long cnt_1 = (a - 1) / c;
	long long cnt_2 = b / c;
	long long cnt_3 = (a - 1) / d;
	long long cnt_4 = b / d;
	long long cnt_5 = (a - 1) / cd;
	long long cnt_6 = b / cd;
	cout << target - abs(cnt_1 - cnt_2) - abs(cnt_3 - cnt_4) + abs(cnt_5 - cnt_6) << endl;
    return;
}

int main() {
    solve();
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {ll N,M,a,sum=0;cin>>N>>M;priority_queue<int> p;for(ll i=0;i<N;i++){cin>>a;p.push(a);sum+=a;}for(ll h=0;h<M;h++){a=p.top();p.pop();p.push(a/2);sum-=a-a/2;}cout<<sum<<endl;}

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

public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException {
		boolean[][] card = new boolean[4][13];
		String markList[] = { "S", "H", "C", "D" };
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());

		for (int i = 0; i < n; i++) {
			String[] cardTemp = br.readLine().split(" ");
			int mark = 0;
			switch (cardTemp[0]) {
			case "S":
				mark = 0;
				break;
			case "H":
				mark = 1;
				break;
			case "C":
				mark = 2;
				break;
			case "D":
				mark = 3;
				break;
			}
			int number = Integer.parseInt(cardTemp[1]);

			card[mark][number - 1] = true;
		}

		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 13; j++) {
				if (card[i][j] == false) {
					System.out.println(markList[i] + " " + (j + 1));
				}
			}
		}
	}

}

Measured memory_bytes: 24256
#include <bits/stdc++.h>
#include <boost/lexical_cast.hpp>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
template<typename T> using pq = priority_queue<T>;
template<typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template<typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto& i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template<class T, class K>
T cast(K v) {
    return boost::lexical_cast<T>(v);
}

template<class T>
void dump_debug(T list) {
#ifdef MY_DEBUG
    each(e, list) cout << e << " ";
    printf("\n");
#endif
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */
#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;

int main() {
#ifdef MY_DEBUG
    while (true) {
#endif
		cpp_int a, b;
		cin >> a >> b;

		if (a == b) cout << "EQUAL" << endl;
		else if (a > b) cout << "GREATER" << endl;
		else cout << "LESS" << endl;	

#ifdef MY_DEBUG
    }
#endif
    return 0;
}

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

int main(){
    int h1,h2,m1,m2,k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    cout << (60*h2+m2)-(60*h1+m1)-k << endl;
    return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    //we are given an array of N integers
    //we have to find out the sum of product of all possible pairs
    //modulo 1000000007
   ll n;
    scanf("%lld",&n);
    vector<ll>a(n);
    ll i,j;
    for(i=0;i<n;i++)
    {
        scanf("%lld",&a[i]);

    }

    vector<ll>b;
    j=a[n-1];
    b.push_back(a[n-1]);
    for(i=n-2;i>0;i--)
    {
       j=(a[i]+j);
       //j=j%1000000007;
       b.push_back(j);
    }
    ll s=0;

    for(i=0,j=n-2;i<n-1;i++,j--)
    {
   a[i]=a[i]%1000000007;
   b[j]=b[j]%1000000007;
      a[i]=a[i]*b[j];
      a[i]=a[i]%1000000007;
    }
    for(i=0;i<n-1;i++)
    {
        s+=a[i];

    }
    printf("%lld",s%1000000007);
    return 0;
}

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

using ll = long long;

constexpr ll inf = 1e18;

int main() {
    int n; cin >> n;
    vector<ll> a(n);
    for(int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    vector<vector<ll>> dp(n + 1, vector<ll>(2, -inf));
    dp[0][0] = a[0];
    for(int i = 1; i < n; ++i) {
        dp[i][0] = max(dp[i - 1][0], dp[i - 1][1]) + a[i];
        dp[i][1] = max(dp[i - 1][0] - a[i - 1] + (-a[i - 1] - a[i]), dp[i - 1][1] + a[i - 1] + (a[i - 1] - a[i]));
    }
    cout << max(dp[n - 1][0], dp[n - 1][1]) << endl;
}

Measured memory_bytes: 6528