akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, z, n) for(int i = z; i < n; i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
#define PI 3.14159265358979
//const int64_t INF = 1LL << 60;
const int INF = 1 << 29;
//const int64_t MOD = 1000000007;
//const int64_t INF = 998244353;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;
typedef pair<int64_t, int64_t> P;

int main(){
    int N;
    cin >> N;
    vector<int> P(N);
    int com = INF, count = 0;
    rep(i, 0, N){
        int pre;
        cin >> pre;
        if (pre <= com){
            count++;
            com = pre;
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 1152
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<bitset>
#include<set>
#define N (100010)
#define P ()
#define M ()
#define inf (0x7f7f7f7f)
#define rg register int
#define Label puts("NAIVE")
#define spa print(' ')
#define ent print('\n')
#define rand() (((rand())<<(15))^(rand()))
#define file(s) freopen(s".in","r",stdin),freopen(s".out","w",stdout)
#define mkp make_pair
typedef long double ld;
typedef long long LL;
typedef unsigned long long ull;
using namespace std;
namespace fastIO1{
	inline char read(){
		static const int IN_LEN=1000000;
		static char buf[IN_LEN],*s,*t;
		return (s==t?t=(s=buf)+fread(buf,1,IN_LEN,stdin),(s==t?-1:*s++):*s++);
	}
	template<class T>
	inline void read(T &x){
		static bool iosig;
		static char c;
		for(iosig=false,c=read();!isdigit(c);c=read()){
			if(c=='-')iosig=true;
			if(c==-1)return;
		}
		for(x=0;isdigit(c);c=read())x=((x+(x<<2))<<1)+(c^'0');
		if(iosig)x=-x;
	}
	inline char readc(char &c){
		for(c=read();!isalpha(c)&&!isdigit(c);c=read())
		if(c==-1)return 0;
	}
	const int OUT_LEN = 10000000;
	char obuf[OUT_LEN],*ooh=obuf;
	inline void print(char c) {
		if(ooh==obuf+OUT_LEN)fwrite(obuf,1,OUT_LEN,stdout),ooh=obuf;
		*ooh++=c;
	}
	template<class T>
	inline void print(T x){
		static int buf[30],cnt;
		if(x==0)print('0');
		else{
			if(x<0)print('-'),x=-x;
			for(cnt=0;x;x/=10)buf[++cnt]=x%10+48;
			while(cnt)print((char)buf[cnt--]);
		}
	}
	inline void flush(){fwrite(obuf,1,ooh-obuf,stdout);}
}
namespace fastIO2{
	template<class T>
	inline void read(T &x){
		static bool iosig;
		static char c;
		for(iosig=false,c=getchar();!isdigit(c);c=getchar()){
			if(c=='-')iosig=true;
			if(c==-1)return;
		}
		for(x=0;isdigit(c);c=getchar())x=((x+(x<<2))<<1)+(c^'0');
		if(iosig)x=-x;
	}
}
using namespace fastIO1;
int n,m,yes,fa[N];
map<int,int>a[N];
multiset<int> G[N]; 
typedef multiset<int>::iterator iter;
queue<pair<int,int> >Q;
void add(int x,int y){G[x].insert(y),a[x][y]++;}
int ask(int x){return fa[x]==x?x:fa[x]=ask(fa[x]);}
void unite(int u,int v){
//	cout<<u<<" "<<v<<endl;
	int p=ask(u),q=ask(v);
	if(G[p].size()>G[q].size())swap(p,q),swap(u,v);
	if(p==q)return;
	fa[p]=q,yes++;
//	G[q].erase(p);
	for(iter i=G[p].begin();i!=G[p].end();i++){
		int t=*i;
		if(t==q)continue;
//		if(yes%1000==0)cout<<t<<" "<<q<<" "<<p<<endl;
		a[p][t]--,a[t][p]--;
		a[q][t]++,a[t][q]++;
		
		if(G[t].find(p)!=G[t].end())G[t].erase(G[t].find(p));
		
		G[t].insert(q),G[q].insert(t);
//		puts("faq");
		if(a[q][t]>=2)Q.push(mkp(q,t));
	}
	G[p].clear();
}
int main(){
//	freopen("in11.txt","r",stdin);
	read(n);
	for(int i=1;i<=(n-1)*2;i++){
		int x,y;
		read(x),read(y);
		add(x,y),add(y,x);
		if(a[x][y]==2)Q.push(mkp(x,y));
	}
	for(int i=1;i<=n;i++)fa[i]=i;
	while(!Q.empty()){
		int u=Q.front().first,v=Q.front().second; Q.pop();
		unite(u,v);
	}
	if(yes==n-1)puts("YES");else puts("NO");
}

Measured memory_bytes: 76928
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

using R = double;
constexpr R pi = acos((R)-1), eps = 1e-10;

int sgn(R a) { return (a > eps) - (a < -eps); }
int sgn(R a, R b) { return sgn(a - b); }
using P = complex<R>;
istream& operator>>(istream& i, P& p) { R x, y; i >> x >> y; p = P(x, y); return i; }
ostream& operator<<(ostream& o, P p) { return o << fixed << setprecision(15) << real(p) << ' ' << imag(p); }
bool cmp(P p, P q) { return 2 * sgn(real(p), real(q)) + sgn(imag(p), imag(q)) < 0; }
bool eql(P p, P q) { return !cmp(p, q) and !cmp(q, p); }
R dot(P p, P q) { return real(conj(p) * q); }
R crs(P p, P q) { return imag(conj(p) * q); }
// -2: back, -1: cw, 0: on, 1: ccw, 2: front
int ccw(P p, P q) {
  int s = sgn(crs(p, q));
  if (s) return s;
  if (dot(p, q) < 0) return -2;
  if (dot(p, q - p) > 0) return 2;
  return 0;
}
int ccw(P o, P p, P q) { return ccw(p - o, q - o); }
struct L {
  P s, t;
  P vec() const { return t - s; }
  R abs() const { return std::abs(vec()); }
  R arg() const { return std::arg(vec()); }
};
int ccw(L s, P p) { return ccw(s.s, s.t, p); }

P proj(P p, L l) {
  P e = l.vec() / l.abs();
  return l.s + dot(p - l.s, e) * e;
}
P refl(P p, L l) { return (R)2 * proj(p, l) - p; }
R distPP(P p, P q) { return abs(q - p); }
R distPL(P p, L l) { return distPP(p, proj(p, l)); }
R distPS(P p, L s) {
  P q = proj(p, s);
  if (!ccw(s, q)) return distPP(p, q);
  return min(distPP(p, s.s), distPP(p, s.t));
}
R distLL(L l, L m) {
  if (sgn(crs(l.vec(), m.vec()))) return 0;
  return distPL(l.s, m);
}
R distLS(L l, L s) {
  if (ccw(l, s.s) * ccw(l, s.t) != 1) return 0;
  return min(distPL(s.s, l), distPL(s.t, l));
}
R distSS(L s, L t) {
  if (ccw(s, t.s) * ccw(s, t.t) <= 0 and ccw(t, s.s) * ccw(t, s.t) <= 0) return 0;
  return min({distPS(s.s, t), distPS(s.t, t), distPS(t.s, s), distPS(t.t, s)});
}
P intxn(L l, L m) {
  assert(sgn(crs(l.vec(), m.vec())));
  return l.s + crs(m.s - l.s, m.vec()) / crs(l.vec(), m.vec()) * l.vec();
}

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int n; cin >> n;
  R r, th; cin >> r >> th, th *= pi / 180;
  V<P> p(n); for (auto&& e : p) cin >> e;
  VV< V<> > ks(20, VV<>(20));
  VV<R> d(20, V<R>(20));
  for (int i = 0; i < n; ++i) for (int j = 0; j < n; ++j) if (j != i) {
    for (int k = 0; k < n; ++k) if (k != j) {
      L s{p[i], p[j]}, t{p[j], p[k]};
      R ph = fmod(3 * pi + t.arg() - s.arg(), 2 * pi) - pi;
      if (sgn(abs(ph), th) <= 0) ks[i][j].push_back(k);
    }
    d[i][j] = distPP(p[i], p[j]);
  }
  VV<R> dp(20, V<R>(20, 1e10));
  for (int i = 0; i < n; ++i) for (int j = 0; j < n; ++j) if (j != i) {
    dp[i][j] = d[i][j];
  }
  int res = 0;
  for (int s = 0; s <= 1e4; ++s) {
    VV<R> ndp(20, V<R>(20, 1e10));
    for (int i = 0; i < n; ++i) for (int j = 0; j < n; ++j) if (j != i) {
      if (!i and sgn(dp[i][j], r) <= 0) res = s + 1;
      for (int k : ks[i][j]) {
        ndp[i][j] = min(ndp[i][j], d[i][j] + dp[j][k]);
      }
    }
    swap(dp, ndp);
  }
  cout << res << '\n';
}


Measured memory_bytes: 3588
#include <stdio.h>
#include <string.h>
int main(void) {
    char s[21];
    scanf("%s", s);
    int n = (int)strlen(s);
    for(int i = 0; i < n; i++) {
        if(s[i] == ',') s[i] = ' ';
    }
    printf("%s\n", s);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
template<typename T>
void chmax(T &a,T b){
  if(a<b)a=b;
}
struct tree{
  vector<vector<int>> G,son,ancestor;
  vector<int> depth,parent;
  queue<int> que;
  int root=-1;
  bool made_lca=false;

  tree(int n):G(n),son(n),parent(n,-1),depth(n,0),ancestor(n){
    for(int i=0;i<n;i++)ancestor[i].resize(30);
  }

  void add_edge(int u,int v){
    G[u].push_back(v);
    G[v].push_back(u);
  }

  void have_root(int r){
    root=r;
    depth[r]=-1;
    que.push(r);
    while(que.size()){
      int p=que.front();que.pop();
      for(int q:G[p]){
        if(parent[p]==q)continue;
        son[p].push_back(q);
        parent[q]=p;
        que.push(q);
      }
    }
  }

  void set_depth(){
    assert(~root);
    depth[root]=0;
    que.push(root);
    while(que.size()){
      int p=que.front();que.pop();
      for(int q:son[p]){
        depth[q]=depth[p]+1;
        que.push(q);
      }
    }
  }

  inline void make_lca(){
    assert(~root);
    if(depth[root]<0)set_depth();
    for(auto p:ancestor)for(auto &q:p)q=-1;
    for(int i=0;i<G.size();i++)ancestor[i][0]=parent[i];
    for(int j=1;j<30;j++)
      for(int i=0;i<G.size();i++)
        if(~ancestor[i][j-1])
          ancestor[i][j]=ancestor[ancestor[i][j-1]][j-1];
    made_lca=true;
  }

  int lca(int u,int v){
    if(!made_lca)make_lca();
    if(depth[u]>depth[v])swap(u,v);
    int diff=depth[v]-depth[u],cnt=0;
    while(diff){
      if(diff&1)v=ancestor[v][cnt];
      cnt++;
      diff>>=1;
    }
    if(u==v)return u;
    int high=25,low=-1;
    for(int k=25;k>=0;k--)if(ancestor[u][k]!=ancestor[v][k])u=ancestor[u][k],v=ancestor[v][k];
    return ancestor[u][0];
  }

};
signed main(){
  int n,u,v;cin>>n>>u>>v;u--;v--;
  tree t(n);
  for(int i=1;i<n;i++){
    int a,b;cin>>a>>b;a--;b--;
    t.add_edge(a,b);
  }
  t.have_root(v);
  int ans=0;
  for(int i=0;i<n;i++){
    int a=t.lca(i,u);
    if(t.depth[u]-t.depth[a]>t.depth[a])continue;
    chmax(ans,t.depth[i]-1);
  }
  cout<<ans<<endl;
}


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

const int MOD = 1000000007;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define copy(from, to) copy(from.begin(), from.end(), back_inserter(to))
#define sort(a) sort(a.begin(), a.end())
#define reverse(s) reverse(s.begin(), s.end())
#define p(s) cout << (s) << endl

typedef long long ll;
using namespace std;

template<class T>
void load(vector<T> &v, int n) {
  for (int i = 0; i < n; ++i) {
    T t;
    cin >> t;
    v.push_back(t);
  }
}

template<class T>
T max(vector<T> &v) {
  return *max_element(v.begin(), v.end());
}

template<class T>
T min(vector<T> &v) {
  return *min_element(v.begin(), v.end());
}

void py(bool isUpper = false) {
  if (isUpper) {
    p("YES");
  } else {
    p("Yes");
  }
}

void pn(bool isUpper = false) {
  if (isUpper) {
    p("NO");
  } else {
    p("No");
  }
}

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

  string c = a + b;
  int d = stoi(c);

  for (int i = 1; i <= 340; ++i) {
    if (d == i * i) {
      py();
      return 0;
    }
  }
  pn();
}

Measured memory_bytes: 256
#include <iostream>
#include <stack>
#include <queue>
#include <set>
#include <vector>
#include <iomanip>
#include <algorithm>
using namespace std;

typedef long long ll;


bool is_product_overflow(ll a, ll b) {

	ll prod = a * b;
	return (prod / b != a);
}

int main()
{
	ll x, k, d;
	cin >> x >> k >> d;

	if (x < 0) x *= -1;

	ll cnt = x / d;
	ll rem = x % d;

	if (cnt > k) {
		cout << x - d * k << endl;
	}
	else if ((k - cnt) % 2 == 0) {
		cout << rem << endl;
	}
	else {
		cout << d - rem << endl;
	}

}

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

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

  int ans = 1;

  for (int i = 2; i <= x; i++) {
    for (int j = 2; j * j <= i; j++) {
      if (i % j != 0) continue;
      int c = 0;
      int n = i;
      while (n % j == 0) {
        n /= j;
        c++;
      }
      if (n == 1 && c >= 2) {
        ans = i;
        break;
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(false), cout << fixed << setprecision(20);
#define int long long
#define gcd __gcd
#define all(x) (x).begin(), (x).end()
template<class T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<class T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}
#define _overload(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(...) _overload(__VA_ARGS__, repi, _rep)(__VA_ARGS__)
#define _rev(i, n) revi(i, n, 0)
#define revi(i, a, b) for(int i = (int)(a - 1); i >= (int)(b); i--)
#define rev(...) _overload(__VA_ARGS__, revi, _rev)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
const int INF = 1e18, MOD = 1e9 + 7;
signed main() {
    INCANT;
    int n;
    cin>>n;
    rev(i, sqrt(n) + 1, 1) {
        if(n % i == 0) {
            cout<<(int)ceil(max(log10(i + 1), log10(n / i + 1)))<<endl;
            return 0;
        }
    }
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	ans := 0
	p := make([]int, n)
	t := false
	for i := 0; i < n; i++ {
		fmt.Scan(&p[i])
		if i+1 == p[i] {
			ans++
			if t {
				ans--
				t = false
			} else {
				t = true
			}
		} else {
			t = false
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 5504
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($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)*}
    };
}

macro_rules! read_value {
    ($next:expr, [graph1; $len:expr]) => {{
        let mut g = vec![vec![]; $len];
        let ab = read_value!($next, [(usize1, usize1)]);
        for (a, b) in ab {
            g[a].push(b);
            g[b].push(a);
        }
        g
    }};
    ($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, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
    ($next:expr, usize1) => (read_value!($next, usize) - 1);
    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, usize);
        read_value!($next, [$t; len])
    }};
    ($next:expr, $t:ty) => ($next().parse::<$t>().expect("Parse error"));
}

#[allow(unused)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}
#[allow(unused)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (let _ = write!(out,$($format)*););
    }
    input! {
        n: usize,
        c: chars,
    }
    let r = c.iter().filter(|&&c| c == 'R').count();
    let w = c.iter().filter(|&&c| c == 'W').count();
    let mut ans = vec!['R'; r];
    ans.extend_from_slice(&vec!['W'; w]);
    puts!("{}\n", (0..n).filter(|&i| ans[i] != c[i]).count() / 2);
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


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

int main(void){
	int n,ans=0;
	cin>>n;
	for(int i=0;i<n;i++){
	    int a,check=1;cin>>a;
	    for(int j=2;j*j<=a;j++){
	        if(a%j==0){
	            check=0;break;
	        }
	    }
	    if(check)ans++;
	}
	cout<<ans<<endl;
	return 0;
}


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

int sort(std::vector<int> &v)
{
    int size = v.size();
    bool flag = true;
    int idx = 0;
    int swapCount = 0;
    while (flag) {
        flag = false;
        for (int i = size - 1; i >= idx + 1; --i) {
            if (v[i] < v[i-1]) {
                int tmp = v[i];
                v[i] = v[i-1];
                v[i-1] = tmp;
                ++swapCount;
            }
            flag = true;
        }
        ++idx;
    }
    return swapCount;
}

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

    std::vector<int> v(n);
    for (int i = 0; i < n; ++i) {
        std::cin >> v[i];
    }
    int cnt = sort(v);
    for (int i = 0; i < n; ++i) {
        std::cout << (i ? " " : "") << v[i];
    }
    std::cout << std::endl;
    std::cout << cnt << std::endl;
    return 0;
}

Measured memory_bytes: 1204
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef double DB;

#define F(i,a,b) for(int i=(a);i<=(b);++i)
#define R(i,n) for(int i=0;i<(n);++i)
#define fill(a,b) memset(a,b,sizeof(a))

const int maxn = 110;
int a[maxn];

int main()
{
	//freopen("test.txt","r",stdin);
	int n;
	scanf("%d",&n);
	LL sum = 0;
	F(i,1,n) scanf("%d",a+i),sum += a[i];
	sum /= n;
	LL res = 1e9;
	F(i,-1,1)
	{
		LL cur = 0;
		F(j,1,n)
		{
			cur += (sum+i - a[j])*(sum+i - a[j]);
		}
		res = min(res,cur);
	}
	printf("%lld\n",res);
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int d[55];
int main(void)
{
    int n;
    int sum=0;
    cin >> n;
    for(int i=1;i<=n;i++)
        cin >> d[i];
    for(int i=1;i<n;i++)
    {
        for(int j=i+1;j<=n;j++)
            sum+=d[i]*d[j];
    }
    cout << sum;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
int main(void){
  long long n,k;
  scanf("%lld%lld",&n,&k);
  if(n<k){
    long long m=llabs(n-k);
    if(n<m)printf("%lld",n);
    else printf("%lld",m);
  }
  else {
    if(n%k==0)
      printf("0");
    else {
      long long m=n%k;
      if(m<llabs(m-k))printf("%lld",m);
      else printf("%lld",llabs(m-k));
    }
  }
    return 0;
  }


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

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);
string str = "6 7 8 9 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9";
string getstr(char s, char g) {
	int i, j;
	for (i = 0; str[i] != s; i++);
	for (j = i; str[j] != g; j++)if (str[j] == s)i = j;
	return str.substr(i, j - i + 1);
}
signed main() {
	int n; cin >> n;
	while (n--) {
		char a, b; cin >> a >> b;
		cout << getstr(a, b) << endl;
	}
	return 0;
}

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

// 未AC
int main() {
  int N, M;
  cin >> N >> M;
  vector<vector<int>> alist(N, vector<int>(2, 0));
  

// ループエラーを除く
  if (M==0) cout << 0 << " " << 0;
  
// alist.at(i).at(0)...問題iが既ACならば1, 未ACならば0
// alist.at(i).at(1)...問題iのAC前のWAの回数
  else {
    for (int i = 0; i < M; i++) {
      // i番目提出の問題番号pと結果sを入力する
      int p;
      string s;
      cin >> p >> s;
      p--; // 問題番号とalistの位置番号の起点が違うため合わせる
      
      // 既ACの問題に関しては、結果がどうであれおこなう処理なし
      // 未ACで結果がWA...問題pのWA回数を1増やす
      // 未ACで結果がAC...問題pをAC判定にするため、alist.at(p).at(0)=1にする。
      if (alist.at(p).at(0)==0 && s=="WA") alist.at(p).at(1)++;
      else if (alist.at(p).at(0)==0 && s=="AC") alist.at(p).at(0)++;
    }
    
    
    int64_t ans1=0, ans2=0;
    for (int64_t i = 0; i < N; i++) {
      if (alist.at(i).at(0)==1) {
        ans1++;
        ans2 += alist.at(i).at(1);
      }
    }
    cout << ans1 << " " << ans2;
  }
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


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

  double a = pow(L/3.0, 3.0);

  printf("%.12lf\n", a);
    
  
  return 0;
}



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

int main() {
    string A,B,C;
    cin >> A >> B >> C;
    if (A.at(A.size() - 1) == B.at(0) && B.at(B.size() - 1) == C.at(0)) {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }
}



Measured memory_bytes: 3580
x = list(map(int, input().split()))
y = list(map(int, input().split()))
z = [[0, 1, 2, 3], [0, 2, 1, 1], [1, 0, 2, 1], [2, 0, 1, 0], [1, 2, 0, 0], [2, 1, 0, 1]]
succeed = False
for i in range(6):
    match = True
    order = [0, 0, 0]
    for j in range(3):
        if {x[j], x[-j-1]} != {y[z[i][j]], y[-z[i][j]-1]}:
            match = False
            break
        if x[j] == y[z[i][j]]:
            order[j] = 1
            if x[j] == x[-j-1]:
                order[j] = 2 
    if match:
        if 2 in order:
            succeed = True
            break
        if (z[i][3] == 0 or z[i][3] == 3) and sum(order) % 2:
            succeed = True
            break
        if z[i][3] == 1 and not sum(order) % 2:
            succeed = True
            break
if succeed:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 7756
#include <iostream>
#include <bits/stdc++.h>
#define t97 1000000007

using namespace std;
typedef long long ll;

void dm(vector<vector<ll> >& m) {
    for(ll i = 0; i < m.size(); i++) {
        for(ll j = 0; j < m[i].size(); j++) {
            if(j != m[i].size()-1) {
                cout << m[i][j] << " ";
            } 
            else {
                cout << m[i][j] << endl;
            }
        }
    }
}

void dv(vector<ll>& v) {
    for(ll i = 0; i < v.size()-1; i++) {
        cout << v[i]<<" ";
    }
    cout << v[v.size()-1]<<endl;
}

void swap(ll& a, ll& b) {
    ll temp = a;
    a = b;
    b = temp;
}

ll minval(ll a, ll b) {
    if(a < b) {
        return a;
    }
    return b;
}

ll maxval(ll a, ll b) {
    if(a > b) {
        return a;
    }
    return b;
}

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

ll powmod(ll a, ll b, ll mod){
    if(b == 0)return 1;
    if(b%2 == 0){
        ll c = powmod(a,b/2, mod);
        return (c*c)%mod;
    }
	else{
        return (a*powmod(a,b-1, mod))%mod;
    }
}

ll modInverse(ll A,ll M)
{
    return powmod(A,M-2,M);
}

void solve() {
	
}

bool winner(ll k, vector<ll>& v, vector<ll>& dp, ll level) {
//	cout << "Level "<< level << endl;
	if(k == 0) {
		return false;
	}
	if(dp[k] == 1) {
		return true;
	}
	if(dp[k] == 0) {
		return false;
	}
	bool wins = false;
	for(ll i = 0;i < v.size(); i++) {
		if(v[i] <= k) {
			wins = (wins || (!winner(k-v[i], v, dp, level+1)));
		}
		if(wins) {
			dp[k] = 1;
			return true;
		}
	}
	dp[k] = 0;
	return false;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
//    freopen("input.txt", "r", stdin); 
//    freopen("output.txt", "w", stdout);
	ll n, k;
	cin>>n>>k;
	vector<ll> v(n);
	for(ll i = 0; i < n; i++) {
		cin>>v[i];
	}
	vector<ll> dp(k+1, -1);
	if(winner(k, v, dp, 0)) {
		cout << "First" << endl;
	}
	else {
		cout << "Second" << endl;
	}
    
    return 0;
}

Measured memory_bytes: 10276
// 20:20 - 
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <deque>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <map>
#include <cmath>
#include <stack>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)

using namespace std;

int main(){
  int n;
  int a[2][150];
  int dp[2][150];

  cin >> n;
  for(int i = 0; i < 2; i++){
    for(int k = 0; k < n; k++){
      cin >> a[i][k];
      dp[i][k] = 0;
    }
  }

  dp[0][0] = a[0][0];
  for(int i = 0; i < 2; i++){
    for(int k = 0; k < n; k++){
      if(i == 0 && k == 0)continue;
      if(i-1 >= 0){
        if(dp[i][k] < dp[i-1][k] + a[i][k])
          dp[i][k] = dp[i-1][k] + a[i][k];
      }
      if(k-1 >= 0){
        if(dp[i][k] < dp[i][k-1] + a[i][k])
          dp[i][k] = dp[i][k-1] + a[i][k];
      }
    }
  }

  //debug
/*  for(int i = 0; i < 2; i++){
    for(int k = 0; k < n; k++){
      cout << dp[i][k] << " ";
    }
    cout << endl;
  }*/

  cout << dp[1][n-1] << endl;

  return 0;
}


Measured memory_bytes: 256
n = gets.to_i
ans = Array.new(n,0)
for i in 1..100
  for j in 1..100
    for k in 1..100
      x = i**2 + j**2 + k**2 + i*j + j*k + k*i
      if x >= 1 && x <= n
        ans[x-1] += 1
      end
    end
  end
end
puts ans

Measured memory_bytes: 14288
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <iomanip>
#include <cstdlib>
using namespace std;

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

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string.h>
#include <cmath>
#include <map>
#include <algorithm>

using ll = long long;
using namespace std;

int main()
{
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	ll L,R;cin>>L>>R;
	ll ans = 2018;
	for(ll i=L;i<R;++i){
		for(ll j=i+1;j<=R;++j){
			ans = min(ans,(i*j)%2019);
			if(ans == 0)return cout<<ans<<endl,0;
		}
	}
	cout<<ans<<endl;
  
 


}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int N;
    scanf("%d",&N);
    if(N%1000==0)
    {
        printf("0\n");
    }
    else if(N>0 && N<1000)
    {
        printf("%d\n",1000-N);
    }
    else if(N>1000 && N<2000)
    {
        printf("%d\n",2000-N);
    }
    else if(N>2000 && N<3000)
    {
        printf("%d\n",3000-N);
    }
    else if(N>3000 && N<4000)
    {
        printf("%d\n",4000-N);
    }
    else if(N>4000 && N<5000)
    {
        printf("%d\n",5000-N);
    }
    else if(N>5000 && N<6000)
    {
        printf("%d\n",6000-N);
    }
    else if(N>6000 && N<7000)
    {
        printf("%d\n",7000-N);
    }
    else if(N>7000 && N<8000)
    {
        printf("%d\n",8000-N);
    }
    else if(N>8000 && N<9000)
    {
        printf("%d\n",9000-N);
    }
    else if(N>9000 && N<10000)
    {
        printf("%d\n",10000-N);
    }
    else
    {
        printf("error 404\n");
    }
    return 0;
}


Measured memory_bytes: 1732
n = int(input())

a = list(int(input()) for i in range(n))
a = sorted(a)
A = sum(a)
if A%10!=0:
  print(A)
else:
  for i in range(n):
    if(A-a[i])%10!=0:
      print(A-a[i])
      exit()
  print(0)
      

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>
#include <limits>
#include <cassert>
#include <bitset>

using namespace std;

/* template */

using ll = long long;

void debug_out() { std::cout << std::endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cout << "debug: "; debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif

#define rep(i, a, n) for (int i = (int)(a); i < (int)(n); i++)
#define rrep(i, a, n) for (int i = ((int)(n-1)); i >= (int)(a); i--)
#define Rep(i, a, n) for (long long i = (long long)(a); i< (long long)(n); i++)
#define RRep(i, a, n) for (long long i = ((long long)(n-1ll)); i>=(long long)(a); i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}

struct Edge{
    int to;
    ll weight;
    Edge(int t, ll w) : to(t), weight(w){ }
};

struct edge{
    int from;
    int to;
    ll weight;
    edge(int f,int t,ll w) : from(f), to(t), weight(w){ }
};


using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;
using edges = vector<edge>;

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

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

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

constexpr ll LNF = 1LL<<60;

constexpr int INF = 1e9+7;

const double PI=3.14159265358979323846;


vector<int> dx = {-1,0,1,0,-1,1,-1,1};
vector<int> dy = {0,-1,0,1,1,-1,-1,1};

/* template */

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s; cin >> s;
    string ans = "";
    rep(i,0,s.size()){
        if(s[i]=='?'){
            ans += 'D';
        }
        else{
            ans += s[i];
        }
    }
    cout << ans << endl;
}


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

#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
#define rep2(i,s,n) for(long long i=(s); i<(long long)(n);i++)

#define mod 1e9+7;
#define inf 1e18+7;

typedef long long ll;

int main() {

    string s;cin>>s;

    if(s=="SAT"){
        cout<<1<<endl;
    }
    else if (s=="FRI") {
        cout<<2<<endl;
    }
    else if (s=="THU") {
        cout<<3<<endl;
    }
    else if (s=="WED") {
        cout<<4<<endl;
    }
    else if (s=="TUE") {
        cout<<5<<endl;
    }
    else if (s=="MON") {
        cout<<6<<endl;
    }
    else if (s=="SUN") {
        cout<<7<<endl;
    }

}


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

int tab[31];
bool isex[31];
map<int,int> m;
int main(){
    int a,b;
    for(;;){
        scanf("%d,%d",&a,&b);
        if(a==0&&b==0) break;
        m[a]=b;
        isex[b]=true;
    }
    int rank=1;
    for(int i=30;i>=0;i--){
        if(isex[i]){
            tab[i]=rank;
            rank++;
        }
    }
    int c;
    while(scanf("%d",&c)!=-1){
        printf("%d\n",tab[m[c]]);
    }
}

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

using namespace std;

const int Nmax = 2e5 + 5;
int n, i, L, q, cnt[Nmax], A[Nmax], x, y, pos, a[Nmax];

int main()
{
 //   freopen("input", "r", stdin);
 //   freopen("output", "w", stdout);
    cin.sync_with_stdio(false);

    cin >> n >> q;
    for(i=1; i<=n; ++i)
    {
        cin >> A[i];
        ++cnt[A[i]];
    }

    for(i=1; i<=n; ++i)
    {
        ++a[max(0, i - cnt[i])];
        --a[i];
    }

    L = (a[0] > 0);
    for(i=1; i<=n; ++i)
    {
        a[i] += a[i-1];
        L += (a[i] > 0);
    }

    while(q--)
    {
        cin >> pos >> y;
        x = A[pos];
        A[pos] = y;

        if(x >= cnt[x])
        {
            --a[x - cnt[x]];
            L -= (!a[x - cnt[x]]);
        }

        --cnt[x];
        ++cnt[y];

        if(y >= cnt[y])
        {
            L += (!a[y - cnt[y]]);
            ++a[y - cnt[y]];
        }

        cout << n - L << '\n';
    }
    return 0;
}


Measured memory_bytes: 3840
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long unsigned int ll;

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

// 初期位置も座標に加える
// ソート
// 差のリストを作る セットにしとく
// 差の最大公約数を求める
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}

int main() {
  int N, X;
  cin >> N >> X;
  vector<int> x;
  x.push_back(X);
  rep(i, N) {
    int xi;
    cin >> xi;
    x.push_back(xi);
  }

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

  set<int> S;
  rep(i, N) {
    S.insert(x[i + 1] - x[i]);
    // cout << x[i + 1] - x[i] << endl;
  }
  auto it = S.begin();
  int result = *it;
  for (auto it = S.begin(), end = S.end(); it != end; ++it) {
    // cout << *it << endl;
    result = gcd(result, *it);
  }

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


Measured memory_bytes: 892
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF = 1LL << 30;
int MOD = 1e9+7;
main(){
    int N;
    cin >> N;
    vector<int> cnt(9);
    for(int i = 0;i < N;i++){
        int a;
        cin >> a;
        cnt[a >= 3200 ? 8 : a / 400]++;
    }
    int mini = 0,maxi = 0;
    for(int i = 0;i < 8;i++){
        mini += cnt[i] != 0;
    }
    maxi = mini + cnt[8];
    if(mini == 0)mini++;

    cout << mini << " " <<  maxi << endl;
    
}

Measured memory_bytes: 256
#include<stdio.h>

int main (){
  int a,b,c,i,temp;
  int flag = 0;
  
    
  scanf("%d %d",&a,&b);
  
  for(i = 1;i < 4;i++){
    if(a * b * i % 2 != 0){
      flag = 1;
    }
  }

  if(flag == 1){
    printf("Yes");
  }else{
    printf("No");
  }
    
        return 0;
  
}



Measured memory_bytes: 128
#include <iostream>
#include <stdio.h>
#define N 100005
using namespace std;
#define ll long long
 
ll a[N],b[N];
int main(){
	ll n,Max=0,flag=1,ans=0;
	scanf("%lld",&n);
	ll num=n;
	num=(n+1)*num/2;
	for(int i=0;i<=n;i++){
		if(i<n) scanf("%lld",&a[i]);
		if(i){
			b[i%n]=a[i%n]-a[i-1];
			Max=max(Max,b[i%n]);
		}
	}
	for(int i=0;i<n;i++){
		b[i]=Max-b[i];
		if(b[i]%n) flag=0;
		b[i]/=n;
		ans+=b[i]*(n-i);
	}
	if(flag && (a[n-1]-ans)%num==0 && ans<=a[n-1]){
		cout<<"YES"<<endl;
	}else{
		cout<<"NO"<<endl;
	}
 
}

Measured memory_bytes: 1792
# include <iostream>
# include <string>
# include <algorithm>
# include <vector>
# include <cstring>
# include <stdio.h>
# include <map>

# define ll long long
# define pii pair<int,int>
# define FOR(a,b) for(int a=1; a<=b; a++)
# define REP(a,b) for(int a=0; a<b; a++)
# define FORU(a,b,c) for(int a=b; a<=c; a++)
# define FORD(a,b,c) for(int a=b; a>=c; a--)

using namespace std;

inline ll max(ll a, ll b){
    return a>b ? a : b;
}

int N, A, B;
int health[100005];
bool ok(int m){
    ll sum = 0;
    FOR(i,N){
        if (health[i] - 1ll * m * B > 0) {
            ll val = max(0ll, (health[i] - 1ll * m * B) / (A - B)  + ((health[i] - 1ll * m * B) % (A - B) > 0 ) );
            sum += val;
        }
    }
    return sum <= m;
}

int main(){

    ios :: sync_with_stdio(false);
    
    cin >> N >> A >> B;
    FOR(i,N) cin >> health[i];
    
    int ans = 1<<30, lo = 1, hi = 1<<30;
    while(lo <= hi){
        int mid = (lo+hi)/2;
        if(ok(mid)){
            hi = mid-1;
            ans = mid;
        }
        else lo = mid+1;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define rrep(i,n) for(int i=(n-1); i>=0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define to_s to_string
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define pr(x) cout<<(x)<<'\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
#define yes "Yes"
#define no "No"
using namespace std;
using ll = long long;
using Edge = pair<int,long long>;
using Graph = vector<vector<Edge>>;
typedef pair<int,int> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


int main(){
    int N;
    cin >> N;
    vector<int> B(N-1);
    rep(i,N-1) cin >> B[i];
    vector<int> A(N);
    A[0] = 1e9;
    
    rep(i,N-1){
        A[i+1] = B[i];
        A[i] = min(B[i],A[i]);

    }
    pr(accumulate(ALL(A),0));
}

Measured memory_bytes: 256
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define CLOOP        while (true)
#define FLOOP(i, n)  for (int i = 0; i < (n); i++)
#define FOR(i, f, l) for (int i = (f); i < (l); i++)
#ifdef DEBUG
#define DUMP(var)   cerr << "[DEBUG] " << #var << ": " << var << endl
#else
#define DUMP(var)
#endif

#define LL long long

using namespace std;

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

    int n;
    cin >> n;
    int a[n], max = 0;
    long long sum = 0;

    FLOOP(i, n)
        cin >> a[i];

    FLOOP(i, n) {
        if (a[i] > max)
            max = a[i];
        else
            sum += max - a[i];
    }

    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 4440
#include<bits/stdc++.h>
using namespace std;
#define RI register int
int read() {
	int q=0;char ch=' ';
	while(ch<'0'||ch>'9') ch=getchar();
	while(ch>='0'&&ch<='9') q=q*10+ch-'0',ch=getchar();
	return q;
}
typedef long long LL;
const int N=100005;
int h[N],ne[N<<1],to[N<<1],sum[N],vis[N],k[N],b[N];
int n,m,tot,ss,tt,js,all;LL ans;
void add(int x,int y) {to[++tot]=y,ne[tot]=h[x],h[x]=tot;}
void dfs1(int x,int las) {
	sum[x]=-sum[las],all+=sum[x],vis[x]=1;
	for(RI i=h[x];i;i=ne[i]) {
		if(to[i]==las) continue;
		if(vis[to[i]]) tt=to[i],ss=x;
		else dfs1(to[i],x);
	}
}
void dfs2(int x,int las) {
	for(RI i=h[x];i;i=ne[i]) {
		if(to[i]==las||(x==ss&&to[i]==tt)||(x==tt&&to[i]==ss)) continue;
		dfs2(to[i],x);
		sum[x]+=sum[to[i]],k[x]+=k[to[i]];
	}
}
void work1() {
	if(all) {puts("-1");return;}
	dfs2(1,0);for(RI i=1;i<=n;++i) ans+=abs(sum[i]);
	printf("%lld\n",ans);
}
void work2() {
	if(all&1) {puts("-1");return;}
	sum[ss]-=all/2,sum[tt]-=all/2;
	ans+=abs(all/2);
	dfs2(1,0);for(RI i=1;i<=n;++i) ans+=abs(sum[i]);
	printf("%lld\n",ans);
}
void work3() {
	if(all) {puts("-1");return;}
	++k[ss],--k[tt],dfs2(1,0);
	b[++js]=0;
	for(RI i=1;i<=n;++i)
		if(!k[i]) ans+=abs(sum[i]);
		else if(k[i]==1) b[++js]=-sum[i];
		else b[++js]=sum[i];
	sort(b+1,b+1+js);
	int x=b[(js+1)/2];
	for(RI i=1;i<=js;++i) ans+=abs(x-b[i]);
	printf("%lld\n",ans);
}
int main()
{
	int x,y;
	n=read(),m=read();
	for(RI i=1;i<=m;++i) x=read(),y=read(),add(x,y),add(y,x);
	sum[0]=-1,dfs1(1,0);
	if(m==n-1) work1();
	else if(sum[ss]==sum[tt]) work2();
	else work3();
	return 0;
}


Measured memory_bytes: 14988
#include <stdio.h>

int main(){
	int age = 1;
	scanf("%d",&age);

	if(age == 1){
		printf("Hello World\n");
	}
	if(age == 2){
		int a,b;
		scanf("%d %d",&a,&b);
		printf("%d\n",a+b);
	}
	return 0;
}

Measured memory_bytes: 128
z[1009999];
main(N,a,b,i){for(;scanf("%d%d%d",&N,&a,&b),N;printf("%d\n",a)){
	for(memset(z,0,sizeof(z)),*z=1,i=0;i<=N;i++)if(z[i])z[a+i]=a+i<=N,z[b+i]=b+i<=N;
	for(a=i=0;i<=N;i++)a+=!z[i];
}exit(0);}

Measured memory_bytes: 4548
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <set>
#include <map>
#include <cassert>
#include <numeric>
#include <string>
#include <cstring>
#include <cmath>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

typedef long long int int64;

const int X = (int) 1e6 + 100;
char str[X];

const int ALP = 26;

int goTo[X][ALP];
int parc[X];
int term[X];

const int N = (int) 2e5 + 100;
vector <int> pos[N];
int sz = 1;

void solve(int id)
{
    scanf("%s", str);
    int n = strlen(str);
    reverse(str, str + n);

    int v = 0;
    for (int i = 0; i < n; i++)
    {
        int c = str[i] - 'a';
        if (goTo[v][c] == 0)
        {
            parc[sz] = c;
            goTo[v][c] = sz++;
        }
        pos[id].push_back(v);
        v = goTo[v][c];
    }
    pos[id].push_back(v);
    term[v] = id;
}

int answer;
int has[ALP];

int timer;

void addPair(int a, int b)
{
    if (a > b)
        swap(a, b);
    if (a == -1 || a == b)
        return;
    answer++;
}

void getAns(int id)
{
    //for (int x : pos[id])
    //    eprintf("%d ", x);
    //eprintf("\n");
    memset(has, false, sizeof has);
    for (int i = (int) pos[id].size() - 1; i >= 0; i--)
    {
        int v = pos[id][i];
//        addPair(id, term[v]);

        for (int j = 0; j < ALP; j++)
            if (has[j])
                addPair(id, term[goTo[v][j]]);

        has[parc[v]] = true;
    }
}

int main(int,  char **)
{
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif

    memset(term, -1, sizeof term);

    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
        solve(i);

    for (int i = 0; i < n; i++)
        getAns(i);

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



	return 0;
}




Measured memory_bytes: 123044
#include <iostream>
#include <string>
using namespace std;
typedef long long ll;

ll gcd(ll n, ll m){
    if(n % m == 0){
        return m;
    }
    return gcd(m, n % m);
}

int main()
{
    ll n, m;
    cin >> n >> m;
    string s, t;
    cin >> s >> t;
    ll g = gcd(n, m);
    for(int i = 0; i < g; i++){
        if(s[(n / g) * i] != t[(m / g) * i]){
            cout << -1 << endl;
            return 0;
        }
    }
    cout << n * m / g << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <string.h>

using namespace std;

// #define for(i,a,b) for (int i=(a);i<(b);++i)
typedef long long ll;
typedef pair<ll,ll> P;
#define REP(i,n) for(long long i = 0; i < (long long)(n); i++)
#define pb push_back // vectorに要素追加
#define INF (ll)1e18
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

/*
けんちょん解答参照
https://atcoder.jp/contests/abc165/submissions/12594319

*/
ll N, M, Q;
vector<ll> a, b, c, d;
 
ll calc(const vector<ll> &A){ // 数列Aが得る得点を計算
	// &: 参照演算子
	// https://qiita.com/RuthTaro/items/f35c3a26779c0ca1a41a
    ll ans = 0;
	REP(i,Q){
        if (A[b[i]] - A[a[i]] == c[i]) ans += d[i];
    }
    return ans;
}

void dfs(vector<ll> &A, ll &ans){
    if (A.size()==N) { // Aの長さがN→Aが完成した→点数を計算する
        ll tmp = calc(A); // Aの点数を計算
		// REP(i,A.size()){
		// 	printf("%lld ", A[i]);
		// }
		// printf(", score: %lld\n", tmp);
        chmax(ans, tmp); // templete: tmpがansより大きかったらans更新
        return;
    }
	// 取りうる値をAの末尾を付け足すことでdfsによる全列挙を行う
	ll ba;
	if (A.size()==0) ba = 1;
	else ba = A.back(); //back: 末尾要素への参照を取得する
	// ba = Aの一番最後の値
    for (ll add = ba; add <= M; ++add) {
        A.pb(add);
        dfs(A, ans);
        A.pop_back(); // pop_back: 末尾要素を削除
    }
}
int main() {
	// 入力
	cin>>N>>M>>Q;
    a.resize(Q); b.resize(Q); c.resize(Q); d.resize(Q); // vectorのサイズを修正
	REP(i,Q){
		ll a_tmp, b_tmp, c_tmp, d_tmp;cin>>a_tmp>>b_tmp>>c_tmp>>d_tmp;a_tmp--;b_tmp--;
		a[i] = a_tmp;b[i] = b_tmp;c[i] = c_tmp;d[i] = d_tmp;
	}
	// REP(i,Q){
	// 	printf("%lld, %lld, %lld, %lld, \n", a[i], b[i], c[i], d[i]);
	// }

	// 解法
    ll ans = 0;
    vector<ll> A;
    dfs(A, ans); // ありうる数列Aをdfsによって全列挙する

	//出力
	printf("%lld\n", ans);
}


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

#define rep(i,x,y) for(ll i=(x);i<(y);i++)
#define rrep(i,x,y) for(ll i=(ll)(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
#ifdef LOCAL
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#define dassert(...) assert(__VA_ARGS__)
#else
#define dump(x)
#define debug(x)
#define dassert(...)
#endif
//#define int long long

typedef long long ll;
const ll MOD = 1e9 + 7;
const long double EPS = 1e-8;

class Sieve {
    long long n_;
    vector<long long> sieve_, primes_;

public:
    explicit Sieve(long long n=1): n_(n), sieve_(n + 1) {
        sieve_[0] = sieve_[1] = -1;
        for (long long i = 2; i <= n; ++i) {
            if (sieve_[i]) continue;
            primes_.push_back(i);
            sieve_[i] = i;
            for (long long j = i*i; j <= n; j += i) {
                if (!sieve_[j]) sieve_[j] = i;
            }
        }
    }
    bool isPrime(long long x) {
        assert (n_ * n_ >= x);
        if (n_ >= x) {
            return sieve_[x] == x;
        } else {
            for (const auto prime : primes_) {
                if (x % prime == 0) return false;
            }
            return true;
        }
    }
    vector<long long> getPrimes() {
        return primes_;
    }
    vector<pair<long long, int>> getPrimeFactorList(long long x) {
        assert (n_ * n_ >= x);
        vector<long long> factorList;
        if (isPrime(x)) {
            factorList.emplace_back(x);
            x /= x;
        }
        while (x != 1) {
            factorList.push_back(sieve_[x]);
            x /= sieve_[x];
        }
        if (factorList.empty()) return {};
        vector<pair<long long, int>> res(1, pair<long long, int>(factorList[0], 0));
        for (long long p : factorList) {
            if (res.back().first == p) {
                res.back().second++;
            } else {
                res.emplace_back(p, 1);
            }
        }
        return res;
    }
};

bool isValid (ll N, ll k) {
    if (k == 1) return false;
    if (N == 1) return true;
    else if (N % k == 0) return isValid(N/k, k);
    return N % k == 1;
}

void solve(long long N){
    unordered_set<ll> answers;
    rep(k,1,pow(N, 0.5)+1) {
        if (isValid(N, k)) answers.insert(k);
        if ((N-1) % k == 0) {
            ll a = (N-1) / k;
            if (a <= k) continue;
            if (isValid(N, a)) answers.insert(a);
        }
    }
    if (isValid(N, N)) answers.insert(N);
    if (isValid(N, N-1)) answers.insert(N-1);

    cout << answers.size() << endl;
}

signed main(){
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


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

#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("Ofast")

using namespace std;

typedef long long ll;


void solve() {
    int a, b;
    cin >> a >> b;
    ll res = a * b;
    cout << res << "\n";

}

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

Measured memory_bytes: 3656
#include<stdio.h>
int main(){
    
    int x,y,z,n;
    scanf("%d",&n);
    
    if(100<=n && n<=999){
        x=n%10;
        n=n/10;
        y=n%10;
        z=n/10;
        if(x==7 || y==7 || z==7)
            printf("Yes\n");
        else
            printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 1664
N=int(input())
A=[0 for _ in range(N)]
B=[0 for _ in range(N)]
for i in range(N):
  a,b=[int(s) for s in input().split()]
  A[i]=a
  B[i]=b
A.sort()
B.sort()
def doublemed(ls,num):
  if num%2==0:
    return(ls[num//2-1]+ls[num//2])
  else:
    return(ls[num//2])
meda=doublemed(A,N)
medb=doublemed(B,N)
print(medb-meda+1)

Measured memory_bytes: 25456
#include<bits/stdc++.h>
using namespace std;
int main(void){
    int h,n;
    cin>>h>>n;
    vector<int> a(n);
    for (int i=0; i<n; i++){
        cin>>a[i];
        h=h-a[i];
    }
        if(h<=0){
            cout<<"Yes"<<endl;
        }else cout<<"No"<<endl;
    }

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

typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> PLL;
typedef pair<P,P> PP;
typedef vector<ll> VECLL;
typedef vector<P> VECP;
typedef priority_queue<P,VECP,greater<P> > PQP;
typedef priority_queue<ll, VECLL, greater<ll> > PQll;

#define rep(i,a,n) for(ll i = a;i < n;i++)   
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue; 
#define LINF (ll)1e18
#define INF (int)1e9
#define fs first
#define sc second

#include <bits/stdc++.h>
#define rep(i,a,n) for(ll i = a;i < n;i++)
typedef long long ll;
using namespace std;

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

    vector<ll> vec;
    ll memo = 0;
    if(s[0] == 'p') vec.push_back(0);
    rep(i,0,s.size()-1){
        memo++;
        if(s[i] != s[i+1]){
            vec.push_back(memo);
            memo = 0;
        }
    }
    memo++;
    vec.push_back(memo);
    
    ll ans = 0;

    memo = 0;
    rep(i,0,vec.size()){
        if(i % 2 == 0){
            memo += vec[i];
        }
        else{
            if(memo < vec[i]){
                ans -= ceil((double)(vec[i] - memo)/2.0);
            }
            else{
                memo -= vec[i];
            }
        }
    }

    ans += memo/2;

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


Measured memory_bytes: 4452