akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pqueue priority_queue
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N;
  cin>>N;
  vector<ll> A(N);
  for(int i=0;i<N;++i) cin>>A[i];
  sort(A.begin(), A.end());
  int ans = N;
  ll now = A[0];
  for(int i=1;i<N;++i) {
    if(now*2<A[i]) {
      ans = N-i;
    }
    now += A[i];
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 4056
#include <algorithm>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <time.h>
#include <vector>

using namespace std;

#define ll long long
#define ld long double

struct Node {
    int num;
    long double dist;
    bool operator<(const Node &right) const {
        return dist >= right.dist;
    }
    Node(int n, long double d) {
        num = n;
        dist = d;
    }
};

long double d(int ax, int ay, int bx, int by) {
    return sqrt((long double)(ax - bx) * (long double)(ax - bx) +
                (long double)(ay - by) * (long double)(ay - by));
}

int main() {
    int Xs, Ys, Xt, Yt;
    cin >> Xs >> Ys >> Xt >> Yt;
    int N;
    cin >> N;
    vector<int> x(N + 2), y(N + 2), r(N + 2);
    for (int i = 0; i < N; i++) {
        cin >> x[i + 1] >> y[i + 1] >> r[i + 1];
    }
    x[0] = Xs;
    y[0] = Ys;
    r[0] = 0;
    x[N + 1] = Xt;
    y[N + 1] = Yt;
    r[N + 1] = 0;
    vector<bool> ch(N + 2);
    vector<long double> dist(N + 2);
    for (int i = 0; i < N + 2; i++) {
        ch[i] = false;
        dist[i] = 1e18;
    }
    dist[0] = 0;
    priority_queue<Node> pq;
    pq.push(Node(0, 0));
    while (pq.size() > 0) {
        Node n = pq.top();
        pq.pop();
        int this_num = n.num;
        long double this_dist = n.dist;
        if (ch[this_num])
            continue;

        ch[this_num] = true;

        for (int i = 0; i < N + 2; i++) {
            if (ch[i])
                continue;

            long double dd = d(x[this_num], y[this_num], x[i], y[i]);
            long double next_dist =
                this_dist +
                max((long double)0, dd - (long double)(r[this_num] + r[i]));

            if (dist[i] > next_dist) {
                dist[i] = next_dist;
                pq.push(Node(i, next_dist));
            }
        }
    }
    // for (long double longd : dist) {
    //    cout << longd << endl;
    //}
    cout << fixed << setprecision(10) << dist[N + 1] << endl;
    return 0;
}


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

#define rep(i,n) for(int i=0; i<n; i++)
#define all(x) (x).begin(),(x).end()
#define INF (1000000000)
#define MOD (1000000007)


int main(){
  int n,m;
  cin >> n >> m;

  vector<ll> a[3];//(x,y,z)を配列のベクトルで管理
  rep(i,n){
    rep(j,3){
      ll num;
      cin >> num;
      a[j].push_back(num);
    }
  }

  ll ans=0;
  rep(bit,1<<3){//1000=8通り
    vector<ll> b;//x+y+z(例)のベクトル
    rep(i,n){
      ll tmp=0;
      rep(j,3){
        if(bit & 1<<j) tmp += a[j][i];
        else tmp -= a[j][i];
        //xは0番目、yは1番目、zは2番目のビットが立っていたら足す　そうでなければ引く
      }
      b.push_back(tmp);
    }
    sort(all(b));
    reverse(all(b));
    ll sum=0;
    rep(i,m){
      sum += b[i];//合計を計算
    }
    ans = max(ans,sum);//最大値更新
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
int compare_int (const void* a,const void* b) {

  return (*(int*)a-*(int*)b);

}

int main(void) {

  int hand[5];
  
  int overlap[5];
  int used[5];

  int count;
  int full_or_three=-1;
  int two_or_one=-1;
  int temp;
  int i,j,k,l,m=0;

  char c;

  while(scanf("%d,%d,%d,%d,%d",&hand[0],&hand[1],&hand[2],&hand[3],&hand[4])!=EOF) {

    //sort current hand
    qsort(hand,sizeof(hand)/sizeof(hand[0]),sizeof(int),compare_int);

    //for(i=0;i<5;i++) printf("%d ",hand[i]);
  
    //count overlapped cards
    count=0;

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

      overlap[i]=0;
      used[i]=0;
    }

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

      if(used[i]==1) continue;
    
      for(j=i+1;j<5;j++) {

	if(used[j]==0 && hand[i]==hand[j]) {

	  overlap[count]++;

	  used[i]=used[j]=1;

	}

      }

      used[i]=1;

      count++;

    }

    //for(i=0;i<5;i++) printf("%d ",overlap[i]);

    //check overlapped cards
  
    //four card?
    for(i=0;i<5;i++) {

      if(overlap[i]==3) {

	printf("four card\n");

	goto Terminate;
      
      }

    }

    //full house or three card?
    for(i=0;i<5;i++) {
    
      if(overlap[i]==2) {

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

	  if(overlap[j]==1) {

	    printf("full house\n");

	    goto Terminate;

	  }

	}

	printf("three card\n");

	goto Terminate;

      }

    }

    if(full_or_three==1) {

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

	if(overlap[i]==1) {

	  printf("full house\n");

	  goto Terminate;

	}

	else {

	  printf("three card\n");

	  goto Terminate;

	}

      }

    }

    //straight?
    if(hand[0]+1==hand[1] && hand[1]+1==hand[2] && hand[2]+1==hand[3] && hand[3]+1==hand[4] || (hand[0]==1 && hand[1]==10 && hand[2]==11 && hand[3]==12 && hand[4]==13)) {

      printf("straight\n");

      goto Terminate;

    }

    //two pair or one pair?
    for(i=0;i<4;i++) {

      if(overlap[i]==1) {

	for(j=i+1;j<5;j++) {

	  if(overlap[j]==1) {

	    printf("two pair\n");

	    goto Terminate;

	  }

	}

	printf("one pair\n");

	goto Terminate;

      }

    }

    //null
    printf("null\n");

  Terminate:
    continue;

  }

  return 0;

}

Measured memory_bytes: 0
#include<stdio.h>
int main(){
  char x[1001];
  int temp,i,total,esa;
  while(scanf("%s",x)!=EOF){
    if(x[0]=='0')break;
    total=0;
    temp=strlen(x);
    for(i=0;i<temp;i++){
      esa=x[i]-'0';
      total+=esa;
    }
    printf("%d\n",total);
  }
  return(0);
}
		  

Measured memory_bytes: 536
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k;cin>>n>>k;
  int ans=1;
  for(int i=0;i<n;i++)
  {
    if(ans<k)
      ans*=2;
    else
      ans+=k;
  }
  cout<<ans;
}
    

Measured memory_bytes: 256
x, y = map(int, input().split())


def group(n):
    if n in [1, 3, 5, 7, 8, 10, 12]:
        return 1
    elif n in [4, 6, 9, 11]:
        return 2
    else:
        return 3


print("Yes" if group(x) == group(y) else "No")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;

struct Node {
    int key;
    Node *parent, *lc, *rc;
};

Node *root, *NIL;

void pre(Node *n) { // 先行順巡回
    if (n == NIL) return;
    cout << " " << n->key;
    pre(n->lc);
    pre(n->rc);
}

void in(Node *n) { // 中間順巡回
    if (n == NIL) return;
    in(n->lc);
    cout << " " << n->key;
    in(n->rc);
}

void insert(int k) {
    Node *y = NIL;
    Node *x = root;

    Node *z = (Node *)malloc(sizeof(Node));
    z->key = k;
    z->lc = NIL;
    z->rc = NIL;

    while (x != NIL) {
        y = x;
        if (z->key < x->key) {
            x = x->lc;
        } else {
            x = x->rc;
        }
    }
    z->parent = y;

    if (y == NIL) {
        root = z;
    } else if (z->key < y->key) {
        y->lc = z;
    } else {
        y->rc = z;
    }
}

int main() {
    int n, i;
    cin >> n;

    string op;
    int input;
    rep(i, n) {
        cin >> op;
        if (op == "insert") {
            cin >> input;
            insert(input);
        } else if (op == "print") {
            in(root);
            cout << endl;
            pre(root);
            cout << endl;
        }
    }

    return 0;
}



Measured memory_bytes: 26624
using System;

namespace late
{
    class Program
    {
        static void Main(string[] args)
        {
            int D, T;

            string inD0 = Console.ReadLine();
            string[] cngD0 = inD0.Split(' ');

            D = int.Parse(cngD0[0]);
            T = int.Parse(cngD0[1]);
            float S = int.Parse(cngD0[2]);

            float Proc = D / S;
            if (Proc <= T)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}


Measured memory_bytes: 27480
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD ll(1e9+7)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr<<#x<<": "<<x<<endl

int main(){
    int n;
    cin >> n;
    for(int i = 0; i <= 50000; i++){
        int a = (double)i*1.08;
        if(a==n){
            cout << i << endl;
            return 0;
        }
    }

    cout << ":(" << endl;

    return 0;

}


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

 int main()
 {
	ll a,b;
	scanf("%lld%lld",&a,&b);

	if(a>b) swap(a,b);

	if(b-a<=1) printf("Brown\n");
	else printf("Alice\n");

	return 0;
 }


Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#define llong long long
#define INF (__INT32_MAX__ / 2)
#define EPS 10e-8
#define MAX_T 100000
#define MAX_C 30

using namespace std;
typedef pair<llong, llong> ipair;
llong modulo(llong left, llong right) { return (left % right + right) % right; }

int N, C;
int dif[MAX_C][MAX_T + 1], table[MAX_C][MAX_T + 1];
int main(int argc, char **argv) {
    cin >> N >> C;
    for(int i = 0; i < N; ++i) {
        int s, t, c;
        cin >> s >> t >> c;
        s--, t--, c--;
        dif[c][s]++;
        dif[c][t + 1]--;
    }

    for(int c = 0; c < C; ++c)
        for(int i = 0; i <= MAX_T; ++i) {
            if(i == 0) table[c][i] = dif[c][i];
            else table[c][i] = table[c][i - 1] + dif[c][i];
        }
    
    int res = 0;
    for(int i = 0; i <= MAX_T; ++i) {
        int cur = 0;
        for(int c = 0; c < C; ++c)
            if(table[c][i])
                ++cur;
        res = max(res, cur);
    }
    
    cout << res << endl;
}


Measured memory_bytes: 23680
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
long long int INF = 1001001001001001LL;
int inf = 1000000007;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;

template<typename T1,typename T2>inline void chmin(T1 &a,const T2 &b){if(a>b) a=b;}
template<typename T1,typename T2>inline void chmax(T1 &a,const T2 &b){if(a<b) a=b;}

#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()

/* do your best */

int main() {
  
  lint n, x, m; cin >> n >> x >> m;

  if (n <= 1000000) {

    vector<lint> t(m, -1);
    vector<lint> a(n, -1);

    lint cur = x;
    lint sum = 0;
    for (int i = 0; i < n; i++) {
      sum += cur;
      a[i] = cur;
      t[cur] = i;
      cur = cur * cur % m;
    }

    cout << sum << endl;
    return 0;
  }

  vector<lint> t(m, -1);

  lint cur = x;
  lint T = -1;
  lint val = -1;
  for (int i = 0; i < n; i++) {
    t[cur] = i;
    lint pre = cur;
    cur = cur * cur % m;

    if (t[cur] != -1) {
      T = t[pre] - t[cur] + 1;
      val = cur;
      break;
    }
  }

  lint cost = 0; // 一週分のコスト
  cur = val;
  while (1) {
    cost += cur;
    cur = cur * cur % m;
    if (cur == val) break;
  }

  // val に当たるまでは、普通に計算。
  lint ans = 0;
  cur = x;
  while (1) {
    ans += cur;
    n--;
    cur = cur * cur % m;
    if (cur == val) break;
  }

  // 残り n 個
  ans += (n / T) * cost;
  n = n % T;
  
  for (int i = 0; i < n; i++) {
    ans += cur;
    cur = cur * cur % m;
  }

  cout << ans << endl;



  return 0;
}


Measured memory_bytes: 10704
h={}
f=->l,r{h[[l,r]]||=r<l ?0:l<2?1+f[2,r]:f[l/2,~-r/2]+f[l-=l/2,r/2]+f[l,~-r/2]}
eval"p f[%d,%d].%%10**9+7"%gets.split

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

int main()
{
  int w, n;
  cin >> w >> n;
  vector<int> amd(w);

  for (unsigned int i = 0; i < amd.size(); ++i)
    amd[i] = i+1;

  for (int i = 0; i < n; ++i) {
    string line;
    cin >> line;
    int a = atoi(line.substr(0, line.find_first_of(",", 0)).c_str());
    int b = atoi(line.substr(line.find_first_of(",", 0)+1).c_str());
    swap(amd[a-1], amd[b-1]);
  }
  for (unsigned int i = 0; i < amd.size(); ++i)
    cout << amd[i] << endl;

  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define rep(i, n) for (rint i = 1; i <= (n); i ++)
#define re0(i, n) for (rint i = 0; i < (int) n; i ++)
#define travel(i, u) for (rint i = head[u]; i; i = e[i].nxt)
#define rint int
using namespace std;
     
typedef long long lo;
     
template<typename tp> inline void read(tp &x) {
	x = 0; char c = getchar(); int f = 0;
	for (; c < '0' || c > '9'; f |= c == '-', c = getchar());
	for (; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + c - '0', c = getchar());
	if (f) x = -x;
}
const int N = 3e5 + 233;
int n, a, b, c, d, pre[N];
char s[N];
inline int find(int x) {
	return pre[x] == x ? x : pre[x] = find(pre[x]);
}

inline void make(int x, int y) {
	if (s[x] || s[y]) return ;
	x = find(x); y = find(y);
	pre[y] = x;
}

int main(void) {
	read(n); read(a); read(b); read(c); read(d);
	scanf("%s", s + 1);
	rep (i, n) s[i] = s[i] == '#';
	s[0] = s[n + 1] = s[n + 2] = 3;
	rep (i, n) pre[i] = i;
	rep (i, n) make(i, i + 1), make(i, i + 2);
	if (find(a) != find(c) || find(b) != find(d)) {
		cout << "No\n";
	} else {
		if (c < d) 
			cout << "Yes\n";
		else {
			// a < b < d < c
			for (int i = b; i <= d; i++) {
				if ((s[i - 1] + s[i] + s[i + 1]) == 0) {
					cout << "Yes\n";
					return 0;
				}
			}
			cout << "No\n";
		}
	}
}


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

using ll = long long;

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

    int n;cin>>n;

    ll ans=0;

    for(int i=1;i<n;i++)ans+=i;

    cout<<ans<<"\n";

    return 0;
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> pi;
typedef vector<pi> vpi;
typedef long double ld;
#define pb emplace_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define ALL(x) x.begin(), x.end()
#define SZ(x) (ll)x.size()
#define f first
#define s second
#define MAXN 501010

ll T,N,M,a,b;
ll A[MAXN];
vi V[MAXN];
ll flip=0;
deque<char> dq;
char c;
string S;

int main(){
	cin>>S;for (auto i:S)dq.pb(i);
	cin>>N;
	while (N--){
		cin>>a;
		if (a == 1)flip = 1-flip;
		else{
			cin>>b>>c;
			if (flip)b = 3-b;
			if(b==1)dq.push_front(c);
			else dq.pb(c);
		}
	}	
	if (flip)reverse(ALL(dq));
	for (auto t:dq)cout<<t;
}


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

int main() {
  int N, A, x;
  cin >> N >> A;
  x = N % 500;
  
  if (A - x >= 0) {
    cout << "Yes" << endl;
  }
	else{
  cout << "No" << endl;
    }
}


Measured memory_bytes: 256
// code author: Dhruva Mahajan
 
// Ideas are cheap, execution is everything.
 
#include<bits/stdc++.h> 
using namespace std;
 
#define ll long long  
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define tr(container, it) for(auto it = container.begin(); it != container.end(); it++)
#define bitcount(a) __builtin_popcount(a) // set bits (add ll)
#define testcase(t) int t;cin>>t;while(t--)
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))

int main(){
	
	fastio;

	ll n,k,sum=0;
	cin>>n>>k;
	ll a[n];
	for(ll i=0;i<n;i++){
		cin>>a[i];
		sum+=a[i];
	}

	sort(a,a+n);
	ll i=n-1;
	while(k>0){
		sum-=a[i];
		i--;
		k--;
		// if(i<0){
		// 	break;
		// }
	}

	// for(ll i=n-1;i>=0;i--){
	// 	sum-=a[i];
	// }
	cout<<max(sum,0)<<endl;

	
	
	return 0;
}

Measured memory_bytes: 1792
#include <cstdint>
#include <iostream>

using namespace std;
static pair<int64_t, int64_t> students[50];
static pair<int64_t, int64_t> points[50];

int32_t main()
{
  uint32_t N, M;

  cin >> N >> M;

  for (uint32_t i = 0; i < N; i++) {
    int64_t x, y;
    cin >> x >> y;
    students[i] = make_pair(x, y);
  }

  for (uint32_t i = 0; i < M; i++) {
    int64_t x, y;
    cin >> x >> y;
    points[i] = make_pair(x, y);
  }

  for (uint32_t i = 0; i < N; i++) {
    int64_t x = students[i].first;
    int64_t y = students[i].second;
    uint64_t m = UINT64_MAX;
    uint64_t min_point = 0;
    for (uint32_t j = 0; j < M; j++) {
      uint64_t distance = abs(x - points[j].first) + abs(y - points[j].second);
      if (distance < m) {
        m = distance;
        min_point = j;
      }
    }
    cout << min_point + 1 << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int h, w;
	int i, j;
	
	while (scanf("%d %d", &h, &w), h || w){
		if (h == 0 && w == 0) break;
		
		for (i = 0; i < h; i++){
			for (j = 0; j < w; j++){
			if (i == 0 || i == h-1 || j == 0 || j == w-1) printf("#");
			else printf(".");
			}
			
			printf("\n");
		}
		
		printf("\n");
	}
		
	return 0;
}

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

int main(){
  int n,m;
  int k[30], a[30][30];
  cin >> n >> m;
  for(int i = 0; i < n; i++){
    cin >> k[i];
    for(int j = 0; j < k[i]; j++){
      cin >> a[i][j];
    }
  }
  int cnt = 0;
  bool like;
  for(int i = 1; i < m+1; i++){ // ｍ種類の食べ物
    like = true;
    for(int j = 0; j < n; j++){ // 各人の好物に入っているか
      bool in = false;
      for(int l = 0; l < k[j]; l++){
        if(a[j][l] == i) in = true;
      }
      if(!in){
        like = false;
        break;
      }
    }
    if(like) cnt++;
  }

  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
fn read<T: std::str::FromStr>(
    stdin_lock: &mut std::io::StdinLock,
    buf: &mut Vec<u8>,
    delimiter: u8,
) -> T {
    buf.clear();
    let l = std::io::BufRead::read_until(stdin_lock, delimiter, buf).unwrap();
    buf.truncate(l - 1); // remove delimiter
    let s = unsafe { std::str::from_utf8_unchecked(&buf) };
    s.parse().unwrap_or_else(|_| panic!("read"))
}

fn main() {
    let stdin = std::io::stdin();
    let mut stdin_lock = stdin.lock();
    let mut buf: Vec<u8> = Vec::new();
    let a: u8 = read(&mut stdin_lock, &mut buf, b' ');
    let b: u8 = read(&mut stdin_lock, &mut buf, b' ');
    let c: u8 = read(&mut stdin_lock, &mut buf, b' ');
    let d: u8 = read(&mut stdin_lock, &mut buf, b'\n');
    let l = a + b;
    let r = c + d;
    let ans = if l > r {
        "Left"
    } else if l == r {
        "Balanced"
    } else {
        "Right"
    };
    println!("{}", ans);
}


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

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

int main()
{
  char s1, s2;
  map<char, int> cup;
  cup['A'] = 1, cup['B'] = 0, cup['C'] = 0;
  while (scanf("%c,%c", &s1, &s2) != EOF){
    swap(cup[s1], cup[s2]);
  }
  if (cup['A']) cout << "A" << endl;
  if (cup['B']) cout << "B" << endl;
  if (cup['C']) cout << "C" << endl;
}

Measured memory_bytes: 1192
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c,x;
    cin>>a>>b>>c>>x;
    int m=0;
    for(int i=0;i<=a;i++){
        for(int j=0;j<=b;j++){
            for(int k=0;k<=c;k++){
                if(500*i+100*j+50*k==x){
                    m++;
                    break;
                }
            }
        }
    }
    cout<<m<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i=0; i<(n); i++)
string cstr(string t){
    rep(i, t.size()){//入れた文字列tに含まれる大文字を子文字に変換する関数
        if (t[i] >= 'A' && 'Z' >= t[i]) t[i] += 'a' - 'A';
    }
    return t;
}
int main(){
    string s; cin >> s; 
    string cs = cstr(s);
    int ans = 0;
    while (1){
        string t;
        cin >> t;
        string ct = cstr(t);
        if (t == "END_OF_TEXT") break;
        if (ct == cs) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3168
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int ctoi(const char c) {
    if ('0' <= c && c <= '9') return (c - '0');
    return -1;
}
vector<int> input(int n) {
    vector<int> vec(n);
    for (int i = 0; i < n; i++) {
        cin >> vec.at(i);
    }
    return vec;
}
void output(vector<int> vec) {
    for (int i = 0; i < vec.size(); i++) {
        cout << vec[i] << " ";
    }
    return;
}
vector<vector<int>> input(int n, int m) {
    vector<vector<int>> table(n, vector<int>(m));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> table. at(i).at(j);
        }
    }
    return table;
}
void output(vector<vector<int>> table) {
    for (int i = 0; i < table.size(); i++) {
        for (int j = 0; j < table.at(0).size(); j++) {
            cout << table.at(i).at(j) << " ";
        }
        cout << endl;
    }
}
long long perm(int n, int r) {
    if (n < r) {
        cout << "error" << endl;
        return 0;
    }
    long long perm = 1;
    for (int i = n; i > n - r; i--) {
        perm *= i;
    }
    return perm;
}
long long comb(int n, int r) {
    if (n < r) {
        cout << "error" << endl;
        return 0;
    }
    long long comb = perm(n,r);
    for (int i = r; i > 0; i--) {
        comb /= i;
    }
    return comb;
}
long long homo(int n, int r) {
    return comb(n + r - 1, n - 1);
}
long long fact(int n) {
    long long fact = 1;
    for (int i = n; i > 0; i--) {
        fact *= i;
    }
    return fact;
}
int gcd(int a, int b)
{
    if (a % b == 0)
    {
        return(b);
    }
    else
    {
        return(gcd(b, a % b));
    }
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
int main() {
  int a,b;
  string s;
  bool f=true;
  cin >> a >> b >> s;
  if(s[a]!='-'){
    f=false;
  }
  sort(s.begin(),s.end());
  
  int cnt=0;
  for(int i=1;i<s.size();i++){
    if(isdigit(static_cast<unsigned char>(s[i]))){
      cnt++;
    }
  }
  
  if(cnt!=a+b){
    f=false;
  }
  
  if(f){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int big = 200;
int small = 195;
int CalcTime(int y,int m,int d){
	int sum = 0;
	for (int i = 1; i < y; i++){
		if (i%3 == 0){
			sum += 200;
		}
		else{
			sum += 195;
		}
	}
	if (y%3 == 0){
		sum += 20 * (m - 1);
	}
	else{
		for (int i = 1; i < m; i++){
			if (i%2 == 0){
				sum += 19;
			}
			else{
				sum += 20;
			}
		}
	}
	sum += d;
	return sum;
}
int main(){
	int n;
	int y, m, d;
	int millennium = CalcTime(1000,1,1);
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> y >> m >> d;
		cout << millennium - CalcTime(y,m,d) << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <cstring>
#include <cassert>
#define N (ll)(2e6+5)
#define INF (ll)(1e18+3)

#define ll long long
#define rep(i,a,n) for(ll i = a; i < n; i++)
#define per(i,a,n) for(ll i = n-1; i >= a; i--)

using namespace std;

ll a[N], p[N], p2[N];

ll t[N];
ll n, k;

void modify(int pp, int value) {  // set value at position p
  for (t[pp += n] = value; pp > 1; pp >>= 1) t[pp>>1] = t[pp] + t[pp^1];
}

int query(int l, int r) {  // sum on interval [l, r)
  int res = 0;
  for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
    if (l&1) res += t[l++];
    if (r&1) res += t[--r];
  }
  return res;
}

void solve() {
    cin >> n >> k;
    n++; p[0] = 0;
    rep(i,1,n) {
        cin >> a[i];
        p[i] = a[i] + p[i-1];
    }
    rep(i,0,n) {
        p[i] -= k*(i+1);
        p2[i] = p[i];
    }

    sort(&p2[0],&p2[n]);
    map<ll,ll> ma;
    ll cur = 0;
    rep(i,0,n) {
        if (!i || p2[i] != p2[i-1])
            ma[p2[i]] = cur++;
    }
    rep(i,0,n) {
        p[i] = ma[p[i]];
    }

    ll ans = 0;
    rep(i,0,n) {
        ans += query(0,p[i]+1);
        modify(p[i],t[p[i]+n]+1);
    }
    cout << ans << endl;
}

int main() {
    solve();
}

Measured memory_bytes: 29056
#include <bits/stdc++.h>
#define int long long

using namespace std;

int n=0,x=0,k=0;
int arr[200001];
vector<int> otr;
vector<int> pol;
vector<int> zeroes;
int otr_p=0, pol_p=0, zero_p=0;

int pol_pol(int a, int b)
{
	int ll = 0, rr = pol.size()-1;
	while (ll<rr-1)
	{
		int mm = (ll+rr)/2;
		if (a*pol[mm]>b)
			rr = mm;
		else
			ll = mm;
	}
	if (a*pol[ll]>b)
		return -1;
	else if (a*pol[rr]>b)
		return ll;
	else
		return rr;
}

int pol_otr(int a, int b)
{
	if (otr.size()==0)
		return -1;
	int ll = 0, rr = otr.size()-1;
	while (ll<rr-1)
	{
		int mm = (ll+rr)/2;
		if (a*otr[mm]>b)
			rr = mm;
		else
			ll = mm;
	}
	if (a*otr[ll]>b)
		return -1;
	else if (a*otr[rr]>b)
		return ll;
	else
		return rr;
}

int otr_otr(int a, int b)
{
	int ll = 0, rr = otr.size()-1;
	while (ll<rr-1)
	{
		int mm = (ll+rr)/2;
		if (a*otr[mm]>b)
			ll = mm;
		else
			rr = mm;
	}
	if (a*otr[rr]>b)
		return -1;
	else if (a*otr[ll]>b)
		return rr;
	else
		return ll;
}

int cnt(int x)
{
	int res=0;
	for (int i=0; i<pol.size(); i++)
	{
		int ii = pol_pol(pol[i], x);
		if (ii==-1)
			continue;
		res+=max(0ll, ii-i);
	}
	for (int i=0; i<otr.size(); i++)	
	{
		int ii = otr_otr(otr[i], x);	
		if (ii==-1)
			continue;
		ii = max(ii, i+1);
		res+=otr.size()-ii;	
	}		
	for (int i=0; i<pol.size(); i++)
	{
		int ii = pol_otr(pol[i], x);	
		if (ii==-1)
			continue;
		res+=ii+1;
	}
	if (x>=0)
		res+=(zeroes.size()*(n-zeroes.size()))+(zeroes.size()*(zeroes.size()-1)/2);
	return res;
}

signed main()
{
	cin >> n >> k;
	for (int i=0; i<n; i++)
		cin >> arr[i];		
	sort(arr, arr+n);
	for (int i=0; i<n; i++)
	{
		if (arr[i]<0)
			otr.push_back(arr[i]);
		else if (arr[i]==0)
			zeroes.push_back(arr[i]);
		else
			pol.push_back(arr[i]);
	}
	otr_p = otr.size()*pol.size();
	zero_p = zeroes.size()*(n-zeroes.size());
	pol_p = pol.size()*(pol.size()-1)/2+otr.size()*(otr.size()-1)/2;
	int ll = LLONG_MIN/3;
	int rr = LLONG_MAX/3;
	while (ll<rr-1)
	{
		int mm = (ll+rr)/2;
		if (cnt(mm)<k)
			ll = mm;
		else
			rr = mm;
	}
	if (cnt(rr)<k)
		cout << rr+1;
	else if (cnt(ll)<k)
		cout << rr;
	else
		cout << ll;
	return 0;
}


Measured memory_bytes: 4980
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> PP;
#define int ll
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
//#define INF 810114514
#define PI 3.141592653589
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE do { cout << "0" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl
#define debug false
#define debug2 false

//素因数分解
std::vector<long long> prime_factorization(long long N){
  std::vector<long long> R;
  if(N<2)return R;
  for(int i=2;i*i<=N;i++){
      while(N%i==0){
          R.push_back(i);
          N/=i;
      }
  }
  if(N!=1){
      R.push_back(N);
  }
  return R;
}

signed main(void){
    int N;
    cin >> N;
    vector<int> P = prime_factorization(N);
    map<int,int> M;
    REP(i,P.size()){
        M[P[i]]++;
    }
    int Ans=0;
    REP(i,P.size()){
        int m = M[P[i]];
        int B = m;
        if(m==0)continue;
        M[P[i]]=0;
        
        for(int k=1;k<=B;k++){
            if(m>=k){
                Ans++;
                m-=k;
            }else{
                break;
            }
        }
        
    }
    cout << Ans << endl;
    return 0;
}




Measured memory_bytes: 3644
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define M 1000001
#define mod 10007

/* 値を入れ替える関数 */
void swap (int *x, int *y) {
    int temp;    // 値を一時保存する変数
    
    temp = *x;
    *x = *y;
    *y = temp;
}

/***
 * pivotを決め、
 * 全データをpivotを境目に振り分け、
 * pivotの添え字を返す
 ***/
int partition (int array[], int left, int right) {
    int i, j, pivot;
    i = left;
    j = right + 1;
    pivot = left;   // 先頭要素をpivotとする
    
    do {
        do { i++; } while (array[i] < array[pivot]);
        do { j--; } while (array[pivot] < array[j]);
        // pivotより小さいものを左へ、大きいものを右へ
        if (i < j) { swap(&array[i], &array[j]); }
    } while (i < j);
    
    swap(&array[pivot], &array[j]);   //pivotを更新
    
    return j;
}

/* クイックソート */
void quick_sort (int array[], int left, int right) {
    int pivot;
    
    if (left < right) {
        pivot = partition(array, left, right);
        quick_sort(array, left, pivot-1);   // pivotを境に再帰的にクイックソート
        quick_sort(array, pivot+1, right);
    }
}
int main(void){
    int N,K,H[200000];
    scanf("%d %d",&N,&K);
    for (int i=0; i<N; i++) {
        scanf("%d",&H[i]);
    }
    
    quick_sort(H,0,N-1);
    long int sum=0;
    for (int i=0;i<N-K; i++) {
        sum+=H[i];
    }
    
    printf("%ld\n",sum);
    return 0;
}

Measured memory_bytes: 896
#include<iostream>
#include<queue>
#include<string>
#include<vector>
#include<math.h>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include<stack>
#include<sstream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<list>
#include<numeric>
typedef long long ll;

#define pi 3.14159265358979323846
#define VI vector<int>
#define VLL vector<long long>
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
const ll MOD = 1e9 + 7;
using namespace std;
template<typename T>
T gcd(T a, T b) {
	if (b == 0) return a;
	return gcd(b, a % b);
	//return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	ll g = gcd(a, b);
	return a / g * b; // Be careful not to overflow
	//return a * b / gcd(a, b);
}

template<typename T>
T binarysearch(vector<T> A, T key) {
	ll left = 0;ll right = 4;ll mid;
	while (left < right) {
		mid = (left + right) / 2;
		if (key == A[mid]) return 1;
		if (key > A[mid]) left = mid + 1;
		else if (key < A[mid]) right = mid;
	}
	return 0;
}

template<typename T>
T finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}
ll frac(ll n)//階乗
{
	if (n == 0) {
		return 1;
	}
	return (n * frac(n - 1)) % MOD;
}

template<typename T>
T keta(T a) {
	ll kazu = 1;
	while (1) {
		if (a / 10 != 0) { a /= 10;kazu++; }
		else break;
	}
	return kazu;
}//桁数

//素数判定
template<typename T>
bool IsPrime(T num)
{
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			// 素数ではない
			return false;
		}
	}

	// 素数である
	return true;
}

template<typename T>
T nCr(ll n, T r) {
	ll ans = 1;
	for (int i = n; i > n - r; --i) {
		ans = ans * i;
	}
	for (int i = 1; i < r + 1; ++i) {
		ans = ans / i;
	}
	return ans;
}
/*char r[4];
int yaju[4];
char op[3];
int sum = 0;
scanf("%s", r);
for (int i = 0;i < 4;i++) {
	yaju[i] = r[i] - '0';
}
*/
//vector<vector<int>> data(3, vector<int>(4));
//vector<vector<Type>> vv(n);

int main() {
	string N; ll ans = 0;cin >> N;
	ll mina = 0;
	vector<ll>sum;
	//vector<ll>C(N);
	//vector<ll>S(N), F(N);
	//for (ll i = 1;i < N;i++)cin >> C[i] >> S[i] >> F[i];
	if (N[N.size() - 1] == '2' || N[N.size() - 1] == '4' || N[N.size() - 1] == '5' || N[N.size() - 1] == '7' || N[N.size() - 1] == '9') {
		cout << "hon" << endl;
	}
	else if (N[N.size() - 1] == '0' || N[N.size() - 1] == '1' || N[N.size()-1] == '6' || N[N.size() - 1] == '8') {
		cout << "pon" << endl;
	}
	else cout << "bon" << endl;
}


Measured memory_bytes: 3576
n,m = map(int,input().split())
li = [[0 for i in range(n)]for j in range(n)]
lis = []

def all_pairs_shortest_paths(W):
    inf = 10**18
    # 頂点の数
    n = len(W)
    # 結果を格納する行列を用意する
    res = [[0] * n for i in range(n)]
    # 用意した行列を初期化する
    for i in range(n):
        for j in range(i, n):
            if i == j:
                val = 0
            elif W[i][j]:
                val = W[i][j]
            else:
                val = inf
            res[i][j] = res[j][i] = val
    # 動的計画法ですべての超点間の最短距離を求める
    for k in range(n):
        for u in range(n):
            for v in range(n):
                res[u][v] = min(res[u][v], res[u][k] + res[k][v])
    return res

for _ in range(m):
    a,b,c = map(int,input().split())
    a -= 1
    b -= 1
    lis.append((a,b,c))
    li[a][b] = c
    li[b][a] = c

lin = all_pairs_shortest_paths(li)
point = 0

for path in lis:
    a,b,c = path
    flag = False
    for i in range(n):
        for j in range(n):
            if lin[i][a]+c+lin[b][j] == lin[i][j]:
                flag = True
    if not flag:
        point += 1

print(point)

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

int main() {
 int a,b,c;
  cin >> a >> b >> c;
  if(a > b){
    swap(a,b);
  }
  if(b > c){
    swap(b,c);
  }
  if(a > b){
    swap(a,b);
  }
  cout << a << ' ' << b << ' ' << c << endl;
}



Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <iostream>
//#include <algorithm>
// #include <iomanip>
#define ll long long

using namespace std;

const int MOD = 1000000007;

int main() {
  ll a, b;
  scanf("%lld %lld", &a, &b);

  if (a == b) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
'''
研究室PCでの解答
'''
import math
#import numpy as np
import queue
import bisect
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)
mod = 10**9+7 #998244353
dir = [(-1,0),(1,0),(0,-1),(0,1)]
alp = "abcdefghijklmnopqrstuvwxyz"

def main():
    n = int(ipt())
    ans = [-int(ipt())]
    for i in range(n-1):
        a = -int(ipt())
        if a >= ans[-1]:
            ans.append(a)
        else:
            ans[bisect.bisect_right(ans,a)] = a
#        print(ans)
    print(len(ans))

    return None

if __name__ == '__main__':
    main()


Measured memory_bytes: 80168
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include<bits/stdc++.h>
#define inf 0x3f3f3f3f
const int maxn = 2e5+100;
using namespace std;
typedef long long ll;
int main()
{
	ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin>>s;
    if(s=="ABC")
    cout<<"ARC";
    else cout<<"ABC";
    return 0;
}

Measured memory_bytes: 3616
#include<stdio.h>
#include<iostream>
#include<queue>
#include<string.h>
using namespace std;
int map[1002][1002], was[1002][1002];
int main(void)
{
	int count = 0, H, W, N, i, j;
	char c=0;
	pair<int, int> q,a[10];
	queue<pair<int, int> > que;
	queue<int> quec;
	quec.push(0);
	scanf("%d %d %d", &H, &W, &N);
	for (i = 0; i <= H + 1; i++)
	{
		map[i][0] = -1;
		map[i][W + 1] = -1;
		was[i][0] = -1;					/*?????????????£???????(???)*/
		was[i][W + 1] = -1;
	}
	for (j = 1; j <= W; j++)
	{
		map[0][j] = -1;
		map[H + 1][j] = -1;           /*?????????????£???????????¨????*/
		was[0][j] = -1;
		was[H + 1][j] = -1;
	}
	for (i = 1; i <= H; i++)
	{
		for (j = 1; j <= W; j++)			/*???????????????(??????????????°???????????????????????????????????¨??°??????????????????*/
		{
			cin >> c;
			if (c == 'X')
				map[i][j] = -1;
			if (c == 'S')
			{
				q.first = i;
				q.second = j;
			}
			if (c == '1')
			{
				a[1].first = i;
				a[1].second = j;
			}
			if (c == '2')
			{
				a[2].first = i;
				a[2].second = j;
			}
			if (c == '3')
			{
				a[3].first = i;
				a[3].second = j;
			}
			if (c == '4')
			{
				a[4].first = i;
				a[4].second = j;
			}
			if (c == '5')
			{
				a[5].first = i;
				a[5].second = j;
			}
			if (c == '6')
			{
				a[6].first = i;
				a[6].second = j;
			}
			if (c == '7')
			{
				a[7].first = i;
				a[7].second = j;
			}
			if (c == '8')
			{
				a[8].first = i;
				a[8].second = j;
			}
			if (c == '9')
			{
				a[9].first = i;
				a[9].second = j;
			}
		}
	}
	/*for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) {
			cout << map[i][j];
		}
		cout << endl;
	}*/
	que.push(q);
	i = 1;
	while (i <= N)
	{
		count = quec.front();
		quec.pop();
		q = que.front();
		que.pop();

		if (q == a[i])
		{

			i++;
			memset(was, 0, sizeof(was));
			while (!que.empty())
				que.pop();
			while (!quec.empty())
				quec.pop();
			quec.push(count);
			que.push(q);
			continue;
		}
		if (map[q.first][q.second + 1] != -1 && was[q.first][q.second + 1] != -1)
		{
			was[q.first][q.second+1] = -1;
			q.second++;
			que.push(q);					/*???????????????*/
			count++;
			quec.push(count);
			count--;
			q.second--;
		}
		if (map[q.first][q.second - 1] != -1 && was[q.first][q.second-1] != -1)
		{
			was[q.first][q.second-1] = -1;
			q.second--;
			que.push(q);
			count++;						/*???????????????*/
			quec.push(count);
			count--;
			q.second++;
		}
		if (map[q.first + 1][q.second] != -1 && was[q.first + 1][q.second] != -1)
		{
			was[q.first + 1][q.second] = -1;
			q.first++;
			que.push(q);
			count++;						/*???????????????*/
			quec.push(count);
			count--;
			q.first--;
		}
		if (map[q.first - 1][q.second] != -1 && was[q.first - 1][q.second] != -1)
		{
			was[q.first-1][q.second] = -1;
			q.first--;
			que.push(q);
			count++;							/*???????????????*/
			quec.push(count);
			count--;
			q.first++;
		}
	}

	printf("%d\n", count);					/*????????£???????????????????¨??????????*/
	return 0;
}

Measured memory_bytes: 10892
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cmath>

using namespace std;

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

  int flag = 0;
  for(int i = 0; i < s.size(); i++) {
    if(flag == 0 && s[i] == 'C') flag = 1;
    else if(flag == 1 && s[i] == 'F') {cout << "Yes" << endl; return 0;}
  }
  cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 384
#include <iostream>

int main(){
   int N;
   std::cin >> N;

   for(int i=1; i<=9; ++i){
      if(N%i==0 && N/i<10) {
	 std::cout << "Yes" << std::endl;
	 return 0;
      }
   }
   std::cout<< "No" << std::endl;
   return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
static const int N = 1000;

void trace(int n, int A[]){
    for(int i = 0; i < n; i++){
            printf("%d", A[i]);
            if(i != n - 1){
                printf(" ");
            }
    }
    printf("\n");
}

void sort(int n, int A[]){

    /* initialization */
    trace(n, A);

    for(int i = 1; i < n; i++){
        int v = A[i];
        int j = i - 1;

        while(j >= 0 && A[j] > v){
            A[j + 1] = A[j];
            j--;
        }

        A[j + 1]= v;

        trace(n, A);
    }
}

int main(){
    int n, i;
    int A[N+1];

    scanf("%d", &n);
    for ( i = 0; i < n; i++ ) scanf("%d", &A[i]);
    sort(n, A);
    return 0;

}



Measured memory_bytes: 1928
import math

N = int(input())

power = 1
NUM = 10 ** 9 + 7

for i in range(1, N + 1) :
    power *= i 
    if power >= NUM :
        power %= NUM
print(power)
"""
power = math.factorial(N)

print(power % (10 ** 9 + 7))
"""


Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String N = sc.next();
		String ans = "";

		if (N.charAt(0) == N.charAt(2)) {
			ans = "Yes";
		} else {
			ans = "No";
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 23124
// ConsoleApplication1.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
using namespace std;

int main()
{
	int h, w;
	while (cin >> h >> w, h|w)
	{
		for (int i = 0; i < h; i++) {
			if (i == 0 || i == h - 1) {
				for  (int  k= 0; k < w; k++)
				{
					cout << "#";

				}
				cout << endl;
				continue;
			}
			for (int j = 0; j < w; j++)
			{
				if (j == 0 || j == w - 1) {
					cout << "#";
				}
				else {
					cout << ".";
				}
			}

			cout << endl;
		}
		cout << endl;



	}
}

// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー

// 作業を開始するためのヒント: 
//    1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します 
//   2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
//   3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
//   4. エラー一覧ウィンドウを使用してエラーを表示します
//   5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します
//   6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します



Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
const int inf=1e5+5;
typedef long long ll;
double mx=-123456789;
ll n;
vector<double>v;
int main()
{
   string s,t;
   cin>>s>>t;
   int cnt=0;
   for(int i=0;i<3;i++){
    if(s[i]==t[i]) cnt++;
   }
   cout<<cnt<<endl;
}


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

int main()
{
    int n;
    cin>>n;
    bool flag = true;
    int a[n];
    for(int i=0;i<n;i++)
    cin>>a[i];
        for(int i=0;i<n;i++)

    {
        if(a[i]%2==0)
        {
            if(a[i]%3!=0&&a[i]%5!=0)
            flag=false;
            
            
        }
    }
    if(!flag)
    cout<<"DENIED";
    else
    cout<<"APPROVED";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n; i >= 0; i--)
#define inf LLONG_MAX
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    string n; cin >> n;
    if (find(all(n), '7') != n.end()) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3624
#include <stdio.h>

int main(void)
{
	int a,b,c;
	
	scanf("%d%d%d" ,&a,&b,&c);         //??\???
	
	if((a<b) && (b<c))                //a<b<c?????????
	{
		printf("Yes\n");
	}
	else                             //????¨???\????????´???
	{
		printf("No\n");
	}
	
	return 0;    //?????????
}

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

using namespace std;

string words[] = {"dream", "dreamer", "erase", "eraser"};

int main() {
    int N, t, x, y, dt, l;
    cin >> N;
    int pre_t = 0;
    int pre_x = 0;
    int pre_y = 0;
    for (int i=0; i<N; i++) {
        cin >> t >> x >> y;
        dt = t - pre_t;
        l = x + y - pre_x - pre_y;
        if ((dt < l) | ((dt-l)%2 == 1)) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

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

using namespace std;

const int maxn = 2e5 + 9;

using lint = long long;

int a[maxn], b[maxn];
priority_queue<pair<int, int>> pq;

int main() {
#if DEBUG
    freopen("in.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n; cin >> n;
    for (int i = 0; i < n; ++i)
        cin >> a[i];
    for (int i = 0; i < n; ++i) {
        cin >> b[i];
        pq.push({b[i], i});
    }
    lint ans = 0;
    while (!pq.empty()) {
        pair<int, int> here = pq.top();
        pq.pop();
        if (b[here.second] <= a[here.second]) continue;
        int p = b[(here.second + n - 1) % n];
        int q = b[here.second];
        int r = b[(here.second + 1) % n];
        lint s = (q - a[here.second]) / (p + r);
        if (s == 0) {
            cout << "-1\n";
            return 0;
        }
        ans += s;
        q -= s * (p + r);
        b[here.second] = q;
        if (a[here.second] != b[here.second])
            pq.push({q, here.second});
    }
    for (int i = 0; i < n; ++i) {
        if (a[i] != b[i]) {
            cout << "-1\n";
            return 0;
        }
    }
    cout << ans << '\n';
}


Measured memory_bytes: 4724
#include <stdio.h>

int main(void)
{
    int c;
    c = 0;
    char S[4];
    char T[4];
    scanf("%s\n%s",S,T);
    if(S[0] == T[0]) c++;
    if(S[1] == T[1]) c++;
    if(S[2] == T[2]) c++;
    printf("%d",c);
	return 0;
}

Measured memory_bytes: 1724
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <map>
#include <sstream>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <iterator>
#include <stack>
#include <list>
using namespace std;

#define INF 100000000
typedef long long int lli;
typedef pair<int,int> P;
struct cost{
	P tp,kp;
	int cnt;
};
int MAP[51][51];
int dt[51][51];
int dk[51][51];
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
bool passed[51][51][51][51];

string IntToString(int number){
	stringstream ss;
	ss << number;
	return ss.str();
}

int main(){
	int X,Y;
	while(cin>>X>>Y&&X&&Y){
		int tx,ty,kx,ky;
		cin >> tx >> ty >> kx >> ky;
		for(int i=1; i<=Y; ++i){
			for(int j=1; j<=X; ++j){
				cin >> MAP[j][i];
			}
		}
		for(int i=1;i<=X; ++i){
			for(int j=1; j<=Y; ++j){
				for(int k=1; k<=X; ++k){
					for(int l=1; l<=Y; ++l){
						passed[i][j][k][l]=false;
					}
				}
			}
		}
		cost ans;
		queue<cost> q;
		cost c;
		c.cnt=0;
		c.tp=P(tx,ty);
		c.kp=P(kx,ky);
		q.push(c);
		bool flag=false;
		while(q.size()){
			cost now = q.front();
			q.pop();
			if(now.cnt>=100){
				break;
			}
			if(now.tp.first==now.kp.first&&now.kp.second==now.tp.second){
				ans=now;
				flag=true;
				break;
			}
			for(int i=0; i<4; ++i){
				cost np;
				np.cnt=now.cnt+1;
				if(1<=now.tp.first+dx[i]&&now.tp.first+dx[i]<=X&&MAP[now.tp.first+dx[i]][now.tp.second]!=1){
					np.tp.first=now.tp.first+dx[i];
				} else {
					np.tp.first=now.tp.first;
				}
				if(1<=now.tp.second+dy[i]&&now.tp.second+dy[i]<=Y&&MAP[now.tp.first][now.tp.second+dy[i]]!=1){
					np.tp.second=now.tp.second+dy[i];
				} else {
					np.tp.second=now.tp.second;
				}
				if(1<=now.kp.first-dx[i]&&now.kp.first-dx[i]<=X&&MAP[now.kp.first-dx[i]][now.kp.second]!=1){
					np.kp.first=now.kp.first-dx[i];
				} else {
					np.kp.first=now.kp.first;
				}
				if(1<=now.kp.second-dy[i]&&now.kp.second-dy[i]<=Y&&MAP[now.kp.first][now.kp.second-dy[i]]!=1){
					np.kp.second=now.kp.second-dy[i];
				} else {
					np.kp.second=now.kp.second;
				}
				if(!passed[np.tp.first][np.tp.second][np.kp.first][np.kp.second]){
					q.push(np);
					passed[np.tp.first][np.tp.second][np.kp.first][np.kp.second]=true;
				}
			}
		}
		if(flag){
			cout << ans.cnt << "\n";
		} else {
			cout << "NA\n";
		}
	}
}

Measured memory_bytes: 8040
#include<iostream>
#include<stdio.h>
#include<string>
using namespace std;
#define ll long long
int main(){
  ll n;
  ll m;
  ll d;
  long double ans;
  cin >> n >> m >> d;

  ll cou=0;


    if(d==0){
      cou=n;
    }else if(d > n){
      cou = 0;

    }else{
    cou = 2*(n-d);
   }



  ans = (double)cou*(m-1)/(double)(n*n);

printf("%0.10Lf\n",ans) ;
  //cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>
#include <algorithm>

using namespace std;

int max_value(std::map<string, int> m) {
  int max = 0;
  for (std::map<string, int>::iterator it = m.begin(); it != m.end(); it++) {
    if (max < it->second) max = it->second;
  }
  return max;
}

int main(){
  int N,M;
  string s[110],t[110];
  cin >> N;
  for(int i=0;i<N;i++){
    cin >> s[i];
  }
  cin >> M;
  for(int i=0;i<M;i++){
    cin >> t[i];
  }

  std::map<string,int> count;
  for(int i=0;i<N;i++){
    if(count.find(s[i]) == count.end()){
      count[s[i]]=0;
    }
     count[s[i]] +=1;
  }
  for(int i=0;i<M;i++){
    if(count.find(t[i]) == count.end()){
      count[t[i]]=0;
    }
    count[t[i]] -=1;
  }
   

  int max = max_value(count);

  cout << max << endl;

  return 0;
  
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	static String original;
	public static void main(String[] args) {
		Scanner reader = new Scanner(System.in);
		String S = reader.next();
		boolean flag = true;
		String ans;

		if (S.charAt(0) != 'A') {
			flag = false;
		}

		int C_index = S.indexOf('C');
		if (S.indexOf('C') > S.length() - 2 || S.indexOf('C') < 2) {
			flag = false;
		}

		for (int i = 1; i < S.length(); i++) {
			if (i != C_index && Character.isUpperCase(S.charAt(i))) {
				flag = false;
			}
		}
		
		if (flag) {
			ans = "AC";
		} else {
			ans = "WA";
		}

		System.out.print(ans);
	}


}


Measured memory_bytes: 25172