akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <cstring>
    #include <chrono>
    #include <complex>


using namespace std;

//def
#define debug(x) cout << #x << ": " << x << '\n'
#define out(x) cout << x << '\n'
#define repeat(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define revrepeat(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define foreach(e, v) for (auto &e : v)
#define CYES cout << "Yes" << endl
#define CNO cout << "No" << endl
#define SPC(x) cout << fixed << setprecision(x)
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))

 #define endl "\n"
    #define ll long long int
    #define vi vector<int>
    #define vll vector<ll>
    #define vvi vector < vi >
    #define pii pair<int,int>
    #define pll pair<long long, long long>
    #define mod 1000000007
    #define inf 1000000000000000001;
    #define all(c) c.begin(),c.end()
    #define mp(x,y) make_pair(x,y)
    #define mem(a,val) memset(a,val,sizeof(a))
    #define eb emplace_back
    #define f first
    #define s second
typedef pair<int, int> P;
constexpr int MOD = 1e9 + 7;
constexpr int INF = __INT_MAX__;               // 2^31 - 1
constexpr long long INFLL = __LONG_LONG_MAX__; // 2^61 - 1
constexpr int MAX_N = 1e5 + 5;
constexpr double PI = acos(-1);

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

    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    sort(all(a), greater<int>());
    auto comPair = [](const P &firstElof, const P &secondElof) {
        int m1 = min(firstElof.first, firstElof.second);
        int m2 = min(secondElof.first, secondElof.second);
        return m1 < m2;
    };
    priority_queue<P, vector<P>, decltype(comPair)> que(comPair);

    ll ans = a[0];
    que.emplace(a[0], a[1]);
    que.emplace(a[0], a[1]);
    repeat(i, 2, n) {
        auto p = que.top();
        que.pop();

        ans += min(p.first, p.second);

        que.emplace(p.first, a[i]);
        que.emplace(p.second, a[i]);
    }
    out(ans);
    return 0;
}

Measured memory_bytes: 6088
import scala.math._

object Main extends App {
  val sc = new java.util.Scanner(System.in)
//  val list = List.fill(3)(sc.nextInt)
  val n = sc.next

  val ans = "ABC" + n

  println(ans)

  ///////////////////////////////////////////

  def bigIterator(start: BigInt, end: BigInt, step: BigInt = 1) =
    Iterator.iterate(start)(_ + step).takeWhile(_ <= end)

  def lcm(a :Int, b :Int): Int =
    a / gcd(a, b) * b

  def lcm(a :Long, b :Long): Long =
    a / gcd(a, b) * b

  def gcd(a: Int, b: Int): Int =
    if (b == 0) a else gcd(b, a % b)

  def gcd(a: Long, b: Long): Long =
    if (b == 0) a else gcd(b, a % b)

  def setOrUpdated[A, B](a: Map[A, B], key: A, value: B, f: (B, B) => B) =
    a.get(key) match {
      case Some(v) => a.updated(key, f(value, v))
      case _ => a + (key -> value)
    }
}

Measured memory_bytes: 25548
N=int(input())

if N>=10:
    result=9
elif N<10:
    result=N

if N>=1000:
    result+=900
elif 100<=N and N<1000:
    result+=N-100+1

if N>=100000:
    result+=90000
elif 10000<=N and N<100000:
    result+=N-10000+1

print(result)

Measured memory_bytes: 3060
fn read<T: std::str::FromStr>() -> T {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).ok();
    buf.trim().parse().ok().unwrap()
}

fn main() {
    let (h, w) = {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).ok();
        let v = buf
            .trim()
            .split_whitespace()
            .map(|e| e.trim().parse().ok().unwrap())
            .collect::<Vec<usize>>();
        (v[0], v[1])
    };

    let mut s: Vec<Vec<char>> = (0..h).map(|_| read::<String>().chars().collect()).collect();

    let bom: char = "#".to_owned().chars().next().unwrap();
    for i in 0..h {
        for j in 0..w {
            if s[i][j] == bom {
                print!("{}", bom);
                continue;
            }
            let mut cnt = 0;
            if i > 0 {
                if j > 0 {
                    if s[i - 1][j - 1] == bom {
                        cnt += 1;
                    }
                }

                if s[i - 1][j] == bom {
                    cnt += 1;
                }

                if j < w - 1 {
                    if s[i - 1][j + 1] == bom {
                        cnt += 1;
                    }
                }
            }

            if j > 0 {
                if s[i][j - 1] == bom {
                    cnt += 1;
                }
            }

            if j < w - 1 {
                if s[i][j + 1] == bom {
                    cnt += 1;
                }
            }

            if i < h - 1 {
                if j > 0 {
                    if s[i + 1][j - 1] == bom {
                        cnt += 1;
                    }
                }

                if s[i + 1][j] == bom {
                    cnt += 1;
                }

                if j < w - 1 {
                    if s[i + 1][j + 1] == bom {
                        cnt += 1;
                    }
                }
            }
            print!("{}", cnt.to_string());
        }
        println!();
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N = 2e7+10 , OO = 0x3f3f3f3f ;
//const int mod = 1000000007;
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
double startTime;
double getCurrentTime() {
	return ((double)clock() - startTime) / CLOCKS_PER_SEC;
}
#define clr(arr,val) memset(arr , val , sizeof (arr))
#define loop(i,n) for(int i = 0;i < int(n);i++)
#define rloop(i,n) for(int i = int(n)-1;i >= 0;i--)
#define xloop(i,a,b) for(int i = int(a);i <= int(b);i++)
#define range(vec) for(auto &x : vec) cin >> x;
#define ALL(v) ((v).begin()) , ((v).end())
#define SZ(v)  ((int)((v).size()))
int dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
//int dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
//int dx[6]={2,1,-1,-2,-1,1};int dy[6]={0,1,1,0,-1,-1}; //Hexagonal Direction

int n , a, b;

bool checkRkm(int x){

    int cnt = 0;
    while (x)
    {
        int dig = x % 10;
        cnt += dig;
        x /= 10;
    }
    return (cnt >= a and cnt <= b);
}

int main()
{
    startTime = (double)clock();
    #ifndef ONLINE_JUDGE
        //freopen("in.in", "r", stdin);
        //freopen("out.in", "w", stdout);
    #endif
	//ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    
    ll ans = 0;
    scanf("%d %d %d", &n, &a , &b);
    for(int i = 1 ; i <= n ; ++i){
        if(checkRkm(i))
            ans += i;
    }
    printf("%lld\n" , ans);


    
    return 0;
}

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

public class Main
{
  public static void main(String[] args) throws IOException
  {
    BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1);
    String s = r.readLine();
    String[] sl = s.split("[\\s]+");
    int a = Integer.parseInt(sl[0]);
    int b = Integer.parseInt(sl[1]);

    if(a + b == 15)
    {
      System.out.println("+");
    }
    else if(a * b == 15)
    {
      System.out.println("*");
    }
    else
    {
      System.out.println("x");
    }
  }
}

Measured memory_bytes: 20692
(defun splitat (c line)
  (labels ((rec (line acc)
				(let ((pos (position-if (lambda(cc) (char= c cc)) line)))
				  (if pos
					  (rec (subseq line (1+ pos)) (cons (subseq line 0 pos) acc))
					(nreverse (cons line acc))))))
	(rec line nil)))

(defun f(s)
  (and (char= (char s 2) (char s 3))
       (char= (char s 4) (char s 5))))

(let ((line (read-line nil nil)))
  (format t "~A~%" (if (f line) "Yes" "No")))


Measured memory_bytes: 12640
#include <iostream>
#include <vector>
#include <queue>

using namespace std;
typedef long long ll;
typedef vector<ll> vi;

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

	int N, K;
	cin >> N >> K;
	vi A(N), B(N);
	for(int i = 0; i < N; ++i) cin >> A[i];
	while(K--) {
		for(int i = 0; i < N; ++i) B[i] = 1;
		priority_queue<int> q, q2;
		for(int i = 0; i < N; ++i) {
			B[i] += q.size();
			q.push(-(i+A[i]));
			while(!q.empty() && -q.top()<=i) q.pop();
		}
		for(int i = N-1; i >= 0; --i) {
			B[i] += q2.size();
			q2.push(i-A[i]);
			while(!q2.empty() && q2.top()>=i) q2.pop();
		}
		bool diff = false;
		for(int i = 0; i < N; ++i) if(A[i] != B[i]) diff = true;
		if(!diff) break;
		swap(A, B);
	}
	for(int i = 0; i < N; ++i) cout << A[i] << " \n"[i+1==N];

	return 0;
}

Measured memory_bytes: 8908
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Scanner;

class Main{




	public static void main(String[] args) {


		Scanner sc = new Scanner(System.in);			//文字の入力
		int n = sc.nextInt();
		int[] a = new int[3*n];
		for(int i= 0;i < 3*n;i++){
			a[i] = sc.nextInt();
		}

		long sum1[] = new long[n+1];
		PriorityQueue<Integer> queue1 = new PriorityQueue<Integer>();
		long xsum = 0;
		for(int i = 0;i < n;i++){
			queue1.add(a[i]);
			xsum += a[i];
		}
		sum1[0] = xsum;

		for(int i = n;i < 2*n;i++){
			queue1.add(a[i]);
			sum1[i-n+1] = a[i] + sum1[i-n];

			long del = queue1.poll();						//最小要素の削除
			sum1[i-n+1] -= del;

//			System.out.println("sum1 " + sum1[i-n+1]);
		}


		long sum2[] = new long[n+1];
		PriorityQueue<Integer> queue2 = new PriorityQueue<Integer>(new MyComparator());
		long ysum = 0;
		for(int i = 3*n-1;i >= 2*n;i--){
			queue2.add(a[i]);
			ysum += a[i];
		}
		sum2[0] = ysum;
		int c = 1;
		for(int i = 2*n-1;i >= n;i--){
			queue2.add(a[i]);
			sum2[c] = a[i] + sum2[c-1];

			long del = queue2.poll();						//最小要素の削除
			sum2[c] -= del;
//			System.out.println("del " + del);
//
//			System.out.println("sum2 " + sum2[c]);

			c++;

		}
//		System.out.println();

		long ans = -100000000000000l;
		for(int i= 0;i <= n;i++){
//			
//			System.out.println("sum1 "+sum1[i]);
//			System.out.println("sum2 "+sum2[n-i]);
//
//			System.out.println(ans);

			ans = Math.max(ans, sum1[i] - sum2[n-i]);
		}
		System.out.println(ans);


	}

}

class MyComparator implements Comparator {
	 
    public int compare(Object obj1, Object obj2) {
         
        int num1 = (int)obj1;
        int num2 = (int)obj2;
         
        if(num1 < num2) {
            return 1;
        } else if(num1 > num2) {
            return -1;
        } else{
            return 0;
        }
    }
}




Measured memory_bytes: 93364
#10で割ったあとの個数に注目して解を出してる
N = int(input())

def factorial(n, p):
    if n == 0: return 0
    return n//p + factorial(n//p, p)

def duble_factorial(n, p):
    if n%2 == 1:
        return factorial(n,p) - duble_factorial(n-1, p) # n!! = n!/(n-1)!!だからpで割ると引き算で表せるよね
    else:
        res = factorial(n//2, p)
        if p == 2: 
            res += n//2
        return res

ans = min(duble_factorial(N,2), duble_factorial(N,5))
print(ans)

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

int main() {
    int n, m;
    cin>>n>>m;
    int a[m], sum=0;
    for(int i=0; i<m; i++){
        cin>>a[i];
        sum+=a[i];
    }
    if(sum>n) cout<<"-1";
    else cout<<n-sum;
	return 0;
}


Measured memory_bytes: 3648
#include "bits/stdc++.h"
using namespace std;

int main() {
	int N;
	cin >> N;
	vector<int>A(N);
	vector<vector<pair<int, int>>>B(N);
	for (int i = 0; i < N; i++) {
		cin >> A.at(i);
		for (int j = 0; j < A.at(i); j++) {
			int x, y;
			cin >> x >> y;
			pair<int, int>C = make_pair(x, y);
			B.at(i).push_back(C);
		}
	}
	int ans = -1;
	for (int i = 0; i < (1 << N); i++) {
		vector<int>Kind(N, 0);
		int kinds = 0;
		for (int j = 0; j < N; j++) {
			if (i & (1 << j)) {
				Kind.at(j) = 1;
				kinds++;
			}
		}
		bool check = true;
		for (int j = 0; j < N; j++) {
			for (int k = 0; k < A.at(j); k++) {
				if (Kind.at(B.at(j).at(k).first - 1) != B.at(j).at(k).second && Kind.at(j) == 1) check = false;
			}
		}
		if (check) ans = max(ans, kinds);
	}
	cout << ans << endl;
}

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

using namespace std;

class Solver {
};

int main() {
	while(true) {
		int a0, l;
		cin >> a0 >> l;
		if (a0 == 0 && l == 0)break;

		map<int, int> mp;
		mp.emplace(a0, 0);
		int a = a0;
		for (int i = 1; i < 50; i++) {
			vector<int> nums(l, 0);
			for (int j = 0; j < l; j++) {
				nums[j] = a % 10;
				a /= 10;
			}
			sort(nums.begin(), nums.end());
			int max = 0;
			int min = 0;
			int div = 1;
			for (int j = 0; j < l; j++) {
				max += nums[j] * div;
				min += nums[l - j - 1] * div;
				div *= 10;
			}
			a = max - min;

			if (mp.find(a) != mp.end()) {
				cout << mp[a] << ' ' << a << ' ' << i - mp[a] << endl;
				break;
			}
			mp.emplace(a, i);
		}
	}
}


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0 ; i<(n) ;i++)
bool go(int a,int b,int k){
	int n = 0;
	while(k>0){
		n += k%10;
		k /=10;
	}

	return (n>=a && n<=b);
}

int main(){
	int a,b,x; cin >> x >> a >> b;
	if(a>b){
		int tmp = a;
		a = b;
		b = tmp; 
	}

	int count = 0;
	for(int i=1 ; i <= x ; i++){
		if(go(a,b,i)) count +=i;
	}
	cout << count << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
using vi = vector<int>;
using vvi = vector<vector<int>>;
int main(){
  int n,m,t,p;
  while(cin >> n >> m >> t >> p, n){
    vector<int> d(t),c(t);
    REP(i,t) cin >> d[i] >> c[i];
    vector<int> x(p),y(p);
    REP(i,p) cin >> x[i] >> y[i];
    vvi a(n,vi(m,1));
    REP(k,t){
      vvi b;
      if(d[k]==1){
        b.assign(max(c[k],n-c[k]),vi(m,0));
        if(c[k]<n-c[k]){
          REP(i,n-c[k])REP(j,m){
            b[i][j] += a[i+c[k]][j];
          }
          REP(i,c[k])REP(j,m){
            b[i][j] += a[c[k]-i-1][j];
          }
        }else{
          REP(i,n-c[k])REP(j,m){
            b[i][j] += a[i+c[k]][j];
          }
          REP(i,c[k])REP(j,m){
            b[i][j] += a[c[k]-i-1][j];
          }
          // REP(i,c[k])REP(j,m){
          //   b[i][j] += a[c[k]-i-1][j];
          // }
          // REP(i,c[k])REP(j,m){
          //   b[i][j] += a[i+c[k]][j];
          // }
        }
        n = max(c[k],n-c[k]);
      }else{
        b.assign(n,vi(max(c[k],m-c[k]),0));
        if(c[k]<m-c[k]){
          REP(i,n)REP(j,m-c[k]){
            b[i][j] += a[i][j+c[k]];
          }
          REP(i,n)REP(j,c[k]){
            b[i][j] += a[i][c[k]-j-1];
          }
        }else{
          REP(i,n)REP(j,m-c[k]){
            b[i][j] += a[i][j+c[k]];
          }
          REP(i,n)REP(j,c[k]){
            b[i][j] += a[i][c[k]-j-1];
          }
        }
        m = max(c[k],m-c[k]);
      }
      a = b;
    }
    REP(i,p){
      cout << a[x[i]][y[i]] << endl;
    }
  }
}



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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define VIN(v) for(auto&elem_: (v) )cin>>elem_
#define VOUT(v, sep) for(_loop_int idx=0; idx<(_loop_int)v.size(); idx++) {cout<<v[idx]; if(idx<v.size()-1) cout<<sep;} cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(debugidx,v.size())cout<<" "<<v[debugidx];cout<<endl
#define DEBUG_ARR(v,n) cout<<#v<<":";REP(debugidx,n)cout<<" "<<v[debugidx];cout<<endl

const ll MOD = 1000000007ll;
const int IINF = numeric_limits<int>::max()/2-1;
const ll LINF = numeric_limits<ll>::max()/2-1;

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



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

    int n;
    cin>>n;

    vl a(n+1,0);
    vl b(n+1,0);
    FOR(i,1,n+1){
        cin>>a[i]>>b[i];
    }

    sort(ALL(a));
    sort(ALL(b));

    ll midA, midB;
    ll ans=0;
    if(n%2==0){
        midA = (ll)(a[n/2]+a[(n/2)+1]) * 5; // * 10/2
        midB = (ll)(b[n/2]+b[(n/2)+1]) * 5; 

        ans = midB-midA;
        ans /= 5; // ÷0.5
        ans += 1;
    }else{
        midA = a[(n/2)+1];
        midB = b[(n/2)+1];

        ans = midB-midA;
        ans += 1;
    }

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

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

using namespace std;
int ax[10005];
int bx[105][105];

int main()
{
    int h,w;
    scanf("%d%d",&h,&w);
    int n;
    scanf("%d",&n);
    int i,j,k,a,b;
    for(i=1;i<=n;i++)scanf("%d",&ax[i]);
    a = 1;b = 0;
    for(i=1;i<=h;i++){
        for(j=1;j<=w;j++){
            if(i%2==1)k = j;
        else k = w-j+1;
            bx[i][k]=a;b++;
            if(b==ax[a]){a++;b = 0;
            }
        }
    }
    for(i=1;i<=h;i++){
        for(j=1;j<=w;j++)printf("%d ",bx[i][j]);
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<algorithm>
#include<cmath>
using namespace std;

typedef long long int llint;

int main(){
	int N;
	int AC=0,WA=0,TLE=0,RE=0;
	cin >> N;
	for(int i=0;i<N;i++){
		string S;
		cin >> S;
		if(S=="AC"){
			AC++;
		}else if(S=="WA"){
			WA++;
		}else if(S=="TLE"){
			TLE++;
		}else if(S=="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: 3628
import sys
input = sys.stdin.readline
sys.setrecursionlimit(2147483647)
INF = 10 ** 9
N = int(input())
h = list(map(int, input().split()))
def chmin(dp, idx, b):
    if dp[idx] > b:
        dp[idx] = b
        return True
    return False
def solve(dp, i):
    if i == 0:return 0
    if dp[i] < INF: return dp[i]
    chmin(dp, i, solve(dp, i-1) + abs(h[i]-h[i-1]))
    chmin(dp, i, solve(dp, i-2) + abs(h[i]-h[i-2]))
    return dp[i]
def main():
    dp = [INF] * N
    dp[0] = 0
    dp[1] = abs(h[0]-h[1])
    print(solve(dp, N-1))
if __name__ == "__main__":
    main()

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

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll A, B, C;
    cin >> A >> B >> C;
    ll m = std::max({A, B, C});

    ll ans = 0;
    ans += (m - A) / 2 + (m - B) / 2 + (m - C) / 2;
    A += ((m - A) / 2) * 2;
    B += ((m - B) / 2) * 2;
    C += ((m - C) / 2) * 2;

    ll s = (m - A) + (m - B) + (m - C);
    if (s == 1)
        ans += 2;
    else if (s == 2)
        ans++;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#pragma region _head

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<iomanip>
#include<queue>
#include<stack>
#include<numeric>
#include<utility>
#include<regex>

void Init() {
	std::cin.tie(0); std::ios::sync_with_stdio(false);
	struct Init_caller { Init_caller() { Init(); } }caller;
}

#pragma region _define

#define int LL
#define f(i,a,b) for(LL i=a;i<b;i++)
#define f_vI(v,n) f(i,0,n)cin>>v[i]
#define f_v2I(v1,v2,n) f(i,0,n)cin>>v1[i]>>v2[i]
#define f_v3I(v1,v2,v3,n) f(i,0,n)cin>>v1[i]>>v2[i]>>v3[i]
#define f_vO(v,n) f(i,0,n)cout<<v[i]<<endl
#define ei else if
#define all(a) a.begin(),a.end()
#define size(s) ((LL)s.size())
#define F first
#define S second
#define check() cout<<"! ! !"
#define endl "\n"
#define _y() cout<<"Yes"<<endl
#define _Y() cout<<"YES"<<endl
#define _n() cout<<"No"<<endl
#define _N() cout<<"NO"<<endl
#define INT_INF 1<<29
#define LL_INF 1LL<<60
#define MOD 1000000007

#pragma endregion

#pragma region _using

using namespace std;

using LL = long long;
using st = string;
using vi = vector<LL>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vd = vector<double>;
using vvd = vector<vd>;
using vvvd = vector<vvd>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<st>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using qi = queue<LL>;
using qc = queue<char>;
using qs = queue<st>;
using si = stack<LL>;
using sc = stack<char>;
using ss = stack<st>;
using pi = pair<LL, LL>;
using ppi = pair<pi, LL>;
using mll = map<LL, LL>;
using mcl = map<char, LL>;
using vpi = vector<pi>;
using vppi = vector<ppi>;

#pragma endregion

struct edge {
	int from, to, cost;
};

void y_n(bool p) {
	p ? _y() : _n();
}

void Y_N(bool p) {
	p ? _Y() : _N();
}

LL vmax(vi v, LL n) {
	int MAX = 0;
	f(i, 0, n) {
		MAX = max(MAX, v[i]);
	}
	return MAX;
}

LL vmin(vi v, LL n) {
	int MIN = LL_INF;
	f(i, 0, n) {
		MIN = min(MIN, v[i]);
	}
	return MIN;
}

LL gcd(LL a, LL b) {
	LL r;
	while ((r = a % b) != 0) {
		a = b;
		b = r;
	}
	return b;
}
LL lcm(LL a, LL b) {
	return (a / gcd(a, b) * b);
}

//素数判定
bool is_prime(int n) {
	for (int i = 2; i*i <= n; i++) {
		if (n % i == 0) {
			return false;
		}
	}
	return true;
}

//階乗計算
LL factorial(LL n) {
	LL a = 1, ret = 1;
	while (a < n) {
		a++;
		ret *= a;
		ret %= MOD;
	}
	return ret;
}


#pragma endregion 


/*****************************************************************************/
signed main(void) {
	int n, a;
	cin >> n >> a;
	vi x(n);
	f_vI(x, n);
	int X = vmax(x, n);
	vvvi dp(n + 1, vvi(n + 1, vi(n*X + 1, 0)));
	dp[0][0][0] = 1;
	f(i, 0, n) {
		f(j, 0, n) {
			f(k, 0, n*X) {
				if (dp[i][j][k] != 0) {
					dp[i + 1][j][k] += dp[i][j][k];
					dp[i + 1][j + 1][k + x[i]] += dp[i][j][k];
				}
			}
		}
	}
	int ans = 0;
	f(i, 1, n + 1) {
		ans += dp[n][i][i*a];
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 52224
#include <iostream>
#include <string>
#include <cstdio>
#include <cstdlib>
using namespace std;

struct Node {
    int key;
    Node *left, *right, *parent;
};

Node *root, *NIL;

void insert(int k)
{
    Node *y = NIL;
    Node *x = root;
    Node *z;

    z = (Node *)malloc(sizeof(Node));
    z->key = k;
    z->left = NIL;
    z->right = NIL;

    while (x != NIL) {
        y = x;
        if (z->key < x->key) {
            x = x->left;
        } else {
            x = x->right;
        }
    }

    z->parent = y;
    if (y == NIL) {
        root = z;
    } else {
        if (z->key < y->key) {
            y->left = z;
        } else {
            y->right = z;
        }
    }
}

void inorder(Node *u)
{
    if (u == NIL) return;
    inorder(u->left);
    printf(" %d", u->key);
    inorder(u->right);
}

void preorder(Node *u)
{
    if (u == NIL) return;
    printf(" %d", u->key);
    preorder(u->left);
    preorder(u->right);
}

int main(int argc, char const *argv[])
{
    int n, i, x;    
    string com;

    scanf("%d", &n);

    for (int i = 0; i < n; i++) {
        cin >> com;
        if (com == "insert") {
            cin >> x;
            insert(x);
        } else if (com == "print") {
            inorder(root);
            printf("\n");
            preorder(root);
            printf("\n");
        }
    }

    return 0;
}




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

int main(){
  int N,Y;
  cin >> N >> Y;
  bool a=false;
  for(int i=0;i<N+1;i++){
    for(int j=0;j<N-i+1;j++){
      if(10000*i+5000*j+1000*(N-i-j)==Y){
        cout << i << " " << j << " " << N-i-j << endl;
        a=true;
        break;
      }
    }
    if(a){
      break;
    }
  }
  if(!a){
    cout << -1 << " " << -1 << " " << -1 << " " << endl;
  }
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val s= readLine()!!
    val sb = StringBuilder()
    s.forEach { when(it){
        '1' -> sb.append(1)
        '0' -> sb.append(0)
        else -> if( sb.isNotEmpty() ) sb.delete(sb.lastIndex,sb.lastIndex+1)
    }}
    println(sb)
}

Measured memory_bytes: 33820
n = int(input())
if n< 105:
  print(0)
elif 105 <= n < 135:
  print(1)
elif 135 <= n < 165:
  print(2)
elif 165 <= n < 189:
  print(3)
elif 189<= n < 195:
  print(4)
else:
  print(5)

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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

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

  int ans = 1, M = 0;
  for (int i = 1; i <= N; i++){
    int num = i, cnt = 0;
    while (num % 2 == 0){
      num /= 2; cnt++;
    }
    if (M < cnt){
      M = cnt; ans = i;
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3544
fun main(args: Array<String>) {
    val (n,k) = readLine()!!.split(" ").map { it.toInt() }
    (1..n).map {
        var count = 0
        var value = it
        while(value<k) {
            value*=2
            count++
        }
        count
    }.map { Math.pow(0.5,1.0*it) }.sum().let { println(it/n) }
}


Measured memory_bytes: 40688
n = int(input())
P = list(map(int, input().split()))
count = 0
for i in range(n-2):

    P_temp = [P[i], P[i+1], P[i+2]]
    P_temp.sort()
    if P_temp[1] == P[i+1]:
        count = count + 1

print(count)


Measured memory_bytes: 2940
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using namespace std;
using uint = unsigned int;
using ll = long long;
const int M = 1e9 + 7;
const ll MLL = 1e18L + 9;
#pragma unused(M)
#pragma unused(MLL)
#ifdef LOCAL
#include"rprint.hpp"
#else
template <ostream& out = cout, class... T> void prints(T&&...){ }
template <ostream& out = cout, class... T> void printd(T&&...){ }
template <ostream& out = cout, class... T> void printde(T&&...){ }
template <ostream& out = cout, class... T> void printb(T&&...){ }
template <ostream& out = cout, class... T> void printArr(T&&...){ }
#endif

int main(){
    int n; cin >> n;
    cout << (n / 100 == n % 10 ? "Yes" : "No") << '\n';
    return 0;
}


Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
dif=0
for i in range(n-1):
       
       if a[i]-a[i+1]>0:
           b=a[i]-a[i+1] 
           a[i+1]+=b
           dif+=b
       else:
           i+=1
print(dif)

Measured memory_bytes: 32180
import sys
import collections
import numpy as np
input = sys.stdin.readline
X = int(input())
import math

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True
while True:
    if is_prime(X):
        print(X)
        sys.exit()
    X += 1

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

int main() {
	int a, b, c;
	int i = 0;

	cin >> a>>b;

	c = a + b;
	if (c % 2 == 0) {
		c = c / 2;
	}
	else {
		c = c / 2;
		c++;
	}
	
	


	cout << c << endl;
	

	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		// while (true) {
		// double q = in.nextDouble();
		// if (q == -1)
		// break;
		// double x = q / 2;
		// while (Math.abs(x * x * x - q) > 0.00001 * q)
		// x = Math.abs(x - ((x * x * x - q) / (3 * x * x)));
		// System.out.printf("%.6f\n", x);
		// }
		double q;
		while ((q = in.nextDouble()) != -1) {
			double xn = q / 2.0;
			double checkVal = xn * xn * xn - q;
			while (Math.abs(checkVal) >= 0.00001 * q) {
				xn = xn - (checkVal) / (xn * xn * 3.0);
				checkVal = xn * xn * xn - q;
			}
			System.out.printf("%f", xn);
			System.out.println();

		}
	}
}

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

int main(){
	int H, W;
	cin >> H >> W;
	char a[H][W];
	rep(i,H)rep(j,W) cin >> a[i][j];
	set<int> r, c;
	rep(i,H) r.insert(i);
	rep(j,W) c.insert(j);
	bool can_erase_r = true, can_erase_c = true;

	while (can_erase_r || can_erase_c) {
		vector<int>v_removed;
		for (int i : r) {
			bool flag = true;
			for (int j : c) {
				if (a[i][j] == '#') {
					flag = false; break;
				}
			}
			if (flag) v_removed.push_back(i);
		}
		if (v_removed.size() == 0) can_erase_r = false;
		for (int i : v_removed) r.erase(i);
		v_removed.clear();

		for (int j : c) {
			bool flag = true;
			for (int i : r) {
				if (a[i][j] == '#') {
					flag = false;	break;
				}
			}
			if (flag) v_removed.push_back(j);
		}
		if (v_removed.size() == 0) can_erase_c = false;
		for (int j : v_removed) c.erase(j);
	}

	for (int i : r) {
		for (int j : c) cout << a[i][j];
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define int long long 
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define all(a) a.begin(),a.end()
#define ld long double
using namespace std;
signed main(){
    fast;
    int n;
    cin>>n;
    if(n  == 2){
        cout<<1;
        return 0;
    }
    int ans = 2;
    int num = n-(int)1;
    for(int i = 2;i*i<=(num);i++){
        if(num%i == 0){
            ans++;
            if((num/i)!=i)
                ans++;
        }
    }
    //cout<<ans<<endl;
    num = n;
    for(int i = 2;i*i<=(num);i++){
        if(num%i == 0){
            int d = i;
            int nn = n;
            while(nn%d == 0){
                nn = nn/d;
            }
            nn = nn%d;
            if(nn == 1)
                ans++;
            d = n/i;
            //cout<<i<<" "<<nn<<endl;
            if(d!=i){
                int nn = n;
                while(nn%d == 0){
                    nn = nn/d;
                }
                nn = nn%d;
                if(nn == 1)
                    ans++;
            }
        }
    }
    cout<<ans;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cassert>
#include<vector>
#include<fstream>
#include<string>
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<queue>
#include<map>
#include<set>
#include<bitset>

using namespace std;
#define REP(i,m,n) for(int i=m;i<n;++i)
#define REPll(i,m,n) for(ll i=m;i<n;++i)
#define INF 10000000000000000
#define MOD 1000000007
#define ll long long
#define mp make_pair
#define all(v) v.begin(),v.end()

vector<vector<pair<int, int>>>v(2100, vector<pair<int, int>>(2100, mp(0, 0)));

int main() {
	int n, k;
	cin >> n >> k;
	REP(i, 0, n) {
		int x, y;
		char c;
		cin >> x >> y >> c;
		if (c == 'W') {
			v[x % (2 * k)][y % (2 * k)].first++;
		}
		else {
			v[x % (2 * k)][y % (2 * k)].second++;
		}
	}
	REP(i, 0, 2 * k) {
		REP(j, 1, 2 * k) {
			v[i][j].first += v[i][j - 1].first;
			v[i][j].second += v[i][j - 1].second;
		}
	}
	REP(j, 0, 2 * k) {
		REP(i, 1, 2 * k) {
			v[i][j].first += v[i - 1][j].first;
			v[i][j].second += v[i - 1][j].second;
		}
	}
	int ans = 0;
	REP(i, 0, k) {
		REP(j, 0, k) {
			//first w  second b
			int hoge = v[2 * k - 1][2 * k - 1].first, foo = v[2 * k - 1][2 * k - 1].second;
			//hoge=b+w,foo=w+b
			hoge += v[i][2 * k - 1].first - 2 * v[i][j + k].first + 2 * v[i][j].first - v[i + k][2 * k - 1].first + 2 * v[i + k][j + k].first - 2 * v[i + k][j].first - v[2 * k - 1][j + k].first + v[2 * k - 1][j].first;
			hoge -= v[i][2 * k - 1].second - 2 * v[i][j + k].second + 2 * v[i][j].second - v[i + k][2 * k - 1].second + 2 * v[i + k][j + k].second - 2 * v[i + k][j].second - v[2 * k - 1][j + k].second + v[2 * k - 1][j].second;
			foo -= v[i][2 * k - 1].first - 2 * v[i][j + k].first + 2 * v[i][j].first - v[i + k][2 * k - 1].first + 2 * v[i + k][j + k].first - 2 * v[i + k][j].first - v[2 * k - 1][j + k].first + v[2 * k - 1][j].first;
			foo += v[i][2 * k - 1].second - 2 * v[i][j + k].second + 2 * v[i][j].second - v[i + k][2 * k - 1].second + 2 * v[i + k][j + k].second - 2 * v[i + k][j].second - v[2 * k - 1][j + k].second + v[2 * k - 1][j].second;
			ans = max(ans, max(hoge, foo));
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 34944
#include <algorithm>
#include <functional>
#include <iostream>
#include <set>
using namespace std;
inline long f(long a){
	if(a%2==0){
		return a/2;
	}else{
		return 3*a+1;
	}
}
int main() {
	long s;
	cin>>s;
	long current=s;
	bool *history = new bool[1000001];
	for(int i=0;i<1000001;i++){
		history[i]=false;
	}
	long counter = 1;
	while(true){
		if(history[current]){
			cout<<counter<<endl;
			break;
		}else{
			history[current]=true;
		}
		current = f(current);
		++counter;
	}
	delete[] history;
	return 0;
}


Measured memory_bytes: 1280
using System;
namespace kozaiyApp
{
    public class C
    {
        static void Main()
        {
            string[] input = Console.ReadLine().Split(' ');
            int A = int.Parse(input[0]);
            int B = int.Parse(input[1]);
            int H = int.Parse(input[2]);
            int M = int.Parse(input[3]);

            double h = H * 30; // Hの角度
            h = h + (M * 0.5);
            double m = M * 6; // Mの角度

            var x = 360 - h + m;
            double d;
            if (x <= 180)
            {
                d = x;
            }
            else
            {
                d = 360 - x;
            }

            var cos = Math.Cos(d * (Math.PI / 180));
            var a = Math.Pow(A, 2);
            var b = Math.Pow(B, 2);
            var c = a + b - (2 * A * B * cos);
            var ans = Math.Sqrt(c);

            Console.WriteLine(ans);
        }
    }
}


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

#define ll long long
#define all(it) it.begin(), it.end()
#define FOR(i, n) for(int i = 0; i < n; i++)
#define FORU(i, a, b, s) for(int i = a; i < b; i += s)
#define FORD(i, a, b, s) for(int i = a; i > b; i -= s)
#define endl "\n"

ll INF = 2e18;
ll MOD = 1e9 + 7;
int i, j, k, t;

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

    if(D == 22) {
        cout << "Christmas Eve Eve Eve" << endl;
    } else if(D == 23) {
        cout << "Christmas Eve Eve" << endl;
    } else if(D == 24) {
        cout << "Christmas Eve" << endl;
    } else if(D == 25) {
        cout << "Christmas" << endl;
    }
}

Measured memory_bytes: 3624
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#pragma warning(disable:4996)
#include <stdio.h>
#include <string>
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <list>
#include <set>
#include <map>
#include <iomanip> 
#include <ctime>
#include <numeric>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

const int INF = 1001001001;
const int MAX = 3e6;
const double PI = 3.14159265358979323846;

const ll mod = 1e9 + 7;

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

int main(int argc, char *args[]) {
	int n;
	cin >> n;
	vector<int> w(n);
	for (int i = 0; i < n; i++) {
		cin >> w[i];
	}
	int s1, s2;
	s1 = 0;
	s2 = accumulate(w.begin(), w.end(), 0);
	int ans = abs(s1 - s2);
	for (int i = 0; i < n - 1; i++) {
		s1 += w[i];
		s2 -= w[i];
		ans = min(ans, abs(s1 - s2));
	}
	cout << ans << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;

double q, x;

int main(){
	while (cin >> q&&q != -1){
		x = q / 2;
		while (abs(pow(x, 3) - q) >= 0.00001*q){
			x = x - (pow(x, 3) - q) / (3 * x*x);
		}
		printf("%.10lf\n", x);
	}
}

Measured memory_bytes: 1232
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

int main() {
    int n, a, b;
    cin >> n >> a >> b;
    cout << min(a,b) << " " << max(0, a+b-n) << "\n";
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<string>
#define INF 1000000000ll
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<m; ++i)
#define FOR(i,n,m) for(long long i=n; i<m; ++i)
#define DUMP(n,a) for(long long dump=0; dump<n; ++dump) { cout<<a[dump]; if(dump!=n-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;
ll nck(ll n, ll k) {
	if(k==0||k==n) return 1;
	else return nck(n-1,k)+nck(n-1,k-1);
}
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,p;
	cin>>n>>p;
	vector<ll> a(n);
	REP(i,n) cin>>a[i];
	ll en=0,on=0;
	REP(i,n) {
		if(a[i]%2==0) en++;
		else on++;
	}
	if(p==0) {
		ll ret=0;
		for(ll i=0; i<=on; i+=2) {
			ret+=nck(on,i)*(1ll<<en);
		}
		cout<<ret<<endl;
	} else {
		ll ret=0;
		for(ll i=1; i<=on; i+=2) {
			ret+=nck(on,i)*(1ll<<en);
		}
		cout<<ret<<endl;
	}
}


Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let n = read::<usize>();
    let a = read_vec::<i64>();
    let mut snuke = 0;
    let mut arai = a.iter().sum::<i64>();

    let mut ans = std::i64::MAX;
    for i in 0..n - 1 {
        snuke += a[i];
        arai -= a[i];
        ans = min(ans, (snuke - arai).abs());
    }
    println!("{}", ans);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 10492
#pragma GCC optimize("Ofast") 
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(a) a.begin(),a.end()
#define lb lower_bound
#define ub upper_bound
#define owo ios_base::sync_with_stdio(0);cin.tie(0);
#define MOD (ll)(1e9+7)
#define INF (ll)(1e18)
#define debug(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
#define time__(d) for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false);\
debug("%s time : %.4fs\n", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> PII;
typedef pair<int,int> pii;
typedef vector<vector<int>> vii;
typedef vector<vector<ll>> VII;
int dx[2] = {-1,0};
int dy[2] = {0,-1};
int main()
{
  owo
	int h,w;
	cin>>h>>w;
	vector<string>grid(h);
	for(int i=0;i<h;i++)cin>>grid[i];
	VII dp(h,vector<ll>(w,0));
	auto ok = [&](int x,int y){return x>=0 && y>=0 && x<h && y<w;};
	dp[0][0] = 1;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if(grid[i][j] == '#')continue;
			for(int k=0;k<2;k++){
				int x = i+dx[k];
				int y = j+dy[k];
				if(ok(x,y) && grid[x][y] == '.'){
					dp[i][j]+=dp[x][y];
					dp[i][j]%=MOD;
				}
			}
		}
	}
	cout<<dp[h-1][w-1];
	
}

Measured memory_bytes: 12140
import sys
n = int(input())
l = list(map(int, input().split()))
d = {}
set_l = list(set(l))
if len(set_l)<3:
    print(0)
    sys.exit()
for i in set_l:
    d[i] = l.count(i)
set_l.sort()
ans = 0
for i in range(len(set_l)-2):
    for j in range(i+1, len(set_l)-1):
        for k in range(j+1, len(set_l)):
            if set_l[i]+set_l[j]>set_l[k] and set_l[i]+set_l[k]>set_l[j] and set_l[k]+set_l[j]>set_l[i]:
                ans += d[set_l[i]]*d[set_l[j]]*d[set_l[k]]
print(ans)

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

int main(){
    int A,B,H,M;
    cin >> A >> B >> H >> M;
    long double th,tm,ceta,ans;
    tm = M*(2*M_PI/60);
    th = (H*60+M)*(2*M_PI/720);
    ceta = abs(th-tm);
    ans = sqrt(A*A + B*B - 2 * A * B * cos(ceta)); 
    cout.precision(20);
    cout << ans << endl;
}

Measured memory_bytes: 4160
L = 9
T = L / 3

def check(line)
  co = Hash.new(0)
  line.each_with_index {|num, i| co[num] += 1}
  (0...L).select {|i| co[line[i]] > 1}
end

def square
  L.times {|i| yield(i % T, i / T)}
end

result = []

$<.gets.to_i.times do
  field = Array.new(L) {$<.gets.split.map(&:to_i)}
  marked = []
  
  field.each_with_index do |row, i|
    marked += check(row).map {|j| i * L + j}
  end
  L.times do |i|
    col = Array.new(L) {|j| field[j][i]}
    marked += check(col).map {|k| k * L + i}
  end
  square do |x, y|
    sx, sy = x * T, y * T
    block = Array.new(L) {|i| field[sy + i / T][sx + i % T]}
    marked += check(block).map {|i| (sy + i / T) * L + sx + i % T}
  end
  
  result << field.flatten.map.with_index do |num, i|
    str = (marked.include?(i) ? "*" : " ") + num.to_s
    str + ((i % L == L - 1) ? "\n" : "")
  end.join
end

puts result.join("\n")


Measured memory_bytes: 7008
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<int> vec;
typedef vector<vec> mat;
int main(){
    map<string,int> A;
    string s[200001];
    int n;
    cin>>n;
    rep(i,n) cin>>s[i],A[s[i]]++;
    set<string> B;
    int m=0;
    rep(i,n) m=max(m,A[s[i]]);
    rep(i,n) if(A[s[i]]==m) B.insert(s[i]);
    for(auto i:B) cout<<i<<endl;
}

Measured memory_bytes: 36096
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long a,b,c,d,ans;
    cin>>a>>b>>c>>d;
    ans=a*c;
    ans=max(a*d,ans);
    ans=max(b*c,ans);
    ans=max(b*d,ans);
    cout<<ans;
    return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int64_t N;
    cin >> N;
    int i;
    int B,size;
    int ans = 100000;
    int F = (int)floor(sqrt(N));

    for(i=1;i<=F;i++){
        if(N % i == 0){
            B = N / i;
            string B_string = to_string(B);
            size = B_string.size();
            ans = min(ans,size);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3740
import java.util.*;

public class Main {
    public static void main(String[] args) {
        List<String> list = new ArrayList<String>();
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int w = sc.nextInt();
        String li0 = "";
        for(int i = 0; i < w; i++){
            li0 += "#";
        }
        list.add(li0);
        
        for(int i = 0; i < h; i++){
            String s = sc.next();
            list.add(s);
        }
        list.add(li0);

        for(int i = 0; i < list.size(); i++){
            System.out.println("#" + list.get(i) + "#");
        }
    }    
}

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

int main() {
    int N;
    long long K;
    cin >> N >> K;
    vector<long long> A(N);
    for (int i = 0; i < N; ++i) cin >> A[i];
        
    long long res = 0;
    for (int d = 60; d >= -1; --d) { // d = -1 は X = K の場合
        if (d != -1 && !(K & (1LL<<d))) continue;
        
        long long tmp = 0;
        for (int e = 60; e >= 0; --e) {
            long long mask = 1LL<<e;
            int num = 0;
            for (int i = 0; i < N; ++i) if (A[i] & mask) ++num;
            
            if (e > d) {
                if (K & mask) tmp += mask * (N - num);
                else tmp += mask * num;
            }
            else if (e == d) {
                tmp += mask * num;
            }
            else {
                tmp += mask * max(num, N - num);
            }
        }
        res = max(res, tmp);
    }
    cout << res << endl;
}

Measured memory_bytes: 1024
package main

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

var sc = bufio.NewScanner(os.Stdin)

func init() {
	const maxWord = (1 << 30)
	buf := []byte{}
	sc.Buffer(buf, maxWord)
	sc.Split(bufio.ScanWords)
}

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

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func solve(n, k int, v []int) int {
	r := min(n, k)
	ans := 0
	for a := 0; a <= r; a++ {
		for b := 0; b <= r-a; b++ {
			selected := make([]int, 0, r)
			for i := 0; i < a; i++ {
				selected = append(selected, v[i])
			}
			for i := n - 1; i >= n-b; i-- {
				selected = append(selected, v[i])
			}

			sort.Ints(selected)
			limit := min(len(selected), k-(a+b))
			for i := 0; i < limit; i++ {
				if selected[i] >= 0 {
					break
				}
				selected[i] = 0
			}

			sum := 0
			for _, num := range selected {
				sum += num
			}
			ans = max(ans, sum)
		}
	}
	return ans
}

func main() {
	n, _ := strconv.Atoi(input())
	k, _ := strconv.Atoi(input())
	v := make([]int, n)
	for i := 0; i < n; i++ {
		v[i], _ = strconv.Atoi(input())
	}
	fmt.Println(solve(n, k, v))
}


Measured memory_bytes: 2400
'use strict';
(function(stdin) {
  var inputs = stdin.toString().split(' ').map(Number);
  var a = inputs[0];
  var b = inputs[1];
  var c = inputs[2];
  var count = 0;
  for (var i = a; i < b + 1;i++){
    if (c % i === 0){
      count++;
    }
  }
  console.log(count);
}(require('fs').readFileSync('/dev/stdin', 'utf8')));

Measured memory_bytes: 15664
//D
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int a[100010];
bool cmp (int p,int b)
{
	return p>b;
}
int main()
{
	int n;
	int x,y1,y2,y,mid;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	sort(a+1,a+1+n);//升序
	x=a[n];
	mid=x/2;
	y1=lower_bound(a+1,a+1+n,mid)-a;
	if(y1==n)
		y1=a[y1-1];
	else y1=a[y1];
	if(y1!=mid)
	{
		sort(a+1,a+1+n,cmp);//降序 
		y2=lower_bound(a+1,a+1+n,mid,greater<int>())-a;
		y2=a[y2];
	if((y1-1-mid)<(mid-y2))
		y=y1;
	else 
		y=y2;
	}
	if(y1==mid)
		y=y1;
	cout<<x<<" "<<y<<endl;
}

Measured memory_bytes: 640