akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>

int64_t solve(char *begin, char *end);

int main(int argc, char const* argv[])
{
  char *next;
  int64_t N, Q;
  scanf("%ld %ld\n", &N, &Q);
  // fprintf(stderr, "N = %ld, Q = %ld\n", N, Q);
  
  char *S = malloc((size_t)N + 1);
  fgets(S, N + 1, stdin);
  S[N] = '\0';

  int64_t R[N];
  memset(R, 0, 8 * N);
  for (int i = 0; i < N - 1; i++) {
    R[i + 1] = R[i] + (((S[i] == 'A') && (S[i + 1] == 'C')) ? 1 : 0);
  }

  int64_t l, r, res;

  for (int i = 0; i < Q; i++) {
    scanf("%ld %ld", &l, &r);
    res = R[r - 1] - R[l - 1];
    printf("%lu\n", res);
  }

  /*
  // Bad code! TLE
  for (int i = 0; i < Q; i++) {
    memset(buf, 0, sizeof(buf));
    fgets(buf, sizeof(buf), stdin);
    l = strtol(buf, &next, 10);
    r = strtol(next + 1, NULL, 10);
    res = solve(S + l - 1, S + r - 1);
    printf("%lu\n", res);

  }
  */
  free(S);
  return 0;
}

int64_t solve(char *begin, char *end) {
  int64_t res = 0;
  for (; begin < end; begin++) {
    if ((begin[0] == 'A') && (begin[1] == 'C')) {
      res++;
      begin++;
    }
  }
  return res;
}



Measured memory_bytes: 1664
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;
using namespace std;
int dis[110][110],p[110][110];
typedef pair<int,pair<int,int> >P;
priority_queue<P,vector<P>,greater<P> >Q;
void Qpush(int a,int b,int c){Q.push(make_pair(a,make_pair(b,c)));}
int main(){
  int h,w;
  while(cin>>w>>h&&h+w){
    lol(i,h)lol(j,w){
      char z;cin>>z;
      if(z=='&')Qpush(0,i,j);
      if(z=='#')p[i][j]=1;
      else p[i][j]=0;
      dis[i][j]=mod;
    }
    while(!Q.empty()){
      int cost=Q.top().first;
      int y=Q.top().second.first;
      int x=Q.top().second.second;
      Q.pop();
      if(dis[y][x]<=cost)continue;
      dis[y][x]=cost;
      int dx[]={-1,0,1,0},dy[]={0,1,0,-1};
      lol(i,4){
	int xx=x+dx[i],yy=y+dy[i];
	if(xx<0||xx==w||yy<0||yy==h)continue;
	int newcost=cost+(p[y][x]!=p[yy][xx]);
	if(dis[yy][xx]>newcost)Qpush(newcost,yy,xx);
      }
    }
    int ans=mod;
    for(int i=0;i<h;i++)ans=min(ans,min(dis[i][0],dis[i][w-1]));
    for(int j=0;j<w;j++)ans=min(ans,min(dis[0][j],dis[h-1][j]));
    cout<<(ans+1)/2<<endl;
  }
  return 0;
}

Measured memory_bytes: 3224
# -*- coding: utf-8 -*-

from collections import deque


if __name__ == '__main__':

    n = int(input())
    E = [set() for _ in range(n)]
    for _ in range(n - 1):
        s, t, d = map(int, input().split())
        E[s].add((t, d))
        E[t].add((s, d))

    Q = deque()

    def bfs(s):
        d = [float("inf")] * n
        Q.append(s)
        d[s] = 0
        while Q:
            u = Q.popleft()
            for v, w in E[u]:
                if d[v] == float("inf"):
                    d[v] = d[u] + w
                    Q.append(v)

        return d

    d = bfs(0)
    tgt = d.index(max(d))
    d = bfs(tgt)
    print(max(d))



Measured memory_bytes: 58328
#include<cstdio>
using namespace std;
int n,t[110],m,Pi,Xi,Time;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&t[i]);
		Time=Time+t[i];
	}
	scanf("%d",&m);
	for(int i=1;i<=m;i++){
		scanf("%d%d",&Pi,&Xi);
		printf("%d\n",Time-t[Pi]+Xi);
	}
	//AC!
	return 0;
}

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

// ---- ----

int f(int n) { return n * (n + 1) / 2; }

int main() {
	int k, s;
	cin >> k >> s;
	
	if(s >= 2 * k) { s = 3 * k - s; }
	
	int ans = f(s + 1);
	if(s > k) { ans -= 3 * f(s - k); }
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
const double EPS = 1e-9;
typedef pair<int, int> P;
typedef unsigned int ui;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
int main() {
	int n; ll k; cin >> n >> k;
	ll out = 0;
	rep(i, n - 1) {
		ll r = out / (k - 1); ll u = out % (k - 1);
		out = r * k + u + 1;
	}
	cout << out << endl;
	return 0;
}


Measured memory_bytes: 3116
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

N, M = map(int, input().split())
A = list(map(int, input().split()))

B = {}
s = 0
ans = 0
B[0] = 1
for a in A:
    s = (s + a) % M
    ans += B.get(s, 0)
    B[s] = B.get(s, 0) + 1

print(ans)


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

int main(void){
    long long N;
    cin >> N;
    
    long long mintime = 10000000000000000;
    for (int i = 0; i < 5; i++){
        long long num;
        cin >> num;
        mintime = min(mintime, num);
    }
    
    long long ans = (N + mintime - 1) / mintime + 4;
    
    cout << ans << endl;
}

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

using ll = long long;
// #define int long long

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, r, n) for (int i = (r); i < (n); ++i)
#define REPR(i, n) for(int i = (n); i >= 0; --i) // from n to 0
#define REPRS(i, r, n) for(int i = (n); i >= (r); --i) // from n to r
#define COUTB(x) cout << (x) << "\n"
#define COUTS(x) cout << (x) << " "
#define PB push_back
#define SORT(obj) sort((obj).begin(), (obj).end())
#define SORTR(obj) sort((obj).begin(), (obj).end(), greater<>())
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define PI (acos(-1))

int getDigit(int n) {
  return to_string(n).length();
}

/***** MAIN *****/
signed main() {
  int n, ans=0;
  bool continueFlag = false;
  cin >> n;
  int boxes[n];
  REP(i,n) scanf("%d", &boxes[i]);
  if(n == 1) {
    cout << "Yes\n";
    return 0;
  }
  REPS(i,1,n) {
    int upDiff = boxes[i] - boxes[i-1];
    if(upDiff <= -2) {
      cout << "No\n";
      return 0;
    } else if(upDiff <= -1) {
      if(continueFlag) {
        cout << "No\n";
        return 0;
      }
      continueFlag = true;
    } else if(upDiff > 0) {
      continueFlag = false;
    }
  }
  cout << "Yes";
  cout << "\n";
  return 0;
}
/***** MAIN *****/


Measured memory_bytes: 640
#!/usr/bin/env python3
import sys


def solve(S: str):
    if S== "ABC":
        print("ARC")
    else:
        print('ABC')
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()


Measured memory_bytes: 9104
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
#define LL long long
int h,w,n,cnt;
LL k,ans,p;
int ask(int a,int b,int c,int d){
	cout<<"? "<<a<<" "<<b<<" "<<c<<" "<<d<<"\n"<<flush;
	int res;
	cin>>res;
	return res;
}
int main() {
	cin>>h>>w>>n>>k;
	p=1;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			int flag=ask(i,j,i,j);
			cnt+=flag;
			if(flag)ans=(ans+p)%k;
			if(cnt==n)break;	
			p=p*2%k;
		}
	}
	cout<<"! "<<ans<<"\n"<<flush;
    return 0;
}

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

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

    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a.at(i);
    }

    int tmp, l = 0, c = 0;
    for (int i = 0; i < n; i++) {
        c++;
        tmp = a.at(l);
        if (tmp == 2) break;
        l = tmp - 1;
    }

    if (tmp == 2) {
        cout << c << endl;
    } else {
        cout << -1 << endl;
    }

    return 0;
}


Measured memory_bytes: 3792
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#include <tuple>

//#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back

int main() {
  int N,M,k,a;
  cin >> N >> M;
  vector<int> food(M,0);

  for(int i=0;i<N;i++){
      cin >> k;
      for(int j=0;j<k; j++){
          cin >> a;
          food[a-1]+=1;
      }
  }

  int cnt = 0;
  for(int i=0;i<M;i++){
    //   cout << i << ": food:" << food[i] << endl;
      if(N == food[i]) cnt++;
  }
  
  cout << cnt << endl;

}


Measured memory_bytes: 256
N=int(input())
H=list(map(int,input().split()))
H.reverse()
for i in range(N-1):
  diff=H[i+1]-H[i]
  if diff==1:
    H[i+1]-=1
  elif diff>1:
    print('No')
    exit()
  else:
    pass
print('Yes')


Measured memory_bytes: 20740
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>
#include <list>

using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ll> pdl;
typedef pair<ld, ld> pdd;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
//typedef boost::multiprecision::cpp_int bigint;

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	string S;
	cin >> S;
	if (S == string("SUN"))cout << "7\n";
	else if (S == string("MON"))cout << "6\n";
	else if (S == string("TUE"))cout << "5\n";
	else if (S == string("WED"))cout << "4\n";
	else if (S == string("THU"))cout << "3\n";
	else if (S == string("FRI"))cout << "2\n";
	else if (S == string("SAT"))cout << "1\n";

	return 0;
}

Measured memory_bytes: 256
a,b = gets.chomp.split(' ').map(&:to_i)
s = gets.chomp.chars
i = 0
while i < a
  unless /["0""1""2""3""4""5""6""7""8""9"]/ =~ s[i]
    ans = "No"
    break
  end
  i += 1
end
if s[i] != "-"
  ans = "No"
end
i += 1
while i < a + b + 1
  unless /["0""1""2""3""4""5""6""7""8""9"9"]/ =~ s[i]
    ans = "No"
    break
  end
  i += 1
end
if ans == "No"
  puts ans
else
  puts "Yes"
end


Measured memory_bytes: 14308
#include <iostream>
using namespace std;
int main()
{
  int A, B ,c ;
  cin>>A;
  cin>>B;
{
 if(A>=13)
      cout<<B;
  else if (A>=6&&A<=12 ){
     c=B/2;
      cout<<c;
  }

  else
      cout<< 0;
}



        return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

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

		int a = sc.nextInt();
		int ans = 0;

		ans = a + (int)Math.pow(a, 2) + (int)Math.pow(a, 3);

		System.out.println(ans);
	}

	private static class FastScanner {
		private BufferedReader reader = null;
		private StringTokenizer tokenizer = null;

		public FastScanner(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
			tokenizer = null;
		}

		public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

	}
}


Measured memory_bytes: 32736
N, Q = map(int, input().split())
E = [[] for _ in range(N)]
C = [0] * N
C[0] = 0
for _ in range(N - 1):
  a, b = map(int, input().split())
  E[a - 1].append(b - 1)
  E[b - 1].append(a - 1)
for _ in range(Q):
  p, x = map(int, input().split())
  C[p - 1] += x
D = [-1] * N
D[0] = 0
Q = [0] * N
enq = 0
for pos in range(N):
  q = Q[pos]
  for adj in E[q]:
    if D[adj] >= 0:
      continue
    D[adj] = D[q] + 1
    C[adj] += C[q]
    enq += 1
    Q[enq] = adj
print(' '.join([str(c) for c in C]))

Measured memory_bytes: 74776
from fractions import gcd


def main():
    A, B, C, D = map(int, input().split())
    Q_AC, R_AC = A // C, A % C
    Q_AD, R_AD = A // D, A % D
    Q_BC, R_BC = B // C, B % C
    Q_BD, R_BD = B // D, B % D
    Q_ACD, R_ACD = A // lcm(C, D), A % lcm(C, D)
    Q_BCD, R_BCD = B // lcm(C, D), B % lcm(C, D)
    N_C = num_baisu(Q_AC, Q_BC, R_AC, R_BC)
    N_D = num_baisu(Q_AD, Q_BD, R_AD, R_BD)
    N_CD = num_baisu(Q_ACD, Q_BCD, R_ACD, R_BCD)
    print(B - A + 1 - (N_C + N_D - N_CD))
    return


def lcm(x, y):
    return (x * y) // gcd(x, y)


def num_baisu(Q_A, Q_B, R_A, R_B):
    if R_A == 0 and R_B == 0:
        return Q_B - Q_A + 1
    elif R_A == 0 and R_B != 0:
        return Q_B - Q_A + 1
    elif R_A != 0 and R_B == 0:
        return Q_B - (Q_A + 1) + 1
    else:
        return Q_B - (Q_A + 1) + 1


if __name__ == "__main__":
    main()


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

int main()
{
  vector<int> X(5);

  for (int i = 0; i < 5; i++)
    cin >> X.at(i);

  for (int i = 0; i < 5; i++)
  {
    if (X.at(i) == 0)
      cout << (i + 1) << endl;
  }
}


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

using namespace std;
using LL = long long;
using P = pair<int, int>;

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

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e15;
const int MOD = 1e9 + 7;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

vector<int> sum1(100005, 0), sum2(100005, 0);

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    vector<int> a(3*n);
    REP(i, 3*n) cin >> a[i];

    priority_queue<int, vector<int>, greater<int>> pq1;
    priority_queue<int> pq2;
   
    int sum = 0;
    REP(i, n) sum += a[i], pq1.push(a[i]);
    sum1[0] = sum;

    REP(i, n){
        pq1.push(a[i+n]);
        sum += a[i+n];
        sum -= pq1.top();
        pq1.pop();
        sum1[i+1] = sum;
    }

    sum = 0;
    REP(i, n) sum += a[3*n-i-1], pq2.push(a[3*n-i-1]);
    sum2[n] = sum; 
    REP(i, n){
        pq2.push(a[2*n-i-1]);
        sum += a[2*n-i-1];
        sum -= pq2.top();
        pq2.pop();
        sum2[n-i-1] = sum;
    }

    int ans = -INFL;
    REP(i, n+1) ans = max(ans, sum1[i] - sum2[i]);

    cout << ans << endl;
}


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

int main(){
 int N,D[100],a;
  int i,j;
  cin>>N;
  for(i=0;i<N;i++){
    cin>>D[i];
  }
  for(j=0;j<N-1;j++){
   for(i=j+1;i<N;i++){
     a +=D[j]*D[i];
   }
  }
  cout<<a<<endl;
}

Measured memory_bytes: 256
D = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(D)]

types = []
last = [-1] * 26
S = 0
for d in range(D):
    # search type
    M = -float('inf')
    for tt in range(26):
        _last = last[:]
        tmp = s[d][tt]

        _last[tt] = d
        for i in range(26):
            tmp -= c[i] * (d - _last[i])

        if tmp > M:
            M = tmp
            M_tt = tt

    S += s[d][M_tt]

    last[M_tt] = d
    for i in range(26):
        S -= c[i] * (d - last[i])
    types.append(M_tt)


last = [-1] * 26
S = 0
for d in range(D):
    seq = []
    for tt in range(26):
        _last = last[:]
        tmp = s[d][tt]

        _last[tt] = d
        for i in range(26):
            tmp -= c[i] * (d - _last[i])

        seq.append([tmp, tt])

    seq.sort(reverse=True)

    tmpmax = -float('inf')
    for i in range(15):
        tt = seq[i][1]
        _last = last[:]
        _types = types[:]
        _types[d] = tt
        _S = S

        for dd in range(d, D):
            _S += s[dd][_types[dd]]
            _last[_types[dd]] = dd
            for i in range(26):
                _S -= c[i] * (dd - _last[i])

        if _S > tmpmax:
            cand = tt
            tmpmax  = _S

    S += s[d][cand]
    last[cand] = d
    for i in range(26):
        S -= c[i] * (d - last[i])

    print(cand + 1)


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

typedef pair<int, int> ii;
typedef pair<ll, ll> pll;

int main( int argc, char *argv[] ) {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	string o, e;

	cin >> o >> e;
	for ( int i = 0 ; i < e.size() ; i++ ){
		cout << o[i] << e[i];
	}
	if ( o.size() > e.size() )
		cout << o.back();
	cout << "\n";

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
 
int main() {
  //int A, j = 0, l = 0, k= 0, f = 0;
  int A, sum = 0;
  cin >> A;
 
  // ここにプログラムを追記
    rep(i ,A) {
      int B , C;
      cin >> B >> C;
      
      sum = sum + C - B + 1;
      
  	}
    	cout << sum;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stdlib.h>
#include <map>
#define MOD_P 1000000007
#define ll long long
using namespace std;



int main()
{
	int n;
	cin >> n;
	vector<int> mons(n + 1);
	vector<int> atk(n);
	for (int i = 0; i < n + 1; i++) {
		cin >> mons[i];
	}
	for (int i = 0; i < n; i++) {
		cin >> atk[i];
	}
	int remain = 0;
	ll int sum = 0LL;

	for (int i = 0; i < n; i++) {
		if (remain >= mons[i]) {
			//printf("case:0");
			sum += (ll int)mons[i];
			remain = atk[i];
		} else if (remain + atk[i] < mons[i]) {
			//printf("case:1");
			sum += (ll int)remain + (ll int)atk[i];
			remain = 0;
		} else {
			//printf("case:2");
			sum += (ll int)mons[i];
			remain = remain + atk[i] - mons[i];
		}
		//printf("[%d,%lld]\n", remain, sum);
	}

	sum += min(mons[n], remain);

	printf("%lld", sum);

	return 0;
}

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

int main()
{
  int N;

  cin >> N;

  vector<string> S(N);

  for (int i = 0; i < N; i++)
  {
    cin >> S.at(i);
  }

  int count = 1;

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

  for (int i = 0; i < N - 1; i++)
  {
    if (S.at(i) == S.at(i + 1))
    {
    }
    else
    {
      count++;
    }
  }

  cout << count << endl;
}


Measured memory_bytes: 9524
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <utility>
#include <numeric>

using namespace std;

const uint64_t MOD = 1000000000 + 7;

int h, w;

void check(int x, int y, vector<vector<string>> &m)
{
	int p[] = { -1, 0, 1 , 0 };
	int q[] = { 0, -1, 0 , 1 };

	for (int i = 0; i < 4; i++)
	{
		for (int j = 0; j < 4; j++)
		{
			if (x + q[i] < 0 || x + q[i] >= w || y + p[i] < 0 || y + p[i] >= h)
			{
				continue;
			}
			if (m.at(y + p[i]).at(x + q[i]) == "#")
			{
				m.at(y + p[i]).at(x + q[i]) = ".";
				check(x + q[i], y + p[i], m);
			}
		}
	}
}

int main()
{
	cin >> h >> w;

	vector<vector<string>> m(h, vector<string>(w));
	for (int i = 0; i < h; i++)
	{
		string s;
		cin >> s;
		for (int j = 0; j < w; j++)
		{
			m.at(i).at(j) = s.substr(j, 1);
		}
	}

	for (int i = 0; i < h; i++)
	{
		for (int j = 0; j < w; j++)
		{
			if (m.at(i).at(j) == "#")
			{
				check(j, i, m);
			}
		}
	}

	bool ok = true;
	for (int i = 0; i < h; i++)
	{
		for (int j = 0; j < w; j++)
		{
			if (m.at(i).at(j) == "#")
			{
				ok = false;
				break;
			}
		}

		if (!ok)
		{
			break;
		}
	}

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


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

int main() {
 	int n;
  int l[2001];
  int bucket[1001];
  cin >> n;
  for(int i=1; i<=1000; i++){
    bucket[i] = 0;
  }
  for(int i=1; i<=n; i++){
    cin >> l[i];
    bucket[l[i]] += 1;
  }
  for(int i=1; i<=n; i++){
    for(int j=1; j<=1000; j++){
      if(bucket[j] > 0){
        l[i] = j;
        bucket[j] -= 1;
        break;
      }
    }
  }
  int ans = 0;
  for(int i=1; i<=n-2; i++){
    for(int j=i+1; j<=n-1; j++){
      for(int k=j+1; k<=n; k++){
        if(l[i] + l[j] <= l[k]){
          break;
        }else{
          ans += 1;
        }
      }
    }
  }
  cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 256
# coding: utf-8
# Your code here!

from bisect import bisect_left
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    n = int(readline())
    S = [int(i) for i in readline().split()]
    q = int(readline())
    T = [int(i) for i in readline().split()]
    
    ans = 0
    for t in T:
        x = bisect_left(S, t)
        if x == n:
            if S[-1] == t:
                ans += 1
        else:
            if S[x] == t:
                ans += 1
    
    print(ans)
    

if __name__ == "__main__":
    main()



Measured memory_bytes: 16396
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        int x = Integer.parseInt(sc.next());
        int v = a*a*b;
        
        if(x < v/2.0){
            System.out.println(Math.toDegrees(Math.atan((double)(a*b*b)/(2*x))));
        }else{
            double tan = (double)(2.0*(v-x))/(a*a*a);
            System.out.println(Math.toDegrees(Math.atan(tan)));
        }
    }
    
}

Measured memory_bytes: 23764
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
#include <set>

using namespace std;

typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define Fst first
#define Snd second
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)
#define repv(t,it,v) for(vector<t>::iterator it = v.begin() ; it != v.end() ; ++it)

char s[100010];
bool b[100010];
int n;
const char a[2][10] = {"dream" , "erase"};

int main(){
	scanf("%s" , s);
	for(; s[n] != 0 ; ++n);
	b[0] = 1;
	repp(i,0,n){
		if(!b[i]) continue;
		repp(j,0,5){
			if(s[i+j] != a[0][j]) break;
			if(j == 4){
				b[i+5] = 1;
				if(s[i+5] == 'e' && s[i+6] == 'r'){
					b[i+7] = 1;
				}
			}
		}
		repp(j,0,5){
			if(s[i+j] != a[1][j]) break;
			if(j == 4){
				b[i+5] = 1;
				if(s[i+5] == 'r'){
					b[i+6] = 1;
				}
			}
		}
	}
	printf("%s\n" , b[n] ? "YES" : "NO");
	return 0;
}


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

int main(int argc, char const *argv[]) {
  int n, q, k=0;
  scanf("%d %d\n", &n, &q);

  char str[n+1];
  scanf("%s\n", str);

  int mem[n];
  mem[0] = 0;

  for (int i = 1; i < n; i++) {
    if(str[i] == 'C' && str[i-1] == 'A') k++;
    mem[i] = k;
  }

  for (int i = 0; i < q; i++) {
    int l, r;
    scanf("%d %d\n", &l, &r);
    // debug
    // printf("debug: %d %d\n", mem[l-1], mem[r-1]);
    printf("%d\n", mem[r-1]-mem[l-1]);
  }

  return 0;
}


Measured memory_bytes: 1280
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>

int main(){
    int r, g;
    std::cin>>r>>g;

    std::cout<<(2 * g - r)<<std::endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
#define int long long
const int INF = (1LL << 60);
using namespace std;


class Edge{
	public:
		int to, cost;
		Edge(int to, int cost) : to(to) ,cost(cost) {}
};

class Node{
	public:
		int dis;
		bool isUsed;
		Node(){
			this->dis = INF;
			this->isUsed = 0;
		}
};

typedef vector<vector<Edge>> AdjList;

void dijkstra_max(AdjList& g, int start, int n, vector<Node>& node){
	priority_queue<pair<int, int>> q;

	q.push(make_pair(0, start));
	node[start].dis = 0;

	pair<int, int> u;
	while(not q.empty()){
		u = q.top(); q.pop();
		int current = u.second;
		node[current].isUsed = 1;

		rep(i,g[current].size()){
			int next = g[current][i].to;
			if(node[next].isUsed == 0){
				if(node[next].dis > node[current].dis + g[current][i].cost){
					node[next].dis = node[current].dis + g[current][i].cost;
					q.push(make_pair(node[next].dis, next));
				}
			}
		}
	}
}
bool f;

void dijkstra_min(AdjList& g, int start, int n, vector<Node>& node){
	priority_queue<int, vector<pair<int, int>>, greater<pair<int, int>>> q;

	q.push(make_pair(0, start));
	node[start].dis = 0;
		node[start].isUsed = 1;

	pair<int, int> u;
	while(not q.empty()){
		u = q.top(); q.pop();
		int current = u.second;

		rep(i,g[current].size()){
			int next = g[current][i].to;
			if(node[next].isUsed == 0){
				if(node[next].dis > node[current].dis + g[current][i].cost){
					node[next].isUsed = 1;
					node[next].dis = node[current].dis + g[current][i].cost;
					q.push(make_pair(node[next].dis, next));
				}
			}else{
				if(node[next].dis != node[current].dis + g[current][i].cost){
					f = false;
				}
			}
		}
	}
}


const int MAX_V = 100005;

vector<int> g[MAX_V]; //グラフ
vector<int> tp; //トポロジカルソートの結果

void bfs(int s, int indeg[MAX_V], bool used[MAX_V]){
	queue<int> q;

	q.push(s);
	used[s] = true;

	while(not q.empty()){
		int u = q.front(); q.pop();
		tp.emplace_back(u);
		rep(i,g[u].size()){
			int v = g[u][i];
			indeg[v]--;
			if(indeg[v] == 0 && not used[v]){
				used[v] = true;
				q.push(v);
			}
		}
	}
}

//グラフに閉路がある場合、0を返す
bool topologicalSort(int v){
	int indeg[MAX_V]; //入次数
	bool used[MAX_V];
	memset(indeg, 0, sizeof(indeg));
	memset(used, 0, sizeof(used));

	rep(i,v) rep(j,g[i].size()) indeg[ g[i][j] ]++;
	rep(i,v) if(indeg[i] == 0 && not used[i]) bfs(i, indeg, used);

	if(tp.size() == v) return true;
	else return false;
}

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

	AdjList ag(n);
	rep(i,m){
		int l, r, c;
		cin >> l >> r >> c;
		l--; r--;
		ag[l].emplace_back(r,c);
		g[l].emplace_back(r);
	}
	if(not topologicalSort(n)){
		cout << "No" << endl;
		return 0;
	}

	f = true;
	vector<Node> maxi(n), mini(n);
	rep(i,n){
		if(maxi[tp[i]].isUsed) continue;
		dijkstra_max(ag, tp[i], n, maxi);
		dijkstra_min(ag, tp[i], n, mini);
	}
	rep(i,n){
		if(maxi[i].dis != mini[i].dis or maxi[i].dis > 1e9 or not f){
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}


Measured memory_bytes: 20692
#include <stdio.h>

int main(int argc, char const *argv[]) {
	char str[101];
	int n, m;
	int ans;

	fgets(str, 100, stdin);
	sscanf(str, "%d %d\n", &n, &m);

	ans = n - m + 1;

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

	return 0;
}


Measured memory_bytes: 128
#[allow(unused_imports)]
use std::cmp::Ordering;

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get {
    ([$t: ty]) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}
fn gcd(a: usize, b: usize) -> usize {
    if a == usize::default() {
        b
    } else {
        gcd(b % a, a)
    }
}

fn solve() {
    let k = get!(usize);
    let mut sum = 0usize;
    for i in 1..k + 1 {
        for j in 1..k + 1 {
            for l in 1..k + 1 {
                sum += gcd(gcd(i, j), l);
            }
        }
    }
    println!("{}", sum);
}


Measured memory_bytes: 2236
#include <stdio.h>

#define MIN(a,b) (((a)>(b))?(b):(a))
#define MAX(a,b) (((a)>(b))?(a):(b))

int main(void)
{
    //for debug
    FILE *fin, *fout;
//#define DEBUG
#ifdef DEBUG
    fin=fopen("input.txt","r");
    fout=fopen("output.txt","w");
#else
    fin=stdin; fout=stdout;
#endif

    //process all input data
    while(feof(fin)==0){
        int a,b;
        fscanf(fin,"%d %d\n",&a,&b);
        int i;
        //gcd is at least 1
        int gcd=1;

        //either a or b can be divided by the other
        if(MAX(a,b)%MIN(a,b)==0){
            gcd=MIN(a,b);
        }
        //otherwise, gcd is ranging between 1..minimum of a,b
        else{
            for(i=MIN(a,b)/2;i>=1;i--){
                //gcd found
                if(a%i==0 && b%i==0){ 
                    gcd=i;
                    break;
                }
            }
        }
        //calc lcm
        long long int lcm=gcd*(a/gcd)*(b/gcd);
        //write result
        fprintf(fout,"%d %lld\n",gcd,lcm);
    }


    return 0;
}

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


#define M 1000000007
#define pb push_back
#define mp make_pair
#define s second
#define f first
#define mod 998244353
#define sz(v) (int)(v).size()

#define pii pair<int, int>
#define vi vector<int>
#define ll long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(0)

ll add(ll a,ll b)
{
	a%=M;
	b%=M;
	ll p = (a+b)%M;
	return (p+M)%M;
}

ll mul(ll a,ll b)
{
	a%=M;
	b%=M;
	ll p = (a*b)%M;
	return (p+M)%M;
}


int main()
{
	fastio;
	ll i,n,a[200];
	cin>>n;
	ll ans=0;
	for(i=1;i<=n;i++)
	{
		cin>>a[i];
		if((i%2)&&(a[i]%2))
			ans++;
	}
	cout<<ans<<endl;
    return 0;
}





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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define TR(X) ({ if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

const ll N = 1 << 18, K = 9, W = 1e5 + 10;
//const ll N = 1 << 4, K = 2, W = 1000;
ll v[N], w[N], dp[1 << K][W];
ll sv[1 << K], sw[1 << K];

void fill_sums(const vl &a) {
	FOR(k,0,sz(a)) FOR(mask,0,1 << k) {
		sv[mask|(1 << k)] = sv[mask] + v[a[k]];
		sw[mask|(1 << k)] = sw[mask] + w[a[k]];
	}
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	ll n; cin >> n;
	FOR(i,1,n+1) cin >> v[i] >> w[i];
	
	FOR(i,1,1 << K) {
		vl a;
		FOR(k,0,K) if (i >> k) a.pb(i >> k);
		fill_sums(a);
		FOR(mask,0,1 << sz(a)) if (sw[mask] < W) {
			dp[i][sw[mask]] = max(dp[i][sw[mask]], sv[mask]);
		}
		FOR(sw,0,W-1) dp[i][sw+1] = max(dp[i][sw+1], dp[i][sw]);
	}
	
	ll q; cin >> q;
	while (q--) {
		ll i, L, j;
		cin >> i >> L;
		vl a;
		for (j = i; j >= (1 << K); j /= 2) a.pb(j);
		fill_sums(a);
	
		ll res = 0;
		FOR(mask,0,1 << sz(a)) if (sw[mask] <= L) {
			res = max(res, sv[mask] + dp[j][L-sw[mask]]);
		}
		cout << res << '\n';
	}
}



Measured memory_bytes: 407040
#include <bits/stdc++.h>
using namespace std;
using lint     = long long;
const lint inf = 1LL << 60;
const lint mod = 1000000007;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    lint x, y;
    cin >> x >> y;
    if (abs(x - y) >= 2) {
        cout << "Alice"
             << "\n";
    } else {
        cout << "Brown"
             << "\n";
    }
    return 0;
}

Measured memory_bytes: 256
//go:generate echo "https://atcoder.jp/contests/dp/tasks/dp_a"
package main

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

type scanner struct{ *bufio.Scanner }

func newScanner(r io.Reader) *scanner {
	s := bufio.NewScanner(r)
	s.Split(bufio.ScanWords)
	s.Buffer(nil, 100000000)
	return &scanner{s}
}

func (s *scanner) Int() int {
	s.Scan()
	n, _ := strconv.Atoi(s.Text())
	return n
}

func (s *scanner) IntSlice(l int) []int {
	if l == 0 {
		return []int{}
	}
	sl := make([]int, l, l)
	for i := range sl {
		sl[i] = s.Int()
	}
	return sl
}

func iabs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func solve(n int, heights []int) int {
	t := make([]int, n+1, n+1)
	for i := range t {
		t[i] = math.MaxInt64
	}

	t[0] = 0
	for i := 1; i < n; i++ {
		if v := t[i-1] + iabs(heights[i]-heights[i-1]); v < t[i] {
			t[i] = v
		}
		if 1 < i {
			if v := t[i-2] + iabs(heights[i]-heights[i-2]); v < t[i] {
				t[i] = v
			}
		}
	}

	return t[n-1]
}

func main() {
	sc := newScanner(os.Stdin)
	n := sc.Int()
	heights := sc.IntSlice(n)
	ans := solve(n, heights)
	fmt.Println(ans)
}


Measured memory_bytes: 3804
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
	int N;
	cin >> N;
	vector<int> A(N);
	for (auto &x : A) {
		cin >> x;
	}
	vector<int> B = A;
	sort(B.rbegin(), B.rend());

	for (int i = 0; i < N; ++i) {
		if (A[i] == B[0]) {
			cout << B[1] << endl;
		}
		else {
			cout << B[0] << endl;
		}
	}
}


Measured memory_bytes: 3200
import os
import heapq
import sys
import math
import operator
from collections import defaultdict
from io import BytesIO, IOBase

"""def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b)"""


# def pw(a,b):
#     result=1
#     while(b>0):
#         if(b%2==1): result*=a
#         a*=a
#         b//=2
#     return result



def inpt():
    return [int(k) for k in input().split()]


def main():
    k = int(input())
    s = input()
    n = len(s)
    ans = 0
    md = 10 ** 9 + 7
    ar26=[1]
    ar25=[1]
    a=1
    b=1
    nn=1
    rr=1
    num=[1]
    rum=[1]
    for i in range(1,n+k+1):
        nn*=i
        nn%=md
        rr*=i
        rr%=md
        num.append(nn)
        rum.append(rr)

    for i in range(k):
        a*=25
        a%=md
        b*=26
        b%=md
        ar26.append(b)
        ar25.append(a)

    for i in range(k+1):
        ans+=(num[n+k-i-1]*pow((rum[n-1]*rum[k-i])%md,md-2,md)*ar26[i]*ar25[k-i])
        ans%=md
    print(ans)

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

if __name__ == "__main__":
    main()


Measured memory_bytes: 205084
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

void solve(int n, int p) {
    vector<int> have(n);
    int now = p;
    int index = 0;
    while(true) {
        if(now > 0) {
            have[index]++;
            now--;
        } else {
            now = have[index];
            have[index] = 0;
        }
        if(have[index] == p) {
            cout << index << endl;
            return;
        }
        index = (index + 1) % n;
    }
}

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(true) {
        int n, p;
        cin >> n >> p;
        if(n == 0 && p == 0) break;
        solve(n, p);
    }
    return 0;
}


Measured memory_bytes: 3128
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;cin>>n;
  vi A(n);
  for(auto &a:A)cin>>a;
  ll now=1;
  for(int i=0;i<n;i++){
    if(A[i]==now)now++;
  }
  if(now==1)cout<<-1<<endl;
  else
  cout<<n-now+1<<endl;
  return 0;
}

Measured memory_bytes: 1792
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String num = br.readLine();
		int k = Integer.parseInt(num);
		System.out.println("ABC"+k);
	}
}

Measured memory_bytes: 23252
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, a, b) for (int i = a; i < (b); i++)
#define FOR(i, n) for (int i = n; i >= 0; i--)
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cstring>
#include <vector>
#define ll long long
#define INF 1000000001;
using namespace std;
struct Edge{int from, to, cost;};

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

    ll Q,H,S,D;
    cin >> Q >> H >> S >> D;
    ll N;
    cin >> N;

    H = min(H, 2*Q);
    S = min(S, 2*H);
    D = min(D, 2*S);

    ll cost = (N/2)*D + (N%2)*S;

    cout << cost << endl;

}

Measured memory_bytes: 256
`use strict`

function Main(input) {
  input = input.trim().split(' ').map(s => parseInt(s))

  const result = input.reduce((a, b) => a + b)
  if(result >= 22) {
    console.log('bust')
  } else {
    console.log('win')
  }
  
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int ans;

int main(){

  string s;
  int n;
  string t[999];

  cin >> s;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> t[i];
    t[i] += t[i];
  }

  for(int i=0;i<n;i++){
    for(int j=0;j<t[i].size()/2;j++){
	bool d = true;
	for(int k=0;k<s.size();k++){
	  if(s[k] != t[i][j+k]) d = false;
	}
	if(d){
	  ans++;
	  break;
	}
    }
  }
  
  cout<< ans << endl;

}

Measured memory_bytes: 1220
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef map<int,int> mii;
typedef vector<int>vi;
#define pb push_back
#define sc(n) scanf("%d",&n)
#define lsc(n) scanf("%lld",&n)
#define all(x) x.begin(),x.end()
#define rep(i,n) for(i=0;i<n;i++)
#define rep1(i,n) for(i=1;i<=n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
#define rev1(i,n) for(i=n;i>0;i--)
#define in insert
#define IT ::iterator
#define pr(n) printf("%d\n",n)
#define lpr(n) printf("%lld\n",n);

  

int main()
{
	ll n,i;
	lsc(n);
	ll a[n];
	ll s=0LL;
	map<ll,ll>mp;
	rep(i,n)
	{
		lsc(a[i]);
		s+=a[i];
		mp[a[i]]++;
	}
	ll q;
	lsc(q);
	while(q--)
	{
		ll b,c;
		lsc(b);lsc(c);
		s-=(mp[b]*b);
		s+=(mp[b]*c);
		mp[c]+=mp[b];
		mp[b]=0LL;
		lpr(s);
	}
    return 0;
}


Measured memory_bytes: 10504
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;

constexpr ll infl = 1000000000000000007LL;
constexpr int inf = 1000000007;

int main() {
    string s;
    cin >> s;
    int ans = s.size();
    for (int i = 0; i < s.size() - 1; ++i) {
        if (s[i] != s[i + 1])
            ans = min(ans, max(i + 1, (int)s.size() - i - 1));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Linq;

class Program {
    static int ReadInt() { return int.Parse(Console.ReadLine()); }
    static int[] ReadInts() { return Console.ReadLine().Split().Select(int.Parse).ToArray(); }
    static string[] ReadStrings() { return Console.ReadLine().Split(); }

    static int F(int a, int b) {
        if (a > b) return int.MaxValue - 2;
        return b - a;
    }

    static int Calc(int x, int y) {
        int a = F(x, y);
        int b = F(-x, y) + 1;
        int c = F(x, -y) + 1;
        int d = F(-x, -y) + 2;
        return new[] { a, b, c, d }.Min();
    }

    static void Main() {
        var xy = ReadInts();
        int x = xy[0];
        int y = xy[1];

        var ans = Calc(x, y);
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 2904
#include <iostream>
#include <string>
#include <stdio.h>
#include <cmath>
#include <cfloat>
#include <algorithm>
#include <numeric>
#include <vector>
#include <iterator>
#include <set>
#include <map>
using namespace std;

const double PI=acos(-1);

int main(){
    string s;
    cin >> s;
    long cnt = 0, wcnt = 0;
    for(long i = 0; i < s.length(); i++){
        if(s[i] == 'W'){
            cnt += i - wcnt;
            wcnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}

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

#define int long long

int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int N;
int L[200];

signed main() {
    cin >> N;
    for (int i = 0; i < 2 * N; i++) {
        cin >> L[i];
    }
    sort(L, L + 2 * N);
    int ans = 0;
    for (int i = 0; i < 2 * N; i += 2) {
        ans += L[i];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
s = gets.chomp

def merge(s, t)
  r = ""
  t.size.times{|i| r += s[i].to_s + t[i].to_s }
  r += s[(t.size)..-1]
  r
end

p (0...(2 ** (s.size - 1))).to_a.map {|i|
  ss = s.clone
  f = i.to_s(2).rjust(s.size - 1, '0').gsub(/1/, '+').gsub(/0/, ' ')
  eval(merge(ss, f).gsub(/\s/, ''))
}.inject(&:+)

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

#include <bits/stdc++.h>
using namespace std;
#define sd(x) scanf("%d", &x)
#define slld(x) scanf("%lld", &x)
#define all(x) x.begin(), x.end()
#define For(i, s, e) for (ll i = s; i < e; i++)
#define pb push_back
#define ll long long
#define mp make_pair

bool comp(pair<ll, ll> a, pair<ll, ll> b)
{
    if (a.second < b.second)
        return true;
    else if (a.second == b.second)
        return a.first < b.first;
    return false;
}
int main()
{
    ll n;
    cin >> n;

    ll ac = 0, wa = 0, tle = 0, re = 0;
    For(i, 0, n)
    {
        string s;
        cin >> s;
        if (s == "AC")
            ac++;
        if (s == "TLE")
            tle++;
        if (s == "WA")
            wa++;
        if (s == "RE")
            re++;
    }
    cout << "AC x " << ac << endl;
    cout << "WA x " << wa << endl;
    cout << "TLE x " << tle << endl;
    cout << "RE x " << re << endl;

    return 0;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
  ll s,p,q;
  cin >> s;
  for(int i = 0; i < s; i++)
  {
      cin>>q;
      if(q==0) p=q;
      else p=__gcd(q,p);
  }
  cout <<p<<endl;
}



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

int main() {
  int N;
  cin >> N;
  
  int FX = 0;
  int X = N;
  while (N > 0) {
    FX += N % 10;
    N /= 10;
  }
  
  string res = "No";
  if (X % FX == 0) res = "Yes";
  
  cout << res << endl;
  
}

Measured memory_bytes: 256