akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;

typedef pair<int, int> P;
//dp[かかる総コスト][使う数字]
/*
    コストb[i]の数字a[i]を選ぶ場合
        dp[i][j-b[i]]の末尾にa[i]をくっつけて最大最小を比較する
*/

//d < tmpの時trueを返す
bool judge(const string &d, const string &tmp) {
    if (d.length() < tmp.length()) return true;
    else if (d.length() == tmp.length()) {
        REP(i,tmp.length()) {
            if ((int)(d[i]-'0') < (int)(tmp[i]-'0')) return true;
            else if ((int)(d[i]-'0') > (int)(tmp[i]-'0')) return false;
        }
    }
    return false;
}
vector<string> dp(10010, "0");
int main(int argc, char const *argv[]) {
    int n, m;
    cin >> n >> m;
    vector<int> a(m);
    REP(i,m) cin >> a[i];
    int b[10];
    b[1] = 2; b[2] = 5; b[3] = 5; b[4] = 4; b[5] = 5; b[6] = 6;
    b[7] = 3; b[8] = 7; b[9] = 6;
    vector<P> p;
    REP(i,m) p.push_back({b[a[i]], a[i]});
    dp[0] = "";
    for (int i = 0; i <= n; ++i) {
        for (auto &x: p) {
            int a = x.second; int b = x.first;
            if (i >= b) {
                if (dp[i-b] != "0") {
                    string tmp = dp[i-b];
                    tmp.push_back((char)(a+'0'));
                    if (judge(dp[i], tmp)) dp[i] = tmp;
                }
            }
        }
    }
    cout << dp[n] << endl;
    return 0;
}

Measured memory_bytes: 41344
#include<stdio.h>
#include<string.h>
int main(){
	char m[9][9],s[9][9];
	int i,j,k=0;
	for(j=0;j<8;j++){
		scanf("%s",m[j]);
		strcpy(s[j],m[j]);
	}
	for(k=90;k<360;k+=90){
		printf("%d\n",k);
		for(i=0;i<8;i++){
			for(j=0;j<8;j++){
				s[j][7-i]=m[i][j];
			}
		}
		for(j=0;j<8;j++){
			printf("%s\n",s[j]);
			strcpy(m[j],s[j]);
		}
	}
    return 0;
}

Measured memory_bytes: 2608
n = int(input())
x = [0]*n
y = [0]*n
for i in range(n):
  x[i], y[i] = map(int, input().split())
t = 0
for i in range(n-1):
  for j in range(i+1, n):
    t += (((x[i]-x[j])**2 + (y[i]-y[j])**2)**0.5)/(n/2)
print(t)

Measured memory_bytes: 3060
#include<stdio.h>

int max(int x, int y);

int nums[100][100];


int main(){
    int row = 0; /* ??? */
    int pos = 0; /* ??? */
    int ans = 0;
    int i;
    int j;

	for(i = 0;i < 100;i++){
		for(j = 0;j < 100;j++){
			nums[i][j] = 0;
		}
	}

    while (scanf("%d", &nums[row][pos]) != EOF){
        pos++;
        if (getchar() == '\n'){
            row++;
            pos = 0;
        }
    }


    for (i = 1; i < ((row + 1) / 2) ; i++){
        nums[i][0] += nums[i - 1][0];
        for (j = 1; j < i + 1; j++){
            nums[i][j] += max(nums[i - 1][j - 1], nums[i - 1][j]);
        }
    }
    for (i = ((row + 1) / 2) ; i < row; i++){
        for (j = 0; j < ((row + 1) / 2); j++){
            nums[i][j] += max(nums[i - 1][j], nums[i - 1][j + 1]);
            ans = max(nums[i][j], ans);
        }
    }


    printf("%d\n", ans);
    
    return(0);
}

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

    return (y);
}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}

const ll MOD = (ll)(1e9 + 7);
ll dp[41][1 << 17];

int main2() {
  CLR(dp, 0);
  int N = nextInt();
  int X = nextInt();
  int Y = nextInt();
  int Z = nextInt();
  int mask17 = (1 << 17) - 1;
  int mask575 = (1 << (X+Y+Z-1)) + (1 << (Y+Z-1)) + (1 << (Z-1));
  dp[0][0] = 1;
  for (int n = 0; n < N; n++) {
    for (int v = 0; v < (1 << 17); v++) if (dp[n][v] > 0) {
      for (int d = 1; d <= 10; d++) {
        int nv = (v << d) + (1 << (d-1));
        nv &= mask17;
        if ((nv & mask575) != mask575) (dp[n+1][nv] += dp[n][v]) %= MOD;
      }
    }
  }
  ll ans = 1;
  REP(i, N) ans = ans * 10 % MOD;
  for (int v = 0; v < (1 << 17); v++) {
    ans -= dp[N][v];
    ans = (ans % MOD + MOD) % MOD;
  }
  cout << ans << endl;
  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws)
    main2();
  return 0;
}


Measured memory_bytes: 42240
#include <math.h>
#include <algorithm>
#include <iostream>
#include <iterator>
#include <set>
#include <unordered_map>
#include <vector>
 
using namespace std;
 
int main(void) {
  int N;
  cin >> N;
  char S[200];
  for (int i = 0; i < N; i++) cin >> S[i];
  int ans;
  for (int i = 1; i < N; i++) {
    set<char> A, B;
    for (int j = 0; j < N; j++) {
      if (j < i) {
        A.insert(S[j]);
      } else {
        B.insert(S[j]);
      }
    }
    vector<char> v;
    set_intersection(A.begin(), A.end(), B.begin(), B.end(), back_inserter(v));
    int p = v.size();
    if (p > ans) ans = p;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        Node[] nodes = new Node[n];
        for (int i = 0; i < n; i++) {
            nodes[i] = new Node(i);
        }
        for (int i = 0; i < n; i++) {
            Node node = nodes[scanner.nextInt()];
            int k = scanner.nextInt();
            if (k > 0) {
                Node[] children = new Node[k];
                for (int j = 0; j < k; j++) {
                    children[j] = nodes[scanner.nextInt()];
                }
                node.setChildren(children);
            }
        }
        Node root = null;
        for (int i = 0; i < n; i++) {
            if (nodes[i].parent == null) {
                root = nodes[i];
                break;
            }
        }
        root.setDepth(0);
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < n; i++) {
            Node node = nodes[i];
            sb.append("node " + String.valueOf(i) + ": parent = ");
            sb.append(node.parent == null ? "-1" : String.valueOf(node.parent.id));
            sb.append(", depth = " + String.valueOf(node.depth) + ", ");
            if (node.parent == null) {
                sb.append("root");
            } else if (node.children == null) {
                sb.append("leaf");
            } else {
                sb.append("internal node");
            }
            sb.append(", [");
            if (node.children != null) {
                for (int j = 0; j < node.children.length; j++) {
                    if (j > 0) {
                        sb.append(", ");
                    }
                    sb.append(node.children[j].id);
                }
            }
            sb.append("]\n");
        }
        System.out.print(sb.toString());
    }

    private static class Node {
        int id;
        Node parent;
        int depth;
        Node[] children;

        private Node(int id) {
            this.id = id;
        }

        private void setChildren(Node[] children) {
            this.children = children;
            for (Node node : children) {
                node.setParent(this);
            }
        }

        private void setParent(Node parent) {
            this.parent = parent;
        }

        private void setDepth(int depth) {
            this.depth = depth;
            if (this.children != null) {
                for (Node node : children) {
                    node.setDepth(depth + 1);
                }
            }
        }
    }

}

Measured memory_bytes: 162200
/*

*/
#include<bits/stdc++.h>

using namespace std;
using ll=long long;
#define rep2(i, a, n) for(int i = (a); i < (n); i++)
#define rep(i, n) rep2(i,0,n)
template<class T,class U>void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>void chmax(T &t,U f){if(t<f)t=f;}

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  int n;cin>>n;
  int a[n];
  rep(i,n)cin>>a[i];
  ll ans=0;
  int hoge=0,bi;
  rep(i,n){
    chmax(hoge,a[i]);
    bi=hoge;
    ans+=bi-a[i];
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 4440
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    N, x = map(int, readline().split())

    print(N - x + 1)


if __name__ == '__main__':
    main()


Measured memory_bytes: 61900
#include <stdio.h>

int main(){
    int i,n[3],max=0,min=0,cost;
    for(i=0;i<3;i++){
        scanf("%d",&n[i]);
        if(n[i]>n[max]) max=i;
        if(n[i]<n[min]) min=i;
    }
    //printf("%d %d",n[max],n[min]);
    cost = n[max] - n[min];
    printf("%d",cost); 

}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for (ll i=0; i<n; ++i)
#define all(c) begin(c),end(c)
#define PI acos(-1)
#define oo LLONG_MAX
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
/*

*/
int main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  
  string S;
  cin >> S;
  if (S == "RRR")
    cout << 3 << endl;
  else if (S == "RRS" || S== "SRR")
    cout << 2 << endl;
  else if (S== "SSS")
    cout << 0 << endl;
  else
    cout << 1 << endl;
           
}


Measured memory_bytes: 3608
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val p = sc.nextInt()
    var odd = 0
    var even = 0

    for (i in 0 until n) {
        val a = sc.nextInt()
        odd += a % 2
        even += (a % 2) xor 1
    }
    if (odd == 0) {
        println(pow(2, even) * int(p == 0))
    } else {
        println(pow(2, odd - 1) * pow(2, even))
    }
}

fun pow(a: Int, b: Int): Long {
    var result = 1L
    for (i in 0 until b) {
        result *= a
    }
    return result
}

fun int(ok: Boolean): Int {
    if (ok) {
        return 1
    }
    return 0
}


Measured memory_bytes: 31008
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define forever for (;;)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
template<typename A> using V = std::vector<A>;
template<typename A> using F = std::function<A>;
template<typename A, typename B> using P = std::pair<A, B>;
using pii = P<int, int>;
using vi = V<int>;
using vd = V<double>;
using vs = V<std::string>;
using vpii = V<pii>;
using vvi = V<vi>;
using vvpii = V<vpii>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979;
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int n) { return n & 1; }
constexpr bool even(const int n) { return ~n & 1; }
template<typename T> std::istream &operator>>(std::istream &is, std::vector<T> &v) { for (T &x : v) is >> x; return is; }
template<typename A, typename B> std::istream &operator>>(std::istream &is, std::pair<A, B> &p) { is >> p.first; is >> p.second; return is; }
using namespace std;
// clang-format on

main {
  string s;
  cin >> s;
  cout << s.rfind("Z") - s.find("A") + 1 << endl;
}


Measured memory_bytes: 640
fn read_stdin() -> String {
    use std::io::Read;
    let mut input = String::new();
    std::io::stdin().read_to_string(&mut input).unwrap();
    input
}

fn scan<'a, I: Iterator<Item = &'a str>, T: std::str::FromStr>(tokens: &mut I) -> T {
    tokens.next().unwrap().parse().ok().unwrap()
}

fn vec<T, F: FnMut(usize) -> T>(n: usize, mut f: F) -> Vec<T> {
    (0..n).map(|i| f(i)).collect()
}

fn main() {
    use std::collections::HashMap;
    let input = read_stdin();
    let tokens = &mut input.split_whitespace();
    let n: usize = scan(tokens);
    let a: Vec<usize> = vec(n, |_| scan(tokens));
    let mut count: HashMap<usize, usize> = HashMap::new();
    for &ai in &a {
        *count.entry(ai).or_insert(0) += 1;
    }
    let mut sum = 0;
    for (_, &c) in &count {
        sum += (c * c - c) / 2;
    }
    for &ai in &a {
        println!("{}", sum - (count[&ai] - 1));
    }
}


Measured memory_bytes: 20632
N, M = map(int, input().split())
students = []
checkpoints = []
for i in range(N):
    students.append(list(map(int,input().split())))
for i in range(M):
    checkpoints.append(list(map(int, input().split())))

for sx, sy in students:
    mindist = 10 ** 9
    num = 0
    for i in range(M):
        cx, cy = checkpoints[i]
        dist = abs(sx-cx) + abs(sy-cy)
        if mindist > dist:
            mindist = dist
            num = i
    print(num+1)


Measured memory_bytes: 3064
#include <stdio.h>
int main()
{
    int n;
    scanf("%d", &n);
    if(n%2 == 0)
    {
        int odd = n/2;
        int even = n/2;
        printf("%d", odd*even);
    }
    else
    {
        int odd = n/2+1;
        int even = n/2;
        printf("%d", odd*even);
    }
    return 0;
}

Measured memory_bytes: 128
s = int(input())
if s <= 2:
    print(0)
else:
    dp = [0]*(s+1)
    dp[s] = 1
    mod = 10**9+7
    for i in range(s, 1, -1):
        dp[i-1] += dp[i]
        dp[i-1] %= mod
        if i-3 >= 0:
            dp[i-3] += dp[i]
            dp[i-3] %= mod
    print(dp[0]%mod)
    


Measured memory_bytes: 8952
#include <stdio.h>
#include<math.h>
#include <algorithm>
using namespace std;

char table[100][101];
int height,width,number;

bool rangeCheck(int row,int col){
	if(row >= 0 && row <= height-1 && col >=0 && col <= width-1)return true;
	else{
		return false;
	}
}

void erase(int row,int col){
	char ch = table[row][col];
	table[row][col] = 'd';
	if(rangeCheck(row,col+1) == true && table[row][col+1] == ch)erase(row,col+1); //right
	if(rangeCheck(row,col-1) == true && table[row][col-1] == ch)erase(row,col-1); //left
	if(rangeCheck(row-1,col) == true && table[row-1][col] == ch)erase(row-1,col); //up
	if(rangeCheck(row+1,col) == true && table[row+1][col] == ch)erase(row+1,col); //down
}

int main(){

	while(true){
		scanf("%d %d",&height,&width);
		if(height == 0 && width == 0)break;

		for(int i =0; i < height; i++){
			scanf("%s",table[i]);
		}

		number = 0;
		for(int i = 0; i < height; i++){
			for(int k=0; k < width; k++){
				if(table[i][k] == '@' || table[i][k] == '#'||table[i][k] == '*'){
					number++;
					erase(i,k);
				}
			}
		}

		printf("%d\n",number);

	}

    return 0;
}

Measured memory_bytes: 3468
def try_dfs_fill_distance(graph, starting_node, distance_cache):
    found_conflicts = False
    traverse_stack = []
    traverse_stack.append((starting_node, 0))

    while traverse_stack:
        node, node_dist_from_origin = traverse_stack.pop()
        if distance_cache[node] == None:
            distance_cache[node] = node_dist_from_origin
            for neighbor_data in graph[node]:
                neighbor_id, neighbor_diff = neighbor_data
                traverse_stack.append((neighbor_id, node_dist_from_origin + neighbor_diff))

        elif distance_cache[node] != node_dist_from_origin:
            found_conflicts = True
            break

    return found_conflicts

if __name__ == '__main__':
    n, m = list(map(int, input().split(" ")))
    graph = [[] for _ in range(n + 1)]
    for _ in range(m):
        l, r, d = list(map(int, input().split()))
        graph[l].append((r, d))
        graph[r].append((l, -d))

    distance_cache = [None for _ in range(n + 1)]
    has_conflict = False
    for i in range(1, len(distance_cache)):
        if distance_cache[i] == None:
            #distance_cache[i] = 0
            #has_conflict = try_dfs_fill_distance_recurse(graph, i, 0, distance_cache)
            has_conflict = try_dfs_fill_distance(graph, i, distance_cache)
            if has_conflict:
                break

    print("No" if has_conflict else "Yes")

Measured memory_bytes: 83544
X,K,D = map(int,input().split()) 
X = abs(X)
if X >= K*D:
    print(X-K*D)
else:
    if (K-X//D) % 2 == 1:
        print(D-(X-X//D*D))
    else:
        print(X-X//D*D)

Measured memory_bytes: 9172
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) loop(i,0,b)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#ifdef DEBUG
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<(DUMP(),__VA_ARGS__).str()<<" ["<<__LINE__<<"]"<<endl)
struct DUMP:ostringstream{template<class T>DUMP &operator,(const T&t){if(this->tellp())*this<<", ";*this<<t;return *this;}};
#else
#define dump(...)
#endif
template<class T> ostream& operator<<(ostream& os, vector<T> const& v){
    rep(i,v.size()) os << v[i] << (i+1==(ll)v.size()?"":" ");
    return os;
}

typedef vector<string> vs;

int main(){
    int p, q;
    while(cin >> p >> q && p){
        vs P(p);
        vi v(p);
        cin.ignore();
        rep(i,p){
            cin >> P[i];
            while(v[i] < P[i].size() && P[i][v[i]] == '.') v[i]++;
        }

        vs Q(q);
        rep(i,q) cin >> Q[i];

        vi ans(q,-2);
        loop(R,1,21) loop(C,1,21) loop(S,1,21){
            int r = 0, c = 0, s = 0;
            bool ok = true;
            rep(i,p){
                if(R*r+C*c+S*s != v[i]){
                    ok = false;
                    break;
                }
                rep(j,P[i].size()){
                    switch (P[i][j]){
                    case '(': r++; break;
                    case ')': r--; break;
                    case '{': c++; break;
                    case '}': c--; break;
                    case '[': s++; break;
                    case ']': s--; break;
                    }
                }
            }
            if(!ok) continue;
            r = 0; c = 0; s = 0;
            rep(i,q){
                int t = R*r+C*c+S*s;
                if(ans[i] == -2) ans[i] = t;
                else if(ans[i] != t) ans[i] = -1;
                rep(j,Q[i].size()){
                    switch (Q[i][j]){
                    case '(': r++; break;
                    case ')': r--; break;
                    case '{': c++; break;
                    case '}': c--; break;
                    case '[': s++; break;
                    case ']': s--; break;
                    }
                }
            }
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 1220
#include<bits/stdc++.h>
#define N 100005
using namespace std;
int n,x,y,fa[N];
int fst[N],nxt[N*2],to[N*2],l;
void link(int x,int y)
{
	to[++l]=y;nxt[l]=fst[x];fst[x]=l;
	to[++l]=x;nxt[l]=fst[y];fst[y]=l;
}
int Get(int x)
{
	int now=0;
	for (int i=fst[x];i;i=nxt[i])
		if (to[i]!=fa[x])
		{
			fa[to[i]]=x;
			now^=Get(to[i])+1;
		}
	return now;
}
int main()
{
	scanf("%d",&n);
	for (int i=1;i<n;i++)
	{
		scanf("%d%d",&x,&y);
		link(x,y);
	}
	puts(Get(1)?"Alice":"Bob");
}

Measured memory_bytes: 7296
#include <cstdio>

using namespace std;

long long gcd(int x, int y)
{
  return y?gcd(y, x%y):x;
}

long long lcm(int x, int y)
{
  return x/gcd(x, y)*y;
}

int main()
{
  long long a, b;
  while(scanf("%lld%lld", &a, &b) != -1){
    if(b > a){
      a += b;
      b = a - b;
      a -= b;
    }
    printf("%lld %lld\n", gcd(a, b), lcm(a, b));
  }
  return 0;
}

Measured memory_bytes: 1024
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define endl "\n"
#define sz(x) ((ll)(x).size())
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define prt(x) cout << (x)
#define prtl(x) cout << (x) << endl
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define rrep(i,a,b) for(ll i=a; i>b; i--)
#define mp(a, b) make_pair(a, b)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define debug(v) cout << #v<< ": " << v <<endl;
#define fst first
#define snd second
using namespace std;
using vi = vector<int>;
using vll = vector<long long int>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vc = vector<char>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long int>>;
using vvc = vector<vector<char>>;
using ll = long long int;
using P = pair<long long int, long long int>;
using Map = map<long long int, long long int>;
ll INF = 1LL<<60;
ll M = 1000000007;

int main(){
    ll n; cin >> n;
    vc s(n);
    rep(i, 0, n){
        cin >> s[i];
    }
    vll w(0);
    priority_queue<ll> r;
    rep(i, 0, n){
        if(s[i] == 'R'){
            r.push(i+1);
        }else{
            w.emplace_back(i+1);
        }
    }
    ll c = 0;
    if(r.empty()){
        prtl(0);
        return 0;
    }
    for(auto x: w){
        if(r.top() < x){
            break;
        }else{
            r.pop();
            c++;
        }
    }
    prtl(c);
}


Measured memory_bytes: 5740
//
//  main.c
//  lyftcontestc
//
//  Created by lim on 12/14/19.
//  Copyright © 2019 lim. All rights reserved.
//

#include <stdio.h>
#include <stdlib.h>
#include <limits.h>

#define max(a,b) \
  ({ __typeof__ (a) _a = (a); \
      __typeof__ (b) _b = (b); \
    _a > _b ? _a : _b; })

#define min(a,b) \
  ({ __typeof__ (a) _a = (a); \
      __typeof__ (b) _b = (b); \
    _a < _b ? _a : _b; })

int main(int argc, const char * argv[]) {
    int i = 0;
    scanf("%i", &i);
    int *h = malloc(sizeof(int) * i);
    int *g = malloc(sizeof(long) * (i + 1));
    for (int j = 0; j < i; j++) {
        scanf("%i", &h[j]);
        g[j] = -1;
    }
    g[0] = 0;
    
    for (int j = 1; j < i; j++) {
        for (int k = 0; k < 2; k++) {
            if (j - k - 1 >= 0) {
                if (g[j] == -1) {
                    g[j] = g[j - k - 1] + abs(h[j] - h[j - k - 1]);
                } else {
                    g[j] = min(g[j], g[j - k - 1] + abs(h[j] - h[j - k - 1]));
                }
            }
        }
    }
    printf("%i\n", g[i - 1]);
    
    free(g);
    free(h);
    return 0;
}


Measured memory_bytes: 896
l=int(input())
a=int(input())
b=int(input())
c=int(input())
d=int(input())

aa=a//c
if a%c!=0:
    aa+=1
bb=b//d
if b%d!=0:
    bb+=1
if aa>bb:
    print(l-aa)
else:
    print(l-bb)



Measured memory_bytes: 5588
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using Graph = vector<vector<ll>>;
using P = pair<int,int>;
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; }
#define MOD 1000000007
#define INF 1000000
#define PI 3.14159265358979323846264338327950L
#define MAX_N 200010
#define lb lower_bound 

int main()
{
  int a,b;cin>>a>>b;
  cout<<a*b<<endl;
}

Measured memory_bytes: 3640
<?php
fscanf(STDIN, "%d %d", $n, $k);
$a = explode(' ', trim(fgets(STDIN)));

if ($k > max($a)) exit('IMPOSSIBLE');
if (in_array($k, $a)) exit('POSSIBLE');
$x = min($a);
foreach ($a as $b) {
	$x = gcd($b, $x);
	if ($x == 1) break;
}
echo $k % $x ? 'IMPOSSIBLE' : 'POSSIBLE';

function gcd($n, $m) {
	return ($n % $m) ? gcd($m, $n % $m) : $m;
}

Measured memory_bytes: 12792
import java.util.Scanner;

public class Main {

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

		int a = scanner.nextInt();
		int b = scanner.nextInt();
		int c = scanner.nextInt();

		String answer = null;
		if (c >= a) {
			if (c <= b) {
				answer = "Yes";
			} else {
				answer = "No";
			}
		} else {
			answer = "No";
		}

		System.out.println(answer);
		scanner.close();
	}
}


Measured memory_bytes: 22868
#include<bits/stdc++.h>
#define ll long long
#define ii pair<ll,int>
using namespace std;

struct DSU {
    vector <int> P, R;
    DSU (int n) {
        P.resize(n), R.resize(n);
        for (int i = 0; i < n; i++) {
            P[i] = i, R[i] = 1;
        }
    }

    int find(int x) {return x == P[x] ? x : P[x] = find(P[x]);}

    bool unionS (int x, int y) {
        x = find(x), y = find(y);
        if (x == y) return false;

        if (R[y] > R[x]) swap(x, y);
        R[x] += R[y];
        P[y] = x;
        return true;
    }
};
struct edge {
    int u, v;
    ll w;
    bool operator<(const edge & E) const {
        return w < E.w;
    }
};

int custom(ii a,ii b){
    if(a.second == b.second){
        return a.first > b.first;
    }
    return a.second > b.second;
}

int main(){
    int n,m;
    cin>>n>>m;
    priority_queue<int>a[m];
    for(int i = 0;i<n;i++){
        ii x;
        cin>>x.first>>x.second;
        if(x.first <= m){
            a[x.first-1].push(x.second);
        }
    }
    int j = 0;
    priority_queue<int>total;
    ll ans = 0;
    for(int i =0;i<m;i++){
        if(i == 0){
            if(a[i].size()){
                ans+=a[i].top();
                a[i].pop();
            }
        }
        else{
            if(!a[i].empty() && !total.empty()){
                if(a[i].top() > total.top()){
                    ans+=a[i].top();
                    a[i].pop();
                }
                else{
                    ans+=total.top();
                    total.pop();
                }
            }
            else{
                if(a[i].empty() && !total.empty()){
                    ans+=total.top();
                    total.pop();
                }
                else if(!a[i].empty() && total.empty()){
                    ans+=a[i].top();
                    a[i].pop();
                }
            }

        }
        while(a[i].size() >0){
            total.push(a[i].top());
            a[i].pop();
        }
    }
    cout<<ans;
}

Measured memory_bytes: 6272
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define each(a,x) for(auto a : (x))
#define all(a) (a).begin(),(a).end()
#define chmin(a,b) ((a) = min((a),(b)))
#define chmax(a,b) ((a) = max((a),(b)))
#define in_range(x,l,r) ((l)<=(x) && (x)<(r))
#define printvec(a) rep(i,a) cout << a[i] << " \n"[i+1==(a).size()];
#define fs first
#define sc second
#define em emplace
#define eb emplace_back
#define sz size()
#define MP make_pair
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;

const ll INF = 1e8;
const D EPS = 1e-8;
const ll MOD = 1e9+7;

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

  int n500 = x / 500;
  x -= n500 * 500;
  int n5 = x / 5;
  cout << n500 * 1000 + n5 * 5 << endl;
}


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

using namespace std;

#define ll long long
#define M 1005000
#define ii pair<ll, ll>
#define fi first
#define se second
#define pb push_back

ll n, k, a[M], b[M], c[M], ans, lef, righ;
string s;

int main(){
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    
    cin >> n >> k >> s;
    s += ' ';
    for (int i = 1; i < n; i++) if (s[i] == s[i - 1]) ans++;
    for (int i = 0; i < n; i++){
        if (s[i] == 'L' && s[i + 1] != 'L') lef++;
        if (s[i] == 'R' && s[i + 1] != 'R') righ++;
    }
    if (k >= min(lef, righ)){
        cout << n - 1;
        return 0;
    }
    cout << ans + k*2;
    return 0;
}


Measured memory_bytes: 512
import sys
sys.setrecursionlimit(10**9)

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()
def deb(text): print("-------\n{}\n-------".format(text))

class Counter:
    def __init__(self):
        self.dict = {}

    def add(self,x):
        if x in self.dict: self.dict[x] += 1
        else: self.dict[x] = 1

    def decrement(self,x):
        self.dict[x] -= 1
        if self.dict[x] <= 0:
            del self.dict[x]

    def get_dict(self):
        return self.dict


INF=10**20
def main():
    N,M=mi()
    A=list(mi())

    X = []
    for i in range(M):
        b,c=mi()
        X.append((c,b))
    
    X.sort(reverse=True)
    A.sort(reverse=True)

    xi = 0
    b = 0

    newA = []
    while A:
        if not xi < len(X): break
        
        if b == 0: c,b = X[xi]
        a = A.pop() # 小さい順に

        # print(a,b,c)
        if a < c:   
            newA.append(c)
        else:
            A.append(a)
            b = 0

        b -= 1 
        if b <= 0:
            xi += 1
    
    # print(A)
    # print(newA)
    print(sum(newA) + sum(A))
        

        




if __name__ == "__main__":
    main()

Measured memory_bytes: 95708
#pragma GCC optimize(3 , "Ofast" , "inline")

#include <bits/stdc++.h>

#define rep(i , a , b) for(register int i=(a);i<=(b);i++)
#define per(i , a , b) for(register int i=(a);i>=(b);i--)


using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int , int> pi;

template<class T>
inline void read (T &x) {
    x = 0;
    int sign = 1;
    char c = getchar ();
    while (c < '0' || c > '9') {
        if ( c == '-' ) sign = - 1;
        c = getchar ();
    }
    while (c >= '0' && c <= '9') {
        x = x * 10 + c - '0';
        c = getchar ();
    }
    x = x * sign;
}

const int maxn = 2e5 + 10;
const int inf = int (1e9);
const ll INF = ll (1e18);
const double PI = acos (- 1);
const int mod = 1e9+7;
const double eps = 1e-8;

map<string,int>mp;
char s[20];
int main () {
    int n;
    scanf ("%d",&n);
    int ma=0;
    rep (i,1,n) {
        scanf ("%s",s);
        int l = strlen (s);
        string t="";
        rep (i,0,l-1) {
            t=t+s[i];
        }
        mp[t]++;
    }
    for(auto x:mp) ma=max (ma,x.second);
    for(auto x:mp) {
        if(x.second==ma) {
            cout<<x.first<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 24448
# coding: utf-8
S = list(input())
ans = 0
c = ['1', '0']
tmp = S[0]
for i in range(1, len(S)):
    if S[i] == tmp:
        ans += 1
        tmp = c[int(S[i])]
    else:
        tmp = S[i]
print(ans)

Measured memory_bytes: 3956
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
/* clang-format off */
#define MOD 1000000007
#define INF 1000000000
#define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(a) (a).begin(), (a).end()
#define __DEBUG__
#ifdef __DEBUG__
#define CH_P(a) cout <<"check_point("<<#a<<")" << "\n";
#define DEBUG(x) cout<<#x<<":"<<x<<"\n"
#define DEBUGS(v) cout << #v << ":";for(auto x:v){cout<<x<<" ";}cout<<"\n"
#endif
#ifndef __DEBUG__
#define CH_P(a) 
#define DEBUG(x) 
#define DEBUGS(v) 
#endif
/* clang-format on */

ll n;

void dfs(vector<char> &a, ll v) {
  if (a.size() == n) {
    //処理
    // DEBUGS(a);
    REP(i, n) { cout << a[i]; }
    cout << endl;
    return;
  }
  if (a.empty()) {
    a.push_back('a');
    dfs(a, 1);
  } else {
    for (ll i = 0; i < v + 1; i++) {
      a.push_back('a' + i);
      dfs(a, max(v, i+1));
      a.pop_back();
    }
  }
}

int main() {
  cin >> n;
  vector<char> a;
  dfs(a, 0);
  return 0;
}


Measured memory_bytes: 3628
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;
ll const MOD = 1e9 + 7;

int main() {
  ll N;
  cin >> N;
  ll A;
  vector<ll> zero_cnt(65);
  for (int i = 0; i < N; i++) {
    cin >> A;
    for (int j = 0; j < 60; j++) {
      zero_cnt[j] += A % 2;
      A /= 2;
    }
  }
  ll ans = 0;
  ll base = 1;
  for (int i = 0; i < 60; i++) {
    ll sum = (zero_cnt[i] * (N - zero_cnt[i])) % MOD;
    sum = (sum * base) % MOD;
    ans = (ans + sum) % MOD;
    base = (base * 2) % MOD;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3632
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;

int main() {
    string s;
    cin >> s;

    int n = s.size();
    int i,j;
    i = 0;
    j = n-1;
    int ans = 0;
    while(j > i){
        int coui = 0, couj = 0;
        while(s[i] == 'x') {
            i++;
            coui++;
        }
        while(s[j] == 'x') {
            j--;
            couj++;
        }
        ans += abs(coui-couj);
        if(s[i] != s[j]) {
            cout << -1 << endl;
            return 0;
        }
        i++;
        j--;
    }

    cout << ans << endl;
}

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

int main() {
 int n;
 cin >> n;
 vector<int> a(n);
 rep(i,n) cin >>  a.at(i);

 sort(a.begin(),a.end());
 reverse(a.begin(),a.end());
 int sumA = 0, sumB = 0; 
 for(int i = 0; i < a.size(); i+=2){
   sumA+=a.at(i);
 }
 for(int i = 1; i < a.size(); i+=2){
   sumB+=a.at(i);
 }
 cout << sumA - sumB << endl;
 } 

Measured memory_bytes: 3596
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

#define ll long long
#define ull unsigned long long

using namespace std;

int main() {
	int A, B, C;
	cin >> A >> B >> C;



	bool ok = true;

	if (A != B){
		ok = false;
	}

	if (B != C){
		ok = false;
	}

	if (C != A){
		ok = false;
	}


	if (ok){
		cout << "Yes" << "\n";
	} else {
		cout << "No" << "\n";		
	}

	return 0;
}


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

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

template<typename H> void print(H head) { cout << head << '\n'; }
template<typename H, typename ...T> void print(H head, T ...tail) { cout << head << " "; print(tail...); }

int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(cin.failbit);

	int n; ll k; cin >> n >> k;
	vi a(n + 1);
	rep(i, 1, n + 1) cin >> a[i];

	int p = 1;
	rep(i, 0, 2 * n) {
		if (k > 0) {
			p = a[p];
			k--;
		}
	}

	if (!k) {
		cout << p << endl;
		return 0;
	}

	// find cycle length
	int l = 1;
	{
		int r = p;
		while (a[r] != p) l++, r = a[r];
	}

	k %= l;
	rep(i, 0, k) p = a[p];
	cout << p << endl;
}


Measured memory_bytes: 3992
N = int(input())
# (a * b * c) or (d * d * d * e)
# (a, b, c) = (3, 5, 7) -> 105
# (a, b, c) = (3, 5, 11) -> 165
# (a, b, c) = (3, 5, 13) -> 195
# (a, b, c) = (3, 5, 17) -> 255 out
# (a, b, c) = (3, 7, 11) -> 231 out
# (d, e) = (3, 5) -> 135
# (d, e) = (3, 7) -> 189
# (d, e) = (3, 11) -> 297 out
# (d, e) = (5, 3) -> 375 out
# therefore: 105, 135, 165, 189, 195

ans = [0, 105, 135, 165, 189, 195, 1000000000]
for i in range(6):
  if ans[i] <= N < ans[i + 1]:
    print(i)

Measured memory_bytes: 8984
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int A,B,C,D;
	cin >> A >> B >> C >> D;
	if(A+B>C+D){
		cout << "Left" << endl;
	}else if(A+B == C+D){
		cout << "Balanced" << endl;
	}else{
		cout << "Right" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} fast;
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
long long mod = 1000000007;
#define REP(i, n) for (long long i = 0; i < (n); i++)
#define rep(i, a, n) for (long long i = a; i < (n); i++)
long long modpow(long long m, long long n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2);
        return (t * t) % mod;
    } else {
        return (modpow(m, n - 1) * m) % mod;
    }
}

template <typename A, size_t N, typename T> void Fill(A (&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
// long long mod = 998244353;
long long power(long long m, long long n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2);
        return t * t;
    } else {
        return modpow(m, n - 1) * m;
    }
}

long long moddiv(long long a, long long b) { return (a * modpow(b, mod - 2)) % mod; }

const ll INF = 1LL << 60;

void print_binary(long long a) {
    for (int i = 31; i >= 0; i--) {
        cout << (a >> i & 1);
    }
    cout << endl;
}

ll nCkmod(ll n, ll k) {
    ll denomi = 1;
    for (int i = n; i > n - k; i--) {
        denomi *= i;
        denomi %= mod;
    }
    ll numera = 1;
    REP(i, k) {
        numera *= (i + 1);
        numera %= mod;
    }
    return moddiv(denomi, numera);
}
map<ll, ll> cnt;
void primeFactors(long long n) {
    while (n % 2 == 0) {
        cnt[2]++;
        n = n / 2;
    }
    for (int i = 3; i <= sqrt(n); i = i + 2) {
        while (n % i == 0) {
            cnt[i]++;
            n = n / i;
        }
    }
    if (n > 2) {
        cnt[n]++;
    }
}
int main() {
    ll n;
    cin >> n;
    vector<bool> sieve(100001);
    sieve[1] = true;
    for (int x = 2; x <= 100000; x++) {
        if (sieve[x]) continue;
        for (int u = 2 * x; u <= 100000; u += x) {
            sieve[u] = true;
        }
    }
    vector<int> rui(100000);
    rui[0] = 0;
    ll now = 0;
    rep(i, 1, 100000) {
        if (sieve[i] == false && sieve[(i + 1) / 2] == false) {
            now++;
        }
        rui[i] = now;
    }
    REP(i, n) {
        ll l, r;
        cin >> l >> r;
        cout << rui[r] - rui[l - 1] << endl;
    }
}

Measured memory_bytes: 3700
#include <iostream>
using namespace std;
int Max(int a, int b) {
    if (a >= b)
        return a;
    else return b;
}
int Min(int a, int b) {
    if (a <= b)
        return a;
    else return b;
}
int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    cout << Min(a, Min(b, c)) << " " << Max(a, Max(b, c)) <<endl;
}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main(){
    int s;
    cin >> s;

    int a, n, fn, flag = 0;
    if(s == 1 || s == 2 || s == 4){
        cout << 4 << endl;
        return 0;
    }

    for(int i=0;i<1000000;i++){
        if(i == 0){
            a = s;
            // cout << a << " ";
        }else{
            n = a;
            if(n%2 == 0)
                fn = n/2;
            else
                fn = 3*n + 1;
            a = fn;
            // cout << a << " ";
            if(a == 4){
                if(flag == 1){
                    cout << i+1 << endl;
                    return 0;
                }else{
                    flag = 1;
                }
            }
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;

int main() {
    int A, B, C, X, Y;
    cin >> A >> B >> C >> X >> Y;

    int ans = A * X + B * Y;
    ans = min(ans, C * 2 * X + max(0, Y - X) * B);
    ans = min(ans, C * 2 * Y + max(0, X - Y) * A);
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
#define REP2(i, n) for (Int i = 0, max_i = (n); i < max_i; i++)
#define REP3(i, a, b) for (Int i = (a), max_i = (b); i < max_i; i++)
#define OVERLOAD2(_1, _2, _3, name, ...) name
#define REP(...) OVERLOAD2(__VA_ARGS__, REP3, REP2)(__VA_ARGS__)
template <class T> inline bool chmax(T& a, const T& b) {
    if (a >= b) return false;
    a = b;
    return true;
}
template <class T> inline bool chmin(T& a, const T& b) {
    if (a <= b) return false;
    a = b;
    return true;
}
struct in {
    int n;
    in() {}
    in(int n_) : n(n_){};
    template <class T> operator T() {
        T ret;
        cin >> ret;
        return ret;
    }
    template <class T> operator vector<T>() {
        vector<T> ret(n);
        for (int i = 0; i < n; i++) cin >> ret[i];
        return ret;
    }
};
struct SetupIO {
    SetupIO() { cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(20); }
} setup_io;

#ifdef _MY_DEBUG
#include "/Users/knshnb/.competitive_local.hpp"
#else
#define dump(...)
#endif

/**
 *    author:  knshnb
 *    created: Sat Dec 28 21:00:13 JST 2019
 **/

signed main() {
    Int n = in(), a = in(), b = in();
    a--, b--;
    Int ans = min(b, n - 1 - a);
    if ((b - a) % 2 == 0) {
        chmin(ans, (b - a) / 2);
    } else {
        chmin(ans, n - 1 - b + 1 + (b - a) / 2);
        chmin(ans, a + 1 + (b - a) / 2);
    }
    cout << ans << endl;
}


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

int main() {
  string s, t="CODEFESTIVAL2016";
  cin >> s;
  int ans=0;
  for ( int i=0; i<t.size(); i++ ) {
    if ( s[i]!=t[i] ) ans++;
  }
  cout << ans;
  return 0;
}


Measured memory_bytes: 3600
#include <iostream>
#include <string>
using namespace std;
#define r(i,n) for(int i=0;i<n;i++)


int main() {
  int n,sum=0;
  r(i,3){
    cin>>n;
    sum+=n;
  }
  if(sum<22)cout<<"win"<<endl;
  else cout<<"bust"<<endl;
  
return 0;
}


Measured memory_bytes: 256
#include<iostream>

int main() {
	int n;
	std::cin >> n;

	bool can = false;
	for (int i{}; i < n / 4 + 1; ++i)
		if ((n - i * 4) % 7 == 0) {
			can = true;
			break;
		}
	
	std::cout << (can ? "Yes" : "No") << "\n";

	return 0;
}

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

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

	int N = scan.nextInt();
	int x = scan.nextInt();

	int[] a_ = new int[N];
	for(int i = 0; i < N; i++){
	    a_[i] = scan.nextInt();
	}

	Arrays.sort(a_);

	int ans = 0;
	for(int i = 0; i < N; i++){
	    x -= a_[i];
	    if(x < 0){
		break;
	    }else{
		ans++;
	    }
	}

	if(x > 0){
	    ans--;
	}
	System.out.println(ans);
    }
}

	    
	


Measured memory_bytes: 21844
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);
		//入力表示

		int T =sc.nextInt();
		int X = sc.nextInt();
		
		double ans=(double)T/X;
			System.out.printf("%.10f",ans);
	}
}

Measured memory_bytes: 27264
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    s=input()
    a=s.find("A")
    z=s.rfind("Z")
    print(z-a+1)
    

main()


Measured memory_bytes: 39920
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main (){
	string str;
	cin >> str;
	vector<char> a(str.size());
	for (int i =0;i<str.size();i++){
		a[i] = str[i];
	}
	int count = 0;
	int min = 1000000;
	for(int i=0; i < str.size();i++){
		if(i ==0){
			if(a[0] == '1'){
				a[0] = '0';
				count++;
			}
		}
		else {
			if(a[i-1] == a[i]){
				if(a[i] == '0'){
					a[i] = '1';
					count++;
				}else if (a[i] == '1'){
					a[i] = '0';
					count++;
				}
			}
		}
	}
	min =count;
	count =0;
	for (int i =0;i<str.size();i++){
		a[i] = str[i];
	}
	
	for(int i=0; i < str.size();i++){
		if(i ==0){
			if(a[0] == '0'){
				a[0] = '1';
				count++;
			}
		}
		else {
			if(a[i-1] == a[i]){
				if(a[i] == '0'){
					a[i] = '1';
					count++;
				}else {
					a[i] = '0';
					count++;
				}
			}
		}
	}
	if (min > count){
	min = count;
	}

	cout << min << endl;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define REP(i,a,b) for(register int i=a;i<=b;++i)
#define DREP(i,a,b) for(register int i=a;i>=b;--i)
using namespace std;
const int maxn=1e6+10;
long long n,m,a[maxn],b[maxn],cnt;
int main(){
/*#ifndef ONLINE_JUDGE
	freopen("A.in","r",stdin);
	freopen("A.out","w",stdout);
#endif*/
	scanf("%lld%lld",&n,&m);
	REP(i,1,n)scanf("%lld%lld",&a[i],&b[i]);
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	int i=n;
	while(b[i]>=a[n] && m>0){m-=b[i];i--;cnt++;}
	if(m>0)cnt+=ceil(m*1.0/a[n]);
	cout<<cnt<<endl;
	return 0;
}


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

int main(){
	long m, f, r;
	while (cin){
		cin >> m >> f >> r;
		if (m == -1 && f == -1 && r == -1) break;
		if (m == -1 || f == -1) cout << "F" << endl;
		else if (m + f >= 80) cout << "A" << endl;
		else if (m + f >= 65 && m + f < 80) cout << "B" << endl;
		else if (m + f >= 50 && m + f < 65) cout << "C" << endl;
		else if (m + f >= 30 && m + f < 50){
			if (r >= 50) cout << "C" << endl;
			else cout << "D" << endl;
		}
		else if (m + f >= 0 && m + f < 30) cout << "F" << endl;
	}
	return 0;
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
#define DIV 998244353

using namespace std;

long a[301];
long dp1[301][90001];
long dp2[301][90001];

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

    dp1[0][0] = 1;
    dp2[0][0] = 1;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < sum; ++j) {
            if (dp1[i][j] != 0) {
                dp1[i + 1][j] = (dp1[i + 1][j] + dp1[i][j] * 2) % DIV;
                dp1[i + 1][j + a[i]] = (dp1[i + 1][j + a[i]] + dp1[i][j]) % DIV;
            }
            if (dp2[i][j] != 0) {
                dp2[i + 1][j] = (dp2[i + 1][j] + dp2[i][j]) % DIV;
                dp2[i + 1][j + a[i]] = (dp2[i + 1][j + a[i]] + dp2[i][j]) % DIV;
            }
        }
    }
    long answer = 1;
    for (int i = 0; i < n; ++i) {
        answer = answer * 3 % DIV;
    }
    for (int i = sum; i > (sum - 1) / 2; --i) {
        long sub = dp1[n][i];
        if (i * 2 == sum) {
            sub -= dp2[n][i];
        }
        answer = (answer - 3 * sub) % DIV;
    }
    if (answer < 0) answer += DIV;
    cout << answer << endl;
}


Measured memory_bytes: 421504
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define mod 1000000007
#define INF2 9999999999
#define INF (1 << 30)
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)

using namespace std;
using ll = __int64_t;

int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
int DX[] = {1, 1, 0, -1, -1, -1, 0, 1};
int DY[] = {0, -1, -1, -1, 0, 1, 1, 1};

void solve(){
    int n, res=0;
    int v[50], c[50];

    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> v[i];
    }
    for(int i = 0; i < n; i++){
        cin >> c[i];
    }
    for(int i = 0; i < n; i++){
        res += max(v[i]-c[i], 0);
    }
    cout << res << endl;
}

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

Measured memory_bytes: 256
S = input()

op = [0]*3
tmp = [0]*4
for i in range(2):
    tmp[0] = int(S[0])
    if i == 0:
        tmp[1] = int(S[1])
        op[0] = '+'
    else:
        tmp[1] = -int(S[1])
        op[0] = '-'
    for j in range(2):
        if j == 0:
            tmp[2] = int(S[2])
            op[1] = '+'
        else:
            tmp[2] = -int(S[2])
            op[1] = '-'
        for k in range(2):
            if k == 0:
                tmp[3] = int(S[3])
                op[2] = '+'
            else:
                tmp[3] = -int(S[3])
                op[2] = '-'
            if sum(tmp) == 7:
                print(S[0] + op[0] + S[1] + op[1] + S[2] + op[2] + S[3] + '=7')

                exit()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()




int main(){
    int h,w,k; cin>>h>>w>>k;
    int ans=0;
    vector<string> p(h);
    rep(i,h) cin>>p[i];
    rep(i,1<<h){
        vector<int> hh(h,0);
        rep(j,h){
            if(i>>j&1) hh[j]=1;
        }
        rep(j,1<<w){
            vector<int> ww(w,0);
            rep(k,w){
                if(j>>k&1) ww[k]=1;
            }
            int kari=0;
            rep(k,h){
                rep(l,w){
                    if(p[k][l]=='#' && hh[k]==0 && ww[l]==0) kari++;
                }
            }
            if(kari==k) ans++;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3632
#include<iostream>
#include<vector>
#include<string>

using namespace std;

int main() {
	long long a, b, x, ans = 0;
	cin >> a >> b >> x;
	long long t1 = b / x;
	long long t2 = a / x - !(a%x);
	cout << t1 - t2 << endl;
}

Measured memory_bytes: 256