akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define PI 3.1415926535
typedef long long ll;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<Pll> vPll;
typedef vector<vector<int>> vvi;
typedef vector<vector<bool>> vvb;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<double>> vvd;
typedef vector<vector<Pi>> vvPi;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi> > pqlP;
string YN(bool y) { return (y?"YES":"NO"); }
string yn(bool y) { return (y?"Yes":"No"); }
string ON(bool y) { return (y?"OK":"NG"); }
int main(void)
{
	int n;

	cin>>n;

	vi a(n), b, c;

	rep(i, n){
		cin>>a[i];
		if(i%2){
			b.push_back(a[i]);
		}else{
			c.push_back(a[i]);
		}
	}
	reverse(all(c));
	c.insert(c.end(), all(b));

	if(n%2==0) reverse(all(c));

	rep(i, c.size()){
		if(i==(int)c.size()-1){
			cout<<c[i]<<endl;
		}else{
			cout<<c[i]<<" ";
		}
	}
}

Measured memory_bytes: 4332
#include <iostream>
#include <cmath>
 
using namespace std;
int main()
{
    long long a,b,c;
    cin >> a >> b >> c;
    long long d = c-a-b;
    
    if(d>0 && d*d > 4*a*b){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
/*long long gcd(long a, long b)
{
	return a % b == 0 ? b : gcd(b, a%b);
}*/
int main()
{
	ios::sync_with_stdio(false);cin.tie(0); cout.tie(0);
	long n;
	int a[100];
	while (cin >> n) {
		for (int i = 0; i != n; i++)
			cin >> a[i];
		sort(a, a + n);
		cout << a[n - 1] - a[0] << endl;
	}
	return 0;
}

Measured memory_bytes: 256
# https://atcoder.jp/contests/abc149/tasks/abc149_c

X = int(input())

# 素数判定
def isPrime(n):
  if n < 2:
    # 2未満は素数でない
    return False
  if n == 2:
    # 2は素数
    return True
  for p in range(2, n):
      if n % p == 0:
        # nまでの数で割り切れたら素数ではない
        return False
  # nまでの数で割り切れなかったら素数
  return True

i = X
# ループする
while i < 1000000:
    if isPrime(i):
        print(i)
        break
    else:
        i = i + 1




Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <cstdlib>  
#include <algorithm>
#include <string>

using namespace std;
 
int main() {
   　int n,k;cin>>n>>k;
     int ans = 0;
     for(int i = 0;i<n;i++){
     	int a;cin>>a;
        int b = 2*min(abs(k-a),abs(a));
        ans += b;
     }
     cout<<ans;
     return 0;
}

Measured memory_bytes: 3104
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author gaidash
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        AHonestOrDishonest solver = new AHonestOrDishonest();
        solver.solve(1, in, out);
        out.close();
    }

    static class AHonestOrDishonest {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            char a = in.nextCharacter();
            char b = in.nextCharacter();

            if (a == 'H') {
                out.println(b);
            } else {
                out.println(b == 'H' ? 'D' : 'H');
            }
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void println(char i) {
            writer.println(i);
        }

        public void close() {
            writer.close();
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public char nextCharacter() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            return (char) c;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 18900
//
//  main.cpp
//  MST2ND
//
//  Created by Dong Truong on 7/13/19.
//  Copyright © 2019 Dong Truong. All rights reserved.
//

#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <iomanip>

using namespace std;
#define long long long

const long maxn = 1e6+2 , cm=1e9+7 , ba=31;
struct elem
{
    long id,gt;
};

long a;string s;

void nhap()
{
    cin>>a>>s;
    if (a>=3200) cout<<s;
    else cout<<"red";
}
int main(int argc, const char * argv[]) {
   // freopen("a.inp","r",stdin);
    nhap();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n'
#define debug(X) cout << #X << " = " << X << endl

using namespace std;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	#ifdef UTP
	freopen("input.txt", "r", stdin);
	#endif
	int n, k; cin >> n >> k;
	long long ans = 0;
	for (int a = 1; a <= n; a++) {
        int b = (k - a % k) % k;
        if ((b + b) % k) continue;
        long long cb = (n - b) / k + 1 - (b == 0);
        ans += (cb * cb);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
import java.math.BigDecimal;
import java.util.Scanner;
public class Main {

    public static void main(String[] args) {
      Scanner sc=new Scanner(System.in);
      String inp=sc.nextLine();
      String[] ip = inp.split(" ");
      String a = ip[0];
      String b = ip[1];
      BigDecimal c = new BigDecimal(a);
      BigDecimal d = new BigDecimal(b);
      BigDecimal res = c.multiply(d);
      long ans = res.setScale(0, BigDecimal.ROUND_FLOOR).longValue();
      System.out.println(ans);
    }
}

Measured memory_bytes: 36036
let inline scan () = System.Console.ReadLine()
let inline split (s: string) = s.Split(' ')

let [|a;b;k|] = scan () |> split |> Array.map int
let len = b - a + 1
if len <= k * 2 then
  for i = a to b do printfn "%i" i
else
  for i = a to a + k - 1 do printfn "%i" i
  for i = b - k + 1 to b do printfn "%i" i


Measured memory_bytes: 11996
def isPrime(n) : 
    if (n <= 1) : 
        return False
    if (n <= 3) : 
        return True
    if (n % 2 == 0 or n % 3 == 0) : 
        return False
    i = 5
    while(i * i <= n) : 
        if (n % i == 0 or n % (i + 2) == 0) : 
            return False
        i = i + 6
    return True

x = int(input())
while isPrime(x)==False:
    x += 1
print(x)

Measured memory_bytes: 3064
#include<cstdio>
#define N 5
char s[N];
bool f[N];
int main()
{
	scanf("%s",s);
	for(int i=0;i<3;i++)
	f[int(s[i]-97)]=1;
	if(f[0]&&f[1]&&f[2]) printf("Yes\n");
	else printf("No\n");
}

Measured memory_bytes: 128
Q=int(input())
n=100000
is_prime=[1]*(n+10)
is_prime[0]=0
is_prime[1]=0
for i in range(2,n+1):
	for j in range(i*2,n+1,i):
		if is_prime[j]==False:
			continue
		is_prime[j]=0
a=[0]*(n+10)
for j in range(2,n+1):
	if is_prime[j]%2==0:
		continue
	if is_prime[j] and is_prime[int((j+1)/2)]:
		a[j]=1
s=[0]*(n+10)		
for k in range(n):
	s[k+1]=a[k]+s[k]
ans=[]
for _ in range(Q):
	l,r=map(int,input().split())
	ans.append(s[r+1]-s[l])
print(*ans,sep='\n')

Measured memory_bytes: 13932
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
#define rep(i,n) for (ll i = 0; i < (n); i++)
#define repd(i,a,b) for (ll i = (a); i < (b); i++)
#define INF LLONG_MAX
#define mod 1000000007
typedef long long ll;
int main(void)
{
	int X;
	cin >> X;
	ll ans = 0;
	ans += X/500 * 1000;
	while(X>=500)
	{
		X -= 500;
	}
	ans += X/5 * 5;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
##Just for prctice
a,b=map(int,input().split())

ans=0
for i in range(a,b+1):
    p=str(i)
    for j in range(3):
        if p[j]!=p[4-j]:
            break
        if j==2:
            ans+=1

print(ans)


"""
11009 11332

4

31415 92653

612
"""




Measured memory_bytes: 3060
import math
a,b,h,m=map(int,input().split())
hh=h/12*360 + m/60*30
mh=m/60*360 

#print(hh,mh)
x=abs(hh-mh)
if x==180:
    print(a+b)
else:
#print(round((a*2+b2-abs(2*a*b*math.cos(x*math.pi/180)))*0.5,9))
    print ('%.9f'%(a**2+b**2-2*a*b*math.cos(x*math.pi/180))**0.5)

Measured memory_bytes: 9332
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <cassert>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define srep(i,n,m) for(int i=n;i<m;i++)
#define elif else if
#define INF 1000000007
#define pi 3.141592653589793
using namespace std;
int saidaikouyakusuu(int a,int b){
    if(b==0) return a;
    return saidaikouyakusuu(b,a%b);
}
int saisyoukoubaisuu(int a,int b){
    return a*b/saidaikouyakusuu(a,b);
}
int n,m,cnt=0,aa[220000],o,p;
pair<int,int> pp[220000];
string s,ss[220000];
char c;
queue<int> que;
signed main(){
    cin>>c;
    if(c<91){
        cout<<'A';
    }else{
        cout<<'a';
    }
}

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

int main() {
  
  int N,x;
  cin >> N >> x;

  vector<long long> vec(N);
  for(int i = 0;i < N;i++) {
    cin >> vec.at(i);
  }

  long long ans = 0;

  for(int i = 0;i < N - 1;i++) {
    long long sum = vec.at(i) + vec.at(i+1),dif = sum - x;
    if(dif > 0) {
      if(vec.at(i + 1) >= dif) {
        vec.at(i + 1) -= dif;
        ans += dif;
      }else {
        vec.at(i) -= dif - vec.at(i + 1);
        vec.at(i + 1) = 0;
        ans += dif;
      }
    }
  }
  
  cout << ans << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>

using namespace std;

/////////////         qsortのラッピング

int qsort_long_compare_ascend(const void *a, const void *b) {
	long c = *(long*)a - *(long*)b;
	if (c > 0) { return 1; }
	else if (c < 0) { return -1; }
	return 0;
}
int qsort_long_compare_descend(const void *a, const void *b) {
	long c = *(long*)b - *(long*)a;
	if (c > 0) { return 1; }
	else if (c < 0) { return -1; }
	return 0;
}
void ascendOrder(int size, long *array) {//昇順
	qsort(array, size, sizeof(long), qsort_long_compare_ascend);
}
void descendOrder(int size, long *array) {//降順
	qsort(array, size, sizeof(long), qsort_long_compare_descend);
}

void swap(long *a, long *b) {
	long c = *a;
	*a = *b;
	*b = c;
}
int main() {
	long X, Y, Z, K;
	long A[1000], B[1000], C[1000];
	long AB[3000];

	cin >> X >> Y >> Z >> K;
	for (int i = 0; i < X; i++) {
		cin >> A[i];
	}
	for (int i = 0; i < Y; i++) {
		cin >> B[i];
	}
	for (int i = 0; i < Z; i++) {
		cin >> C[i];
	}

	descendOrder(X, A);
	descendOrder(Y, B);
	descendOrder(Z, C);

	long count = 0;
	long ix[1000],iy[1000];
	long value[3000];
	for (long i = 0; i < X; i++) {
		ix[i] = i;
		iy[i] = 0;
		value[i] = A[i] + B[0];
	}

	long abSize = min(3000L, X * Y);
	while (1) {
		AB[count] = value[0];
		iy[0]++;
		if (iy[0] >= Y) {
			value[0] = -1;
		}
		else {
			value[0] = A[ix[0]] + B[iy[0]];
		}

		count++;
		if (count >= abSize) { break; }

		for (long i = 0; i < X - 1; i++) {
			if (value[i] < value[i + 1]) {
				swap(&value[i], &value[i + 1]);
				swap(&ix[i], &ix[i + 1]);
				swap(&iy[i], &iy[i + 1]);
			}
			else {
				break;
			}
		}
	}


	count = 0;
	long ixy[3000], iz[3000];
	for (long i = 0; i < abSize; i++) {
		ixy[i] = i;
		iz[i] = 0;
		value[i] = AB[i] + C[0];
	}

	while (1) {
		cout << value[0] << endl;
		iz[0]++;
		if (iz[0] >= Z) {
			value[0] = -1;
		}
		else {
			value[0] = AB[ixy[0]] + C[iz[0]];
		}

		count++;
		if (count >= K) { break; }

		for (long i = 0; i < abSize - 1; i++) {
			if (value[i] < value[i + 1]) {
				swap(&value[i], &value[i + 1]);
				swap(&ixy[i], &ixy[i + 1]);
				swap(&iz[i], &iz[i + 1]);
			}
			else {
				break;
			}
		}
	}

	return 0;
}

Measured memory_bytes: 380
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;
use std::f64::consts::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        r: i64,
        g: i64,
        b: i64,
        n: i64,
    }
    let mut cnt = 0;
    let r_max = (n+r-1) / r + 1;
    let g_max = (n+g-1) / g + 1;
    let b_max = (n+b-1) / b + 1;

    for i in 0..r_max as usize as i64 {
        for j in 0..g_max as usize as i64 {
            let acc = n - r*i - g*j;
            if acc % b == 0 && acc >= 0 {
                cnt += 1;
                continue;
            }
        }
    }
    println!("{}", cnt);
}


Measured memory_bytes: 4352
def show():
    global L,R,X,ans
    print((L,R,X,ans))

N=int(input())
A=list(map(int,input().split()))
A.append(2**20-1)

L=0;R=0
ans=0
X=A[L]

while L<N or R<N:
    while R<N-1 and X&A[R+1]==0:
        X=X^A[R+1]
        R+=1
#        show()
    if L==R:
        ans+=1
        L+=1
        R+=1
        X=A[L]
    else:
        ans+=R-L+1
        X=X^A[L]
        L+=1
#    show()
print(ans)

Measured memory_bytes: 24840
#include<bits/stdc++.h>
#define mxn 200005
#define LL long long
using namespace std;
int n,L,R;
LL a[mxn],b[mxn],xorv[mxn],ans;
inline int read(){
	int res=0,f_f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-') f_f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){res=(res<<3)+(res<<1)+ch-'0';ch=getchar();}
	return res*f_f;
}
int main(){
	n=read();
	for (int i=1;i<=n;i++){
		a[i]=read();
		b[i]=b[i-1]+a[i],xorv[i]=xorv[i-1]^a[i];
	}
	L=1,R=1,ans=1;
	while(R<n){
		R++;
		if(b[R]-b[L-1]==(xorv[R]^xorv[L-1])) ans+=(LL)R-L+1;
		else{
			while(b[R]-b[L-1]!=(xorv[R]^xorv[L-1])&&L<R) L++;
			ans+=(LL)R-L+1;
		}
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 4992
#include <stdio.h>
#include <stdlib.h>

int q(const int *a,const int *b)
{
    return *a-*b;
}

int main(void)
{
    int n[3];
    scanf("%d%d%d",&n[0],&n[1],&n[2]);
    qsort(n,3,4,q);
    if(n[0]!=n[1])printf("%d",n[0]);
    else printf("%d",n[2]);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <cmath>
#define SQ(x) (x)*(x)

using namespace std;

double dis(double x1,double x2,double y1,double y2){
  return(sqrt(SQ(x2-x1)+SQ(y2-y1)));
}

int main(void){
  int n=0;
  double k[20][2],s=0;
  char c;
  while(cin>>k[n][0]>>c>>k[n][1])n++;
  for(int i=1;i<n-1;i++){
    double a=dis(k[0][0],k[i][0],k[0][1],k[i][1]);
    double b=dis(k[i][0],k[i+1][0],k[i][1],k[i+1][1]);
    double c=dis(k[0][0],k[i+1][0],k[0][1],k[i+1][1]);
    double z=(a+b+c)/2;
    s+=sqrt(z*(z-a)*(z-b)*(z-c));
  }
  printf("%.6lf\n",s);
  return 0;
}

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

typedef string str;
typedef long long ll;
typedef double db;
typedef pair<int, int> pii;
typedef map<int, int> mii;
typedef vector<int> vi;
typedef vector<bool> vb;

#define pb push_back
#define fi first
#define se second
#define in insert
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

const int MID = 1e5 + 3;
const int INF = 1e9 + 5;
const int MOD = 1e9 + 7;

int main(){
    speed;
    int n;
    cin >> n;
    int s = 0;
    int mn = 1000;
    while(n--){
        int k;
        cin >> k;
        s += k;
        if(k % 10 != 0){
            mn = min(mn, k);
        }
    }
    if(s % 10 == 0){
        if(mn == 1000){
            s = 0;
        }
        else{
            s -= mn;
        }
    }
    cout << s;
}

Measured memory_bytes: 3644
def popcount(n):
    return bin(n).count("1")

n = int(input())
x = input()
px = x.count("1")
a = px + 1
b = px - 1
tmpa = 0
tmpb = 0

if b == 0:
    for i in range(n):
        if x[i] == "1":
            tmpa += pow(2, n - i - 1, a)
            tmpa %= a

    for i in range(1, n + 1):
        count = 1
        if x[i - 1] == "1":  # x[i] == "1" -> "0"
            print(0)
            continue

        else:  # x[i] == "0" -> "1"
            y = tmpa + pow(2, n - i, a)
            y %= a
        while y:
            y %= popcount(y)
            count += 1
        print(count)

else:
    for i in range(n):
        if x[i] == "1":
            tmpa += pow(2, n - i - 1, a)
            tmpa %= a
            tmpb += pow(2, n - i - 1, b)
            tmpb %= b

    for i in range(1, n + 1):
        count = 1
        if x[i - 1] == "1":  # x[i] == "1" -> "0"
            y = tmpb - pow(2, n - i, b)
            y %= b
        else:  # x[i] == "0" -> "1"
            y = tmpa + pow(2, n - i, a)
            y %= a
        while y:
            y %= popcount(y)
            count += 1
        print(count)


Measured memory_bytes: 79828
N = int(input())
L = [int(s) for s in list(input().split())]

l_sort = sorted(L)
cnt = 0

for i in l_sort:
    for j in l_sort:
        for k in l_sort:
            if i >= j or i >= k or j >= k: continue
            if i + j <= k: continue
            cnt+=1
print(cnt)

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

int main(){
    int n, m; cin >> n >> m;
    vector<vector<string>> v(n);
    rep(i, m){
        int a; cin >> a;
        string s; cin >> s;
        v.at(a-1).push_back(s);
    }
    int ac = 0, wa = 0;
    vector<int> v_wa(n);
    rep(i, n){
        bool flag = true;
        for(auto j : v.at(i)){
            if(j == "AC") {
                ac++;
                flag = false;
                break;
            }
            wa++;
        }
        if(flag) wa = 0;
        v_wa.at(i) = wa;
        wa = 0;
    }
    int sum = 0;
    for(auto a : v_wa) sum += a;
    cout << ac << ' ' << sum << endl;
    return 0;
}


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

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

class Sol{
	public void Solve(){
		while(true){
			var d=ria();
			if(d[0]==0&&d[1]==0)return;
			int N=d[0];
			int M=d[1];
			int[] A=new int[N];
			int[] B=new int[M];
			for(int i=0;i<N;i++)A[i]=ri();
			for(int i=0;i<M;i++)B[i]=ri();
			
			int sumA=A.Sum();
			int sumB=B.Sum();
			int aa=-1;
			int bb=-1;
			int min=(int)1e9;
			
			for(int i=0;i<N;i++){
				for(int j=0;j<M;j++){
					if(sumA-A[i]+B[j]==sumB-B[j]+A[i]){
						if(A[i]+B[j]<min){
							aa=A[i];
							bb=B[j];
							min=aa+bb;
						}
					}
				}
			}
			if(min==(int)1e9){
				Console.WriteLine(-1);
			}else{
				Console.WriteLine("{0} {1}",aa,bb);
			}
		}
	}

	public Sol(){
		
	}

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

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

typedef long long lint;
typedef pair<int, int> P;
#define REP(i, x, n) for(int i = x ; i < n ; ++i)
#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for(int i = n - 1 ; i >= 0 ; --i)
#define SORT(c) sort((c).begin(), (c).end())

const int IINF = 1e9 + 10;
const lint LLINF = (lint)1e18 + 10;
const lint MOD = (lint)1e9 + 7;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

lint power(lint x, lint n){
    lint res = 1;
    while(n > 0){
        if(n & 1){
            res *= x;
            res %= MOD;
        }
        x *= x;
        x %= MOD;
        n >>= 1;
    }
    return res;
}

lint nCr(lint n, lint r){
    r = min(r, n-r);
    if(r < 0){
        return 0;
    }
    lint multiple = 1, divide = 1;
    rep(i, r){
        multiple *= (n - i);
        multiple %= MOD;
        divide *= (i + 1);
        divide %= MOD;
    }
    lint res = multiple * power(divide, MOD-2);
    res %= MOD;
    return res;
}

int main(){
    lint n, m;
    cin >> n >> m;
    lint res = m, ans = 1;
    for(lint i = 2 ; i * i <= res ; ++i){
        lint cnt = 0;
        while(res % i == 0){
            res /= i;
            ++cnt;
        }
        ans *= nCr(cnt + n - 1, cnt);
        ans %= MOD;
    }
    if(res > 1){
        ans *= n;
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import itertools,math
N = int(input())
ls = [list(map(int,input().split())) for _ in range(N)]
#print(ls)
ls2 = itertools.permutations(range(N))
#print(ls2)
dist = 0
for p in ls2:
    for i in range(N-1):
        j = i + 1
        dist += (((ls[p[i]][0])-(ls[p[j]][0]))**2+((ls[p[i]][1])-(ls[p[j]][1]))**2)**0.5
print(dist/math.factorial(N))


Measured memory_bytes: 9228
/*
    When you are not practicing someone else is,
    and the day u meet them u will Lose.

    So, all you need is Practice, Practice and Practice.
*/
#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,a,b)       for(i=a;i<=b;i++)
#define FOR(i,a,b)      for(i=a;i>=b;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 ans=1;x%=mod;while(p>0){if(p&1)ans=(ans*x)%mod;p=p>>1;x=(x*x)%mod;}return ans;}
int inv(int x){return po(x,mod-2)%mod;}
#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,q;








void sol()
{   string a,s;
    cin>>a>>s;
    int mn=inf;
    n=sz(a);
    m=sz(s);

    for(int i=0;i+m-1<n;i++)
    {
        c=0;
        fo(j,m)if(a[i+j]!=s[j])c++;
        mn=min(mn,c);
    }
    
    
    
    cout<< mn <<endl;
}





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


Measured memory_bytes: 3616
N = int(input())
As = list(map(int,input().split()))

mini = 10000000000000
for i in range(min(As) - 1, max(As) + 1):
    tmp = 0
    for a in As:
        tmp += (i - a) ** 2

    if tmp < mini:
        mini = tmp

print(mini)


Measured memory_bytes: 2940
# coding: utf-8
class PotUnionFind:
    def __init__(self, size):
        self.parent = [-1 for i in range(size)]#非負なら親ノード，負ならグループの要素数
        self.diff_p = [0 for i in range(size)]#親ノードを基準としたポテンシャル

    def root(self, x): #root(x): xの根ノードを返す
        if self.parent[x] < 0:
            return x
        else:
            rx = self.root(self.parent[x]) #xをxの根rxに直接つなぎたい
            self.diff_p[x] += self.diff_p[self.parent[x]] #そのために，diff(rx,x)を計算
            self.parent[x] = rx #xをrxに直接つなげる
            return rx

    def merge(self, x, y, dxy): #ポテンシャル差の条件p(y)-p(x)=dxyでxとyのグループをまとめる
        rx = self.root(x) #rxを新たにxと名づける
        ry = self.root(y) #ryを新たにyと名づける
        dxy += self.diff_p[x] - self.diff_p[y] #dxyをdiff(rx,ry)で置き換え
        x,y=rx,ry
        if x == y:
            return False
        if self.parent[x] > self.parent[y]: #xの要素数がyの要素数より「小さい」とき入れ替える
            x,y,dxy=y,x,-dxy
        self.parent[x] += self.parent[y] #xの要素数を更新
        self.parent[y] = x #yをxにつなぐ
        self.diff_p[y] = dxy #yの相対ポテンシャルを更新
        return True

    def issame(self, x, y): #issame(x,y): xとyが同じグループにあるならTrue
        return self.root(x) == self.root(y)
        
    def diff(self,x,y): #diff(x,y): xを基準としたyのポテンシャルを返す 
        if self.root(x) == self.root(y): #この時点でxの親はroot(x)
            return self.diff_p[y] - self.diff_p[x]
        else:
            return None

    def size(self,x): #size(x): xのいるグループの要素数を返す
        return -self.parent[self.root(x)]

n = int(input())

T=PotUnionFind(n)
for _ in [0]*(n-1):
    u,v,w = [int(i) for i in input().split()]
    T.merge(u-1,v-1,w)

for i in range(n):
    print(T.diff(0,i)%2)



Measured memory_bytes: 10204
#include<stdio.h>
#define MAX 100005
#define NIL -1
struct Node_struct{int p, l, r;}; /*p: 親(parent), l: 一番左の子(left child), r:右の兄弟(right sibling)*/
typedef struct Node_struct Node;
Node T[MAX];
int D[MAX];

void print(int u){
  int i, c;
  printf("node %d: parent = %d, depth = %d, ", u, T[u].p, D[u]);

  if(T[u].p == -1) printf("root, ");
  else if(T[u].l == -1) printf("leaf, ");
  else printf("internal node, ");
  
  printf("[");
  for (i=0, c = T[u].l; c != NIL; i++, c = T[c].r){
    if(i) printf(", ");
    printf("%d", c);
  }
  printf("]\n");
  
}

void calcDepth(int u, int p){
  D[u] = p;
  if(T[u].r != -1) calcDepth(T[u].r, p);
  if(T[u].l != -1) calcDepth(T[u].l, p+1);
}

int main(){
  int i, j, k;
  int n;
  int id, sib, child;
  int root = NIL;
  scanf("%d", &n);
  for(i=0; i<n; i++) T[i].p = T[i].l = T[i].r = NIL;
  
  for(i=0; i<n; i++){
    scanf("%d %d", &id, &k);
    for(j = 0, sib = NIL; j<k; j++){ //子を入力する (input children)
      scanf("%d", &child);
      T[child].p = id;
      if(j == 0) T[id].l = child; //idの一番左の子 (the most left child of id)
      else T[sib].r = child; //左の兄弟に繋げる (connect to left sibling)
      sib = child;//次の子供の左の兄弟 (the left sibling of the next child)
    }
  }

  //根を求める (find the root)
  for(i=0; i<n; i++){
    if(T[i].p == -1) root = i;
  }
  
  //それぞれのノードの深さを求める (find depth of each node)
  calcDepth(root, 0);

  //出力 (output)
  for(i=0; i<n; i++) print(i);
  
  return 0;
}



Measured memory_bytes: 6396
#include <queue>
#include <string>
#include <vector>
#include <iostream>
#include <functional>
using namespace std;
const vector<int> dx = { 0, 1, 0, -1 };
const vector<int> dy = { 1, 0, -1, 0 };
int main() {
	int T;
	cin >> T;
	while (T--) {
		const int H = 12, W = 6;
		vector<string> S(H);
		for (int i = 0; i < H; ++i) {
			cin >> S[i];
		}
		function<int(int, int, bool)> get_comp = [&](int x, int y, bool del) {
			queue<pair<int, int> > que; que.push(make_pair(x, y));
			char ini = S[x][y];
			int cnt = 0;
			while (!que.empty()) {
				pair<int, int> u = que.front(); que.pop();
				S[u.first][u.second] = 'V';
				++cnt;
				for (int i = 0; i < 4; ++i) {
					int tx = u.first + dx[i], ty = u.second + dy[i];
					if (0 <= tx && tx < H && 0 <= ty && ty < W) {
						if (del && S[tx][ty] == 'O') {
							S[tx][ty] = '.';
						}
						if (S[tx][ty] == ini) {
							que.push(make_pair(tx, ty));
						}
					}
				}
			}
			for (int i = 0; i < H; ++i) {
				for (int j = 0; j < W; ++j) {
					if (S[i][j] == 'V') {
						if (del) S[i][j] = '.';
						else S[i][j] = ini;
					}
				}
			}
			return cnt;
		};
		int cnt = 0;
		while (true) {
			bool chain = false;
			for (int i = 0; i < H; ++i) {
				for (int j = 0; j < W; ++j) {
					if (string("RGBYP").find(S[i][j]) != string::npos) {
						int comps = get_comp(i, j, false);
						if (comps >= 4) {
							get_comp(i, j, true);
							chain = true;
						}
					}
				}
			}
			if (chain) ++cnt;
			else break;
			for (int i = 0; i < W; ++i) {
				for (int j = H - 1; j >= 0; --j) {
					for (int k = j; k < H - 1; ++k) {
						if (S[k + 1][i] == '.') swap(S[k + 1][i], S[k][i]);
					}
				}
			}
		}
		cout << cnt << endl;
	}
	return 0;
}


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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n; cin>>n;
	vector<string>v;
	for(int i=0;i<n;++i){
		string s; cin>>s;
		v.emplace_back(s);
	}
	sort(v.begin(),v.end());
	int ans=1;
	for(int i=1;i<n;++i){
		if(v.at(i)==v.at(i-1))continue;
		++ans;
	}
	cout<<ans<<"\n"s;
}

Measured memory_bytes: 11636
q = int(input())

def lcss(x,y):
    
    lcs = [0]*(len(x)+1)
    for i in range(len(y)):
        w1 = y[i]
        lcs_2 = lcs[:]
        for j in range(len(x)):
            if x[j] == w1:
                lcs[j+1] = lcs_2[j] + 1  
            elif lcs[j+1] < lcs[j]:
                lcs[j+1] = lcs[j]
    return lcs[-1]

ret = []
for i in range(q):
    x = input()
    y = input()
    ret.append(lcss(x,y))
print(*ret,sep= "\n")

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
using Graph = vector<vector<int>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define INF 1000000000

ll mv[2001][2001];

void solve_abc160() {
	ll ans;
	ll n, x, y;
	cin >> n >> x >> y;

	Graph g(n);
	rep(i, n - 1) {
		g[i].push_back(i + 1);
		g[i + 1].push_back(i);
	}
	g[x-1].push_back(y-1);
	g[y-1].push_back(x-1);

	rep(i, n)
	{
		V dist(n, -1);
		queue<ll> que;
		dist[i] = 0;
		que.push(i);
		while (!que.empty()) {
			int v = que.front();
			que.pop();

			// v から辿れる頂点をすべて調べる
			for (int nv : g[v]) {
				if (dist[nv] != -1) continue; // すでに発見済みの頂点は探索しない

				// 新たな白色頂点 nv について距離情報を更新してキューに追加する
				dist[nv] = dist[v] + 1;
				que.push(nv);
			}
		}

		rep(j, n) {
			mv[i][dist[j]]++;
		}
	}

	rep(i, n - 1) {
		ans = 0;
		rep(j, n) {
			ans += mv[j][i + 1];
		}
		cout << ans/2 << "\n";
	}
}

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

	solve_abc160();

	return 0;
}


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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout.setf(ios::fixed);
    cout.precision(10);
    
    int L;
    cin >> L;
    double a = L / 3.;
    cout << (a * a * a) << endl;
}


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


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

	int x, y, a, b, c;	cin >> x >> y >> a >> b >> c;
	vector <ll> p(a), q(b), r(c);
	for (auto &i : p)	cin >> i;
	for (auto &i : q)	cin >> i;
	for (auto &i : r)	cin >> i;

	sort(p.begin(), p.end(), greater <int>());
	sort(q.begin(), q.end(), greater <int>());
	sort(r.begin(), r.end());

	vector <int> redgreen;
	rep (i, x)	redgreen.push_back(p[i]);
	rep (i, y)	redgreen.push_back(q[i]);

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

	c--;
	rep (i, x + y)
		if (r[c] > redgreen[i] && 0 <= c)		redgreen[i] = r[c--];
		else	break;
	ll final = 0;
	for (auto i: redgreen)
		final += i;
	cout << final << endl;

	return 0;
}

Measured memory_bytes: 3832
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<int> &o) {
    int a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;


int main() {
    ll MAX = 50;

    ll k;
    cin >> k;


    if (k == 0) {
        printf("4\n3 3 3 3\n");
        ret();
    }
    if (k == 1) {
        printf("3\n1 0 3\n");
        ret();
    }

    if (k <= MAX) {
        MAX = 2;
    }

    cout << MAX << endl;
    ll f = k % MAX;
    ll g = k / MAX + (MAX - 1);

    ll p = g + MAX - (f - 1);

    rep(i, MAX) {
        if (i < f) cout << p;
        else cout << g - f;
        if (i < MAX - 1) cout << ' ';
    }

    cout << endl;


}


Measured memory_bytes: 3608
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string>

#define rep(i, a, b) for ( ll i = (a); i < (b); i++ )
#define per(i, a, b) for ( ll i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()
#define all(v) (v).begin(), (v).end()
#define sz(v) (int)(v).size()

using namespace std;

typedef long long ll;
typedef long double ld;

using P = pair<int, int>;

static const long long MOD = 1000000007;
static const long long LINF = (ll)(1e18+99);
static const int INF = 1e9+99;

ll k, a[55];

int main(void) {
    cin >> k;
    ll n = 50;
    ll q = k/n, r = k%n;
    rep(i, 1, n+1) {
        a[i] = n-1;
        a[i] += (q + (i<=r?1:0))*n;
        a[i] -= q*(n-1) + (i<=r?r-1:r);
    }

    cout << n << endl;
    rep(i, 1, n+1) {
        if (i>1) printf(" ");
        printf("%lld", a[i]);
    }
    printf("\n");
    return 0;
}


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

#define ll unsigned long long
#define endl "\n" 
#define FOR(n) for(int i=0 ; i<n ; i++)
#define FORa(a, n) for(ll i=a ; i<=n ; i++)
ll mod=1000000007;
ll inf=1e9;
vector<ll> dp;
void solve()
{
  string s;
  ll x , y ,z,sum=0;
  cin >> s ;
  for(int i=0 ; i<s.size() ; i++){
    sum+=s[i]-'0';
  }
 
  
  if(sum%9==0) cout << "Yes\n";
  else cout << "No\n";
}   

  


int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t=1;
  //cin >> t;
  while(t--)
    solve();
    return 0 ;
}
  

Measured memory_bytes: 3788
a = input()
t = input()
n = len(a)
m = len(t)
if n<m:
  print("UNRESTORABLE")
  exit()
for i in range(n-m+1)[::-1]:
  flag = True
  for j in range(m):
    if a[i+j] != t[j] and a[i+j] != "?":
      flag = False
  if flag:
    b = a.replace("?","a")
    print(b[:i] + t + b[i+m:])
    exit()
        
print("UNRESTORABLE")


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

using namespace std;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;

const int N = 2000005, MOD = 1000000007;
int f[N], finv[N], act[N];

inline void add(int &a, int b) {
    a += b;
    if (a >= MOD) {
        a -= MOD;
    }
}

inline void sub(int &a, int b) {
    a -= b;
    if (a < 0) {
        a += MOD;
    }
}

inline int mul(int a, int b) {
    return (ll)a * b % MOD;
}

void precalc() {
    f[0] = 1;
    for (int i = 1; i < N; i++) {
        f[i] = mul(f[i - 1], i);
    }
    finv[0] = finv[1] = 1;
    for (int i = 2; i < N; i++) {
        finv[i] = (MOD - mul(MOD / i, finv[MOD % i])) % MOD;
    }
    for (int i = 2; i < N; i++) {
        finv[i] = mul(finv[i - 1], finv[i]);
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.setf(cout.fixed);
    cout.precision(20);
    precalc();
    int n;
    cin >> n;
    for (int k = (n + 1) / 2; k < n; k++) {
        act[k] = mul(mul(f[k - 1], f[k]), finv[2 * k - n]);
    }
    int res = 0;
    for (int k = (n + 1) / 2; k < n; k++) {
        int realact = act[k];
        sub(realact, act[k - 1]);
        add(res, mul(k, realact));
    }
    cout << res << "\n";
}


Measured memory_bytes: 20352
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
#define MAX 110
int main(){
	int n;
	int list[MAX];
	while(cin>>n,n){
		int ans=0;
		for(int i=0;i<n;i++){
			cin>>list[i];
		}
		
		
		for(int i=0;i<n;i++){
			for(int j=0;j<n-i-1;j++){
				if(list[j]>list[j+1]){
					swap(list[j],list[j+1]);
					ans++;
				}
			}
		}
		
		
		
		
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
import java.math.BigDecimal;
import java.util.Scanner;

public class Main{
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			
			BigDecimal s = scan.nextBigDecimal();
			BigDecimal k =scan.nextBigDecimal();
			
			BigDecimal C= s.multiply(k);
			
			
		
			
			
			/*
			long goukei = 0;
			int k = (int)(100.0*B);
			int a = k%10;//1
			k/=10;
			int b = k%10;//10
			k/=10;
			int c = k%10;//100
			
			
			
			goukei+=(long)c*A;
			long x = A*(long)b/10;
			long y = A*(long)a/100;
			
			goukei+=x+y;
			*/
			
	
			System.out.println(C.longValue());
			//System.out.println();
			
			
			
			
			
			
		}
		
		
	}
		

}


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

int main() {
    int n;
    cin >> n;
    vector<string> s(n);
    rep(i,n) cin >> s[i];
    int ac = 0, wa = 0, tle = 0, re = 0;
    rep(i,n) {
        if(s[i]=="AC") ac++;
        if(s[i]=="WA")  wa++;
        if(s[i]=="TLE") tle++;
        if(s[i]=="RE")  re++;
    }
    cout << "AC" << " " << "x" << " " << ac << endl; 
    cout << "WA" << " " << "x" << " " << wa << endl; 
    cout << "TLE" << " " << "x" << " " << tle << endl; 
    cout << "RE" << " " << "x" << " " << re << endl; 

    return 0;
}

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

int main(){
  int n;
  int a=0, b;
  int renzoku = 0;
  int max = 0;
  cin >> n;
  for(int i = 0; i < n; ++i){
    cin >> b;
    if(a>=b){
      renzoku++;
      if(renzoku>max)max=renzoku;
    }else{
      renzoku = 0;
    }
    a = b;//前回の段はa
  }

  cout << max << endl;
  
  return 0; 
}

Measured memory_bytes: 256
use std::cmp::min;
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("filed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: usize = read();
    let m: usize = read();
    let mut coins = vec![0; m + 1];
    for i in 0..m {
        coins[i] = read();
    }
    let mut dp = vec![500000; n + 1];
    dp[0] = 0;
    for i in 1..n+1 {
        for j in 0..m {
            if i >= coins[j] {
                dp[i] = min(dp[i], dp[i - coins[j]] + 1);
            }
        }
    }
    println!("{}", dp[n]);
}



Measured memory_bytes: 5036
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n,i,sum1=0,sum2=0;
    int arr[200000];
    int s[200000];
    cin>>n;
    for(i=0; i<n; i++)
    {
        cin>>arr[i];
    }
    for(i=0;i<n;i++)
    {
        sum1=sum1+arr[i];
    }
    for(i=0; i<n-1; i++)
    {
      if(arr[i]>arr[i+1])
      {
          arr[i+1]=arr[i];
      }
    }
    for(i=0;i<n;i++)
    {
        sum2=sum2+arr[i];
    }
    i=sum2-sum1;
    cout<<i<<endl;
    return 0;
}




Measured memory_bytes: 4344
#include <iostream>
using namespace std;
#include<string.h>
#include<set>
#include<stdio.h>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
#include <cstdio>
#include <cstdlib>
#include<stack>
#include<vector>



int main()
{
    int n;
    while(cin>>n)
    {
map<int ,int >a;
        int sum=0;
        int b;
        for(int i=0;i<n;i++)
        {
            scanf("%d",&b);
            if(a[b]==1)
                {
                    sum--;
                    a[b]=0;
                }
            else
            {
                sum++;
                a[b]=1;
            }
        }
        printf("%d\n",sum);
    }
    return 0;
}


Measured memory_bytes: 4992
#A
x,y = map(int, input().split())
res = 0
if x == 1:
    res += 300000
elif x == 2:
    res += 200000
elif x == 3:
    res += 100000
if y == 1:
    res += 300000
elif y == 2:
    res += 200000
elif y == 3:
    res += 100000
if x == 1 and y == 1:
    res += 400000
print(res)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define BIT(n) (1LL << (n))
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPB(i, n) for (int i = 0; i < BIT(n); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORA(i, n) for (auto &&i : n)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define DEBUG(x) cerr << #x << ": " << x << "\n"
#define PRINTALL(V)                                                            \
  for (auto v : (V)) {                                                         \
    cerr << v << " ";                                                          \
  }                                                                            \
  cerr << "\n";
#define ALL(v) v.begin(), v.end()
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define epb emplace_back
#define int long long
using namespace std;
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 (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template < class T > using vec = std::vector< T >;
template < class T > void print(const T &x) { cout << x << "\n"; }
const int MOD = 1000000007, INF = 1061109567, INF2 = INF * INF;
const double EPS = 1e-10, PI = acos(-1.0);
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
signed main() {
  cin.tie(0), ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  int N, Ma, Mb;
  cin >> N >> Ma >> Mb;
  vec< int > a(N), b(N), c(N);
  REP(i, N) { cin >> a[i] >> b[i] >> c[i]; }
  vec< vec< vec< int > > > dp(N + 1,
                              vec< vec< int > >(401, vec< int >(401, INF)));
  dp[0][0][0] = 0;
  REP(i, N) {
    REP(j, 401) {
      REP(k, 401) {
        dp[i + 1][j][k] = dp[i][j][k];
        int vala = j - a[i];
        int valb = k - b[i];
        if (vala >= 0 && valb >= 0)
          dp[i + 1][j][k] = min(dp[i][j][k], dp[i][vala][valb] + c[i]);
      }
    }
  }
  int ans = INF;
  REPS(i, 401) {
    int vala = i * Ma;
    int valb = i * Mb;
    if (vala > 400 || valb > 400)
      break;
    chmin(ans, dp[N][vala][valb]);
  }
  if (ans != INF) {
    print(ans);
  } else {
    print("-1");
  }
}

Measured memory_bytes: 53504