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

#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;

int main(){
	cin.tie(NULL);
	ios::sync_with_stdio(false);
	//insert code
	int n;
	cin>>n;
	vi arr(n);
	rep(i,0,n)cin>>arr[i];
	vector<int>dp(n,INT_MAX);
	dp[0]=0;
	dp[1]=abs(arr[0]-arr[1]);
	for (int i=2;i<n;i++){
		dp[i]=min(dp[i],min(dp[i-1]+abs(arr[i]-arr[i-1]),dp[i-2]+abs(arr[i]-arr[i-2])));
	}
	cout<<dp[n-1]<<endl;
	return 0;
}

Measured memory_bytes: 1024
import math
import itertools
N=int(input())

def lengs(inp):
    x=0.0;y=0.0;S=0.0
    for i in range(N):
        J=math.sqrt((inp[i][0]-x)**2+(inp[i][1]-y)**2)
        x=float(inp[i][0]);y=float(inp[i][1])
        if i!=0:S+=J
    return S

J=[]
for i in range(N):
    j=input().split()
    J.append([float(j[0]),float(j[1])])
Js=list(itertools.permutations(J))
S=0.0
for Ja in Js:
    S+=lengs(Ja)
S=S/len(Js)
print(S)


Measured memory_bytes: 8052
import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 19
MOD = 10 ** 9 + 7
EPS = 10 ** -10

l, r, d = MAP()

ans = 0
for i in range(l, r+1):
    if i % d == 0:
        ans += 1
print(ans)


Measured memory_bytes: 9348
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < n; ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
#define FORV(i, v) for (auto i = v.begin(); i != v.end(); i++)
using namespace std;

using ll = long long;

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; }
const int INF = 1001001001;
const long long INFLL = LLONG_MAX / 3;
const double eps = (1e-9);

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

  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i, n) cin >> a[i];

  vector<bool> dp(k+1, false);  // 石が i 個のとき手番が回ってきたプレイヤーが勝てるか
  for (int i = 1; i <= k; i++) {
    for (int j = 0; j < n; j++) {
      if (i - a[j] < 0) continue;
      dp[i] = dp[i] | !dp[i-a[j]];
    }
  }

  if (dp[k]) puts("First");
  else puts("Second");

  return 0;
}


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

int main() {
    int L, R, d;
    cin >> L >> R >> d;

    int ans = 0;
    for (int i = L; i <= R; i++)
    {
        if (i % d == 0) ans++;
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define N 100020
#define ll long long
using namespace std;
inline int read(){
  int x=0,f=1;char ch=getchar();
  while(ch>'9'||ch<'0')ch=='-'&&(f=0)||(ch=getchar());
  while(ch<='9'&&ch>='0')x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
  return f?x:-x;
}

int fa[N], sz[N];
int find(int x) {
  return fa[x] == x ? x : fa[x] = find(fa[x]);
}

typedef pair<int, int> kotori;
set<kotori> mp;
set<int> es[N];
map<kotori, int> ct;
queue<kotori> que;

void insert(int x, int y) {
  if (x > y) swap(x, y);
  kotori res = {x, y};
  if (++ ct[res] == 2) {
    que.push(res);
  }
  mp.insert(res);
}

void erase(int x, int y) {
  if (x > y) swap(x, y);
  mp.erase({x, y});
}

int main(int argc, char const *argv[]) {
  int n = read();

  for (int i = 1; i <= n; ++ i) {
    fa[i] = i;
  }

  for (int i = 1; i < n*2-1; ++ i) {
    int x = read(), y = read();
    insert(x, y);
    es[x].insert(y);
    es[y].insert(x);
  }

  while (!que.empty()) {
    kotori prpr = que.front();
    que.pop();

    int x = find(prpr.first);
    int y = find(prpr.second);

    if (x == y) continue;

    if (es[x].size() > es[y].size()) {
      swap(x, y);
    }

    fa[x] = y;
    erase(x, y);
    es[y].erase(x);
    for (int to : es[x]) {
      to = find(to);
      if (to == y) continue;
      erase(x, to);
      insert(to, y);
      es[to].erase(x);
      es[to].insert(y);
      es[y].insert(to);
    }

  }

  int ans = 0;
  for (int i = 1; i <= n; ++ i) {
    ans += fa[i] == i;
  }

  if (ans == 1) puts("YES");
  else          puts("NO");

  return 0;
}

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

int N;ll A[20];
ll Solve(int l,int r,ll lm,ll rm){
	if(l>r) return 0;
	ll ans=0x3f3f3f3f3f3f3f3fLL;
	for(int i=l;i<=r;i++)
		ans=min(ans,Solve(l,i-1,lm,rm+lm)+Solve(i+1,r,lm+rm,rm)+A[i]*(lm+rm));
	return ans;
}

int main(){
	scanf("%d",&N);
	for(int i=1;i<=N;i++) scanf("%lld",&A[i]);
	printf("%lld\n",A[1]+A[N]+Solve(2,N-1,1,1));
} 

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

#[allow(unused_macros)]
macro_rules! scan {
  ($e:expr; $t:ty) => {
    $e.get::<$t>()
  };
  ($e:expr; $($t:ty), *) => {
    ($($e.get::<$t>(),)*)
  }
}

struct Scanner<R: Read> {
  reader: R
}

#[allow(dead_code)]
impl<R: Read> Scanner<R> {
  fn new(reader: R) -> Scanner<R> {
    Scanner { reader: reader }
  }
  fn safe_get<T: FromStr>(&mut self) -> Option<T> {
    let token = self.reader.by_ref().bytes().map(|c| c.unwrap() as char)
      .skip_while(|c| c.is_whitespace())
      .take_while(|c| !c.is_whitespace())
      .collect::<String>();
    if token.is_empty() { None } else { token.parse().ok() }
  }
  fn get<T: FromStr>(&mut self) -> T {
    if let Some(v) = self.safe_get() { v } else {
      writeln!(stderr(), "Terminated with EOF").unwrap();
      std::process::exit(0);
    }
  }
}

fn max(a: i32, b: i32) -> i32 { if a > b { a } else { b } }
fn min(a: i32, b: i32) -> i32 { if a < b { a } else { b } }

fn main() {
  let cin = stdin();
  let cin = cin.lock();
  let mut sc = Scanner::new(cin);
  let (a, b, c) = scan!(sc; i32, i32, i32);
  println!("{}", if max(a, b) > c && min(a, b) < c { "Yes" } else { "No" });
}


Measured memory_bytes: 4352
/*
ID: htc9811
LANG: C++
TASK: 
*/

#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<cstdio>
#include<cstring>
#include<queue>
#include<deque>
#include<stack>
#include<ctime>
#include<cmath>
#include<complex>
#include<cstdlib>
#include<iomanip>
#include<utility>
#include<cctype>
#include<bitset>
#include<list>
using namespace std;

const int N=2e5+7;
int a[N];
int n;
long long ans;
long long sum[N];
map<long long,int> s;

int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",a+i);
	for(int i=1;i<=n;i++) sum[i]=sum[i-1]+a[i];
	s[0]=1;
	for(int i=1;i<=n;i++) ans+=s[sum[i]]++;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 15104
#include <iostream>

using namespace std;

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

  if(S == "Sunny") {
    cout << "Cloudy";
  } else if(S == "Cloudy") {
    cout << "Rainy";
  } else {
    cout << "Sunny";
  }

  return 0;
}


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

int main()
{
    int H, W;
    cin >> H >> W;

    string c;

    for (int i = 0; i < W + 2; i++)
        cout << '#';
    cout << endl;

    for (int i = 0; i < H; i++)
    {
        cin >> c;
        cout << '#' << c << '#' << endl;
    }

    for (int i = 0; i < W + 2; i++)
        cout << '#';
    cout << endl;
}


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

using namespace std;

int main() {
    int N;
    vector<int> d;
    cin >> N;
    for (int i = 0; i< N; i++) {
        int a;
        cin >> a;
        d.push_back(a);
    }
    sort(d.begin(), d.end());
    cout << d[N/2] - d[N/2 - 1] << endl;
}

Measured memory_bytes: 892
// AOJ 0275 Railroad
// 2018.2.21 bal4u

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

#define QMAX 10000
typedef struct { int t, s; } QUE;
QUE que[QMAX+2]; int qsize;

#define PARENT(i) ((i)>>1)
#define LEFT(i)   ((i)<<1)
#define RIGHT(i)  (((i)<<1)+1)

void min_heapify(int i)
{
	int l, r, min;
	QUE qt;

	l = LEFT(i), r = RIGHT(i);
	if (l < qsize && que[l].t < que[i].t) min = l; else min = i;
	if (r < qsize && que[r].t < que[min].t) min = r;
	if (min != i) {
		qt = que[i], que[i] = que[min], que[min] = qt;
		min_heapify(min);
	}
}

void deq()
{
	que[0] = que[--qsize];
	min_heapify(0);
}

void enq(int s, int t)
{
	int i, min;
	QUE qt;

	i = qsize++;
	que[i].s = s, que[i].t = t;
	while (i > 0 && que[min = PARENT(i)].t > que[i].t) {
		qt = que[i], que[i] = que[min], que[min] = qt;
		i = min;
	}
}

#define INF 0x10101010
#define MAX 100003

int S; 
int   hi[MAX], *to[MAX]; short *w[MAX];
int dist[MAX];
char  mk[MAX];
int hi2[MAX], *to2[MAX];

int   q[MAX], top, tail;
typedef struct { int s, e; } T;
T ord[200002], _ord[200002]; int sz;
int f[200002];

int c[40002], d[40002];
unsigned long long dp[MAX];

//#define getchar_unlocked()  getchar()
int in()
{
	int n = 0;
	int c = getchar_unlocked();
	do n = (n<<3)+(n<<1) + (c & 0xf), c = getchar_unlocked();
	while (c >= '0');
	return n;
}

void dijkstra(int start)
{
	int i, s, e, d;

	memset(dist, INF, S << 2);
	qsize = 0;
	enq(start, 0), dist[start] = 0;
	while (qsize) {
		s = que[0].s, deq();
		for (i = 0; i < hi[s]; i++) {
			e = to[s][i], d = dist[s] + w[s][i];
			if (dist[e] > d) hi2[e] = 0, enq(e, d);
			if (dist[e] >= d) dist[e] = d, to2[e][hi2[e]++] = s;
		}
	}
}

void order(int goal)
{
    int i, k, s, e, max;

	max = 0;
	q[0] = goal, top = 0, tail = 1;
	mk[goal] = 1;
	sz = 0;
	while (top < tail) {
		s = q[top++];
		for (i = 0; i < hi2[s]; i++) {
			e = to2[s][i];
			if (!mk[e]) mk[e] = 1, q[tail++] = e;

			_ord[sz].s = e, _ord[sz++].e = s;
			k = dist[s];
			if (k > max) max = k;
			f[k]++;
		}
	}

	for (i = 1; i <= max; i++) f[i] += f[i-1];
	for (i = sz-1; i >= 0; i--) {
		k = dist[_ord[i].e], ord[--f[k]] = _ord[i];
	}
}

int main()
{
	int R, Q, u, v, _w, a, b, i, j, k;
	int *memo;
	
	S = in()+1, R = in();
	memo = malloc(R*3*sizeof(int));
	j = 0, i = R; while (i--) {
		memo[j++] = u = in(), hi[u]++;
		memo[j++] = v = in(), hi[v]++;
		memo[j++] = in();
	}
	for (i = 0; i < S; i++) if (hi[i]) {
		to [i] = malloc(hi[i] << 2), w[i] = malloc(hi[i] << 1);
		to2[i] = malloc(hi[i] << 2);
	}

	memset(hi, 0, S << 2);
	j = 0; while (R--) {
		u = memo[j++], v = memo[j++], _w = memo[j++];
		k = hi[u]++, to[u][k] = v, w[u][k] = _w;
		k = hi[v]++, to[v][k] = u, w[v][k] = _w;
	}
	free(memo);
	
	a = in(), b = in();
	dijkstra(a);
	order(b);

	Q = in();
	for (i = 0; i < Q; i++) c[i] = in(), d[i] = in();
	k = (Q+63)>>6; for (i = 0; i < k; i++) {
        memset(dp, 0, sizeof(dp));
		for (j = 0; j < 64; j++) if ((i<<6)+j < Q) dp[c[(i<<6)+j]] |= 1LL<<j;
		for (j = 0; j < sz; j++) dp[ord[j].e] |= dp[ord[j].s];
        for (j = 0; j < 64; j++) if ((i<<6)+j < Q) {
            puts(dp[d[(i<<6)+j]] & (1LL<<j)? "Yes": "No");
		}
    }
	return 0;
}



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

int main(){
	int n, w; cin >> n >> w;
	P a[n]; rep(i, n) cin >> a[i].first >> a[i].second;

	int dp[n+1][w+1];
	memset(dp, 0, sizeof(dp));
	loop(i, 1, n+1)loop(j, 1, w+1){
		if(j - a[i-1].second >= 0) dp[i][j] = max(dp[i-1][j], dp[i][j-a[i-1].second]+a[i-1].first);
		else dp[i][j] = dp[i-1][j];
	}
	cout << dp[n][w] << endl;

	return 0;
}



Measured memory_bytes: 7044
#pragma GCC optimize("Ofast") 

////////////////////////////////////////////////////////////////////////////////

#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define endl "\n"
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#define bew ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define all(x) x.begin(),x.end()
#define pb push_back
#define fi first
#define se second
#define mod (long)(1e9+7)
#define ip(ar,n) for(int i=0;i<n;++i)cin>>ar[i];
#define op(ar,n) for(int i=0;i<n;++i)cout<<ar[i]<<" ";
#define print(...) for(auto xas:{__VA_ARGS__})cerr<<xas<<" ";
#define test int t;cin>>t;while(t--)
#define tar(x) int x;cin>>x;
#define fil(ar,val) memset(ar,val,sizeof ar)
#define loop(n) for(int i=0;i<n;++i)
#define coutd(x,y) printf("%0.y lf",x);
#define verdict(x,y) if(flag)cout<<x;else cout<<y;


////////////////////////////////////////////////////////////////////////////////

typedef vector<int> vec; 
typedef pair<int, int> pa; 
typedef vector<pa> vecp; 
typedef set<int> se;
typedef map<int,int> ma;

////////////////////////////////////////////////////////////////////////////////

void manupulate(string &str)
{
    for(int i=0;i<str.size();++i)
    str[i]-=48;
}

bool isprime(int n)
{
    if(n<=1)
        return false;
    for(int i=2;i*i<=n;++i)
    if(n%i==0)
        return false;
    return true;
}

int expo(int a,int n)
{
    if(n==0)
        return 1;
    if(n==1)
        return a;
    int tmp=expo(a,n/2);
    tmp=(tmp*tmp)%mod;
    if(n&1)
        tmp=(tmp*a)%mod;
    return tmp;
}


////////////////////////////////////////////////////////////////////////////////



signed main() {
bew;

    tar(s);
    tar(w);
    if(w>=s)
    cout<<"unsafe";
    else
    cout<<"safe";
 
    
















return 0;
}

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

using namespace std;

int str[10];

void getBinStr(int target) {
  int nowMod;
  int nowDiv = target;
  int i;

  for(i = 0; i < 10 && nowDiv != 0; i++) {
    nowMod = nowDiv % 2;
    nowDiv /= 2;
    str[i] = nowMod;
  }
  for(int j = i; j < 10; j++) {
    str[j] = 0;
  }
}


int main(void) {
  int target;
  const static int weight[] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};
  while(cin >> target) {
    getBinStr(target);
    bool isFirst = true;
    for(int i = 0; i < 10; i++) {
      if(str[i] == 1) {
        if(isFirst) {
          cout << weight[i];
          isFirst = false;
        }
        else {
          cout << " " << weight[i];
        }
      }
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 1156
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<unordered_map>
#include<array>
#include<map>
#include<bitset>
#include<iomanip>
#include<list>
#include <numeric>
using namespace std;
typedef unsigned long long int ulint;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
#define RE return 0
//ios::sync_with_stdio(false);
//std::cin.tie(0);
//<< setprecision(20)
const int mod=(int)1e9+7;
const llint big=(llint)(2.19e12+1);
const long double pai=3.141592653589793238462643383279502884197;
const long double ena=2.71828182845904523536;
const long double eps=1e-7;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
template <class T> void soun(T& ar)
{sort(ar.begin(),ar.end());ar.erase(unique(ar.begin(),ar.end()),ar.end());}
llint gcd(llint a,llint b){if(a%b==0){return b;}else{return gcd(b,a%b);}}
llint lcm(llint a,llint b){return a/gcd(a,b) *b;}
template<class T,class U> auto LB(T& ve,U in){return lower_bound(ve.begin(),ve.end(),in);}
template<class T,class U> auto UB(T& ve,U in){return upper_bound(ve.begin(),ve.end(),in);}
template<class T,class U> auto LBI(T& ve,U in){return LB(ve,in)-ve.begin();}
template<class T,class U> auto UBI(T& ve,U in){return UB(ve,in)-ve.begin();}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
int main(void){
	int a,b,c;cin>>a>>b>>c;
	if(a>b){swap(a,b);}
	if(b>c){swap(b,c);}
	if(a>b){swap(a,b);}
	cout<<a<<" "<<b<<" "<<c<<endl;
	RE;
}


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

public class Main {
	public static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		//A
		/*int N = sc.nextInt();
		String N_S = String.valueOf(N);
		char N1,N2,N3,N4;
		N1 = N_S.charAt(0);
		N2 = N_S.charAt(1);
		N3 = N_S.charAt(2);
		N4 = N_S.charAt(3);
		if((N1==N2&&N1==N3)||(N2==N4&&N3==N4))
			System.out.println("Yes");
		else
			System.out.println("No");*/

		//B
		int N =sc.nextInt();
		ArrayList<Long> List = new ArrayList<Long>();
		List.add((long) 2);
		List.add((long) 1);
		for(int i = 2 ; i <= N ; i++){
			List.add(List.get(i-1)+List.get(i-2));
		}
		System.out.println(List.get(N));
	}
}


Measured memory_bytes: 21844
import java.util.Scanner;

class Main {

  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    long N = scanner.nextLong();
    long M = scanner.nextLong();
    if (N >= 3 && M >= 3) {
      System.out.println((N - 2) * (M - 2));
      return;
    } else if (N == 2 || M == 2) {
      System.out.println(0);
      return;
    } else {
      System.out.println(Math.max(Math.max(N, M) - 2, 1));
      return;
    }
  }

}


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

const int N = 1e5+5;
int dist[N], vis[N];
std::vector<int> graph[N], sorted;

void dfs(int v) {
  if(vis[v]) return;
  vis[v] = true;
  for (int u : graph[v]) dfs(u);
  sorted.push_back(v);
}

int32_t main() {
  int n, m;
  scanf("%d%d", &n, &m);

  for (int i = 0; i < m; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    graph[a].push_back(b);
  }

  for (int i = 1; i <= n; i++) dfs(i);
  std::reverse(sorted.begin(), sorted.end());

  int ans = 0;
  for (int v: sorted)
    for (int u : graph[v]) 
      ans = std::max(ans, dist[u] = std::max(dist[u], dist[v] + 1));

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


Measured memory_bytes: 9080
n,k = map(int,input().split())
point = 0

for i in range(1,n+1):
    j = 1/n
    if i >= k:
        point += j
        continue
    now = i
    count = 0
    while now < k:
        now *= 2
        count += 1
    j *= (1/2)**count
    point += j
    
print(point)

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

int main() {
  int N ; 
  cin >> N ;
  
  for ( int i = 0 ; i <= N ; i++ ){
  	char hina ; 
    cin >> hina ; 
    if ( hina == 'Y' ) {
      cout << "Four" << endl ;
      break;
    }
    else if (i == N )
      cout << "Three" << endl ; 
    }
  
}




Measured memory_bytes: 256
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;
use std::f64::consts::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

fn main() {
    input! {
        n: usize, mut k: usize,
        mut td: [(usize1, i64); n],
    }
    let mut dt = vec![];
    for (t, d) in td {
        dt.push((d, t));
    }
    dt.sort();
    dt.reverse();

    let mut p = vec![];
    let mut cnt = vec![];
    let mut s = BinaryHeap::new();
    let mut sum_ = 0;
    let mut v = vec![false; n];
    let mut cnt_acc = 0;
    for i in 0..k {
        let (d, t) = dt[i];
        sum_ += d;
        if v[t] == true {
            s.push((-d, t));
        } else {
            v[t] = true;
            cnt_acc += 1;
        }
    }
    p.push(sum_);
    cnt.push(cnt_acc);
    for i in k..n {
        let (new_d, new_t) = dt[i];
        if v[new_t] == true {
            continue;
        }
        if let Some((d_, t_)) = s.pop() {
            sum_ += d_ + new_d;
            v[new_t] = true;
            cnt_acc += 1;
            p.push(sum_);
            cnt.push(cnt_acc);
        }
    }
    let mut ans = 0;
    for i in 0..p.len() {
        ans = max(ans, p[i] + cnt[i] * cnt[i]);
    }

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


Measured memory_bytes: 8444
N, K = map(int, input().split())
P = list(map(int, input().split()))

M = [sum(P[:K]) / 2 + K / 2]

for i in range(1, N-K+1):
    M.append(M[i-1] - P[i-1]/2 + P[i-1+K]/2)


print(max(M))


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

int main() {
  double x1,x2,x3,y1,y2,y3;
  cin >> x1 >> y1;
  cin >> x2 >> y2;
  cin >> x3 >> y3;

  double a = sqrt(abs(x1-x2) * abs(x1-x2) + abs(y1-y2) * abs(y1-y2));
  double b = sqrt(abs(x1-x3) * abs(x1-x3) + abs(y1-y3) * abs(y1-y3));
  double c = sqrt(abs(x3-x2) * abs(x3-x2) + abs(y3-y2) * abs(y3-y2));
  double s = (a + b + c) / 2;
  double S = sqrt(s * (s - a) * (s - b) * (s - c));
  double r = S / s;
  double len = max(a,max(b,c));
  double L = 0, R = len;
  for(int i = 0; i < 100000; i++) {
    double min = (L + R) / 2;
    if(len * (r - min) >= 2 * min * r) L = min;
    else R = min;
  }

  cout << fixed << setprecision(13) << L << endl;
}


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


int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int s,w;

	cin>>s>>w;

	if(w>=s)
		cout<<"unsafe\n";
	else
		cout<<"safe\n";



	return 0;
}


Measured memory_bytes: 3552
import java.util.Scanner;
 
public class Main {
 
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
 
		Scanner sc = new Scanner(System.in);
 
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		
 
		if (A == B) {
 
			System.out.println(C);
 
		} else if (A == C) {
 
			System.out.println(B);
 
		} else if (B == C) {
 
			System.out.println(A);
 
		}
	}
}

Measured memory_bytes: 23124
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define repi(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,a) repi(i,0,a)
#define repd(i,a,b) for(int i = (a) ; i >= (b); i--)
#define repit(i,a) for(__typeof((a).begin()) i = (a).begin(); i!= (a).end(); i++)
#define all(u) (u).begin(),(u).end()
#define rall(u) (u).rbegin(),(u).rend()
#define UNIQUE(u) (u).erase(unique(all(u)),(u).end)

#define pb push_back
#define mp makek_pair
#define INF 1e9
#define EPS 1e-9
#define PI acos(-1.0)

using namespace std;

typedef long long ll;
typedef vector<int> vi;

int N, M, R[16][16], mem[1<<16][16][8];

int f(int s, int i, int h)
{
    if (mem[s][i][h] >= 0) return mem[s][i][h];
    if (!(s >> i & 1)) return 0;
    int sz = __builtin_popcount(s);
    if (sz == 1) return 1;

    int ret = 0;
    int M = 1 << h - 1;
    int m = sz - M;
    int tmp = s ^ 1 << i;
    for (int t = tmp; t; --t, t &= tmp) {
	int k = __builtin_popcount(t);
	if (m <= k && k <= M)
	    for (int j = 0; j < N; ++j)
		if (R[i][j])
		    ret += f(s ^ t, i, h - 1) * f(t, j, h - 1);
    }
    return mem[s][i][h] = ret;
}

void solve()
{
    memset(mem, -1, sizeof(mem));

    --M;
    rep(i,N) rep(j,N) cin >> R[i][j];

    cout << f((1 << N) - 1, M, 32 - __builtin_clz(N - 1)) << endl;
}

int main()
{
    while (cin >> N >> M && N)
	solve();

    return 0;
}

Measured memory_bytes: 33940
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define space putchar(' ')
#define enter putchar('\n')
#define mp make_pair
#define MAXN 2005
//#define ivorysi
using namespace std;
typedef long long int64;
template<class T>
void read(T &res) {
    res = 0;char c = getchar();T f = 1;
    while(c < '0' || c > '9') {
	if(c == '-') f = -1;
	c = getchar();
    }
    while(c >= '0' && c <= '9') {
	res = res * 10 + c - '0';
	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {putchar('-');x = -x;}
    if(x >= 10) {
	out(x / 10);
    }
    putchar('0' + x % 10);
}
const int MOD = 1000000007;
int N,M,bl[MAXN],fa[MAXN],dep[MAXN],up,eq;
int64 X,T,faE[MAXN];
bool vis[MAXN];
struct Edge {
    int to,next;int64 val;
}E[MAXN * 2];
int head[MAXN],sumE;
struct node {
    int u,v;int64 val;
    friend bool operator < (const node &a,const node &b) {
	return a.val < b.val;
    }
}Ed[MAXN];
int inc(int a,int b) {
    return a + b >= MOD ? a + b - MOD : a + b;
}
int mul(int a,int b) {
    return 1LL * a * b % MOD;
}
int fpow(int x,int c) {
    int res = 1,t = x;
    while(c) {
	if(c & 1) res = mul(res,t);
	t = mul(t,t);
	c >>= 1;
    }
    return res;
}
void update(int &x,int y) {
    x = inc(x,y);
}
void add(int u,int v,int64 c) {
    E[++sumE].to = v;
    E[sumE].next = head[u];
    E[sumE].val = c;
    head[u] = sumE;
}
void dfs(int u) {
    dep[u] = dep[fa[u]] + 1; 
    for(int i = head[u] ; i ; i = E[i].next) {
	int v = E[i].to;
	if(v != fa[u]) {
	    fa[v] = u;
	    faE[v] = E[i].val;
	    dfs(v);
	}
    }
}
int getfa(int u) {
    return bl[u] == u ? u : bl[u] = getfa(bl[u]);
}
int64 Query(int u,int v) {
    if(dep[u] < dep[v]) swap(u,v);
    int64 res = 0;
    while(dep[u] > dep[v]) {
	res = max(res,faE[u]);
	u = fa[u];
    }
    if(u == v) return res;
    while(u != v) {
	res = max(res,faE[u]);
	res = max(res,faE[v]);
	u = fa[u];v = fa[v];
    }
    return res;
}
void Solve() {
    read(N);read(M);read(X);
    for(int i = 1; i <= M ; ++i) {
	read(Ed[i].u);read(Ed[i].v);read(Ed[i].val);
    }
    for(int i = 1 ; i <= N ; ++i) bl[i] = i;
    sort(Ed + 1,Ed + M + 1);
    for(int i = 1 ; i <= M ; ++i) {
	if(getfa(Ed[i].u) != getfa(Ed[i].v)) {
	    vis[i] = 1;
	    T += Ed[i].val;
	    add(Ed[i].u,Ed[i].v,Ed[i].val);
	    add(Ed[i].v,Ed[i].u,Ed[i].val);
	    bl[getfa(Ed[i].u)] = getfa(Ed[i].v);
	}
    }
    dfs(1);
    for(int i = 1 ; i <= M ; ++i) {
	if(!vis[i]) {
	    int64 d = Ed[i].val - Query(Ed[i].v,Ed[i].u);
	    if(d == X - T) ++eq;
	    else if(d > X - T) ++up;
	}
    }
    if(X < T) {puts("0");return;}
    else if(X == T) {
	int ans = 0;
	update(ans,mul(inc(fpow(2,N - 1),MOD - 2),fpow(2,M - N + 1)));
	update(ans,mul(mul(2,inc(fpow(2,eq),MOD - 1)),fpow(2,up)));
	out(ans);enter;
    }
    else {
	int ans = 0;
	update(ans,mul(mul(2,inc(fpow(2,eq),MOD - 1)),fpow(2,up)));
	out(ans);enter;
    }
}
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
}


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

using namespace std;

int
main(void){
	vector<vector<int> > vec(3, vector<int> (3));
	for(int i = 0; i < 3; i++){
		for(int j = 0; j < 3; j++){
			cin >> vec[i][j];
		}
	}
	vector<int> a(3);
	for(a[0] = -100; a[0] <= 100; a[0]++){
		for(a[1] = -100; a[1] <= 100; a[1]++){
			for(a[2] = -100; a[2] <= 100; a[2]++){
				vector<int> b(3);
				b[0] = vec[0][0] - a[0]; b[1] = vec[0][1] - a[0]; b[2] = vec[0][2] - a[0];
				bool flag = true;
				for(int i = 1; i < 3; i++){
					for(int j = 0; j < 3; j++){
						if(vec[i][j] != a[i] + b[j]){
							flag = false;
						}
					}
				}
				if(flag){
					cout << "Yes";
					return 0;
				}
			}
		}
	}
	cout << "No";
	
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    abc093b()
}

// retest
fun abc093b() {
    val (a, b, k) = readLine()!!.split(" ").map { it.toLong() }

    val answer = (a..b).filter { it < a + k || it > b - k }

    println(answer.joinToString(separator = System.lineSeparator()))
}


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

using i64 = int64_t;

#define rep(i, x, y) for (i64 i = i64(x), i##_max_for_repmacro = i64(y); i < i##_max_for_repmacro; ++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf = 1.01e9;
const i64 inf64 = 4.01e18;
const double eps = 1e-9;

template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "(" << p.first << ", " << p.second << ")";
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "[";
    for (const auto &v : vec) {
        os << v << ",";
    }
    os << "]";
    return os;
}

template <typename T>
bool chmin(T &a, const T &b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

void solve() {
    //const i64 mod = 1'000'000'007;

    i64 N;
    cin >> N;

    vector<i64> x(N);
    vector<i64> cnt(4);
    rep(i,0,N){
        cin >> x[i];
        ++cnt[x[i]];
    }

    const i64 size=301;
    using ld = long double;
    static ld memo[size][size][size];
    static bool done[size][size][size];
    fill_n((ld*)memo, size*size*size, 0);
    fill_n((bool*)done, size*size*size, false);
    function<long double(i64,i64,i64)> rec=[&](i64 b,i64 c,i64 d){
        if(done[b][c][d]) return memo[b][c][d];
        done[b][c][d]=true;

        i64 a=N-b-c-d;
        auto& res=memo[b][c][d];

        if(a==N) return res=0;

        if(a==0){
            if(b>0) res+=(((long double)b)/N)*(rec(b-1,c,d)+1);
            if(c>0) res+=(((long double)c)/N)*(rec(b+1,c-1,d)+1);
            if(d>0) res+=(((long double)d)/N)*(rec(b,c+1,d-1)+1);
        }else{
            long double p=1-(((long double)a)/N);
            res+=(1-p)/p;
            if(b>0) res+=(((long double)b)/N)/p*(rec(b-1,c,d)+1);
            if(c>0) res+=(((long double)c)/N)/p*(rec(b+1,c-1,d)+1);
            if(d>0) res+=(((long double)d)/N)/p*(rec(b,c+1,d-1)+1);
        }

        return res;
    };

    cout << rec(cnt[1],cnt[2],cnt[3]) << endl;
}

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


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

using ll = long long;

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

    int n, m;
    cin >> n >> m;

    ll x[m];
    for (int i = 0; i < m; ++i) {
        cin >> x[i];
    }

    sort(x, x + m);
    ll total_diff = abs(x[0] - x[m - 1]);
    ll diff[m - 1];
    for (int i = 0; i < m - 1; ++i) {
        diff[i] = abs(x[i] - x[i + 1]);
    }
    sort(diff, diff + m - 1);

    int length = min(n - 1, m - 1);
    for (int i = 0; i < length; ++i) {
        total_diff -= diff[m - 2 - i];
    }

    cout << total_diff << '\n';

    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
//#pragma GCC optimize("O3")
//#pragma GCC target ("sse4")
using namespace std;
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define MEM(x,a) memset((x),a,sizeof((x)))
#define F first
#define S second
#define imx INT_MAX
const long long MOD = (long long)(1e9+7);
const long long MMX = (long long)(1e18);
typedef long long LL;
typedef pair<int,int> pii;
int n;
char c[100005];
string k[4];
bitset<100005>uu;
int main()
{
    scanf("%s",c+1);
    n=strlen(c+1);
    k[0]="dream";
    k[1]="dreamer";
    k[2]="erase";
    k[3]="eraser";
    uu[0]=true;
    for(int i=1;i<=n;i++)
    {
        for(int j=0;j<4;j++)
        {
            int tp=k[j].size();
            if(tp>i)continue;
            bool p=true;
            for(int cur=0;cur<tp;cur++)
            {
                if(c[i-(tp-1-cur)]!=k[j][cur])p=false;
            }
            if(p&&uu[i-tp])uu[i]=true;
        }
    }
    if(uu[n])printf("YES");
    else printf("NO");
}


Measured memory_bytes: 3924
#include <stdio.h>

int main(void)
{
  char n[10];
  int i;

  i = 0;
  fgets(n, 10, stdin);
  while (n[i])
  {
    if (n[i] == '7')
    {
      puts("Yes");
      return (0);
    }
    i++;
  }
  puts("No");
  return (0);
}

Measured memory_bytes: 1492
#![allow(unused)]

use std::io::{Read, StdinLock};
use std::iter::{FromIterator, Iterator};
use std::str::{FromStr};
use std::string::String;

pub fn read_bytes<T: FromIterator<char>>(s: &mut StdinLock) -> T {
    s.bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<T>()
}

pub fn reads(s: &mut StdinLock) -> String {
    read_bytes::<String>(s)
}

pub fn read<T: FromStr>(s: &mut StdinLock) -> T {
    reads(s).parse().ok().unwrap()
}

fn main() {
    let sin = std::io::stdin();
    let mut sin = sin.lock();

    let l = read::<i64>(&mut sin);

    println!("{}", ((l as f64) / 3.).powi(3))
}

Measured memory_bytes: 4352
n = int(input())
a = [int(x) for x in input().split(' ')]

sum_start = 0
sum_end = 0
index_start = 0
index_end = n - 1

while True:
    if index_start > index_end:
        break
    if sum_start < sum_end:
        sum_start += a[index_start]
        index_start += 1
    else:
        sum_end += a[index_end]
        index_end -= 1

print(abs(sum_start - sum_end))


Measured memory_bytes: 26060
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce


INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007



s = S()
for i in range(len(s) - 2):
    if s[i] == s[i + 2]:
        print(i + 1, i + 3)
        break
    elif s[i] == s[i + 1]:
        print(i + 1, i + 2)
        break
    elif s[i + 1] == s[i + 2]:
        print(i + 2, i + 3)
        break
else:
    if len(s) == 2 and s[0] == s[1]:
        print(1, 2)
    else:
        print(-1, -1)


Measured memory_bytes: 40176
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <deque>
#include <queue>

#define rep(i, n) for(int i = 0; i < n; ++i)
#define REP(i, m, n) for(int i = m; i < n; ++i)
#define rrep(i,n) for(int i = n; i >= 0; --i)
#define RREP(i, m, n) for(int i = n; i >= m; --i)

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

using namespace std;

const long long MOD = 1000000007;

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

	int h, w, n;
	cin >> h >> w >> n;

	if (n / h < n / w) {
		if (n%h == 0) cout << n / h << "\n";
		else cout << n / h + 1 << "\n";
	}
	else {
		if (n%w == 0) cout << n / w << "\n";
		else cout << n / w + 1 << "\n";
	}

	return 0;
}


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

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

    bool isComfortable = true;

    for (int i = 0; i < input.length(); i++)
    {
        if (i % 2 == 0)
        {
            if (input[i] == 'L')
            {
                isComfortable = false;
                break;
            }
        }
        else if (i % 2 == 1)
        {
            if (input[i] == 'R')
            {
                isComfortable = false;
                break;
            }
        }
    }

    cout << (isComfortable ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#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");}
const int MX = 200005;
#define RET(ans) {cout<<ans<<endl;return 0;} 

    // 二次元ベクターの基本
    /*
    vector<vector<int>> dp; // 宣言
    dp.resize(n); // 1次元めの要素数決定
    dp[i].push_back(int); // プッシュバック
    rep(i,n){
        sort(dp[i].begin(),dp[i].end()); // 二次元めを昇順ソート
    }
    */

    // 整数スキャン（複数）
    /*
    int x,y,z;
    scanf("%d%d%d",&x,&y,&z);

    // n個の整数のスキャン
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // 文字列スキャン
    /*
    string s; cin >> s;
    */

    // n個の文字列スキャン
    /*
    vector<string> slist;
    rep(i,n){
        string s; cin >> s;
        slist.push_back(s);
    }
    */

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


    ll ans = 0;
    if(b/a>=c){
        ans=c;
    }else{
        ans=b/a;
    }
    
    cout << ans << endl;
    return 0;
}
 
 


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <cstdio>
#include <math.h>
using namespace std;
#define _USE_MATH_DEFINES

int main(){
	double a, b, theta;
	cin >> a >> b >> theta;

	double S = a*b*sin((theta*M_PI) / 180) / 2;
	double L = a + b + sqrt(a*a + b*b - 2 * a*b*cos(theta*M_PI / 180));
	double h = b *sin((theta*M_PI) / 180);
	printf("%.10f\n", S);
	printf("%.10f\n", L);
	printf("%.10f\n", h);
}

Measured memory_bytes: 3428
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <queue>
using namespace std;
 
map<string, int> dp;
int direction[4] = { 1, -1, 4, -4 };
 
//************************************
// Method:    bfs
// FullName:  bfs
// Access:    public 
// Returns:   void
// Qualifier: 让0漫游整个字串
//************************************
void bfs()
{
	queue<string> que;
	que.push("01234567");
	dp["01234567"] = 0;
	while (!que.empty())
	{
		string now = que.front(); que.pop();
		// p是'0'的位置
		int p = 0;
		for (int j = 0; j < 8; ++j)
		{
			if (now[j] == '0')
			{
				p = j;
				break;
			}
		}
 
		for (int i = 0; i < 4; ++i)
		{
			int n = p + direction[i];
			if (0 <= n && n < 8 && 
				!(p == 3 && i == 0) && // 右上角不能再往右了
				!(p == 4 && i == 1))   // 左下角不能再往左了
			{
				string next = now;
				swap(next[p], next[n]);
				if (dp.find(next) == dp.end())
				{
					dp[next] = dp[now] + 1;
					que.push(next);
				}
			}
		}
	}
}
 
///////////////////////////SubMain//////////////////////////////////
int main(int argc, char *argv[])
{
 
	bfs();
	string line;
	while (getline(cin, line))
	{
		line.erase(remove(line.begin(), line.end(), ' '), line.end());
		cout << dp[line] << endl;
	}
 
	return 0;
}


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

int calc(int n){
	int res = 0;
	while(n){
		res++;
		n /= 10;
	}
	return res;
}

signed main(){
	int n, ans = 1e18;
	scanf("%lld", &n);
	for(int i = 1;i*i <= n;i++){
		if(n%i != 0)continue;
		int a = calc(i), b = calc(n/i);
		ans = min(ans, max(a, b));
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
int main (){
  int n;
  scanf(" %d",&n);

  double x[10]={};
  char u[10][10]={};
  int yen=0;
  double bit=0;

  for ( int i=0; i <n; i++) {
    scanf(" %lf",&x[i]);
    scanf(" %s",u[i]);
    if(u[i][0]=='B'){bit+=x[i];}
    else {yen+=x[i];}
  }

  printf("%lf\n",yen+bit*380000);

return 0;
}


Measured memory_bytes: 128
A = []
for _ in range(3):
    A.append([int(i) for i in input().split()])
N = int(input())
B = []
for _ in range(N):
    B.append(int(input()))
matrix = [[0,0,0],[0,0,0],[0,0,0]]
def check(m):
    for i in range(3):
        if sum(m[i])==3:
            return True
    for ii in range(3):
        if m[0][ii]+m[1][ii]+m[2][ii]==3:
            return True
    if m[0][0] + m[1][1] + m[2][2] == 3:
        return True
    if m[2][0] + m[1][1] + m[0][2] == 3:
        return True
    return False
for b in B:
    for i in range(3):
        for ii in range(3):
            if A[i][ii] == b:
                matrix[i][ii] = 1
print("Yes") if check(matrix) else print("No")

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

using namespace std;

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

    bool yes = false;
    if(S[0] == S[1] && S[1] == S[2] && S[2] == S[3]){
        cout << "No" << endl;
        return 0;
    }
    if(S[0] == S[1]){
        if(S[2] == S[3]){
            yes = true;
        }
    }else if(S[0] == S[2]){
        if(S[1] == S[3]){
            yes = true;
        }
    }else if(S[0] == S[3]){
        if(S[1] == S[2]){
            yes = true;
        }
    }
    if(yes){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const long long INF = 1001001001;
const long long MOD = 1000000007;
const double EPS = 1e-10;

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

    int d,t,s;
    cin>>d>>t>>s;
    if(s*t>=d)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 3632
#include "bits/stdc++.h"
using namespace std;

int main() {
	vector<int>A(3);
	for (int i = 0;i<3;++i) {
		cin >> A[i];
	}
	sort(A.begin(),A.end());
	cout << A[0] + A[1] << endl;
	return 0;
}

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

#define mp make_pair
#define pb push_back

typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll, ll> l4;

int n;
int main()
{
  ll ans = 0, last = 0, a;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i)
    {
      scanf("%lld", &a);
      ll take = min(last, a);
      ans += take;
      a -= take;
      ans += a/2;
      last = a%2;
    }
  printf("%lld\n", ans);

}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>

using namespace std;

long long MOD = 1000000007;

template<typename T>
void cout_vec(vector<T> &vec){
    for(int i=0; i<vec.size(); i++){
        if (i!=0){
            cout << ' ';
        }
        cout << vec[i];
    }
    cout << endl;
}

template<typename T>
void cout_mat(vector<vector<T>  > &mat){
    for(int i=0; i<mat.size(); i++){
        vector<T> vec = mat[i];
        cout_vec(mat[i]);
    }
}

int H, W;
vector<vector<int> > pp={{1,0}, {0,1}, {-1,0}, {0,-1}};
int bfs(int y, int x, vector<vector<char> > &grid){
    int key=(W+2)*y+x;

    priority_queue<pair<int, int> , vector<pair<int, int> >, less<pair<int, int> > > que;
    que.push(make_pair(0,key));
    vector<vector<int> > m(H+2,vector<int>(W+2,MOD));
    m[y][x]=0;
    while((int)que.size()>0){
        int dist=que.top().first+1;
        key=que.top().second;
        que.pop();

        int h=key/(W+2);
        int w=key%(W+2);

        //if(m[h][w]!=MOD)continue;
        //cout << key << ' ' <<  h << ' ' << w << endl;
        for(int i=0; i<4; i++){
            int nh=h+pp[i][0];
            int nw=w+pp[i][1];
            
            if(m[nh][nw]<=dist || grid[nh][nw]=='#')continue;
            //cout << (w+2)*(nh)+nw << ' ' << nh << ' ' << nw << grid[nh][nw] << endl;
            m[nh][nw]=dist;
            que.push(make_pair(dist, (W+2)*(nh)+nw));
        }
    }
    //cout << endl;
    //cout_mat(m);

    int ret=0;
    for(const auto vec: m){
        for(const auto d: vec){
            if(d!=MOD){
                ret=max(ret, d);
            }
        }
    }
    return ret;
}

int main(){

    cin >> H >> W;

    vector<vector<char> > grid(H+2,vector<char>(W+2,'#'));
    for(int i=1; i<=H; i++){
        for(int j=1; j<=W; j++){
            cin >> grid[i][j];
        }
    }

    //cout_mat(grid);

    int ans=0;
    for(int i=1; i<=H; i++){
        for(int j=1; j<=W; j++){
            if(grid[i][j]=='#')continue;
            ans=max(ans, bfs(i, j, grid));
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
// D - joisino's travel
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
#define rp(i,s,e) for(int i=(s);i<(e);++i)
#define rpz(i,e) rp(i,0,e)
#define all(x) (x).begin(),(x).end()
#define DIST_MAX 1000000000

void warshall_floyd(vvi &D){
	rpz(relay,D.size()) rpz(from,D.size()) rpz(to,D.size())
		D[from][to] = min(D[from][to], D[from][relay] + D[relay][to]);
}

int main(){
	int N,M,R; cin>>N>>M>>R;
	vi RR(R); rpz(i, R){ cin>>RR[i]; RR[i]--; }

	vvi D(N, vi(N, DIST_MAX)); rpz(i, N) D[i][i] = 0;
	rpz(i, M) rpz(j, 3){ int a,b,c; cin>>a>>b>>c; D[a-1][b-1] = D[b-1][a-1] = c; }

	warshall_floyd(D);

	sort(all(RR));//最初の順列生成
	int ans = DIST_MAX;
	do{
		int d = 0;
		rpz(i, R-1) d += D[RR[i]][RR[i+1]];
		ans = min(ans, d);
	}
	while(next_permutation(all(RR)));//次の順列生成
	cout<< ans <<endl;
}

Measured memory_bytes: 384