akhauriyash/Code-Regression huggingface dataset:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

H, W = MAP()
N = INT()
a = LIST()[::-1]

ans = [[0]*W for _ in range(H)]
tmp = a.pop()
color = 1
cnt = 0
for i in range(H):
    for j in range(W):
        if i%2:
            j = W-j-1
        ans[i][j] = color
        cnt += 1
        if cnt == tmp and a:
            cnt = 0
            tmp = a.pop()
            color += 1

for i in ans:
    print(" ".join([str(x) for x in i]))


Measured memory_bytes: 10744
#include <iostream>
#include <unordered_map>
#include <cstring>
#include <string>
#include <vector>

using namespace std;

int main() {
  const int MAX = 300000;
  int H, W, M; 
  cin >> H >> W >> M;
  int h[MAX], w[MAX] = {0};
  for (int i = 0; i < M; i++) {
    cin >> h[i] >> w[i];
    h[i]--;
    w[i]--;
  }

  // Create unordered map to reference the existence of a bomb later
  // The key cannot be pair as long as I don't implement a has function for pair
  unordered_map<string, int> map;

  int rows[MAX], cols[MAX] = {0};

  int row_best_count = 0;
  int col_best_count = 0;

  for (int i = 0; i < M; i++) {
    string key = to_string(h[i]) + ',' + to_string(w[i]);
    map[key] = 1;

    rows[h[i]]++;
    cols[w[i]]++;

    row_best_count = max(row_best_count, rows[h[i]]);
    col_best_count = max(col_best_count, cols[w[i]]);
  }

  vector<int> best_rows;
  vector<int> best_cols;

  for (int i = 0; i < H; i++) {
    if (rows[i] == row_best_count) {
      best_rows.push_back(i);
    }
  }

  for (int i = 0; i < W; i++) {
    if (cols[i] == col_best_count) {
      best_cols.push_back(i);
    }
  }

  int ans = row_best_count + col_best_count - 1;
  for (int r : best_rows) {
    bool break_signal = false;
    for (int c : best_cols) {
      string key = to_string(r) + ',' + to_string(c);
      if (!map[key]) {
        ans = row_best_count + col_best_count;
        break_signal = true;
        break;
      }
    }

    if (break_signal) break;
  }

  cout << ans << endl;
}

Measured memory_bytes: 35016
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repe(i,n) for (int i = 0; i <= (n); ++i)
#define repe1(i,n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
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 (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
const int INF = 1e9;
const ll mod = 1000000007;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a * b / gcd(a, b);}

ll pow_kai(ll a, ll n) {
    ll x = 1;
    while(n > 0) {
        if(n&1) {
            x = x*a;
        }
        a = a*a;
        n >>= 1;
    }
    return x;
}
 
int main() {
    int n;
    ll a;
    vector<ll> A;
    cin >> n;
    set<ll> B;
    rep(i,n) {
        cin >> a;
        A.pb(a);
        B.insert(a);
    }
    if (A.size() == B.size()) {
        cout << "YES" << "\n";
    } else {
        cout << "NO" << "\n";
    }
}

Measured memory_bytes: 11120
#include <iostream>
using namespace std;
int main() {
  int N;
  cin >> N;
  
  if (N>=64) cout << 64 << endl;
  
  if (N>=32 && N<64) cout << 32 << endl;
  
  if (N>=16 && N<32) cout << 16 << endl;
  
  if (N>=8 && N<16) cout << 8 <<endl;
  
  if (N>=4 && N<8) cout << 4 << endl;
  
  if (N>=2 && N<4) cout << 2 <<endl;
  
  if (N==1) cout << 1 << endl;
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin >> N;
    double X[N],Y[N];
    double totalDist=0;
    for(int i=0; i<N; i++){
        cin >> X[i] >> Y[i];
        for(int j=0; j<i;j++){
            totalDist += sqrt(pow(X[i]-X[j],2)+pow(Y[i]-Y[j],2));
        }
    }
    totalDist*=2.0/(double)N;
    printf("%.6lf",totalDist);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using  namespace std;
signed main(){
  string s,c="keyence";
  int a,b=0;
  cin>>s;
  for(int i=0;i<s.size();i++){
    if(s[i]!=c[i]){
      a=i;
      break;
    }
  }
  for(int i=s.size();i>=0;i--){
    b++;
    if(s[i-1]!=c[c.size()-b]){
      b--;
      break;
    }
  }
  if(a+b>=c.size()||a==c.size()||b==c.size()||a+1==c.size()&&s.size()==c.size()) cout<<"YES\n";
  else cout<<"NO\n";
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int a,b,c,count=0;
    cin >> a;
    cin >> b;
    cin >> c;
    for(int i=a;i<=b;i++){
        if (c%i==0)
            count++;
    }
    cout << count<< endl;
    return 0;
}



Measured memory_bytes: 3104
#include<iostream>
#define MAX 10000
using namespace std;
int b_sort(int x[], int n){
	int count=0, temp;
		for(int i=0; i<n-1; i++){
			for(int j=n-1; j>i; j--){
				if(x[j-1] > x[j]){
					temp = x[j];
					x[j] = x[j-1];
					x[j-1] = temp;
					count++;
				}
			}
		}
	return count;
}

int main(){
	int x[MAX], n, p;
	while(1){
		cin >> n;
		if(n == 0) return 0;
		for(int i=0; i<n; i++) x[i]=0;
		for(int i=0; i<n; i++){
			cin >> p;
			x[i] = p;
		}
		cout << b_sort(x,n) << endl;
	}
}

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

using namespace std;

typedef long long LL;
typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

int N,M;

int main(){
	cin >> N >> M;
	cout << ((100*N+1800*M)<<M) << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
/************************************************/
#define rep(i,n) for(int i=0;i<n;i++)
#define m_p make_pair
#define pb push_back
#define fr first
#define se second
#define forn(i,a,n) for(int i=a;i<n;i++)
#define foreach(i,c) for(__typeof(c.begin())i=(c.begin());i!=(c).end();i++)
#define pii pair<int,int>
#define vi vector<int>
#define ll long long
#define sz(s) s.size()
#define all(s) s.begin(),s.end()
#define zero(x) memset(x,0,sizeof(x))
#define vii vector<pair<int,int> >
#define mpis map<int,string>
#define mpii map<int,int>
#define mpsi map<string,int>
#define re return
#define mod 1000000007
/************************************************/
using namespace std;

long long get(){
	char c=getchar();
	long long x=0LL;
	while(c<'0'||c>'9')
	c=getchar();
	while(c>='0'&&c<='9'){
		x*=10LL;
		x+=(c-'0');
		c=getchar();
	}
	return x;
}
int n,ww;
int w[101];
int v[101];
ll dp[100001];
int main(){
	ios::sync_with_stdio(0);
	cin>>n>>ww;
	rep(i,n)
	cin>>w[i]>>v[i];
	zero(dp);
	rep(i,n)
	for(int j=ww;j>=w[i];j--){
		dp[j]=max(dp[j],dp[j-w[i]]+v[i]);
	}
    cout<<dp[ww];
	re 0;
}

Measured memory_bytes: 1024
/*
	Copyright: razouq (c)
	Author: Anass BENDARSI
	Date: 20-Apr-20 3:50:56 AM
	flamers will **** you
*/
//#include<flamers.h>

#include "bits/stdc++.h"
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#define ll long long
#define ull unsigned long long
#define F first
#define S second
#define PB push_back
#define POB pop_back

using namespace std;

int main(){
//	freopen("input.in", "r", stdin);
//	freopen("output.out", "w", stdout);
	ios::sync_with_stdio(0);
	cin.tie();
	double pi = 3.1415;
	int r;
	cin>>r;
	cout<<2*r*pi<<endl;
	return 0;
}


Measured memory_bytes: 3808
// Try AtCoder
// author: Leonardone @ NEETSDKASU

let time t s f =
    if t < s then
        s
    elif t % f = 0 then
        t
    else
        t + f - (t % f)

let rec calc t xs =
    match xs with
    | []    -> t
    | [|c; s; f|]::xs ->
        let u = time t s f
        calc (u + c) xs

let rec solve n xs =
    match xs with
    | [] -> []
    | [|c; s; _|]::xs ->
        calc (c + s) xs :: solve n xs

[<EntryPoint>]
let main _ =
    let n = int <| stdin.ReadLine()
    let xs =
        seq { 1 .. n - 1 }
        |> Seq.map (fun _ ->
            stdin.ReadLine().Split(' ')
            |> Array.map int
            )
        |> Seq.toList
    solve n xs
    |> Seq.iter (fun x -> printfn "%A" x)
    printfn "0"
    0



Measured memory_bytes: 18268
#include <stdio.h>
#include <string.h>
#define MAX 16

int path[MAX][MAX],holl[MAX][MAX];
int a,b;

int solve(void){
	int i,j,m,n;
	for(i=0;i<a;i++){
		for(j=0;j<b;j++){
			if(holl[i][j]){
				path[i][j] = 0;
				continue;
			}else if(!i && !j){
				path[i][j] = 1;
			}else{
				int x = 0;
				if(i)x += path[i-1][j];
				if(j)x += path[i][j-1];
				path[i][j] = x;
			}
		}
	}
	return printf("%d\n",path[a-1][b-1]);
}

int main(void){
	int m;
	int i;
	while(scanf("%d%d",&a,&b),a||b){
		scanf("%d",&m);
		memset(holl,0,sizeof 
			holl);
		for(i=0;i<m;i++){
			int A,B;
			scanf("%d%d",&A,&B);
			holl[A-1][B-1]=1;
		}
		solve();
	}
	return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <tuple>
#include <cstdio>
#include <cassert>
#include <functional>
#define _LIBCPP_DEBUG 0
using namespace std;

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

    int minimum=200001,count=0;
    for (int i = 0; i < n; i++)
    {
        int p;
        cin >> p;
        if (p<=minimum)
        {
            minimum=p;
            count++;
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 3628
#include<stdio.h>
main(){
  int N;
  int i, j, k, v;
  int A[1000];
  scanf("%d", &N);
  for(i = 0; i < N; i++){
    scanf("%d", &A[i]);
    if(i == N-1){
      printf("%d", A[i]);
    }
    else printf("%d ", A[i]);
  }
  printf("\n");
  for(i = 1; i < N; i++){
    v = A[i];
    j = i-1;
    while(j >= 0 && A[j] > v){
      A[j+1] = A[j];
      j--;
      A[j+1] = v;
    }
    for(k = 0; k < N; k++){
      if(k == N-1){
	printf("%d", A[k]);
      }
      else printf("%d ", A[k]);
    }
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 604
import java.util.Scanner;

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

        if (a < b) {
            System.out.println("a < b");
        } else if (a > b) {
            System.out.println("a > b");
        } else if (a == b){
            System.out.println("a == b");
        }
    }
}

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

namespace HABIT{
    #define f(a,b,c,d) for(register int a=b,c=d;a<=c;a++)
    #define g(a,b,c,d) for(register int a=b,c=d;a>=c;a--)
    #define LOCAL
    typedef int i32;
    typedef unsigned int u32;
    typedef long long int i64;
    typedef unsigned long long int u64;
    typedef pair<i32,i32> pii;
    const i32 MAXN=1024;
    typedef i32 ar[MAXN];
    
    template<typename T> inline T Max(T a) { return a; }
    template<typename T,typename... Args> inline T Max(T a,Args... args){
        T b=Max(args...);
        return (a>b)?a:b;
    }
    template<typename T> inline T Min(T a) { return a; }
    template<typename T,typename... Args> inline T Min(T a,Args... args){
        T b=Min(args...);
        return (a<b)?a:b;
    }

    #ifdef LOCAL
        inline char gc() { return getchar(); }
    #else
        inline char gc() {
            static char s[1<<20|1]={0},*p1=s,*p2=s;
            return (p1==p2)&&(p2=(p1=s)+fread(s,1,1<<20,stdin),p1==p2)?EOF:*(p1++);
        }
    #endif
    inline i64 read(){
        register i64 ans=0;register char c=gc();register bool neg=0;
        while(c<48||c>57) neg^=!(c^'-'),c=gc();
        while(c>=48&&c<=57) ans=(ans<<3)+(ans<<1)+(c^48),c=gc();
        return neg?-ans:ans;
    }

    char Output_Ans[1<<20|1],*Output_Cur=Output_Ans;
    inline void output() { Output_Cur-=fwrite(Output_Ans,1,Output_Cur-Output_Ans,stdout); }
    inline void print(char c){
        if(Output_Cur-Output_Ans+1>>20) output();
        *(Output_Cur++)=c;
    }
    inline void print(char *s) { while(*s) print( *(s++) ); }
    inline void print(u64 x){
        if(!x) { print('0'); return ; }
        char buf[30]={0},*p=buf+28;
        while(x) *(p--)=x%10+48,x/=10;
        print(p+1);
    }
    inline void print(u32 x) { print( (u64)x ); }
    inline void print(i64 x){
        if(x<0) print('-'),x=-x;
        print( (u64)x );
    }
    inline void print(i32 x){
        if(x<0) print('-'),x=-x;
        print( (u64)x );
    }
}
using namespace HABIT;

int main(){
    i32 N=read(),K=read(),Vis[128]={0},Cnt=0;
    f(i,1,I,K)
        f(j,1,J,read())
            Vis[read()]++;
    f(i,1,I,N) Cnt+=(Vis[i]==0);
    print(Cnt);
    output();
    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <math.h>

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

using namespace std;

int main(){
	int d, n, ans;
	cin >> d >> n;
	ans = pow(100,d)*n;
	if (n==100) ans += pow(100,d);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define ALL(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int,int>;
using vi = vector<int>;
using vs = vector<string>;
using vll = vector<long long>;
using vpii = vector<pair<int,int>>;
using vivi = vector<vector<int>>;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const int mod = 10000007;
const int inf = 1001001001;



int main(void) {
  double n,k;
  cin >> n >> k;
  double sum = 0;
  rep2(i,1,n+1){
    if(i>=k) break;
    double two = 1;
    int p = i;
    while(p<k){
      two*=2;
      p*=2;
    }
    sum += (two-1)/two;
  }
  cout << fixed << setprecision(10) << 1-sum/n << endl;
}


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

fn main() {
    let n: usize = read();
    let mut b: Vec<usize> = (0..n).map(|_| read()).collect();

    let mut ans: Vec<usize> = Vec::new();
    while !b.is_empty() {
        let mut found = false;
        for i in (0..b.len()).rev() {
            if b[i] == i+1 {
                b.remove(i);
                ans.push(i+1);
                found = true;
                break;
            }
        }
        if !found {
            println!("-1");
            return;
        }
    }

    for i in ans.iter().rev() {
        println!("{}", i);
    }
}

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


Measured memory_bytes: 4352
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cout << #x << " = " << (x) << endl;
using Graph = vector<vector<int> >;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
#define int long long

void solve() {
	int n, we; cin >> n >> we;
    vector<int> w(n), v(n);
    rep(i, n) {
        cin >> w[i] >> v[i];
    }
    vector<vector<int>> dp(n + 1, vector<int>(2e+5, INF));
    dp[0][0] = 0;
    rep(i, n) {
        for(int j = 0; j <= 1e+5; ++j) {
            if(j - v[i] < 0) dp[i + 1][j] = dp[i][j];
            else dp[i + 1][j] = min(dp[i][j], dp[i][j - v[i]] + w[i]);
        }
    }
    int ans = 0;
    for(int j = 0; j <= 1e+5; ++j) {
        if(dp[n][j] <= we) ans = j;
    }
    cout << ans << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init();
	solve();
	//cout << "finish" << endl;
    return 0;
}

Measured memory_bytes: 159744
n, m = map(int, input().split())
h = list(map(int, input().split()))
g = [[] for _ in range(n)]
for _ in range(m):
    a, b = map(lambda x: int(x)-1, input().split())
    g[a].append(b)
    g[b].append(a)
ans = 0
for v in range(n):
    flag = False
    for nv in g[v]:
        if h[v] <= h[nv]:
            flag = True
            break
    if not flag: ans += 1
print(ans)


Measured memory_bytes: 29508
n = gets.to_i

s = gets.chars
max = 0

(1...(s.size)).each do |i| 
  a, b = s[0...i].uniq, s[i..(s.size)].uniq
  
  count =  (a + b).count - (a - b).count - (b - a).count
  count /= 2
  max = [count, max].max
end

puts max

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
int main (){
  int i,n;
  cin>>n;
  vector<int>x(n);
  vector<int> p(n);
  vector<int> q(n);
  for(i=0;i<n;i++)x[i]=i+1;
  for(i=0;i<n;i++)cin>>p[i];
  for(i=0;i<n;i++)cin>>q[i];
  int pcnt = -1, qcnt = -1, cnt = 0;
  do {
    if(p == x) pcnt = cnt;
    if(q == x) qcnt = cnt;
    if(pcnt != -1 && qcnt != -1) break;
    cnt++;
  }while(next_permutation(x.begin(),x.end()));
  cout<<abs(pcnt-qcnt)<<endl;
  return 0;
}

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

int main(){
    int n, d, x, a, i, s = 0;
    cin >> n >> d >> x;
    for(i=0; i<n; i++){
        cin >> a;
        s += (d-1)/a + 1;
    }
    cout << s+x;
    return 0;
}

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

int main(){
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i,n) cin >> a[i];
	int maxim = 0;
	int minimum = 1e9;
	rep(i,n){
		maxim = max(maxim,a[i]);
		minimum = min(minimum,a[i]);
	}
	cout << maxim - minimum << endl;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> x(n), y(n);
  rep(i, n) cin >> x[i] >> y[i];
  vector<int> idx(n);
  iota(idx.begin(), idx.end(), 0);
  int fac = 1;
  for (int i = 2; i <= n; i++)
    fac *= i;
  double ans = 0;
  do {
    double res = 0;;
    rep(i, n-1) {
      int dix = x[idx[i+1]]-x[idx[i]];
      int diy = y[idx[i+1]]-y[idx[i]];
      res += sqrt(dix*dix+diy*diy);
    }
    res /= fac;
    ans += res;
  } while (next_permutation(idx.begin(), idx.end()));
  cout << fixed << setprecision(9) << ans << endl;
  return 0;
}

Measured memory_bytes: 3872
#include <iostream>
#include <string>

using namespace std;

int ans;
string a, b;

int main()
{
    cin >> a >> b;

    if(a[0] != b[0])
        ans++;

    if(a[1] != b[1])
        ans++;

    if(a[2] != b[2])
        ans++;

    cout << 3 - ans << '\n';
    return 0;
}


Measured memory_bytes: 256
n=int(input())
p=[int(i) for i in input().split()]
answer=0
for i in range(1,n-1):
    if p[i]!=min([p[i],p[i-1],p[i+1]]) and p[i]!=max([p[i],p[i-1],p[i+1]]):
        answer+=1
print(answer)

Measured memory_bytes: 38256
XY = list(map(int, input().split()))
 
c = 2 * XY[0] - XY[1] / 2
t = - XY[0] + XY[1] / 2
 
if not (XY[1] / 2).is_integer():
  print('No')
elif c == 0 and t == 0:
  print('No')
elif c >= 0 and t >= 0:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 9188
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define INF 1000000000
#define MOD 1000000007
#define EPS 0.00000001

int f(int a){
    if(a%2) return 3*a+1;
    return a/2;
}


int main(){
    int s; cin >> s;
    map<int, int> M;
    int now = s;
    for(int i=0; i<1000000; i++){
        if(M[now]==1){
            cout << i+1 << endl;
            return 0;
        }
        M[now]++;
        now = f(now);
    }
    
    
}


Measured memory_bytes: 256
n, d = gets.chomp.split.map(&:to_i)
x = Array.new(n)
(0..(n-1)).each do |i|
  x[i] = gets.chomp.split.map(&:to_i)
end
sum = 0
cnt = 0

(0..(n-1)).each do |i|
	((i+1)..(n-1)).each do |j|
      sum = 0
      (0..(d-1)).each do |k|
        sum += (x[i][k] - x[j][k]).abs ** 2
      end
      cnt += 1 if (sum ** (1/2.0)) == (sum ** (1/2.0)).ceil
	end
end
puts cnt

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b;
  cin >> a >> b;
  if(a%2 == 0 || b%2 == 0){
    cout << "Even" << endl;
  } else {
    cout << "Odd" << endl;
  }
  // ここにプログラムを追記
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
typedef pair<int, pair<int, int>> PP;
const double PI = 3.1415926535897932;   // acos(-1)
const double EPS = 1e-15;
const int INF = 1001001001;
const int mod = 1e+9 + 7;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define chadd(x, y) x = (x + y) % mod

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

    int n, k;
    cin >> n >> k;
    vector<vector<ll>> input(n);
    for(int i = 0; i < n; ++i){
        int t;
        ll d;
        cin >> t >> d;
        input[--t].push_back(d);
    }
    for(int i = 0; i < n; ++i)  sort(input[i].begin(), input[i].end(), greater<ll>());
    vector<vector<ll>> info(2);
    for(int i = 0; i < n; ++i){
        int sz = input[i].size();
        if(sz == 0) continue;
        info[1].push_back(input[i][0]);
        for(int j = 1; j < sz; ++j) info[0].push_back(input[i][j]);
    }
    sort(info[0].begin(), info[0].end(), greater<ll>());
    sort(info[1].begin(), info[1].end(), greater<ll>());
    int sz0 = info[0].size(), sz1 = info[1].size();
    vector<ll> sum0(sz0 + 1, 0);
    vector<ll> sum1(sz1 + 1, 0);
    for(int i = 0; i < sz0; ++i)    sum0[i+1] = sum0[i] + info[0][i];
    for(int i = 0; i < sz1; ++i)    sum1[i+1] = sum1[i] + info[1][i];
    int limit = min(k, sz1);
    ll res = 0;
    for(int i = 1; i <= limit; ++i){
        if(k - i >= 0 && k - i <= sz0){
            chmax(res, sum0[k - i] + sum1[i] + (ll)i * i);
        }
    }
    cout << res << endl;
}

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

int main() {
  int a, b, c, k;
  cin >> a >> b >> c >> k;
  int cnt = 0;
  while (a >= b) {
    b *= 2;
    ++cnt;
  }
  while (b >= c) {
    c *= 2;
    ++cnt;
  }
  if (cnt <= k) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3560
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long int H,W;
  cin >> H >> W;
  
  if(H != 1 && W != 1){
  	if((H*W % 2) == 0){
    cout << H*W/2 << endl;
 	 }
  	else{
    cout << H*W/2 + 1 << endl;
    }
  }   
  else{
    cout << 1 << endl;
  }
  
}


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

int main(){
    int h,m,s,str;
    //cout<<"please input 2 numbers.\n"<<endl;
    cin >>str;
    s=str%60;
    str=(str-s)/60;
    m=str%60;
    h=(str-m)/60;
    cout<<h<<":"<<m<<":"<<s<<endl;
    return 0;
}


Measured memory_bytes: 3076
n, m = map(int, input().split())

l = [0]*(n + 1)
ac = 0
wa = 0

for i in range(m):
    p, s = input().split()
    p = int(p)
    if l[p] != -1:
        if s == "AC":
            ac += 1
            wa += l[p]
            l[p] = -1
        else:
            l[p] += 1

print(ac, wa)


Measured memory_bytes: 3956
n = int(input())
s = list(int(input()) for _ in range(n))
ans = sum(s)
flag = float('inf')
for i in range(n):
    if s[i] % 10 != 0:
        flag = min(flag,s[i])
if ans % 10 == 0:
    if flag != float('inf'):
        print(ans - flag)
    else:
        print(0)
else:
    print(ans)

Measured memory_bytes: 9124
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define all(c) begin(c),end(c)
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;
//最大公約数
ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}
//最小公倍数
ll lcm(ll x, ll y) {
  return x/gcd(x, y)*y;
}
//素因数分解
vector<pair<ll,int>> factorize(ll n) {
  vector<pair<ll,int>> res;
  for (ll i = 2; i*i <= n; ++i) {
    if (n%i) continue;
    res.emplace_back(i,0);
    while (n%i == 0) {
      n /= i;
      res.back().second++;
    }
  }
  if (n != 1) res.emplace_back(n,1);
  return res;
}
 
 
 ll mod=100000007;
 
int main() {
  int n;
  cin>>n;
  int l[n];
  rep(i,n){
    cin>>l[i];
  }
  int ans=0;
  sort(l,l+n);

  rep(i,n-2){
    for(int j=i+1;j<n-1;j++){
      for(int k=j+1;k<n;k++){
        int a=l[i],b=l[j],c=l[k];
        int ab=a+b;
        int ab_=b-a;
        if(ab>c&&ab_<c){
          if(a!=b&&b!=c&&c!=a){
            ans++;
            //cout<<a<<b<<c<<endl;
          }
          
        }
      }
    }
  }
  cout<<ans;
  
}

Measured memory_bytes: 3624
a,b,k=map(int, input().split())

x = list()
for i in range(a, a+min([k,b+1-a])):
  #print(i)
  x.append(i)
#print('---')
for i in range(b-min([k,b+1-a])+1, b+1):
  #print(i)
  x.append(i)
#print('---')

for xx in sorted(set(x)):
  print(xx)


Measured memory_bytes: 3060
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

#define rep(i, n) for(int i=0;i<n;i++)

typedef int long long ll;
using namespace std;
typedef pair<int, int> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;
static const int MAX = 100;
static const int INF = (1 << 23);

int main() {

    cout<<setprecision(16);
    double a,b,c;
    cin>>a>>b>>c;
    double tei = a*a;
    double tai = a*a*b;

    double l = 0;
    double r = 90;

    int i =0;
    double med3;
    while(i<1000000){
        i++;

        med3 = (l+r)/2;
        double med = (med3/180)*M_PI;
        double med4  = 90- med3;
        double med2 = (med4/180)*M_PI;

         double san;

         if(tan(med2)*b>a){

             double newb = a *tan(med);
             //cout<<newb<<endl;
             san = tai-(a*newb/2)*a;

         }else{
             san = (b*b*tan(med2)/2)*a;
         }

        // cout<<med3<<" "<<san<<endl;



        if(san==c){
            cout<<med3<<endl;
            return 0;
        }else if(san>c){
             l = med3;
        }else {
            r = med3;
        }
    }


    cout<<med3<<endl;




    return 0;
}


Measured memory_bytes: 256
def gcd(a,b):
    if a < b:
        a,b = b,a
    if b == 0:
        return a
    if a%b == 0:
        return b
    return gcd(b, a%b)
N = int(input())
a = list(map(int,input().split()))
g1=[0 for i in range(N)]
g2=[0 for i in range(N)]
g1[0]=a[0]
g2[N-1]=a[N-1]
for i in range(1,N):
  g1[i]=gcd(g1[i-1],a[i])
for i in range(N-2,-1,-1):
  g2[i]=gcd(g2[i+1],a[i])
ans=1
for i in range(N-2):
  a=gcd(g1[i],g2[i+2])
  ans=max(ans,a)
ans=max(ans,g1[N-2],g2[1])
print(ans)

Measured memory_bytes: 14436
#include<stdio.h>
int n,i,j,C[150];
char S[2][9],t,o[5]="mcxi";
int main()
{
	C[109]=0;C[99]=1;C[120]=2;C[105]=3;
	for(scanf("%d",&n);n--;)
	{
		int N[4]={0};
		scanf("%s%s",S[0],S[1]);
		for(j=0;j<2;j++)
			for(i=0;S[j][i];i++)
			{
				if('1'<S[j][i]&&S[j][i]<='9')
					t=S[j][i];
				else
				{
					N[C[S[j][i]]]+=t==0?1:t-'0';
					t=0;
				}
			}
		for(i=3;i>=0;i--)
			if(N[i]>=10)
			{
				N[i-1]++;
				N[i]-=10;
			}
		for(i=0;i<4;i++)
			if(N[i]!=0)
			{
				if(N[i]>1)printf("%d",N[i]);
				printf("%c",o[i]);
			}
		puts("");
	}
	return 0;
}

Measured memory_bytes: 616
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n;i>=0;i--)
#define MAX 5002
#define B 100
#define dpb push_back
#define fi first
#define se second
typedef pair<int, int> P;
typedef long long ll;
const int inf = 1e9;
const ll INF = 1e18;

int x[3] = {1, 5, 10};
int main(){
	int n, ans = 0, y;
	scanf("%d%d", &n, &y);
	ll num = 0, a, b, c = 0, f = 1;
	for(int i = 0;i <= n;i++){
		a = i;
		for(int j = 0;j <= n-a;j++){
			b = j;
			if(i*10000+j*5000+(n-(i+j))*1000 == y){
				f = 0;
				c = n-(i+j);
				break;
			}
		}
		if(f == 0)break;
	}
	if(f == 0){
		printf("%lld %lld %lld\n", a, b, c);
	}else{
		printf("-1 -1 -1\n");
	}
	return 0;
}





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

using namespace std;
typedef long long ll;
ll prefix[200009];
int main() {
  int n;cin>>n;
  ll sum=0;
  for(int i=1;i<=n;i++){
      int x;
      cin>>x;
      sum+=x;
      prefix[i]=x+prefix[i-1];
  }
  ll ans=3020202020;
  
   for(ll i=1;i<n;i++){
       ll l=prefix[i];
       ll r=sum-prefix[i];
      ans=min(abs(l-r),ans);
  }
  cout<<ans;
}

Measured memory_bytes: 5196
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>

#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define vi vector<int>
#define VS vector<string>
#define all(x) x.begin(),x.end()
#define mp make_pair
#define pb push_back

using namespace std;

int main(){
    map<string, vector<int> > m;
    string s; int p;
    while(cin >> s >> p){
        m[s].push_back(p);
    }
    map<string, vector<int> >::iterator it = m.begin();
    while( it != m.end() ){
        cout << (*it).first << endl;
        sort(all((*it).second));
        for(int i=0; i < (*it).second.size(); i++){
            if(i != 0) cout << " " << (*it).second[i];
            else cout << (*it).second[i];
        }
        cout << endl;
        ++it;
    }
}

Measured memory_bytes: 1244
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
int main()
{
    int n;
    string s;
    cin >> n >> s;
    int ans = 0;
    for(int i = 0;i < 1000;i++)
    {
        int c[3] = {i / 100,(i / 10) % 10,i % 10};
        int count = 0;
        for(int j = 0;j < s.size();j++)
        {
            if(s[j] == ('0' + c[count]))
            {
                count++;
            }
            if(count == 3)
            {
                break;
            }
        }
        if(count == 3)
        {
            ans++;
        }
    }
    cout << ans << "\n";
    
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

class CPU{
    int time;
    String name;
}

public class Main {
    public static void main(String[] Args){
        Scanner sc = new Scanner(System.in);
        Queue<CPU> que = new LinkedList<>();
        int n = sc.nextInt();
        CPU[] cc = new CPU[n];
        int q = sc.nextInt();
        sc.nextLine();
        for(int i=0;i<n;i++){
            String[] tt = sc.nextLine().split(" ");
            cc[i] = new CPU();
            cc[i].name = tt[0];
            cc[i].time = Integer.parseInt(tt[1]);
            que.add(cc[i]);
        }
        int tot=0;
        while(!que.isEmpty()){
            CPU now = que.poll();//返回第一个元素，并删除
            if(now.time > q){
                now.time -= q;
                que.add(now);
                tot += q;
            }
            else{
                tot += now.time;
                System.out.println(now.name + " " + tot);
            }
        }
    }

}



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

using namespace std;

int main() {
    size_t n, m;
    long long c;
    cin >> n >> m >> c;
    vector<long long> b(m);
    for (size_t i = 0; i < m; ++i) cin >> b[i];
    size_t num_right = 0;
    for (size_t i = 0; i < n; ++i) {
        long long sum = c;
        for (size_t j = 0; j < m; ++j) {
            long long a;
            cin >> a;
            sum += a * b[j];
        }
        if (sum > 0) ++num_right;
    }
    cout << num_right << endl;
    return EXIT_SUCCESS;
}

Measured memory_bytes: 256
/*There's a possibility*/
/*but stop sucking first*/
#define dbg(...) ; 
#define db(...) ; 
#include "bits/stdc++.h"
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define f(i,a,b) for(i=a;i<b;i++)
#define fr(i,a,b) for(i=a;i>=b;i--)
#define endl '\n'
#define tst cout<<'*';
#define ll long long int
#define ff first
#define ss second
#define pb push_back
#define pf push_front
using namespace std;

int h[100005],dp[100005],k;

int fun(int i)
{
    if(dp[i]!=-1)
        return dp[i];
    if(i==0)
        return dp[i]=0;
    int j;
    dp[i]=abs(h[i]-h[i-1])+fun(i-1);
    f(j,2,k+1)
        if(i-j>=0)
            dp[i]=min(dp[i],abs(h[i]-h[i-j])+fun(i-j));
    return dp[i];
}

int main()
{
    fast;
    int n,i;
    cin>>n>>k;
    f(i,0,n)
        cin>>h[i];
    memset(dp,-1,sizeof(dp));
    cout<<fun(n-1);
}

Measured memory_bytes: 10676
#include<bits/stdc++.h>
//g++ -std=c++11 

using namespace std;
typedef long long ll;

#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define DIV 1000000007 //10^9+7

ll N;
ll A[100005];
ll B[100005];

int main(){
	cin >> N;
	rep(i, N)  cin >> A[i];

	for(ll i = 1; i < N; i++) {
		B[i] = (A[i-1] - B[i-1]/2) * 2;
	}

	ll rest = A[N-1] - B[N-1]/2;
	rep(i, N) {
		if(i%2 == 0) {
			cout << B[i] + rest;
		} else {
			cout << B[i] - rest;
		}

		if(i != N - 1) {
			cout << " ";
		} else {
			cout << endl;
		}
	}

}


Measured memory_bytes: 5192
#include <iostream>
#include <utility>
#include <string>
#include <vector>
#include <cmath>
using namespace std;

int H,W,Q,D;
int A[301][301];
int L[100001],R[100001];
int S[90001] = {0};
vector<pair<int,int>> v(90001);

int main(){
	cin >> H >> W >> D;
	for(int i=1;i<=H;i++){
		for(int j=1;j<=W;j++){
			cin >> A[i][j];
			v[A[i][j]] = make_pair(i,j);
		}
	}
	cin >> Q;
	for(int i=0;i<D;i++){
		int j=0;
		while(i+j+D<=H*W){
			pair<int,int> s = v[i+j];
			pair<int,int> t = v[i+j+D];
			S[i+j+D] += S[i+j]+abs(s.first-t.first)+abs(s.second-t.second);
			j += D;
		}
	}
	for(int i=1;i<=Q;i++){
		cin >> L[i] >> R[i];
		//int ans = 0;
		/*while(L[i]!=R[i]){
			pair<int,int> s = v[L[i]];
			pair<int,int> t = v[L[i]+D];
			ans += abs(s.first-t.first)+abs(s.second-t.second);
			L[i] += D;
		}*/
		cout << S[R[i]]-S[L[i]] << endl;
	}
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(long long i = 0;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define Sort(v, n) sort(v, v+n);
#define VSort(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define cY cout<<"Yes";
#define cN cout<<"No";
#define cA(a) cout<<a;
const ll MOD = 1000000007;



int main() {
    int a,p;cin>>a>>p;
    int kakera = a*3 + p;
    cout << kakera/2;
}

Measured memory_bytes: 256
import sys
import math
import string
import fractions
import random
from operator import itemgetter
import itertools
from collections import deque
import copy
import heapq
from bisect import bisect, bisect_left, bisect_right

MOD = 10 ** 9 + 7
INF = float('inf')
input = lambda: sys.stdin.readline().strip()

sys.setrecursionlimit(10 ** 8)

L = int(input())
ans = 0
print((L/3)**3)

Measured memory_bytes: 6696
#include <iostream>

long long mod_pow(long long x, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) {
      res = res * x % mod;
    }
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}

long long mod_inverse(long long x, long long mod) {
  return mod_pow(x, mod - 2, mod);
}

// return nCk % mod
// it takes O(k)
long long mod_comb(long long n, long long k, long long mod) {
  long long numer = 1, denom = 1;
  for (long long i = 0; i < k; i++) {
    numer = numer * ((n - i) % mod) % mod;
    denom = denom * ((i + 1) % mod) % mod;
  }
  return numer * mod_inverse(denom, mod) % mod;
}

int main() {
  const int mod = 1000000007;
  int X, Y;
  std::cin >> X >> Y;

  int t1 = 2 * Y - X, t2 = 2 * X - Y;
  if (t1 % 3 != 0 || t2 % 3 != 0) {
    std::cout << 0 << "\n";
    return 0;
  }

  int a = t1 / 3, b = t2 / 3;
  if (a < 0 || b < 0) {
    std::cout << 0 << "\n";
    return 0;
  }

  std::cout << mod_comb(a + b, a, mod) << "\n";

  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>

int main()
{
    int a, b, c, d, e, f;
    while (scanf("%d", &a) != EOF) {
        scanf("%d", &b);
        scanf("%d", &c);
        scanf("%d", &d);
        scanf("%d", &e);
        scanf("%d", &f);
        if (c*e - b*f == 0 && - c*d + a*f == 0) {
            printf("%.3f ", (float) 0);
            printf("%.3f\n", (float) 0); 
        } else if ( - c*d + a*f == 0) {
            printf("%.3f ", (float) (c*e - b*f) / (a*e - b*d ));
            printf("%.3f\n", (float) 0); 
        } else if (c*e -b*f == 0) {
            printf("%.3f ", (float) 0);
            printf("%.3f\n", (float) (- c*d + a*f) / (a*e - b*d ));
        } else {
            printf("%.3f ", (float) (c*e - b*f) / (a*e - b*d ));
            printf("%.3f\n", (float) (- c*d + a*f) / (a*e - b*d ));
        }
    }
    return 0;
}

Measured memory_bytes: 1064
import java.util.Scanner;

public class Main {

    public static void main(String[] args)
    {
        Scanner scan=new Scanner(System.in);
        int Count=0;
        int count_num=scan.nextInt();

        for(int j=0;j<count_num;j++){
            if(Check(scan.nextInt()))
            {
                Count++;
            }
        }

        System.out.println(Count);
    }

    public static boolean Check(int a)
    {
        if(a==2 || a==3) return true;
        if(a<=3  || a%2==0) return false;
        for(int i=3;i<=Math.sqrt((double)a);i+=2)
        {
            if(a%i==0) return false;
        }
        return true;
    }
}

Measured memory_bytes: 42164
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
 
const int maxn = 1e5 + 20, inf = 1e9+1;

ll n, w, z, s, e;

int main()
{
	
	ios::sync_with_stdio(0); cin.tie(0);
	cin >> n >> z >> w;
	for (int i = 0; i < n; i++)
	{
		s = e;
		cin >> e;
	}
	if (n == 1) return cout << abs (e - w) << endl, 0;
	cout << max ( abs(e - w) , abs (e - s) ) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_(i, n, m) for (int i = n; i < (int)(m); i++)
#define all(v) v.begin(), v.end()
#define int long long
#define stoi stoll
//#define _GLIBCXX_DEBUG

signed main() {
  int N, M; cin >> N >> M;
  string ans;
  rep(i, N) ans += 'a';
  
  rep(i, M) {
    int s; cin >> s;
    char c; cin >> c;
    if(ans[s-1] == 'a' || ans[s-1] == c) {
      ans[s-1] = c;
    } else {
      cout << -1 << endl;
      return 0;
    }
  }
  rep(i, N) if(ans[i] == 'a') {
    if(i == 0 && N > 1) ans[i] = '1';
    else ans[i] = '0';
  }
  
  if(ans[0] == '0' && N > 1) {
    cout << -1 << endl;
    return 0;
  } else {
    cout << ans << endl;
    return 0;
  }

}

Measured memory_bytes: 3592
[A, B] = list(map(int, input().split()))
cnt = 0
for i in range(A, B+1):
  list_str = list(str(i))
  list_str_re = list(reversed(list_str))
  if list_str == list_str_re:
    cnt += 1
  else:
    continue
print(cnt)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b){return (a*b)/gcd(a, b);}


int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int a[3];
    cin>>a[0]>>a[1]>>a[2];
    sort(a,a+3);
    if(a[0]==a[1] && a[0]!=a[2] || a[1]==a[2] && a[0]!=a[1]) cout<<"Yes";
    else cout<<"No";
}


Measured memory_bytes: 256
A,B,C = map(int,input().split())
m = [A,B,C]
m = sorted(m)
if (m[2]-m[0])%2 == (m[2]-m[1])%2:
  print(m[2]-(m[0]+m[1])//2)
else:
  print(m[2]-(m[0]+m[1])//2 + 1)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace::std;
#define int long long

#define all(x) (x).begin(), (x).end()
#define inf (sizeof(int) == 4 ? (int)1E9 : (int)1E18)

template<class T> istream& operator>>(istream& I, vector<T>& v) {for (T &e: v) I >> e; return I;}



void _main() {
        char a; cin >> a;
        if (isupper(a)) cout << 'A';
        else cout << 'a';
}



signed main() {
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
        int _t = 1;
//        cin >> _t;
        while (_t--) _main();
        return 0;
}

Measured memory_bytes: 3684
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>

typedef long long ll;

ll mod=1000000000+7;


char s[30000];

int main(void){
    int N;
    scanf("%d", &N);
    scanf("%s", s);

    char pass[3] = "000";
    int pass_n = 0;

    int i, j;
    j=0;

    int ans=0;

    for(pass_n=0;pass_n<1000;pass_n++){
        pass[2]=(char)(pass_n%10)+48;
        pass[1]=(char)((pass_n%100-pass_n%10)/10)+48;
        pass[0]=(char)((pass_n-pass_n%100)/100)+48;
        for(i=0;i<N;i++){
            if(pass[j]==s[i]){
                if(j==2){
                    ans++;
                    break;
                }
                j++;
                continue;
            }
        }
        j=0;
    }

    printf("%d", ans);

    return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

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

		int H = sc.nextInt();
		int W = sc.nextInt();
		String[] C = new String[H];

		for (int i = 0; i < H; i++) {
			C[i] = sc.next();
		}

		for (int j = 0;j < H; j++) {
			for (int i = 0;i < 2;i++) {
			System.out.println(C[j]);
			}
		}
	}
}

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

#define pb(s) push_back(s)
#define ALL(v) v.begin(), v.end()
#define ALLA(arr, sz) arr, arr + sz
#define SORT(v) sort(ALL(v))
#define REVERSE(v) reverse(ALL(v))
#define SORTA(arr, sz) sort(ALLA(arr, sz))
#define REVERSEA(arr, sz) reverse(ALLA(arr, sz))
#define PI 3.14159265358979323846264338327950L


typedef long long ll;

const ll MOD =1e9+7;



int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll x;
    cin>>x;
    ll ans=0;
    ans+=2*(x/11);
    x%=11;
    if(x>0)ans++;
    if(x>6)ans++;
    cout<<ans;
    return 0;
}


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

#define ankit_2305 cerr<<"\nTime taken : "<<(float)(clock()-time_p)/CLOCKS_PER_SEC<<" sec\n";
#define START clock_t
#define TIMER time_p=clock();
#define ll long long

#define MOD 1000000007

using namespace std;

int n, h[100000], k;
ll dp[100000];

ll solve(int p){
	if(dp[p] != -1)
		return dp[p];
	
	ll mn = INT_MAX;
	
	for(int i=1;i<=k;i++){
		dp[p+i] = solve(p+i);
		mn = min(mn, dp[p+i] + abs(h[p] - h[p+i]));
	}
	return dp[p] = mn;
}

int main(){
    START TIMER
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
	int t = 1;
	while(t--){
		cin>>n>>k;
		for(int i=0;i<n;i++){
			cin>>h[i];
			dp[i] = -1;
		}
		for(int i=1;i<=k;i++){
			if(i > n)
				break;
			dp[n-i] = abs(h[n-1] - h[n-i]);
		}
		cout<<solve(0)<<"\n";
	}
    ankit_2305
    return 0;
}


Measured memory_bytes: 6144
#include<bits/stdc++.h>
#define ll long long
#define N 5005
#define pii pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
using namespace std;
template<typename T>
inline void in(T &x)
{
	x=0;
	char c=getchar();
	bool fu=0;
	while(c<'0'||c>'9'){if(c=='-')fu=1;c=getchar();}
	while(c>='0'&&c<='9')x=(x<<1)+(x<<3)+(c^48),c=getchar();
	x=fu?-x:x;
}
int n,m,p[N],c[N],tag[N],tagc;
ll now,ans=numeric_limits<ll>::min(),a[N];
void dfs(int from,int rest)
{
	now+=c[from];
	if(now>ans)ans=now;
	tag[from]=++tagc;
	a[tag[from]]=a[tag[from]-1]+c[from];
	if(!rest)
	{
		return;
	}
	if(tag[p[from]])
	{
		int len=tag[from]-tag[p[from]]+1;
		ll val=a[tag[from]]-a[tag[p[from]]-1];
		ll mx=0;
		if(rest>=len&&val>0)
		{
			
			int num=(rest-len)/len;
			now+=1LL*num*val;
			ll tmp=now+val;
			rest-=num*len;
			int rest1=rest-len;
			for(int i=tag[p[from]];i<=tag[from]&&i-tag[p[from]]+1<=rest1;++i)
			if(a[i]-a[tag[p[from]]-1]>mx)mx=a[i]-a[tag[p[from]]-1];
			if(tmp+mx>ans)ans=tmp+mx;
		}
		mx=0;
		for(int i=tag[p[from]];i<=tag[from]&&i-tag[p[from]]+1<=rest;++i)
		if(a[i]-a[tag[p[from]]-1]>mx)mx=a[i]-a[tag[p[from]]-1];
		now+=mx;
		if(now>ans)ans=now;
		return;
	}
	dfs(p[from],rest-1);
}
int main()
{
	in(n);in(m);
	for(int i=1;i<=n;++i)in(p[i]);
	for(int i=1;i<=n;++i)in(c[i]);
	for(int i=1;i<=n;++i)
	{
		tagc=0;
		now=0;
		for(int j=1;j<=n;++j)tag[j]=0,a[j]=0;
		dfs(p[i],m-1);
	}
	printf("%lld\n",ans);
	return 0;
}

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

int getType(int score){
	if (score < 400) return 0;
	if (score < 800) return 1;
	if (score < 1200) return 2;
	if (score < 1600) return 3;
	if (score < 2000) return 4;
	if (score < 2400) return 5;
	if (score < 2800) return 6;
	if (score < 3200) return 7;
	return 8;
}

int main(){
	int cnt[10] = {0};
	int n, x;

	cin >> n;
	while (n--){
		cin >> x;
		cnt[getType(x)]++;
	}
	n = 0;
	for (int i = 0; i < 8; i++)
		n += cnt[i] > 0;
	if (!n){
		cnt[8]--;
		n = 1;
	}
	cout << n << " " << n + cnt[8];
	return 0;
}

Measured memory_bytes: 256