akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <array>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>
#include <stack>
#include <utility>
#include <bitset>
#include <complex>
#include <algorithm>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <random>
#include <functional>
#include <sstream>
#include <iomanip>

using namespace std;

#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define dump(x) cout << #x << " = " << (x) << endl;
#define forauto(i, a) for(auto i : a)cout << i << " "; puts("");

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef pair<double, double> PDD;
typedef complex<double> CD;

int eye(double n) {
	int ret;

	if (n >= 1.1)ret = 0;
	else if (n >= 0.6)ret = 1;
	else if (n >= 0.2)ret = 2;
	else ret = 3;

	return ret;
}

int main() {
	double a, b;
	VI l(4), r(4);
	while (cin >> a >> b) {
		//if (a == 0.)break;
		l[eye(a)]++;
		r[eye(b)]++;
	}
	rep(i, 4) {
		cout << l[i] << " " << r[i] << endl;
	}
}


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>

using namespace std;
#define int long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(), (x).end()

template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
//SOLVE
void solve(void)
{
  int H,W; cin>>H; cin>>W; 
  vector<vector<char> >  mat (H,vector<char>(W,0));
  for (int i = 0; i < H; i++)
  {
    for (int j = 0; j < W; j++)
    {
       cin>>mat[i][j];
    }
  }
  vector<vector<int> > data_H (H,vector<int>(W,0));
  vector<vector<int> > data_W (H,vector<int>(W,0));
  for (int i = 0; i < H; i++)
  {
    for (int j = 0; j < W; j++)
    {
      if(mat[i][j] == '#')data_H[i][j] = 0;
      else
      {
        data_H[i][j] = 1;
        if(j != 0) data_H[i][j] += data_H[i][j-1];
      }
    } 
  }
  for (int i = 0; i < H; i++)
  {
    for (int j = W-2; j >= 0; j--)
    {
      if(mat[i][j] == '#')data_H[i][j] = 0;
      else
      {
        chmax(data_H[i][j],data_H[i][j+1]);
      }
    } 
  }

  for (int j = 0; j < W; j++)
  {
    for (int i = 0; i < H; i++)
    {
      if(mat[i][j] == '#')data_W[i][j] = 0;
      else
      {
        data_W[i][j] = 1;
        if(i != 0) data_W[i][j] += data_W[i-1][j];
      }
    } 
  }
  for (int j = 0; j < W; j++)
  {
    for (int i = H-2; i >= 0; i--)
    {
      if(mat[i][j] == '#')data_W[i][j] = 0;
      else
      {
        chmax(data_W[i][j],data_W[i+1][j]);
      }
    } 
  }
  int ANS = 0;
  for (int i = 0; i < H; i++)
  {
    for (int j = 0; j < W; j++)
    {
      chmax(ANS,data_W[i][j] + data_H[i][j] -1);
    }
    
  }
  cout<<ANS<<endl;
  
  
  return;
}

int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

  return 0;
}


Measured memory_bytes: 66944
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	static Scanner scanner;

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

        int N=gi();
        Map<String, Integer> map=new HashMap<String, Integer>();
        
        for (int i=0; i<N; i++) {
            String s=gs();
            if(map.containsKey(s)) {
            	int k=map.get(s);
            	map.put(s, k+1);
            }else {
            	map.put(s, 1);
            }
        }
        int m=gi();

        for (int i=0; i<m; i++) {
            String s=gs();
            if(map.containsKey(s)) {
            	int k=map.get(s);
            	map.put(s, k-1);
            }else {
            	map.put(s, -1);
            }
        }
        
        int max=0;
        for (Integer v : map.values()) {
        	if(v>max) {
        		max=v;
        	}
        }

	    System.out.println(max);

//	    if (isNumber(s1) && isNumber(s2) && s.charAt(a) == '-') {
//	    	System.out.print("Yes");
//	    }else {
//	    	System.out.print("No");
//	    }



	}

	public static long d(long n) {
		String a=String.valueOf(n);
		return (long)a.length();
	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}

	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

Measured memory_bytes: 35580
#include<stdio.h>
#include<stdlib.h>

int main(){
  int i, j, A[1000], N, v;
  scanf("%d", &N);
  if(!(N > 100)){
    for(i = 0; i < N; i++){
      scanf("%d", &A[i]);
      if(i != N-1)
	printf("%d ", A[i]);
      else
	printf("%d\n", A[i]);
    }
    for(i = 1; i < N; i++){
      v = A[i];
      j = i - 1;
      while(j >= 0 && A[j] > v){
	A[j+1] = A[j];
	j--;
      }
      A[j+1] = v;

      for(j = 0; j < N; j++)
	if(j != N-1)
	  printf("%d ", A[j]);
	else
	  printf("%d\n", A[j]);
    }
  }
  return 0;
}



Measured memory_bytes: 2064
i,j,k,n,x,t;
main(){
    for(;scanf("%d%d",&n,&x),n+x;printf("%d\n",t))
        for(i=1,t=0;i<=n;i++)
            for(j=i+1;k=x-i-j,j<=n;j++)
                if(j<k&&k<=n)t++;
}

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

#define pb push_back
#define fi first
#define se second
#define ll long long
#define pq priority_queue
#define mp make_pair
#define pii pair<int,int>
#define mod 998244353

int lowbit(int x) {return x&(-x);}

int n,d;
int a[200010];

vector <pair<ll,pii> > e;

struct UF{
	int p[200010],rank[200010];	
	void init() {
		for (int i=0;i<200010;i++) p[i]=i;
		for (int i=0;i<200010;i++) rank[i]=0;
	}
	int getf(int x){
		if (p[x]==x) return x;
		return getf(p[x]);
	}
	bool same(int x,int y) {
		return getf(x)==getf(y);
	}
	void unite(int x,int y) {
		int xx=getf(x);
		int yy=getf(y);
		if (xx!=yy) {
			if (rank[xx]<rank[yy]) p[xx]=yy;
			else {
				p[yy]=xx;
				if (rank[xx]==rank[yy]) rank[xx]++;
			}
		}
	}
}uf;

void solve(int l,int r) {
	if (l==r) return;
	int mid=l+r>>1;
	ll mn=1e18;
	int pl,pr;
	for (int i=l;i<=mid;i++) {
		ll cur=(ll)a[i]-(ll)d*(ll)i;
		if (cur<mn) {
			mn=cur;
			pl=i;
		}
	}
	mn=1e18;
	for (int j=mid+1;j<=r;j++) {
		ll cur=a[j]+(ll)d*(ll)j;
		if (cur<mn) {
			mn=cur;
			pr=j;
		}
	}
	for (int i=mid+1;i<=r;i++) {
		ll vl=(ll)a[pl]-(ll)d*(ll)pl;
		ll vr=(ll)a[i]+(ll)d*(ll)i;
		e.pb(mp(vl+vr,mp(pl,i)));
	}
	for (int i=l;i<=mid;i++) {
		ll vl=(ll)a[i]-(ll)d*(ll)i;
		ll vr=(ll)a[pr]+(ll)d*(ll)pr;
		e.pb(mp(vl+vr,mp(i,pr)));
	}
	solve(l,mid);
	solve(mid+1,r);
}

int main(){
	scanf("%d%d",&n,&d);
	for (int i=0;i<n;i++) scanf("%d",&a[i]);
	solve(0,n-1);
	sort(e.begin(),e.end());
	uf.init();
	ll ans=0ll;
	for (int i=0;i<e.size();i++) {
		int u=e[i].se.fi,v=e[i].se.se;
		if (!uf.same(u,v)) {
			uf.unite(u,v);
			ans+=e[i].fi;
//			cout<<e[i].fi<<" "<<u<<" "<<v<<endl;
		}
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 68704
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <stack>
#include <climits>
#include <map>
#include <set>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

const ll mod = 1000000007;
const int inf = 1e9;
const long long INF = 1LL << 60;

vector<int> G[200100];
int p[200100];
int ans[200100];

void dfs(int p_n,int v, int pre)
{
    ans[v] = pre + p[v];
    //cout << v << ' ' << pre<< ' ' << ans[v] << endl;
    for(int i = 0; i < G[v].size(); i++){
        if(p_n != G[v][i]) dfs(v,G[v][i],ans[v]);
    }
}

int main()
{
    int n,q;
    cin >> n >> q;
    
    for(int i = 0; i < n-1; i++){
        int a,b;
        cin >> a >> b;
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    
    for(int i = 0; i < n; i++) p[i] = 0;
    for(int i = 0; i < q; i++){
        int a,x;
        cin >> a >> x;
        a--;
        p[a] += x;
    }
    
    dfs(-1,0,0);
    //for(int i = 0; i < n; i++) ans[i] = 0;
    for(int i = 0; i < n; i++) cout << ans[i] << ' ';
} 

Measured memory_bytes: 27392
#include<string>
#include<iostream>
#include<cmath>
#define MIN 1e13
typedef long long ll;
using namespace std;

int
main(void)
{
  ll n; cin >> n;
  ll ans = MIN;

  for(ll i = 1; i <= sqrt(n); i++){
    if(n%i == 0){
      ll j = n/i;
      if (ans > i+j-2) ans = i+j-2;
    }
  }

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

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
	//scan
	int n,m;
	scanf("%d %d\n",&n,&m);
	int a[n][m];
	int b[m][1];
	int c[n][1];
	int i,j;
	for(i=0;i<n;i++){
		for(j=0;j<m;j++){
			if(j==m-1){
				scanf("%d\n",&a[i][j]);
			}else{
				scanf("%d ",&a[i][j]);
			}
		}
	}
	int k;
	for(k=0;k<m;k++){
		scanf("%d\n",&b[k][0]);
	}
	//end scan
	int l;
	for(l=0;l<n;l++){
		int x;
		c[l][0] = 0;
		for(x=0;x<m;x++){
			c[l][0] = c[l][0] + (a[l][x]*b[x][0]);
		}
	}
	int y;
	for(y=0;y<n;y++){
		printf("%d\n",c[y][0]);
	}
	return 0;
}

Measured memory_bytes: 644
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=200005;
const ll INF=1LL<<60;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N,M;cin>>N>>M;
    vector<int> A(N,-1);
    
    bool ok=true;
    
    for(int i=0;i<M;i++){
        int a,b;cin>>a>>b;
        a--;
        if(A[a]==-1) A[a]=b;
        else if(A[a]!=b) ok=false;
    }
    
    if(!ok||(N>=2&&A[0]==0)) cout<<-1<<endl;
    else{
        if(N==1){
            if(A[0]==-1) A[0]=0;
            cout<<A[0]<<endl;
        }else{
            if(A[0]==-1) A[0]=1;
            for(int i=1;i<N;i++){
                if(A[i]==-1) A[i]=0;
            }
            for(int i=0;i<N;i++) cout<<A[i];
            cout<<endl;
        }
    }
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using intl = long long;
using itnl = long long;
using itn = int;
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define rrep(i, n) for(intl i = (intl)(n); i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define rrepi(i, a, b) for(intl i = (intl)(a); i >= (intl)(b); i--)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define cin(i, a) rep(i, alength(a))cin >> a[i]
#define ccin(i, j, a) rep(i, alength(a))rep(j, alength(a[i]))cin >> a[i][j]
#define debug(x) cout << #x << ":" << x << endl
#define rdebug(i,x) rep(i, alength(x))cout << #x << "[" << i << "]:" << x[i] << endl
#define sqrt sqrtl
#define itn int
#define double ld
#define pb push_back
#define mp make_pair
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld eps = 1.0e-14;//-9
void fp(bool f){cout << (f ? "Yes" : "No") << endl;}
void fp(bool f, string s, string t){cout << (f ? s : t) << endl;}
intl kai(intl k){
    intl a = 1;
    for(int i = 2; i <= k; i++){
        a *= i;
    }
    return a;
}
intl gcd(intl a, intl b){
    if(!b)return a;
    return gcd(b, a % b);
}
intl lcm(intl a,intl b){
    return a / gcd(a, b) * b;
}
intl digit10(intl a){
    intl b = 0;
    do{
        a /= 10;
        b++;
    }while(a);
    return b;
}
signed main(){
    cout << fixed << setprecision(10);
    intl a,b,c,d;
    cin >> a >> b >> c;
    fp((a <= c)&&(a + b >= c),"YES","NO");
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main {
	public static void main (String[] args) {
    	Scanner scanner = new Scanner(System.in);
    	int N = scanner.nextInt();
		
		String s = calculate(N);
		System.out.println(s);
	}
	
	public static String calculate(int n) {
		String str = null;
		
		calc:
		for (int x = 0; x <= n; x++) {
			for (int y = 0; y <= n; y++) {
				if ( n == 4*x + 7*y) {
					str = "Yes";
					break calc;
				}
			}
			str ="No";
		}
		
		//System.out.println(str);
		return str;
	}
}

Measured memory_bytes: 23764
void main()
{
    long n = readln.chomp.to!long;

    if (n & 1)
    {
        0.writeln;
    }
    else
    {
        long cnt;
        long d = 10;
        while (d <= n)
        {
            cnt += n / d;
            d *= 5;
        }

        cnt.writeln;
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 380
// 利用栈来求解逆波兰表达式

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int top, S[100];

void push(int x) { S[++top] = x; }

int pop() {
  top--;
  return S[top + 1];
}

int main() {
  int a, b;
  top = 0;
  char s[100];
  while (scanf("%s", s) != EOF) {
    if (s[0] == '+') {
      a = pop();
      b = pop();
      push(a + b);
    } else if (s[0] == '-') {
      a = pop();
      b = pop();
      push(b - a);
    } else if (s[0] == '*') {
      a = pop();
      b = pop();
      push(a * b);
    } else if (s[0] == '+') {
      a = pop();
      b = pop();
      push(a + b);
    } else {
      push(atoi(s));
    }
  }

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



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

int main(){
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(0);
	int n, t;
	cin >> n >> t;
	int a[n];
	for(int i = 0;i < n; ++i){
		cin >> a[i];
	}
	int mx = 0,p = 0;
	for(int i = n-1;i>=0;--i){
		mx = max(mx, a[i]);
		p = max(p, mx - a[i]);
	}
	mx = 0;
	int mxcnt=0,curcnt=0;
	int ans = 0;
	for(int i = n-1;i>=0;--i){
		if(mx < a[i]){
			ans += min(mxcnt,curcnt);	
			mxcnt = 0;
			curcnt = 0;
			mx = a[i];
		}
		mxcnt += a[i] == mx;
		curcnt += mx - p == a[i];
	}
	ans += min(mxcnt,curcnt);	
	cout << ans << '\n';
}


Measured memory_bytes: 640
N, Y = map(int, input().split())

for x in range(N+1):
    for y in range(N+1):
        z = N - (x+y)
        if z >= 0 and 10000*x + 5000*y + 1000*z == Y:
            print(x,y,z)
            exit()
print(-1,-1,-1)

Measured memory_bytes: 3060
program main
	implicit none
	integer :: N, i, S
	integer, allocatable :: a(:)
	
	read(*, *) N
	allocate(a(1:N))
	read(*, *) a
	
	S = 0
	do i = 1, N
		if(i == a(a(i)) .AND. i < a(i)) then
			S = S + 1
		end if
	end do
	
	write(*, *) S
end program main

Measured memory_bytes: 1152
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb emplace_back
#define INF (1e9+1)
//#define INF (1LL<<59)

#define Left second
#define Right first
class SEGMENTS{
private:
    
    map<int,int> dat;
    
    bool isInclude(int li, int ri, int L, int R){ return (L<=li && ri<=R); }
    
public:
    
    void erase(int l, int r){
        while(true){
            auto it = dat.upper_bound(l);
            if(it==dat.end() || r<=it->Left)break;
            
            int li = it->Left;
            int ri = it->Right;
            
            if( isInclude(li,ri,l,r) ) dat.erase(it);
            else{
                int tl = li, tr = ri;
                dat.erase(it);
                if( isInclude(l,r,li,ri) ){
                    if(li!=l) dat[l] = li;
                    if(r!=ri) dat[ri] = r;
                }else{
                    if(li<=l&&l<ri) tr = l;
                    if(l<=li&&li<r) tl = r;
                    if(tl!=tr) dat[tr] = tl;
                }
            }
        }
    }
    
    void insert(int l, int r){
        while(true){
            auto it = dat.upper_bound(l);
            if(it==dat.end() || r<it->Left){
                if(dat.count(l)){
                    dat[r] = dat[l];
                    dat.erase(l);
                }
                else dat[r] = l;
                break;
            }
            
            if( isInclude(it->Left,it->Right,l,r) ) dat.erase(it);
            else{
                l = min(l,it->Left);
                r = max(r,it->Right);
            }
        }
    }
    
    int size(){ return dat.size(); }
    
    void output(){ for(auto e:dat)cout<<e.Left<<" "<<e.Right<<endl;cout<<endl; }
};

int main(){
    int n;
    cin>>n;
    string s;
    cin>>s;
    
    SEGMENTS st;
    
    for(int i=0;i<n;){
        if(s[i]=='0')i++;
        else{
            int l=i;
            while(i<n && s[i]=='1') i++;
            st.insert(l,i);
        }
    }
    
    int q;
    cin>>q;
    while(q--){
        int l,r,b;
        cin>>l>>r>>b;
        l--;
        
        if(b==0)    st.erase(l,r);
        else        st.insert(l,r);
        
        cout<<st.size()<<endl;
    }
}

Measured memory_bytes: 4172
#include <algorithm>
#include <cassert>
// #include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
// #include <random>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

/*
unsigned seed1 = std::chrono::system_clock::now().time_since_epoch().count();
mt19937 g1.seed(seed1);
*/
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<pii, pii> ppiipii;
typedef pair<int, ppiipii> pippiipii;
typedef pair<int, pii> pipii;
typedef pair<pii, int> ppiii;
typedef pair<int, ppiii> pippiii;
typedef pair<int, ll> pill;
typedef pair<int, double> pid;
// note to self, the below two triggers someone
typedef pair<ll, ll> pll;
typedef pair<ll, int> plli;
typedef long double ld;

int main() {
  int n, t;
  scanf("%d %d", &n, &t);
  int lowest = 1 << 30;
  int ret = 0;
  int save = 0;
  for(int i = 0; i < n; i++) {
    scanf("%d", &t);
    if(t - lowest > save) {
      ret = 0;
      save = t - lowest;
    }
    if(t - lowest == save) ret++;
    lowest = min(lowest, t);
  }
  printf("%d\n", ret);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int H,W;
  cin >> H >> W;

  vector<string>S(H);
  for (int i = 0; i < H; i++) {
      cin >> S.at(i);
  }
  
  int count = 0;
  vector<vector<int>> yoko(H, vector<int>(W));
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (S.at(i).at(j) == '.'){
        count++;
      }
      
      if (S.at(i).at(j) == '#'){
        yoko.at(i).at(j) = 0;
          for (int k = 0; k < count; k++) {
            yoko.at(i).at(j-k-1) = count;
          }
        count = 0;
      }
      else if (S.at(i).at(j) == '.' && j == W-1){
        for (int k = 0; k < count; k++) {
          yoko.at(i).at(j-k) = count;
        }
        count = 0;
      }
    }
  }
  
  count = 0;
  vector<vector<int>> tate(H, vector<int>(W));
  for (int j = 0; j < W; j++) {
    for (int i = 0; i < H; i++) {
      if (S.at(i).at(j) == '.'){
        count++;
      }
      
      if (S.at(i).at(j) == '#'){
        tate.at(i).at(j) = 0;
          for (int k = 0; k < count; k++) {
            tate.at(i-k-1).at(j) = count;
          }
        count = 0;
      }
      else if (S.at(i).at(j) == '.' && i == H-1){
        for (int k = 0; k < count; k++) {
          tate.at(i-k).at(j) = count;
        }
        count = 0;
      }
    }
  }
  
  int j = 0;
  int k = 0;
  vector<int>A(H*W);
  for (int i = 0; i < H*W; i++) {
    A.at(i) = tate.at(j).at(k) + yoko.at(j).at(k);
    if (k == W-1){
      k = 0;
      j++;
    }
    else {
      k++;
    }
  }
  sort(A.begin(), A.end());
  cout << A.at(H*W-1)-1 << endl;
}
     

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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
#define debug(x) cerr << #x << ": " << x << endl
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2018/02/14  Problem: 061_arc_a / Link: https://arc060.contest.atcoder.jp/tasks/arc060_a?lang=en  ----- */
/* ------問題------

1 以上 9 以下の数字のみからなる文字列 S が与えられます。 この文字列の中で、あなたはこれら文字と文字の間のうち、いくつかの場所に + を入れることができます。
一つも入れなくてもかまいません。 ただし、+ が連続してはいけません。
このようにして出来る全ての文字列を数式とみなし、和を計算することができます。
ありうる全ての数式の値を計算し、その合計を出力してください。

-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */

LL N,K;

LL ans = 0LL;

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

	string S;
	cin >> S;
	VI a(SZ(S));
	FOR(i, 0, SZ(S)) {
		a[i] = S[i] - '0';
	}
	FOR(bit, 0, 1 << (SZ(S)-1)) {
		LL sum = 0;
		LL ret = a[0];
		FOR(i, 1, SZ(a)) {
			if (bit&(1 << (i-1))) {
				sum += ret;
				ret = a[i];
			}
			else ret = 10 * ret + a[i];
		}
		sum += ret;
		ans += sum;
	}

	cout << ans << "\n";

	return 0;
}


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

#define NREP() for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define ALL(x) (x).begin(),(x).end()
#define MSG(x) cout << x << endl;
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
using ll = long long;
const static ll MOD = 1e9 + 7;

int main(int argc, char *argv[]) {
    ll n;
    cin >> n;

    ll p = 0;
    while (pow(2,p) <= n) {
        p++;
    }

    p--;
    MSG(pow(2, p))
}

Measured memory_bytes: 256
#_______________________________________________________________#
def fact(x):
	if x == 0:
		return 1
	else:
		return x * fact(x-1)
def lower_bound(li, num): 
	answer = -1
	start = 0
	end = len(li)-1

	while(start <= end):
		middle = (end+start)//2
		if li[middle] >= num:
			answer = middle
			end = middle - 1
		else:
			start = middle + 1
	return answer #index where x is not less than num
def upper_bound(li, num): 
	answer = -1
	start = 0
	end = len(li)-1

	while(start <= end):
		middle = (end+start)//2

		if li[middle] <= num:
			answer = middle
			start = middle + 1
		
		else:
			end = middle - 1
	return answer #index where x is not greater than num

def abs(x):
	return x if x >=0 else -x
def binary_search(li, val, lb, ub): 
	ans = 0
	while(lb <= ub):
		mid = (lb+ub)//2
		#print(mid, li[mid])
		if li[mid] > val:
			ub = mid-1
		elif val > li[mid]:
			lb = mid + 1
		else:
			ans = 1
			break
	return ans
def kadane(x): #maximum sum contiguous subarray
	sum_so_far = 0
	current_sum = 0
	for i in x:
		current_sum += i
		if current_sum < 0:
			current_sum = 0
		else:
			sum_so_far = mpos(sum_so_far,current_sum)
	return sum_so_far
def pref(li):
	pref_sum = [0]
	for i in li:
		pref_sum.append(pref_sum[-1] + i)
	return pref_sum

#_______________________________________________________________#
'''
      ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
   ▄███████▀▀▀▀▀▀███████▄
░▐████▀▒▒Aestroix▒▒▀██████
░███▀▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▀████
░▐██▒▒▒▒▒KARMANYA▒▒▒▒▒▒████▌         ________________
░▐█▌▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒████▌  ? ?   |▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒|
░░█▒▒▄▀▀▀▀▀▄▒▒▄▀▀▀▀▀▄▒▒▐███▌   ?    |___CM ONE DAY___|
░░░▐░░░▄▄░░▌▐░░░▄▄░░▌▒▐███▌     ? ? |▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒|
░▄▀▌░░░▀▀░░▌▐░░░▀▀░░▌▒▀▒█▌    ? ?    
░▌▒▀▄░░░░▄▀▒▒▀▄░░░▄▀▒▒▄▀▒▌      ? 
░▀▄▐▒▀▀▀▀▒▒▒▒▒▒▀▀▀▒▒▒▒▒▒█     ? ? 
░░░▀▌▒▄██▄▄▄▄████▄▒▒▒▒█▀       ? 
░░░░▄█████████ ████=========█▒▒▐▌
░░░▀███▀▀████▀█████▀▒▌
░░░░░▌▒▒▒▄▒▒▒▄▒▒▒▒▒▒▐
░░░░░▌▒▒▒▒▀▀▀▒▒▒▒▒▒▒▐
░░░░░████████████████
'''
from math import *
#for _ in range(int(input())):
for _ in range(1):
	#n = int(input())
	#p,f = map(int,input().split())
	#d,t,s = map(int,input().split())
	#ws,wa = map(int,input().split())
	#b = list(input())
	#x = int(input())
	#n = len(b)
	#s2 = input()
	#r, g, b, w = map(int,input().split())
	#a = list(map(int,input().split()))
	#b = list(map(int,input().split()))
	#s1 = list(st)
	s = input()
	t = input()
	n = len(s)
	m = len(t)
	cnt = 10000
	for i in range(n-m+1):
		st = s[i:i+m]
		if st == t:
			cnt = 0
			break
		else:
			temp = 0
			for j in range(m):
				if st[j] != t[j]:
					temp += 1
			cnt = min(cnt,temp)
	print(cnt)





	


















	






Measured memory_bytes: 73332
#[allow(unused_imports)]
use {
   proconio::{fastout, input, marker::*},
   std::cmp::*,
   std::collections::*,
};

#[fastout]
fn main() {
   input! {
      n: usize,
   }

   let mut ans = 0;
   for i in 1..=n {
      let m = n / i;
      ans += i * m * (m + 1) / 2;
   }
   println!("{}", ans);
}


Measured memory_bytes: 2196
#include<iostream>
#define MIN -100
#define MAX 100
#define SIZE 100
using namespace std;

int main() {
    int N, M, X, Y;
    cin >> N >> M >> X >> Y;
    int xs[SIZE];
    int ys[SIZE];
    for (int i = 0; i < N ; i++) cin >> xs[i];
    for (int i = 0; i < M ; i++) cin >> ys[i];

    int Z = MIN;
    bool found = false;
    for (int z = MIN + 1; z <= MAX && !found; z++) {
        if ((X < z) && (z <= Y)) found = true;
        else found = false;
        for (int i = 0; i < N && found; i++) found *= (xs[i] < z);
        for (int i = 0; i < M && found; i++) found *= (z <= ys[i]);

        if (found) Z = z;
    }

    if (Z > MIN) cout << "No War" << endl;
    else cout << "War" << endl;

    return 0;
}

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

int main(){
    ll N;
    cin >> N;
    ll ans = 1e15;
    for(ll i = 1; i * i <= N; i++){
        if(N % i != 0) continue;
        ans = min(ans, (i-1) + (N/i - 1));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#! -*- coding:utf-8 -*-
n = int(input())
a = map(int,input().split())
a = list(a)
a = sorted(a,reverse=True)

x = 0
tmp = 0
for i in range(len(a)):
    #print(a)
    #print(tmp,a[0])
    if tmp == a[0]:
        x = a[0]
        a.remove(a[0])
        break
    else:
        tmp = a[0]
        a.remove(a[0])

b = 0
tmp = 0
for i in range(len(a)):
    if tmp == a[0]:
        b = a[0]
        break
    else:
        tmp = a[0]
        a.remove(a[0])

#print(x)
#print(b)
print(x*b)


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

typedef long long ll;

ll find(ll x)
{
	ll l = 0,r = pow(2e18,0.2);
	while( l <= r )
	{
		ll mid = ( l + r ) / 2;
		ll z = mid * mid * mid * mid * mid;
		if( z > x )
		{
			r = mid - 1;
		}else if( z < x )
		{
			l = mid + 1;
		}else return mid;
	}
	return -1;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll x;
	cin >> x;
	for (ll i = 0; i <= 2000; i++)
	{
		ll z = i * i * i * i * i;
		ll t1 = x + z;
		ll t2 = x - z;
		int ans1 = find(t1);
		int ans2 = find(abs(t2));
		if( ans1 != - 1 )
		{
			cout << ans1 << ' ' << i << '\n';
			return 0;
		}
		if( ans2 != -1 )
		{
			if( t2 < 0 ) ans2 *= -1;
			cout << ans2 << ' ' << i*-1 << '\n';
			return 0;
		}
	}
	return 0;
}


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

MOD = 1000000007
S = input()

def add(a,b):
    a += b
    if a >= MOD:
        a -= MOD
    return a

dp = [[0 for i in range(5)] for j in range(200000)]

dp[0][0] = 1

for i in range(len(S)):
    for j in range(4):
        if S[i] == '?':
            dp[i+1][j] = add(dp[i+1][j], dp[i][j] * 3 % MOD)
        else:
            dp[i+1][j] = add(dp[i+1][j], dp[i][j])
    if S[i] == 'A' or S[i] == '?':
        dp[i+1][1] = add(dp[i+1][1], dp[i][0])
    if S[i] == 'B' or S[i] == '?':
        dp[i+1][2] = add(dp[i+1][2], dp[i][1])
    if S[i] == 'C' or S[i] == '?':
        dp[i+1][3] = add(dp[i+1][3], dp[i][2])

print(dp[len(S)][3])

Measured memory_bytes: 45688
#include<bits/stdc++.h>
using namespace std;
//#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define co(a) cout<<a<<endl
#define sz size()
#define bgn begin()
#define en end()
#define pb(a) push_back(a)
#define pop pop_back
#define V vector
#define P pair
#define V2(a,b,c) V<V<int>> a(b,V<int>(c))
#define V2a(a,b,c,d) V<V<int>> a(b,V<int>(c,d))
#define incin(a) int a; cin>>a
//#define min min<int>
//#define max max<int>
template<class T>
 void cou(vector<vector<T>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}
/*template<>
 void cou(vector<vector<char>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}*/
 int wari(int a,int b) {
   if(a%b==0)
     return a/b;
   else
     return a/b+1;
 }
 int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
 int souwa(int a){
  return a*(a+1)/2;
 }
 int lcm(int a,int b){
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }
 bool prime(int a){
   if(a<2)
     return false;
   else if(a==2)
     return true;
   else if(a%2==0)
     return false;
   double b=sqrt(a);
    for(int i=3;i<=b;i+=2){
      if(a%i==0){
        return false;
      }
    }
   return true;
 }
struct Union{
  vector<int> par;
  Union(int n){
	par= vector<int>(n, -1);
  }
  int find(int x){
    if(par[x]<0)
      return x;
    else
      return par[x]=find(par[x]);
  }
  bool same(int a,int b){
    return find(a)==find(b);
  }
  int Size(int a){
    return -par[find(a)];
  }
  void unite(int a,int b){
    a=find(a);
    b=find(b);
    if(a==b)
      return;
    if(Size(b)>Size(a))
      swap<int>(a,b);
    par[a]+=par[b];
    par[b]=a;
  }
};
int ketas(int a){
  string b=to_string(a);
  int c=0;
  fo(i,keta(a)){
    c+=b[i]-'0';
  }
  return c;
}
/*struct aa{
	vector<int> gt;
  aa(int n){
	gt= vector<int>(n, 1);
  }
	void c(V<int> d,int b){
	if(d[b]==0){
		gt[d[b]-1]++;
		gt[gt.sz-1]++;
	}
	else{
		gt[d[b]-1]++;
		c(d,d[d[b]]-1);
	}
}
void cok(int a){
	cout<<gt[a-1]<<endl;
	fo(i,a-1)
	cout<<gt[i]<<endl;
}
};
*/
signed main(){
	int a,b;
	cin>>a>>b;
	cout<<(a%b!=0)<<endl;
}

Measured memory_bytes: 256
N = int(input())
S = []
for _ in range(N):
    S.append(input())
print("AC x {}".format(S.count("AC")))
print("WA x {}".format(S.count("WA")))
print("TLE x {}".format(S.count("TLE")))
print("RE x {}".format(S.count("RE")))

Measured memory_bytes: 16052
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
      return Array.new(size1){init}
  else
      return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

N=gets.to_i
def bfs(g)
    que=[0]
    cost=array(N,INF)
    cost[0]=0
    until que==[]
        p=que.shift
        g[p].each do|v,c|
            next unless cost[v]==INF
            cost[v]=cost[p]+c
            que.push(v)
        end
    end
    return cost
end
g=Array.new(N){[]}
(N-1).times do|i|
  u,v,w=get_i
  u-=1
  v-=1
  g[u].push([v,w])
  g[v].push([u,w])
end
cost=bfs(g)
ans=array(N)
ans[0]=0
1.upto(N-1) do|i|
  if cost[i].even?
      ans[i]=0
  else
      ans[i]=1
  end 
end
puts ans.join("\n")

Measured memory_bytes: 34324
#include<bits/stdc++.h>
#define qq ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define mod 1000000007
using namespace std;
int main()
{
	string s;
	cin>>s;
	for(int i=0;i<s.length();i++)
	{
		if(s[i]==s[i+1]){
			cout<<"Bad"<<endl;
			return 0;
		}
		else continue;
	}
	cout<<"Good"<<endl;
	return 0;
	
}

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

const int N = 10;

int n, m, k;
char s[N][N];

int solve() {
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 0; i < n; ++i) {
    scanf("%s", s[i]);
  }

  int ans = 0;
  for (int i = 0; i < 1 << n; ++i) {
    for (int j = 0; j < 1 << m; ++j) {
      int cnt = 0;
      for (int r = 0; r < n; ++r) {
        if (i >> r & 1) continue;  
        for (int c = 0; c < m; ++c) {
          if (j >> c & 1) continue;  
          if (s[r][c] == '#') ++cnt;
        }
      }

      if (cnt == k) ++ans;
    }
  }

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

int main() {
  int t = 1;
  // scanf("%d", &t);
  while (t--) solve();
  return 0;
}


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

int main() {
  int N, X;
  cin >> N >> X;
  vector<int> vec(N);
  int sum = 0;
  
  for (int i = 0; i < N; i++){
    cin >> vec.at(i);
    sum += vec.at(i);
  }
  
  sort(vec.begin(), vec.end());
  int r = X - sum;
  int count = 0;
  
  while (r >= vec.at(0)) {
    r -= vec.at(0);
    count++;
  }
  
  cout << N + count << endl;
}


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

def readInts():
  return [int(s) for s in input().split(" ")]

def main():
  N = readInts()[0]
  A = readInts()
  minus = 0
  m = abs(A[0])
  s = 0
  for a in A:
    if a < 0:
      minus += 1
    if abs(a) < m:
      m = abs(a)
    s += abs(a)

  if minus % 2 == 0:
    print(s)
  else:
    print(s - 2 * m)

if __name__ == "__main__":
  main()


Measured memory_bytes: 14412
public class Print_Test_Cases {

  static void Main(string[] args) {
    int counter = 0;
    while(true) {
      var line = System.Console.ReadLine();
      if(line == "0") {
        break;
      }
      System.Console.WriteLine("Case {0}: {1}", ++counter, line);
    }
  }

}

Measured memory_bytes: 9312
N = gets.to_i
get = "3 3 3 3 3"
a = gets.split(" ").map(&:to_i)

max = a.max
min_count = 0
kekka = true

N.times do |i|
    kekka = false if a[i] < max - 1
    min_count += 1 if a[i] == max - 1
end

if kekka
    if 2 * max - min_count > N 
        kekka = false
    elsif min_count >= max
        kekka = false
    end
end

kekka = true if a.all?{|item| item == N - 1}

if kekka
    puts "Yes"
else
    puts "No"
end

Measured memory_bytes: 8076
import java.util.Scanner;

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

        int a = sc.nextInt();
        int b = sc.nextInt();

        if((a >= 0 && b <= 0) || (a <= 0 && b >= 0)) {
            System.out.println("Zero");
        } else if (a < 0 && b < 0) {
            int x = b - a;
            if (x % 2 == 0) {
                System.out.println("Negative");
            } else {
                System.out.println("Positive");
            }
        } else if (a > 0 && b > 0) {
            System.out.println("Positive");
        }
    }
}


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



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

	int a, b, c, d,  e;
	a = k / 100;
	b = k % 100;
	c = b / 10;
	d = b % 10;



	if (a==7||c==7||d==7) {
		cout << "Yes";

	}
	else {
		cout << "No";
	}
}


Measured memory_bytes: 3620
//#include<bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<numeric>
#include<vector>
#include<set>
#include<map>
#include<unordered_map>
#include<stack>
#include<queue>
#include<list>
using namespace std;

typedef long long ll;

#define MOD 1000000007

class Comb{
private:
  ll *fac,*finv,*inv;
public:
  Comb(){
    fac = new ll[1000000];
    finv = new ll[1000000];
    inv = new ll[1000000];
    fac[0] = 1;
    for(int i=1;i<1000000;i++){
      fac[i] = i*fac[i-1];
      fac[i] %= MOD;
    }
    inv[1] = 1;
    for(int i=2;i<1000000;i++){
      inv[i] = MOD-inv[MOD%i]*(MOD/i)%MOD;
    }
    finv[0] = 1;
    for(int i=1;i<1000000;i++){
      finv[i] = inv[i]*finv[i-1];
      finv[i] %= MOD;
    }
  }
  ll calc(ll n,ll k){
    ll c = fac[n];
    c *= finv[k];c %= MOD;
    c *= finv[n-k];c %= MOD;
    return c;
  }
};

int main(){
  string s;
  cin >> s;
  if(s[2]==s[3] && s[4]==s[5]) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


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

int main(){

  int n;
  string s;
  cin >> n >> s;
  int cur = 0;
  int ans = 0;
  for(int i = 0; i < n; i++){
    if(s[i] == 'I')
      cur++;
    else
      cur--;

    ans = max(ans, cur);
  }

  cout << ans << endl;


}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,q,w,e,r,sum=0;
  cin>>a>>b;
  for(;a<=b;a++){
    q=a%10;
    w=a/10000;
    e=((a-q-w*10000)/10)%10;
    r=((a-q-w*10000)/10)/100;
    if(q==w&&e==r){
      sum+=1;
    }
  }
  cout<<sum;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
height = [0] + list(map(int, input().split()))
mawari = [0] * (n+1) 
ans = 0

for _ in range(m):
    a, b = map(int, input().split())
    mawari[a] = max(mawari[a], height[b])
    mawari[b] = max(mawari[b], height[a])
    

for i in range(1,n+1):
    if height[i]> mawari[i]:
        ans += 1
print(ans)

Measured memory_bytes: 19920
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int k = scan.nextInt();
		String s = scan.next();

		System.out.println(s.substring(0,k - 1) + s.substring(k - 1, k).toLowerCase() + s.substring(k));
	}
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
int i,j,n,x,mx=0,a;
map<int,int>m;
int main()
{
    cin>>n;
    for(j=1;j<=n;j++)
    {cin>>x;
       for(i=2;i*i<=x;i++)
       {
        a=0;
        while(x%i==0)
          {x/=i;
          if(!a){
             m[i]++;a++;}
           mx=max(m[i],mx);
          }
       }
       if(x!=1){m[x]++;mx=max(m[x],mx);}
    }
    if(mx==1||mx==0)cout<<"pairwise coprime";
    else if(mx<n)cout<<"setwise coprime";
    else cout<<"not coprime";
}

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

main(){
  int n,i,p=0;
  cin >> n;
  char c;
  for (i=1;i<=n;i++){
    cin >> c;
    if (c=='Y') p++;
  }
  if (p!=0) cout << "Four" << endl;
  else cout << "Three" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using st = size_t;
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;
using ull = unsigned long long;
#define inf 0x40000000
#define all(v) v.begin(), v.end()
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
template <typename T> using mptr = T*;

int main(){
    int n,k,ans;
    cin>>n>>k;
    vi d(k);
    rep(i,k)cin>>d.at(i);
    bool no=false;
    for(int tpn;;){
        for(int i=0;i<d.size();++i){
            tpn=n;
            no=false;
            while(tpn){
                if(tpn%10==d.at(i)){no=true;break;}
                tpn/=10;
            }
            if(no){++n;break;}
        }
        if(!no){ans=n;break;}
    }
    cout<<ans<<"\n"s;
}

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

using namespace std;
using ll = long long;


int main()
{
    string s; cin >> s;
    vector<ll> cnt(26);
    for(int i = 0; i < 26; i++) {
        cnt[i] = count(s.begin(), s.end(), 'a' + i);
    }
    ll n = s.size();
    ll ans = n * (n - 1) / 2;
    for(int i = 0; i < 26; i++) {
        ans -= (cnt[i] - 1) * cnt[i] / 2;
    }
    cout << ans + 1 << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define fi first
#define se second
#define show(x) cerr<<#x<<"="<<x<<"\n"
typedef long long ll;
using namespace std;
//const ll MOD=(ll)1e9+7;
//const ll inf=(ll)1e14;
const int dy[]={1,0,-1,0};
const int dx[]={0,1,0,-1};
int n,m,h,w;
char a[51][51],b[51][51],c[51][51];

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout<<fixed;
#ifdef LOCAL_DEFINE
  FILE *stream1;
  //FILE *stream2;
  stream1=freopen("in","r",stdin);
  //stream2=freopen("out","w",stdout);
  if(stream1==NULL)return 0;
  //if(stream2==NULL)return 0;
#endif
  while(cin>>w>>h,h){
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
        cin>>a[i][j];
        b[i][j]=a[i][j];
        c[i][j]=a[i][j];
      } 
    }
    while(1){
      bool flag=0;
      for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
          if(a[i][j]=='W'){
            for(int d=0;d<4;d++){
              if(i+dy[d]<0 || i+dy[d]>=h)continue;
              if(j+dx[d]<0 || j+dx[d]>=w)continue;
              if(a[i+dy[d]][j+dx[d]]=='B')continue;
              if(a[i+dy[d]][j+dx[d]]=='W')continue;
              a[i+dy[d]][j+dx[d]]='W';
              flag=1;
            }
          }
        }
      }
      if(!flag)break;
    }
    /*for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
        cout<<a[i][j];
      }
      cout<<"\n";
    }
    cout<<"\n";*/
    while(1){
      bool flag=0;
      for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
          if(b[i][j]=='B'){
            for(int d=0;d<4;d++){
              if(i+dy[d]<0 || i+dy[d]>=h)continue;
              if(j+dx[d]<0 || j+dx[d]>=w)continue;
              if(b[i+dy[d]][j+dx[d]]=='B')continue;
              if(b[i+dy[d]][j+dx[d]]=='W')continue;
              b[i+dy[d]][j+dx[d]]='B';
              flag=1;
            }
          }
        }
      }
      if(!flag)break;
    }
    /*for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
        cout<<b[i][j];
      }
      cout<<"\n";
    }*/
    int bl=0,wh=0;
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
        if(c[i][j]!='.')continue;
        if(a[i][j]=='W' && b[i][j]=='.')wh++;
        if(a[i][j]=='.' && b[i][j]=='B')bl++;
      }
    }
    cout<<bl<<" "<<wh<<endl;
  }
#ifdef LOCAL_DEFINE
  cerr<<"Time elapsed: "<<1.0*clock()/CLOCKS_PER_SEC<<"s.\n";
  fclose(stream1);
  //fclose(stream2);
#endif
  return 0;
}







Measured memory_bytes: 3040
#include<bits/stdc++.h>
using namespace std;
#define Size 10000000
#define ll long long int
#define Sort(x) sort(x.begin(),x.end())
#define fr(x) for(long long i=0;i<x;i++)
#define rep(i,a,b) for (ll i = a; i <= b; ++i)
#define debug(x) cout<<x<<"\n"
#define dec(i,a,b) for (ll i = a; i >= b; --i)
#define pb push_back
#define in(x) cin>>x


int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll N,ans=0;
    in(N);
    vector<ll> A;
    fr(N){
        ll x;
        in(x);
        A.pb(x);
    }
    rep(i,1,A.size()-1){
        if(A[i]<A[i-1]){
            ans+=A[i-1]-A[i];
            A[i]=A[i-1];
        }
        else continue;
    }
    debug(ans);
}




Measured memory_bytes: 5328
#include <iostream>
#include<map>
using namespace std;
typedef long long ll;
ll n,s[26],d[365][26],t[365],ans,u[26],q,a,b,c,MAX=-10000000,L,A[365];
int main(void){
    cin>>n;
    for(int i=0;i<26;i++){
        cin>>s[i];
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<26;j++){
            cin>>d[i][j];
        }
    }
    
    
    for(int i=0;i<n;i++){
            A[i]=t[i]=rand()%26+1;
        }
        
        
    q=20000;
    while(q--){
        a=rand()%n;
        b=rand()%26;
        ans=0;
        for(int i=0;i<26;i++)u[i]=0;
        
        c=t[a];
        t[a]=b+1;
        
        for(int i=0;i<n;i++){
            ans+=d[i][t[i]-1];
            u[t[i]-1]=i+1;
            for(int j=0;j<26;j++){
                ans-=s[j]*(i+1-u[j]);
            }
        }
        if(MAX<ans){
            MAX=ans;
            for(int i=0;i<n;i++){
                A[i]=t[i];
            }
        }
        else t[a]=c;
    }
    
    for(int i=0;i<n;i++){
        cout<<A[i]<<endl;
    }
    //cout<<MAX<<endl;
}


Measured memory_bytes: 3692
#include <stdio.h>

int main(void)
{
  int n, a, b;
  scanf("%d %d %d", &n, &a, &b);
  char s[n];
  int i = 0;
  int dms = 0;
  int frg = 0;
  int pass = 0;
  while (i < n)
  {
    scanf("%s", &s[i]);
    if (s[i] == 'a')
    {
      dms++;
      if (pass < a + b)
      {
        printf("Yes\n");
        pass++;
      }
      else
        printf("No\n");
    }
    else if (s[i] == 'b')
    {
      frg++;
      if ((pass < a + b) && (frg <= b))
      {
        printf("Yes\n");
        pass++;
      }
      else
        printf("No\n");
    }
    else if (s[i] == 'c')
      printf("No\n");
    i++;
  }
  return 0;
}

Measured memory_bytes: 640
#include <iostream>

using namespace std;

int main(){
    int k, s;
    cin >> k >> s;

    int count = 0;
    int sum;

    for (int x=0; x<=k; x++){
        for (int y=0; y<=k; y++){
            sum = x + y;

            if ( ((s-sum) <= k) && (sum <= s) ){
                count += 1;
            }
        }
    }

    cout << count << endl;
}

Measured memory_bytes: 256
# import bisect
from collections import Counter, deque
# import copy
# from heapq import heappush, heappop, heapify
# from fractions import gcd
# import itertools
# from operator import attrgetter, itemgetter
# import math

import sys

# import numpy as np

ipti = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n = int(input())
    h = list(map(int,ipti().split()))
    h.append(0)

    cnt = 0

    que = deque()
    que.append((0, n, 0))

    while que:
        left, right, height = que.pop()
        flag = False

        for i in range(left, right+1):
            if not flag and h[i] > height:
                nl = i
                flag = True

            if flag and h[i] <= height:
                nr = i
                que.append((nl, nr, height + 1))
                cnt += 1
                flag = False

    print(cnt)



if __name__ == '__main__':
    main()

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

int main() {
    int d, n;
    cin >> d >> n;
    
    int64_t num = 1;
    for (int i = 0; i < d; i++){
        num *= 100;
    }

    int64_t ans = 0;

    ans = num * n;
    if (n == 100){
        ans += num;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256