akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
                     
#define int             long long
#define ld              long double
#define mp              make_pair
#define ff              first
#define ss              second
#define pb              push_back
#define fo(i,n)         for(i=0;i<n;i++)
#define fo1(i,n)        for(i=1;i<=n;i++)
#define FO(i,k,n)       for(i=k;k<=n?i<=n:i>=n;k<=n?i++:i--)
#define all(c)          c.begin(),c.end()
#define rall(c)         c.rbegin(),c.rend()
#define si              set<int>
#define vi              vector<int>
#define mii             map<int,int>
#define pii             pair<int,int>
#define vpii            vector<pii>
#define vvi             vector<vi>
#define usi             unordered_set<int>
#define umii            unordered_map<int,int>
#define pqmx            priority_queue<int>
#define pqmn            priority_queue<int,vi,greater<int> >
#define sp(x)           cout<<setprecision(x)<<fixed;
#define setbits(x)      __builtin_popcountll(x)
#define zerobits(x)     __builtin_ctzll(x)
#define in(a,n)         vi a(n);fo(i,n)cin>>a[i];
#define in1(a,n)        vi a(n+1);fo1(i,n)cin>>a[i];
#define w(t)            int t;cin>>t;while(t--)
#define sz(v)           (int)v.size()
#define gcd             __gcd
#define lcm(x,y)        x*(y/gcd(x,y))
#define endl            '\n'
#define PI              3.14159265358979323846
const int inf =         1e18;
const int mod =         1e9+7;
void __p(int x) {cout<<x;}
void __p(int32_t x){cout<<x;}
void __p(float x){cout<<x;}
void __p(double x){cout<<x;}
void __p(ld x) {cout<<x;}
void __p(char x){cout <<'\''<<x<<'\'';}
void __p(const char *x){cout <<'\"' <<x<<'\"';}
void __p(const string &x) {cout<<'\"'<<x<<'\"';}
void __p(bool x) {cout<<(x?"true":"false");}
void _p() {cout << "]\n";}
template<typename T,typename V>     void __p(const pair<T,V> &x) {cout<<'{';__p(x.first);cout<<',';__p(x.second);cout<<'}';}
template<typename T>                void __p(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __p(i); cout << "}";}
template <typename T,typename... V> void _p(T t, V... v) {__p(t);if(sizeof...(v))cout<<", ";_p(v...);}
int po(int x,int p,int m = inf) {int ans=1;x%=m;while(p>0){if(p&1)ans=(ans*x)%m;p=p>>1;x=(x*x)%m;}return ans;}
int inv(int x,int m=mod){return po(x,m-2,m)%m;}
#ifndef ONLINE_JUDGE
#define dbg(x...) cout<<"["<<#x<<"]=[";_p(x)
#else 
#define dbg(x...)
#endif
//=================================================================================




const int N=1e6+6;
int n,m,k,x,y,z,a,b,c,d,i,j,l,r,f;








void sol()
{   string s;
    cin>>s;
    
    fo(i,s.size())cout<<'x';
    
    
    //cout<<  <<endl;
}





int32_t main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //sp(10);
    // w(t)
    sol();
    return 0;
}

Measured memory_bytes: 3640
while True :
    H , W = map(int,input().split())

    if H == 0 and W == 0 :
        break
    else:
        for i in range(H):
            for j in range(W):
                if i % 2 ==1 :
                    if j % 2 ==1 :
                        print("#" ,end="")
                    else :
                        print("." ,end="")

                else :
                    if j % 2 ==1 :
                        print("." ,end="")
                    else:
                        print("#" ,end="")
            print()
        print()


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

static const int N=100;

int main(){
  int n,p[N+1],m[N+1][N+1];
  cin>>n;
  for(int i=1;i<=n;i++){
    cin>>p[i-1]>>p[i];
  }
  for(int i=1;i<=n;i++)m[i][i]=0;
  for(int l=2;l<=n;l++){
    for(int i=1;i<=n-l+1;i++){
      int j=i+l-1;
      m[i][j]=(1<<21);
      for(int k=i;k<=j-1;k++){
        m[i][j]=min(m[i][j],m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j]);
      }
    }
  }
  cout<<m[1][n]<<endl;
  return 0;
}


Measured memory_bytes: 3120
import java.util.*

fun inputList() = 
    readLine()!!.split(" ").map(String::toLong)

fun sum_digits(num_: Long): Long {
    var num = num_
    var rtn: Long = 0
    while(num != 0.toLong()) {
        val tmp = num % 10
        rtn += tmp
        num /= 10
    }
    return rtn
}

fun gcd(a: Long, b: Long): Long = 
    if(b != 0.toLong()) a else gcd(b, a % b)

fun lcm(a: Long, b: Long) = 
    if(b==0.toLong()) a else gcd(b, a % b)

fun main(args: Array<String>) {
    val (h, w) = inputList()
    val (h_, w_) = inputList()

    println((h-h_) * (w - w_))
}


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

#define Fast ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define FO freopen("in.txt", "r", stdin)
#define FC freopen("out.txt", "w", stdout)
#define aise cout<<"aise"<<endl
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define mp make_pair
#define ll long long
#define all(x) x.begin(), x.end()
#define mset(v, a) memset(v, a, sizeof(v))
#define pll pair< ll, ll >
#define pdd pair< double, double >
#define ff first
#define ss second
#define pi acos(-1.0)
#define mxN 2010
#define inf 1e14
#define MOD 1000000007

int main()
{

    string a,b;
    cin >> a >> b;
    a+=b;
    ll ans = 0;
    ll mul = 1;
    for(ll i = 0; i < a.size(); i++)
    {

        ll x = a[i]-'0';
        ans+=x;
        if(i < a.size()-1) ans*=10;
    }
    ll sq = sqrt(ans);
    if(sq*sq==ans) cout << "Yes";
    else cout << "No";
}


Measured memory_bytes: 256
package main

// かなり雑にdfs書いた

import (
	"bufio"
	"fmt"
	"os"
	"reflect"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

var table [][]bool

func dfs(passed []bool, cur, limit int)int{
    count := 0
    for _, v := range passed{
        if v == true{
            count += 1
        }
    }
    if count == limit{
        return 1
    }
    ret := 0
    for i, v := range table[cur]{
        if v && !passed[i]{
            my_passed := append([]bool{}, passed...)
            my_passed[i] = true
            ret += dfs(my_passed, i, limit)
        }
    }
    return ret
}

func main() {
	sc.Split(bufio.ScanWords)
	defer out.Flush() // !!!!coution!!!! you must use Fprint(out, ) not Print()
	/* --- code ---*/
	n, m := nextInt(), nextInt()
	// table初期化
	table = make([][]bool, n)
	for i := 0; i < n; i++ {
		table[i] = make([]bool, n)
	}

	for i:=0; i<m; i++{
	    a, b := nextInt()-1, nextInt()-1
        table[a][b] = true
        table[b][a] = true
	}
	passed := make([]bool, n)
	passed[0] = true
	fmt.Fprint(out, dfs(passed, 0, n))
}

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func PrintOut(src interface{}, joinner string) {
	switch reflect.TypeOf(src).Kind() {
	case reflect.Slice:
		s := reflect.ValueOf(src)
		for idx := 0; idx < s.Len(); idx++ {
			fmt.Fprintf(out, "%v", s.Index(idx))
			if idx < s.Len()-1 {
				fmt.Fprintf(out, "%s", joinner)
			} else {
				fmt.Fprintln(out)
			}
		}
	default:
		fmt.Fprintln(out, "fuck")
	}
}


Measured memory_bytes: 768
import bisect

def get_indexes(num):
  idx = -1
  idxs = []
  while idx != N-1:
    tmp_idx = S[idx+1:].find(str(num))
    if tmp_idx == -1:
      return idxs
    else:
      idx += tmp_idx+1
      idxs.append(idx)
  return idxs

N = int(input())
S = input()

ans = 0
S_idxs = []
for i in range(10):
  S_idxs.append(get_indexes(i))

for i in range(10):
  if S_idxs[i] == []:continue
  ii = min(S_idxs[i])
  for j in range(10):
    if S_idxs[j] == []:continue
    jj = max(S_idxs[j])
    for k in range(10):
      for kk in S_idxs[k]:
        if ii<kk and kk<jj:
          ans += 1
          break
          
print(ans)
#print(S_idxs)

#print('*'*20)
#print(get_indexes(1))

Measured memory_bytes: 43740
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String a = sc.next();
    String b = sc.next();
    String c = sc.next();
    int an = a.length()-1;
    int bn = b.length()-1;    
    
    String ans;
    
    if(a.charAt(an)==b.charAt(0)&&b.charAt(bn)==c.charAt(0)) ans = "YES";
    else ans = "NO";


    System.out.println(ans);
    
  }
}

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

typedef uint64_t u64;
typedef int64_t i64;
typedef uint32_t u32;
typedef int32_t i32;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;

#define rep(idx, N) for (u64 idx = 0; idx < N; idx++)

int main() {
  i32 n;
  cin >> n;
  rep(i, n) {
    i32 a;
    cin >> a;
    if ((a & 1) == 0) {
      if (a % 3 != 0 && a % 5 != 0) {
        cout << "DENIED";
        return 0;
      }
    }
  }

  cout << "APPROVED";
  return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,m;
	cin>>n>>m;
	int a[n][m],b[m],c;
	for(int i=0;i<n;i++) 
	  for(int j=0;j<m;j++) cin>>a[i][j];
	for(int i=0;i<m;i++) cin>>b[i];
	for(int i=0;i<n;i++){
		c=0;
		for(int j=0;j<m;j++) c+=a[i][j]*b[j];
		cout<<c<<endl;
	}
	return 0;
}



Measured memory_bytes: 3120
#include <string>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <iostream>
#include <functional>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <cmath>
#include <limits>
#include <tuple>
#include <queue>
#include <stack>

using namespace std;
typedef long long ll;

vector<int> sieve_of_eratosthenes(int n) {
	vector<int> primes(n);
	for (int i = 2; i < n; ++i)
		primes[i] = i;
	for (int i = 2; i*i < n; ++i)
		if (primes[i])
			for (int j = i*i; j < n; j += i)
				primes[j] = 0;
	return primes;
}

#define MAX_PRIME 100000

int main()
{
	auto primes = sieve_of_eratosthenes(MAX_PRIME);
	primes.erase(remove(primes.begin(), primes.end(), 0), primes.end());
	vector<int> like2017;
	for (auto p : primes) {
		int p2 = p * 2 - 1;
		if (p2 > MAX_PRIME)
			break;
		if (binary_search(primes.begin(), primes.end(), p2)) {
			like2017.push_back(p2);
		}
	}

	int Q;
	cin >> Q;
	for (int i = 0; i < Q; i++) {
		int l, r;
		cin >> l >> r;
		auto it1 = lower_bound(like2017.begin(), like2017.end(), l);
		auto it2 = upper_bound(it1, like2017.end(), r + 1);
		cout << (it2-it1) << endl;
	}
	return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
int i,N[7],n,a,b;
int t[7][7]={
            {0,0,0,0,0,0,0},
            {0,0,3,5,2,4,0},
            {0,4,0,1,6,0,3},
            {0,2,6,0,0,1,5},
            {0,5,1,0,0,6,2},
            {0,3,0,6,1,0,4},
            {0,0,4,2,5,3,0}
            };
int hantei(int p){
    int i;
    for(i=1;i<7;i++){
        if(p==N[i]){
            return i;
        }
    }
    return 0;
}
int main(void){
    for(i=1;i<7;scanf("%d",&N[i++]));
    for(scanf("%d",&n);n--;){
        scanf("%d%d",&a,&b);
        printf("%d\n",N[t[hantei(a)][hantei(b)]]);
    }
}

Measured memory_bytes: 1852
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(void){
  int N;
  cin>>N;
  vector<int> a(3*N);
  for(int i=0;i<3*N;i++){
      cin>>a[i];
  }
  sort(a.begin(),a.end());
  long long int c=0;;
  for(int i=0;i<N;i++){
      c+=a[3*N-2-2*i];
  }
  cout<<c<<endl;
  return 0;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define EPS 1e-9
#define MOD 1000000007
#define int long long
using namespace __gnu_pbds;
using namespace std;
typedef pair<int, int> pii;
typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> ost;
#define INF 10000000000


int32_t main(){
	int n, w;
	cin >> n >> w;
	int sumi = 0;
	vector<int> wt(n), val(n);
	for(int i = 0; i < n; i++){
		cin >> wt[i] >> val[i];
		sumi += val[i];
	}
	vector<int> dp(sumi+1,1e18);
	dp[0] = 0;
	for(int i = 0; i < n; i++){
		for(int j = sumi-val[i]; j >= 0; j--){
			dp[j+val[i]] = min(dp[j+val[i]], dp[j]+wt[i]);
		}
	}
	int ans = 0;
	for(int i = 0; i <= sumi; i++){
		if(dp[i] <= w)
			ans = max(ans,i);
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 1024
fun main(args :Array<String>) {
    val n = readInteger()
    val s = readLine()!!
        .map {
            val intNum = it.toInt()
            val zeroFirst = intNum - 'A'.toInt()
            val plusN = zeroFirst + n
            val modValue = plusN % ('Z' - 'A' + 1)
            val plusA = modValue + 'A'.toInt()
            plusA.toChar()
        }.joinToString("")
    println(s)
}

fun readInteger() = readLine()!!.toInt()
fun readStringList() = readLine()!!.split(" ")
fun readIntegerList() = readStringList().map(String::toInt)
fun readLongList() = readStringList().map(String::toLong)


Measured memory_bytes: 33704
#include <cstdio>
#include <iostream>
#include <set>
#include <bitset>
#include <vector>
#include <algorithm>

using namespace std;

set<int> factors;
int n;
bitset<1005> isprime;
vector<int> plist;
int num[1005];
long long ans = 1;

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

    cin >> n;
    isprime.flip();

    if(n == 1 || n == 2) {
        cout << n;
        return 0;
    }

    for(int i=2; i<=1000; i++) {
        if(!isprime[i]) continue;
        for(int j=2; j*i <= 1000; j++) {
            isprime[i * j] = false;
        }
    }

    for(int i=2; i<=1000; i++) {
        if(!isprime[i]) continue;
        plist.push_back(i);
    }

    for(int i=1; i<=n; i++) {
        for(int j: plist) {
            if(i % j == 0) {
                int copy = i;
                while(copy % j == 0) {
                    num[j] ++;
                    copy /= j;
                }
            }
        }
    }

    for(int i=1; i<=n; i++) {
        // cout << num[i] << ' ';
        if(num[i] == 0) continue;
        ans *= (num[i] + 1);
        ans %= 1000000007;
    }

    // ans += 1;
    ans %= 1000000007;

    cout << ans;
}

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

int main(){
    int N; cin >> N;
    vector<int> d(N);
    for(int i = 0; i < N; i++){
        cin >> d[i];
    }
    int ans = 0;
    for(int i = 0; i < N; i++){
        for(int j = i + 1; j < N; j++){
            ans += d[i] * d[j];
        }
    }
    cout << ans << endl;
}

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

	int a(string A,string B,string C);
	int b(string A,string B,string C);
	int c(string A,string B,string C);

	int a(string A,string B,string C){
		if(A.empty()){
			puts("A");
			return 0;
		}
		if(A[0]=='a'){
			A.erase(A.begin());
			a(A,B,C);
		}else if(A[0]=='b'){
			A.erase(A.begin());
			b(A,B,C);
		}else{
			A.erase(A.begin());
			c(A,B,C);
		}
	}

	int b(string A,string B,string C){
		if(B.empty()){
			puts("B");
			return 0;
		}
		if(B[0]=='a'){
			B.erase(B.begin());
			a(A,B,C);
		}else if(B[0]=='b'){
			B.erase(B.begin());
			b(A,B,C);
		}else{
			B.erase(B.begin());
			c(A,B,C);
		}
	}

	int c(string A,string B,string C){
		if(C.empty()){
			puts("C");
			return 0;
		}
		if(C[0]=='a'){
			C.erase(C.begin());
			a(A,B,C);
		}else if(C[0]=='b'){
			C.erase(C.begin());
			b(A,B,C);
		}else{
			C.erase(C.begin());
			c(A,B,C);
		}
	}


int main(){
	string A,B,C;
	cin >> A >> B >> C;
	a(A,B,C);
	return 0;
}	



Measured memory_bytes: 256
S = input()

   
ans = 0
for i in range(2 ** (len(S)-1)):
    oparr = []
    for j in range(len(S)-1):
        if (i >> j) & 1:
            oparr.insert(0,"+")
        else:
            oparr.insert(0,"-")
    oparr.append("")
    tmp = ""
    for k in range(len(S)):
        tmp += S[k] + oparr[k]
    if eval(tmp) == 7:
        print(tmp + "=7")
        exit()


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

using namespace std;
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); ++i)
double const PI = 3.1415926535897932384626433;
using P = pair<int, int>;

int main() {

    int x, a, b;
    cin >> x >> a >> b;
    if (abs(x - a) > abs(x - b))
        cout << 'B' << endl;
    else
        cout << 'A' << endl;
    return 0;
}

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

int main(){
  int i,j,k,cnt=0;
  int n;
  cin>>n;
  int L[n];
  for(i=0;i<n;i++)cin>>L[i];
  sort(L,L+n);
  for(i=0;i<n;i++){
    for(j=i+1;j<n;j++){
      int p=L[i]+L[j];
      for(k=j+1;k<n;k++){
        if(p>L[k])cnt++;
      }
    }
  }
  cout<<cnt;
}

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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

    ll N; cin >> N;
    ll A[100005];
    for (int i = 0;i < N;i++){
        cin >> A[i];
    }

    vector<ll> lis;
    lis.push_back(1);

    for (int i = 0;i < N;i++){
        ll idx = upper_bound(lis.begin(),lis.end(),-A[i]) - lis.begin();
        if(idx >= lis.size()-1){
            if(-A[i] < lis[lis.size()-1])lis[lis.size()-1] = -A[i];
            else lis.push_back(-A[i]);
        }else{
            lis[idx] = -A[i];
        }
    }

    cout << lis.size() << endl;

    return 0;

}

Measured memory_bytes: 2168
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef long long ll;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    int N, X, T; cin >> N >> X >> T;
    cout << T*((N+X-1)/X) << endl;
}

Measured memory_bytes: 3608
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <cstring>
#include <cctype>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <numeric>
using namespace std;
 
#define REP(i, s, e) for (int i = (s); i < (e); i++)
#define REPI(i, s, e) for (int i = (s); i <= (e); i++)
#define rep(i, n) REP(i, 0, n)
#define repi(i, n) REPI(i, 0, n)
#define ALL(v) (v).begin(), (v).end()
 
#define dump(x) (cout << #x << " = " << x << endl)
#define dump2(x, y) (cout << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")" << endl)
#define dump3(x, y, z) (cout << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y << ", "<< z << ")" << endl)
 
typedef long long ll;
typedef pair<int, int> pii;

const int MAX = 55;

int N, M, A, B, C, T;

typedef vector< vector<int> > mat;
mat S;

mat mul(mat &A, mat &B)
{
	mat C(A.size(), vector<int>(B[0].size()));

	for (int i = 0; i < A.size(); i++) {
		for (int k = 0; k < B.size(); k++)
			for (int j = 0; j < B[0].size(); j++)
				C[i][j] = (C[i][j] + A[i][k]*B[k][j]) % M;
	}

	return C;
}

mat pow(mat A, int n)
{
	int N = A.size();
	mat B(N, vector<int>(N));

	for (int i = 0; i < N; i++)
		B[i][i] = 1;

	while (n > 0) {
		if (n&1) B = mul(B, A);
		A = mul(A, A);
		n >>= 1;
	}

	return B;
}

int main()
{
	while (cin >> N >> M >> A >> B >> C >> T, N|M|A|B|C|T) {
		S = mat(N, vector<int>(1, 0));
		rep(i, N)
			cin >> S[i][0];

		mat X = mat(N, vector<int>(N, 0));
		X[0][0] = B;
		X[0][1] = C;
		for (int i = 1; i < N-1; i++) {
			X[i][i-1] = A;
			X[i][i]   = B;
			X[i][i+1] = C;
		}
		X[N-1][N-2] = A;
		X[N-1][N-1] = B;

		X = pow(X, T);

		mat Y = mul(X, S);
		rep(i, Y.size())
			printf("%d%c", Y[i][0], (i==Y.size()-1?'\n':' '));
	}
	return 0;
}

Measured memory_bytes: 1244
#include<bits/stdc++.h>
 
using namespace std;
 
template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.first << ' ' << v.second; return os; }
template <class T, class S> ostream& operator << (ostream &os, const map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const unordered_map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; }
 
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <class Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << endl; }
    template <class Arg1, class... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args) {
        const char* sep = strchr(names + 1, ',');
        cerr.write(names, sep - names) << " : " << arg1 << "  ";
        __f(sep + 1, args...);
    }
#else
#define trace(...) 0
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#endif
 
#define fast_cin() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MAX 1000000
#define ll long long
#define db double
#define str string
#define pb push_back
#define For(i,s,e) for (ll i=(s); i<(e); i++)
#define Forrev(i,s,e) for (ll i=(s); i>=(e); i--)
#define all(v) v.begin(),v.end()
 
#define vll vector<ll>
#define vs vector<string>
#define mapll map<ll,ll>
#define pll pair<ll,ll>
#define initialise(a, x) memset(a, x, sizeof(a))
#define maxheap priority_queue<ll>
#define minheap priority_queue<ll,vector<ll> ,greater<ll>>
 
#define ff first
#define ss second
#define endl "\n"
#define mp make_pair
const ll mod=1e9 + 7;
 
ll takemod(ll a) {
    return ((a%mod)+mod)%mod;
}
 
ll gcd(ll a, ll b) { 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);        
}
 
ll fast_exp(ll base, ll expo) {
    ll res=1;
    while(expo>0) {
        if(expo&1) res=(res*base)%mod;
        base=(base*base)%mod;
        expo>>=1;}
    return res;
}
 
ll modinv(ll a) {
    return takemod(fast_exp(takemod(a), mod-2));
}
 
void solve() {
    
    int n,k; cin >> n >> k;

    int arr[n];
    for (int i = 0; i < n; i++)
    	cin >> arr[i];

    int dp[n];

    for (int i = 0; i < n; i++)
    	dp[i] = -1;

    dp[n-1] = 0;

    for (int i = n-2; i >= 0; i--) {
    	
    	int val = 1e9;
    	for(int j = i+1; j <= min(i+k,n-1); j++) {
    		val = min(val, abs(arr[i] - arr[j]) + dp[j]);
    		//cout<<abs(arr[i] - arr[j]) + dp[j]<<endl;
    	}
    	dp[i] = val;
    }

    cout << dp[0] << endl;
}
 
signed main() 
{
    fast_cin();
    
    
    int t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    
    
    return 0;    
}

Measured memory_bytes: 4384
N = int(input())
ans = 0
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return len(divisors)

for i in range(1, N+1, 2):
    if make_divisors(i) == 8:
        ans += 1
print(ans)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;

const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1000000000000000000L;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
const int ddx[] = {1, 1, 0, -1, -1, -1, 0, 1};
const int ddy[] = {0, 1, 1, 1, 0, -1, -1, -1};

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

int extgcd(int a, int b, int& x, int&y) {
    int d = a;
    if(b != 0) {
        d = extgcd(b, a % b, y, x);
        y -= (a / b) * x;
    }else {
        x = 1;
        y = 0;
    }
    return d;
}

int inv(int a) {
    int x, y;
    extgcd(a, MOD, x, y);
    return (x + MOD) % MOD;
}

int main() {
    int n;
    cin >> n;
    int* b = new int[n + 1];
    rep(i, n - 1) cin >> b[i + 1];
    b[0] = b[n] = INF;

    int sum = 0;
    rep(i, n) {
        sum += min(b[i], b[i + 1]);
    }
    cout << sum << endl;
}


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


public class Main{

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		while(true) {

			String[] line = s.nextLine().split(" ");
			if(Integer.parseInt(line[0]) == 0 && Integer.parseInt(line[1]) == 0)
				break;
			int[][] vertexs = new int[Integer.parseInt(line[0]) + 1][Integer.parseInt(line[0]) + 1];
			for(int i=0 ; i<Integer.parseInt(line[1]) ; i++) {
				String[] lines = s.nextLine().split(" ");
				if(Integer.parseInt(lines[0]) == 1) {
					if(vertexs[Integer.parseInt(lines[1])][Integer.parseInt(lines[2])] == 0) {
						vertexs[Integer.parseInt(lines[1])][Integer.parseInt(lines[2])] = Integer.parseInt(lines[3]);
						vertexs[Integer.parseInt(lines[2])][Integer.parseInt(lines[1])] = Integer.parseInt(lines[3]);
					} else if(vertexs[Integer.parseInt(lines[1])][Integer.parseInt(lines[2])] > Integer.parseInt(lines[3])) {
						vertexs[Integer.parseInt(lines[1])][Integer.parseInt(lines[2])] = Integer.parseInt(lines[3]);
						vertexs[Integer.parseInt(lines[2])][Integer.parseInt(lines[1])] = Integer.parseInt(lines[3]);
					}
				}else {
					int start = Integer.parseInt(lines[1]);
					int end = Integer.parseInt(lines[2]);
					System.out.println(solve(start, end, vertexs));
				}
			}
		}
	}

	public static int solve(int start, int end, int[][] vertexs) {
		int[] result = new int[vertexs.length];
		boolean[] visited = new boolean[vertexs.length];
		for(int i=0 ; i<=vertexs.length ; i++) {
			Arrays.fill(result, Integer.MAX_VALUE);
		}
		result[start] = 0;

		while(true) {
			int index = 0;
			int minCost = Integer.MAX_VALUE;
			for(int i=1 ; i<vertexs.length ; i++) {
				if(minCost>result[i] && !visited[i]) {
					minCost = result[i];
					index = i;
				}
			}
			if(index == 0)
				break;

			visited[index] = true;

			for(int j=1 ; j<vertexs[index].length ; j++) {
				if(vertexs[index][j] != 0 && !visited[j]) {
					if(result[j] > result[index] + vertexs[index][j]) {
						result[j] = result[index] + vertexs[index][j];
					}
				}
			}
		}
		return (result[end] == Integer.MAX_VALUE) ? -1 : result[end];
	}

}

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


int main(){

    int N, K, h[100000];
    cin >> N >> K;
    for( int i = 0; i < N; i++ ) cin >> h[i];
    
    
    int ans = 1e+9;
    sort( h, h+N );
    for( int i = 0; i <= N-K; i++ ) ans = min( ans, h[i+K-1] - h[i] );

    cout << ans << endl;

    return 0;

}

Measured memory_bytes: 768
from collections import defaultdict, deque
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate
import sys
import re


def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LIM(): return list(map(lambda x:int(x) - 1, sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def LIRM(n): return [LIM() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
mod = 1000000007


def main():
    n, q = LI()
    li = [0] * n
    s = S()
    for i in re.finditer('AC', s):
        li[i.end()-1] += 1

    li = list(accumulate(li))


    for l, r in LIR(q):
        print(li[r-1] - li[l-1])




main()

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

#define N 1005
#define MP make_pair
typedef long long LL;
const int mod = 1e9 + 7;

int a[N], b[N];
int va[N * N], vb[N * N];

int main()
{
	//freopen("in.txt", "r", stdin);
	
	int n, m;
	scanf("%d %d", &n, &m); 
	for (int i = 1; i <= n; ++i)
		scanf("%d", &a[i]), va[a[i]] = 1;
	for (int i = 1; i <= m; ++i)
		scanf("%d", &b[i]), vb[b[i]] = 1;
	
	for (int i = 1; i < n; ++i)
		for (int j = i + 1; j <= n; ++j)
			if (a[i] == a[j]) return puts("0"), 0;
	
	for (int i = 1; i < m; ++i)
		for (int j = i + 1; j <= m; ++j)
			if (b[i] == b[j]) return puts("0"), 0;
	
	sort(a + 1, a + n + 1);
	sort(b + 1, b + m + 1);
	LL ans = 1;
	int p1 = n + 1, p2 = m + 1;
	for (int x = n * m; x >= 1; --x)
	{
		while (p1 - 1 >= 1 && a[p1 - 1] >= x) --p1;
		while (p2 - 1 >= 1 && b[p2 - 1] >= x) --p2;
		if (!va[x] && vb[x])
		{
			ans = ans * (n - p1 + 1) % mod;
		}
		else if (va[x] && !vb[x])
		{
			ans = ans * (m - p2 + 1) % mod;
		}
		else if (!va[x] && !vb[x]) 
		{
		 	ans = ans * ((n - p1 + 1) * (m - p2 + 1) - (n*m-x)) % mod;  
		}
	}
	printf("%lld\n", ans);
	
	
	return 0;	
}

Measured memory_bytes: 2304
s = input()
cnt = 0
for i in range(1, len(s)+1):
    t = s[i-1]
    if i % 2 == 1:
        if t == 'R':
            cnt += 1
        elif t == 'U':
            cnt += 1
        elif t == 'D':
            cnt += 1
    else:
        if t == 'L':
            cnt += 1
        elif t == 'U':
            cnt += 1
        elif t == 'D':
            cnt += 1


if cnt == len(s):
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3060
from itertools import permutations
N=int(input())
P=tuple(map(int,input().split()))
Q=tuple(map(int,input().split()))

for i,p in enumerate(permutations(range(1,N+1))):
    if p==P:
        a=i
    if p==Q:
        b=i
print(abs(a-b))

Measured memory_bytes: 39024
import std.stdio;
import std.algorithm;
import std.string;
import std.conv;
import std.math;

void main(){

    real maxm,minm;
    maxm = 0;
    minm = 200000000;
    while(true){
	auto s = readln();
	if(stdin.eof()) break;
	real n = to!real(chomp(s));
	maxm = max(maxm,n);
	minm = min(minm,n);
    }
    writeln(maxm-minm);
}

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

using namespace std;

long long dp[51][51][2501] = {};

int main()
{
	int n, a;
	cin >> n >> a;
	vector<int> x(n);
	for (int i = 0; i < n; i++) {
		cin >> x[i];
	}

	dp[0][0][0] = 1;
	for (int i = 1; i <= n; i++) {
		dp[i][0][0] = dp[i - 1][0][0];
		for (int j = 1; j <= n; j++) {
			for (int k = 0; k <= a * n; k++) {
				if (k - x[i - 1] >= 0) {
					dp[i][j][k] += dp[i - 1][j - 1][k - x[i - 1]];
					dp[i][j][k] += dp[i - 1][j][k];
				}
				else {
					dp[i][j][k] += dp[i - 1][j][k];
				}				
			}
		}
	}

	long long ans = 0;
	for (int i = 1; i <= n; i++) {
		ans += dp[n][i][i * a];
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 52584
import java.util.*;

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

    int ans = 0;
    int prevH = 0;
    for (int i = 0; i < N; i++) {
      int h = sc.nextInt();
      if (h >= prevH) {
        ans += h - prevH;
      }
      prevH = h;
    }
    
    System.out.println(ans);
  }
}

Measured memory_bytes: 23252
#include<bits/stdc++.h>
#include<string>
using namespace std;
int main()
{
  string s;
  int count=0;
  cin>>s;
  for(int i=0;i<(s.size())/2;i++)
  {
    if(s[i]!=s[s.size()-1-i])
    {
      count++;
    }
  }
  cout<<count<<endl;
  return 0;
}

Measured memory_bytes: 256
'use strict'
function Main(hoge){
  var input=hoge;
  input=input.split(/\s+/);
  for(let i=0;i<input.length;i++)
    input[i]=input[i]-0;
  var A=input.shift();
  var B=input.shift();
  var Q=input.shift();
  var s=input.splice(0,A);
  var t=input.splice(0,B);
  var x=input.splice(0,Q);
  var y=binarySort(x);
  var s_before=[];
  var s_after=[];
  var t_before=[];
  var t_after=[];
  var p=0,q=0;
  for(let i=0;i<Q;i++){
    while(s[p]<y[i][0])
      p++;
    s_before[i]=(s[p-1]||-1e14);
    s_after[i]=(s[p]||1e14);
    while(t[q]<y[i][0])
      q++;
    t_before[i]=(t[q-1]||-1e15);
    t_after[i]=(t[q]||1e15);
  }
//  console.log(s_before,s_after);
  var ans=[];
  for(let i=0;i<Q;i++){
    let j=y[i][1];
    let Y=y[i][0];
    let sb=s_before[i],sa=s_after[i],tb=t_before[i],ta=t_after[i]; 
    let abs=Math.abs;
    ans[j]=Math.min(
      abs(sa-Y)+abs(ta-sa),
      abs(sa-Y)+abs(tb-sa),
      abs(sb-Y)+abs(ta-sb),
      abs(sb-Y)+abs(tb-sb),
      abs(ta-Y)+abs(sa-ta),
      abs(ta-Y)+abs(sb-ta),
      abs(tb-Y)+abs(sa-tb),
      abs(tb-Y)+abs(sb-tb)
    );
  }
  return (ans.join('\n'));
}

function binarySort(A){ 
  var a=A.length;
  var B=[[A[0],0]];
  for(let i=1;i<a;i++){
    let u=B.length-1;
    let d=0;
    let m=Math.floor((d+u)/2);
    while(!(d>u)){
      if(B[m][0]<A[i]){
        d=m+1;
      }else{
        u=m-1;
      }
      m=Math.floor((d+u)/2);
    }
    B.splice(m+1,0,[A[i],i]);
  }
  return B;
}

var myAns=Main(require('fs').readFileSync('/dev/stdin','utf8'));
console.log(myAns);    


Measured memory_bytes: 91884
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <list>

using namespace std;

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

long long int INF = 1e18;
long long int MOD = 1e8 + 7;

int main(){
	
	while(true){
		string str;
		cin >> str;
		char pre = str[0];
		
		if(pre == '#'){
			break;
		}
		
		str += " ";
		
		int cnt = 0;
		
		vector<P> v;
		
		for(int i = 0; i < str.size(); i++){
			if(str[i] == pre){
				cnt += 1;
			}else{
				if(pre == '8' || pre == '0'){
					v.push_back(make_pair(cnt, 3));
				}else{
					v.push_back(make_pair(cnt, 5));
				}
				cnt = 1;
			}
			pre = str[i];
		}
		
		long long int ans = 1;
		
		for(int i = 0; i < v.size(); i++){
			int num = v[i].first;
			int tp = v[i].second;
			long long int S = 0;
			long long int DP[5] = {1};
			
			for(int j = 1; j <= num + 1; j++){
				if((num - j) % tp == 0){
					for(int k = 0; k < tp; k++){
						S += DP[k];
						S %= MOD;
					}
				}
				long long int DP2[5] = {};
				for(int k = 0; k < tp; k++){
					DP2[0] += DP[k];
					DP2[0] %= MOD;
				}
				for(int k = 1; k < tp; k++){
					DP2[k] = DP[k - 1];
					DP2[k] %= MOD;
				}
				swap(DP, DP2);
			}
			ans *= S;
			ans %= MOD;
		}
		
		cout << ans << endl;
	}
	return 0;
}



Measured memory_bytes: 3288
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>

using namespace std;
const int N=2e5+10;

int n;
int z[N],t[N];


int main(){
    scanf("%d",&n);
    for(int i=0;i<n;++i){
        int a,b;
        scanf("%d%d",&a,&b);
        z[i]=a+b;
        t[i]=a-b;
    }
    int max_z=-1e9,min_z=1e9;
    int max_t=-1e9,min_t=1e9;
    for(int i=0;i<n;++i){
        if(z[i]>max_z) max_z=z[i];
        if(z[i]<min_z) min_z=z[i];

        if(t[i]>max_t) max_t=t[i];
        if(t[i]<min_t) min_t=t[i]; 
    }
    cout<<max(max_z-min_z,max_t-min_t)<<endl;
    return 0;
}

Measured memory_bytes: 5344
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n = ii()
A = iil()
ans = 0

l = [0]*(max(A)+2)

for i in A:
    if i != 0:
        l[i-1] += 1
    l[i] += 1
    l[i+1] += 1
#print(l)
print(max(l))

Measured memory_bytes: 14004
class UnionFind:
  def __init__(self, num):
    self.rank = [0]*num
    self.par = [i for i in range(num)] #基準(par = parentのpar)
    self.n   = num
    self.size = [1]*num

#親を探す
  def find(self, x):
    if self.par[x] == x:
      return x
    else:
      self.par[x] = self.find(self.par[x]) #自分じゃなきゃ親を探す
      return self.par[x]

#集合を結合する(結合する前に親のポインタを取得する)
  def union(self, x, y):
    x = self.find(x)
    y = self.find(y)
    if x == y:
      return
    if self.rank[x] < self.rank[y]: #ランクの高い方に基準を合わせる
      x,y=y,x
    if self.rank[x] == self.rank[y]:
      self.rank[x] += 1
    self.par[y] = x
    self.size[x] += self.size[y]
    self.size[y] = 0

  def same(self, x, y):
    return self.find(x) == self.find(y)

  def all_find(self):
    for n in range(len(self.par)):
      self.find(n)


n,m=map(int,input().split())
# edges=[[0]*n for i in range(n)]
# uf=UnionFind(n)
ans=0
# ab=[]
# for i in range(m):
#   a,b=map(int,input().split())
#   ab.append([a,b])
#   uf.union(a-1,b-1)
# for i in range(m):
#   uf1=UnionFind(n)
#   for j in range(m):
#     a,b=ab[j]
#     if i==j:
#       continue
#     uf1.union(a-1,b-1)
#   if all([True if i==j else False for i,j in zip(uf.par,uf1.par)])!=True:
#     ans+=1
nl=[]
for i in range(m):
    f,t=map(int,input().split())
    nl.append([f-1,t-1])
for i in range(m):
    uf=UnionFind(n)
    flag=False
    for j in range(m):
        if i==j:
            continue
        uf.union(nl[j][0],nl[j][1])
    nl.append(t)
    for j in range(n):
        for k in range(n):
            if not uf.same(j,k):
                flag=True
    if flag:
        ans+=1
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,a,b) for(int i=a;i<b;i++)
#define each(it,v) for(auto it : v)
#define mod 1000000007
#define all(v) (v).begin(),(v).end()
#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define vpii vector<pair<int,int>>
#define vv vector<vector<int>>
using namespace std;

main()
{
    int k,s; cin>>k>>s;

    int cnt=0;

    rep(i,k+1)rep(j,k+1)
    {
        int a=s-i-j;
        if(0<=a && a<=k)
        {
            cnt++;
        }
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
 int cu(int x){
   x = ((x + 9)/ 10) * 10;
   return x;
 }

int main() {
  
  vector<int> v(5);
  for (int i = 0; i < 5; i++){
    cin >> v.at(i);
  }  
 
  int sum = 0;
  for (int i = 0; i < 5; i++){
    sum += cu(v.at(i));
  }  
 
  int last = 0;
   for (int i = 0; i < 5; i++){
     int amari = v.at(i) % 10;
     int amari_r = 10 - amari;
     if(last < amari_r && amari_r != 10){
     last = amari_r;
     }
  } 
  
 
  

   cout << sum - last << endl;
}
  
    

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
#define ll long long
int n;
ll ans=0;
signed main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		for(int x=1;x*x<=i/6;x++){
			for(int y=x;(y+1)*(y+1)<=i-2;y++){
				for(int z=y;(z+1)*(z+1)<=i-2;z++){
					ll val=x*x+y*y+z*z+y*z+x*y+x*z;
					if(val>i)break;
					if(val==i){
						if(x==y&&y==z){ans++;continue;
						}
						if(x==y||y==z||x==z){ans+=3;continue;
						}
						ans+=6;
					}
				}
			}
		}
		cout<<ans<<endl; ans=0;
	}
	return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <cmath>
#include <climits>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <string>
#include <stack>
#include <algorithm>
#include <map>
#include <numeric>
#include <set>
using namespace std;
// scanf
#pragma warning(disable: 4996)
// v:vector  type:型  order:greater or less
#define _sort(v,type,order) do { sort(v.begin(),v.end(),order<type>()); } while(0)
// vector 要素の総和算出
// v:vector  default_value:初期値
#define _sum(v,default_value) accumulate(v.begin(),v.end(),default_value )
// vector 最大値( return ite )
#define _max_element(v) max_element(v.begin(),v.end())
// vector 最大値が格納されている要素値
#define _max_element_number(v) distance(v.begin(),max_element(v.begin(),v.end()))

//set<uint32_t> member;	// 重複するデータを保持する事はできない member.insert(2) member.insert(2) ⇒ member.count(2)は1
//multiset<uint32_t> v;	// 重複するデータも保持する事はできる   member.insert(2) member.insert(2) ⇒ member.count(2)は2

// 丸め
#define _round(v) round(v)
// 2乗 / 3乗
#define _square(v) pow(v,2)
#define _cube(v)   pow(v,3)
// 大小判定
#define _max(x,y) max(x,y)-
#define _min(x,y) min(x,y)
// string ⇒ int
#define _stringtoi(s) stoi(s)
// double 平方根
#define _sqrt(x) sqrt(x)
// double 引数 x 以上で最小の整数値 ex) 3.30303 ⇒ 4
#define _ceil(x) ceil(x)
// 指定された要素以上の値が現れる最初の位置のイテレータを取得する
#define _lower_bound(v,min) lower_bound(v.begin(), v.end(), min)
// 指定された要素より大きい値が現れる最初の位置のイテレータを取得する
#define _upper_bound(v,min) upper_bound(v.begin(), v.end(), min)

// 順列 n個の数が与えられる
// 0,1,2,...,n-1
// 全ての並べ方を1行ごとに出力する
// ex 0 1 2 / 0 2 1 / 1 0 2 / 1 2 0 / 2 0 1 / 2 1 0
#define _next_permutation(v) do {   \
	for (auto num : v) {            \
		printf("%d ", num);         \
	}                               \
	printf("\n");                   \
} while (next_permutation(v.begin(), v.end()))

// 絶対値
static int32_t _abs(const int32_t x) { return  (x > 0 ? x : -x); }
// 最大公約数
static int gcd(int a, int b)
{
	if (a < b) {
		a ^= b;
		b ^= a;
		a ^= b;
	}
	return b ? gcd(b, a % b) : a;
}
// 最小公倍数
static int lcm(int a, int b) { return a * b / gcd(a, b); }
// 多次元 std::vector 生成
template<class T>
vector<T> make_vec(size_t a) { return vector<T>(a); }
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts) { return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...)); }
// ex) auto dp = make_vec<uint64_t>(SIZE + 1, 2, 2);



// 169 B
// https://atcoder.jp/contests/abc169/tasks/abc169_b
int main()
{
	uint32_t n;	// 要素数 n
	cin >> n;
	
	vector<uint64_t> v(n);
	for (uint32_t i = 0; i < n; ++i) {
		cin >> v[i];
		if (!v[i]) {
			printf("0\n");
			return 0;
		}
	}

	uint64_t result = 1;
	for (uint32_t i = 0; i < n; ++i) {
		if (v[i] > ((uint64_t)(1e18) / result)) {
			printf("-1\n");
			return 0;
		}
		result = result * v[i];
	}

	printf("%llu\n", result);
	return 0;
}




Measured memory_bytes: 4056
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>

using namespace std;

int main (){
  int A,B;
  int H,M;
  cin >> A >> B >> H >> M;

  int temp;
  temp = max(A,B);
  A = min(A,B);
  B = temp;

  double angle, angle_A, angle_B;
  angle_A = (double) H * 5.0 + (double)M/12.0;
  angle_B = (double) M;
  angle = ((angle_A - angle_B)/30) * M_PI;

  double x, y;
  x = A*sin(angle);
  y = B - (A*cos(angle));

  printf("%.15lf\n", sqrt(x*x + y*y));

}

Measured memory_bytes: 4036
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <numeric>
#include <iomanip>
#define M_PI acos(-1)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1000000007;
const int MAX_V = 201;
int now = 0;

const int MAX = 510000;
const int MOD = 1000000007;

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;
}
struct edge {
	int t;
	edge(int _t) : t(_t) {}
};
bool use[100010];

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

void Solve() {
	
	ll x, y;
	cin >> x >> y;
	if (abs(x - y) < 2) {
		cout << "Brown" << endl;
	}
	else cout << "Alice" << endl;

}


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



Measured memory_bytes: 256
package main

import "fmt"

func main() {
    var r, c int
    var m [100][100]int
    var yoko int
    var tate [100]int

    fmt.Scanf("%d %d", &r, &c)

    // 表データ読み込み
    for i:=0; i<r; i++ {
        for j:=0; j<c; j++ {
            fmt.Scanf("%d", &m[i][j])
        }
    }

    // タテ計算の初期化
    for j:=0; j<c; j++ {
        tate[j] = 0
    }

    // 表の表示
    for i:=0; i<r; i++ {
        yoko = 0
        for j:=0; j<c; j++ {
            fmt.Printf("%d ", m[i][j])
            yoko += m[i][j]
            tate[j] += m[i][j]
        }
        fmt.Println(yoko)
    }

    // 最下行の表示
    sum := 0
    for j:=0; j<c; j++ {
        fmt.Printf("%d ", tate[j])
        sum += tate[j]
    }
    fmt.Println(sum)
}


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

using i64 = long long;
using P = pair<i64, i64>;

#define overload3(_1, _2, _3, name, ...) name
#define rep1(i, n) for(i64 i = 0LL; i < (n); ++i)
#define rep2(i, a, b) for(i64 i = (a); i < (b); ++i)
#define rep(...) overload3(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)
#define all(v) v.begin(), v.end()


void solve(long long N, std::vector<long long> V, std::vector<long long> C){
    i64 ans = 0;
    rep(i, N) ans += max(0LL, V[i] - C[i]);
    cout << ans << endl;
}

struct IoSetup {
    IoSetup() {
        // cin.tie(nullptr);
        // ios::sync_with_stdio(false);
        cout << fixed << setprecision(10);
        cerr << fixed << setprecision(10);
    }
} iosetup;

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> V(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&V[i]);
    }
    std::vector<long long> C(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&C[i]);
    }
    solve(N, std::move(V), std::move(C));
    return 0;
}


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

#define _1 first
#define _2 second
#define pb push_back
#define mp make_pair
#define sqr(x) ((x) * (x))
#define all(x) (x).begin(), (x).end()
#define uni(x) (x).erase(unique(all(x)), (x).end())
#define reset(x, y) memset(x, y, sizeof(x))
#define BUG(x) cerr << #x << " = " << (x) << endl
#define BUGP(x) cout << #x << " = " << (x)._1 << ", " << (x)._2 << endl
using namespace std;

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

const int dr[] = {-1, 0, 1, 0, -1, -1, 1, 1};
const int dc[] = {0, -1, 0, 1, -1, 1, -1, 1};
// Head

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

    int a, b;
    cin >> a >> b;
    cout << 6 - a - b << '\n';
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
    int a = 0, b = 0;
    
    scanf("%d %d", &a, &b);
    if(a < b) {
        printf("a < b\n");
    } else if(a > b) {
        printf("a > b\n");
    } else {
        printf("a == b\n");
    }
    return 0;
}


Measured memory_bytes: 2084
n, x = map(int, input().split())
L = list(map(int, input().split()))
D = [0] * (n + 1)
ans = 1

for i in range(1, n + 1):
    D[i] = D[i - 1] + L[i - 1]

    if D[i] <= x:
        ans = ans + 1
    else:
        break

print(ans)

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

int main() {
  
  string s;
  cin >> s;
  
  bool ans = true;
  REP(i,s.size()) {
    int c = 0;
    REP(j,s.size()) {
      if (s[i] == s[j]) c++;
    }
    if (c % 2 != 0) {
      ans = false;
      break;
    }
  }
  
  cout << (ans ? "Yes" : "No") << endl;
  
}

Measured memory_bytes: 3584
#include <iostream>
#include <sstream>
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <set>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <bitset>
#include <stack>
#include <queue>
#include <ctype.h>
#include <list>

typedef long long int lli;
#define rep(i,s,N) for(int i=s;i<N;i++)
#define MOD 1000000007
#define more(a,b) (((a)>(b))?(a):(b))
#define less(a,b) (((a)<(b))?(a):(b))
template<class T> inline bool chmax(T & a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T & a, T b) { if (a > b) { a = b; return 1; } return 0; }

using namespace std;

int main(void)
{
	int A, B, C, D; cin >> A >> B >> C >> D;
	while (true) {
		C -= B;
		if (C <= 0) {
			cout << "Yes" << endl;
			break;
		}
		A -= D;
		if (A <= 0) {
			cout << "No" << endl;
			break;
		}
	}


	return 0;
}


Measured memory_bytes: 3636