akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <queue>
#include <cassert>
#include <iomanip>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const int iINF = 1001001001;
const long long llINF = 1LL << 60;
int main()
{
    int n, x, t; cin >> n >> x >> t;
    int ans = ceil(double(n) / x) * t;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3628
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
using namespace std;

map<long long, int> prime_factorize(long long n) {
    map<long long, int> res;
    for (long long p = 2; p * p <= n; ++p) {
        while (n % p == 0) { ++res[p]; n /= p; }
    }
    if (n != 1) res[n] = 1;
    return res;
}

int main() {
    int n; cin >> n;
    vector<int> cnt(n + 1);
    for (int i = 1; i <= n; i++) {
        for (auto &p: prime_factorize(i)) cnt[p.first] += p.second;
    }
    int ans = 0;
    for (int i = 1; i <= n; i++) if (cnt[i] >= 74) ans++;
    for (int i = 1; i <= n; i++) if (cnt[i] >= 2) {
        for (int j = 1; j <= n; j++) if (i != j && cnt[j] >= 24) ans++;
    }
    for (int i = 1; i <= n; i++) if (cnt[i] >= 4) {
        for (int j = 1; j <= n; j++) if (i != j && cnt[j] >= 14) ans++;
    }
    for (int i = 1; i <= n; i++) if (cnt[i] >= 2) {
        for (int j = 1; j <= n; j++) if (i != j && cnt[j] >= 4) {
            for (int k = j + 1; k <= n; k++) if (i != k && cnt[k] >= 4) ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
// -----------------------------------
// Author     : MatsuTaku
// Affiliation: Tokushima University
// Country    : Japan
// Date       : 03/29/2020
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

  int D,N; cin>>D>>N;
  int ans = pow(100, D)*N;
  if (N == 100)
    ans += pow(100, D);
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
/*******************************
Author:Morning_Glory
LANG:C++
Created Time:2019年09月01日 星期日 20时05分18秒
*******************************/
#include <cstdio>
#include <fstream>
using namespace std;
int ans;
char s[5],t[5];
int main()
{
	scanf("%s%s",s,t);
	for (int i=0;i<3;++i)	ans+=s[i]==t[i];
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 128
K = int(input())
nums = [int(e) for e in input().split()]

if nums[0]%K == 0:
    l = nums[0]//K
    m = nums[1]//K
else:
    l = nums[0]//K + 1
    m = nums[1]//K

if l <= m:
    print('OK')
else:
    print('NG')

Measured memory_bytes: 9192
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <functional>
#include <algorithm>
using namespace std;

typedef long long ll;

int days[2][12] = {
    {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
    {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
};

int main()
{
    int y1, m1, d1, y2, m2, d2;
    while(cin >> y1 >> m1 >> d1 >> y2 >> m2 >> d2 && y1 != -1) {
        int ret = 0, m = m1, y = y1;
        for(;;) {
            int f;
            if(y % 4 == 0) {
                if(y % 100 == 0) {
                    if(y % 400 == 0) {
                        f = 1;
                    } else {
                        f = 0;
                    }
                } else {
                    f = 1;
                }
            } else {
                f = 0;
            }
            
            if(y == y2 && m == m2) {
                ret += d2 - d1;
                break;
            } else {
                ret += days[f][m - 1];
            }
            
            if(m == 12) {
                y++; m = 1;
                continue;
            } else {
                m++;
            }
            
        }
        cout << ret << endl;
    }
}

Measured memory_bytes: 0
import std.stdio, std.conv, std.array, std.string;
import std.algorithm;
import std.container;
import std.range;
import core.stdc.stdlib;
import std.math;

void main() {
  long M1, D1; readf("%d %d\n", &M1, &D1);
  long M2, D2; readf("%d %d\n", &M2, &D2);
  
  writeln(M1 == M2 ? "0" : "1");
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet};

mod util {
    use std::io::stdin;
    use std::str::FromStr;
    use std::fmt::Debug;

    #[allow(dead_code)]
    pub fn line() -> String {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    }

    #[allow(dead_code)]
    pub fn get<T: FromStr>() -> T
        where <T as FromStr>::Err: Debug
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().parse().unwrap()
    }

    #[allow(dead_code)]
    pub fn gets<T: FromStr>() -> Vec<T>
        where <T as FromStr>::Err: Debug
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|t| t.parse().unwrap())
            .collect()
    }
}

fn main() {
    let nm: Vec<i64> = util::gets();
    let n = nm[0];
    let m = nm[1];

    if (n - m).abs() > 1 {
        println!("0");
    } else {
        let modulo = 1_000_000_000 + 7;
        let pn = (1..n + 1).fold(1, |acc, x| (acc * x) % modulo);
        let pm = (1..m + 1).fold(1, |acc, x| (acc * x) % modulo);

        let mut a = (pn * pm) % modulo;

        if n == m {
            a = (a * 2) % modulo;
        }

        println!("{}", a);
    }
}


Measured memory_bytes: 4352
#include<iostream>
#include<stdio.h>
using namespace std;


int main(){
    
    while(1){
        int a, b;
        char op;
        cin >> a >> op >> b;
        if(op == '+'){
            cout << a + b << endl;
        }else if(op == '-'){
            cout << a - b << endl;
        }else if(op == '*'){
            cout << a * b << endl;
        }else if(op == '/'){
            if(b == 0) continue;
            cout << a / b << endl;
        }else{
            break;
        }
    }
    
    return 0;
}

Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
using ll = unsigned long long;

int lcd(int a, int b) {
  if (a < b) {
    swap(a, b);
  }
  if (b == 0) {
    return a;
  } else {
    return lcd(b, a % b);
  }
}


int main() {
  int N;
  cin >> N;
  int result = 0;
  vector<int> A(N), B(N), C(N);
  for (int i = 0; i < N; ++i) {
    cin >> A[i];
  }
  for (int i = 0; i < N; ++i) {
    cin >> B[i];
  }
  for (int i = 0; i < N - 1; ++i) {
    cin >> C[i];
  }
  
  for (int i = 0; i < N; ++i) {
    int ai = A[i];
    result += B[ai - 1];
    if (A[i - 1] + 1 == A[i]) {
      result += C[ai - 2];
    }
  }
  cout << result << endl;
}

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

using namespace std;

int main(){
    int n,m,c,count = 0;
    cin >> n >> m >> c;
    vector<int>b(m);
    vector<vector<int>>a(n,vector<int>(m));

    for(int i = 0;i < m;i++)
        cin >> b[i];
    for(int i = 0;i < n;i++){
        int sum = 0;
        for(int j = 0;j < m;j++){
            cin >> a[i][j];
            sum += a[i][j]*b[j];
        }
        if(sum>c*-1)count++;
    }

    cout << count << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) begin(x), end(x)
using namespace std;
using ll = long long;
template <typename T> using V = vector<T>;
constexpr int Mod = 998244353;
constexpr int mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;
template <typename T> constexpr bool chmax(T &a, const T &b) {
    if(a >= b) return false;
    a = b;
    return true;
}
template <typename T> constexpr bool chmin(T &a, const T &b) {
    if(a <= b) return false;
    a = b;
    return true;
}

/*-------------------------------------------*/

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

    int n;
    cin >> n;
    string s;
    set<string> st;
    rep(i, n) {
        cin >> s;
        st.insert(s);
    }
    cout << st.size() << endl;

    return 0;
}

Measured memory_bytes: 19236
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
const int MaxN = 1e5;
typedef long long LL;
using namespace std;
int n ;
LL a[MaxN + 5]  , sum[MaxN + 5] , Max = 0;
int main()
{
	while(~scanf("%d" , &n)){
		Max = 0;
		for(int i = 1;i <= n;i++) scanf("%lld" , &a[i]);
		sort(a + 1 , a + n + 1);
		for(int i = 1;i <= n;i++) sum[i] = sum[i - 1] + a[i];
		LL ans = 1;
		for(int i = 2;i <= n;i++){
			if(a[i] <= 2LL * sum[i - 1]) ans++;
			else ans = 1;
		}
		printf("%lld\n" , ans);
	}
}

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

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

	bool isUnbalance= false;

	int left;
	int right;

	for(int i=0; i<s.size()-1; i++)
		if(s[i]==s[i+1])
			isUnbalance=true, left=i, right= i+1;

	for(int i=0; i<s.size()-2; i++)
		if(s[i]==s[i+2])
			isUnbalance=true, left=i, right= i+2;

	if(isUnbalance)
		std::cout<<left+1<<" "<<right+1<<std::endl;
	else
		std::cout<<-1<<" "<<-1<<std::endl;

	return 0;
	
}

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

#define vi push_back
#define vo pop_back
#define mp make_pair
#define fe first
#define se second
typedef long long ll;

const int MXN = 1e2 + 10;

int h, w, n, Colors[MXN * MXN], Square[MXN][MXN];
bool CheckFlag;

void Input () {
    cin >> h >> w >> n;
    for (int i = 1; i <= n; i++)
        cin >> Colors[i];
}

int ColorToUse (int x) {
    for (int i = x; i <= n; i++)
        if (Colors[i] > 0)
            return i;
    return 0;
}

bool Check (int i, int j) {
    if (!CheckFlag)
        return i < h && j < w;
    return i >= 0 && j < w;
}

int Con () {
    if (!CheckFlag)
        return h - 1;
    return 0;
}

void Solve () {
    int clr = ColorToUse(1), d = 1, s = 0, j = 0;
    for (int i = s; Check(i, j); i += d) {
        Square[i][j] = clr;
        Colors[clr]--;
        clr = ColorToUse(clr);
        if (i == Con()) {
            j++;
            i = Con();
            if (!CheckFlag)
                i++;
            else
                i--;
            d *= -1;
            CheckFlag ^= 1;
        }
    }
}

void Output () {
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cout << Square[i][j] << ' ';
        }
        cout << endl;
    }
}

int main () {
    Input();
    Solve();
    Output();
    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll H,W;
    cin >>H>>W;
    vector<vector<char>>ans(H+2,vector<char>(W+2,'#'));

    rep2(i,H){
        rep2(j,W){
            cin>>ans[i][j];
        }
    }

    rep(i,H+2){
        rep(j,W+2){
            cout<<ans[i][j];
        }
        cout<<endl;
    }



    return 0;
    

}

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

static const int N = 36;

void bubbleSort(char a[][3], int n) {
    int flag = 1;

    for (int i = 0; flag; i++) {
        flag = 0;
        for (int j = n - 1; j > i; j--) {
            if (a[j][1] < a[j-1][1]) {
                swap(a[j], a[j-1]);
                flag = 1;
            }
        }
    }
}

void selectionSort(char a[][3], int n) {
    for (int i = 0; i < n; i++) {
        int min = i;
        for (int j = i + 1; j < n; j++) {
            if (a[j][1] < a[min][1]) {
                min = j;
            }
        }
        if (min != i) {
            swap(a[min], a[i]);
        }
    }
}

void output(char a[][3], int n) {
    for (int i = 0; i < n; i++) {
        if (i > 0) {
            cout << ' ';
        }
        cout << a[i][0] << a[i][1];
    }
    cout << endl;
}

bool isStable(char a[][3], char b[][3], int n) {
    for (int i = 0; i < n; i++) {
        if (a[i][0] != b[i][0] || a[i][1] != b[i][1]) {
            return false;
        }
    }
    return true;
}

int main() {
    char a[N][3], b[N][3];
    int n;

    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        b[i][0] = a[i][0];
        b[i][1] = a[i][1];
    }

    bubbleSort(a, n);
    output(a, n);
    cout << "Stable" << endl;

    selectionSort(b, n);
    output(b, n);
    if (isStable(a, b, n)) {
        cout << "Stable" << endl;
    } else {
        cout << "Not stable" << endl;
    }

    return 0;
}



Measured memory_bytes: 3100
def main():
    N, A, B = (int(i) for i in input().split())
    if (B - A) % 2 == 0:
        print((B-A)//2)
    else:
        cur = min(B-1, N-A)
        if A - 1 >= N - B:
            cur2 = (N - B)*2 + 1
            A += (N - B)*2 + 1
            cur2 += (B-A)//2
            print(min(cur, cur2))
        else:
            cur2 = (A - 1)*2 + 1
            B -= (A - 1)*2 + 1
            cur2 += (B-A)//2
            print(min(cur, cur2))


if __name__ == '__main__':
    main()


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

int main() {
  int n;
  double S = 0;
  cin >> n;
  vector<double> v(n);
  for(int i = 0;i < n;i++) {
    cin >> v[i];
    v[i] = 1 / v[i];
    S += v[i];
  }
  cout << fixed << setprecision(9) << 1 / S << endl;
}

Measured memory_bytes: 3812
import java.util.Scanner;
class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] a = new int[n];
        for(int i=0;i<n;++i)a[i]=scan.nextInt();
        long[] fsum = new long[n];
        long[] bsum = new long[n];
        fsum[0]=a[0];bsum[n-1]=a[n-1];
        for(int i=1;i<n;++i)fsum[i]=fsum[i-1]+a[i];
        for(int i=n-2;i>=0;--i)bsum[i]=bsum[i+1]+a[i];
        long ans = Long.MAX_VALUE;
        for(int i=2;i<=n-2;++i){
            // [0, i-1] [i, n-1]
            int left = 0;
            int right =i-1;
            while(right-left>1){
                int center = (left+right)/2;
                if(fsum[center]*2 > fsum[i-1])right=center;
                else left=center;
            }
            if(right==i-1)--right;


            int l2 = i;
            int r2 = n-1;
            while(r2-l2>1){
                int c = (l2+r2)/2;
                if(bsum[c]*2 > bsum[i])l2 = c;
                else r2=c;
            }
            if(l2==i)++l2;

            long P1 = fsum[left], Q1 = fsum[i-1]-fsum[left];
            long P2 = fsum[right], Q2 = fsum[i-1]-fsum[right];
            long R1 = bsum[l2], S1 = bsum[i] - bsum[l2];
            long R2 = bsum[r2], S2 = bsum[i] - bsum[r2];
            long PQ1max = Math.max(P1, Q1);
            long PQ1min = Math.min(P1, Q1);
            long PQ2max = Math.max(P2, Q2);
            long PQ2min = Math.min(P2,Q2);
            long RS1max = Math.max(R1,S1);
            long RS1min = Math.min(R1,S1);
            long RS2max = Math.max(R2,S2);
            long RS2min = Math.min(R2,S2);
            ans = Math.min(ans, Math.max(PQ1max, RS1max) - Math.min(PQ1min, RS1min));
            ans = Math.min(ans, Math.max(PQ1max, RS2max) - Math.min(PQ1min, RS2min));
            ans = Math.min(ans, Math.max(PQ2max, RS1max) - Math.min(PQ2min, RS1min));
            ans = Math.min(ans, Math.max(PQ2max, RS2max) - Math.min(PQ2min, RS2min));
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 85572
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (ll)n; ++i)
#define INF 10e12
#define MOD 1000000000 + 7
#define MAX 51000
#define all(x) (x).begin(), (x).end()
#define MX(x) *max_element(all(x))
#define MN(x) *min_element(all(x))

using namespace std;

int main(void)
{
    int n, m;
    map<string, int> a;
    map<string, int> b;
    cin >> n;
    rep(i, n)
    {
        string tmp;
        cin >> tmp;
        a[tmp]++;
    }
    cin >> m;
    rep(i, m)
    {
        string tmp;
        cin >> tmp;
        b[tmp]++;
    }
    int ans = 0;
    for (auto i : a)
        ans = max(ans, i.second - b[i.first]);
    cout << ans << endl;
}


Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
int main () {
  long N, K;
  cin >> N >> K;
  vector<long> data(N);
  for(int i = 0; i < N; i++)cin >> data.at(i);
  for(int i = 0; i < N - K; i++){
    if(data.at(i) < data.at(i + K))cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 4840
#include<iostream>
#include<vector>
#include<algorithm>

int main(void)
{
  std::vector<int> ans(3);
  std::cin >> ans[0];
  std::cin >> ans[1];
  std::cin >> ans[2];
  
  std::sort(ans.begin(), ans.end());
  std::cout << ans[1] + ans[0] << std::endl;
  
  return 0;
}
  
  

Measured memory_bytes: 256
package main

import (
    "fmt"
    "bufio"
    "os"
)

func main(){
    r := bufio.NewReader(os.Stdin)
    var a, b, c int
    
    fmt.Fscan(r, &a, &b, &c)
    
    if a<=b && b<=c {
        fmt.Printf("%v %v %v\n",a,b,c)
    } else if a<=c && c<b {
        fmt.Printf("%v %v %v\n",a,c,b)
    } else if b<a && a<=c {
        fmt.Printf("%v %v %v\n",b,a,c)
    } else if b<=c && c<a {
        fmt.Printf("%v %v %v\n",b,c,a)
    } else if c<a && a<=b {
        fmt.Printf("%v %v %v\n",c,a,b)
    } else {
        fmt.Printf("%v %v %v\n",c,b,a)
    }

}



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

int main() {
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  a = a+b;
  c = c+d;
  if(a > c){
    cout << "Left" << endl;
  }
  else if(a == c){
    cout << "Balanced" << endl;
  }
  else{
    cout << "Right" << endl;
  }
}


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

#define all(s) s.begin(), s.end()
#define vi vector<int>
#define pb push_back
#define ii pair<int, int>
#define x first
#define y second

int main() {
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int n, k;
    cin >> n >> k;
    if (n >= 10) cout << k;
    else cout << k + 100 * (10 - n);
    return 0;
}

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

void func150b() {
  int n, ans = 0;
  string s;
  string keyWord = "ABC";

  //しーいんキーボードからの入力受け
  cin >> n >> s;
  //長さ-3まで
  for (int i = 0; i <= n - 3; i++) {
    if (s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C') ans++;
  }
  cout << ans << endl;
}

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

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



int main(void) {
  int w,h,n;
  cin >> w >> h >> n;
  vector<vector<bool>> a(w,vector<bool>(h,true));
  int ans = w*h;
  rep(i,n){
    int p,q,r;
    cin >> p >> q >> r;
    
    
    if(r==1){
      rep(j,p){
        rep(k,h){
          if(a[j][k]) {
            ans--;
            a[j][k] = false;
          }
        }
      }
    }
    if(r==2){
      rep2(j,p,w){
        rep(k,h){
          if(a[j][k]) {
            ans--;
            a[j][k] = false;
            
          }
        }
      }
    }
    if(r==3){
      rep(j,q){
        rep(k,w){
          if(a[k][j]) {
            ans--;
            a[k][j] = false;
          }
        }
      }
    }
    if(r==4){
      rep2(j,q,h){
        rep(k,w){
          if(a[k][j]){
            ans--;
            a[k][j] = false;
          }
        }
      }
    }
    //cout << i << " " <<  ans << endl;
  }
    cout << ans << endl;
                         
}


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

int main() {
	int n;
	while(cin >> n, n) {
		int item;
		string name;
		map<string, int> items;
		for(int i = 0; i < n; ++i) {
			cin >> name >> item;
			items.insert(map<string, int>::value_type(name, item));
		}

		int m;
		cin >> m;
		for(int i = 0; i < m; ++i) {
			int k, sum = 0;
			string o;
			cin >> o >> k;
			for(; k > 0; --k) {
				string q;
				cin >> q;
				sum += items[q];
			}
			items[o] = min(items[o], sum);
		}

		string ans;
		cin >> ans;
		cout << items[ans] << endl;
	}
}

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

public class Main implements Runnable { //Runnableを実装する
    public static void main(String[] args) {
        new Thread(null, new Main(), "", 64 * 1024 * 1024).start(); //16MBスタックを確保して実行
    }

    public void run() {
        //ここに処理を書く
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int[]s = {a,b,c};
        Arrays.sort(s);
        System.out.println(s[2]*10+s[1]+s[0]);
    }
}


Measured memory_bytes: 25940
#include <iostream>

using namespace std;

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

    long long res = 0LL;
    for (long long i = (a & 3); i <= ((a & 3) <= (b & 3) ? (b & 3) : (4 + (b & 3))); i++) {
        res ^= (i & 1LL);
    }

    for (int i = 1; (1LL << i) <= 1000000000000LL; i++) {
        long long s_i = (1LL << i);
        long long s_i_m1 = s_i - 1;

        long long ai = ((a & s_i) == 0 ? 0 : s_i - (a & s_i_m1));
        long long bi = ((b & s_i) == 0 ? 0 : (b & s_i_m1) + 1);

        res |= ((ai + bi) % 2 == 0 ? 0 : s_i);
    }

    cout << res << 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 N;cin >> N;
    int sum =0;
    vector<int> d(N);

    rep(i,N){
        cin >> d[i];
    }

    for(int i=0; i<N-1; i++){
        for(int j=i+1; j<N; j++){
            sum+= d[i]*d[j];
        }
    }

    cout << sum << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
vector<int> v[222222];
int k[222222];
void dfs(int p,int father)
{
	for(int i=0;i<v[p].size();i++)
	{
		if(v[p][i]==father)
		  continue;
		k[v[p][i]]+=k[p];
		dfs(v[p][i],p);
	}
}
int main()
{
  int n,q;
  cin>>n>>q;
  for(int i=0;i<n-1;i++)
  {
  	int a,b;
  	cin>>a>>b;
  	v[a].push_back(b);
  	v[b].push_back(a);
  }
  for(int i=0;i<q;i++)
  {
  	int a,b;
  	cin>>a>>b;
  	k[a]+=b;
  }
  dfs(1,0);
  for(int i=1;i<=n;i++)
    cout<<k[i]<<" ";
  return 0;
}

Measured memory_bytes: 27136
import java.util.Scanner;

public class Main {
   public static void main(String[] args) {
      Scanner scan = new Scanner(System.in);
      int W = scan.nextInt();
      int H = scan.nextInt();
      int x = scan.nextInt();
	  int y = scan.nextInt();
	  int r = scan.nextInt();

      if(
	     (x + r > W) || 
		 (y + r > H) ||
		 (x - r < 0) ||
		 (y - r < 0)
      ) {
		   System.out.println("No");
	  } else {
		   System.out.println("Yes");
	  }
   }
}



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

typedef long long ll;

int main(){
    int n, k; cin >> n >> k;
    int arr[n];
    for(int i=0; i<n; i++) cin >> arr[i];
    int dp[n+1];
    dp[0] = 0;
    //dp[1] = abs(arr[1] - arr[0]);
    for(int i=1; i<n; i++){
        dp[i] = INT_MAX;
        for(int j=1; j<=k; j++){
            if(i-j >= 0){
                dp[i] = min(dp[i], dp[i-j] + abs(arr[i]-arr[i-j]));
            }
        }
        //dp[i] = min(dp[i-2] + abs(arr[i] - arr[i-2]), dp[i-1] + abs(arr[i] - arr[i-1]));
    }
    cout << dp[n-1] << endl;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <queue>
using namespace std;
int n,m,p;
int sx,sy;
char s[1505][1505];
struct node{
	int x,y,step;
	node(int sx,int sy,int step)
	{
		this->x=sx;this->y=sy;this->step=step;
	}
};
int dx[4]={0,0,-1,1};
int dy[4]={1,-1,0,0};
int vis[1505][1500];
node bfs(node u,int pos)
{
	queue<node> q;
	while(!q.empty())q.pop();
	q.push(u);
	
	while(!q.empty())
	{
		node v=q.front();q.pop();
		if(s[v.x][v.y]==pos+'0') return v;
		for(int i=0;i<4;i++)
		{
			int x=v.x+dx[i];
			int y=v.y+dy[i];
			if(x>=1&&x<=n&&y>=1&&y<=m&&s[x][y]!='X'&&vis[x][y]==0)
			{
				vis[x][y]=1;
				node now=node(x,y,v.step+1);
				q.push(now);
			}
		}
	}
}
int main()
{
	while(cin>>n>>m>>p)
	{
		int ans=0;
		for(int i=1;i<=n;i++)
		{
			cin>>s[i]+1;
			for(int j=1;j<=m;j++)
			{
				if(s[i][j]=='S') sx=i,sy=j;
			}
		}
		node u=node(sx,sy,0);	
		for(int i=1;i<=p;i++)
		{		
			memset(vis,0,sizeof(vis));
			vis[u.x][u.y]=1;
			u=bfs(u,i);
			ans+=u.step;
			u.step=0;
		}
		cout<<ans<<endl;
	}
	return 0;
}


Measured memory_bytes: 13416
n1 = int(input())
s = (input()).split()
n2 = int(input())
t = (input()).split()
m = []

for i in range(0, n2):
      left = 0
      right = n1
      key = int(t[i])
      while left < right:
            mid = int((left + right)/2)
            if int(s[mid]) == key:
                  m.append(key)
                  break
            elif key < int(s[mid]):
                  right = mid
            else:
                  left = mid + 1

print(len(m))

Measured memory_bytes: 19272
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mk make_pair
#define mod 1000000007
int main(){
  int d,t,s;
  cin>>d>>t>>s;
  if(d<=(t*s)){
    cout<<"Yes"<<endl;
  }
  else
     cout<<"No"<<endl;
}

Measured memory_bytes: 3580
#include <stdio.h>

int main()
{
int c,omosa,keisu,i,x;
  scanf("%d",&keisu);
  scanf("%d",&c);
  scanf("%d",&omosa);
  for(i=0;i<=9;i++){
    x = keisu*omosa-c;
    omosa=x;
    printf("%d\n",x);
  }
  return 0;
  
}

Measured memory_bytes: 128
<?php
list($A, $B, $C) = explode(" ", trim(fgets(STDIN)));

$count = 0;

$a = $A;
$b = $B;
$c = $C;

while ($a % 2 == 0 && $b % 2 == 0 && $c % 2 == 0) {
    if ($count != 0 && ($a == $A && $b == $B && $c == $C)) {
        $count = -1;
        break;
    }
    $ta = $a;
    $tb = $b;
    $tc = $c;

    $count++;
    $a = ($tb + $tc) / 2;
    $b = ($tc + $ta) / 2;
    $c = ($ta + $tb) / 2;

}

echo $count;

Measured memory_bytes: 4728
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <vector>

using namespace std;

typedef long long lint;

int main() {
  int n, k, mod;
  scanf("%d %d %d", &n, &k, &mod);

  const int lim = n + 1;
  vector<vector<int>> binom(lim + 1, vector<int>(lim + 1));
  for (int a = 0; a <= lim;  ++a)
    binom[a][0] = binom[a][a] = 1;
  for (int a = 0; a <= lim; ++a)
    for (int b = 1; b < a; ++b) {
      binom[a][b] = binom[a - 1][b] + binom[a - 1][b - 1];
      if (binom[a][b] >= mod) binom[a][b] -= mod;
    }

  vector<vector<int>> dp(n + 2, vector<int>(k + 1));
  vector<vector<int>> dp_sum(n + 2, vector<int>(k + 2));

  for (int size = 1; size <= n + 1; ++size) {
    if (size == 1) {
      for (int rv = 0; rv <= k; ++rv)
        dp[size][rv] = 1;
    } else {
      for (int rv = 0; rv <= k; ++rv) {
        int &res = dp[size][rv];
        res = 0;
        for (int size2 = 1; size2 <= size - 1; ++size2) {
          res = (res +
                 (lint)binom[size - 2][size2 - 1] *
                 (dp_sum[size2][k + 1] - dp_sum[size2][rv + 1] + mod) % mod *
                 dp[size - size2][rv]) % mod;
        }
      }
    }
    dp_sum[size][0] = 0;
    for (int rv = 0; rv <= k; ++rv) {
      dp_sum[size][rv + 1] = dp_sum[size][rv] + dp[size][rv];
      if (dp_sum[size][rv + 1] >= mod) dp_sum[size][rv + 1] -= mod;
    }
  }

  printf("%d\n", dp[n + 1][0]);

  return 0;
}


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

int main(){

    string S; cin >> S;
    rep(i, S.size()){
        if(i % 2 == 0){
            if(S[i] == 'L'){
                cout << "No\n";
                return 0;
            }
        }else{
            if(S[i] == 'R'){
                cout << "No\n";
                return 0;
            }
        }
    }
    cout << "Yes\n";

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <cstring>
bool table[12][10005];
using namespace std;
int r,c;
int ans;
int ji(){
    int op=0;
    for(int j=1;j<=c;j++){
        int a=0,b=0;
        for(int i=1;i<=r;i++){
            if(table[i][j]) a++;
            else b++;
        }
        op+=(a>b?a:b);
    }
    return op;
}
void br(int now){
    if(now>r){
        int bi=ji();
        ans=ans>bi?ans:bi;
        return ;
    }
    br(now+1);
    for(int i=1;i<=c;i++)
        if(table[now][i]) table[now][i]=false;
        else table[now][i]=true;
    br(now+1);
    for(int i=1;i<=c;i++)
        if(table[now][i]) table[now][i]=false;
        else table[now][i]=true;
}
int main(void){
    while(cin>>r>>c){
        if(0==r&&0==c) break;
        memset(table,0,sizeof(table));
        ans=-1000000;
        for(int i=1;i<=r;i++)
            for(int j=1;j<=c;j++){
                cin>>table[i][j];
            }
        br(1);
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 3096
N = int(input())
x = []
u = []
for _ in range(N):
    a, b = input().split()
    x.append(float(a))
    u.append(b)
ans = 0
for i in range(N):
    if u[i] == 'JPY':
        ans += x[i]
    else:
        ans += x[i] * 380000.0
print(ans)

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

int main(){
  int a,b,c,i,count=0;
  scanf("%d%d%d",&a,&b,&c);
  for(i=a;i<=b;i++){
    if(c%i==0){
      count++;
    }
  }
  printf("%d\n",count);
  return 0;
}



Measured memory_bytes: 2056
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,l; cin>>n>>l; 
  vector<string> s(n); for(int i = 0; i < n; i++){
  cin>>s[i];
}
  sort(s.begin(),s.end());
  for(auto xx : s) cout<<xx;
  cout<<"\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <bitset>
using namespace std;
typedef bitset<64> b64;
int main(){
	b64 b;
	int n,x;
	cin>>n;
	vector<b64> v(n);
	for(int i=0,j;i<n;i++)for(cin>>j;j--;v[i][x]=1)cin>>x;
	int q,a;
	for(cin>>q;q--;){
		cin>>a;
		if(a==0)cin>>x,cout<<b[x]<<endl;
		if(a==1)cin>>x,b|=v[x];
		if(a==2)cin>>x,b&=~v[x];
		if(a==3)cin>>x,b^=v[x];
		if(a==4)cin>>x,cout<<((b&v[x])==v[x])<<endl;
		if(a==5)cin>>x,cout<<(b&v[x]).any()<<endl;
		if(a==6)cin>>x,cout<<(b&v[x]).none()<<endl;
		if(a==7)cin>>x,cout<<(b&v[x]).count()<<endl;
		if(a==8)cin>>x,cout<<(b&v[x]).to_ulong()<<endl;
	}
}




Measured memory_bytes: 3096
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <iomanip>
using namespace std;
#define pb push_back
#define pf push_fron
#define INF 1e9
#define PI acos(-1)
typedef long long ll;

bool dp[2][4010][20010];
const int B = 10000;

int main() {
	string str;
	cin >> str;
	int x, y;
	cin >> x >> y;

	int cnt = 0;
	vector<int> v;

	for (int i = 0; i < str.size(); i++) {
		if (str[i] == 'F') {
			++cnt;
		}
		else {
			v.pb(cnt);
			cnt = 0;
		}
	}
	if (cnt)v.pb(cnt);
	
	int c[2] = {};
	for (int i = 0; i < 2; i++) {
		dp[i][0][B] = true;

		for (int j = i; j < v.size(); j += 2) {
			for (int k = 0; k < 20010; k++)if (dp[i][c[i]][k]) {
				if (j != 0) {
					dp[i][c[i] + 1][k - v[j]] = true;
				}
				dp[i][c[i] + 1][k + v[j]] = true;
			}
			++c[i];
		}
	}
	cout << ((dp[0][c[0]][x + B] && dp[1][c[1]][y + B]) ? "Yes" : "No" )<< endl;

	return 0;
}

Measured memory_bytes: 154368
import kotlin.math.abs
import kotlin.math.pow

fun main() {
    println(solve())
}

val solve: () -> Any = {
    val K = readInt()
    val (A, B) = readIntList()
    var res = false
    for (n in A..B) {
        if (n % K == 0) {
            res = true
            break
        }
    }

    res.toYesOrNo("OK", "NG")
}

val mod: Int = 1_000_000_007

fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)

fun <T> T.alsoPrintln() = also { println(this) }

fun Boolean.toYesOrNo(yes: String = "Yes", no: String = "No") = if (this) yes else no

Measured memory_bytes: 36284
using System;
using System.Collections.Generic;

namespace D2019PC
{
    class C
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());

            string s;
            int count = 0;
            int BconutA = 0;
            int conutA = 0;
            int Bconut = 0;
            int res = 0;

            for (int i = 0; i < N; i++)
            {
                count = 0;
                s = Console.ReadLine();

                if (s[0] == 'B' && s[s.Length - 1] == 'A') { BconutA++; }
                else if (s[0] == 'B') { Bconut++; }
                else if (s[s.Length - 1] == 'A') { conutA++; }

                for (int j = 0; j < s.Length - 1; j++)
                {
                    if (s[j] == 'A' && s[j + 1] == 'B') count++;
                }
                res += count;
            }


            while (1 < BconutA)
            {
                res++;
                BconutA--;
            }

            while (0 < BconutA)
            {
                if (Bconut == 0 || conutA == 0) break;
                BconutA--;
                Bconut--;
                conutA--;
                res += 2;
            }

            for (int i = 0; i < BconutA; i++)
            {
                if (Bconut < conutA) Bconut++;
                else conutA++;
            }

            Console.WriteLine(res + Math.Min(Bconut, conutA));
        }
    }
}


Measured memory_bytes: 13140
#include<stdio.h>

 main(){ 

  int a=0;

  int W,H,x,y,r=0;  

scanf("%d %d %d %d %d",&W,&H,&x,&y,&r); 

  if(x-r>=0&&x+r<=W){ 

    if(y-r>=0&&y+r<=H){ 

      a=1; 

    }  

}  

else{ 

    a=0; 

  }   

if(a==1){

    printf("Yes\n");

  } 

  else if(a==0){ 

    printf("No\n");

  } 

  return 0;

} 

Measured memory_bytes: 584
N,K = map(int,input().split())
A = [0] + list(map(int,input().split()))
turn = [-1] * (N+1) # いつ訪問したかを記録する
c = 1
for k in range(K):
    if turn[c]!=-1:
        T = k - turn[c] # 周期
        bias = turn[c] # バイアス
        break
    turn[c] = k
    c = A[c]
else:
    print (c)
    exit()

K -= bias 
K %= T
K += bias
c = 1 
for k in range(K):# 小さくしたKでシミュレーションし直す
    c = A[c]
print (c)

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

int main(){
  int n;
  cin >> n;
  double ans=0;
  rep(i,n){
    double tmp;
    string currency;
    cin >> tmp;
    cin >> currency;
    if (currency=="BTC"){
      ans+=tmp*380000;
    }
    else{
      ans+=tmp;
    }
  }
  cout << ans;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e16

ll r,c,n;
ll x[111111][3],y[111111][3];
ll dist[2];
vector<P> ps;

int main(){
	cin.sync_with_stdio(false);
  cin>>r>>c>>n;
  rep(i,n){
    rep(j,2)cin>>x[i][j]>>y[i][j];
  }
  rep(i,n){
    if((x[i][0]==0||x[i][0]==r||y[i][0]==0||y[i][0]==c)
      &&(x[i][1]==0||x[i][1]==r||y[i][1]==0||y[i][1]==c)){
      rep(j,2){
        if(y[i][j]==0){
          dist[j]=x[i][j];
        }else if(x[i][j]==r){
          dist[j]=r+y[i][j];
        }else if(y[i][j]==c){
          dist[j]=r+c+(r-x[i][j]);
        }else{
          dist[j]=r+c+r+(c-y[i][j]);
        }
      }
      sort(dist,dist+2);
      ps.push_back(P(dist[0],i));
      ps.push_back(P(dist[1],i+n));
    }
  }
  sort(all(ps));
  stack<ll> st;
  rep(i,ps.size()){
    if(ps[i].se>=n){
      if(st.size()>0&&st.top()+n==ps[i].se)st.pop();
      else{
        cout<<"NO"<<endl;
        return 0;
      }
    }else{
      st.push(ps[i].se);
    }
  }
  cout<<"YES"<<endl;
	return 0;
}


Measured memory_bytes: 11504
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,s,n) for(int i=s;i<n;i++)
#define fi first
#define se second
#define all(c) c.begin(),c.end()
typedef long long int ll;
typedef pair<int, int> P;
typedef long double ld;
void Ans(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}

const ll INF=1001001001;
const ll mod=1000000007;

int main(){
  ll a,b;
  cin>>a>>b;
  
  if(a!=1&&b!=1) cout<<(a*b+1)/2<<endl;
  else cout<<1<<endl;
  
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pq priority_queue
using namespace std;
const ll INF=(ll)1e9;
const ll MOD=(ll)1e9+7;
const ll MAX=100100;
vector<int> dx={1,0,-1,0},dy={0,1,0,-1};
template<class T> inline bool chmax(T& a, T b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a>b) { a=b; return 1; } return 0; }

ll gcd(ll a, ll b) {
  if (b==0) return a;
  else return gcd(b,a%b);
}
ll lcm(ll a, ll b) {
  ll g=gcd(a,b);
  return a/g*b;
}

int main(){
    ll N,M,L;
    string S,T;
    cin>>N>>M>>S>>T;
    L=lcm(N,M);
    ll a=L/M,b=L/N;
    ll k=lcm(a,b);

    for(ll i=0;i<=L/k;i++){
        if(S[a*i]!=T[b*i]){
            cout<<"-1"<<endl;
            return 0;
        }
    }
    cout<<L<<endl;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t;
    cin>>t;
    int a,b,c;
    bool flag=1;
    while(t--)
    {
    	cin>>a>>b>>c;
    	if(a<b+c)
    	{
    		flag=0;
    	}
    	else
    	{
    		if((b+c-a)%2!=0)
    		{
    			flag=0;
    		}
    	}
    }
    if(flag==1)
    {
    	cout<<"Yes"<<endl;
    }
    else
    {
    	cout<<"No"<<endl;
    }
}

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

typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define dump(x)  cout << #x << " = " << (x) << endl;	//debug
#define SZ(x) ((int)(x).size())
#define REP(i, n) for(ll i = 0; i < (n); i++)
#define REPR(i, n) for (ll i = (n); i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (ll i = (a); i >= (b); i--)
#define ps(s) cout << #s << endl;
#define pv(v) cout << (v) << endl;
#define pvd(v) cout << setprecision(16) << res << endl;
#define ALL(a)  (a).begin(),(a).end()
#define RANGE(a, l, r)  (a).begin()+(l),(a).begin()+(r)

int main() {
	int n;
	cin >> n;
	int nmin = INF;
	int res = 0;
	FOR(i, 1, n) {
		int tmp;
		cin >> tmp;
		if (tmp <= nmin) {
			nmin = tmp;
			res++;
		}
	}
	pv(res)
	return(0);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
#include <math.h> 
#include<stdio.h>
#include<string.h> //strcmp、strncmp関数を使うために必要
 
int main(){
    int N,M;
    int sum = 0;
    bool j = true;
    int count = 0;
    
    cin >> N >> M;
    vector<int> A(N);
    
    for(int i = 0; i < N;i++){
        cin >> A.at(i);
        sum += A.at(i);
    }
    
    double kiru = 0;
    kiru = (double)sum/(double)(4*M);
    
    
    for(int i = 0;i < N;i++){
        if(kiru <= A[i]){
            count++;
        }
    }
    if(count >= M){
        cout << "Yes" << endl;
 
    }else{
        cout << "No" << endl;
    }
    //printf("%f",kiru);
    
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define rep(i,a,n) for(ll i =(a);i<(n);i++)
#define urep(i,a,n) for(ll i = (a);i>=(n);i--)
#define all(x) (x).begin();(x).end()
typedef long long ll;
using namespace std;
ll Power(ll a,ll x) {
	int num = a;
	rep(i, 1, x)num *= a;
	return num;
}

ll N, ans;
string S;
string s1, s2;
int main() {
	cin >> N >>S;
	rep(i, 0, N)s1 += S[i];
	urep(i, N*2-1, N)s2 += S[i];
	map<pair<string,string>, ll> m1,m2;
	rep(i, 0, Power(2, N)) {
		bitset<18> b1(i);
		string tmp1,tmp2,num1,num2;
		rep(j, 0, N) {
			if (b1[j]) {
				tmp1 += s1[j];
				tmp2 += s2[j];
			}
			else {
				num1 += s1[j];
				num2 += s2[j];
			}
		}
		pair<string, string> num;
		num.first = tmp1; num.second = num1;
		m1[num]++;
		num.first = tmp2; num.second = num2;
		m2[num]++;
	}
	for (map<pair<string,string>, ll>::iterator itr = m1.begin(); itr != m1.end(); ++itr) {
		ans += itr->second*m2[itr->first];
	}
	cout << ans << endl;
	cin >> ans;
	return 0;
}

Measured memory_bytes: 108288
import string
import sys
readline = sys.stdin.readline
write = sys.stdout.write

def solve():
    s0 = "^" + string.ascii_uppercase + string.ascii_lowercase
    *S, = map(s0.index, readline().strip()); N = len(S)
    *T, = map(s0.index, readline().strip()); M = len(T)

    base = 59; mod = 10**9 + 9
    pw = [1]*(N+1)
    r = 1
    for i in range(N):
        pw[i+1] = r = r * base % mod

    h0 = [0]*(M+1)
    r = 0
    for i in range(M):
        h0[i+1] = r = (r * base + T[i]) % mod

    h1 = [0]*(N+1)
    r = 0
    for i in range(N):
        h1[i+1] = r = (r * base + S[i]) % mod

    ans = 0
    for i in range(N-M+1):
        left = 0; right = M+1
        while left+1 < right:
            mid = (left + right) >> 1
            if h0[mid] == (h1[mid+i] - h1[i] * pw[mid]) % mod:
                left = mid
            else:
                right = mid
        if left < M:
            if (h0[M] - h0[left+1] * pw[M - (left+1)]) % mod == (h1[M+i] - h1[i+left+1] * pw[M - (left+1)]) % mod:
                ans += 1
    write("%d\n" % ans)
solve()


Measured memory_bytes: 40268
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  vector<int> b(N);
  vector<int> c(N);
  for(int i = 0; i < N; i++){
    cin >> a.at(i);
  }
  for(int i = 0; i < N; i++){
    cin >> b.at(i);
  }
  for(int i = 0; i < N; i++){
    cin >> c.at(i);
  }
  int sum = 0;
  for(int i = 0; i < N; i++){
    sum += b.at(a.at(i)-1);
    if(i > 0){
      if(a.at(i) - a.at(i - 1) == 1)sum += c.at(a.at(i-1)-1);
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 3628
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>

typedef unsigned long long ULLONG;
typedef long long LLONG;
static const LLONG MOD_NUM = 1000000007;

template <class _T> static _T tp_abs(const _T& a) {
	//	usage:  tp_abs<type name>(a);
	return ((a < 0) ? (a * -1) : a);
}
template <class _T> static _T tp_min(_T a, _T b) {
	return a < b ? a : b;
}
template <class _T> static _T tp_max(_T a, _T b) {
	return a > b ? a : b;
}
template<class _T> static void get1int(_T& a) {
	const char* fmt = " %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld";
	}

	if (scanf(fmt, &a) < 0) {
		printf("g1int Error\n");
	}
}
template<class _T> static void get2int(_T& a, _T& b) {
	const char* fmt = " %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld";
	}

	if (scanf(fmt, &a, &b) < 0) {
		printf("g2int Error\n");
	}
}
static void getstring(char* buff) {
	if (scanf(" %s", buff) < 0) {
		printf("getstr error!\n");
	}
}

static void AGC038A_Matrix();

#if 1
int main()
{
	AGC038A_Matrix();
	fflush(stdout);
	return 0;
}
#endif

static void AGC038A_Matrix()
{
	int H, W, A, B;
	get2int(H, W);
	get2int(A, B);
	
	for (int h = 0; h < H; h++) {
		for (int w = 0; w < W; w++) {
			if ((h < B) ^ (w < A))
				printf("1");
			else
				printf("0");
		}
		putchar('\n');
	}
}


Measured memory_bytes: 1280
import math
A, B, H, M = list(map(int, input().split()))

h_rad = (H+M/60)/12 *2*math.pi
m_rad = M/60 * 2 * math.pi

h_x = A * math.sin(h_rad)
h_y = A * math.cos(h_rad)

m_x = B * math.sin(m_rad)
m_y = B * math.cos(m_rad)

print(math.sqrt(pow(h_x-m_x, 2) + pow(h_y-m_y, 2)))

Measured memory_bytes: 9580