akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
using namespace std;
const int INF = 1001001001;

int main() {
    int E;
    while(cin >> E && E != 0) {
        vector<int> a(10,INF);
        vector< vector<int> > d(10,a);
        for(int i=0; i<10; i++) d[i][i] = 0;
        for(int i=0; i<E; i++) {
            int s,t,w;
            cin >> s >> t >> w;
            d[s][t] = w;
            d[t][s] = w;
        }

        for(int k=0; k<10; k++) {
            for(int i=0; i<10; i++) {
                for(int j=0; j<10; j++) {
                    if(d[i][k] != INF && d[k][j] != INF) {
                        d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
                    }
                }
            }
        }

        int ans = 0, sum = INF;
        for(int i=0; i<10; i++) {
            if(d[i][0] == INF) break;
            int temp = 0;
            for(int j=0; j<10; j++) {
                if(d[i][j] == INF) break;
                else temp += d[i][j];
            }
            if(sum > temp) {
                ans = i;
                sum = temp;
            }
        }
        cout << ans << " " << sum << endl;
    }
    return 0;
}


Measured memory_bytes: 3108
import math

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

# N = 100000
# M = 1000000000

def pfac(n):
    values = [1, n]
    for i in range(2, int(n ** 0.5) + 1):
        if n % i == 0:
            values.append(i)
            values.append(n // i)
    return values

L = pfac(M)
L = [i for i in L if i * N <= M]

ans = []

for i in L[::-1]:
    if (M - (N * i)) % i == 0:
    # if M % i == 0:
        ans.append(i)

print(max(ans))


Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int N = scan.nextInt();
    scan.nextLine();
    int[] AArray = new int[N];
    int[] BArray = new int[N];
    int[] CArray = new int[N - 1];
    for (int i = 0; i < N; i++) {
      AArray[i] = scan.nextInt();
    }
    for (int i = 0; i < N; i++) {
      BArray[i] = scan.nextInt();
    }
    for (int i = 0; i < N - 1; i++) {
      CArray[i] = scan.nextInt();
    }
    int result = 0;
    int tmp = -1;
    for (int i = 0; i < N; i++) {
      int atmp = AArray[i];
      result += BArray[atmp - 1];
      if (atmp - tmp == 1) {
        result += CArray[tmp - 1];
      }
      tmp = atmp;
    }

    System.out.println(result);

  }

}


Measured memory_bytes: 25172
import java.util.Scanner;

public class Main {

    static int MOD = 1_000_000_007;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        int[] A = new int[N+1];
        for(int i = 1; i <= N; i++) A[i] = sc.nextInt();
        // dp[i][j]：ｉ人目まででｊ個の飴を分ける分け方 % MOD
        long[][] dp = new long[N+1][K+1];
        dp[0][0] = 0;
        int sum = 0;
        for(int i = 1; i <= N; i++){
            sum += A[i];
            for(int j = 0; j <= K; j++){
                if(j == 0) dp[i][j] = 1;
                else if(j <= A[i]) dp[i][j] = (dp[i-1][j] + dp[i][j-1]) % MOD;
                else if(j <= sum) dp[i][j] = (dp[i-1][j] + dp[i][j-1] - dp[i-1][j - A[i] -1] + MOD) % MOD;
            }
        }
        System.out.println(dp[N][K]);
        sc.close();
    }

}


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

int main() {
  int n;
  string s;
  cin >> n >> s;
  
  if (n%2==1) cout << "No" << endl;
  
  else {
    bool judge = true;
    for (int i=0; i<n/2; i++) if (s.at(i) != s.at(i+n/2)) judge = false;
    if (judge) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string.h>
typedef long long ll;

#define MAX(x, y)	(((x) > (y))? (x) : (y))
#define MIN(x, y)	(((x) < (y))? (x) : (y))
#define ABS(x)		(((x) < 0)? (-1*(x)) : (x))
#define REPI(x,y)	for (int i=(x);i<(y);i++)
#define REPJ(x,y)	for (int j=(x);j<(y);j++)
#define MEMCLR(X)	memset((X),0,sizeof((X)))

using namespace std;
typedef vector<vector<pair<int, int>>> GRA;

int i,j;
string s;

int main() {
	cin >> s;
	int x = stoi(s);
	switch (x) {
	case 1:
	case 10:
	case 100:
		 cout << 1 << endl;break;
	case 11:
	case 101:
	case 110:
		 cout << 2 << endl;break;
	case 111:
		 cout << 3 << endl;break;
	default:
		 cout << 0 << endl;break;
	}
	
	return 0;
}

Measured memory_bytes: 256
fun main(args : Array<String>) {
    val (m1, d1) = readLine()!!.split(" ").map { it.toInt() }
    val (m2, d2) = readLine()!!.split(" ").map { it.toInt() }

    if (m1 == 12) {
        println(if (m2 == 1) 1 else 0)
    } else {
        println(if (m2 == m1+1) 1 else 0)
    }
}

Measured memory_bytes: 38120
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

inline int toInt(string s) {int v; istringstream sin(s);sin>>v; return v;}

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector< vector<int> > Mat;
typedef tuple<int, int, int, int> T;

const int MOD = (int)1e9+7;
const int INF = (int)1e9;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

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

    ll N, M;
    cin >> N >> M;
    vector< pair<ll, ll> > drink(N);
    rep(i, N) cin >> drink[i].first >> drink[i].second;

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

    ll ans = 0;
    rep(i, N){
        if(drink[i].second <= M){
            ans += drink[i].first * drink[i].second;
            M -= drink[i].second;
        }else{
            ans += drink[i].first * M;
            break;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1792
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())

int a, b,q;
long long s[100000];
long long t[100000];

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


	cin >> a >> b >> q;
	rep(i, a)cin >> s[i];
	rep(i, b)cin >> t[i];


	rep(i, q) {
		long long x;
		cin >> x;
		auto idx1 = lower_bound(s, s + a, x) - s;
		auto idx2 = lower_bound(t, t + b, x) - t;
		long long ans = 1LL << 60;


		if (idx1 < a && idx2 < b) {
			ans = min(ans, max(s[idx1], t[idx2]) - x);
		}
		if (idx1 > 0 && idx2 > 0) {
			ans = min(ans, x - min(s[idx1 - 1], t[idx2 - 1]));
		}
		if (idx1 < a && idx2 > 0) {
			long long d1 = s[idx1] - x;
			long long d2 = x - t[idx2 - 1];
			ans = min(ans, min(d1, d2) * 2 + max(d1, d2));
		}
		if (idx1 > 0 && idx2 < b) {
			long long d1 = x - s[idx1 - 1];
			long long d2 = t[idx2] - x;
			ans = min(ans, min(d1, d2) * 2 + max(d1, d2));
		}
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 2944
x1, y1, x2, y2 = [int(_) for _ in input().split()]
vx, vy = x2 - x1, y2- y1
vx, vy = -vy, vx
x3, y3 = x2 + vx, y2 + vy
vx, vy = -vy, vx
x4, y4 = x3 + vx, y3 + vy
print(x3, y3, x4, y4)


Measured memory_bytes: 2940
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
        new Main().run();
    }
	public void run(){
		Scanner scan = new Scanner(System.in);
		char[] ch = {'m','c','x','i'};
		while(scan.hasNext()){
			int n = scan.nextInt();
			for(int i = 0;i < n;i++){
				String str = scan.next() + scan.next();
				int a = 1;
				int[] sum = new int[4];
				int t;
				for(int j = 0;j < str.length();j++){
					t = str.charAt(j) - '0';
					if(t < 10){
						a = t;
					}else if(t == 61){
						sum[0] += a;
						a = 1;
					}else if(t == 51){
						sum[1] += a;
						a = 1;
					}else if(t == 72){
						sum[2] += a;
						a = 1;
					}else if(t == 57){
						sum[3] += a;
						a = 1;
					}
				}
				if(sum[3] > 9){
					sum[2]++;
					sum[3] -= 10;
				}
				if(sum[2] > 9){
					sum[1]++;
					sum[2] -= 10;
				}
				if(sum[1] > 9){
					sum[0]++;
					sum[1] -= 10;
				}
				str = "";
				for(int j = 0;j < 4;j++){
					if(sum[j] > 1){
						str += sum[j] + "" + ch[j];
					}else if(sum[j] > 0){
						str += ch[j];
					}
				}
				System.out.println(str);
			}
		}
	}
}

Measured memory_bytes: 28428
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

void extended_euclid(ll x,ll y,ll *c,ll *a,ll *b){
  ll a0,a1,a2,b0,b1,b2,r0,r1,r2,q;r0=x;r1=y;a0=1;a1=0;b0=0;b1=1;
  while(r1>0){q=r0/r1;r2=r0%r1;a2=a0-q*a1;b2=b0-q*b1;r0=r1;r1=r2;a0=a1;a1=a2;b0=b1;b1=b2;}
  *c=r0;*a=a0;*b=b0;
}

ll get_inv(ll n, ll p){
  ll a,b,c;
  extended_euclid(n,p,&c,&a,&b);
  if(a<p) a+=p;
  return a%p;
}

ll fact[2000100],fact_inv[2000100];

void init() {
  fact[0]=1;
  REP(i,1,2000100) fact[i]=fact[i-1]*i%MAX;
  fact_inv[2000050]=get_inv(fact[2000050],MAX);
  rrep(i,2000050)fact_inv[i]=fact_inv[i+1]*(i+1)%MAX;
}

ll nCr(ll N,ll K){
  if(K<0||K>N)return 0;
  return fact[N]*fact_inv[K]%MAX*fact_inv[N-K]%MAX;
}

ll nPr(ll N,ll K){
  if(K>N)return 0;
  return fact[N]*fact_inv[N-K]%MAX;
}

vector<int> v[111111];
ll n,m;
ll dfs(ll x,ll p) {
  ll ans=nPr(m+(p==-1?0:-2),max(0LL,(ll)v[x].size()+(p==-1?1:-1)));
  rep(i,v[x].size()) {
    ll y=v[x][i];
    if(y==p) continue;
    ans*=dfs(y,x);
    ans%=MAX;
  }
  return ans;
}

void Main() {
  init();
  cin >> n >> m;
  rep(i,n-1) {
    ll x,y;
    cin >> x >> y;
    x--,y--;
    v[x].pb(y);
    v[y].pb(x);
  }
  pr(dfs(0,-1));
}

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


Measured memory_bytes: 41984
#include<iostream>
using namespace std;
#include<iomanip>
int main(){
  int n,k,i,j;
  double sum=0.0;
  cin>>n>>k;
  for(i=1;i<=n;i++){
    double t=1.0/n;
    j=i;
    while(j<k){
      j*=2;
      t/=2;
    }
    sum=sum+t;
  }
  cout<<fixed<<setprecision(12)<<sum;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#include <cstring>
#include <algorithm>
#include <math.h>
#include <map>
#include <bitset>
#include <cmath>
#include <set>
#include <utility>

#define INF 1000000000000
#define MOD 1000000007 //10^9+7:合同式の法

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

int main(){
    int N,goukei = 0;
    cin >> N;

    while(N > goukei){
        goukei += 1000;

    }

    cout << goukei - N << endl;
    
}

Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main(){
  int n,i,a=0,b,c=0;
  string s;
  cin >> n >> s;
  while(n>0 && s[0]=='.'){
    s.erase(0,1);
    n--;
  }
  while(n>0 && s[n-1]=='#'){
    s.erase(n-1,1);
    n--;
  }
  for(i=0;i<n;i++) if(s[i]=='.') a++;
  b = a;
  for(i=0;i<n;i++){
    if(s[i]=='#'){
      if(i!=0 && s[i-1]=='.'){
        b += c;
        a = min(a,b);
        c = 0;
      }
      c++;
    }else c--;
  }
  b += c;
  a = min(a,b);
  cout << a << endl;
  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
string S;
string st,md,lg;
string df = "dream dreamer erase eraser";
bool flag = true;
int main(){
    cin >> S;
    while(S.size()){
        int L = S.size();
        if( L>= 7){
            lg = S.substr(S.size()-7,7);
            md = S.substr(S.size()-6,6);
            st = S.substr(S.size()-5,5);
        }else if( L >= 6){
            lg = "0";
            md = S.substr(S.size()-6,6);
            st = S.substr(S.size()-5,5);
            
        }else if( L >= 5){
            lg = "0";
            md = "0";
            st = S.substr(S.size()-5,5);
        }else{
            lg = md = st = "0";
        }
        
        if(df.find(lg) != -1){
            S.erase(S.end() - 7, S.end());
        }else if(df.find(md) != -1){
            S.erase(S.end() - 6, S.end());
        }else if(df.find(st) != -1){
            S.erase(S.end() -5 , S.end());
        }else{
            flag = false;
            break;
        }
    }
    
    if(flag){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    
}

Measured memory_bytes: 512
using System;

namespace _99
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] splitStrings = Console.ReadLine().ToString().Split(' ');
            int a = int.Parse(splitStrings[0]);
            int b = int.Parse(splitStrings[1]);

            int ans = 0;

            if (a > 9 || a < 1 || b < 1 || b > 9)
            {
                ans = -1;
            }
            else
            {
                ans = a * b;
            }

            Console.Write(ans);
            Console.ReadKey(true);
        }
    }
}


Measured memory_bytes: 13140
#include<iostream>
#include<algorithm>

using namespace std;


int main()
{
    long long  N,K;
    long long H[200010];
    long long res =0;
    cin >> N >>K;
    for(int i=0;i<N;i++)
    {
        cin >> H[i];
    }
    sort(H,H+N,greater<int>());

   for(int j=K;j<N;++j)
   {
       res = res + H[j];
   }
   cout << res <<endl;
   return 0;
}

Measured memory_bytes: 1792
print("".join([[["{0}\n".format(A[2][B[1]-1]-A[2][B[0]-1]) for B in [list(map(int,input().split())) for i in range(A[0][1])]] for x in [[A[2].append(A[2][i-1]+1) if A[1][0][i-1]=='A' and A[1][0][i]=='C' else A[2].append(A[2][i-1]) for i in range(1,len(A[1][0]))]]] for A in [[[int(x) for x in input().split()],[str(x) for x in input().split()],[0]]]][0][0])[:-1])

Measured memory_bytes: 37088
#include<bits/stdc++.h> //Ithea Myse Valgulious
namespace chtholly{
typedef long long ll;
#define re0 register int
#define rec register char
#define rel register ll
#define gc getchar
#define pc putchar
#define p32 pc(' ')
#define pl puts("")
/*By Citrus*/
inline int read(){
  int x=0,f=1;char c=gc();
  for (;!isdigit(c);c=gc()) f^=c=='-';
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return f?x:-x;
  }
inline void read(rel &x){
  x=0;int f=1;char c=gc();
  for (;!isdigit(c);c=gc()) f^=c=='-';
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  x=f?x:-x;
  }
template <typename mitsuha>
inline int write(mitsuha x){
  if (!x) return pc(48);
  if (x<0) x=-x,pc('-');
  int bit[20],i,p=0;
  for (;x;x/=10) bit[++p]=x%10;
  for (i=p;i;--i) pc(bit[i]+48);
  }
inline char fuhao(){
  char c=gc();
  for (;isspace(c);c=gc());
  return c;
  }
}using namespace chtholly;
using namespace std;
const int yuzu=1e5;
char c[yuzu|10];
int cnt[999],sum;
vector<int> occur[999];

int main(){
scanf("%s",c+1);
int i,j,n=strlen(c+1);
if (n==2){
  if (c[1]==c[2]) printf("1 2");
  else puts("-1 -1");
  return 0;
  }
for (i=1;i<=n-2;++i){
  memset(cnt,0,sizeof cnt);
  for (j=i;j<=i+2;++j){
    if (++cnt[c[j]]>1) return printf("%d %d",i,i+2),0;
    }
  } 
puts("-1 -1");
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,L,R;
string S,T;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

typedef vector<P> vp;
typedef vector<vp> matP;

int main() {
    cin>>N;
    vector<string> w(N);
    bool yes = true;
    rep(i,N) {
        cin>>w[i];
        rep(j,i){
            if(w[j] == w[i]) yes = false;
        }
    }
    reps(i,1,N){
        if(w[i][0] != w[i-1][w[i-1].size() - 1]) yes = false;
    }
    cout<<(yes ? "Yes" : "No")<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long int
int ar[105];
int res[105];
int32_t main(){
	int n;cin>>n;
	ar[n]=10000000000;
	for(int i=1;i<n;i++){
		cin>>ar[i];
	}
	res[1]=ar[1];
	for(int i=2;i<=n;i++){
		res[i]=min(ar[i],ar[i-1]);
	}
	cout<<accumulate(res+1,res+n+1,0);
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <climits>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <bitset>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
typedef long long ll;
typedef pair<int,int> pii;
const int INF = 1<<29;
const double PI = acos(-1);
const double EPS = 1e-8;

char s[1010];

int number(int &i) {
  ll a = 0;
  while(isdigit(s[i])) {
    a = a*2 + (s[i]-'0');
    if (a >= 1024) throw 0;
    i++;
  }
  return a;
}

bool op_exp(int &i);

void check_exp(int &i, bool f) {
  //cout << s[i] << " " << f << endl;
  if (isdigit(s[i])) {
    number(i);
    bool r = op_exp(i);
    if (f && !r) throw 0;       // 括弧で囲まれてるのにopがない
  } else if (s[i] == '(') {
    i++;
    check_exp(i,1);
    if (s[i] != ')') throw 0;
    i++;
    bool r = op_exp(i);
    if (f && !r) throw 0;
  } else {
    throw 0;
  }
}

bool op_exp(int &i) {
  if (s[i] == '+' || s[i] == '-' || s[i] == '*') {
    i++;
    check_exp(i,0);
    return 1;
  }
  return 0;
}

int term(int &i);
int fact(int &i);

int exp(int &i) {
  int p = term(i);
  while(s[i]=='+' || s[i]=='-') {
    char c = s[i++];
    if (c == '+') {
      int a = term(i);
      p += a;
    }
    else p -= term(i);
    if (p>=1024 || p<0) throw 0;
  }
  return p;
}

int term(int &i) {
  int p = fact(i);
  while(s[i]=='*') {
    i++;
    p *= fact(i);
    if (p>=1024 || p<0) throw 0;
  }
  return p;
}

int fact(int &i) {
  if (s[i] == '(') {
    i++;
    int p = exp(i);
    assert(s[i++]==')');
    return p;
  } else {
    return number(i);
  }
}

vector<int> v;

int rec(int now) {
  if (now == -1) {
    //cout << s << endl;
    try {
      int i = 0;
      check_exp(i,0);
      if (s[i]) throw 0;
      i = 0;
      int res = exp(i);
      //cout << res << endl;
      return res;
    } catch(int a) {
      return -1;
    }
  }
  int ma = -1;
  static const string hoge = "01+-*()";
  FOR(it, hoge) {
    s[v[now]] = *it;
    ma = max(ma, rec(now-1));
  }
  return ma;
}

int main() {
  while(cin >> s) {
    v.clear();
    REP(i,strlen(s)) {
      if (s[i] == '.') v.push_back(i);
    }
    cout << rec(v.size()-1) << endl;
  }
}

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

int n, key;

struct node{
  struct node *left;
  struct node *right;
  struct node *parent;
  int key;
};

struct node *root, *NIL;

void insert(struct node *, int key);
struct node* find(struct node *, int key);
void delete(struct node*, int);
struct node* treeSuccessor(struct node*);
struct node* min(struct node*);
void inorder(struct node *);
void preorder(struct node *);
	  
int main(){

  int i, j, k;
  char order[20];
  struct node *result;
  
  scanf("%d", &n);
  for(i=0; i<n; i++){
    scanf("%s", order);

    if(order[0]=='i'){
      scanf("%d", &key);
      insert(root, key);
     
    }//insert

    else if(order[0]=='f'){

      scanf("%d", &key);
      result=find(root, key);
      if(result != NIL) printf("yes\n");
      else printf("no\n");
      
    }
    else if(order[0]=='d'){

      scanf("%d", &key);
      delete(root, key);
    }
    else if(order[0]=='p'){
      
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }//print
  }
  return 0;
}

void insert(struct node *x, int key){

  struct node *y=NIL;
  struct node *z;

  z=(struct node*)malloc(sizeof(struct node));
  z->key=key;
  z->left=NIL;
  z->right=NIL;
  
  while(x!=NIL){//適した入れる場所見付けるまで繰り返す
    y=x;
    if(z->key < x->key){
      x=x->left;
    }
    else x=x->right;
  }
  z->parent=y;

  if(y==NIL){
    root = z;
  }
  else {
    if(z->key < y->key){
    y->left = z;
    }
    else y->right=z;
  }
}
struct node* find(struct node *x, int key){

  while(x!=NIL && x->key!=key){

    if(key< x->key) x=x->left;
    else x=x->right;
    
  }
  return x;  
}
void delete(struct node *x, int key){

  struct node *z= find(x, key);
  struct node *y; //削除する対象をyとおく
  struct node *ychild;

  //2つとも葉か1つ葉
  if(z->left == NIL || z->right == NIL) y=z; //削除するzの内容をyに入れる
  //2つとも子であった場合
  else y=treeSuccessor(z); //次節点(右の子の最小値)がzになり代わる。それによってzは削除

  //yの子を見つける
  if(y->left!=NIL){
    x=y->left;
  }else{
    x=y->right;
  }

  if(x!=NIL){
    x->parent = y->parent;
  }

  //親だった場合
  if(y->parent == NIL){
    root = ychild;
  }
  else if(y==y->parent->left){
    y->parent->left =x;
  }
  else{
    y->parent->right=x;
  }
  
  if(y!=z){
    z->key = y->key;
  }
  
  free(y);
  
}
struct node* treeSuccessor(struct node *x){

  struct node *p;

  if(x->right != NIL) return min(x->right);
  p=x->parent;
  while(p != NIL && x==p->right){
    x=p;
    p=p->parent;
  }
  return p;
}
struct node* min(struct node *m){
  while(m->left != NIL ) m=m->left;
  return m;
}
			   
void inorder(struct node *x){

  if(x==NIL) return;

  inorder(x->left);
  printf(" %d", x->key);
  inorder(x->right);
}
void preorder(struct node *x){

  if(x==NIL) return;
  printf(" %d", x->key);
  preorder(x->left);
  preorder(x->right);
}
  




Measured memory_bytes: 20612
import sys
from collections import Counter
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


n, q = LI()
s = SI()
query = [LS() for _ in range(q)]


# posにいるゴーレムが，場外に出るか出ないかを判定
def check(pos, c):

    for t, d in query:
        # そのマスが呪文の影響を受ける対象マスではない場合
        if s[pos] != t:
            continue
        if d == 'L':
            if pos == 0:
                # 消滅する
                return c == 'L'
            # 呪文によって左にずれる
            pos -= 1
        else:
            if pos == n - 1:
                return c == 'R'
            pos += 1
    # 消滅しない
    return False


lo = -1
hi = n
while hi - lo > 1:
    mid = (lo + hi) // 2
    # 消滅するのであれば，さらに右よりにあるゴーレムで消滅する物を探す
    # 始めs[mid]にいるゴーレムが消滅するのであれば，
    # それより左にいるゴーレムは，左端で消滅する
    if check(mid, 'L'):
        lo = mid
    else:
        hi = mid
# 最も＞側にいる，左側に向かって進んで消滅するゴーレムのインデックス
l = lo


lo = -1
hi = n
while hi - lo > 1:
    mid = (lo + hi) // 2
    if check(mid, 'R'):
        hi = mid
    else:
        lo = mid
r = hi 

print(n - (l + 1 + n - r))


Measured memory_bytes: 39644
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

void Main() {
  ll a,b,c,d;
  cin >> a >> b >> c >> d;
  pr(min(a,b)+min(c,d));
}

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


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cctype>
#include<cstdlib>
#include<algorithm>
#include<bitset>
#include<vector>
#include<list>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<ctime>
#include<complex>
#include<functional>
#include<climits>
#include<cassert>
#include<iterator>
#include<random>
#include<unordered_set>
#include<unordered_map>
 
using namespace std;
 
long long int n;
long long int p;
 
 
int main() {
	scanf("%lld%lld", &n, &p);
  	if(n==1LL){
    	printf("%lld\n",p);
      	return 0;
    }
	long long int w = 1;
	for (long long int i = 2; ; i++) {
		long long int z = 1;
		long long int cnt = n;
		while (cnt--) {
			if (z > p)break;
			z *= i;
		}
		if (z > p) {
			break;
		}
		if (cnt==-1&&p%z == 0LL) {
			p /= z;
			w *= i;
            i=1;
		}
	}
	printf("%lld\n", w);
	return 0;
}

Measured memory_bytes: 256
def main():
  from itertools import groupby

  N, K = map(int,input().split())
  S = input()

  num = []
  cot = []
  for k, n in groupby(S):
    num.append(k)
    cot.append(len(list(n)))

  if num[-1] == "0":
    cot += [0]
    num += [0]

  X = [0]*(len(cot)+1)
  for i in range(len(cot)):
    X[i+1] = X[i]+cot[i]

  ans = 0
  for i in range(len(X)):
    x = K*2
    if num[i] == "1":
      x += 1
    try:
      ans = max(ans, X[i+x]-X[i])
    except:
      break
  if ans == 0:
    ans = len(S)
  print(ans)

if __name__ == '__main__':
  main()

Measured memory_bytes: 8792
n, m = list(map(int, input().split()))
x = list(map(int, input().split()))

if m == 1:
    print(0)
    exit()

x.sort()

z = []
for i in range(len(x) - 1):
    z.append(abs(x[i] - x[i + 1]))

z.sort()
for _ in range(n - 1):
    if len(z) > 0:
        z.pop()

print(sum(z))

Measured memory_bytes: 13968
#include<iostream>
#include<cstdio>
#include<cstring>
namespace nym
{
	const int N=101000,M=N*2,D=12;
	int begin[N],next[M],to[M];
	bool vis[N][D];
	int col[N];
	int n,m,e,T;
	void add(int x,int y,bool k=1)
	{
		to[++e]=y;
		next[e]=begin[x];
		begin[x]=e;
		if(k)add(y,x,0);
	}
	int op[N][3];
	void initialize()
	{
		scanf("%d%d",&n,&m);
		for(int i=1,u,v;i<=m;i++)
			scanf("%d%d",&u,&v),add(u,v);
		scanf("%d",&T);
		for(int i=1;i<=T;i++)
			scanf("%d%d%d",&op[i][0],&op[i][1],&op[i][2]);
	}
	void work(int p,int d,int w)
	{
		if(vis[p][d])return;
		vis[p][d]=1;
		if(!d){col[p]=w;return;}
		work(p,d-1,w);
		for(int i=begin[p];i;i=next[i])
			work(to[i],d-1,w);
	}
	void solve()
	{
		initialize();
		for(int i=T;i;i--)
			work(op[i][0],op[i][1],op[i][2]);
		for(int i=1;i<=n;i++)
			printf("%d\n",col[i]);
	}
}
int main()
{
	nym::solve();
	return 0;
}


Measured memory_bytes: 5376
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;
using static System.Array;

class Program
{
    public static void Main()
    {
        var n = long.Parse(ReadLine());
        var a = ReadLine().Split().Select(long.Parse).ToArray();
        Sort(a);
        Reverse(a);
        LinkedList<long> list = new LinkedList<long>();
        long sum = a[0];
        list.AddFirst(a[0]);
        list.AddLast(a[1]);
        Queue<long> queue = new Queue<long>();
        queue.Enqueue(a[1]);
        int i = 2;
        while(queue.Count > 0)
        {
            long num = queue.Dequeue();
            if(i < n)
            {
                sum += num;
                queue.Enqueue(a[i]);
                i++;
            }
            if(i < n)
            {
                sum += num;
                queue.Enqueue(a[i]);
                i++;
            }
        }

        WriteLine(sum);
        ReadLine();
    }
}


Measured memory_bytes: 45592
import fractions

def getlist():
	return list(map(int, input().split()))

A, B, C, D = getlist()

x = int(C * D // fractions.gcd(C, D))

if A % C == 0:
	cx = int(B // C - A // C + 1)
else:
	cx = int(B // C - A // C)
if A % D == 0:
	dx = int(B // D - A // D + 1)
else:
	dx = int(B // D - A // D)

if A % x == 0:
	cdx = int(B // x - A // x + 1)
else:
	cdx = int(B // x - A // x)

print(B - A + 1 - cx - dx + cdx)

Measured memory_bytes: 5048
#include<iostream>
using namespace std;
int main(){
	int a,b,c[2];
	for(int i=0;i<2;i++){
cin>> c[i];
if(c[i]<-1000||c[i]>1000)cin >> c[i];}
if(c[0]>c[1]){cout<<"a > b"<<endl;}
if(c[0]<c[1]){cout<<"a < b"<<endl;}
if(c[0]==c[1]){cout<<"a == b"<<endl;}
return 0;}


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

int main() {
    long long N;
    cin >> N;
    vector<long long> A(N), B(N), C(N);

    rep(i, N) { cin >> A[i]; }
    rep(i, N) { cin >> B[i]; }
    rep(i, N) { cin >> C[i]; }

    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    sort(C.begin(), C.end());

    long long ans = 0;
    long long greaterCnt = 0;
    map<long long, long long> cntmap;
    for (long long i = N - 1; i >= 0; i--) {
        greaterCnt += C.end() - upper_bound(C.begin(), C.end(), B[i]);
        cntmap[B[i]] = greaterCnt;
    }
    rep(i, N) {
        vector<long long>::iterator iter = upper_bound(B.begin(), B.end(), A[i]);
        if (iter != B.end()) {
            ans += cntmap[*iter];
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 8832
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
from collections import defaultdict
def resolve():
    A=input()
    n=len(A)
    ans=n*(n+1)//2

    D=defaultdict(int)
    for a in A:
        D[a]+=1

    for c in D.values():
        ans-=c*(c+1)//2

    print(ans+1)
resolve()

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

using namespace std;

void solve() {
	long long a, b, c, d; 
	cin >> a >> b >> c >> d;
	if (a < b) cout << "No\n";
	else if (c <= b) {
		long long e = __gcd(b, d);
		a %= e;
		long long f = a / e * e;
		long long g = (b - a - 1) / e * e;
		long long mn = a - f, mx = a + g;
		if (mn + d < b || mx > c) cout << "No\n";
		else cout << "Yes\n"; 
	}
	else {
		if (d >= b) cout << "Yes\n"; else cout << "No\n";
	}
}

int main() {
	ios::sync_with_stdio(false);
	int t; cin >> t; while (t--) solve();
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define Fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define mod 1000000007
#define maxn 100000

int main(){
	Fio;
	int t=1;
	//cin >> t;
	while(t--){
		int n;
		cin >> n;
		int h[n], costs[n];

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

		costs[0] = 0;
		costs[1] = abs(h[1] - h[0]);

		for (int i = 2; i < n; ++i)
		{
			costs[i] = min(costs[i-1] + abs(h[i] - h[i-1]), costs[i-2] + abs(h[i] - h[i-2]));
		}

		cout << costs[n-1];
	}

	return 0;
}

Measured memory_bytes: 1024
/*
    Author - Param Kothari
    Ah shit, here we go again
*/
 
/* Ordered Set Implementaton:

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace __gnu_pbds;

typedef tree<
    int,
    null_type,
    less<int>,
    rb_tree_tag,
    tree_order_statistics_node_update>
ordered_set;
*/

#include <bits/stdc++.h>
 
using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define mk make_pair 
 
typedef long long ll;
typedef long double ld;

void solve(){
    string s;
    cin >> s;
    if(s == "AAA" || s == "BBB"){
        cout << "No\n";
    }
    else cout << "Yes\n";
    return;
}
 
int main(){
    IOS;
    int t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
    return 0;
}


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

char r;

void input(){
  cin >> r;
}

void solve(){
  input();
  r++;
  cout << r << endl;
}

int main() {
  solve();
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main () {
  int n;
  cin >> n;
  int p[n];
  for(int i = 0; i < n; i++){
    cin >> p[i];
  }
  int ans = 0;
  for(int i = 1; i < n - 1; i++) {
    if((p[i - 1] < p[i]) && (p[i] < p[i + 1])) {
      ans++;
    }
    else if((p[i - 1] > p[i]) && (p[i] > p[i + 1])){ 
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
/*
Problem Number: ABC177D
Problem Name: Friends
Notes: 
*/

#include <bits/stdc++.h>
#define endl "\n"

using namespace std;

vector<vector<int>> g;
vector<bool> v;

int dfs(int n){
    int sum = 1;
    v[n] = 1;
    for(auto ch : g[n])
        if(!v[ch])
            sum += dfs(ch);
    return sum;
}

int main(){
    cin.tie(0) -> sync_with_stdio(0);
    
    int n, m;
    cin >> n >> m;
    int a, b;
    g = vector<vector<int>>(n);
    for(int i = 0; i < m; i++){
        cin >> a >> b;
        g[a-1].push_back(b-1);
        g[b-1].push_back(a-1);
    }

    int sol = 0;
    v = vector<bool>(n);
    for(int i = 0; i < n; i++)
        if(!v[i])
            sol = max(sol, dfs(i));

    cout << sol << endl;
    
    return 0;
}

Measured memory_bytes: 23436
//============================================================================
// Name        : A.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<cmath>
#include<list>
#include<set>
#include<map>

using namespace std;

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

	for (int i = 1; i < N - 1 && K != 0; ++i) {
		if (s[i - 1] != s[i]) {
			for (int j = i; j < N && K != 0; ++j) {
				if ((s[i - 1] == s[j] || K == 0)) {
					break;
				}
				s[j] = s[i - 1];
			}
			--K;
		}
	}

	if (s[0] != s[1] && K != 0) {
		s[0] = s[1];
		--K;
	}
	if (s[N - 1] != s[N - 2] && K != 0) {
		s[N - 1] = s[N - 2];
		--K;
	}

	int ans = 0;
	for (int i = 1; i < N - 1; ++i) {
		if (s[i] == 'R' && s[i + 1] == 'R')
			++ans;
		if (s[i] == 'L' && s[i - 1] == 'L')
			++ans;
	}

	if (s[0] == 'R' && s[1] == 'R')
		++ans;
	if (s[N - 1] == 'L' && s[N - 2] == 'L')
		++ans;

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


Measured memory_bytes: 512
<?php
  fscanf(STDIN, "%d %d", $a, $b);
  $a_n = "";
  $b_n = "";
    
  for($i=0;$i<$b;$i++){
 	$a_n .= $a;
  }

  for($i=0;$i<$a;$i++){
 	$b_n .= $b;
  }

if($a_n > $b_n){
  echo $a_n;
}else{
  echo $b_n;
}
  ?>

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

const long long Mx = 0x7FFFFFFF;
long long n, q, x, y, m = 1;
long long a[300000];

void ud(long long x, long long y) {
	long long k = m + x - 1;
	a[k] = y;
	while (k > 0) {
		k = (k - 1) / 2;
		a[k] = min(a[k * 2 + 1], a[k * 2 + 2]);
	}
}

long long find(long long x, long long y, long long k, long long l, long long r) {
	if (x <= l && y >= r)
		return a[k];
	else if (x >= r || y <= l)
		return Mx;
	else {
		long long lm = find(x, y, k * 2 + 1, l, (l + r) / 2);
		long long rm = find(x, y, k * 2 + 2, (l + r) / 2, r);

		return min(lm, rm);
	}
}

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

	while (m < n)
		m *= 2;

	for (int i = 0; i < m * 2; i++)
		a[i] = Mx;

	for (int j = 0; j < q; j++) {
		int p;
		cin >> p;

		if (p == 0) {
			cin >> x >> y;
			ud(x, y);
		}
		else if (p == 1) {
			cin >> x >> y;
			cout << find(x, y + 1, 0, 0, m) << endl;
		}
	}

	return 0;
}


Measured memory_bytes: 5148
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define ll long long
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rep1(i, n) FOR(i, 1, n+1)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define rwhole(x) (x).rbegin(), (x).rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define P pair<int, int>
#define debug(var) cerr << "[" << #var << "] " << var << '\n'
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define pr(s) cout << (s) << '\n'
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};
const int INF = 1001001001;
const ll INFll = 1E+18;

using S = int;
S op(int a, int b) {
    return max(a, b);
}
S e() {
    return 0;
}


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n, k;
    cin >> n >> k;
    vi a(n);
    rep(i, n) cin >> a[i];
    const int NMAX = 300005;
    segtree<S, op, e> seg(NMAX);
    rep(i, n) {
        int l = max(0, a[i]-k);
        int r = min(NMAX-1, a[i]+k);
        int res = seg.prod(l, r+1);
        seg.set(a[i], res+1);
    }

    int ans = seg.prod(0, NMAX);
    
    pr(ans);
    return 0;
}


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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

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

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
    ost<<"{"<<p.first<<","<<p.second<<"}";
    return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
    ost<<"{";
    for(int i=0;i<v.size();i++){
        if(i)ost<<",";
        ost<<v[i];
    }
    ost<<"}";
    return ost;
}

inline int topbit(unsigned long long x){
    return x?63-__builtin_clzll(x):-1;
}

inline int popcount(unsigned long long x){
    return __builtin_popcountll(x);
}

inline int parity(unsigned long long x){
    return __builtin_parity(x);
}

signed main(){
	int a,b;
	cin>>a>>b;
	cout<<a*b<<endl;


    return 0;
}


Measured memory_bytes: 3604
H, W = map(int, input().split())

field = []

for i in range(H):
  field.append(list(input()))
count = 0
  
for i in range(H):
  for j in range(W):
    if field[i][j]=='#':
      if j - 1 >= 0 and field[i][j - 1] == "#":
        continue
      elif j + 1 < W and field[i][j + 1] == "#" :
        continue
      elif i + 1 < H and field[i + 1][j] == "#" :
        continue
      elif i - 1 >= 0 and field[i - 1][j] == "#":
        continue
      else:
        print("No")
        exit()

print("Yes")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (int)(x).size()
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
int main(){
int n;
cin >> n;
vector<int> a(n);
for(int i = 0;i<n;i++) cin >> a[i];
int ans = 0;
for(int i = 0;i<n;i++) ans = __gcd(ans,a[i]);
cout << ans;


}


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

import math
import sys

n,k = map(int,input().split())
al = list(map(int,input().split()))
fl = list(map(int,input().split()))

al.sort()
fl.sort(reverse=True)

ub = max([a*f for a,f in zip(al, fl)])
lb = 0

while True:
    if ub == lb:
        print(lb)
        sys.exit()
    p = 0
    t = (ub + lb) // 2
    for a, f in zip(al, fl):
        p += max(a - t // f, 0)
    if p <= k:
        ub = t
    else:
        lb = t + 1

Measured memory_bytes: 119756
#include<bits/stdc++.h>
        using namespace std;
         
        int main(){
          int count=0,a,b;
          cin>>a>>b;
         int socket=1;
       
         
        while(socket<b){
           count++;
          socket+=a-1;
          }
          cout<<count;
         
        return 0;
        
        }

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

int main() {
    int N, K;
    cin >> N >> K;
    int MAX = (N-1) * (N-2) / 2;
    if (MAX < K) { cout << -1 << endl; return 0; }
    vector<pair<int, int>> ans;
    for (int i = 1; i < N; i++) ans.emplace_back(0, i);
    
    int now = MAX;
    for (int i = 1; i < N; i++) {
        for (int j = i+1; j < N; j++) {
            if (K < now--) ans.emplace_back(i, j);
        }
    }
    
    cout << ans.size() << endl;
    for (auto e : ans) cout << ++e.first << " " << ++e.second << endl;
    return 0;
}

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;cin >> n;
	vector<int> a(n);
	vector<int> b(n);
	rep(i,n){
		cin >> a.at(i);
		b.at(i)=a.at(i);
	}
	sort(b.begin(),b.end());
	rep(i,n){
		if(a.at(i)>=b.at(n/2)) cout << b.at(n/2-1) << endl;
		else cout << b.at(n/2) << endl;
	}
}

Measured memory_bytes: 3840
#include <stdio.h>
#define N 1000000

int s[N],l=0,r=0;

void push(int x){
  s[r]=x;
  r++;
  if(r>=N)r=0;
}

int pop(){
  int a=s[l];
  l++;
  if(l>=N)l=0;
  return a;
}

int main(){
  l=r=0;
  int n,i,q;
   char ch[n][10];
   int c[n];
   int sum=0,x;
   
   scanf("%d%d",&n,&q);
   for(i=0;i<n;i++){
     scanf("%s %d",ch[i],&c[i]);
     push(i);
   }

   while(l != r){
     x=pop();

     if(q<c[x]){
       sum+=q;
       c[x]-=q;
       push(x);
     }

     else{
       sum+=c[x];
       printf("%s %d\n",ch[x],sum);
     }
   }
     
   return 0;

   
}



Measured memory_bytes: 3160
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline
n = int(input())
data = [[] for i in range(n)]
for i in range(n-1):
    a,b,c = map(int,input().split())
    a -= 1
    b -= 1
    data[a].append([b,c])
    data[b].append([a,c])

dist = [-1 for i in range(n)]
q,k = map(int,input().split())
k -= 1
dist[k] = 0

def dfs(now,pre,d):
    dist[now] = d
    for p,q in data[now]:
        if p == pre:
            continue
        dfs(p,now,d+q)

dfs(k,-1,0)

for i in range(q):
    x,y = map(int,input().split())
    x -= 1
    y -= 1
    print(dist[x]+dist[y])

Measured memory_bytes: 209328
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

using ll = long long;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

#define input(...) __VA_ARGS__; in(__VA_ARGS__)

template<class T>
void print(vector<T> a) {
  cout << "[ ";
  REP(i, a.size()) cout << a[i] << " ";
  cout << "]" << endl;
}

void print() {
  std::cout << std::endl;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  std::cout << head << " ";
  print(std::forward<Tail>(tail)...);
}

void in() { }

template <class Head, class... Tail>
void in(Head&& head, Tail&&... tail) {
  cin >> head;
  in(std::forward<Tail>(tail)...);
}

ll n, x;
vector<ll> s;
vector<vector<ll>> table;
ll MOD = 1000000000 + 7;
ll powmod(ll v, ll x) {
  if (x == 0) return 1;
  if (x % 2 == 0) {
    ll tmp = powmod(v, x / 2);
    return (tmp * tmp) % MOD;
  } else {
    return (powmod(v, x - 1) * v) % MOD;
  }
}

#define DP table[i][a]
ll dfs(ll i, ll a) {
  if (DP != -1) return DP;
  if (i == n) return DP = a;

  // double p = 1. / (n - i);
  ll p = powmod(n - i, MOD - 2);
  return DP = ((dfs(i + 1, a % s[i]) * p) % MOD + (dfs(i + 1, a) * ((1 - p + MOD) % MOD)) % MOD) % MOD;

  /* if (i == n - 1) return DP = a % s[n - 1]; */
  /* return DP = (dfs(i + 1, a % s[i]) + dfs(i + 1, a)) % MOD; */
}

int main() {
  cin >> n >> x;
  s = vector<ll>(n);
  REP(i, n) cin >> s[i];
  sort(s.begin(), s.end(), greater<ll>());
  table = vector<vector<ll>>(n + 1, vector<ll>(x + 1, -1));
  ll fact = 1;
  FOR(i, 1, n) {
    (fact *= i) %= MOD;
  }
  cout << dfs(0, x) * fact % MOD << endl;
}


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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


int main() {
    i64 H, W; cin >> H >> W;
    vector<i64> dist(26, 0);
    REP(i, H) REP(j, W) {
        char a; cin >> a;
        dist[a - 'a']++;
    }

    auto solve = [&]() -> bool {
        i64 N = H * W;
        i64 n4 = 0, n2 = 0, n1 = 0;
        REP(i, 26) {
            n4 += dist[i] / 4;
            dist[i] = dist[i] % 4;
            n2 += dist[i] / 2;
            dist[i] = dist[i] % 2;
            n1 += dist[i];
        }
        if (H % 2 == 0 && W % 2 == 0) {
            if (N / 4 == n4) return true;
            else return false;
        } else if (H % 2 == 1 && W % 2 == 1) {
            if (n1 > 1) return false;
            i64 rem = N - H - W + 1;
            if (rem / 4 > n4) return false;
            n2 += (n4 - rem / 4) * 2;
            rem = H + W - 1;
            if (rem / 2 == n2) return true;
            else return false;
        } else {
            if (H % 2 == 1) swap(H, W);
            i64 rem = N - H;
            if (rem / 4 > n4) return false;
            n2 += (n4 - rem / 4) * 2;
            rem = H;
            if (rem / 2 == n2) return true;
            else return false;
        }
        return false;
    };

    cout << (solve() ? "Yes" : "No") << endl;

    return 0;
}

Measured memory_bytes: 256