akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp5
{

    class Program
    {
        static void Main(string[] args)
        {
            string S = Console.ReadLine();
            int NS = int.Parse(S);
            int n1 = NS / 1000;
            int n2 = (NS % 1000)/100;
            int n3 = (NS % 100) / 10;
            int n4 = NS % 10;

            bool YYMM = false;
            bool MMYY = false;

            if(n1 * 10 + n2 <= 12 && n1 * 10 + n2 != 0)
            {
                MMYY = true;
            }
            if(n3 * 10 + n4 <= 12 && n3 * 10 + n4 != 0)
            {
                YYMM = true;
            }

            if (YYMM == true && MMYY == false)
            {
                Console.WriteLine("YYMM");
            }
            else if (MMYY == true && YYMM == false)
            {
                Console.WriteLine("MMYY");
            }
            else if (MMYY == true && YYMM == true)
            {
                Console.WriteLine("AMBIGUOUS");
            }
            else
            {
                Console.WriteLine("NA");
            }
        }
    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define debug(x)      cerr << "L" << __LINE__ << ": " << #x << " = " << (x) << endl
#define debugvec(v)   rep(i, v.size()) cerr << "L" << __LINE__ << ": " << #v << "[" << i << "] = " << v[i] << endl;
#define debugvec2(v)  cerr << "L" << __LINE__ << ": " << #v << " = { "; rep(i, v.size()) cerr << v[i] << (i + 1 == v.size() ? "" : ", "); cerr << " }" << endl;
typedef long long ll;  /* 10^18 くらいまでいける */

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

  int a_sum = accumulate(a.begin(), a.end(), 0);

  if (h<=a_sum)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}

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

using namespace std;

const int N = 2e5 + 5;

vector<int> g[N];

vector<int> nodes[2];
int col[N], ans[N], used[N];

void dfs(int v, int par) {
  nodes[col[v]].push_back(v);
  for (int u : g[v]) {
    if (u == par) continue;
    col[u] = !col[v];
    dfs(u, v);
  }
}

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i < n; ++i) {
    int u, v;
    scanf("%d %d", &u, &v);
    --u, --v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  dfs(0, 0);
  int cnt3 = n / 3;
  if ((int)nodes[0].size() <= cnt3 || (int)nodes[1].size() <= cnt3) {
    int small = nodes[0].size() < nodes[1].size() ? 0 : 1;
    int now = 3;
    for (int u : nodes[small]) {
      ans[u] = now;
      used[now] = 1;
      now += 3;
    }
    now = 1;
    for (int u : nodes[small^1]) {
      while (used[now]) ++now;
      ans[u] = now;
      used[now] = 1;
    }
  }
  else {
    int now1 = 1, now2 = 2, now3 = 3;
    for (int u : nodes[0]) {
      if (now1 <= n) {
        ans[u] = now1;
        now1 += 3;
      }
      else {
        ans[u] = now3;
        now3 += 3;
      }
    }
    for (int u : nodes[1]) {
      if (now2 <= n) {
        ans[u] = now2;
        now2 += 3;
      }
      else {
        ans[u] = now3;
        now3 += 3;
      }
    }
  }
  for (int i = 0; i < n; ++i) {
    printf("%d%c", ans[i], i + 1 == n ? '\n' : ' ');
  }
  return 0;
}


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

int main() {
  //頂点数、辺数
  int h,w; cin >> h >> w;
  vector<int> a;
  //グラフ入力受取
  vector<string> M(h);
  for (int i = 0; i < h; i++){
    string s;
    cin >> s;
    M[i] = s;
  }
  
  map<P,vector<P>> G;
  map <P,int> dist; //全頂点を「未訪問」に初期化
  for (int i = 0; i < h; i++){
    for(int j = 0;j < w;j++){
      dist[P(i,j)]=-1;
      if(M[i][j]=='#'){
	G[P(i,j)].push_back (P(-1,-1));
	continue;
      }
      if(i!=0&&M[i-1][j]=='.')G[P(i,j)].push_back(P(i-1,j));
      if(i!=h-1&&M[i+1][j]=='.')G[P(i,j)].push_back(P(i+1,j));
      if(j!=0&&M[i][j-1]=='.')G[P(i,j)].push_back(P(i,j-1));
      if(j!=w-1&&M[i][j+1]=='.')G[P(i,j)].push_back(P(i,j+1));
    }
  }
  
  //BFSのためのデータ構造
  rep(i,h)rep(j,w){
    queue <P> que;
    map <P,int> dist2;
    dist2.insert(dist.begin(), dist.end());
    //初期条件 (頂点0を初期ノードとする)
    dist2[P(i,j)] = 0;
    que.push(P(i,j)); //0を橙色頂点にする
    
    //BFS開始 (キューが空になるまで探索を行う)
    while (!que.empty()) {
      P v = que.front();
      que.pop();
      //vから辿れる頂点を全て調べる
      for (P nv : G[v]) {
	if (nv == P(-1,-1))continue;
	if (dist2[nv]!=-1)continue; //既に発見済みの頂点は探索しない
	//新たな白色頂点nvについて距離情報を更新してキューに追加する
	dist2[nv] = dist2[v] + 1;
	que.push(nv);
      }
    }
    int tmp = 0;
    rep(i,h)rep(j,w)a.push_back(max(tmp,dist2[P(i,j)]));
  }
  int ans = 0;
  rep(i,a.size())ans = max(ans,a[i]);
  cout << ans << endl;
  return 0;
}
  


Measured memory_bytes: 1504
#include <bits/stdc++.h>
#define int long long
#pragma GCC optimize("O3,Ofast,no-stack-protector,unroll-loops,fast-math")
#pragma GCC target("avx,avx2,sse")
using namespace std;

int root(int x) {
    for (int i = -1000; i <= 1000; i++) {
        if (i * i * i * i * i == x) {
            return i;
        }
    }
    return -1;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int x;
    cin >> x;
    for (int i = -1000; i <= 1000; i++) {
        int res = i * i * i * i * i - x;
        if (root(res) != -1) {
            cout << i << ' ' << root(res) << endl;
            return 0;
        }
    }

    fflush(stdout);
    return 0;
}


Measured memory_bytes: 3656
#include<stdio.h>

int MAX = 501,FUGE=10000;
int SIZE=(1<<30);

int main(){

  int n, i, j, num, sum, A[MAX][MAX], x, y, min, d[MAX], p[MAX], s[MAX];

  scanf("%d", &n);

  for ( i = 0; i< n; i++ ){

    for ( j = 0; j < n; j++ ){

      scanf("%d", &num);

      A[i][j] = num;
      if(num ==-1) A[i][j] = FUGE;
    }
  }

  for ( i = 0; i < n; i++ ) {

    d[i] = SIZE;
    p[i] = -1;
    s[i] = 0;

  }

  d[0] = 0;

  while(1){

    min = MAX;
    x = -1;

    for ( i = 0; i < n; i++ )
      {
	if ( min > d[i] && ! s[i] )
	  {
	    x = i;
	    min = d[i];
	  }
      }
    if ( x == -1 ) break;
    s[x] = 1;

    for ( y = 0; y < n; y++ )
      {
	if ( !s[y] && A[x][y] != MAX )
	  {
	    if ( d[y] > A[x][y] )
	      {
		d[y] =  A[x][y];
		p[y] = x;
	      }
	  }
      }
  }

  sum = 0;

  for ( i = 0; i < n; i++ )
    {
      if ( p[i] != -1 ) sum += A[i][p[i]];
    }

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

  return 0;
}

Measured memory_bytes: 804
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#define ll long long
#define rep(i, a, b) for(int i = a; i <= b; i++)
void read(int &x) {
    x = 0; int flag = 1; char ch = ' ';
    while(ch < '0' || ch > '9') { if(ch == '-') flag = -1; ch = getchar(); }
    while(ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
    x *= flag;
}
void read(ll &x) {
    x = 0; int flag = 1; char ch = ' ';
    while(ch < '0' || ch > '9') { if(ch == '-') flag = -1; ch = getchar(); }
    while(ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
    x *= flag;
}
using namespace std;
const int maxn = 1010;
int n, l, a[maxn], sum, ans;
int main()
{
    read(n), read(l);
    rep(i, 1, n) a[i] = l + i - 1, sum += a[i];
    int mmax = 1000000;
    rep(i, 1, n)
        if(abs(sum - (sum - a[i])) < mmax) {
            mmax = abs(sum - (sum - a[i]));
            ans = sum - a[i];
        }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int> >;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define rrep(i,m,n) for(int i = m; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define mp make_pair
#define sum accumulate
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
typedef long long ll;
const int INF = 2000000000;
const ll INF64 = 1000000000000000ll;
const ll MOD = 1000000007LL;
int main(){
    int h,n;
    std::cin >> h>>n;
    VEC(int,a,n);
    if(sum(all(a),0)>=h)std::cout << "Yes" << std::endl;
    else std::cout << "No" << std::endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<char> vchar;
typedef vector<vector<char>> vvchar;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
typedef priority_queue<long long> prque;
#define ain(i,n,a) for(long long i=0;i<(long long)(n);i++){cin>>a[i];}
#define aout(i,n,a) for(long long i=0;i<(long long)(n);i++){if(i){cout<<" ";}cout<<a[i];if(i==n-1){cout<<endl;}}
#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define vsort(v) sort((v).begin(),(v).end())
#define vrsort(v) sort((v).rbegin(),(v).rend())
#define vreverse(v) reverse((v).begin(),(v).end())
#define pf(a) push_front(a)
#define pb(a) push_back(a)
#define INF 1998021900
#define MOD 1000000007
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  //input
  vll c(4);char v;rep(i,4){cin>>v;c[i]=v-48;}
  //caricurate
  rep(d,2){
  rep(f,2){
  rep(g,2){
  ll h=c[0];
  if(d){h-=c[1];}else{h+=c[1];}
  if(f){h-=c[2];}else{h+=c[2];}
  if(g){h-=c[3];}else{h+=c[3];}
    if(h==7){
    cout<<c[0]<<(d?"-":"+")<<c[1]<<(f?"-":"+")<<c[2]<<(g?"-":"+")<<c[3]<<"=7"<<endl;return 0;
    }
  }
  }
  }
}

Measured memory_bytes: 256
mod = 1000000007
N = int(input())
A = list(map(int, input().split()))
S = [0] # 累積和のリスト
ans = 0
for i in range(N):
    S.append(A[i] + S[i] % mod)
for i in range(N):
    sum = S[N] - S[i + 1]
    if sum < 0:
        sum += mod
    ans += A[i] * sum
print(ans % mod)




Measured memory_bytes: 31352
#include <stdlib.h>     /* srand, rand */
#include <time.h>       /* time */
#include <bits/stdc++.h>
#include <cmath>
#include <iomanip>
#include <iterator> 
using namespace std;

#define f first
#define s second

#define pb push_back
#define pp pop_back
#define mp make_pair

#define sz(x) (int)x.size()
#define sqr(x) ((x) * 1ll * (x))
#define all(x) x.begin(), x.end()
#define clr(a,v) memset(a, v, sizeof(a))

#define rep(i, l, r) for (int i = (l); i <= (r); i++)
#define per(i, l, r) for (int i = (l); i >= (r); i--)
#define reflex ios_base::sync_with_stdio(false)

#define nl '\n'
#define ioi exit(0);


#define PI 3.14159265

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int N= (int)1e5 + 7;
const int inf = (int)1e9 + 7;
const int mod = (int)1e9 + 7;
//const int mod = 1000000007;
const ll linf = (ll)1e18 + 7;

const int dx[] = {-1, 0, 1, 0, 1, -1, -1, 1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int kx[] = {-1,1,2,2,1,-1,-2,-2};
const int ky[] = {2,2,1,-1,-2,-2,-1,1};

int h[100007];
vector< vector<int> > g;
void add(int i, int j) {
	g[i].push_back(j);
	g[j].push_back(i);
}
int main() { 
	int ans = 0;
	int n, m; cin>> n >> m;
	for (int i = 1; i <= n; i++) {
		cin >> h[i];
	}
	g.resize(N);
	for (int i = 1; i <= m; i++) {
		int a, b;
		cin>> a >> b;
		add(a,b);
	}
	
	for (int i = 1; i <= n; i++) {
		bool ok = true;
		for (int j = 0; j < (int)g[i].size(); j++) {
			if (h[i] <= h[g[i][j]])
				ok  = false;
		}
		if (ok)
			ans++;
	}
	cout<<ans;
	return 0;
} 




Measured memory_bytes: 8744
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <stdlib.h>
#include <math.h>
#include <string>
#include <time.h>
#include <string.h>
#include <queue>
#include <stack>
using namespace std;
typedef long long int ll;
ll dp[111][300][111];
ll n, t;
ll a[300];
ll ans=0;
ll mod=1e9+7;
ll fact[111];
int main(void)
{
	cin>>n>>t;
	ll i, j, k;
	for(i=1 ; i<=n ; i++)
	{
		cin>>a[i];
	}
	fact[0]=1;
	fact[1]=1;
	for(i=2 ; i<=110 ; i++)
	{
		fact[i]=(i*fact[i-1])%mod;
	}
	dp[0][0][0]=1;
	for(i=1 ; i<=n ; i++)
	{
		for(j=0 ; j<=255 ; j++)
		{
			for(k=0 ; k<=i-1 ; k++)
			{
				dp[i][j^a[i]][k+1]+=dp[i-1][j][k];
				dp[i][j^a[i]][k+1]=dp[i][j^a[i]][k+1]%mod;
				dp[i][j][k]+=dp[i-1][j][k];
				dp[i][j][k]=dp[i][j][k]%mod;
			}
		}
	}
	for(k=0 ; k<=n ; k++)
	{
		ll add=dp[n][t][k];
		for(ll u=1 ; u<=k ; u++)
		{
			add=(add*u)%mod;	
		}
		ans=(ans+add)%mod;
	}
	cout<<ans;
	cout<<endl;
}

Measured memory_bytes: 22784
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
	string s;
	cin>>s;
	int a,b,c,d;
	a = s[0]-'0';
	b = s[1]-'0';
	c = s[2]-'0';
	d = s[3]-'0';
	if(a+b+c+d == 7){printf("%d+%d+%d+%d=7\n", a,b,c,d); return 0;}
	if(a+b+c-d == 7){printf("%d+%d+%d-%d=7\n", a,b,c,d); return 0;}
	if(a+b-c+d == 7){printf("%d+%d-%d+%d=7\n", a,b,c,d); return 0;}
	if(a+b-c-d == 7){printf("%d+%d-%d-%d=7\n", a,b,c,d); return 0;}
	if(a-b+c+d == 7){printf("%d-%d+%d+%d=7\n", a,b,c,d); return 0;}
	if(a-b+c-d == 7){printf("%d-%d+%d-%d=7\n", a,b,c,d); return 0;}
	if(a-b-c+d == 7){printf("%d-%d-%d+%d=7\n", a,b,c,d); return 0;}
	if(a-b-c-d == 7){printf("%d-%d-%d-%d=7\n", a,b,c,d); return 0;}
	return 0;
}

Measured memory_bytes: 256
// inputに入力データ全体が入る
function Main(input) {
  var ans = 0
  // 1行目がinput[0], 2行目がinput[1], …に入る
  input = input.trim().split("\n");
  var [N, D] = input[0].split(" ").map((n) => parseInt(n));
  var d = input.slice(1)
  for (i = 0; i < d.length; i++) {
    let tmp = d[i].split(" ").map((n) => parseInt(n))
    if (Math.sqrt((tmp[0] * tmp[0]) + (tmp[1] * tmp[1])) <= D ) {
      ans++
    }
  }

  console.log(ans)

}
// *この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
// Main(require("fs").readFileSync("./input.txt", "utf-8"));


Measured memory_bytes: 63656
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
#include<ctime>
#define maxn 500010
using namespace std;
int n,k;
int a[maxn];
int t[maxn];
void file(){
	freopen("permutation.in","r",stdin);
	freopen("permutation.out","w",stdout);
}
int tr[maxn<<2];
struct node{
	int v,nxt;
}e[maxn<<2];
int head[maxn],cnt;
void add(int u,int v){
	e[++cnt].v=v;e[cnt].nxt=head[u];head[u]=cnt;
}
int in[maxn];
void pushup(int u){
	tr[u]=max(tr[u<<1],tr[u<<1|1]);
}
void insert(int u,int l,int r,int val,int pos){
	if(l==r){
		tr[u]=val;return ;
	}
	int mid=(l+r)>>1;
	if(pos<=mid)insert(u<<1,l,mid,val,pos);
	else insert(u<<1|1,mid+1,r,val,pos);
	pushup(u);
}
int query(int u,int l,int r,int ql,int qr){
	if(ql<=l && qr>=r)return tr[u];
	int mid=(l+r)>>1;
	int res=0;
	if(ql<=mid)res=max(res,query(u<<1,l,mid,ql,qr));
	if(qr>mid)res=max(res,query(u<<1|1,mid+1,r,ql,qr));
	return res;
}
priority_queue<int, vector<int>, greater<int> >q;
int ans[maxn];
void gettop(){
	for(int i=1;i<=n;i++)if(in[i]==0)q.push(i);
	for(int i=1;i<=n;i++){
		if(q.empty())return ;
		int u=q.top();q.pop();
		ans[i]=u;
		for(int j=head[u];j;j=e[j].nxt){
			int v=e[j].v;
			in[v]--;
			if(in[v]==0)q.push(v);
		}
	}
}
inline int read(){
	int x=0,f=1;char ch=0;
	while(ch<'0' || ch>'9'){
		if(ch=='-')f=-1;ch=getchar();
	}
	while(ch>='0' && ch<='9'){
		x=(x<<3)+(x<<1)+ch-'0';ch=getchar();
	}
	return x*f;
}
int main(){
	//file();
	n=read();k=read();
	for(int i=1;i<=n;i++){
		a[i]=read();
		t[a[i]]=i;
	}
//	cerr<<clock()/1000<<endl;
	for(int i=1;i<=n;i++){//printf("*\n");
		int pos=query(1,1,n,t[i]+1,t[i]+k-1);
		insert(1,1,n,i,t[i]);
		add(t[pos],t[i]);
		if(pos!=0 && t[pos]!=0){
			in[t[i]]++;
		}
	}
//	cerr<<clock()/1000<<endl;
	gettop();
//	cerr<<clock()/1000<<endl;
	for(int i=1;i<=n;i++){
		a[ans[i]]=i;
	}
	for(int i=1;i<=n;i++)printf("%d\n",a[i]);
//	cerr<<clock()/1000<<endl;
	return 0;
}

Measured memory_bytes: 26480
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define DEB2(X) cout<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define DEB2(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
//typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define NP(X,Y) next_permutation(X,Y)
#define setdouble(X,Y) cout<<fixed<<setprecision(X)<<Y
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

string S;

signed main(){
	cin>>S;
	int M=0;
	if(S=="RRR"){
		cout<<3<<endl;
	}
	else if(S.substr(0,2)=="RR"||S.substr(1,2)=="RR"){
		cout<<2<<endl;
	}
	else if(S[0]=='R'||S[1]=='R'||S[2]=='R'){
		cout<<1<<endl;
	}
	else{
		cout<<0<<endl;
	}
	return 0;
}


Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
const long long INF = 1LL << 60;

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

	int ans = min(a*n, b);

	cout << ans << endl;


	return 0;
}

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

using namespace std;

long long x[26];

int main() {
	string s;
	cin >> s;
	long long n = s.size(), ans = n * (n - 1) / 2 + 1;
	for (char c : s)
		x[c - 'a']++;
	for (int i = 0; i < 26; i++)
		ans -= x[i] * (x[i]- 1) / 2;
	cout << ans << '\n';
}

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

int main(void){
  long int a, b, x, y, ans;

  cin >> a >> b >> x;

  ans = (long int)(b / x) + 1;
  if (a != 0) ans -= (long int)((a - 1) / x) + 1;

  cout << ans << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MOD 1000000007
using namespace std; 
typedef long long ll;
//Have your way LORD (YAH-WEH)
ll vis[1000001];
int main(){
	
	ll n; cin>>n;
	ll co = 0;
	
	for(int i = 1; i < n; i++){
		if(!vis[n-i] && !vis[i] && i != n-i) {
			vis[n-i] = 1;
			vis[i] = 1;
			co++;
			//cout<<n-i<<" "<<i<<"\n";
		}
	}
	cout<<co<<"\n";
	
	
	
}


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

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] first = br.readLine().split(" ", 2);
        int n = Integer.parseInt(first[0]);
        int m = Integer.parseInt(first[1]);
        HashSet<Integer>[] orgGraph = new HashSet[n + 1];
        for (int i = 1; i <= n; i++) {
            orgGraph[i] = new HashSet<>();
        }
        for (int i = 0; i < m; i++) {
            String[] line = br.readLine().split(" ", 2);
            int a = Integer.parseInt(line[0]);
            int b = Integer.parseInt(line[1]);
            orgGraph[a].add(b);
        }
        boolean[][] cost = new boolean[3][n + 1];
        ArrayDeque<Integer> deq = new ArrayDeque<>();
        ArrayDeque<Integer> next = new ArrayDeque<>();
        String[] last = br.readLine().split(" ", 2);
        int s = Integer.parseInt(last[0]);
        int t = Integer.parseInt(last[1]);
        deq.add(s);
        int idx = 0;
        while (deq.size() > 0) {
            while (deq.size() > 0) {
                int x = deq.poll();
                if (x == t && idx % 3 == 0) {
                    System.out.println(idx / 3);
                    return;
                }
                if (cost[idx % 3][x]) {
                    continue;
                }
                cost[idx % 3][x] = true;
                next.addAll(orgGraph[x]);
            }
            ArrayDeque<Integer> tmp = next;
            next = deq;
            deq = tmp;
            idx++;
        }
        System.out.println(-1);
    }
}

Measured memory_bytes: 80908
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
#include <stack>
#include <iomanip>
#include <limits>
using namespace std;
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
using Graph=vector<vector<int>>;
using edge= struct{int to;ll cost;};
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;}
typedef priority_queue<ll> PQ_HIGH;
typedef priority_queue<ll,VL,greater<ll>> PQ_LOW;//昇順

void test(priority_queue<pair<ll,ll>> que){
  while(!que.empty()){
    cout<<que.top().first<<" "<<que.top().second<<endl;
    que.pop();
  }
}

int main(){
  ll k;cin>>k;
  queue<ll> a;
  for(int i=1;i<10;i++){
    a.push(i);
  }
  ll top=1;
  for(int i=0;i<k;i++){
    top=a.front();
    a.pop();
    if(top%10==0){
      ll tmp1=top*10;
      ll tmp2=top*10+1;
      a.push(tmp1);
      a.push(tmp2);
    }
    else if(top%10==9){
      ll tmp1=top*10+8;
      ll tmp2=top*10+9;
      a.push(tmp1);
      a.push(tmp2);
    }
    else{
      ll tmp1=top*10+top%10-1;
      ll tmp2=top*10+top%10;
      ll tmp3=top*10+top%10+1;
      a.push(tmp1);
      a.push(tmp2);
      a.push(tmp3);
    }
  }
  cout<<top<<endl;
}

Measured memory_bytes: 4636
/** 
 *  Author : Parth Prajapati aka (PARTH_4399, hungry_chef)
 * 	Institute : Pandit Deendayal Petroleum University
**/
#include<bits/stdc++.h>

using namespace std; 

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    long long n, sum = 0, i;
    cin>>n;
    for(i=1;i<=n;++i)
    {
        if(i%3 != 0 && i%5 != 0)
            sum += i;
    }
    cout<<sum;
	return 0;
}

Measured memory_bytes: 3652
def resolve():
    H, W = [int(i) for i in input().split()]
    if min(H, W) == 1:
        print(1)
    elif (H * W) % 2 == 0:
        print(format(H * W // 2, "d"))
    else:
        print(format((H * W // 2) + 1, "d"))


resolve()


Measured memory_bytes: 3188
#include <bits/stdc++.h>
        using namespace std;
        #define int long long
const int MAX = 2000003;
const int MOD = 1000000007;

//
int fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
int COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

        signed main() {
    cout<<fixed<<setprecision(15);
        int n;
        cin>>n;
        string s[n];
        for(int i=0;i<n;i++)cin>>s[i];
        sort(s,s+n);
        int a[n],amax=0;
        a[0]=1;amax=1;
        for(int i=1;i<n;i++){
                if(s[i-1]==s[i]){
                        a[i]=a[i-1]+1;
                        
                }else a[i]=1;
                amax=max(amax,a[i]);
        }
        for(int i=0;i<n;i++){
                if(amax==a[i])cout<<s[i]<<endl;
        }
        }


Measured memory_bytes: 15872
#include<bits/stdc++.h>
    using namespace std;
    int main()
    {
      string a,b,c;
      cin>>a>>b>>c;
      int a1=a.length();
      int b1=b.length();
      if(a[a1-1]==b[0] && b[b1-1]==c[0])
        cout<<"YES"<<endl;
      else
        cout<<"NO"<<endl;
      return 0;
    }

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

void solve(int n){
    vector<string> vs(n);
    for(int i=0;i<n;i++) cin >> vs[i];

    for(int i=0;i<n;i++){
        int idx=i;
        bool ok = true;
        //5 [i,idx]
        int sum = 0;
        for(int j=i;j<n;j++){
            sum += vs[j].size();
            if(sum > 5){
                ok = false;
                break;
            }
            if(sum == 5){
                idx = j;
                break;
            }
        }
        if(!ok){
            //cout << i << " 1 " << endl;
            continue; }
        idx++;
        ///cerr << "idx " << idx << endl;
        //7
        sum = 0;
        for(int j=idx;j<n;j++){
            sum += vs[j].size();
            if(sum > 7){
                ok = false;
                break;
            }
            if(sum == 7){
                idx = j;
                break;
            }
        }
        if(!ok){
            //cout << i << " 2" << endl;
            continue; }
        idx++;

        //cerr << "idx " << idx << endl;
        //5
        sum = 0;
        for(int j=idx;j<n;j++){
            sum += vs[j].size();
            if(sum > 5){
                ok = false;
                break;
            }
            if(sum == 5){
                idx = j;
                break;
            }
        }
        if(!ok){
            //cout << i << " 3" << endl;
            continue; }
        idx++;

        //7
        sum = 0;
        for(int j=idx;j<n;j++){
            sum += vs[j].size();
            if(sum > 7){
                ok = false;
                break;
            }
            if(sum == 7){
                idx = j;
                break;
            }
        }
        if(!ok){
            //cout << i << " 4" << endl;
            continue; }
        idx++;
        //7
        sum = 0;
        //cerr << "idx  " << idx << endl;
        for(int j=idx;j<n;j++){
            sum += vs[j].size();
            if(sum > 7){
                ok = false;
                break;
            }
            if(sum == 7){
                idx = j;
                break;
            }
        }
        if(!ok){
            //cout << i << " 5"<< endl;
            continue; }
        idx++;
        cout << i+1 << endl;
        return;
    }
}

int main(){
    while(1){
        int n;
        cin >> n;
        if(n==0) break;
        solve(n);
    }
}



Measured memory_bytes: 3172
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N=2e5+1;
int a[N];
main()
{
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)cin>>a[i];
    sort(a+1,a+n+1);
    reverse(a+1,a+n+1);
    int ans=0,cnt=0,f=n-1;
    for(int i=2;i<=n;i++){
        ans+=a[i-1];
        cnt++;
        f--;
        if(cnt>=n-i)break;
    }
    for(int i=2;i<=n&&f--;i++)ans+=a[i];
    cout<<ans<<endl;
}


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

int main() {
  string s;
  cin>>s;
  string w[7]={"SUN","MON","TUE","WED","THU","FRI","SAT"};
  rep(i,7) {
    if (w[i]==s) cout<<7-i<<endl;
  }
  return 0;
}



Measured memory_bytes: 256
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().strip()

n = ni()
a = na()
ans = 0
flag = 1
while flag:
    for i in range(len(a)):
        if a[i] % 2 == 0:
            pass
        else:
            flag = 0
        a[i] = a[i]/2
    if flag:
        ans += 1
print(ans)


Measured memory_bytes: 3064
#!/usr/bin/env python3
S = input()
bf = '01' * (len(S) // 2) + '0' * (len(S) & 1)
wf = '10' * (len(S) // 2) + '1' * (len(S) & 1)
ans = 10**5
ans = min(ans, [x != y for x, y in zip(S, bf)].count(True))
ans = min(ans, [x != y for x, y in zip(S, wf)].count(True))
print(ans)


Measured memory_bytes: 4212
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define rep(i,n) for(int i=0; i<n; i++)
#define pb(a) push_back(a)
#define mp make_pair

int main()
{
  string s,t;
  int a,b;
  string u;

  cin >> s >> t;
  cin >> a >> b;
  cin >> u;

  if(s == u) a--;
  if(t == u) b--;

  cout << a << " " << b << endl;

  return 0;
}

Measured memory_bytes: 256
n = int(input())
zoro_flag = "000"
ans = False
for i in range(n):
    zoro_flag = zoro_flag[1:]
    d1, d2 = input().split()
    if d1 == d2:
        zoro_flag += "1"
        if zoro_flag == "111":
            ans = True
    else:
        zoro_flag += "0"
print("Yes") if ans else print("No")

Measured memory_bytes: 9176
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
int main()
{
    int N,H,W;
    cin>> N>>H>>W;

    int ans=(N-H+1)*(N-W+1);

    cout << ans << endl;

   return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#define MAX (1000)

int main(void) {
    int i, n;
    double sum, avg, sd, s[MAX];
    while(scanf("%d", &n), n) {
        sum = sd = 0;
        for(i = 0; i < n; i++) {
            scanf("%lf", &s[i]);
            sum += s[i];
        }
        avg = sum / n;
        for(i = 0; i < n; i++) {
            sd += pow((s[i] - avg), 2);
        }
        printf("%f\n", sqrt(sd / n));
    }
    return 0;
}

Measured memory_bytes: 664
H, W = map(int, input().split())
a = [list(input()) for i in range(H)]

#print(a)

while 1:
  h, w = [0, 0]
  hl = []
  for i in range(len(a)):
    w = 0
    for j in range(len(a[0])):
      #print(i, j, a[i][j])
      if a[i][j] != '.':
        w += 1
    #print(w)
        
    if w == 0:
      hl.append(i)
      
  hl.sort(reverse = True)
  for i in hl:
    del a[i]
    
  wl = []
  for i in range(len(a[0])):
    h = 0
    for j in range(len(a)):
      if a[j][i] != '.':
        h += 1
    #print(h)
        
    if h == 0:
      wl.append(i)
      
  wl.sort(reverse = True)
  for i in wl:
    for j in range(len(a)):
      del a[j][i]
        
  if h != 0 and w != 0:
    break
    
for i in range(len(a)):
  print(''.join(a[i]))

Measured memory_bytes: 9152
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
int main()
{
   
   
        
     ll x,y;
     cin>>x>>y;
     ll a=y-2*x;
     ll a1=a/2;
     ll b1=x-a1;
     if(a%2!=0||a1<0||b1<0)
        {cout<<"No";return 0;}
     if(a1+b1==x&&4*a1+2*b1==y)
     cout<<"Yes";
     else
        cout<<"No";
     
	return 0;
}

Measured memory_bytes: 3628
#include <stdio.h>
#include <math.h>
#include <string.h>
#define pai 3.1415926535

int main(void) {
	char s[200000];
	scanf("%s", s);
	
	int maxz = 0;
	int mina = 200000;
	for (int i = 0; i < strlen(s); i++) {
		if (s[i] == 'A'&&mina>i) {
			mina = i;
		}
		if (s[i] == 'Z'&&maxz<i) {

			maxz = i;
		}
	}
	printf("%d", maxz - mina+1);


	return 0;

}

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
const ll INF = 1 << 29;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll N;
    cin >> N;

    ll ans = INF;
    for(ll i = 1; i * i <= N; ++i){
        if(N % i == 0){
            ll m = N / i;
            ll a = max(i, m);
            ll b = 1;
            while(a >= 10){
                a /= 10;
                ++b;
            }
            ans = min(ans, b);
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
n, x = gets.split.map(&:to_i)
arr = gets.split.map(&:to_i)

count = 0

(n - 1).times do |i| #0からn-1まで回
    next if arr[i] + arr[i + 1] <= x
    y = arr[i] + arr[i + 1] - x
    count += y
    arr[i + 1] = [0, arr[i + 1] - y].max
end

p count

Measured memory_bytes: 11140
#include<bits/stdc++.h>
using namespace std;
typedef struct node
{
	int a[51][51];
	int scale;
	struct node operator *(const struct node & tmp)
	{
		struct node ret;
		int i,j,k;
		ret.scale=scale;
		memset(ret.a,0,sizeof(ret.a));
		for(k=1;k<=scale;k++)
			for(i=1;i<=scale;i++)
				for(j=1;j<=scale;j++)
					if(a[i][k]&&tmp.a[k][j])
						ret.a[i][j]=(ret.a[i][j]+(long long)a[i][k]*tmp.a[k][j])%1000000007;
		return ret;
	}
}NODE,*PNODE;
NODE g,ans;
int main()
{
	long long n,k,i,j,answer=0,flag=0;
	scanf("%d %lld",&n,&k);
	g.scale=n;
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=n;j++)
		{
			scanf("%d",&g.a[i][j]);
		}
	}
	while(k)
	{
		if(k%2)
		{
			if(!flag)
			{
				ans=g;
				flag=1;	
			}
			else
				ans=ans*g;
		}
		g=g*g;
		k/=2;
	}
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=n;j++)
		{
			answer=(answer+ans.a[i][j])%1000000007;
		}
	}
	printf("%lld",answer);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define mfill(x,y) memset(x,y,sizeof(x))
#define all(v) v.begin(), v.end()
#define in(x,y,h,w) if(0<=x&&x<h&&0<=y&&y<w)
#define y0 y12345
#define y1 y54321

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

using ul = unsigned long;
using ll = long long;
using P = pair<int, int>;
using vint = vector<int>;using vvint = vector<vector<int>>;
using vll = vector<ll>;using vvll = vector<vector<ll>>;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a, const T &b){if(a>b){a=b;return 1;}return 0;}
template <class T>void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}
template <class T>T gcd(T &a, T &b){if(a<b){swap(a,b);} T r = a%b; while(r!=0){a=b;b=r;r=a%b;} return b;}

vint dx = {-1, 0, 1, 0}, dy = {0, -1, 0, 1};
vint dx8 = {-1, -1, -1, 0, 1, 1, 1, 0}, dy8 = {-1, 0, 1, 1, 1, 0, -1, -1};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    debug("debug test\n");
    int n,m;cin>>n;
    vint b(n-1);
    rep(i, n-1){
        cin>>b[i];
        
    }
    int ans = 0;
    rep(i, n){
        if(i==0){
            ans += b[0];
        }else if(i==n-1){
            ans += b[n-2];
        }else{
            ans += min(b[i-1], b[i]);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>


int main(){
	char S[25];
	char T[25];
	char U[25];
	int A;
	int B;
	
	scanf ("%s %s",&S,&T);
	scanf("%d %d",&A,&B);
	scanf("%s",&U);
	
	if (strcmp(S,U) ==0){
		A--;
		printf("%d %d",A,B);
		
	}
	else if (strcmp(T,U) ==0){
		
		B--;
		printf("%d %d",A,B);
	}
	
	
	return 0;
}

Measured memory_bytes: 3120
#include<stdio.h>
#include<string.h>
char s[10000];
int i;
int n,m;
char ns[3];

int main(){
	while(scanf("%s",s)!=EOF){
		n=0;m=0;
		for(i=0;i+2<strlen(s);i++){
			ns[0]=s[i];
			ns[1]=s[i+1];
			ns[2]=s[i+2];
			if(strcmp(ns,"JOI")==0)n++;
			if(strcmp(ns,"IOI")==0)m++;
		}
		printf("%d\n%d\n",n,m);
	}
	return 0;
}

Measured memory_bytes: 976
import java.util.*;
public class Main {
	public static void main(String[] args){
       Scanner sc = new Scanner(System.in);
      
      // 整数の取得
	  int N = sc.nextInt();
      int count = 1;
      
      for(int i=0;i<3;i++){
        count = count*N;
      }
      System.out.println(count);
    }
}

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

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

  bool flag = true;
  for(int i=0;i<3;i++){
    if(S.at(i) == S.at(i+1)){
      flag = false;
      break;
    }
  }
  if(flag){
    cout<<"Good"<<endl;
  }else{
    cout<<"Bad"<<endl;
  }
}


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

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define mt(p, q, r) make_tuple(p, q, r)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<ll> vll;
typedef vector<ld> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<vector<ll>> vvll;
typedef vector<vector<ld>> vvd;
typedef vector<vector<bool>> vvb;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;
typedef vector<pair<ll, ll>> vpll;
typedef vector<tuple<ll, ll, ll>> vtlll;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

template <typename T>
void fin(T a)
{
  cout << a << endl;
  exit(0);
}

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

//実行部
void Main()
{
  ll n; cin >> n;
  fin(n / 3);
}

//前処理
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  Main();
  return 0;
}

/*
//test時
  g++ test.cpp -o test;./test
*/


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int A = scan.nextInt();
        int answer = N * N - A;
        System.out.println(answer);
    }
}


Measured memory_bytes: 21844
#include <iostream>
#include <string>
#include <algorithm>
#include <climits>
#include <unordered_map>
#include <vector>
using namespace std;

string abc="abcdefghijklmnopqrstuvwxyz";

int main() {
  long N, M;
  cin >> N >> M;
  
  int p[M];
  string S[M];
  for (int i = 0; i < M; i++) {
    cin >> p[i] >> S[i];
  }
  
  unordered_map<long, long> WAs;
  unordered_map<long, long> ACs;
  
  for (int i = 0; i < M; i++) {
      if( S[i] == "AC" ) {
        ACs[p[i]]++;
      }
      if( S[i] == "WA" ) {
        if(ACs[p[i]] == 0){
          WAs[p[i]]++;
        }
      }
  }
  
  long acNum = 0;
  long pena = 0;
  for (auto ac: ACs) {
    if( ac.second > 0 ){
      acNum++;
      pena += WAs[ac.first];
    }
  }
    
  cout << acNum << " " << pena << endl;
  return 0;
}


Measured memory_bytes: 14372
#include <bits/stdc++.h>
using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define inf 100000000
#define _GLIBCXX_DEBUG
typedef long long ll;
typedef double db;
typedef string str;
// head

int main(){
    const int  H=80,W=80,K=12900;
    int h,w;
    cin>>h>>w;
    int A[H][W],B[H][W];
    rep(i,h) rep(j,w) cin >> A[i][j];
    rep(i,h) rep(j,w) cin >> B[i][j];
    // int K=12900;
    int d;
    bool dp[H][W][K];
    dp[0][0][abs(A[0][0]-B[0][0])] = true;
    rep(i,h){
        rep(j,w){
            d=abs(A[i][j]-B[i][j]);
            if (i-1>=0){
                rep(k,K){
                    if (dp[i-1][j][k]){
                        dp[i][j][k+d]=1;
                        dp[i][j][abs(k-d)]=1;

                    }
                }
            }
            if (j-1>=0){
                rep(k,K){
                    if (dp[i][j-1][k]){
                        dp[i][j][k+d]=1;
                        dp[i][j][abs(k-d)]=1;

                    }
                }
            }
        }
    }
    rep(k,K){
        if (dp[h-1][w-1][k]){
            cout << k;
            return 0;
        }
    }




}

Measured memory_bytes: 80896
object Main extends App {
	val pw = new java.io.PrintWriter(System.out)

	@scala.annotation.tailrec
	def loop(start: Int, end: Int)(f: Int => Unit): Unit =
		if (start < end) {
			f(start)
			loop(start + 1, end)(f)
		}

	val n, m = Scanner.nextInt

	val connected = Array.fill(n)(Vector[Int]())
	loop(0, m) { _ =>
		val a, b = Scanner.nextInt - 1
		connected(a) = connected(a) :+ b
		connected(b) = connected(b) :+ a
	}

	val visited = Array.fill(n)(false)
	val mark		= Array.fill(n)(-1)
	val queue		= scala.collection.mutable.Queue(0)

	while (queue.nonEmpty) {
		val q = queue.dequeue()
		visited(q) = true
		connected(q).filter{ v => !visited(v) && mark(v) == -1 } foreach { v =>
			mark(v) = q
			queue.enqueue(v)
		}
	}

	pw.println("Yes")
	loop(1, n) { i => pw.println(mark(i) + 1) }
	pw.flush()
}

object Scanner {
	private val buf = new Array[Byte](1024); private var ptr = 0; private var len = 0

	@inline private def isPrintableChar(c: Int): Boolean = 33 <= c && c <= 126
	@inline private def hasNextByte(): Boolean = if (ptr >= len) { ptr = 0; len = System.in.read(buf); len > 0 } else true
	@inline private def hasNext(): Boolean = {
		while (hasNextByte() && !isPrintableChar(buf(ptr))) ptr += 1
		hasNextByte()
	}
	@inline private def readByte(): Byte = if (hasNextByte()) { val res = buf(ptr); ptr += 1; res } else -1

	def next(): String = {
		if(!hasNext()) ???
		val sb = new StringBuilder; var b = readByte()
		while (isPrintableChar(b)) { sb.append(b.toChar); b = readByte() }
		sb.toString
	}

	def nextInt(): Int = {
		val n = nextLong()
		if (n < Int.MinValue || Int.MaxValue < n) ???
		n.toInt
	}

	def nextLong(): Long = {
		if(!hasNext()) ???
		var minus = false; var b = readByte()
		if (b == '-') { minus = true; b = readByte() }

		@scala.annotation.tailrec
		def go (b: Byte, n: Long = 0): Long = if ('0' <= b && b <= '9') go(readByte(), n * 10 + b - '0') else if (minus) -n else n

		go(b)
	}

	def nextDouble(): Double = next().toDouble
}


Measured memory_bytes: 88216
#include <stdio.h>
#include <stdbool.h>

void Read(int* sec);
int CalcHour(int sec, int* res);
int CalcMinute(int sec, int* res);
void Write(int h, int m, int s);
bool RangeCheck(int sec);

int main()
{
    int hour, minute, sec;
    hour = minute = sec = 0;

    Read(&sec);

    if (!RangeCheck(sec)) {
        return -1;
    }

    sec = CalcHour(sec, &hour);

    sec = CalcMinute(sec, &minute);

    Write(hour, minute, sec);

    return 0;
}

void Read(int* sec)
{
    scanf("%d", sec);
}

int CalcHour(int sec, int* res)
{
    *res = sec / 3600;
    return sec % 3600;
}

int CalcMinute(int sec, int* res)
{
    *res = sec / 60;
    return sec % 60;
}

void Write(int h, int m, int s)
{
    printf("%d:%d:%d\n", h, m, s);
}

bool RangeCheck(int sec)
{
    return (0 <= sec) && (sec <= 86400) ? true : false;
}



Measured memory_bytes: 2728
#include <bits/stdc++.h>
#include <boost/math/constants/constants.hpp>
using namespace std;
typedef long long ll;
long double e = boost::math::constants::e<long double>();
long double pi = boost::math::constants::pi<long double>();
// 条件を見落としていませんか？
int N;
set<string> ans;
void solve(char c, string s) {
    if (s.size() == N) {
        ans.insert(s);
        return;
    }
    char d = c+1;
    solve(d, s+d);
    for (char i = 'a'; i <= c; i++) {
        solve(c, s+i);
    }
}
int main () {
    cin >> N;
    solve('a', "a");
    for (auto x: ans) {
        cout << x << endl;
    }
}

Measured memory_bytes: 12416
#include<stdio.h>

int main()
{
	int W, H, x, y ,r;
	scanf("%d %d %d %d %d" ,&W ,&H ,&x ,&y ,&r);
	if (r <= (W - x) && r <= x && r <=(H - y) && r <= y ) printf("Yes\n");
	else printf("No\n");

	return 0;
}

Measured memory_bytes: 584
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <cstring>
using namespace std;

int main(int argc, char *argv[])
{
	int x, a, b;
	cin >> x >> a >> b;

	if (a >= b)
		cout << "delicious";
	else if (a + x < b)
		cout << "dangerous";
	else
		cout << "safe";

	cout << endl;
	
	return 0;
}


Measured memory_bytes: 256
s = input().split()
N = int(s[0])
M = int(s[1])
 
AB = {}
for i in range(N):
  data = input().split()
  if int(data[0]) in AB.keys():
    AB[int(data[0])] += int(data[1])
  else:
    AB[int(data[0])] = int(data[1])
AB = sorted(AB.items())
money = 0
num = 0
for A,B in AB:
  for b in range(B):
    num += 1
    money += A
    if num == M:
      break
      
  if num == M:
    break
  
print(int(money))

Measured memory_bytes: 23004
#include<iostream>
#include <bits/stdc++.h>
#include<vector>
using namespace std;
int main()
{
    string s;
    cin>>s;
    if(s[2]==s[3] && s[4]==s[5])
    cout<<"Yes"<<endl;
    else
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string.h>

using namespace std;

int N[210000];
long long ans,n;

bool mtime()
{
    for(int i=1; i<n; i++)
    {
        if(N[i]-N[i-1]>1||N[i]>i)
            return true;
    }
    return false;
}

int main()
{
    cin>>n;
    for(int i=0; i<n; i++)
    {
        cin>>N[i];
    }
    if(N[0]!=0||mtime())
    {
        cout<<-1<<endl;
        return 0;
    }
    ans=0;
    ans+=N[n-1];
    for(int i=n-2; i>0; i--)
    {
        if(N[i]-N[i+1]>-1)
            ans+=N[i];
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1024
# AtCoder
N = int(input())
dp = [float('inf')]*100010
dp[0] = 0

for i in range(1, N+1):
    power = 1
    while power <= i:
        dp[i] = min(dp[i], dp[i-power]+1)
        power *= 6

    power = 1
    while power <= i:
        dp[i] = min(dp[i], dp[i-power]+1)
        power *= 9

print(dp[N])


Measured memory_bytes: 3828
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main (){
    int N,a[1000],A=0,B=0;
    cin >> N;
    for (int i = 0;i<1000;i++){
        a[i]=0;
    }
    for (int i = 0;i<N;i++){
        cin >> a[i];
    }
    sort(a,a+1000);
    for (int i = 999;i>=0;i--){
        if(i%2==1){
            A+=a[i];
        }else{
            B+=a[i];
        }
    }
    cout << A-B ;
    return 0;
}

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

using namespace std;

typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define debug(a) cout << #a << ": " << a << endl;

int main() {
  ll N, A, B, C, D, E;
  cin >> N >> A >> B >> C >> D >> E;

  ll minNum = min({A, B, C, D, E});
  ll quotient = N / minNum;
  if (N % minNum != 0)
    quotient++;
  cout << 4 + quotient << endl;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"log"
	"math"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)
var buff []byte

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buff, bufio.MaxScanTokenSize*1024)
	log.SetFlags(log.Lshortfile)
}

func main() {
	n := nextInt()
	k := nextInt()
	snuk := make([]int, n)
	for i := 0; i < k; i++ {
		d := nextInt()
		for j := 0; j < d; j++ {
			a := nextInt() - 1
			snuk[a]++
		}
	}
	cnt := 0
	for i := 0; i < n; i++ {
		if snuk[i] == 0 {
			cnt++
		}
	}
	fmt.Println(cnt)
}

func nextString() string {
	sc.Scan()
	return sc.Text()
}

func nextFloat64() float64 {
	sc.Scan()
	f, err := strconv.ParseFloat(sc.Text(), 64)
	if err != nil {
		panic(err)
	}
	return f
}

func nextInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func nextInts(n int) (r []int) {
	r = make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt()
	}
	return r
}

var dy = []int{0, 1, 0, -1}
var dx = []int{1, 0, -1, 0}
var MAX = math.MaxInt32

func pow(a, b int) int {
	return int(math.Pow(float64(a), float64(b)))
}

func lcm(a, b int) int {
	return a * b / gcd(a, b)
}
func gcd(a, b int) int {
	if a < b {
		a, b = b, a
	}
	for b != 0 {
		a, b = b, a%b
	}
	return a
}
func max(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}
func min(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}
func sum(a []int) (r int) {
	for i := range a {
		r += a[i]
	}
	return r
}
func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

type Pair struct {
	a, b int
}

type Pairs []Pair

func (p Pairs) Len() int {
	return len(p)
}
func (p Pairs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p Pairs) Less(i, j int) bool {
	if p[i].a == p[j].a {
		return p[i].b < p[j].b
	}
	return p[i].a < p[j].a
}


Measured memory_bytes: 1760