akhauriyash/Code-Regression huggingface dataset:
object Main extends App {
  val sc = new FastScanner(System.in)
  val N, M = sc.nextInt()
  val (acs, was) = LazyList
    .fill(M)(sc.nextInt() -> sc.next())
    .foldLeft((
      scala.collection.mutable.HashMap.empty[Int, Unit],
      scala.collection.mutable.HashMap.empty[Int, Int])
    ) {
      case ((acs, was), (p, "AC")) =>
        if (!acs.contains(p)) acs.update(p, ())
        acs -> was
      case ((acs, was), (p, "WA")) =>
        val penalty = if (acs.contains(p)) was else {
          val count = was.getOrElseUpdate(p, 0)
          was.update(p, count + 1)
          was
        }
        acs -> penalty
    }
  println(s"${acs.size} ${was.filter { case (i, _) => acs.contains(i) }.values.sum}")

  class FastScanner(in: java.io.InputStream) {
    val buffer = new Array[Byte](1024)
    var length = 0
    var p = 0

    def hasNextByte: Boolean =
      if (p < length) true
      else {
        p = 0
        length = in.read(buffer)
        if (length == 0) false else true
      }

    def readByte: Int = if (hasNextByte) buffer({
      p += 1;
      p - 1
    }) else -1

    def isPrintable(n: Int): Boolean = 33 <= n && n <= 126

    def skip(): Unit = while (hasNextByte && !isPrintable(buffer(p))) p += 1

    def hasNext: Boolean = {
      skip()
      hasNextByte
    }

    def next(): String = {
      if (!hasNext) throw new NoSuchElementException
      val sb = new java.lang.StringBuilder
      var temp = readByte
      while (isPrintable(temp)) {
        sb.appendCodePoint(temp)
        temp = readByte
      }
      sb.toString
    }

    def nextInt(): Int = Math.toIntExact(nextLong())

    def nextInts(n: Int): Array[Int] = {
      val ar = new Array[Int](n)
      for (i <- 0 until n) ar(i) = nextInt()
      ar
    }

    def nextLong(): Int = {
      if (!hasNext) throw new NoSuchElementException
      var minus = false
      var temp = readByte
      if (temp == '-') {
        minus = true
        temp = readByte
      }
      if (temp < '0' || '9' < temp) throw new NumberFormatException
      var n = 0
      while (isPrintable(temp)) {
        if ('0' <= temp && temp <= '9') {
          n *= 10
          n += temp - '0'
        }
        temp = readByte
      }
      if (minus) -n else n
    }
  }

}


Measured memory_bytes: 61112
#include<stdio.h>
int main(void)
{
    int i,j;
    int y;

    for(i=1;i<=9;i++){
        for(j=1;j<=9;j++){
            y=i*j;
            printf("%dx%d=%d\n",i,j,y);
        }
    }

    return 0;
}

Measured memory_bytes: 524
#include<bits/stdc++.h>
#define ll long long int
#define ul unsigned long long int
#define va vector<long long int> a 
#define vb vector<long long int> b
const ll M = 1e9+7;
const ll inf = 1e18+5;
const ll INF=INT_MAX;
using namespace std;
void fast(){cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);}
ll bs(ll arr[], ll l, ll r, ll x){
	ll mid=0;
    if (r >= l){
		if (arr[mid] == x) return mid; 
        if (arr[mid] > x) return bs(arr, l, mid - 1, x); 
        return bs(arr, mid + 1, r, x); 
    }
    return -1;
}
ll power(ll x,ul y,ll p){
	ll res = 1;
	x = x % p;
	if(x == 0) return 0;
	while (y > 0){
		if (y & 1) res = (res*x) % p;
		y = y>>1;
		x = (x*x) % p;
		}
	return res;
}
ll arr[500000],st[500000];
void buildtree(int si,int ss,int se){
	if(ss==se){
		st[si]=arr[ss];
		return;
	}
	int mid=ss+(se-ss)/2;
	buildtree(2*si,ss,mid);
	buildtree(2*si+1,mid+1,se);
	st[si]=min(st[2*si],st[2*si+1]);
}
int query(int si,int ss,int se,int qs,int qe){
	if(qs>se || qe<ss) //completely outside
		return INF;
	if(ss>=qs && se<=qe)
		return st[si];
	int mid=ss+(se-ss)/2;
	int l=query(2*si,ss,mid,qs,qe);
	int r=query(2*si+1,mid+1,se,qs,qe);
	return min(l,r);
}
void update(int si,int ss,int se,int qi){
	if(ss==se){
		st[si]=arr[ss];
		return;
	}
	int mid=ss+(se-ss)/2;
	if(qi<=mid) update(2*si,ss,mid,qi);
	else update(2*si+1,mid+1,se,qi);
	st[si]=min(st[2*si],st[2*si+1]);
}

void solve(){
	ll a,b,c,k;
	cin>>a>>b>>c>>k;
	while(b<=a && k!=0){ b*=2;  k--;}
	while(k!=0){ c*=2; k--;}
	if(b>a && c>b) cout<<"Yes\n";
	else cout<<"No\n";
 }
int main(){
	fast();
	solve();
	return 0;
}


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

int xy[3000][3000];
int yx[3000][3000];
int main() {
    int h, w;
    cin >> h >> w;
    string s[h];
    for (int i = 0; i < h; i++) cin >> s[i];
    int ans = 0;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (s[i][j] == '.') xy[i][j]++;
        }
        for (int j = w - 1; j >= 1; j--) {
            if (s[i][j - 1] == '#' || s[i][j] == '#') continue;
            xy[i][j - 1] += xy[i][j];
        }
        for (int j = 0; j < w - 1; j++) {
            if (s[i][j] == '#' || s[i][j + 1] == '#') continue;
            xy[i][j + 1] = xy[i][j];
        }
    }
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (s[i][j] == '.') yx[i][j]++;
        }
    }
    for (int i = 0; i < w; i++) {
        for (int j = h - 1; j >= 1; j--) {
            if (s[j - 1][i] == '#' || s[j][i] == '#') continue;
            yx[j - 1][i] += yx[j][i];
        }
        for (int j = 0; j < h - 1; j++) {
            if (s[j][i] == '#' || s[j + 1][i] == '#') continue;
            yx[j + 1][i] = yx[j][i];
        }
    }
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (s[i][j] == '.') {
                ans = max(ans, xy[i][j] + yx[i][j] - 1);
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 53504
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    s = input()
    if s[2] == s[3] and s[4] == s[5]:
        print("Yes")
    else:
        print("No")
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 38384
$n = gets.chomp.to_i
str = gets.chomp


# 65が起点
def change_chr(str,n)
  i = str.codepoints[0]
  shift = ((i-65) + n) % 26
  (65+ shift).chr
end

puts str.split("").map{|elem| change_chr(elem,$n)}.inject(&:+)


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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}

bool possible(ll A, ll B, ll K) {
  ll s = max(1LL, K/2 - 100);
  ll t = min(K/2 + 100, K);
  ll p = 0;
  for (ll i = s; i <= t; i++) {
    ll x = i;
    ll y = K+1-i;
    if (x >= A) x++;
    if (y >= B) y++;
    chmax(p, x * y);
  }
  return p < A*B;
}


int main2() {
  int Q = nextInt();
  while(Q-->0) {
    ll A = nextInt();
    ll B = nextInt();
    ll lo = 0;
    ll hi = 2 * max(A, B) + 10;
    while (hi - lo > 1) {
      ll mid = (hi + lo) / 2;
      if (possible(A, B, mid)) lo = mid; else hi = mid;
    }
    cout << lo << endl;
  }
  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws)
    main2();
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
char mat[1005][1005];
int n,m;
int dx[] = {-1,1,0,0};
int dy[] = {0,0,1,-1};

bool safe(int x,int y){
    return (x>=0 && x<n && y>=0 && y<m && mat[x][y]=='.');
}

int32_t main(){
	ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
////////////////////////////////

    cin >> n >> m;

    int startx,endx,starty,endy;
    cin >> startx >> starty >> endx >> endy;

    startx--;
    starty--;
    endy--;
    endx--;

    for (int i=0;i<n;i++)
        for (int j=0;j<m;j++) cin >> mat[i][j];

    int dist[n][m];
    for (int i=0;i<n;i++)
        for (int j=0;j<m;j++) dist[i][j] = 1e9;

    deque<pair<int,int>>dq;
    dist[startx][starty]=0;
    dq.push_back(make_pair(startx,starty));

    while (!dq.empty()){

        auto it = dq.front();
        dq.pop_front();

        for (int i=0;i<4;i++){
            int newx = it.first + dx[i];
            int newy = it.second + dy[i];

            if (safe(newx,newy) && dist[newx][newy] > dist[it.first][it.second]){
                dist[newx][newy] = dist[it.first][it.second];
                dq.push_front(make_pair(newx,newy));
            }
        }

        for (int i=it.first-2;i<=it.first+2;i++)
            for (int j=it.second-2;j<=it.second+2;j++){

                int newx = i;
                int newy = j;

            if (safe(newx,newy) && dist[newx][newy] > dist[it.first][it.second] + 1){
                dist[newx][newy] = dist[it.first][it.second] + 1;
                dq.push_back(make_pair(newx,newy));
            }
        }
    }

    if (dist[endx][endy] == 1e9){
        cout<<"-1\n";
        return 0;
    }

    cout<<dist[endx][endy]<<'\n';
}


Measured memory_bytes: 12608
import java.util.Scanner;

public class Main {

	static boolean[] primes;

	static void primeSet(final int MAX){
		primes = new boolean[MAX+1];
		primes[2] = true;
		for(int i=3;i<=MAX;i+=2){
			primes[i] = true;
		}
		int rt = (int) Math.sqrt(MAX);
		for(int i=3;i<=rt;i+=2){
			if(primes[i]){
				for(int j=i*2;j<=MAX;j+=i){
					primes[j] = false;
				}
			}
		}
	}

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

		int call = 0;
		while(true){
			int n = stdIn.nextInt();
			if(n==0)
				return;
			if(call<n){
				primeSet(n);
				call=n;
			}

			for(int i=n;;i--){
				if(primes[i]&&primes[i-2]&&primes[i-6]&&primes[i-8]){
					System.out.println(i);
					break;
				}
			}
		}
	}
}

Measured memory_bytes: 22000
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
using namespace std;
#define MAXSIZE 200
#define MAXL 100
typedef long long int lli;

int getDigitSum(int x);

int getAbs(int x);

int getMin(vector<int> v);

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

    string ans = (n % getDigitSum(n) == 0)? "Yes" : "No";
    cout << ans << endl;
    return 0;
}

int getDigitSum(int x){
    int res = 0;
    while(x > 0){
        res += x % 10;
        x /= 10;
    }
    return res;
}

int getAbs(int x){
    return (x > 0)? x : -x;
}

int getMin(vector<int> v){
    int res = 40000;
    for(int i = 0; i < v.size(); i++){
        res = min(res, v[i]);
    }
    return res;
}

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

int main() {

	int a, b; cin >> a >> b;
	int ans;
	if (a == b) ans = 2 * a;
	else {
		if (a < b) swap(a, b);
		ans = a + (a - 1);
	}	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3580
#include<iostream>
#include<map>
#include<vector>
#include<list>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<climits>
#include<ctime>
#include<cstring>
#define REP(i,p,n) for(int i=p;i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define rep_split(tok,a_str,re) for(char *tok = strtok((char *)a_str.c_str(),re); tok != NULL; tok = strtok(NULL,re))
#define all(c) (c).begin(), (c).end()
using namespace std;
int S[1001] = {0};

int main() {
	int N;

	while(true) {
		cin >> N;

		if (N == 0) { break; }
		rep(i,N) {
			cin >> S[i];
		}
		sort(S,S+N);
		int ave = accumulate(S+1,S+N-1,0) / (N-2);
		cout << ave << endl;
	}
	

	return 0;
}

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

int sum=1;
int main(){
  int n;
  string operate;
  while(cin>>n,n!=0){
    sum=1;
    int dice[6]={1,6,2,5,3,4};
    int changedice[6]={0};
    for(int i=0;i<n;i++){
      cin>>operate;
      if(operate[0]=='N'){
	changedice[3]=dice[0];
	changedice[2]=dice[1];
	dice[0]=dice[2];
	dice[1]=dice[3];
	dice[2]=changedice[2];
	dice[3]=changedice[3];
	sum+=dice[0];
      }else if(operate[0]=='W'){
	changedice[5]=dice[0];
	changedice[4]=dice[1];
	dice[0]=dice[4];
	dice[1]=dice[5];
	dice[4]=changedice[4];
	dice[5]=changedice[5];
	sum+=dice[0]; 
      }else if(operate[0]=='E'){
	changedice[4]=dice[0];
	changedice[5]=dice[1];
	dice[0]=dice[5];
	dice[1]=dice[4];
	dice[4]=changedice[4];
	dice[5]=changedice[5];
	sum+=dice[0];
      }else if(operate[0]=='S'){
	changedice[2]=dice[0];
	changedice[3]=dice[1];
	dice[0]=dice[3];
	dice[1]=dice[2];
	dice[2]=changedice[2];
	dice[3]=changedice[3];
	sum+=dice[0];
      }else if(operate[0]=='L'){//1,6,2,5,3,4->1,6,4,3,2,5
	changedice[2]=dice[5];
	changedice[3]=dice[4];
	dice[4]=dice[2];
	dice[5]=dice[3];
	dice[2]=changedice[2];
	dice[3]=changedice[3];
	sum+=dice[0];
      }else if(operate[0]=='R'){
	changedice[2]=dice[4];
	changedice[3]=dice[5];
	dice[4]=dice[3];
	dice[5]=dice[2];
	dice[2]=changedice[2];
	dice[3]=changedice[3];
	sum+=dice[0];
      }
    }
    cout<<sum<<endl;
  }
  return 0;
}

Measured memory_bytes: 3028
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, n) for(int i = 1; i < (int)(n); i++)
typedef long long ll;
#define NP next_permutation
#define MP make_pair

int dp[100];

//最大公約数
int gcd(int x, int y){
  if(x % y == 0) return y;
  return gcd(y, x % y);
}
//最小公倍数
int lcm(int x, int y){
  return x * y / gcd(x, y);
}
//フィボナッチ数列
//配列dpを-1で初期化する
int fib(int n){
  if(n == 0 || n == 1) return dp[n] = 1;
  if(dp[n] != -1) return dp[n];
  return dp[n] = fib(n - 1) + fib(n - 2);
}
//階乗計算(factorial)
int fact(int n){
  if(n = 1) return 1;
  return n * fact(n - 1);
}
//累乗計算(Exponentiation)
//x**y
ll expo(int x, int y){
  ll ans = 1;
  rep(i, y){
    ans *= x;
  }
  return ans;
}
//桁数
int keta(ll x){
  if(x == 0) return 1;
  int res = 0;
  while(x){
    x /= 10;
    res++;
  }
  return res;
}


int main(){
  int n, m, c;
  cin >> n >> m >> c;
  vector<int> b(m);
  rep(i, m) cin >> b[i];
  vector<vector<int>> a(n, vector<int>(m));
  rep(i,n){
    rep(j, m) cin >> a[i][j];
  }

  vector<int> p(n);
  rep(i,n){
    int point = 0;
    rep(j,m){
      point += a[i][j] * b[j];
    }
    p[i] = point;
  }

  int ac = 0;
  rep(i, n){
    if(p[i] + c > 0) ac++;
  }
  cout << ac << endl;
}




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

int main(){
    char com[10];
    priority_queue<int> pq;

    while(1){
        scanf("%s", com);
        if( com[0] == 'i'){
            int key; scanf("%d", &key);
            pq.push(key);
        } else if( com[1] == 'x'){
            printf("%d\n", pq.top());
            pq.pop();
        } else if (com[0] == 'e'){
            break;
        }
    }
    return 0;
}


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

using namespace std;

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

	vector<int> d;
	d.resize(n);

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

	int ans = 0;

	for(int i = 0; i < n; ++i) {
		for(int j = i + 1; j < n; ++j) {
			ans += d[i] * d[j];
		}
	}

	cout << ans << '\n';

	return 0;
}


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

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back

bool isPrime(int n){
    if(n==1)return false;
    if(n==2)return true;
    
    for(int i=2;i<=sqrt(n);i++){
        if(n%i==0)return false;
    }
    return true;
}


vi solvePrime(int n){
    vi ret;
    int c=0;
    for(int i=n+1;;i++){
        if(isPrime(i)){
            ret.pb(i);
            c++;
        }
        if(c>=101)break;
    }
    return ret;
}



int main(){
    int n,p;
    while(cin>>n>>p){
        if(n==-1 && p==-1)break;
        
        vi prime;
        prime=solvePrime(n);
        
        vi result;
        
        int len=prime.size();
        rep(i,len){
            for(int j=i;j<len;j++){
                result.pb(prime[i]+prime[j]);
            }
        }
        sort(all(result));
//        rep(i,len)cout<<result[i]<<endl;
        
        cout<<result[p-1]<<endl;
    }

    
    return 0;
}

Measured memory_bytes: 1276
#include <iostream>
#include <string>
#include <stdio.h>
using namespace std;

int main() {
    int D, N;
    cin >> D >> N;

    if(D == 0) {
        if(N != 100) {
            cout << N << endl;
        } else {
            cout << 101 << endl;
        }
    } else if(D == 1) {
        if(N != 100) {
            cout << N * 100 << endl;
        } else {
            cout << 10100 << endl;
        }
    } else if(D == 2) {
        if(N != 100) {
            cout << N * 10000 << endl;
        } else {
            cout << 1010000 << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 256
//=====================================================
// 
// (setq backup-inhibited t)
// (setq auto-save-default nil)
// 
// (column-number-mode t)
// (setq-default tab-width 2 indent-tabs-mode nil)
// 
// (global-set-key "\C-h" 'delete-backward-char)
// 
// (setq indent-line-function 'indent-relative-maybe)
// (global-set-key "\C-m" 'newline-and-indent)
// 
//=====================================================

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <algorithm>

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

using namespace std;

struct Cost {
  Cost(int time_,int trans_) : time(time_), trans(trans_) {}
  int time;
  int trans;
};

bool operator<(const Cost& lhs, const Cost& rhs) {
  if(lhs.time!=rhs.time)return lhs.time<rhs.time;
  return lhs.trans<rhs.trans;
}

bool operator>(const Cost& lhs, const Cost& rhs) {
  return rhs < lhs;
}

Cost operator+(const Cost& lhs, const Cost& rhs) {
  return Cost(lhs.time+rhs.time,lhs.trans+rhs.trans);
}

Cost dijkstra(const vector<vector<pair<int,Cost>>>& g, int s, int t) {
  int n = g.size();
  vector<Cost> cost(n,Cost(1000000000,1000000000));
  priority_queue<pair<Cost,int>,vector<pair<Cost,int>>,greater<pair<Cost,int>>> q;
  q.emplace(Cost(0,0),s);
  while(!q.empty()){
    auto p=q.top();
    q.pop();
    Cost nc = p.first;
    int i = p.second;
    if(nc>cost[i])continue;
    for(auto e:g[i]){
      if(cost[e.first] > nc+e.second){
        cost[e.first] = nc+e.second;
        q.emplace(cost[e.first],e.first);
      }
    }
  }
  return cost[t];
}


int main() {
  int n,t;
  cin>>n>>t;
  string a,b;
  cin>>a>>b;
  set<string> cities_s;
  int cnt=0;
  vector<vector<string>> stops(n);
  vector<vector<pair<int,Cost>>> g;
  vector<int> len(n);
  REP(i,n){
    cin>>len[i];
    REP(j,len[i]){
      string s;
      cin>>s;
      stops[i].push_back(s);
      cities_s.insert(s);
      g.emplace_back();
    }
    REP(j,len[i]-1){
      int d;
      cin>>d;
      g[cnt+j].emplace_back(cnt+j+1,Cost(d,0));
      g[cnt+j+1].emplace_back(cnt+j,Cost(d,0));
    }
    cnt+=len[i];
  }
  vector<string> cities;
  for(string s:cities_s){
    cities.push_back(s);
    g.emplace_back();
  }
  int cnt2=0;
  REP(i,n){
    REP(j,len[i]){
      int o = lower_bound(begin(cities),end(cities),stops[i][j]) - begin(cities);
      g[cnt+o].emplace_back(cnt2+j,Cost(0,0));
      g[cnt2+j].emplace_back(cnt+o,Cost(t,1));
    }
    cnt2+=len[i];
  }
  int s_i = lower_bound(begin(cities),end(cities),a) - begin(cities);
  int t_i = lower_bound(begin(cities),end(cities),b) - begin(cities);
  auto res = dijkstra(g,s_i+cnt,t_i+cnt);
  if (res.time >= 1000000000)
    cout << -1 << endl;
  else
    cout << (res.time - t) << ' ' << (res.trans - 1) << endl;
  return 0;
}

Measured memory_bytes: 26840
using System;
using System.Linq;
using static System.Console;


class Program
{
    static void Main(string[] args)
    {
        var str = ReadLine().Split().Select(i => int.Parse(i)).ToArray();
        int w = str[0] , a = str[1] , b = str[2];
        var temp = Math.Max(a,b) - (Math.Min(a, b) + w);
        if (temp < 0) WriteLine(0);
        else WriteLine(temp);
    }
}

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

int main()
{

    int n;
    cin>>n;
    int K;
    cin>>K;
    vector<int> c(n);
    int k;
    for(int i=0; i<n; i++)
    {
        cin>>k;
        c[i] = k;
    }
    vector<int> dp(n);
    dp[0]=0;
    dp[1] = abs(c[1]-c[0]);
    int mini = INT_MAX;
    for(int i=2; i<n; i++)
    {
        int j=1;
        int index=0;
        while(j<=K && i-j>=0) {
            if(abs(c[i] - c[i-j])+dp[i-j] < mini)
            {
                mini  = abs(c[i] - c[i-j]) + dp[i-j];
                index = K;

            }
            j++;}
          //  mini=INT_MAX;
        dp[i] = mini;
        mini=INT_MAX; }
    cout<<dp[n-1];
    return 0;
}



Measured memory_bytes: 1152
use std::cmp::*;
use std::collections::*;
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let MOD:i64 = 1e9 as i64 + 7;
    let h: usize = read();
    let w: usize = read();
    let mut grid: Vec<Vec<char>> = vec![vec![' '; w]; h];
    for i in 0..h {
        let mut s: String = read();
        grid[i] = s.chars().collect();
    }
    let mut dp: Vec<Vec<i64>> = vec![vec![0; w]; h];
    for i in 0..h {
        for j in 0..w {
            if (grid[i][j] == '#') {
                dp[i][j] = -1;
            }
        }
    }
    dp[0][0] = 1;
    for i in 0..h {
        for j in 0..w {
            if (i == 0 && j == 0) {
                continue;
            }
            if (i == 0 && j != 0 && dp[i][j] != -1 && dp[i][j - 1] != -1) {
                dp[i][j] = dp[i][j - 1];
            }
            if (i != 0 && j == 0 && dp[i - 1][j] != -1 && dp[i][j] != -1) {
                dp[i][j] = dp[i - 1][j];
            } else if i != 0 && j != 0 {
                if dp[i - 1][j] != -1 && dp[i][j] != -1 {
                    dp[i][j] += dp[i - 1][j];
                    dp[i][j] %= MOD;
                }
                if dp[i][j - 1] != -1 && dp[i][j] != -1 {
                    dp[i][j] += dp[i][j - 1];
                    dp[i][j] %= MOD;
                }
            }
        }
    }
    println!("{}", dp[h - 1][w - 1]);
}

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

ans = [0 for i in range(10001)]

for x in range(1,101):
    for y in range(1,101):
        for z in range(1,101):
            v = x*x+y*y+z*z+x*y+y*z+z*x
            if v < 10001:
                ans[v] += 1

for i in range(n):
    print(ans[i+1])

Measured memory_bytes: 9316
#include <stdio.h>
  
   int main(void){
       int kouka[6];
       int val[]={1,5,10,50,100,500};
       int i,sum=0;
       for(i=0;i<6;i++){
           scanf("%d",&kouka[i]);
           kouka[i]=kouka[i]*val[i];
          sum=sum+kouka[i];
      }
      if(sum>=1000)
         printf("%d\n",1);
      else
          printf("%d\n",0);
      return 0;
     }

Measured memory_bytes: 1836
import java.util.Scanner;

public class Main{
    public void solve(){
        Scanner sc =new Scanner(System.in);
        int N,su;
        int one = 0;
        int some = 1;
        N = sc.nextInt();
        
        while(N != 0){
            for(int i=0;i<N;i++){
                su = sc.nextInt();
                if(su >= 2){
                    some++;
                }else if(su ==1){
                    one++;
                }
            }
            if(some >= 2){
                System.out.println(one+some);
            }else{
                System.out.println("NA");
            }
            one = 0;
            some = 1;
            N = sc.nextInt();
        }
    }
    
    public static void main(String[]args){
        Main obj = new Main();
        obj.solve();
    }
}

Measured memory_bytes: 158596
#include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include <string>
#include <complex>
#include <functional>
using namespace std;
//typedef pair<string,string> P;
//double dat[100][100];
//int dp[6][1010];//動的計画法
//int prime[10000001];
//char str[1010][1010];
//vector<pair<int,int> > pc[100001];
//int ABS(int a){return max(a,-a);}
//long long num[100000];
int main(){
	int n,a,b;
	cin>>n;
	if(n==1) cout<<"Hello World"<<endl;
	else {
		cin>>a>>b;
		cout<<a+b<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s,t,u;
    int a,b;
    cin >> s >> t >> a >> b >> u;
    if(s==u){
        cout << a-1 << " " << b << endl;
    }
    else{
        cout << a << " " << b-1 << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <iomanip>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// #define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>

#define ll long long
#define Size(v) (int)v.size()

using namespace std;
// using namespace __gnu_pbds;

int n;

void solve() {
	cin >> n;
	string s;
	cin >> s;

	int sze = 1;

	for (int i = 1; i < n; ++i) {
		if (s[i] != s[i - 1]) ++sze;
	}

	cout << sze;
}

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

	int t = 1;
	while (t--) 
		solve();
	return 0;
}

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

#define M 26
#define ascii_a 97
int main() 
{
  string s, t;
  cin >> s >> t;
  int s_length = s.length();
  int t_length = t.length();

  vector<vector<int>> vec(M);
  int count_s[M] = {};
  int count_t[M] = {};
  rep (i, s_length) {
    ++count_s[s[i] - ascii_a];
    vec[s[i] - ascii_a].push_back(i);
  }
  rep (i, t_length) ++count_t[t[i] - ascii_a];
  rep (i, M) {
    if (count_t[i] == 0) continue;
    if (count_s[i] == 0) {
      cout << -1 << endl;
      return 0;
    }
  }

  int loop_counter = 0;
  int index_s = 0;
  rep (i, t_length) {
    int c = t[i] - ascii_a;
    auto posi = lower_bound(vec[c].begin(), vec[c].end(), index_s);
    if (posi == vec[c].end()) {
      --i;
      ++loop_counter;
      index_s = 0;
      continue;
    }
    int idx_lower = distance(vec[c].begin(), posi);
    index_s = vec[c][idx_lower] + 1;
  }

  ll ans = (ll)s_length * (ll)loop_counter + (ll)index_s;
  cout << ans << endl;
  return 0;
}

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

def main(n,A):
    B = []
    if n%2==1:
        for i in range(n-1,-1,-2):
            B.append(A[i])
        for i in range(1,n-1,2):
            B.append(A[i])
    else:
        for i in range(n-1,0,-2):
            B.append(A[i])
        for i in range(0,n-1,2):
            B.append(A[i])
        
    print(" ".join(B))
    
if __name__ == '__main__':
    n = int(input())
    A = [str(a) for a in input().split()]
    main(n,A)

Measured memory_bytes: 25668
#include <stdio.h>

int main(void)
{
    int A, B, C, D, E;
    int time;
    int b;
    
    scanf("%d%d%d%d%d", &A, &B, &C, &D, &E);
    
    
    time = 0;
    if (A < 0){
        if (B < 0){
            b = B;
        }
        else {
            b = 0;
        }
        time += (b - A) * C;
        A = b;
    }
    
    if (A >= 0 && B >= 0){
        if (A == 0){
            time += D;
        }
        time += (B - A) * E;
    }

    printf("%d\n", time);
    
    return (0);
}



Measured memory_bytes: 2120
//include,namespace
 #include<bits/stdc++.h>
 #include<iostream> 
 #include <queue>
 #include <vector>
 #include <string>
 using namespace std;
//REPmacro
 #define all(x) (x).begin(),(x).end()             //ソート
 #define FOR(i,x,n)for(int i=(x);i<(n);i++)
 #define FOR_R(i,x,n) for(int i=(n-1);i>=(x);i--)
 #define REP(i, n) FOR(i, 0, n)
 #define REP_R(i, n) FOR_R(i, 0, n)
//long long(define)
 using ll = long long;
 typedef long long ll;
 typedef long long int64;
 typedef long long lint;
 typedef long long lli;

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};
////////////////いろいろあるよ//////////////////////////////////
int main(){
	double a;
  	cin >> a;
  cout << 2* a * M_PI << endl;
}


Measured memory_bytes: 3784
s = input()
t = input()

sum = 1000
for i in range(len(s)-len(t)+1):
  sch = s[i:i+len(t)]
  tm = 0
  for si in range(len(t)):
    if sch[si] != t[si]:
    	tm += 1
        
  if tm < sum:
    sum = tm
print(sum)

Measured memory_bytes: 67704
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define VPLL vector<pair<long long,long long> >
#define F first
#define S second
typedef long long LL;
using namespace std;
const int MOD = 1e9+7;
const int SIZE = 1e6+10;

int main(){
    DRIII(x,y,z);
    return 0*puts((y*10+z)%4?"NO":"YES");
    return 0;
}


Measured memory_bytes: 764
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()) {
            int n = sc.nextInt();
            int m = sc.nextInt();
            if(n == 0 && m == 0) break;
            
            int[] ns = new int[n];
            int[] ms = new int[m];
            int nsum = 0;
            int msum = 0;
            
            for(int i=0; i<n; i++) {
                ns[i] = sc.nextInt();
                nsum += ns[i];
            }
            for(int i=0; i<m; i++) {
                ms[i] = sc.nextInt();
                msum += ms[i];
            }
            
            int sn = -1;
            int sm = -1;
            
            for(int i=0; i<n; i++) {
                for(int j=0; j<m; j++) {
                    if(nsum - ns[i] + ms[j] == msum - ms[j] + ns[i]) {
                        if(sn == -1) {
                            sn = ns[i];
                            sm = ms[j];
                        }
                        else if(ns[i] + ms[j] < sn + sm) {
                            sn = ns[i];
                            sm = ms[j];
                        }
                    }
                }
            }
            System.out.println(sn==-1?sn:sn+" "+sm);
        }
    }
}



Measured memory_bytes: 29676
h, w = map(int, input().split())
pic = [input().split() for i in range(h)]


for i in range(w+2):
    print("#", end='')
print()

for i in range(h):
    print("#{}#".format(pic[i][0]))

for i in range(w+2):
    print("#", end='')
print()

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

int main() {
	std::string s;
	int max=0;
	int maxv=0;
	string maxval;
	string maxlen;
	map<string,int> m;
	while(cin>>s){
		if(s.length()>max){
			max=s.length();
			maxlen=s;
		}
		m[s]++;
		if(maxv<m[s]){
			maxval=s;
			maxv=m[s];
		}
	}
	cout<<maxval<<" "<<maxlen<<endl;
}

Measured memory_bytes: 3220
/**
 * Title:
 * Url:
 */
#include<bits/stdc++.h>

using namespace std;

#define ll long long

int main() {
    string s; cin >> s;
    if(s=="ABC") {
        cout << "ARC" << endl; 
    } else {
        cout << "ABC" << endl;
    }

    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> P;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 1000000000
#define LLINF 1000000000000000ll
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
int N;
int A[1<<19];
P f[1<<19];
P merge(P a,int x){
	if(a.fi<x){
		a.sec = a.fi;
		a.fi = x;
	}else if(a.sec < x){
		a.sec = x;
	}
	return a;
}
P merge(P a,P b){
	return merge(merge(a,b.fi),b.sec);
}
int ans[1<<18];
int main(){
	cin >> N;
	for(int i=0;i<(1<<N);i++){
		cin >> A[i];
		f[i]=P(A[i],-INF);
	}
	for(int j=0;j<N;j++){
		for(int i=0;i<(1<<N);i++){
			if((i>>j)&1)f[i]=merge(f[i],f[i&~(1<<j)]);
		}
	}
	for(int i=1;i<(1<<N);i++){
		ans[i]=f[i].fi+f[i].sec;
	}
	for(int i=2;i<(1<<N);i++){
		ans[i]=max(ans[i-1],ans[i]);
	}
	for(int i=1;i<(1<<N);i++){
		cout << ans[i] << endl;
	}
}
#include <bits/stdc++.h>

Measured memory_bytes: 11264
import java.util.*;
public class Main{
    static Scanner kbd = new Scanner(System.in);
    public static void main(String[] args){
	while(kbd.hasNext()){
	    int n = kbd.nextInt();
	    if(n!=0){
		int i;
		boolean key = false; //falseなら施錠されている
		String[] id = new String[n];
		for(i=0; i<n; i++){
		    id[i] = kbd.next();
		}
		int m = kbd.nextInt();
		while(m>0){
		    String x = kbd.next();
		    boolean c = false; //trueなら正しいID
		    for(i=0; i<n; i++){
			if(x.equals(id[i])) {
			    c = true; break;
			}
		    }
		    
		    if(c){
			if(!key){
			    System.out.println("Opened by "+x);
			    key = true;
			}
			else{
			    System.out.println("Closed by "+x);
			    key = false;
			}
		    }
		    else{
			System.out.println("Unknown "+x);
		    }
		    m--;
		}
	    }
	}
    }
}

Measured memory_bytes: 21780
#include <bits/stdc++.h>
using namespace std;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#define P(x) cout << (x) << "\n"
#define p(x) cout << (x)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define vv(type, c, m, n, i) vector<vector<type>> c(m, vector<type>(n, i));
#define rep(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
#define rrep(i,a,n) for(int i=(a), i##_len=(n); i>i##_len; --i)
#define len(x) ((int)(x).size())
#define mp make_pair
#define eb emplace_back
#define fi first
#define se second
#define chmax(a,b) if(a<b)a=b;
#define chmin(a,b) if(b<a)a=b;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> pii;
int main() {
	int x, y; cin >> x >> y;
	P(__gcd(x, y));
	return 0;
}

Measured memory_bytes: 3124
#include <bits/stdc++.h>
using i64 = long long;

int main() {
    constexpr i64 mod = 1000000007;
    int n, m;
    std::cin >> n >> m;
    i64 r = 0, c = 0, p;
    std::cin >> p;
    for (int i = 1; i < n; i++) {
        i64 x;
        std::cin >> x;
        r = (r + (x - p) * i % mod * (n - i) % mod) % mod;
        p = x;
    }
    std::cin >> p;
    for (int i = 1; i < m; i++) {
        i64 y;
        std::cin >> y;
        c = (c + (y - p) * i % mod * (m - i) % mod) % mod;
        p = y;
    }

    std::cout << r * c % mod << std::endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)

int main()
{
    int a, b;
    cin >> a >> b;
    int ans = a;
    if (b < a)
    {
        ans = a - 1;
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
def main():
    x = int(input())
    expo_list = []

    for i in range(1, 1000):
        for j in range(2, 10):
            expo_list.append(i ** j)

    expo_list.sort(reverse=True)

    for expo in expo_list:
        if expo <= x:
            print(expo)
            break


if __name__ == "__main__":
    main()


Measured memory_bytes: 73900
import sys



N=raw_input()
te=raw_input()

flaglist=[]
for i in range(len(te)):
    if te[i]=="P" or te[i]=="p":
        if te[i]  not in flaglist:
            flaglist.append(te[i])
    if te[i]=="W" or te[i]=="w":
        if te[i]  not in flaglist:
            flaglist.append(te[i])
    if te[i]=="G" or te[i]=="g":
        if te[i]  not in flaglist:
            flaglist.append(te[i])
    if te[i]=="Y" or te[i]=="y":
        if te[i]  not in flaglist:
            flaglist.append(te[i])
            
if len(flaglist)==3:
    print("Three")
elif len(flaglist)==4:
    print("Four")


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

int main() {
  int A,B;
  cin >> A >> B;
  int ans = 0; //回答用変数
  
  for (int i = A; i < B+1 ;i++){
    string s = to_string(i);
    if(s[0]==s[4] && s[1]==s[3]){
      ans +=1;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define repr(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define ALL(a) (a).begin(), (a).end()
using ll = long long;
// using Graph = vector<vector<int>>;
using P = pair<ll, ll>;
const int dx[] = {0, -1, 0, 1};
const int dy[] = {1, 0, -1, 0};
const ll mod = 1e9 + 7;
const ll INF = 1e9;
const ll LINF = 1LL << 60;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //////////////////////////////////////
  string t;
  cin >> t;
  rep(i, t.length()) {
    if (t[i] == '?') t[i] = 'D';
  }
  cout << t << endl;
  return 0;
}


Measured memory_bytes: 3744
import sys
n=int(input())
a=[]
b=[]
for i in range(n):
  s=input()
  overall=0
  minimum=0
  current=0
  for j in range(len(s)):
    if s[j]=='(':
      current+=1
    else:
      current-=1
    minimum=min(current,minimum)
  overall=current
  if overall>=0:
    a.append([overall,minimum])
  else:
    b.append([overall,minimum])
finalsum=0
a=sorted(a, key=lambda t:t[1])
a.reverse()
b=sorted(b, key=lambda t:t[0]-t[1])
b.reverse()
for i in a:
  if finalsum+i[1]<0:
    print('No')
    sys.exit()
  finalsum+=i[0]
for i in b:
  if finalsum+i[1]<0:
    print('No')
    sys.exit()
  finalsum+=i[0]
if finalsum==0:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 228936
#include<iostream>
#include<vector>
#include<stack>
#include<algorithm>
#include<string>
#include<set>
#include<numeric>
#include<functional>
#include<unordered_map>
#include<cmath>
#include<cstdlib>

int main()
{
	int A, B;
	std::cin >> A >> B;
	printf("%d\n", (A + B) % 24);
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
const long long Maxn=200000+20,inf=0x3f3f3f3f;
long long n,ans;
inline long long read()
{
	long long s=0,w=1;
	char ch=getchar();
	while(ch<'0' || ch>'9'){if(ch=='-')w=-1;ch=getchar();}
	while(ch>='0' && ch<='9')s=(s<<3)+(s<<1)+(ch^48),ch=getchar();
	return s*w;
}
int main()
{
	n=read();
	for(long long i=1;i<=n;++i)
	{
		long long j=n/i;j*=i;
		long long cnt=(j-i)/i+1;
		ans+=((i+j)*cnt)>>1;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 3712
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <algorithm>
#include <set>
#include <cmath>
#include <iomanip>
#define REP(i, n) for(int i=0; i<n; i++)
#define REPR(i, n) for(int i=n; i>=0; i--)
#define FOR(i, m, n) for(int i=m; i<n; i++)
#define FORR(i, m, n) for(int i=m; i>=n; i--)
#define INF 999999999
#define ll long long
#define VSORT(v) sort(v.begin(), v.end())
#define pb(a) push_back(a)
using namespace std;

#ifdef INPUT
#include <sstream>
stringstream input(R"(
7 6
......
....#.
.#....
..#...
..#...
......
.#..#.
)");
#define cin input
#endif

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

	char a[h][w];
	REP(i,h)
	{
		REP(j,w)
			cin >> a[i][j];
	}

	char s='T';
	REP(i,h)
	{
		REP(j,w)
		{
			if (a[i][j]=='#')
			{
				s = 'F';
				break;
			}
		}
		if(s=='T')
		{
			REP(j,w)
			{
				a[i][j]='N';
			}
		}
		s='T';
	}

	REP(i,w)
	{
		REP(j,h)
		{
			if(a[j][i]=='#')
			{
				s = 'F';
				break;
			}
		}
		if(s=='T')
		{
			REP(j,h)
			{
				a[j][i]='N';
			}
		}
		s='T';
	}

	REP(i,h)
	{
		REP(j,w)
		{
			if (a[i][j]!='N')
				cout << a[i][j];
		}
		cout << endl;
	}	
}

Measured memory_bytes: 256
import java.util.*;

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

        int N = sc.nextInt();
        int[] H = new int[N];

        for (int i = 0; i < N; i++) H[i] = sc.nextInt();

        boolean isControllable = true;

        for (int i = N - 1; i > 0; i--) {
            if (H[i - 1] - 1 > H[i]) {
                isControllable = false;
                break;
            } else if (H[i - 1] > H[i]) {
                H[i - 1]--;
            }
        }

        System.out.println(isControllable ? "Yes" : "No");
    }
}

Measured memory_bytes: 50220
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
const ll INF = 1LL<<60;
const ll MOD = 1e9+7;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    double r;cin>>r;
    cout<<setprecision(12)<<2*3.1415926535*r<<endl;
    return 0;
}

Measured memory_bytes: 3788
#include <stdio.h>
#include <iostream>
using namespace std;

int main()
{
	const int numOfAlp = 26;
	char ch;
	int *cnt = new int[numOfAlp];
	for (int i = 0; i < numOfAlp; i++) cnt[i] = 0;
	while (scanf("%c", &ch) != EOF) {
		if ('A' <= ch && ch <= 'Z') ch = tolower(ch);
		if ('a' <= ch && ch <= 'z') cnt[ch - 'a']++;
	}
	for (int i = 0; i < numOfAlp; i++) {
		printf("%c : %d\n", 'a' + i, cnt[i]);
	}
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
using Int = long long;

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

//INSERT ABOVE HERE
signed main(){
  Int n;
  cin>>n;
  Int ans=1e9;
  for(Int a=1;a<n;a++){
    Int b=n-a;
    string s=to_string(a);
    string t=to_string(b);
    Int res=0;
    for(char c:s) res+=c-'0';
    for(char c:t) res+=c-'0';
    chmin(ans,res);
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 892
a, n, m = map(int, input().split())
candi = []
ans = 0

for i in range(a + 1, 9*8+a+1):
    if i**n <= m:
        candi.append(i**n)
for j in candi:
    k = j
    digit = []
    for _ in range(9):
        digit.append(k%10)
        k //= 10
    if (sum(digit)+a)**n == j:
        ans += 1
print(ans)


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

int main() {
  string s;
  cin >> s;
  long long k;
  cin >> k;
  if (k == 1) {
    cout << s.at(0);
    return 0;
  }
  int num = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s.at(i) != '1' && k > num) {
      cout << s.at(i);
      return 0;
    } else {
      num++;
    }
  }
  cout << 1;
  return 0;
}


Measured memory_bytes: 256
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
// #include<C:\Users\J\Desktop\AC\athead.h>
#define showa(v) for(int iii = 0; iii < v.size(); iii++){ cout << v[iii] << " ";} cout << endl;
#define show(iiii) cout << iiii << endl; 
#define shows(iiiii) cout << iiiii << " ";
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include <cmath>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <set>
#include <deque>
#include <numeric>
#include<tuple>
#include <utility>
#include <map>
#define waru 1000000000+7

using namespace std;

int main(){
    int n, d;
    cin >> n >> d;
    int haba = 2*d+1;
    // show(haba)
    if (n%haba == 0){
        cout << n/haba;
        return 0;
    }
    else{
        cout << (n/haba)+1;
        return 0;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <cctype>
#include <bitset>
#include <type_traits>

#include <list>
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define YES(j) cout << (j ? "YES" : "NO") << endl;
#define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
#define yes(j) std::cout << (j ? "yes" : "no") << endl;

int main(void)
{
    string s;
    cin >> s;
    int cnt = 0;
    int ans = 0;
    bool flag = false;
    for (int i = 0; i < s.length(); i++)
    {
        if (s[i] == '0')
        {
            if (cnt < 0)
                ans += 2;
            cnt++;
        }
        else
        {
            if (cnt > 0)
                ans += 2;
            cnt--;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
import java.util.*;
class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    pl(2*Math.PI*a+"");
  }

  public static void pr(String str){
    System.out.print(str);
  }
  public static void pl(String str){
    System.out.println(str);
  }
}


Measured memory_bytes: 39108
import java.util.*;

public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);
    
    int N = sc.nextInt();

    String[] s = new String[N];

    for (int i = 0; i < N; i++) {
      s[i] = sc.next();
    }

    int M = sc.nextInt();

    String[] t = new String[M];

    for (int i = 0; i < M; i++) {
      t[i] = sc.next();
    }

    sc.close();

    HashMap<String, Integer> map = new HashMap<String, Integer>();

    for (int i = 0; i < N; i++) {
      if (map.containsKey(s[i])) {
        int count = map.get(s[i]);
        map.put(s[i],count + 1);
      } else {
        map.put(s[i],1);
      }
    }

    for (int i = 0; i < M; i++) {
      if (map.containsKey(t[i])) {
        int count = map.get(t[i]);
        map.put(t[i],count - 1);
      } else {
        map.put(t[i],-1);
      }
    }

    int count = 0;

    Set<String> keys = map.keySet();

    for (int i = 0; i < keys.size(); i++) {
      String key = keys.toArray(new String[0])[i];
      count = Math.max(count, map.get(key));
    }

    System.out.println(count);

  }

}

Measured memory_bytes: 23892