akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>


    using namespace std;
    using ll = long long;
    using ull = unsigned long long;
    using pii = pair<int, int>;
    using pll = pair<ll, ll>;



    const int INF = 0x3f3f3f3f;
    const long long int LLINF = 0x3f3f3f3f3f3f3f3f;
    const int NMAX = 1e7 + 5;
    const int MOD = 1e9 + 7;
    #define endl "\n"



    char strings[10][11];
    int n,m;
    bool compatible(char * tab){
        for (int i = 0; i < n; ++i)
        {
            int count = 0;
            for (int j = 0; j < m; ++j)
            {
                if(strings[i][j] != tab[j])count++;
                if(count>1)return false;
            }
        }
        return true;
    }
    void solve(char * tab){
        for (int i = 0; i < m; ++i)
        {
            if(tab[i] == '_'){
                for (char l = 'a'; l <= 'z'; ++l)
                {
                    tab[i] = l;
                    solve(tab);
                    if(compatible(tab))return;
                    else{
                        tab[i] = '_';
                    }
                }
            }
        }
    }
    int main() {
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
        int N;
        cin >> N;
        int money = 1000;
        while(money - N < 0){
            money += 1000;
        }
        cout<<money-N<<endl;
        return 0;
    }


Measured memory_bytes: 3620
#[allow(unused_macros)]
macro_rules! scan {
    () => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().to_string()
        }
    };
    (;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().split_whitespace().map(|s| s.to_string()).collect::<Vec<String>>()
        }
    };
    (;;$n:expr) => {
        {
            (0..$n).map(|_| scan!()).collect::<Vec<_>>()
        }
    };
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty;;$n:expr) => {
        (0..$n).map(|_| scan!($t;;)).collect::<Vec<_>>()
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    scan!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    scan!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn dikstra(graph: &[Vec<(usize, usize)>]) -> Vec<usize> {
    let mut dists = vec![1usize << 30; graph.len()];
    dists[0] = 0;

    let mut visited = vec![false; graph.len()];
    loop {
        let tmp = dists.clone();
        if let Some((dist, i)) = tmp
            .into_iter()
            .enumerate()
            .filter(|&(i, _)| !visited[i])
            .map(|(i, v)| (v, i))
            .min()
        {
            visited[i] = true;
            for &(to, d) in &graph[i] {
                if dist + d < dists[to] {
                    dists[to] = dist + d;
                }
            }
        } else {
            break;
        }
    }

    dists
}

fn main() {
    let n = scan!(usize);

    let mut graph = vec![vec![]; n];

    for _ in 0..n {
        let vs = scan!(usize;;);
        let v = vs[0];
        let m = vs[1];
        for i in 0..m {
            graph[v].push((vs[1 + i * 2 + 1], vs[1 + i * 2 + 2]))
        }
    }

    for (i, d) in dikstra(&graph).into_iter().enumerate() {
        println!("{} {}", i, d);
    }
}



Measured memory_bytes: 5056
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>

using namespace std;

#define FOR(i, N) for (int i = 0; i < (int)N; i++)
#define FORIN(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define MOD 1000000007
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

using Pi = pair<int, int>;
using ll = long long;
const int INF = 1 << 28;

string to_string(string s) {
  return s;
}

template<class S,class T>
string to_string(pair<S,T> p){
	return "{"+to_string(p.first)+","+to_string(p.second)+"}";
}

template <class T>
string to_string(unordered_set<T> s){
	string ret="{";
	for(T t:s)ret+=to_string(t)+",";
	ret+="}";
	return ret;
}

template <class T>
string to_string(vector<T> v) {
  string ret = "{";
  for (int i = 0; i < (int)v.size() - 1; ++i) {
    ret += to_string(v[i]) + ",";
  }
  if (v.size() > 0) {
    ret += to_string(v.back());
  }
  ret += "}";
  return ret;
}

void debug() {
  cerr << endl;
}

template <class Head, class... Tail>
void debug(Head head, Tail... tail) {
  cerr << to_string(head) << " ";
  debug(tail...);
}

void print() {
  cout << endl;
}

template <class Head, class... Tail>
void print(Head head, Tail... tail) {
  cout << to_string(head);
  print(tail...);
}

int main() {
  double a,b;
  cin>>a>>b;
  printf("%.10f\n",a*b/(a+b));
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int s[3][3];
  int N;
  int i,j,k;
  for(i=0;i<3;i++){
    for(j=0;j<3;j++){
      cin >> s[i][j];
    }
  }
  cin >> N;
  int t[N];
  for(i=0;i<N;i++){
    cin >> t[i];
  }
  for(i=0;i<3;i++){
    for(j=0;j<3;j++){
      for(k=0;k<N;k++){
     if(s[i][j]==t[k]){
       s[i][j]=0;
     }
      }
    }
  }
  string ans="No";
  for(i=0;i<3;i++){
    if(s[1][i]==s[2][i] && s[0][i]==s[1][i]){
      ans="Yes";
    }
    if(s[i][1]==s[i][2] && s[i][0]==s[i][1]){
     ans="Yes";
    }
    if(s[0][2]==s[1][1] && s[2][0]==s[1][1]){
     ans="Yes";
    }
    if(s[1][1]==s[2][2] && s[0][0]==s[1][1]){
      ans="Yes";
    }
  }
  cout << ans << endl;
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
int main(){
  int min=0,max=0;
  int n;
  cin >> n;
  bool color[8]={};
  int highrate=0;
  rep(i,n){
    int rate;
    cin >> rate;
    rate/=400;
    if(rate<8){
      color[rate]=true;
    }
    else{
      highrate++;
    }
  }
  rep(i,8){
    if(color[i]==true){min++;max++;}
  }
  max+=highrate;
  if(min==0){min=1;}
  cout << min <<" "<< max <<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>

using namespace std;
using ll = long long;

void hoge(string s,vector<ll> &vec, ll cnt=0LL) {
  ll n = static_cast<ll>(s.size());
  if (n == 0) {
    vec.push_back(cnt);
    return;
  }
  for (ll i = 1; i <= n; ++i) {
    ll tmp = stoll(s.substr(0, i));
    hoge(s.substr(i, n - i), vec, cnt+tmp);
  }
}

int main() {
  string s;
  cin >> s;
  vector<ll> vec;
  hoge(s, vec);
  sort(vec.begin(), vec.end());
  cout << accumulate(vec.begin(), vec.end(), 0LL) << endl;
}


Measured memory_bytes: 3644
/******************************************
 * Author : sinon.su96@gmail.com
 * Or : ahafid96@gmail.com
 * Username : SINON
 * Date : April 2020
 * Civil and Structural engineering student
 * at Ecole des Ponts ParisTech
 * ***************************************/

//Import usefull library :
#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <ctime>
#include <algorithm>
#include <sstream>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <cstdlib>
#include <cstdio>
#include <iterator>
#include <functional>
#include <bitset>
using namespace std;

//usefull abreviation
#define fi first
#define se second
#define pb push_back
#define sqr(x) (x)*(x)
typedef long long LL;
typedef unsigned long long uLL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
typedef vector<int> vi;


int main()
{
  int a, b, c;
  cin >> a >> b >> c;
  cout << c << " " << a << " " << b <<"\n";
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint     = long long;
const lint inf = 1LL << 60;
const lint mod = 1000000007;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    lint n, c, k;
    cin >> n >> c >> k;
    vector<lint> z;
    z.reserve(2 * n);
    vector<lint> t(n);
    for (int i = 0; i < n; ++i) {
        cin >> t[i];
        z.push_back(t[i]);
        z.push_back(t[i] + k);
    }
    sort(z.begin(), z.end());
    z.erase(unique(z.begin(), z.end()), z.end());
    map<lint, int> za;
    int idx = 0;
    for (auto &zz : z) {
        za[zz] = idx++;
    }
    vector<int> pos(2 * n, 0);
    for (int i = 0; i < n; ++i) {
        pos[za[t[i]]]++;
    }
    lint ret = 0;
    priority_queue<lint, vector<lint>, greater<lint>> q;
    for (int i = 0; i < (int)z.size(); ++i) {
        for (int j = 0; j < pos[i]; ++j) {
            q.push(za[z[i] + k]);
        }
        while (!q.empty() && q.top() == i) {
            ret++;
            for (int j = 0; j < c; ++j) {
                q.pop();
                if (q.empty())
                    break;
            }
        }
    }
    cout << ret << "\n";
    return 0;
}

Measured memory_bytes: 15872
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
#include <limits.h>
int max(int a, int b){return a>b?a:b;}
int min(int a, int b){return a<b?a:b;}
int gcd(int a, int b){return min(a,b)==0?max(a,b):gcd(min(a,b),max(a,b)%min(a,b));}
long long llmax(long long a, long long b){return a>b?a:b;}
long long llmin(long long a, long long b){return a<b?a:b;}
long long llgcd(long long a, long long b){return min(a,b)==0 ?llmax(a,b):llgcd(llmin(a,b),llmax(a,b)%llmin(a,b));}
int assort(const void *a, const void *b){return *(int*)a-*(int*)b;}
int dessort(const void *a, const void *b){return *(int*)b-*(int*)a;}
int llassort(const void *a, const void *b){return *(long long*)a-*(long long*)b;}
int lldessort(const void *a, const void *b){return *(long long*)b-*(long long*)a;}
int charassort(const void *a, const void *b){return strcmp((char*)a ,(char*)b);}
int chardessort(const void *a, const void *b){return strcmp((char*)b ,(char*)a);}
int ntoi(char c){return c-'0';}
int ltoi(char c){return c-'a';}
int utoi(char c){return c-'A';}

char lowcmp[26]="abcdefghijklmnopqrstuvwxyz";
char upcmp[26]="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
long long mod=1000000007;

int main(void){
    int n;
    scanf("%d",&n);
    if (n==1){
        printf("Hello World\n");
    } else {
        int a,b;
        scanf("%d%d",&a,&b);
        printf("%d\n",a+b);
    }
    
    
    
    
    
    
    
    
	return 0 ;
}

Measured memory_bytes: 128
let s = read_line ()
let f g s = let n = ref 0 in String.iter (fun c -> if g c then incr n) s; !n
let _ = print_endline @@ if s.[0] = 'A' && String.(contains (sub s 2 (length s - 3)) 'C') && f (fun c -> Char.uppercase c = c) s = 2 then "AC" else "WA"

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

int main(){

    long long N, buf1, buf2;
    cin >> N;
    long long last = 10e+12;

    for(long long i=floor(sqrt(N)); i>=1; i--){
        // buf1 = N/i;
        buf2 = N%i;
        if(buf2 == 0){
            // cout << i << endl;
            last = N/i + i - 2;
            break;
            // if(last > buf1+i){
                // last = buf1 + i - 2;
            // }
        }
    }
    cout << last << endl;
}

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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< pii >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define in(x, a, b) ((a) <= (x) && (x) < (b))
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

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

    Int(n);
    vector<int> data(n);
    for (int i = 0; i < n; i++) {
        cin >> data[i];
    }
    
    int ans = 0;
    Rep(i, n-1) {
        vi hoge = { data[i-1], data[i], data[i+1] };
        sort(all(hoge));
        ans += data[i] == hoge[1];
    }

    std::cout << ans << std::endl;

    return 0;
}


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

int main(){
    string total;
    string ichien;
    
    cin >> total;
    cin >> ichien;
    
    if(stoi(total) % 500 <= stoi(ichien))
      cout << "Yes" << endl;
  	else
      cout << "No" << endl;
      
    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>


void call(int n);

int main (){
	int n=0,o;
	scanf("%d",&n);
	
	call(n);	
	//scanf("%d",&o);

	return 0;

}



void call(int n)
{
	int x;
	int i = 1;	

// CHECK_NUM
	do
	{
		x = i;
		if(x % 3 == 0)
		{
			printf(" %d", i);
			continue; // goto CHECK_NUM
		}

// INCLUDE3
		do
		{
			if ( x % 10 == 3 )
			{
				printf(" %d", i);
				break;
			}
			x /= 10;
		}while(x);

	}while(++i <= n);
	printf("\n");
}

Measured memory_bytes: 600
N=gets.to_i
c=gets.chomp
i=0
while i <= 200000
  ri = c.rindex('R')
  wi = c.index('W')
  if !ri.nil? && !wi.nil? && ri > wi
    c[ri], c[wi] = c[wi], c[ri]
  else
    break
  end
  i += 1
end
puts i


Measured memory_bytes: 14620
import java.math.*;
import java.io.*;
import java.util.*;
 
class Main{
    public static void main(String[] args) throws Exception{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        int N = Integer.parseInt(br.readLine());
        int[] A = new int[N];
        int[] B = new int[N];
        int[] C = new int[N];

        for(int i = 0; i < N; i++){
            String[] l1 = br.readLine().split(" ");
            for(int j = 0; j < 3; j++){
                if(j == 0){
                    A[i] = Integer.parseInt(l1[0]);
                }else if(j == 1){
                    B[i] = Integer.parseInt(l1[1]);
                }else{
                    C[i] = Integer.parseInt(l1[2]);
                }
            }
        }

        int[][] dp = new int[N][3];

        for(int i = 0; i < N; i++){
            for(int j = 0; j < 3; j++){
                if(i == 0){
                    if(j == 0){
                        dp[i][j] = A[i];
                    }else if(j == 1){
                        dp[i][j] = B[i];
                    }else{
                        dp[i][j] = C[i];
                    }
                }else{
                    for(int k = 0; k < 3; k++){
                        if(j == k) continue;
                        if(j == 0) dp[i][j] = Math.max(dp[i][j], dp[i - 1][k] + A[i]);
                        else if(j == 1) dp[i][j] = Math.max(dp[i][j], dp[i - 1][k] + B[i]);
                        else dp[i][j] = Math.max(dp[i][j], dp[i - 1][k] + C[i]);
                    }
                }
            }
        }
        
        int ans = 0;
        for(int i = 0; i < 3; i++){
            ans = Math.max(ans, dp[N - 1][i]);
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 48068
#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;
}
string s; 
int main(){
	ios::sync_with_stdio(0);
	cin>>s;
	if(s=="ARC")
	cout<<"ABC";
	else
	cout<<"ARC";
	re 0;
}

Measured memory_bytes: 3640
n = int(input())

low = [0]*n
high = [0]*n

for i in range(n):
    a, b = [int(x) for x in input().split(" ")]
    low[i] = a
    high[i] = b

low.sort()
high.sort()

if n%2 == 1:
    print(high[n//2]-low[n//2]+1)
else:
    x = (low[(n-1)//2] + low[n//2])/2
    y = (high[(n-1)//2] + high[n//2])/2
    print(int(2*y - 2*x + 1))


Measured memory_bytes: 75772
def main():
    # input
    import math
    t1, t2 = map(int, input().split())
    a1, a2 = map(int, input().split())
    b1, b2 = map(int, input().split())

    x = (a1-b1)*t1
    y = (a2-b2)*t2
    diff = x+y

    if x == -y:
        print("infinity")
        return
    elif x*y>0 or abs(x)>abs(y):
        print(0)
        return

    x = abs(x)
    diff = abs(diff)
    ans = x//diff
    remainder = x%diff
    if remainder==0:
        print(ans*2)
    else:
        print(ans*2+1)

    # calc

if __name__ == '__main__':
    main()


Measured memory_bytes: 38256
#include<stdio.h>
int main(){
    long n;
    scanf("%ld",&n);
    long a[n];
    for(long i = 0; i < n; i++)
        scanf("%ld",&a[i]);
    long ans = 1;
    for(long i = 0; i < n; i++)
        if(a[i] == ans)
            ans++;
    if(ans == 1)
        puts("-1");
    else
        printf("%ld\n",n - ans + 1);
    return 0;
}

Measured memory_bytes: 1664
#include <iostream>

using namespace std;
using ll = long long int;

int main()
{
    ll a, b, x;
    cin >> a >> b >> x;
    ll fb = b / x + 1;
    --a;
    ll fa = (a == -1) ? 0 : a / x + 1;
    ll ans = fb - fa;

    cout << ans << endl;

    return 0;
}

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

using namespace std;
using ll = long long;

int main()
{
    int n;
    cin >> n;
    for(int i = 0; i< 10; i++){
        if(n < 400 + 200*(i+1)){
            cout << 8-i << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 3672
#include "bits/stdc++.h"
#define _USE_MATH_DEFINES
#include <math.h>
 
using namespace std;
 
using LL = long long;
using VLL = std::vector<LL>;
using VVLL = std::vector<VLL>;
using VVVLL = std::vector<VVLL>;
using LD = long double;
using VLD = std::vector<LD>;
using VVLD = std::vector<VLD>;
using VVVLD = std::vector<VVLD>;
 
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; }

//template<class T=LL> inline vector<T> cinv(LL N){ vector<T> v(N); REP(i, N)cin>>v[i]; return move(v);}
//template<class T=LL> inline vector<T> cinv(LL N){ vector<T> v(N); REP(i, N)cin>>v[i]; return move(v);}
#define REP(i,n) for(LL (i)=0;(i)<(n);(i)++)
#define ALL(v) v.begin(), v.end()
#define PRINTLN(v) {LL i=0; for(auto (a): v ){   cerr <<i << " : "<<  a << endl; i++;}}
#define PRINTSP(v) for(auto (a): v ) {cerr << a << " ";} cerr << endl
#define cmax(a,b) {if(a<b){a=b;}}
#define cmin(a,b) {if(a>b){a=b;}}
#define EACH(a,A) for(auto a: A)
//#define cmax(a,b) a = (a>b ? a:b)
//#define cmin(a,b) a = (a<b ? a:b) 
//cin,cout高速化のおまじない＋桁数指定
inline VLL cinvll(LL N){
  VLL A(N);
  REP(i,N){
    cin >> A[i];
  }
  return move(A);
}
struct Fast{
	Fast(){
		cin.tie(0);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(std::numeric_limits<double>::max_digits10);
	}
} fast;

LL nCr(LL n, LL r) {
  LL num = 1;
  for (LL i = 1; i <= r; i++) {
    num = num * (n - i + 1) / i;
  }
  return num;
}


void func(){
  LL N;
  cin >> N;
  auto A = cinvll(N);
  //PRINTSP(A);

  LL M=3;
  VLL X(M,0);
  LL ans=1;
  REP(i,N){
    LL a = A[i];

    LL cnt=0;
    if(X[0]==a){
      cnt++;
    }
    if(X[1]==a){
      cnt++;
    }
    if(X[2]==a){
      cnt++;
    }
    auto it = find(ALL(X),a);
    if(it==X.end()){
      cout << 0;
      return;
    }
    auto idx = it-X.begin();
    //cout <<idx << endl;
    X[idx]++;
    ans *= cnt;
    ans %= 1000000007;
    //PRINTSP(X);
  }
  cout <<ans;
} 
int main()
{
  func();
  return 0;
}
 

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

long power(long x, long y, long mod){
  long ans = 1, tmp = x;;
  while(y>0){
    if(y & 1){
      ans *= tmp%mod;
      ans %= mod;
    }
    tmp *= tmp;
    tmp %= mod;
    y >>= 1;
  }
  return ans;
}

int main(){
  long n, mod = INF;
  cin >> n;
  long ans = (power(10,n,mod) - (power(9,n,mod)*2)%mod)%mod + power(8,n,mod);
  if(ans < 0)ans += mod;
  ans %= mod;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3540
#include <stdio.h>

int main() {
    int a[5];
    int i, j, tmp;
    
    scanf ("%d %d %d %d %d", &a[0], &a[1], &a[2], &a[3], &a[4]);

    for (i = 1; i < 5; i++) {
        tmp = a[i];
        if (a[i - 1] < tmp) {
            j = i;
            do {
                a[j] = a[j - 1];
                j--;
            } while (j > 0 && a[j - 1] < tmp);
            a[j] = tmp;
        }
    }
    
    printf("%d %d %d %d %d\n", a[0], a[1], a[2], a[3], a[4]);
    
    return 0;
}

Measured memory_bytes: 596
import numpy as np
from copy import deepcopy


S = np.array([s for s in input()], str)
T = np.array([t for t in input()], str)
nS, nT = map(len, (S, T))
ans = ''
idx = []

if nS < nT:
    ans = 'UNRESTORABLE'
else:
    for i in range(nS - nT + 1):
        s = S[i:i + nT]
        if np.all((s == T) | (s == '?')):
            idx.append(i)

if not idx:
    ans = 'UNRESTORABLE'
else:
    i = idx[-1]
    S[i:i + nT] = T
    ans = np.where(S == '?', 'a', S)

print(''.join(ans))

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

using namespace std;
using ll = long long;

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

#define ALL(o) (o).begin(), (o).end()

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T, vector<T>, greater<T> >;

const ll MOD = 1000000007;

int main() {
	int n,t;
	V<int> v;

	cin >> n;
	REP(i,n) {
		cin >> t;
		v.push_back(t);
	}
	v[0] -= 1;
	FOR(i,1,n-1) {
		if(v[i] > v[i-1]) {
			v[i] -= 1;
		}
		if(v[i] > v[i+1]) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;


}




Measured memory_bytes: 892
#include <stdio.h>
int main(void)
{
    double w;
    while (scanf("%lf", &w) != EOF) {
        if (!(w > 48.0)) puts("light fly"); else
        if (!(w > 51.0)) puts("fly"); else
        if (!(w > 54.0)) puts("bantam"); else
        if (!(w > 57.0)) puts("feather"); else
        if (!(w > 60.0)) puts("light"); else
        if (!(w > 64.0)) puts("light welter"); else
        if (!(w > 69.0)) puts("welter"); else
        if (!(w > 75.0)) puts("light middle"); else
        if (!(w > 81.0)) puts("middle"); else
        if (!(w > 91.0)) puts("light heavy"); else
        puts("heavy");
    }
    return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int PMAX = 10000000;

template <typename T>
struct node {
	T val, add;
	node *l, *r;
	node() {}
	node(T val, T add) : val(val), add(add), l(nullptr), r(nullptr) {}
	void init(T v, T a, node *left, node *right) {
		val = v;
		add = a;
		l = left;
		r = right;
	}
};

node<ll> pool[PMAX];

template <typename T>
class SaikyoSegmentTree {
	const ll n;
	const T id;
	int it, rit;
	vector<node<T>*> root;
	T getval(node<T> *x) {
		return x == nullptr ? id : x->val;
	}
	T getadd(node<T> *x) {
		return x == nullptr ? id : x->add;
	}
	node<T>* getl(node<T> *x) {
		return x == nullptr ? nullptr : x->l;
	}
	node<T>* getr(node<T> *x) {
		return x == nullptr ? nullptr : x->r;
	}
	ll size(ll n) {
		assert(n < (1ll << 62ll));
		ll res = 1;
		while (res < n) res <<= 1;
		return res;
	}
	node<T> *new_node(T val, T add, node<T> *l = nullptr, node<T> *r = nullptr) {
		pool[it].init(val, add, l, r);
		return &pool[it++];
	}
	node<T> *fix(node<T> *x, ll l, ll r, T val, ll lb, ll ub) {
		if (r <= lb || ub <= l) return x;
		if (l <= lb && ub <= r) return new_node(getval(x), getadd(x) + val, getl(x), getr(x));
		ll c = (lb + ub) / 2;
		auto nl = fix(getl(x), l, r, val, lb, c);
		auto nr = fix(getr(x), l, r, val, c, ub);
		return new_node(getval(x) + val * (min(r, ub) - max(l, lb)), getadd(x), nl, nr);
	}
	T sub(node<T> *x, ll l, ll r, ll lb, ll ub) {
		if (x == nullptr) return id;
		if (ub <= l || r <= lb) return id;
		if (l <= lb && ub <= r) return x->val + x->add * (ub - lb);
		ll c = (lb + ub) / 2;
		return sub(getl(x), l, r, lb, c) + sub(getr(x), l, r, c, ub) + x->add * (min(r, ub) - max(l, lb));
	}
public:
	SaikyoSegmentTree(ll n_, T id_) : n(size(n_)), id(id_), it(0) {
		root.push_back(nullptr);
	}
	void add(ll l, ll r, T val, int rt = -1) {
		if (rt == -1) rt = root.size() - 1;
		assert(0 <= rt && rt < (int)root.size());
		root.push_back(fix(root[rt], l, r + 1, val, 0, n));
	}
	T find(ll l, ll r, int rt = -1) {
		if (rt == -1) rt = root.size() - 1;
		assert(0 <= rt && rt < (int)root.size());
		return sub(root[rt], l, r + 1, 0, n);
	}
};

int main()
{
	cin.sync_with_stdio(false);
	cin.tie(0);
	ll N, M, Q;
	cin >> N >> M >> Q;
	vector<tuple<int, int, int>> vab(M);
	for (int i = 0; i < M; i++) {
		cin >> get<1>(vab[i]) >> get<2>(vab[i]) >> get<0>(vab[i]); get<1>(vab[i])--; get<2>(vab[i])--;
	}
	sort(vab.begin(), vab.end());
	SaikyoSegmentTree<ll> sst(N, 0);
	for (int i = 0; i < M; i++) {
		sst.add(get<1>(vab[i]), get<2>(vab[i]), 1);
	}
	ll x, y, j;
	while (Q--) {
		cin >> x >> y >> j; x--; y--;
		ll l = 0, r = M;
		while(l + 1 < r) {
			ll c = (l + r) / 2;
			if (sst.find(x, y, c) >= j) {
				r = c;
			}
			else {
				l = c;
			}
		}
		printf("%d\n", get<0>(vab[r - 1]));
	}
	return 0;
}

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

#define ll long long
#define ar array
#define vi vector<int>
#define vvi vector<vector<int>>
#define vll vector<long long>
#define forn(i,n) for(ll i=0; i<(n); i++)
#define fori(i,k,n) for(ll i=k; i<(n); i++) 
#define all(x) (x).begin(),(x).end()
#define en '\n'
#define FILL(x,v) memset(x,v,sizeof(x))
#define pb push_back

template<typename T> void print(vector<T>& a)
{
	for (int i = 0; i < a.size(); i++)
		cout << a[i] << ' ';
	cout << en;
}
 
template<typename T> void print(deque<T>& a)
{
	for (int i = 0; i < a.size(); i++)
		cout << a[i] << ' ';
	cout << en;
}
 
template<typename T> void print(vector<vector<T>>& a)
{
	for (int i = 0; i < a.size(); i++)
	{
		for (int j = 0; j < a[i].size(); j++)
			cout << a[i][j] << ' ';
		cout << en;
	}
}
const int INF = 1e9 + 5;

void solve(){
	int n, k;
	cin >> n >> k;
	vi a(n);
	for(auto &it: a){
		cin >> it;
	}
	vi dp(n, INF);
	// min jumps
	dp[0] = 0;
	forn(i,n){
		for(int j=i+1; j<=i+k; j++){
			if(j < n){
				dp[j]=min(dp[j], dp[i]+abs(a[i] - a[j]));
			}
		}
	}
	cout << dp[n-1] << en;
}

int main(){
    ios::sync_with_stdio(0);
	cin.tie(0);
    cout.tie(0);
 
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
    int t = 1;
	// cin >> t;
    while(t--)
        solve();
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1000005;
const double Pi=acos(-1);
const int P=200003;
int n,m,l,id[maxn],r[maxn<<2];
ll a[maxn];
struct Complex{
	double x,y;
	Complex(double u=0,double v=0){x=u,y=v;}
};
Complex operator + (Complex a,Complex b){
	return Complex(a.x+b.x,a.y+b.y);
}
Complex operator - (Complex a,Complex b){
	return Complex(a.x-b.x,a.y-b.y);
}
Complex operator * (Complex a,Complex b){
	return Complex(a.x*b.x-a.y*b.y,a.x*b.y+a.y*b.x);
}
Complex b[maxn<<2],c[maxn<<2],s[50];
 
void FFT(Complex *f,int n,int op){
	for(int i=0;i<n;i++)
		if(i<r[i]) swap(f[i],f[r[i]]);
	Complex tmp,buf,x,y;
	for(int len=1;len<n;len<<=1){
		tmp=Complex(cos(Pi/len),op*sin(Pi/len));
		for(int R=len<<1,j=0;j<n;j+=R){
			buf=Complex(1,0);
			for(int k=0;k<len;k++){
				x=f[j+k],y=buf*f[j+k+len];
				f[j+k]=x+y;f[j+k+len]=x-y;
				buf=buf*tmp;
			}
		}
	}
}
int main()
{
	for(int i=0,x=1;i<P-1;i++) id[x]=i,x=x*2%P;
	scanf("%d",&n);
	for(int i=1,x;i<=n;i++)
	{
		scanf("%d",&x);
		if(x==0) continue;
		a[x]++,b[id[x]].x+=1;
//		cout<<id[x]<<endl;
	}
	int lim=1;
	for(;lim<(P<<1);lim<<=1,l++);
	for(int i=0;i<lim;i++) r[i]=(r[i>>1]>>1)|((i&1)<<(l-1));
	FFT(b,lim,1);
	for(int i=0;i<lim;i++) b[i]=b[i]*b[i];
	FFT(b,lim,-1);
	ll ans=0;
	for(ll i=0;i<P;i++) ans-=(i*i%P)*a[i];
//	(a[i]*(a[i]-1)-a[i]*a[i]);
	for(int i=0,val=1;i<lim;i++)
	{
		ans+=(ll)(b[i].x/lim+0.5)*val;
//		if((ll)(b[i].x/lim+0.5)) cout<<val<<' '<<(ll)(b[i].x+0.5)<<endl;
		val=val*2%P;
	}
	printf("%lld\n",ans/2);
	return 0;
}

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

int main()
{
	int  a,b;
	cin >> a >> b ;
	for (int i = 0; i <=max(a,b); i++)
	{
		if(abs(a - i) == abs(b - i)){
			cout << i<< endl;
			return 0;
		}
		/* code */
	}
	

	cout << "IMPOSSIBLE"<< endl;
	return 0;
}


Measured memory_bytes: 384
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {

	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");
		int n = Integer.parseInt(str[0]);
		int q = Integer.parseInt(str[1]);

		int a[] = new int[n];
		Arrays.fill(a, Integer.MAX_VALUE);

		SegmentTree st = new SegmentTree(a);

		for (int i = 0; i < q; i++) {
			str = br.readLine().split(" ");

			int com = Integer.parseInt(str[0]);
			int x = Integer.parseInt(str[1]);
			int y = Integer.parseInt(str[2]);

			if (com == 0) {
				st.update(x, y);
			} else {
				System.out.println(st.query(x, y + 1));
			}
		}
	}

}

class SegmentTree {

	int N;
	int[] origin;
	int[] tree;

	int INT_MAX = Integer.MAX_VALUE;

	SegmentTree(int[] original) {
		this.origin = Arrays.copyOf(original, original.length);
		int n = origin.length;
		this.N = 1;
		while (N < n)
			N *= 2;
		this.tree = new int[N * 2];
		for (int i = 0; i < N * 2; i++) {
			tree[i] = INT_MAX;
		}
		build();
	}

	// O(N)
	void build() {
		for (int i = 0; i < origin.length; i++) {
			update(i, origin[i]);
		}
	}

	// i番目の値をxに更新 O(log N)
	void update(int i, int x) {
		i += N - 1;
		tree[i] = x;
		while (i > 0) {
			i = (i - 1) / 2;
			tree[i] = marge(tree[i * 2 + 1], tree[i * 2 + 2]);
		}
	}

	// O(log N);
	int query(int start, int end) {
		return query(start, end, 0, 0, N);
	}

	// [a, b)の最小値、l, rにはノードkに対応する区間を与える
	private int query(int a, int b, int k, int l, int r) {
		if (r <= a || b <= l)
			return INT_MAX;

		if (a <= l && r <= b) {
			return tree[k];
		} else {
			int lv = query(a, b, 2 * k + 1, l, (l + r) / 2);
			int rb = query(a, b, 2 * k + 2, (l + r) / 2, r);
			return marge(lv, rb);
		}
	}

	private int marge(int l, int r) {
		return Math.min(l, r);
	}

}


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

int main(void){
  string s;
  int a,z;
  cin >> s;
  for(int i=0; i< s.size(); i++){
    if(s[i] == 'A'){
      a =i;
      break;
    }
  }
  for(int i=0; i< s.size(); i++){
    if(s[i] == 'Z'){
      z =i;
    }
  }
  cout << z-a+1 << endl;
  return 0;
}

Measured memory_bytes: 3756
#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef pair<int,int>P;
vector<vector<vector<P> > >v;
int dp[51][51][51][51];
string s[51];
int h,w;
inline int dfs(int ly,int lx,int ry,int rx){

  int res=-1e7;

  if(ly<0||ry<0||ly>=h||ry>=h)return -1e7;
  if(lx<0||rx<0||lx>=w||rx>=w)return -1e7;
  if(s[ly][lx]=='#'||s[ry][rx]=='#')return -1e7;
  if(ly==ry&&lx==rx)return dp[ly][lx][ry][rx]=0;
  if(ly==ry&&lx==rx+1)return dp[ly][lx][ry][rx]=0;
  if(ly==ry+1&&lx==rx)return dp[ly][lx][ry][rx]=0;
  if(ly==ry+1&&lx==rx+1)return dp[ly][lx][ry][rx]=0;
  if(ly>ry||lx>rx)return -1e7;
  if(dp[ly][lx][ry][rx]!=-1e8)return dp[ly][lx][ry][rx];

  res=max(res,dfs(ly+1,lx,ry,rx));
  res=max(res,dfs(ly,lx+1,ry,rx));
  res=max(res,dfs(ly,lx,ry-1,rx));
  res=max(res,dfs(ly,lx,ry,rx-1));

  if(islower(s[ly][lx])){

    if(isupper(s[ry][rx])&&s[ly][lx]==tolower(s[ry][rx])){
      res=max(res,dfs(ly+1,lx,ry-1,rx)+1);
      res=max(res,dfs(ly,lx+1,ry-1,rx)+1);
      res=max(res,dfs(ly+1,lx,ry,rx-1)+1);
      res=max(res,dfs(ly,lx+1,ry,rx-1)+1);
    }

    else r(i,v[ly][lx].size()){
      int y=v[ly][lx][i].first;
      int x=v[ly][lx][i].second;
      if(!(ly<=y&&y<=ry&&lx<=x&&x<=rx))continue;
      res=max(res,dfs(ly,lx,y,x)+dfs(y,x,ry,rx));
    }

  }

  return dp[ly][lx][ry][rx]=res;
}
int main(){
  while(cin>>h>>w,h){
    r(i,51)r(j,51)r(k,51)r(l,51)dp[i][j][k][l]=-1e8;
    v.clear();
    v.resize(h,vector<vector<P> >(w));
    r(i,h)cin>>s[i];
    r(i,h)r(j,w)r(y,h)r(x,w){
      if(i<=y&&j<=x){
        if(islower(s[i][j])&&isupper(s[y][x])){
          if(s[i][j]==tolower(s[y][x])){
            v[i][j].push_back(P(y,x));
          }
        }
      }
    }
    cout<<(dfs(0,0,h-1,w-1)<0?-1:dp[0][0][h-1][w-1])<<endl;
  }
}


Measured memory_bytes: 29680
# 次の日曜日が何日後か出力

answer = input ()

if answer == "SUN":
    print("7")
elif answer == "MON":
    print("6")
elif answer == "TUE":
    print("5")
elif answer == "WED":
    print("4")
elif answer == "THU":
    print("3")
elif answer == "FRI":
    print("2")
elif answer == "SAT":
    print("1")

Measured memory_bytes: 8812
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S; cin >> S;
    string T;
    rep(i, S.length()) {
        if(S[i] != 'x') T += S[i];
    }
    string R = T;
    reverse(R.begin(), R.end());
    if(T != R) {
        cout << -1 << endl;
        return 0;
    }
    int ans = 0;
    int l = 0, r = S.length() - 1;
    while(l <= r) {
        if(S[l] != S[r]) {
            if(S[l] == 'x') l++;
            else r--;
            ans++;
        } else {
            l++;
            r--;
        }
    }
    cout << ans << endl;



    return 0;
}


Measured memory_bytes: 3760
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
        int n = sc.nextInt(); int k = sc.nextInt();
        int [] a = new int[n + 1];
        for (int i = 1; i <= n; i++) a[i] = sc.nextInt();
        for (int i = k + 1; i <= n; i++) {
            out.println(a[i] > a[i - k] ? "Yes" : "No");
        }
        out.close();
    }


    //-----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }


    }

}

Measured memory_bytes: 56988
#include<bits/stdc++.h>
using namespace std;
int n,m;
int po[1000100];

int mlg;
vector<int>li[22];
int mr[22][1000100];
int ml[22][1000100];
void get_line(int pos,int ma)
{
	li[pos].push_back(0);
//	cout<<endl;
//	cout<<"pos: "<<pos<<" ma: "<<ma<<endl;
	for(int i=1;i<=n;++i)
		if(i==1||po[i]-po[i-1]>ma)
			li[pos].push_back(i);
	li[pos].push_back(n+1);
	for(int i=1,p=0;i<=n;++i)
	{
		mr[pos][i]=mr[pos][i-1];
		if(i==li[pos][p+1])
			p++,mr[pos][i]=li[pos][p+1]-1;
	}
	mr[pos][n+1]=n;
	ml[pos][n+1]=n+1;
	for(int i=n,p=li[pos].size()-1;i;--i)
	{
		ml[pos][i]=ml[pos][i+1];
		if(i==li[pos][p]-1)
			p--,ml[pos][i]=li[pos][p];
	}
//	cout<<"mr: ";for(int i=1;i<=n;++i)cout<<mr[pos][i]<<" ";cout<<endl;
//	cout<<"ml: ";for(int i=1;i<=n;++i)cout<<ml[pos][i]<<" ";cout<<endl;
}

int pre[1000100],suf[1000100];
int ans[22];
void out(int ma)
{
	for(int i=1;i<=ma;++i)
		for(int j=li[0][i];j<li[0][i+1];++j)
			puts(ans[i]?"Possible":"Impossible");
}
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;++i)scanf("%d",&po[i]);
	for(int tm=m;tm;mlg++,tm>>=1) get_line(mlg,tm);
	get_line(mlg,0);mlg++; 
	int s=1<<mlg,nxt;
	memset(suf,0x3f,sizeof(suf));
	suf[0]=n+1;
//	cout<<"s: "<<s<<endl;
	for(int i=0;i<s;++i)
	{
//		cout<<"i: "<<i<<" pre: "<<pre[i]<<" suf: "<<suf[i]<<endl;
		for(int j=0;j<mlg;++j)
		{
			if((i>>j)&1)continue;
			nxt=(i|(1<<j));
			pre[nxt]=max(pre[nxt],mr[j][pre[i]+1]);
			suf[nxt]=min(suf[nxt],ml[j][suf[i]-1]);
		}
	}
	int ma=li[0].size()-2;
	if(ma>mlg)
	{
		for(int i=1;i<=n;++i)puts("Impossible");
		return 0;
	}
	s--;
	int ls=(s^1);
	for(int i=1,L,R;i<=ma;++i)
	{
		L=li[0][i];R=li[0][i+1]-1;
		for(int j=0;j<=s;++j)
		{
			if(j&1)continue;
//			cout<<"j: "<<j<<" invj: "<<((s^j)&ls)<<endl;
			if(pre[j]>=L-1&&suf[(s^j)&ls]<=R+1)
			{
				ans[i]=1;
				break;
			}
		}
	}
	out(ma);
	return 0;
}


Measured memory_bytes: 118772
#include <cstdio>

unsigned long long n,m,r,c=1;

int main(){
    scanf("%llu %llu",&n,&m);
    r+=(n-m)*100;
    for(int i=0;i<m;i++)
        c*=2;
    r+=m*1900;
    printf("%d",r*c);
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

    static Scanner scanner;

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

        double n=gl();
        double m=gl();
        double d=gl();
        double ans =0;
        if (d==0) {
        	ans = (m-1)/n;
        } else {
        	ans = (m-1) * 2 * (n-d)/ n/n;
        }
        System.out.println(ans);
    }


    // 文字列として入力を取得
    public static String gs() {
         return scanner.next();
    }

    // intとして入力を取得
    public static int gi() {
         return Integer.parseInt(scanner.next());
    }

    // longとして入力を取得
    public static long gl() {
         return Long.parseLong(scanner.next());
    }

    // doubleとして入力を取得
    public static double gd() {
         return Double.parseDouble(scanner.next());
    }
}

Measured memory_bytes: 35748
#include <iostream>

int main() {
    std::string N;
    std::cin >> N;

    switch (N[N.length() - 1]) {
        case '2':
        case '4':
        case '5':
        case '7':
        case '9':
            std::cout << "hon" << std::endl;
            break;

        case '0':
        case '1':
        case '6':
        case '8':
            std::cout << "pon" << std::endl;
            break;

        case '3':
            std::cout << "bon" << std::endl;
            break;
    }

    return 0;
}


Measured memory_bytes: 3036
#include<string>
#include<bits/stdc++.h>
#define fast  ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define ll long long int
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define el '\n'
using namespace std;
//const int N=1e6+5;
//int fr[N];
bool isPrime(int num){
    int root=sqrt(num);
    for(int i=2;i<=root;i++){
        if(num%i==0){
            return false;
        }
    }
    return true;
}
void replaceAll( string &s, const string &search, const string &replace ) {
    for( size_t pos = 0; ; pos += replace.length() ) {

        pos = s.find( search, pos );
        if( pos == string::npos ) break;
        s.erase( pos, search.length() );
        s.insert( pos, replace );
    }
}
const int N=2e5+1;
int A[N], dp[N], n,ans;

int jump(int i, int cost){
    if(dp[i] != -1){
        return cost + dp[i];
    }
    if(n == i + 1){
        dp[i] = 0;
    }else if(n == i + 2){
        dp[i] = abs(A[i] - A[i + 1]);
    }else{
        dp[i] = min(jump(i + 1, abs(A[i] - A[i + 1])), jump(i + 2, abs(A[i] - A[i + 2])));
    }
    return cost + dp[i];
}
int main()
{
    fast;
    cin>>n;
    memset(dp, -1, sizeof dp);
    for(int i=0;i<n;i++)cin>>A[i];
    cout<<jump(0,0);
    return 0;
}


Measured memory_bytes: 7200
k = %[Man Oku Cho Kei Gai Jo Jou Ko Kan Sei Sai Gok Ggs Asg Nyt Fks Mts].split.to_a
k.unshift("")
while gets
  m, n = $_.split.map(&:to_i)
  break if m == 0 && n == 0
  v = m ** n
  x = []
  a = v.to_s.size / 4
  0.upto(a){ |i| x[i] = v / 10**(4*i) % 10000 }
  a.downto(0){ |i| print x[i], k[i] if x[i] > 0 }
  puts
end

Measured memory_bytes: 8760
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b,c;
  cin >> a >> b >> c;
  if ((a == 5 && b == 5 && c == 7)||(a == 5 && b == 7 && c == 5)||(a == 7 && b == 5 && c == 5)){
  cout << "YES";
  }else{
  cout << "NO";
  }
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define CLR(a) memset((a), 0 ,sizeof(a))
#define ALL(a) (a).begin(),(a).end()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define MAX_N 1000000
#define MAX_X 1000
#define MAX_Y 1000

int cave[MAX_Y][MAX_X];
bool sieve[MAX_N+1];
int dp[MAX_N+1];

int m, n;

struct P { int x, y; };

P search_cave(int n) {
    REP(y, MAX_Y) REP(x, MAX_X) {
        if (cave[y][x] == n) {
            return (P){x, y};
        }
    }
    return (P){0, 0}; // fail
}

int main() {
    sieve[0] = sieve[1] = true;
    FOR(i, 2, MAX_N+1) {
        if (sieve[i]) continue;
        for (int j = i + i; j < MAX_N+1; j += i) {
            sieve[j] = true;
        }
    }

    int ul = cave[0][0] = MAX_N;
    // left -> down -> right -> up ->
    int d = 0;
    int dx[] = {1, 0, -1, 0}; int dy[] = {0, 1, 0, -1};
    int x = 0, y = 0;
    while (ul > 1) {
        int sx = x + dx[d];
        int sy = y + dy[d];
        if (0 <= sx && sx < MAX_X && 0 <= sy && sy < MAX_Y && cave[sy][sx] == 0) {
            x = sx;
            y = sy;
            ul--;
            cave[y][x] = ul;
        } else {
            d = (d + 1) & 3; // d % 4
        }
    }

    while (cin >> m >> n, m|n) {
        fill_n(dp, MAX_N+1, -1);
        P s = search_cave(n);
        dp[n] = 0;
        int max_primes = 0, max_cave = 0;
        FOR(y, s.y, MAX_Y) REP(x, MAX_X) {
            int c = cave[y][x];
            if (c > m || dp[c] < 0) continue;
            if (!sieve[c]) { // prime
                dp[c]++;
                if (max_primes < dp[c]) {
                    max_primes = dp[c];
                    max_cave = c;
                } else if (max_primes == dp[c]) {
                    max_cave = max(max_cave, c);
                }
            }
            for (int dx = -1; dx <= 1; dx++) {
                int sx = x + dx;
                int sy = y + 1;
                if (0 <= sx && sx < MAX_X && 0 <= sy && sy < MAX_Y) {
                    int c2 = cave[sy][sx];
                    if (c2 <= m) {
                        dp[c2] = max(dp[c2], dp[c]);
                    }
                }
            }
        }
        cout << max_primes << " " << max_cave << endl;
    }
}

Measured memory_bytes: 9948
#include <algorithm>
#include <iostream>
#include <cmath>
using namespace std;
#define INF (1e9)
#define N 41
#define B 4

int main(){
  int n,p[N],t[N],dp[N][B],tim,pos,ans;
  while(1){
    cin>>n;
    if(!n) break;
    for(int i=0;i<n;i++) cin>>p[i]>>t[i];
    for(int i=0;i<N;i++)
      for(int j=0;j<B;j++) dp[i][j]=INF;
    dp[0][0]=tim=pos=0;
    for(int i=0;i<n;i++){
      for(int j=0;j<B;j++){
	if(dp[i][j]==INF) continue;
	if(i>=1&&j>=1&&t[i-1]+p[i-1]*(j+1)+p[i]<=t[i])
	  dp[i+1][1]=min(dp[i+1][1],dp[i][j]+p[i-1]+p[i]);
	if(j<=2&&tim+abs(p[i]-pos)*(j+1)<=t[i])
	  dp[i+1][j+1]=min(dp[i+1][j+1],dp[i][j]+abs(p[i]-pos));
      }
      tim=t[i],pos=p[i];
    }
    ans=INF;
    for(int i=0;i<B;i++) ans=min(ans,dp[n][i]);
    if(ans!=INF) cout<<"OK "<<ans+p[n-1]<<endl;
    else{
      for(int i=0;i<=n;i++){
	int flag=1;
	for(int j=0;j<B;j++)
	  if(dp[i][j]!=INF) flag=0;
	if(flag){
	  cout<<"NG "<<i<<endl;
	  break;
	}
      }
    }
  }
  return 0;
}

Measured memory_bytes: 1164
#include <stdio.h>

int main(void)
{
  int n, a, b;
  scanf("%d %d %d", &n, &a, &b);
  char s[n];
  int i = 0;
  int frg = 0;
  int pass = 0;
  while (i < n)
  {
    scanf("%s", &s[i]);
    if (s[i] == 'a')
    {
      if (pass < a + b)
      {
        printf("Yes\n");
        pass++;
      }
      else
        printf("No\n");
    }
    else if (s[i] == 'b')
    {
      frg++;
      if ((pass < a + b) && (frg <= b))
      {
        printf("Yes\n");
        pass++;
      }
      else
        printf("No\n");
    }
    else if (s[i] == 'c')
      printf("No\n");
    i++;
  }
  return 0;
}

Measured memory_bytes: 640