akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
using namespace std;

string to_string(string s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifndef ONLINE_JUDGE
#define show(...) cerr << "[" << #__VA_ARGS__ << "] :", debug_out(__VA_ARGS__)
#else
#define show(...) 42
#endif

#define ff first
#define ss second
#define endl "\n"
#define pb push_back
#define two pair<int,int>
#define ll long long int
#define int long long int
#define mod(x,m) ((x%m+m)%m)
#define oo 1e15
#define limit 1000000007
#define all(v) v.begin(),v.end()
#define max3(x,y,z) max(x,max(y,z))
#define min3(x,y,z) min(x,min(y,z))
#define rep(a1,b1,c1) for(int a1=b1;a1<c1;a1++)
#define repb(a2,b2,c2) for(int a2=b2;a2>=c2;a2--)
#define speedforces std::ios::sync_with_stdio(false)
#define watch(x) cerr << (#x) << " is " << (x) << "\n"
#define input_from_file  freopen("input.txt", "r", stdin);
#define output_to_file  freopen("output.txt", "w", stdout);


signed main(){
//input_from_file;
speedforces;
int n,m; cin>>n>>m;
vector<string> v(n);
for(int i=0;i<n;i++) cin>>v[i];
int dp[1005][1005];
memset(dp,0,sizeof dp);
dp[0][0] = 1;
for(int i=0;i<n;i++)
 for(int j=0;j<m;j++)
  if(v[i][j] != '#'){
   if(i > 0) dp[i][j] += dp[i-1][j] , dp[i][j] %= limit;
   if(j > 0) dp[i][j] += dp[i][j-1] , dp[i][j] %= limit;
 }
cout<<dp[n-1][m-1]<<endl;  
}

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

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

    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++)
    {
        if(v[i] > c[i])
        {
            a += v[i];
            b += c[i];
        }
    }
    cout << a - b << endl;
}

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

string s;
int k;
set<string> S;

int main() {
   cin >> s >> k;
   int n = s.size();
   for (int i = 0; i < n; i++) {
      string t = "";
      for (int j = i; j < n && i+k >= j; j++) {
         t.push_back(s[j]);
         S.insert(t);
      }
   }

   int cnt = 1;
   for (string t : S) {
      if (cnt == k) {
         cout << t << endl;
         return 0;
      }
      cnt++;
   }


   return 0;
}


Measured memory_bytes: 2176
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		ArrayList<Integer> A = new ArrayList<Integer>();
		for(int i = 0; i < N; i ++) {
			A.add(stdIn.nextInt());
		}
		
		long stepSum = 0;
		
		for(int i = 1; i < N; i ++) {
			if(A.get(i - 1) <= A.get(i)) {
				continue;
			}else {
				stepSum += A.get(i - 1) - A.get(i);
				A.set(i, A.get(i - 1));
			}
		}
		
		System.out.println(stepSum);
	}
}

Measured memory_bytes: 65544
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <deque>
#include <queue>
#include <string.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
typedef long long ll;
typedef pair<int,int> P;
int main() {
    string s;
    cin >> s;
    int a = 200001;
    int z = 0;
    rep(i, 0, s.size()){
        if(s[i]=='A'){
            a=min(i,a);
        }
        if(s[i]=='Z'){
            z=max(i,z);
        }
    }
    
    cout << z-a+1 << endl;
}

Measured memory_bytes: 3744
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
typedef long long ll;
typedef long double  ld;
#define pii pair<ll,ll> 
#define pic pair<ll,char>
#define vi vector< ll > 
#define vvi vector< vi > 
#define vpi vector< pii > 
#define vvpi vector< vpi > 
#define st  set <ll, greater <ll> >
#define mst  multiset <ll, greater <ll> >
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mapp  unordered_map <ll, ll>
#define ppii pair< pii, pii > 
#define test(t) ll t;cin>>t;while(t--)
#define inarr(n) ll arr[n];for(ll i=0;i<n;i++)cin>>arr[i];
#define ingra(m) vvi arr(100005);for(ll i=0;i<m;i++){ll u,v;cin>>u>>v;arr[u].pb(v);arr[v].pb(u);}
#define mem(a,b) memset(a,b,sizeof(a))
#define inn freopen("input.txt", "r", stdin)
#define outt freopen("output.txt", "w", stdout)
#define all(arr) arr.begin(),arr.end()
ll power(ll x,ll y){ll res = 1;while(y){if(y&1) res = (res*x)%mod;y=y/2,x=(x*x)%mod;}return res%mod;}
ll dp[101][100001];
signed main()
{
    fast;
    ll pref[100001];
    ll n,k,i,j;
    cin>>n>>k;
    ll arr[n];
    for(i=0;i<n;i++)
        cin>>arr[i];
    for(i=0;i<=arr[0];i++)
    {
        if(i<=k)
        dp[0][i] = 1;
    }
    pref[0] = 1;
    for(i=1;i<=k;i++)
        pref[i] = pref[i-1]+dp[0][i];
    for(i=1;i<n;i++)
    {
        for(j=0;j<=k;j++)
        {
            if(arr[i]>=j)
                dp[i][j] = pref[j];
            else
                dp[i][j] = (pref[j]-pref[j-arr[i]-1]+mod)%mod;
        }
        pref[0] = dp[i][0];
        for(j=1;j<=k;j++)
            pref[j] = (pref[j-1]+dp[i][j])%mod;
    }
    cout<<dp[n-1][k];
}

Measured memory_bytes: 79104
#
# abc090 b
#
import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """11009 11332"""
        output = """4"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """31415 92653"""
        output = """612"""
        self.assertIO(input, output)


def resolve():
    A, B = map(int, input().split())
    ans = 0
    for i in range(A, B+1):
        s = str(i)
        for j in range(3):
            if s[j] != s[-1-j]:
                break
        else:
            ans += 1
    print(ans)


if __name__ == "__main__":
    # unittest.main()
    resolve()


Measured memory_bytes: 16172
#include<bits/stdc++.h>
using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define REP(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define FOR(i,a,b) for(int i=int(a);i<=int(b);++i)

#define ALL(x) (x).begin(),(x).end()
typedef long long ll;

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev

int main(){
  cout.precision(12);
  int N,K;
  cin >> N >> K;

  double ans = 0;
  FOR(i,1,N){
    ans += 1/(N * pow(2, ceil(log2(ceil((double)K / i)))));
  }

  cout << ans << endl;
}

Measured memory_bytes: 384
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<limits>
#include<bitset>
#include<array>
#include<numeric>
#include<iomanip>
#include<functional>
#include<deque>

using namespace std;
typedef long long int ll;

#define C cout<<
#define E <<endl

ll n,m,a,b,c,x,y,z,aa[200010],ab[200010],ac[1010][1010];
bool r,ra,rb,rc;
string s,sa,sb,sc;
char ca,cb,cc,cd[1010][1010];
vector<ll> va,vb,vc;

int main(){
    cin>>s;
    C (int(s[5])-int('0')==0 and int(s[6])-int('0')<=4 ? "Heisei":"TBD") E;
    
}

Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

use std::collections::BinaryHeap;

fn main() {
    input!{
        n: usize,
        m: usize,
        ab: [(usize1, usize1); m],
    };

    let mut nei = Vec::with_capacity(n);
    for _ in 0..n {
        nei.push(Vec::new());
    }
    for (a, b) in ab {
        nei[a].push(b);
        nei[b].push(a);
    }

    let mut ans = vec![None; n];
    let mut queue = BinaryHeap::new();
    queue.push((0, 0, 0));
    while let Some((hop, pos, from)) = queue.pop() {
        match ans[pos] {
            None => ans[pos] = Some((from, hop)),
            Some((_, hop2)) if hop2 < hop => {
                    ans[pos] = Some((from, hop))
            }
            _ => continue,
        }
        for &next in nei[pos].iter() {
            queue.push((hop - 1, next, pos));
        }
    }
    println!("Yes");
    for a in ans.iter().skip(1) {
        let (to, _ ) = a.unwrap();
        println!("{}", to + 1);
    }
}


Measured memory_bytes: 24472
import math
a,b,h,m = map(int, input().split())
# 時針:30度/1時間 0.5度/1分
h_deg = h*30 + m*0.5  # H時M分後の時針の角度(deg)
# 分針:6度/1分
m_deg = m*6 # M分後の分針の角度(deg)
deg = h_deg - m_deg
rad = math.radians(deg)
c2 = a**2 + b**2 - 2*a*b*math.cos(rad)
print(math.sqrt(c2))


Measured memory_bytes: 9500
#include<iostream>
using namespace std;
int main(){
	int n,num,digit,rev=0;
	cin>>num;
	n=num;
	do{
		digit=num%10;
		rev=(rev*10)+digit;
		num=num/10;
		
	}while(num!=0);
	if(n==rev)
	cout<<"Yes";
	else
	cout<<"No";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MAXN 1000010
#define rep(i,n) for (int i = 0; i < (n); ++i)
const ll mod = 1e9+7;

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

bool pairCompare(const P& firstElof, const P& secondElof)
{
    return firstElof.second < secondElof.second;
}

int main() {
    int a, b, x;
    cin >> a >> b >> x;
    if ( x >= a and x <= a+b ) {
        cout << "YES" << endl;
    } else {
        cout << "NO" <<endl;
    }
}



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

int main() {
  int N;
  cin >> N;
  long long ans = 1;
  for (int i = 0; i < N; i++) {
    ans *= (i + 1);
    ans %= static_cast<long long>(pow(10, 9) + 7);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
MOD = 10**9 + 7

def main():
    N, M = map(int, input().split())
    broken_floors = set(int(input()) for _ in range(M))
    dp = [0]*(N+2)
    dp[1] = 1

    for i in range(1, N+1):
        if i not in broken_floors:
            dp[i+1] = (dp[i] + dp[i-1]) % MOD

    print(dp[-1])

if __name__ == '__main__':
    main()

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

#define PI 4*atan(1)
#define INF 1e8

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

int main(){
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  cout << max(A * B, C * D) << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
int main(){
       int five=0,seven=0,n;
       for(int i=0;i<3;i++){
              scanf("%d",&n);
              if(n==5) five++;
              if(n==7) seven++;
       }
       if(five==2&&seven==1) printf("YES");
       else printf("NO");
       return 0;
}


Measured memory_bytes: 128
import collections
def main():
    N, M = map(int, input().split())
    graph = collections.defaultdict(list)
    for _ in range(M):
        a, b = [int(c) for c in input().split()]
        graph[a].append(b)
        graph[b].append(a)

    count = 0
    for a in graph:
        for b in graph[a]:
            if a < b:
                start, goal = a, b
                cur = [start]
                visited = set([start])
                isFound = False
                while cur and not isFound:
                    temp = []
                    for c in cur:
                        for d in graph[c]:
                            if [c, d] != [a, b] and d not in visited:
                                if d == goal:
                                    isFound = True
                                    break
                                visited.add(d)
                                temp.append(d)
                        if isFound:
                            break
                        cur = temp
                if not isFound:
                    count += 1
    return count

if __name__ == '__main__':
    print(main())

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

using namespace std;
using ll = long long;
using edge = struct { int to; ll cost; };

#define mod 1000000007
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(a) (a).begin(), (a).end()
#define INF (1 << 29)

long long combination[10001][10001];

//initC(int n);
//long long gcd(long long a, long long b);
//long long lcm(long long a, long long b);

void solve()
{
    ll a, b, k;
    cin >> a >> b >> k;
    set<ll> ans;
    for(ll i = 0; i < k; i++) ans.insert(min(a+i, b));
    for(ll i = k - 1; i >= 0; i--) ans.insert(max(b-i, a));
    for(auto x : ans) cout << x << "\n";
}

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


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

int main() {
  int N; cin >> N;
  int A[100010], dp[100010];
  for(int i = 0; i < N; ++i) cin >> A[i];
  fill(dp, dp+N, 1);
  for(int i = 0; i < N; ++i) {
    *upper_bound(dp, dp+N, -A[i]) = -A[i];
  }
  std::cout << lower_bound(dp, dp+N, 1) - dp << std::endl;

  return 0;
}


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

public class Main {
    FastScanner in;
    PrintWriter out;

    void solve() {
        int n = in.nextInt();
        long have = in.nextLong();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
        }
        Arrays.sort(a);
        int res = 0;
        for (int i = 0; i + 1 < n; i++) {
            if (a[i] <= have) {
                have -= a[i];
                res++;
            }
        }
        if (a[n - 1] == have) {
            res++;
        }
        out.println(res);
    }

    void run() {
        try {
            in = new FastScanner(new File("Main.in"));
            out = new PrintWriter(new File("Main.out"));

            solve();

            out.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    void runIO() {

        in = new FastScanner(System.in);
        out = new PrintWriter(System.out);

        solve();

        out.close();
    }

    class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public FastScanner(InputStream f) {
            br = new BufferedReader(new InputStreamReader(f));
        }

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

        boolean hasMoreTokens() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return false;
                st = new StringTokenizer(s);
            }
            return true;
        }

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

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

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

    public static void main(String[] args) {
        new Main().runIO();
    }
}

Measured memory_bytes: 22612
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int K = 1e5 + 5;
LL k,a[K];
int main()
{
	scanf("%d",&k);
	for (int i = 1;i <= k; ++i)
		cin>>a[i];
	if (a[k] != 2)
	{
		puts("-1");
		return 0; 
	}
	LL l = 1,r = 1;
	for (int i = k - 1;i;--i)
	{
		l = (l * (a[i + 1]) + a[i] - 1) / a[i];
		r = ((r + 1) * a[i + 1] - 1) / a[i];
		if (l > r)
		{
			puts("-1");
			return 0;
		}
	}
	//cout<<l<<" "<<r<<endl;
	cout<<l * a[1]<<" "<<(r + 1) * a[1] - 1;
}

Measured memory_bytes: 1024
// D.

#include <sstream>
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>

using namespace std;

typedef long long LL;
typedef long double LD;
const LL MOD = 1000000007;
const LD EPS = 1e-10;
static const size_t MAX_N = 1000001;

struct modll {
	long long x;
	modll() { }
	modll(int _x) : x(_x) { }
	operator int() const { return (int)x; }
	modll operator+(int y) { return (x + y + MOD) % MOD; }
	modll operator+=(int y) { x = (x + y + MOD) % MOD; return *this; }
	modll operator-(int y) { return (x - y + MOD) % MOD; }
	modll operator-=(int y) { x = (x - y + MOD) % MOD; return *this; }
	modll operator*(int y) { return (x * y) % MOD; }
	modll operator*=(int y) { x = (x * y) % MOD; return *this; }
	modll operator/(int y) { return (x * modpow(y, MOD - 2)) % MOD; }
	modll operator/=(int y) { x = (x * modpow(y, MOD - 2)) % MOD; return *this; }
	static modll modinv(int a) { return modpow(a, MOD - 2); }
	static modll modpow(int a, int b) {
		modll x = a, r = 1;
		for (; b; b >>= 1, x *= x) if (b & 1) r *= x;
		return r;
	}
};

modll combination(LL n, LL r) {
	static modll fact[MAX_N + 1], inv[MAX_N + 1];
	if (!fact[0]) {
		fact[0] = 1;
		for (int i = 1; i <= MAX_N; ++i) {
			fact[i] = fact[i - 1] * i;
		}
		inv[MAX_N] = modll::modinv(fact[MAX_N]);
		for (int i = MAX_N; i >= 1; --i) {
			inv[i - 1] = inv[i] * i;
		}
	}
	if (r > n) {
		return 0;
	}
	return (fact[n] * inv[r]) * inv[n - r];
}

int main(int argc, char *argv[])
{
	int n, m;
	cin >> n >> m;
	int mx = sqrt(m);
	vector<int> b;
	for (int i = 2; i <= mx; ++i) {
		if ((m % i) == 0) {
			int cnt = 0;
			while ((m % i) == 0) {
				++cnt;
				m /= i;
			}
			b.push_back(cnt);
		}
	}
	if (m > 1) {
		b.push_back(1);
	}
	modll ans = 1;
	for (int x : b) {
		ans *= combination(x + n - 1, x);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 15872
#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans = count = 0

h,w,k=map(int,input().split())
S=[list(input()) for i in range(h)]
color=[[0]*w for i in range(h)]
def exist(row):
    for j in range(w):
        if S[row][j]=="#":
            return True
    return False

for i in range(h):
    for j in range(w):
        if S[i][j]=="#":
            count+=1
            color[i][j]=count  

for i in range(h):
        for j in range(1,w):
            if color[i][j] == 0: color[i][j]=color[i][j-1]
                
        for j in range(w-2,-1,-1):
            if color[i][j] == 0: color[i][j]=color[i][j+1]

for i in range(1,h):
    if not exist(i):
        color[i]=color[i-1]
        
for i in range(h-2,-1,-1):
    if not exist(i):
        color[i]=color[i+1]

for ci in color:
    print(*ci)

Measured memory_bytes: 50524
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<set>
#include<map>
#include<vector>
typedef long long int ll;
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOR_IN(i, a, b) for(int i = (a); i < (b); i++)
#define BETWEEN(x, a, b) ((x) >= (a) && (x) <= (b))
#define BIT(b, i) (((b) >> (i)) & 1)
#define LOG_F 1
#define LOG(...) if(LOG_F) fprintf(stderr, __VA_ARGS__)

using namespace std;

ll pow(int x, int n){
  return n == 0 ? 1 : x * pow(x, n - 1);
}


/*
n m
ai bi ci (m)

n 100
m 1000
ci 1000
 */
#define INF 1000000000
int n,m,a[1000],b[1000],c[1000];
ll d[100][100];
bool check[100][100];

int main(){
  REP(i,100){
    REP(j,100){
      d[i][j] = i==j ? 0 : INF;
    }
  }
  
  cin>>n>>m;
  REP(i,m){
    cin>>a[i]>>b[i]>>c[i];
    a[i]--; b[i]--;
    d[a[i]][b[i]] = c[i];
    d[b[i]][a[i]] = c[i];    
  }

  REP(k,n){
    REP(i,n){
      REP(j,n){
        if(d[i][j] > d[i][k] + d[k][j]){
          d[i][j] = d[i][k] + d[k][j];
          check[i][k] = check[k][i] = true;
          check[j][k] = check[k][j] = true;
        }
      }
    }
  }

  int cnum=0;
  REP(i,m){
    if(d[a[i]][b[i]] == c[i]) cnum++;
  }

  cout<< m - cnum << endl;

  return 0;
}


Measured memory_bytes: 384
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.NoSuchElementException;
import java.util.Scanner;

public class Main {
  private final long MOD = (long) (1e9 + 7);

  public class Combination {
    private long[] fact;
    private long[] invFact;

    public Combination(int max) {
      long[] inv = new long[max + 1];
      fact = new long[max + 1];
      invFact = new long[max + 1];
      inv[1] = 1;
      for (int i = 2; i <= max; i++) inv[i] = inv[(int) (MOD % i)] * (MOD - MOD / i) % MOD;
      fact[0] = invFact[0] = 1;
      for (int i = 1; i <= max; i++) fact[i] = fact[i - 1] * i % MOD;
      for (int i = 1; i <= max; i++) invFact[i] = invFact[i - 1] * inv[i] % MOD;
    }

    public long get(int x, int y) {
      return fact[x] * invFact[y] % MOD * invFact[x - y] % MOD;
    }
  }

  private void solve(Scanner in, PrintWriter out) {
    int N = in.nextInt();
    int A = in.nextInt();
    int B = in.nextInt();
    int C = in.nextInt();
    int D = in.nextInt();

    Combination combination = new Combination(N);

    long[][] dp = new long[N + 2][N + 2];
    dp[0][A] = 1;

    //dp[i][member] := i人を使ってmember人未満のチームで分ける方法
    for (int i = 0; i <= N; i++) {
      for (int member = A; member <= B; member++) {
        if (dp[i][member] <= 0) continue;
        dp[i][member + 1] += dp[i][member];
        dp[i][member + 1] %= MOD;

        long d = dp[i][member];
        for (int num = 1; num <= D; num++) {
          if (i + num * member > N) break;
          int remain = N - (i + (num - 1) * member);
          d *= combination.get(remain, member);
          d %= MOD;
          if (num < C) continue;
          long e = d * combination.invFact[num];
          e %= MOD;
          dp[i + num * member][member + 1] += e;
          dp[i + num * member][member + 1] %= MOD;
        }
      }
    }

    out.println(dp[N][B + 1]);

  }

  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    PrintWriter out = new PrintWriter(System.out);
    new Main().solve(in, out);
    in.close();
    out.close();
  }
}


Measured memory_bytes: 18672
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>
using namespace std;
#define int long  long int
#define ll long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
const int INF = 1e8;

signed main() {
	int H, W;
	cin >> H >> W;
	vector<string>s(H);
	int dx[4] = { 1,0,-1,0 };
	int dy[4] = { 0,1,0,-1 };
	rep(i, H)cin >> s[i];
	int mx = -1;
	rep(si, H)rep(sj, W) { // スタートの位置を全部試す
		if (s[si][sj] == '#')continue; // 障害物なら飛ばす
		vector<vector<int>>d(H, vector<int>(W, INF));
		queue<P>q;
		q.push(P(si, sj));
		d[si][sj] = 0;
		while (q.size()) {
			P p = q.front();
			q.pop();
			for(int i=0;i<4;i++){
				int nx = p.first + dx[i];
				int ny = p.second + dy[i];
				if (0 <= nx && nx < H && 0 <= ny && ny < W && s[nx][ny] != '#' && d[nx][ny] == INF) {
					q.push(P(nx, ny));
					d[nx][ny] = d[p.first][p.second] + 1;
				}
			}
		}
		rep(i, H)rep(j, W) {
			if (d[i][j] == INF)continue;
			mx = max(mx, d[i][j]);
		}
	}
	cout << mx;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		int X = sc.nextInt();
		int Y = sc.nextInt();
		if(N <= K) {
			System.out.println(N * X);
		}
		else {
			System.out.println(K * X + (N-K) * Y);
		}
	}
}

Measured memory_bytes: 35684
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<deque>
#include<tuple>
#include<queue>
#include<stack>
#include<map>
#include<cstdint>
#include<unordered_map>
#include<boost/multiprecision/cpp_int.hpp>


#define rep(i, n) for(int i = 0; i < ( int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define vi vector<int>
#define vll vector<ll>
#define all(x) (x).begin(),(x).end()
#define F first
#define S second


namespace mp = boost::multiprecision;

using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

vector<int>devisor(int n) {
	vector<int>value;
	FOR(i, 1, pow(n, 0.5) + 1) {
		if (n % i == 0) {
			value.push_back(i);
			if (i * i != n) {
				value.push_back(n / i);
			}
		}
	}
	return value;
}
int ans(int gcd, vector<int>devisor,vector<int>a) {
	bool flag = true;
	int i = 0;
	while (flag) {
		int count = 0;
		rep(j, a.size()) {
			if (a[j] % devisor[i] != 0) {
				count++;
			}
			if (count >= 2) {
				break;
			}
		}
		if (count <= 1) {
			gcd = max(gcd, devisor[i]);
			flag = false;
		}
		else {
			i++;
		}
	}
	return gcd;
}

int main() {
	int n;
	cin >> n;
	vector<int>a(n);
	rep(i, n) {
		cin >> a[i];
	}
	sort(all(a));

	int b = a[0];
	int c = a[1];
	vector<int>div_b,div_c;
	div_b = devisor(b);
	div_c = devisor(c);
	sort(all(div_b));
	reverse(all(div_b));
	sort(all(div_c));
	reverse(all(div_c));
	int gcd = 1;
	int answer = max(ans(gcd, div_c, a), 
		ans(gcd, div_b, a));
	cout << answer << endl;

}


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

long long greater_num(int i, long long n, vector<long long int> &a){
  for(int k=i; k<n; k++){
     if(a[k] > a[k+1]) return k;
  }//for
  return n-1;
}//greater_num

long long less_num(int i, long long n, vector<long long int> &a){
  for(int k=i; k<n; k++){
     if(a[k] < a[k+1]) return k;
  }//for
  return n-1;
}//greater_num

int main(void){
  long long N;
  cin >> N;
  vector<long long int> a(N);
  for(int i; i<N; i++) cin >> a[i];

  int count = 0;
  for(int i=0; i<N; i++){
    if(a[i] == a[i+1]){
       continue;
    }else if(a[i] < a[i+1]){
       i = greater_num(i, N, a);
       //cout << a[i] << " " << a[i+1] << "\n";
       count++;
    }else{
       i = less_num(i, N, a);
       //cout << a[i] << " " << a[i+1] << "\n";
       count++;
    }//if
  }//for

  cout << count << "\n";
}//main


Measured memory_bytes: 4004
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define INF (1e9)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
const long double PI = acos(-1.0L);
const long long MOD = 1000000007LL;
//const long long MOD = 998244353LL;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
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; }
///////////////////////////////////////////////////////////////////////////////////////////////////

double dist(int x, int y) {
    return sqrt(double(x*x+y*y));
}
int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    while (true) {
        int D,E; cin >> D >> E;
        if (D+E==0) break;
        double ans = 1e9;
        rep(i,D+1) {
            chmin(ans,fabs(dist(i,D-i) - E));
        }

        cout << fixed << setprecision(10) << ans << endl;
    }
}



Measured memory_bytes: 3256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int MOD = 1e9 + 7;
const int INF = 2e9;
#define pb push_back
#define mp make_pair
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 (a>b) { a=b; return 1; } return 0; }

int main(){
    int w, a, b;
    cin >> w >> a >> b;
    if(b<a){
        a ^= b ^= a ^= b;
    }
    int ans = b - (a + w);
    if(ans < 0){
        ans = 0;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; ++i)
#define RREP(i, n) for (int i = n; 0 <= i; --i)
#define FOR(i, start, end) for (int i = start; i < end; ++i)
#define RFOR(i, start, end) for (int i = start; end <= i; --i)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1'000'000'007
#define INF32 1'050'000'000
#define INF64 4'000'000'000'000'000'000
using ll = long long;
using namespace std;
template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }

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

  ll N; cin >> N;
  ll M; cin >> M;
  ll X; cin >> X;
  ll g[N][M+1];

  ll x;
  REP (i, N) {
    REP (j, M+1) {
      cin >> x;
      g[i][j] = x;
    }
  }

  ll ans = 10000100;
  REP (x, (2<<N)) {
    // cout << "---" << x << endl;
    ll total = 0;
    ll skills[M]; REP (t, M) skills[t] = 0;

    REP (i, N) {
      if (!(x&(1<<i))) continue;
      // cout << g[i][0] << " " << g[i][1] << " " << g[i][2] << " " << g[i][3] << " " << endl;
      total += g[i][0];
      REP (t, M) skills[t] += g[i][t+1];
    }

    // check skills
    bool is_ok = true;
    REP (t, M) {
      if (skills[t] < X) {
        is_ok = false;
        break;
      }
    }

    // cout << "total: " << total << "\t";
    // REP (t, M) cout << "[" << t << ": " << skills[t] << "]\t";
    // cout << endl;

    if (!is_ok) continue;
    else if (total < ans) {
      ans = total;
    }
  }

  if (ans == 10000100) cout << "-1\n";
  else cout << ans << '\n';
}



Measured memory_bytes: 3624
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int mod = (int)1e9+7;
const int nax = 405;
const ll INF = 1e18+5;
int n;
int a[22][22];
ll dp[1<<22][22];

ll solve(int mask, int i){
	if(mask==(1<<n)-1)
		return 1;
	if(i==n)
		return 0;
	if(dp[mask][i]!=-1)
		return dp[mask][i];
	ll ans = 0;
	for(int j=0;j<n;j++){
		if(!(mask&(1<<j)) && a[i][j]){
			ans = (ans + solve(mask|(1<<j),i+1 ))%mod;
		}
	}
	return dp[mask][i] = ans;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	cin>>n;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++)
			cin>>a[i][j];
	}
	memset(dp,-1,sizeof(dp));
	cout<<solve(0,0);
    return 0;
}









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

#pragma region Macro
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define SORT(v) sort(v.begin(), v.end())
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define vi vector<int>
#define vvi vector<vector<int>>
#define chmax(x,y) (x = max(x,y))
#define chmin(x,y) (x = min(x,y))

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#pragma endregion

void solve(){
	#define int ll
	// ここに処理を記述
	// コンパイル時はエイリアス「gpp」--> c++17でコンパイル
	ll H;
	cin >> H;

	ll ans = 1;
	ll temp = H;
	ll amount = 1;
	while(temp > 1){
		temp /= 2;
		amount *= 2;
		ans += amount;
	}

	cout << ans << endl;
}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	
	solve();
	return 0;
}

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

int main(int, char**) {
  int n;
  std::cin >> n;
  std::vector<long long> as(n);

  long long sum{};
  for(int i{}; i < n; ++i) {
    std::cin >> as[i];
    sum += as[i];
  }
  sum /= 2;

  long long v{sum};
  for(int i{1}; i < n; i += 2) {
    v -= as[i];
  }
  std::cout << 2 * v << std::endl;

  for(int i{0}; i < n - 1; ++i) {
    v = as[i] - v;
    std::cout << 2 * v << std::endl;
  }

  return 0;
}


Measured memory_bytes: 2048
import sys, os, math, bisect, itertools, collections, heapq, queue, copy, array

# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
# from decimal import Decimal
# from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
INF = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    D, X = il()
    ret = X

    for n in range(N):
        A = ii()
        d, m = divmod(D, A)
        if m == 0:
            ret += D // A
        else:
            ret += D // A + 1
    print(ret)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9740
#include <iostream>
#include <vector>
#include <algorithm>
#include <limits>
using namespace std;
bool reitou[100];
int time_table[100][100];
int main(void) {
	for (;;) {
		int n, m, l, k, a, h;
		cin >> n >> m >> l >> k >> a >> h;
		if (!n)return 0;
		fill(&reitou[0], &reitou[100], false);
		fill(&time_table[0][0], &time_table[99][100], numeric_limits<int>::max() >> 1);
		reitou[a] =reitou[h] =true;
		for (int i = 0; i < l; i++) {
			int buf;
			cin >> buf;
			reitou[buf] = true;
		}
		for (int i = 0; i < k; i++) {
			int x, y, t;
			cin >> x >> y >> t;
			time_table[x][y] = t;
			time_table[y][x] = t;

		}
		for (int i = 0; i < n; i++)time_table[i][i] = 0;
		for (int i = 0; i < n; i++) {//??????????????±???
			for (int j = 0; j < n; j++) {
				for (int k = 0; k < n; k++) {
					time_table[j][k] = min(time_table[j][k], time_table[j][i] + time_table[i][k]);
				}
			}
		}
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				if (!reitou[i])time_table[i][j] = numeric_limits<int>::max() >> 1;
				if (!reitou[j])time_table[i][j] = numeric_limits<int>::max() >> 1;
				if (time_table[i][j]>m)time_table[i][j] = numeric_limits<int>::max() >> 1;
			}
		}
		for (int i = 0; i < n; i++) {//??????????????±???
			for (int j = 0; j < n; j++) {
				for (int k = 0; k < n; k++) {
					time_table[j][k] = min(time_table[j][k], time_table[j][i] + time_table[i][k]);
				}
			}
		}
		if (time_table[a][h] == (numeric_limits<int>::max() >> 1)) {
			cout << "Help!" << endl;
		}
		else {
			cout << time_table[a][h] + max(0, time_table[a][h] - m) << endl;
		}
	}
}

Measured memory_bytes: 1204
N=int(input())
B=list(map(int,input().split()))
ls = [0]*N
ls[0] = B[0]
#print(B)
for i in range(1,N-1):
    if B[i-1] <= B[i]:
        ls[i] = B[i-1]
    else:
        ls[i] = B[i]
ls[N-1] = B[N-2]
print(sum(ls))
#print(ls)


Measured memory_bytes: 61620
#include <iostream>

using namespace std;

int main(){
    int n, tmp, min, max;
    long long sum;
    cin >> n;
    cin >> tmp;
    min = tmp; max = tmp; sum = tmp;
    for(int i = 1; i < n; i++) {
        cin >> tmp;
        if(tmp < min) { min = tmp; }
        if(tmp > max) { max = tmp; }
        sum += tmp;
    }
    cout << min << " " << max << " " << sum << endl;
    return 0;
}


Measured memory_bytes: 3100
#include "bits/stdc++.h"
#define REP(i, a, n) for(int i=a; i<n; i++)
using namespace std;

int a, b;
int main() {
    cin>>a>>b;
    /*
    if(abs(a-b)<2) cout<<"Yay!"<<endl;
    else{
        if(abs(a-b))
    }*/

    bool flag=false;
    if(a<b){
        int tmp=a;
        a=b;
        b=tmp;
    }
    int cnt=16;
    while(cnt>0){

        if(a>0){
            a--;
            cnt--;
        }
        if(b>0){
            b--;
            cnt--;
        }
        else {
            cnt--;
        }

        if(a==0 && b==0){
            flag=true;
            break;
        }
    }
    if(flag) cout<<"Yay!"<<endl;
    else cout<<":("<<endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
li = list(map(int,input().split()))
li.sort()
cnt = 0


cnt_li = [0] * (10 ** 6 +1)

for i in li:
    cnt_li[i-1] += 1
    if cnt_li[i-1] == 1:
        for j in range(2*i,10**6+1,i):
            cnt_li[j-1] += 1

for k in li:
    if cnt_li[k-1] == 1:
        cnt += 1

print(cnt)

Measured memory_bytes: 32128
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////

int a[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};


int main() {
    int k;
    cin >> k;
    cout << a[k-1] << endl;
    return 0;
}


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

using namespace std;

using int64 = long long;

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

  int h, w;
  cin >> h >> w;
  vector<string> board;
  for (int i = 0; i < h; i++) {
    string row;
    cin >> row;
    board.push_back(row);
  }

  vector<string> red(h, string(w, '.'));
  vector<string> blue(h, string(w, '.'));
  for (int r = 1; r < h - 1; r++) {
    for (int c = 1; c < w - 1; c++) {
      if (r % 2 == 1) {
        red[r][c] = '#';
      } else {
        blue[r][c] = '#';
      }
      if (board[r][c] == '#') {
        red[r][c] = blue[r][c] = '#';
      }
    }
  }
  for (int r = 1; r < h - 1; r++) {
    red[r][0] = '#';
    blue[r][w - 1] = '#';
  }

  for (int r = 0; r < h; r++) {
    cout << red[r] << endl;
  }
  cout << endl;
  for (int r = 0; r < h; r++) {
    cout << blue[r] << endl;
  }
}

Measured memory_bytes: 1536
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    double R;
    cin >> R;
    print(2*R*3.14);



}

Measured memory_bytes: 3780
#include<cstdio>
using namespace std;

int main(){
	int n, x, ans;

	scanf("%d", &n);

	ans = 0;
	for (int i = 0; i < n; i++) {
		scanf("%d", &x);
		ans += x;
	}
	ans -= n;

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

	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll mod = 1e9 + 7;
int N;
ll dp[1 << 6][110];
int GAC = 1 + (1 << 5);
int ACG = (1 << 3) + (1 << 4);
int AGC = (1 << 2) + (1 << 5);
int AXG = 1 << 4;
int AGX = 1 << 2;
int mask1 = (1 << 6) - 1 - (3 << 2);
int mask2 = (1 << 6) - 1 - (3 << 4);
int main(){

    cin >> N;
    for(int i = 0; i < 4; i++){
        dp[i << 4][1] = 1;
    }
    for(int i = 1; i <= N; i++){
        if(i < 3){
            for(int j = 0; j < (1 << 6); j++){
                for(int k = 0; k < 4; k++){ 
                    dp[(j >> 2) + (k << 4)][i + 1] += dp[j][i];
                    dp[(j >> 2) + (k << 4)][i + 1] %= mod;
                    
                }
            }    
        }else{
            dp[GAC][i] = 0;
            dp[ACG][i] = 0;
            dp[AGC][i] = 0;
            for(int j = 0; j < (1 << 6); j++){
                for(int k = 0; k < 4; k++){
                    if(k == 2 && (j & mask1) == AXG) continue;
                    if(k == 2 && (j & mask2) == AGX) continue;
                    dp[(j >> 2) + (k << 4)][i + 1] += dp[j][i];
                    dp[(j >> 2) + (k << 4)][i + 1] %= mod;
                }
            }
        }
    }
    ll ans = 0;
    for(int i = 0; i < (1 << 6); i++){
        ans += dp[i][N];
        ans %= mod;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
h = list(map(int, input().split()))

h.append(0)
ans = 0
while(sum(h) > 0):
    interval_start = 0
    interval_end = 0
    interval_min = 101
    in_interval = False
    for i in range(N + 1):
        if not in_interval:
            if h[i] == 0:
                continue
            else:
                in_interval = True
                interval_start = i
                interval_min = h[i]
        else:
            if h[i] == 0:
                in_interval = False
                interval_end = i
                ans += interval_min
                for j in range(interval_start, interval_end):
                    h[j] -= interval_min
            else:
                interval_min = min(interval_min, h[i])           
print(ans)

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

int dx[6] = {1, 1, 0, -1, -1, 0};
int dy[6] = {0, 1, 1, 0, -1, -1};
int Map[250][250];

int main(){

    while(1){
        int t, n; cin >> t >> n;
        if(!t) break;

        for(int i = 0; i < 250; i++){
            for(int j = 0; j < 250; j++){
                Map[i][j] = 1;
            }
        }

        for(int i = 0; i < n; i++){
            int x, y; cin >> x >> y;
            x += 100;
            y += 100;
            Map[x][y] = 0;
        }

        int sx, sy; cin >> sx >> sy;

        int ans = 1;
        queue<pair<int, pair<int, int> > > q;
        q.push({0, {sx + 100, sy + 100}});
        Map[sx + 100][sy + 100] = 0;
        while(!q.empty()){
            int cost = q.front().first;
            int nowx = q.front().second.first;
            int nowy = q.front().second.second;
            //cout << nowx-100 << " " << nowy-100 << " " << cost  << endl;
            q.pop();
            if(cost >= t) continue;

            for(int h = 0; h < 6; h++){
                int nx = nowx + dx[h];
                int ny = nowy + dy[h];
                if(Map[nx][ny]){
                    ans++;
                    Map[nx][ny] = 0;
                    q.push({cost + 1, {nx, ny}});
                }
            }
        }

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


Measured memory_bytes: 3400