akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
template <class T> inline void chmin(T &a, const T& b) { if (b < a) a = b; }
template <class T> inline void chmax(T &a, const T& b) { if (b > a) a = b; }
/* clang-format on */

ll gcd(ll a, ll b) {
  return b == 0 ? a : gcd(b, a % b);
}

ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

ll f(ll A, ll B, ll C) {
  return A - (A / B + A / C - A / lcm(B, C));
}

int main() {
#ifdef DEBUG
  ifstream ifs("in.txt");
  cin.rdbuf(ifs.rdbuf());
#endif
  ll A, B, C, D;
  while (cin >> A >> B >> C >> D) {
    ll res = f(B, C, D) - f(A - 1, C, D);
    cout << res << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define lli long long int
#define ld long double 
#define pb push_back
#define MAX 1e18
#define mod 1000000007
#define PI 3.14159265358979323846264338327
#define eps 1e-6
using namespace std;



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

    double t,x,y,i,l,h,mid,n,j,a,b,mx,mn;
    double th1,th2;
    
    cout<<fixed<<setprecision(20);
    
    cin>>mx>>mn>>x>>y;
    

    double tm=x*60+y;
    th1=.5*tm;
    th2=y*6;
    double d=abs(th1-th2),d2;
    //cout<<d<<endl;
    //d=90;

    d=(PI*d)/180;
   // cout<<d<<endl;
    

    cout<<sqrt(mx*mx+mn*mn-(2*mx*mn*cosl(d)));





    
  	
}

Measured memory_bytes: 4052
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int fun(char *,char *,int );
int fun(char *s1,char *s2,int n)
{
    int i,j=0,t=0;
    for(i=0;i<n;i++)
    {
        while(s1[i+t]==s2[j+t])
        {
            t++;
            if(s1[i+t]=='\0')
            {
                break;
            }
        }
        if(s1[i+t]!=s2[j+t]&&s1[i+t]!='\0')
        {
            t=0;
        }
        if(s1[i+t]=='\0')
        {
            break;
        }
    }
    return 2*n-t;
}
int main()
{
    char a[101];
    char b[101];
    int n;
    scanf("%d%s%s",&n,a,b);
    printf("%d\n",fun(a,b,n));
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <deque>
using namespace std;

string S; int Q;
void input()
{
    cin>>S>>Q;
}

void solve()
{
    deque<char> data;
    for(int i=0;i<S.length();++i){
        data.push_back(S[i]);
    }
    int rev_count=0;
    for(int i=0;i<Q;++i){
        int t; cin>>t;
        if(t==1) rev_count++;
        else if(t==2){
            int f; char c; cin>>f>>c;
            if((rev_count%2==1 && f==1)||(rev_count%2==0 && f==2)) data.push_back(c);
            else if((rev_count%2==1 && f==2)||(rev_count%2==0 && f==1)) data.push_front(c);
        }
    }
    if(rev_count%2==1) reverse(data.begin(),data.end());
    for(auto itr = data.begin(); itr != data.end(); ++itr) {
        cout<<*itr;
    }
    cout<<endl;
}

int main()
{
    cin.tie();
    ios::sync_with_stdio(false);
    input();
    solve();
    return 0;
}

Measured memory_bytes: 4088
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S,T;
  cin >> S >> T;
  int s=S.size();
  int t=T.size();
  int a=0;
  for(int i=s-t;i>=0;i--){
    a=0;
    for(int j=0;j<t;j++){
      if(S[i+j]!=T[j] && S[i+j]!='?'){a=1;}
    }
    if(a==0){
      for(int j=0;j<t;j++){S[i+j]=T[j];}
      for(int k=0;k<s;k++){
        if(S[k]=='?'){S[k]='a';}
      }
      cout << S << endl;
      return 0;
    }
  }
  cout << "UNRESTORABLE" << endl;
}

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

using namespace std;

int main(){

    int r, c;
    int sum=0;
    int all = 0;
    cin >> r >> c;
    
    vector< vector<int> > sheet((r+1), vector<int>(c+1));

    for(int i=0; i<r; i++){
        sum = 0;
        for(int j=0; j<c; j++){
            cin >> sheet[i][j];
            sum+=sheet[i][j];
        }
        sheet[i][c] = sum;
        all += sum;
    }

    for(int i=0; i<c; i++){
        sum = 0;
        for(int j=0; j<r; j++){
            sum+=sheet[j][i];
        }
        sheet[r][i] = sum;
    }

    sheet[r][c] = all;

    for(int i=0; i<r+1; i++){
        for(int j=0; j<c+1; j++){
            cout << sheet[i][j];
            if(j != c) cout << " ";
        }
        cout << endl;
    }

    return  0;
}

Measured memory_bytes: 3152
#include <stdio.h>

int main(void)
{
	int a,b;
	scanf("%d%d",&a,&b);
	if(a == b)
		{printf("Draw");}
	else
		{
		if(a == 1)
			{printf("Alice");}
		else if(b == 1)
			{printf("Bob");}
		else if(a > b && b != 1)
			{printf("Alice");}
		else
			{printf("Bob");}
		}
	return 0;
}
			



Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vp;
typedef pair<int,int> pii;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9+7;
const int MAX = 10000000;
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
//cout << 'H' << endl;
//next_permutation(ALL(p));
//typedef priority_queue<int> pque;//これは大きい順
//typedef priority_queue<int, vector<int>, greater<int>> pque;//これは小さい順


int main(){
	int a,b;
	cin >> a >> b;
	if(a>9 || b>9){
		cout << -1 << endl;
		return 0;
	}
	cout << a*b << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e2 + 3;
#define F first
#define S second
ll n , x , y , X , Y;
pair<ll, ll> A[2*N];
pair<ll, ll> prefix[2*N];

int quad(pair<ll,ll> &a){
	if(a.F >= 0 && a.S >= 0)
		return 1;
	else if(a.F < 0 && a.S >= 0)
		return 2;
	else if(a.F < 0 && a.S < 0)
		return 3;
	else
		return 4;
}
ll cross(pair<ll, ll> &a , pair<ll, ll> &b){
	return (a.F*b.S - a.S*b.F);
}
bool cmp(pair<ll,ll> &a , pair<ll, ll> &b){
	if(quad(a) == quad(b))
		return cross(a , b) > 0;
	else
		return quad(a) < quad(b);
}

long double ans = 0;
long double dis(pair<ll, ll> a , pair<ll, ll> b){
	ll some = (a.F-b.F)*(a.F-b.F) + (a.S-b.S)*(a.S-b.S);

	return sqrt(some);
}
int main(){
	cin >> n;
	for(int i= 1 ;i <=n ; i++){
		cin >> A[i].F >> A[i].S;
	}

	sort(A+1 , A+n+1 , cmp);

	// Iterating on the first one to be taken
	for(int i= 1 ;i <= n ; i++)
		A[i+n] = A[i];

	for(int i = 1 ;i <= 2*n ; i++){
		X += A[i].F;
		Y += A[i].S;
		prefix[i] = make_pair(X , Y);
	}
	
	for(int i =1 ;i <= n ; i++){
		for(int j = i ; j < n+i ; j++){

			ans = max(ans , dis(prefix[j] , prefix[i-1]));
		}
	}

	printf("%0.20lf\n", (double)ans );

}

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

struct DSU {
	vector <int> p, sz;

	DSU(int n) {
		p.assign(n + 1, 0);
		sz.assign(n + 1, 0);

		for(int i = 1; i <= n; i++)
			p[i] = i, sz[i] = 1;
	}

	int findst(int x) { return p[x] = (x == p[x]) ? x : findst(p[x]); } //without path compression

	void joinst(int a, int b) { //representativo de cada set
		if(sz[a] < sz[b])
			swap(a, b);

		sz[a] += sz[b];
		p[b] = a;
	}
};

const int MAX = 2e5 + 5;
int n, m, k;
vector <int> g1[MAX], g2[MAX];

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

	DSU dsu(n);

	for(int i = 1; i <= m; i++) {
		int x, y; scanf("%d%d", &x, &y);
		g1[x].push_back(y);
		g1[y].push_back(x);

		if(dsu.findst(x) != dsu.findst(y))
			dsu.joinst(dsu.findst(x), dsu.findst(y));
	}

	for(int i = 1; i <= k; i++) {
		int x, y; scanf("%d%d", &x, &y);
		g2[x].push_back(y);
		g2[y].push_back(x);
	}

	vector <int> mk(n + 1, 0);

	for(int u = 1; u <= n; u++) {
		int r = dsu.findst(u);
		int ans = dsu.sz[r] - 1;

		for(int v : g1[u]) {
			if(!mk[v] && dsu.findst(v) == r) {
				mk[v] = 1;
				ans--;
			}
		}

		for(int v : g2[u]) {
			if(!mk[v] && dsu.findst(v) == r) {
				mk[v] = 1;
				ans--;
			}
		}

		for(int v : g1[u])
			mk[v] = 0;

		for(int v : g2[u])
			mk[v] = 0;

		printf("%d", ans);
		printf(u == n ? "\n" : " ");
	}

	return 0;
}

Measured memory_bytes: 17656
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
#include <iomanip>

using namespace std;
typedef long long ll;

struct pos {
    ll x, y, r;
};

struct edge {
    int to;
    double cost;
};

struct status {
    double cost;
    int v;

    bool operator<(const status &rhs) const { return cost < rhs.cost; };
    bool operator>(const status &rhs) const { return cost > rhs.cost; };
};

const double INF = 1e20;

vector<double> dijkstra(int s, int n, vector<vector<edge>> &graph) {
    priority_queue<status, vector<status>, greater<>> que;
    vector<double> dis(n, INF);
    dis[s] = 0;
    que.push({0, s});

    while (!que.empty()) {
        status now = que.top();
        que.pop();

        if (dis[now.v] < now.cost)continue;

        for (auto next:graph[now.v]) {
            if (dis[next.to] > dis[now.v] + next.cost) {
                dis[next.to] = dis[now.v] + next.cost;
                que.push({dis[next.to], next.to});
            }
        }
    }

    return dis;
}

int main() {
    pos s{0, 0, 0}, t{0, 0, 0};
    cin >> s.x >> s.y >> t.x >> t.y;
    int n;
    cin >> n;
    vector<pos> v(n + 2);
    v[0] = s, v[n + 1] = t;
    for (int i = 1; i <= n; i++) cin >> v[i].x >> v[i].y >> v[i].r;

    vector<vector<edge>> graph(n + 2);
    for (int i = 0; i < n + 2; i++) {
        for (int j = 0; j < n + 2; j++) {
            ll diffx = v[i].x - v[j].x, diffy = v[i].y - v[j].y;
            graph[i].push_back({j, max(0.0, sqrt(diffx * diffx + diffy * diffy) - v[i].r - v[j].r)});
        }
    }

    cout << fixed << setprecision(15) << dijkstra(0, n + 2, graph)[n + 1] << endl;
    return 0;
}

Measured memory_bytes: 23460
use std::collections::HashMap;

// Template from https://techracho.bpsinc.jp/jhonda/2019_08_05/78537

// input macro for competive-programming from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        input_inner!{$s, $($r)*}
    };
}

#[allow(unused_macros)]
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)*}
    };

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

#[allow(unused_macros)]
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, bytes) => {
        read_value!($iter, String).into_bytes()
    };

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

fn main() {
    use std::io::Read;
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();

    println!("{}", solve(&s));
}

macro_rules! test {
    ($($exp_input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                let start = std::time::Instant::now();
                let input = solve($exp_input);
                let end = start.elapsed();
                assert_eq!(input, $output, "{}.{:03}", end.as_secs(), end.subsec_millis());
                assert!(end.as_secs() <= 2, "expected_sec: {}sec, actual_sec: {}sec", 2, end.as_secs());
                assert!(end.as_secs() <= 1, "expected_sec: {}sec, actual_sec: {}sec", 1, end.as_secs());
                assert!(end.subsec_millis() <= 10, "expected_ms: {}ms, actual_ms: {}ms", 10, end.subsec_millis());
                assert!(end.subsec_millis() <= 2, "expected_ms: {}ms, actual_ms: {}ms", 2, end.subsec_millis());
            )*
        }
    };
}

test! {
r#"2"# => r#"3"#,
r#"4"# => r#"7"#,
r#"1000000000000"# => r#"1099511627775"#,
}

fn f(map: &mut HashMap<usize, usize>, h: usize) -> usize {
    if map.contains_key(&h) == false {
        let h2 = h / 2;
        let h2_value = f(map, h2);
        map.insert(h2, h2_value);
        let a = map[&h2];
        map.insert(h, 1 + a + a);
    }
    map[&h]
}

fn solve(src: &str) -> String {
    let mut src_iter = src.split_whitespace();
    input! {
        source = src_iter,
        h: usize,
    }

    let mut map:HashMap<usize, usize> = HashMap::new();
    map.insert(0, 0);
    map.insert(1, 1);
    f(&mut map, h).to_string()
}

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

int main() {

    //input
    int N; cin >> N;
    vector<int>H(N);
    for (int i = 0; i < N; ++i) {
        cin >> H.at(i);
    }
    int count = 1;
    for (int i = 1; i < N; ++i) {
        bool canView = true;
        for (int j = i - 1; j >= 0 ; --j) {
            if(H.at(i) < H.at(j)){
              canView = false;
            }
        }
        if(canView == true) count++;
    }
    cout << count;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std ;
 
#define lli long long int
#define pb push_back
 
int main ()
{
    int a , b ;
    cin >> a >> b ;

    vector <int> v ;
    v.pb(a);
    v.pb(b);

    sort(v.begin(), v.end());

    if (v[0] == 1 && v[1] == 2) cout << "3\n";
    else if (v[0] == 1 && v[1] == 3) cout << "2\n";
    if (v[0] == 2 && v[1] == 3) cout << "1\n";

    return 0 ;
}

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

static class U
{
    public static int INFTY = (1 << 21);
}

class Edge{   
    public int from, to, cost;
    public Edge(int from, int to, int cost = 0)
    {
        this.from = from;
        this.to = to;
        this.cost = cost;
    }
        
    // TODO operator
};

class Node
{
    public List<Edge> edges;
    public int dist;
    public Node(){
        edges = new List<Edge>();
        dist = U.INFTY;
    }
};

class Graph{
    public List<Node> nodes;
    public Graph(int n) {
        nodes = new List<Node>();
        for (int i = 0; i < n; i++)
        {
            nodes.Add(new Node());   
        }
    }

    public Node this[int i]
    {
        get { return nodes[i]; }
    }
};

class Data
{
    public int dist;
    public Edge edge;
    public Data(int dist, Edge edge) {
        this.dist = dist;
        this.edge = edge;
    }
    // TODO operator
};
    
class Program
{
    public static void Main(string[] args)
    {
        int N = int.Parse(Console.ReadLine());
        Graph G = new Graph(N);
        
        for (int i = 0; i < N; i++)
        {
            string[] str = Console.ReadLine().Split(' ');
            int n = int.Parse(str[0]) - 1;
            int c = int.Parse(str[1]);
            for (int j = 0; j < c; j++)
            {
               G[n].edges.Add(new Edge(n, int.Parse(str[2+j]) - 1));                  
            }
        }

        var q = new Queue<Data>();
        q.Enqueue(new Data(0, new Edge(-1, 0)));
        while (q.Count > 0)
        {
            Data d = q.Dequeue();
            Node nd = G[d.edge.to];
            if(nd.dist != U.INFTY) continue;
            nd.dist = d.dist;
            foreach (var ee in nd.edges)
            {
                q.Enqueue(new Data(nd.dist+1, ee));
            }
        }

        for (int i = 0; i < N; i++)
        {
            if (G[i].dist == U.INFTY) G[i].dist = -1;
            Console.WriteLine("{0} {1}", i+1, G[i].dist);
        }
    }
}

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

int main() {
	int a,b;
	cin >> a >> b;
	int sw = (a + b) / 2;
	int am = (a + b) % 2;
	if(am == 1)
	{
		cout << "IMPOSSIBLE" << endl;
	}
	else
	{
		cout << sw << endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,a,b) for(int i=(a),_end_=(b);i<=_end_;i++)
#define DREP(i,a,b) for(int i=(a),_end_=(b);i>=_end_;i--)
#define EREP(i,a) for(int i=start[(a)];i;i=e[i].next)
template<class T>inline void chkmax(T &a,T b){ if(a<b)a=b;}
template<class T>inline void chkmin(T &a,T b){ if(a>b)a=b;}
#define fi first
#define se second
#define mkr(a,b) make_pair(a,b)
inline int read()
{
	int sum=0,p=1;char ch=getchar();
	while(!(('0'<=ch && ch<='9') || ch=='-'))ch=getchar();
	if(ch=='-')p=-1,ch=getchar();
	while('0'<=ch && ch<='9')sum=sum*10+ch-48,ch=getchar();
	return sum*p;
}

const int maxn=3e3+20;
const int mod=1e9+7;
const int inv2=mod+1>>1;

int n,q,a[maxn],f[maxn][maxn],g[maxn][maxn];

inline void init()
{
	n=read();q=read();
	REP(i,1,n)a[i]=read();
	REP(i,1,n)REP(j,1,n)g[i][j]=f[i][j]=a[i]>a[j];
}

inline void doing()
{
	REP(i,1,q)
	{
		int x=read(),y=read();
		REP(k,1,n)if(k!=y && k!=x)
		{
			//x,k
			g[x][k]=1ll*(f[x][k]+f[y][k])*inv2%mod;
			g[k][x]=1ll*(f[k][x]+f[k][y])*inv2%mod;
//k,y
			g[k][y]=1ll*(f[k][y]+f[k][x])*inv2%mod;
			g[y][k]=1ll*(f[y][k]+f[x][k])*inv2%mod;
			
		}
		g[x][y]=1ll*(f[x][y]+f[y][x])*inv2%mod;
		g[y][x]=1ll*(f[x][y]+f[y][x])*inv2%mod;
		REP(k,1,n)f[x][k]=g[x][k],f[k][y]=g[k][y],f[k][x]=g[k][x],f[y][k]=g[y][k];
	}
	int p2=1; REP(i,1,q)p2=p2*2%mod; 
	int ans=0;
	REP(i,1,n)REP(j,i+1,n)ans=(ans+(ll)p2*f[i][j])%mod;
	printf("%d\n",ans);
}

int main()
{
	init();
	doing();
	return 0;
}



Measured memory_bytes: 71296
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()
ll d1[4] = {1, -1, 0, 0};
ll d2[4] = {0, 0, 1, -1};

int main(){
    ll a, v, b, w, t;
    cin >> a >> v >> b >> w >> t;
    if(a == b){
        cout << "YES" << endl;
    }else if(a > b){
        if(b - w * t < a - v * t) cout << "NO" << endl;
        else cout << "YES" << endl;
    }else{
        if(b + w * t > a + v * t) cout << "NO" << endl;
        else cout << "YES" << endl;
    }
    return 0;
}

Measured memory_bytes: 3592
#include <cstdio>
const int N = 100032;
typedef long long ll;
const ll MOD = 1000000007;

ll inv[N];

int main() {
	int n, a;
	scanf("%d",&n);
	inv[1] = 1;
	for (int i = 2; i <= n; i++)
		inv[i] = -MOD/i * inv[MOD%i] %MOD;
	for (int i = 2; i <= n; i++)
		(inv[i] += inv[i-1]) %= MOD;
	ll ans = 0;
	for (int i = 0; i < n; i++) {
		scanf("%d",&a);
		ans += a * (inv[i+1] + inv[n-i] - 1) %MOD;
	}
	for (int i = 2; i <= n; i++)
		ans = ans * i %MOD;
	if (ans < 0) ans += MOD;
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 896
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <map>
#include <unordered_map>
#include <chrono>
#include <numeric>
using namespace std;
using ll = long long;
const ll INF = (ll)1e18+1;
const ll DIV = 1000000007;
//#define TEST
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
#ifdef TEST
    chrono::system_clock::time_point start, end;
    start = chrono::system_clock::now();
#endif
    int A,B,C;
    cin >> A >> B >> C;
    if(B >= A*C) cout << C << endl;
    else cout << B/A << endl;
#ifdef TEST
    end = chrono::system_clock::now();
    cerr << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000.0) << "[ms]" << endl;
#endif
    return 0;
}

Measured memory_bytes: 3532
/*
Author : N_o_o_B
Created : April 22 2020 21:42:39 
*/
#include <bits/stdc++.h>
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
*/
#define TRACE
#ifdef TRACE
#define trace(...) { cerr<<"[ "; __trace__(#__VA_ARGS__, __VA_ARGS__);}
#undef endl
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const pair<Arg1,Arg2> &x) {
    return out<<"("<<x.first<<","<<x.second<<")";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const vector<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const set<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const map<Arg1,Arg2> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
void __trace__(const string name, Arg1&& arg1){
    cerr << name << " : " << arg1 << " ] " << endl;
}
 
template <typename Arg1, typename... Args>
void __trace__(const string names, Arg1&& arg1, Args&&... args){
    const string name = names.substr(0,names.find(','));
    cerr<<name<<" : "<<arg1<<" | ";
    __trace__(names.substr(1+(int)name.size()), args...);
}
#else
    #define trace(args...)
#endif
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vll;
typedef vector<vl> vvl;
//typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> oset;
#define fori(i,n) for(int i=0;i<n;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repd(i,a,b) for(int i=a;i>=b;i--)
#define ford(i,n)  for(int i=n-1;i>=0;i--)
#define trav(x,a) for(auto& x:a)
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define sz(a) (int)a.size()
#define fi first
#define se second
clock_t time_p=clock();
void time_taken()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
//const ll mod=998244353;
const ll mod=1e9+7;
const ll INF=1e18;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    cout.precision(12);cout << fixed;

    string s;
    cin >> s;
    vector<bool> seen(26);
    for(char c:s){
        seen[c-'a']=1;
    }
    fori(i,26){
        if(!seen[i]){
            cout << char('a'+i) << endl;
            return 0;
        }
    }
    cout << "None" << endl;

    time_taken();
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;

int h, w;
vector<string> s;
vector<int> dx = {1, -1, 0, 0}, dy = {0, 0, 1, -1};

bool func(int i, int j) {
  if (s[i][j] == '.') return true;
  for (int t = 0; t < 4; t++) {
    int x = j + dx[t];
    int y = i + dy[t];
    if (x < 0 || w - 1 < x || y < 0 || h - 1 < y) continue;
    if (s[y][x] == '#') return true;
  }
  return false;
}

int main() {
  cin >> h >> w;
  s.resize(h);
  for (int i = 0; i < h; i++) {
    cin >> s[i];
  }
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (func(i, j) == false) {
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 3604
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#pragma warning(disable : 4996) //_CRT_SECURE_NO_WARNINGS
int compare(const void* a, const void* b) {
	return strcmp(*((char**)a), *((char**)b));
}
int main() {
	long N;
	scanf("%ld", &N);
	char** list;
	int head, tail,res;
	list = (char*)malloc(sizeof(char*) * N);
	for (long i = 0;i < N;i++) {
		list[i] = malloc(sizeof(char) * 11);
		scanf("%s", list[i]);
	}
	/*辞書順にソート*/
	qsort(list, N, sizeof(list[0]), compare);
	for (res=1,head = 0, tail = 1;tail < N;) {
		if (strcmp(list[head], list[tail]) == 0) {
			tail++;
		}
		else {
			res += 1;
			head = tail;
			tail += 1;
		}
	}
	printf("%d", res);
	for (long i = 0;i < N;i++) {
		free(list[i]);
		list[i] = NULL;
	}
	free(list);
	list = NULL;
	return 0;
}

Measured memory_bytes: 11112
#include <bits/stdc++.h>
using namespace std;
int main(){
    int W,H,x,y,r;
    cin >> W >> H >> x >> y >> r;
    
    if((r <= x)&&(x <= W - r)&&(r <= y)&&(y <= H - r)){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3096
while input = gets
  hand = input.split(',').map(&:to_i).group_by { |num| num }.to_h

  if hand.keys.length == 2
    if hand.values.map(&:length).include?(4)
      puts 'four card'
    else
      puts 'full house'
    end
  elsif hand.keys.length == 5
    sorted_nums = hand.keys.sort
    if sorted_nums.include?(1)
      start_num = 1
    else
      start_num = sorted_nums[0]
    end
    straight_hand = [start_num, *sorted_nums[1]..(sorted_nums[1] + 3)]

    if sorted_nums == straight_hand
      puts 'straight'
    else
      puts 'null'
    end
  elsif hand.keys.length == 3
    if hand.values.map(&:length).include?(3)
      puts 'three card'
    else
      puts 'two pair'
    end
  elsif hand.keys.length == 4
    puts 'one pair'
  else
    puts 'null'
  end
end

Measured memory_bytes: 8584
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n, x, cnt = 0;
  cin>>n;
  //vector<int> vc(n+1);
  for(int i=1; i<=n; i++)
  {
    cin>>x;
    if(i % 2 == 1 && x % 2 == 1) cnt++; 
  }
  cout<<cnt;
  return 0;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
#define int long long int
using namespace std;
int32_t main()
{
	int a, b, c; cin >> a >> b >> c;
	int x[c + 50], y[c + 50], mx = 0, my = 0, cntx[a + 50] = {0}, cnty[b + 50] = {0};
	for(int i=0; i<c; i++)
	{
		cin >> x[i] >> y[i];
		cntx[x[i]] ++; mx = max(mx, cntx[x[i]]);
		cnty[y[i]] ++; my = max(my, cnty[y[i]]);
	}
	int t1 = 0, t2 = 0;
	for(int i=1; i<=a; i++) if(cntx[i] == mx) t1 ++;
	for(int i=1; i<=b; i++) if(cnty[i] == my) t2 ++;
	int t = t1 * t2;
	for(int i=0; i<c; i++)
	{
		if(cntx[x[i]] == mx && cnty[y[i]] == my) t --;
	}
	if(t) cout << mx + my;
	else  cout << mx + my - 1;
	cout << '\n';
	return 0;
}

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

using namespace std;

class Dice {
    public:
        int value[6];
        Dice(){};
        Dice(int* num) {
            for (int i = 0; i < 6; i++) {
                Dice::value[i] = num[i];
            }
        }
        void rotate(char direction) {
            int tmp;
            switch(direction) {
                case 'N':
                    tmp = Dice::value[0];
                    Dice::value[0] = Dice::value[1];
                    Dice::value[1] = Dice::value[5];
                    Dice::value[5] = Dice::value[4];
                    Dice::value[4] = tmp;
                    break;

                case 'S':
                    for(int i = 0; i < 3; i++) Dice::rotate('N');
                    break;

                case 'W':
                    tmp = Dice::value[0];
                    Dice::value[0] = Dice::value[2];
                    Dice::value[2] = Dice::value[5];
                    Dice::value[5] = Dice::value[3];
                    Dice::value[3] = tmp;
                    break;

                case 'E':
                    for(int i = 0; i < 3; i++) Dice::rotate('W');
                    break;

                case 'R':
                    tmp = Dice::value[1];
                    Dice::value[1] = Dice::value[3];
                    Dice::value[3] = Dice::value[4];
                    Dice::value[4] = Dice::value[2];
                    Dice::value[2] = tmp;
                    break;

                default:
                ;
            }
        }
};

string checkValue(Dice dice1, Dice dice2) {
    if(dice2.value[3] == dice1.value[0]) dice2.rotate('E');
    if(dice2.value[2] == dice1.value[0]) dice2.rotate('W');
    while(dice2.value[0] != dice1.value[0]) dice2.rotate('N');
    while(dice2.value[1] != dice1.value[1]) dice2.rotate('R');
    for(int i = 0; i< 6; i++) {
        if(dice2.value[i] != dice1.value[i]) {
            return "No";
        }
    }
    return "Yes";
}

int main() {
    int num[6];
    string result = "No";
    for(int i = 0; i < 6; i++) cin >> num[i];
    Dice dice1 = Dice(num);
    Dice dice2;
    for(int i = 0; i < 6; i++) cin >> num[i];
    char direction[4] = {'N', 'S', 'W', 'E'};
    for(int i=0;i<4;i++) {
        dice2 = Dice(num);
        dice2.rotate(direction[i]);
        if(checkValue(dice1, dice2) == "Yes") result = "Yes";
    }
    dice2 = Dice(num);
    dice2.rotate('N');
    dice2.rotate('N');
    if(checkValue(dice1, dice2) == "Yes") result = "Yes";

    cout << result << endl;
    return 0;
}


Measured memory_bytes: 3220
L = input()

length = len(L)
cnt = 1
mod = 10**9+7
scale = 1

for l in reversed(L):
    if l == "0":
        pass
    else:
        cnt = divmod(cnt * 2 + scale, mod)[1]
    scale = divmod(scale*3, mod)[1]

print(cnt)


Measured memory_bytes: 3316
fun main(args: Array<String>) {
    val (n, totalW) = readLine()!!.split(' ').map(String::toLong)
    val things = Array(4) { mutableListOf<Long>() }
    var w1 = -1L
    (1..n).forEach {
        val (w, v) = readLine()!!.split(' ').map(String::toLong)
        if (w1 == -1L) w1 = w
        things[(w - w1).toInt() % 4].add(v)
    }
    (0..3).forEach { things[it].sortDescending() }

    var ans = 0L
    for (i0 in 0..things[0].size) {
        for (i1 in 0..things[1].size) {
            for (i2 in 0..things[2].size) {
                for (i3 in 0..things[3].size) {
                    val curW = i0 * w1 + i1 * (w1 + 1) + i2 * (w1 + 2) + i3 * (w1 + 3)
                    if (curW > totalW) break
                    else ans = Math.max(ans,
                            things[0].take(i0).sum()
                                    + things[1].take(i1).sum()
                                    + things[2].take(i2).sum()
                                    + things[3].take(i3).sum()
                    )
                }
            }
        }
    }
    println(ans)
}


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

int main () {
  int N;
  cin >> N;
  for(int i=0;i<14;i++){
    for(int j=0;j<25;j++){
     if(N==i*7+j*4){
       cout << "Yes" << endl;
       return 0;
     }
    }
  }
   cout << "No" << endl;
}


Measured memory_bytes: 256
S = input()

ans = True

tmp_S1 = ""
tmp_S2 = ""
for i in range(len(S)):
    if S[i] == "A" or S[i] == "C":
        continue
    tmp_S1 += S[i]
    tmp_S2 += S[i]

if tmp_S1.lower() != tmp_S2:
    ans = False

if S[0] != "A":
    ans = False

cnt = 0
for i in range(2, len(S)-1):
    if S[i] == "C":
        cnt += 1
if cnt != 1:
    ans = False

if ans is True:
    print("AC")
else:
    print("WA")


    


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(void){
  int n,i,a,k,ans=0;
  cin >> n;
  for (i=0;i<n;i++){
    cin >> a;
    k=0;
    while (a%2==0){
      a/=2;
      k++;
    }
    ans+=k;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
<?php
fscanf(STDIN, "%d%d", $H, $W);
for($y = 0; $y < $H; $y++){
    fscanf(STDIN, "%s", $str);
    for($x = 0; $x < $W; $x++){
        $map[$y][$x] = $str[$x];
        if($map[$y][$x] == "#"){
            $list[] = [$y,$x];
        }
    }
}
$count = 0;
while($list){
    $nextList = [];
    foreach($list as list($y, $x)){
        if($x){
            if($map[$y][$x-1] == "."){
                $map[$y][$x-1] = "#";
                $nextList[] = [$y, $x-1];
            }
        }
        if($y){
            if($map[$y-1][$x] == "."){
                $map[$y-1][$x] = "#";
                $nextList[] = [$y-1, $x];
            }
        }
        if($x < $W-1){
            if($map[$y][$x+1] == "."){
                $map[$y][$x+1] = "#";
                $nextList[] = [$y, $x+1];
            }
        }
        if($y < $H-1){
            if($map[$y+1][$x] == "."){
                $map[$y+1][$x] = "#";
                $nextList[] = [$y+1, $x];
            }
        }
    }
    $list = $nextList;
    if($list)$count++;
}
echo $count;


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

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int a, b, c;
  cin >> a >> b >> c;
  cout << (c >= a && c <= b ? "Yes" : "No") << '\n';
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N,M;
    int p[100001],y[100001];
    vector<int> vec[100001];
    
    cin>>N>>M;
    for(int i=0;i<M;i++){
        cin>>p[i]>>y[i];
        vec[p[i]].push_back(y[i]);
    }
    for(int i=0;i<N;i++){
        sort(vec[i+1].begin(),vec[i+1].end());
    }
    
    for(int i=0;i<M;i++){
        printf("%06d",p[i]);
        int j=lower_bound(vec[p[i]].begin(),vec[p[i]].end(),y[i])-vec[p[i]].begin()+1;
        printf("%06d",j);
        cout<<endl;
    }
    return 0;
}




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

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

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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define rrep(i,n) RFOR(i,n,0)
#define fi first
#define se second

using namespace std;

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


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

	ll N, K;
	cin >> N >> K;

	ll t[N], d[N];
	map<ll, ll> mp1;
	rep(i, N) {
		cin >> t[i] >> d[i];
	}

	vector<pll> v;

	rep(i, N) {
		v.push_back((pll){d[i], t[i]});
	};

	sort(v.begin(), v.end());
	reverse(v.begin(), v.end());

	map<ll, ll> mp;
	ll ans = 0;
	ll typ = 0;
	vector<ll> w;
	for(ll i = 0; i < K; i++){
		pll p = v[i];
		auto it = mp.find(p.se);
		if(it == mp.end()){
			mp[p.se] = 0;
			typ++;
		}

		mp[p.se]++;
		if(mp[p.se] >= 2) w.push_back(p.fi);

		ans += p.fi;
	}

	ans += typ * typ;
	// cout << "first:" << ans << endl;
	ll ans2 = ans;
	ll anst = ans;

	for(int i = K; i < N; i++){
		pll p = v[i];
		// cout << i << " " << p.se << endl;
		auto it = mp.find(p.se);
		if(it != mp.end()) continue;

		mp[p.se] = 1;

		if(w.size() == 0) continue;
		ans2 -= w[w.size()-1];
		ans2 += p.fi;
		ans2 -= typ * typ;
		ans2 += (typ+1) * (typ+1);

		w.pop_back();
		typ++;

		anst = max(anst, ans2);
		// cout << i << ":" << ans << " " << typ << endl;
	}

	cout << max(ans, anst) << endl;
}


Measured memory_bytes: 9584
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n, a, b = 0;
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a, b += a - 1;
    cout << b;
}


Measured memory_bytes: 256
n = int(input())
flag = True
a = [[0] * 2 for i in range(n)]
for i in range(n):
    c, b = map(int, input().split())
    a[i][0], a[i][1] = c, b

a = sorted(a, key=lambda x:x[1])
time = 0
for w, lim in a:
    time += w
    if(time > lim):
        flag = False
        break

if(flag):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 39704
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <climits> // FOO_MAX, FOO_MIN
#include <cmath> 
#include <cstdlib> // abs(int)
#include <numeric>
#include <iomanip>
#include <map>

using namespace std;

#define roundup(n,d) ( ((n) + ((d)-1)) / (d) )
#define assign_max(into, compared) (into = max((into), (compared)))
#define assign_min(into, compared) (into = min((into), (compared)))
#define rep(i,n) for(long long i = 0;i < n;++i)
#define FAST_IO ios::sync_with_stdio(false); cin.tie(nullptr);
#define fix(n) fixed << setprecision(n)
#define ALL(v) v.begin(),v.end()

#define PI 3.14159265358979323846;

using ll = long long;
using ull = unsigned long long;
using vll = vector<long long>;

int main(void){
    FAST_IO

    ll n,m,x;
    cin >> n >> m >> x;
    vector<vll> v(n,vll(m+1));

    rep(i,n){
        rep(j,m+1){
            cin >> v[i][j];
        }
    }
    
    ll endmask = 1 << n;
    ll cost = LLONG_MAX;
    rep(mask,endmask){
        vll temp(m+1);

        for(ll co_m = mask,i = 0; co_m > 0;co_m >>= 1,++i){
            if(co_m & 1LL){
                rep(j,m+1){
                    temp[j] += v[i][j];
                }
            }
        }

        bool cant = false;
        for(ll i = 1;i < m+1;i++){
            if(temp[i] < x){
                cant = true;
                break;
            }
        }
        if(cant)continue;

        assign_min(cost,temp[0]);
    }

    if(cost == LLONG_MAX){
        cout << -1 << endl;
    } else {
        cout << cost << endl;
    }
    
    return 0;
}

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

template<typename T>
T get_value(std::istream& is);

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

  vector<int> needs(get_value<size_t>(cin));
  const auto source {get_value<int>(cin)};
  for (auto&e : needs)
    cin >> e;

  const auto left {source - accumulate(needs.begin(), needs.end(), 0)};
  cout << needs.size() + (left / *min_element(needs.begin(), needs.end())) << '\n';

  return 0;
}

template<typename T>
inline T get_value(std::istream& is)
{
  T v;
  is >> v;
  return v;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define UNIQUE(v) v.erase(unique(all(v)),v.end());
#define fill(a,x) memset(a,x,sizeof(a))
#define zero(a) fill(a,0)
#define minus(a) fill(a,-1)
#define dbg(x) cout << #x"=" << x << endl

int main() {
  int n;
  cin >> n;
  int count = 0;
  int num;
  int res=0;
  int minIndex=0;
  vi array;
  while(count!=n){
    cin >> num;
    array.pb(num);
    count++;
  }

  rep(i,n) {
    if(i==0) {
      res += 1;
      continue;
    }
    if(array[i] > array[minIndex]) continue;
    minIndex = i;
    res+=1;
    continue;
  }

  cout << res << endl;

  return 0;
}


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

int main() {
	double A, B;
	cin >> A >> B;
	int ans = -1;

	for (int i = 0; i < 20000; i++) {
		if (floor(i * 0.08) == A && floor(i * 0.1) == B) {
			ans = i;
			break;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
a, b = map(int, input().split())
s = input()
flag = True

for i in range(a):
  if s[i] == '-':
    flag = False
    break

if s[a] != '-':
  flag = False

for i in range(a + 1, a + b + 1):
  if s[i] == '-':
    flag = False
    break

if flag:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3064
<?php
fscanf(STDIN,"%d %d",$A,$V);
fscanf(STDIN,"%d %d",$B,$W);
fscanf(STDIN,"%d",$T);

$D = abs($A - $B);

$S = $V - $W;

if ($D <= $S*$T) {
 echo 'YES';
}else{
 echo 'NO';
}


Measured memory_bytes: 16108
#include <stdio.h>

int main(){
    int a,b,val1,val2,val3;
    
    scanf("%d %d",&a,&b);
    
    val1=a+b;
    val2=a+(a-1);
    val3=b+(b-1);
    
    if(val1>=val2 && val1>=val3){
        printf("%d\n",val1);
    }
    
    else if(val2>=val1 && val2>=val3){
        printf("%d\n",val2);
    }
    
    else if(val3>=val1 && val3>=val2){
        printf("%d\n",val3);
    }
    
    
    return 0;
}

Measured memory_bytes: 128
var obj = init();
Main();
function nextInt(){return myconv(next(),1);}
function nextStrArray(){return myconv(next(),2);}//半角スペース分割
function nextIntArray(){return myconv(next(),4);}//半角スペース + 数値化
function nextCharArray(){return myconv(next(),6);}//1文字分割
function next(){return obj.next();}
function hasNext(){return obj.hasNext();}
function myin(){return require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");}
function init(){
  var inputFile = myin();
  var returnObj = {
    "list" : inputFile, "index" : 0, "max" : inputFile.length,
    "hasNext" : function(){return (this.index < this.max);},
    "next" : function(){if(!this.hasNext()){return "";}else{var returnInput = this.list[this.index];this.index++;return returnInput;}}
  };
  return returnObj;
}
function myout(t){console.log(t);}//標準出力
function myerr(t){console.error(t);}//標準エラー出力
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す　1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
  var L = next();
  myout(Math.pow(L / 3,3));
}

Measured memory_bytes: 7372
// Problem Code: abc161_c

#include <bits/stdc++.h>

using namespace std;

long long C(long long N, long long K) {
	long long mod = N % K;
	return min(mod, abs(mod - K) % K);
}

int main() {
	long long N, K;
	cin >> N >> K;
	cout << C(N, K);
	return 0;
}

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

int main()
{
char a='!';
while(a!='?'){
	int b=0,c=0;
	scanf("%d %c %d",&b,&a,&c);
	switch(a){
		case'+':
			printf("%d\n",b+c);
			break;
		case'-':
			printf("%d\n",b-c);
			break;
		case'*':
			printf("%d\n",b*c);
			break;
		case'/':
			printf("%d\n",b/c);
			break;
	}
}
return 0;
}


Measured memory_bytes: 3176
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
#define ll long long
#define pb push_back
#define fr first
#define sc second
#define MAX ((ll)(2e17+100))
#define MX ((ll)(1e5+100))
#define ARRS ((ll)(2e6+100))
#define HS ((ll)(233))
#define MOD ((ll)(1e9+7))
#define EP ((double)(1e-9))
#define LG 21
#define mul(a,b) a=((a)*(b))%MOD
using namespace std;


ll n,m,x,k,p;
ll a[ARRS];
ll f[2][ARRS];
vector<pair<ll,ll> > v[ARRS];

int main(){
	cin>>n;
	for(int i=0; i<n; i++){
		cin>>k;
		f[i&1][k]++;
	}
	for(int i=0; i<MX; i++){
		v[0].pb({f[0][i],i});
		v[1].pb({f[1][i],i});
	}
	ll pas=0;
	sort(v[0].begin(),v[0].end());
	sort(v[1].begin(),v[1].end());
	reverse(v[0].begin(),v[0].end());
	reverse(v[1].begin(),v[1].end());
	if(v[0][0].sc==v[1][0].sc)pas=max(v[0][1].fr+v[1][0].fr,
			v[0][0].fr+v[1][1].fr);
	else pas=v[0][0].fr+v[1][0].fr;
	cout<<n-pas;

}


Measured memory_bytes: 54764
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;


template<class T,class U>
void chmax(T& a,U b){
	if(a<b)
		a=b;
}
 
template<class T,class U>
void chmin(T& a,U b){
	if(b<a)
		a=b;
}


//vector<pair<int,int>> pairs;  pairs[i] = make_pair(value, value);
//sort(a.begin(),a+index_number);



/*
vector<int> vec(100,-1);全ての値に-1をセット
vector<std::vector<int>> vec{{ 1, 2, 3 },{ 4, 5, 6 }};
vec.size() vec[i].size()
vec.emplace_back(20);追加
*/


//cin>>  cout<<'\n'
signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int n;
    int ans = 0;

    cin >> n ;

    ans = (n-2)*180;


    cout << ans <<'\n';


    return 0;
}

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 mut 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")
    };
}

fn main() {
    input! {
        n: usize,
        m: i32,
        q: usize,
        abcd: [(usize,usize,i32,i32);q],
    }
    let mut val = vec![1i32; n + 1];

    println!("{:?}", dfs(&mut val, 1, m, &abcd));
}

fn dfs(buf: &mut Vec<i32>, d: usize, ub: i32, abcd: &Vec<(usize, usize, i32, i32)>) -> i32 {
    let mut sum = 0;
    if d == buf.len() {
        for &(a, b, c, d) in abcd {
            if buf[b] - buf[a] == c {
                sum += d;
            }
        }
    } else {
        for i in buf[d - 1]..ub + 1 {
            buf[d] = i as i32;
            sum = std::cmp::max(sum, dfs(buf, d + 1, ub, abcd));
        }
    }
    sum
}


Measured memory_bytes: 2136
#include<bits/stdc++.h>
const int N=2e5+9;
using namespace std;
map<int,int>tab;
vector<int>belong[N];
vector<int>g[N];
int num[N],w[N],tot,f[N];
char s[N];
int main()
{
	scanf("%s",s);
	int len=strlen(s);
    for(int i=len;i>=1;--i) s[i]=s[i-1];
//cout<<len<<"------"<<endl;
	for(int i=1;i<=len;++i)
	{
		num[s[i]-'a']++;
		for(int j=0;j<26;++j) if(num[j]%2) w[i]+=(1<<j);
	}
	w[0]=0;
	for(int i=len;i>=0;--i)
	{
	   if(tab.find(w[i])==tab.end())
	   {
	   	  tab[w[i]]=++tot;
	   	  belong[tot].push_back(i);
	   }
	   else belong[tab[w[i]]].push_back(i);
	   
	   int all=belong[tab[w[i]]].size();
	   int pos=tab[w[i]];
	   if(all>1) g[belong[pos][all-2]].push_back(i);
	   
	   int now=0;
	   for(int j=0;j<26;++j) 
	   {
		 if((1<<j)&w[i]) 
          {
          	int p;
          	if(tab.find(w[i]-(1<<j))==tab.end()) continue;
          	else p=tab[w[i]-(1<<j)];
		    int sz=belong[p].size();
		    if(sz) g[belong[p][sz-1]].push_back(i);
		  }
		 else 
		 {
		 	int p;
          	if(tab.find(w[i]+(1<<j))==tab.end()) continue;
          	else p=tab[w[i]+(1<<j)];
          	int sz=belong[p].size();
		    if(sz) g[belong[p][sz-1]].push_back(i);
		 }
	   }
	}
	for(int i=0;i<=len;++i) f[i]=len;
    f[0]=0;
	for(int i=1;i<=len;++i)
	{
		int sz=g[i].size();
		for(int j=0;j<sz;++j)
		 {
		  if(w[g[i][j]]!=w[i]) f[i]=min(f[i],f[g[i][j]]+1);
	      else
		   {
			 if(g[i][j]) f[i]=min(f[i],f[g[i][j]]);
	         else f[i]=min(f[i],1);
		   }
		 }
	}
	cout<<f[len]<<endl;
	return 0;
}
/*
abcabcxabcx
abaccbccaad
*/

Measured memory_bytes: 44024
#include <iostream>
#include <fstream>
#include <cstring>
#include <climits>
#include <algorithm>
#include <math.h>
#include <vector>
using namespace std;

#define ll long long

ll dp[101][100000];

// ll solve(int i, int W, ll int* w, ll int* v, int n) {

// 	if (W < 0)
// 		return INT_MIN;
// 	if (i == n)
// 		return 0;

// 	if (dp[i][W] == -1)
// 		dp[i][W] = max(solve(i+1, W, w, v, n), solve(i+1, W-w[i], w, v, n) + v[i]);
// 	return dp[i][W];
// }

ll solve_ite(int W, ll int* w, ll int* v, int n) {

	for (int i = 1; i <= n; ++i) {
		for (int j = 0; j <= W; ++j) {
			if (w[i-1] > j)
				dp[i][j] = dp[i-1][j];
			else
				dp[i][j] = max(dp[i-1][j], dp[i-1][j-w[i-1]] + v[i-1]);
		}
	}
	return dp[n][W];
}

int main() {

	int n, W;
	cin >> n >> W;
	ll v[n], w[n];
	for (int i = 0; i < n; ++i)
		cin >> w[i] >> v[i];
	memset(dp, 0, sizeof(dp));
	// cout << solve(0, W, w, v, n);
	cout << solve_ite(W, w, v, n);

	return 0;
}

Measured memory_bytes: 79104