akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<iostream>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<utility>
#include<stack>
#include<algorithm>
#include<string>
#include<string.h>
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll,ll> ii;
const int N = 100;
const int LIM = 4000;
const int MOD = 1e9 + 7;
ll dp[N + 5][LIM + 5];
ll png[N + 5];

int main(){
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    ll n, k; cin >> n >> k;
    png[0] = 1;
    for(int i = 1; i <= n; ++i){
        png[i] = 1LL * png[i - 1] * (k + 1) % MOD;
    }
    dp[n + 1][0] = 1;
    // cout << "TES" << endl;
    ll ans = 0;
    ll cnt = 0;
    for(int i = n; i >= 1; --i){
        for(int j = 0; j <= k; ++j){
            for(int l = 0; l <= cnt; ++l){
                ll val = j + l;

                if(j <= i){
                    dp[i][l + val / i] += dp[i + 1][l];
                    dp[i][l + val / i] %= MOD;
                    val %= i;
                }else{
                    dp[i][l] += dp[i + 1][l];
                    dp[i][l] %= MOD;
                }
                ll add = val * dp[i + 1][l] % MOD * png[i - 1] % MOD;
                // cout << "(" << i << ", " << j << ", " << l << ") -> " << add << " " << dp[i + 1][l] << endl;
                ans += add;
                ans %= MOD;
            }
        }
        cnt += (i + cnt) / i;
        // cout << i << " :: ";
        // for(int j = 0; j <= 10; ++j){
        //     cout << dp[i][j] << " ";
        // }cout << endl;
    }

    cout << ans << endl;
}

Measured memory_bytes: 768
n = int(input())
a = [int(i) for i in input().split()]
_min = 10**5
for _a in a:
    count = 0
    while _a > 0 and _a % 2 == 0:
        count += 1
        _a = _a // 2
    _min = min(_min, count)
print(_min)

Measured memory_bytes: 3064
import sys
from collections import defaultdict, deque

input = sys.stdin.readline

def chmin(a, b):
    if a > b:
        return b
    else:
        return a

def main():
    N = int(input())
    f_inf = float('inf')
    # DP テーブルを初期化　(最小化問題なので INF に初期化)
    MAX_N = 110000
    dp = [f_inf] * MAX_N
    dp[0] = 0
    for i in range(1, N+1):
        for j in range(N):
            pow6 = 6 ** j
            if pow6 > N:
                break
            dp[i] = chmin(dp[i], dp[i-pow6] + 1)
        for j in range(N):
            pow9 = 9 ** j
            if pow9 > N:
                break
            dp[i] = chmin(dp[i], dp[i-pow9] + 1)
    print(dp[N])


if __name__ == '__main__':
    main()


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

using namespace std;

bool isPrime[60000];

int main(void){
  fill(isPrime, isPrime+60000, true);
  for(int i=2;i<60000;i++){
    if(isPrime[i]){
      for(int j=2; i*j<60000;j++){
	isPrime[i*j] = false;
      }
    }
  }

  int n;
  while(cin >> n){
    int tmp=1;
    int mini=0, maxi = 0;
    while(1){
      if(mini == 0 && isPrime[n-tmp] == true) mini = n-tmp;
      if(maxi == 0 && isPrime[n+tmp] == true) maxi = n+tmp;
      if(mini != 0 && maxi != 0) break;
      tmp++;
    }
    cout << mini << " " << maxi << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stdio.h>
#include <string.h>
#include <math.h>
using namespace std;

int main() {
    int a, b, c, d, e, f;
    cin >> a >> b >> c >> d >> e >> f;

    int x[30 + 30] = { 1 }, y[3000 + 30] = { 1 };

    for (int i = 0; i < 30; i++) {
        if (x[i]) x[i + a] = x[i + b] = 1;
    }
    for (int j = 0; j < 3000; j++) {
        if (y[j]) y[j + c] = y[j + d] = 1;
    }

    int k1 = 0, j1 = -1;
    for (int i = 1; i <= 30; i++) {
        for (int j = 0; j <= 3000; j++) {
            int k = i * 100 + j;
            if (k > f) break;
            if (x[i] && y[j]) {
                if (j * k1 > j1 * k && j * (100 + e) <= e * k) {
                    k1 = k;
                    j1 = j;
                }
            }
        }
    }

    cout << k1 << ' ' << j1 << endl;

    return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using E = System.Linq.Enumerable;

class Program
{
    static readonly double INF = double.PositiveInfinity;

    static void Main(string[] args)
    {
        while (true)
        {
            int[] input = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            int N = input[0], M = input[1], P = input[2], A = input[3] - 1, B = input[4] - 1;
            if (N == 0) break;
            int[] nums = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            if (nums.Any(i => i == 0)) throw new Exception();
            double[][] dist = E.Range(0, M).Select(i => E.Repeat(INF, M).ToArray()).ToArray();

            for (int i = 0; i < P; i++)
            {
                input = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
                dist[input[0] - 1][input[1] - 1] = input[2];
                dist[input[1] - 1][input[0] - 1] = input[2];
            }
            double[][] dp = E.Range(0, 1 << N).Select(i => E.Repeat(INF, M).ToArray()).ToArray();
            dp[0][A] = 0;
            for (int mask = 0; mask < (1 << N); mask++)
                foreach (int use in E.Range(0, N).Where(use => (mask >> use & 1) == 0))
                    foreach (int i in E.Range(0, M).Where(i => dp[mask][i] < INF))
                        foreach (int j in E.Range(0, M).Where(j => dist[i][j] < INF))
                        {
                            double cost = dp[mask][i] + dist[i][j] / nums[use];
                            int nextMask = mask | 1 << use;
                            dp[nextMask][j] = Math.Min(dp[nextMask][j], cost);
                        }

            double ans = INF;
            for (int mask = 0; mask < (1 << N); mask++) ans = Math.Min(ans, dp[mask][B]);
            Console.WriteLine((ans == INF) ? "Impossible" : ans.ToString("f3"));
        }
    }
}

Measured memory_bytes: 6516
#include<iostream>
#include<vector>
using namespace std;
int main(){
  int n, a;
  cin >> n;
  vector<int> v;
  for(int i=0; i<n; i++){
    cin >> a;
    v.push_back(a);
  }
  //iさんが到着したとき3人いた = iさんは3番目に着いた
  vector<int> r(n);
  for(int i=0; i<n; i++){
    r[v[i]-1] = i+1;
  }
  for(int i=0; i<n; i++){
    cout << r[i] << " ";
  }
  return 0;
}
    

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

int main() {
  int h, w;
  cin >> h >> w;
  string str[h];
  for (int i = 0; i < h; i++) {
    cin >> str[i];
  }

  int count[h][w];
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      count[i][j] = -1;
    }
  }
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (str[i][j] == 'c') {
	for (int k = j; k < w; k++) {
	  count[i][k] = k - j;
	}
      }
    }
  }

  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (j < w - 1) cout << count[i][j] << ' ';
      else cout << count[i][j] << endl;
    }
  }

  return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  int two=0;
  int four=0;
  for(int i=0;i<n;i++){
    cin >> a.at(i);
    if(a.at(i)%2==0 && a.at(i)%4!=0)
    two++;
    if(a.at(i)%4==0)
    four++;
  }
  if(two==n)
  cout << "Yes" << endl;
  else if(two>1 && four>=(n-two+1)/2)
    cout << "Yes" << endl;
  else if(four>=n/2)
  cout << "Yes" << endl;
  else
  cout << "No" << endl;
}



Measured memory_bytes: 3680
#include <iostream>
//#include <iomanip>
//#include <string>
#include <vector>
#include <algorithm>
#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
//using vll = vector<int> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
using pll = pair<ll,ll> ;
#define all(v) v.begin(),v.end()
//ll mod = 1000000007 ;
//long double pie = acos(-1) ;
//ll INF = 1000000000000 ;

void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void fix_cout(){cout << fixed << setprecision(20) ;}

int main(){
	ll n ; cin >> n ;
	vector<pll> a(n) ;
	for(int i=0;i<n;i++) cin >> a.at(i).second >> a.at(i).first ;
	sort(all(a)) ;
	ll sum = 0 ;
	for(int i=0;i<n;i++){
		sum += a.at(i).second ;
		if(sum>a.at(i).first){
			yorn(0) ;
			return 0 ;
		}
	}
	yorn(1) ;
}


Measured memory_bytes: 3328
///Astalavista Code........~CodeSlayer007
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define int long long
#define double long double
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define PT(x) cout << (#x) << " is " << (x) << endl;
#define SPD_emergency ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
const int M = 1e9 + 7;
void PV(vi v) { for (int i = 0 ; i < v.size() ; i++) cout << v[i] << " "; cout << endl;}
void PA(int v[], int n) { for (int i = 0 ; i < n ; i++)cout << v[i] << " " ; cout << endl;}
void IN(int a[], int n) {for (int i = 0; i < n; i++)cin >> a[i];}
//continue break deque stack queue sort reverse accumulate  count lower_bound upper_bound
// next_permutation copy_n __builtin_popcount

signed  main() {
  SPD_emergency

   // freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);

  //int t; cin >> t; int tt = 1; while (t--)
  {
  
   int s,w;
   cin >> s >> w;
   if(w>=s){
    cout<<"unsafe"<<endl;
   }
   else
    cout<<"safe"<<endl;

   

  
  return 0;
   }
}

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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define abs(a) max((a),-(a))

typedef long long LL;
typedef long long ll;
typedef pair<ll,ll> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
const ll mod=1000000007;
const ll INF=mod*mod/100000;

ll dp[1001][1001][11][2];
ll time10[11];
int main(){
  rep(i,1001){
    rep(j,1001){
      rep(k,11){
        rep(l,2){
          dp[i][j][k][l]=INF;
        }
      }
    }
  }
  time10[1]=1;
  for(int i=2;i<11;i++){
    time10[i]=time10[i-1]*10;
  }
  ll x;string s;cin>>x>>s;int n=s.length();
  dp[n][0][0][0]=0;
  dp[n-1][1][1][1]=0;
  // dp[n-1][1][1][0]=1;
  if('0'<=s[n-1]&&s[n-1]<='9'){
    if(s[n-1]=='0'){
      dp[n-1][0][1][1]=0;
    }
    else{
      dp[n-1][0][1][0]=s[n-1]-'0';
    }
  }
  for(int i=n-2;i>=0;i--){
    for(int j=0;j<=n-i+2;j++){
      if(j>0){
        dp[i][j][0][0]=min(dp[i][j][0][0],dp[i+1][j-1][1][1]);
        for(int l=1;l<11;l++){
          dp[i][j][0][0]=min(dp[i][j][0][0],dp[i+1][j-1][l][0]);
        }
      }
      if(s[i]=='+'){
        dp[i][j][0][0]=min(dp[i][j][0][0],dp[i+1][j][1][1]);
        for(int l=1;l<11;l++){
          dp[i][j][0][0]=min(dp[i][j][0][0],dp[i+1][j][l][0]);
        }
      }
      for(int k=1;k<11;k++){
        if(j>0){
          dp[i][j][k][0]=min(dp[i][j][k][0],dp[i+1][j-1][k-1][0]+time10[k]);
          dp[i][j][k][0]=min(dp[i][j][k][0],dp[i+1][j-1][k-1][1]+time10[k]);
        }
        if(s[i]=='1'){
            dp[i][j][k][0]=min(dp[i][j][k][0],dp[i+1][j][k-1][0]+time10[k]);
            dp[i][j][k][0]=min(dp[i][j][k][0],dp[i+1][j][k-1][1]+time10[k]);
        }
        if(j>0){
          dp[i][j][k][1]=min(dp[i][j][k][1],dp[i+1][j-1][k-1][0]);
          dp[i][j][k][1]=min(dp[i][j][k][1],dp[i+1][j-1][k-1][1]);
        }
        if(s[i]=='0'){
          dp[i][j][k][1]=min(dp[i][j][k][1],dp[i+1][j][k-1][0]);
          dp[i][j][k][1]=min(dp[i][j][k][1],dp[i+1][j][k-1][1]);
        }
        if('2'<=s[i]&&s[i]<='9'){
          ll key=s[i]-'0';
          dp[i][j][k][0]=min(dp[i][j][k][0],dp[i+1][j][k-1][0]+time10[k]*key);
          dp[i][j][k][0]=min(dp[i][j][k][0],dp[i+1][j][k-1][1]+time10[k]*key);
        }
      }
    }
  }
  bool out=false;
  for(int i=0;i<1001;i++){
    ll mi=INF;
    for(int j=1;j<11;j++){
        mi=min(mi,dp[0][i][j][0]);
    }
    mi=min(mi,dp[0][i][1][1]);
    if(mi<=x){
      cout<<i<<endl;out=true;break;
    }
  }
  if(!out)cout<<-1<<endl;
  return 0;
}



Measured memory_bytes: 175428
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807
#define MOD ll(1e9+7)

int main(){
    ll n, k;
    cin >> n >> k;
    vector<ll> h(n);
    for(int i = 0; i < n; i++){
        cin >> h[i];
    }
    vector<ll> dp(n,0);
    dp[0] = 0; dp[1] = abs(h[1]-h[0]);
    for(ll i = 2; i < n; i++){
        ll mincost = 9999999999;
        for(ll j = 1; j <= k; j++){
            if(i-j<0){continue;}
            mincost = min(mincost, dp[i-j]+abs(h[i]-h[i-j]));
        }
        dp[i] = mincost;
    }
    cout << dp[n-1] << endl;

}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define  all(x) (x).begin(),(x).end()
typedef long long ll;

int f[45];

void fib(int n){
    f[0] = f[1] = 1;
    for(int i = 2; i <= n; i++){
        f[i] = f[i-1] + f[i-2];
    }
}

int main(){
    int n;
    cin >> n;
    fib(n);
    cout << f[n] << endl;
}


Measured memory_bytes: 3084
import java.util.*;
import java.io.*;


public class Main {
    static int mod = (int) 1e9 + 7;
    static int DX[] = { -1, 0, 1, 0 }, DY[] = { 0, -1, 0, 1 };

    static int n;
    static long k;
    static long a[];
    public static void main(String[] args) {
        FastScanner fs = new FastScanner(System.in);
        n = fs.nextInt();
        k = fs.nextLong();
        a = fs.nextLongArray(n);
        Arrays.sort(a);
        long INF = (long)(1e18)+1;
        long l = -INF;
        long r = INF;
        while(l+1<r) {
            long c = (l+r)/2;
            if(check(c))l=c;
            else r = c;
        }
        System.out.println(l);
    }
    //x未満の組合せがk個未満ならtrue
    static boolean check(long x) {
        long tot = 0;
        for(int i=0;i<n;i++) {
            long now = a[i];
            int l = -1, r = n;
            if(now >= 0) {
                while(l+1<r) {
                    int c = (l+r)/2;
                    if(now * a[c] < x) l = c;
                    else r = c;
                }
                tot += (l+1);
            }
            else {
                while(l+1<r) {
                    int c = (l+r)/2;
                    if(now * a[c] < x) r = c;
                    else l = c;
                }
                tot += (n - r);
            }
            if((long)a[i] * a[i]<x)tot--;
        }
        if(tot/2 < k) return true;
        else return false;
    }
}

//高速なScanner
class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

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

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

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

    public long nextLong() {
        return Long.parseLong(next());
    }

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

    public double nextDouble() {
        return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    }
}

Measured memory_bytes: 48528
#include<bits/stdc++.h>
#include <cmath>
using namespace std;
#define ll long long
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define deb(x) cout<<#x<<" : "<<x<<"\n";
#define debug(x,y) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<"\n";
#define deb_arr(a,n) {cout<<#a<<":";for(int i=0;i<n;i++) {cout<<a[i]<<" ";} cout<<'\n';}
#define deb_mat(dist,n,m) {cout<<#dist<<"\n";for(int i=0;i<n;i++){for(int j=0;j<m;j++){cout<<dist[i][j]<<" ";}cout<<'\n';}}
#define ff first
#define ss second
#define ub upper_bound
#define lb lower_bound
#define all(a) (a).begin(),(a).end()
#define bs binary_search
#define sz size()
#define vi vector<int>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define ld long double
#define clr fflush(stdout);
//#define clr cout.flush();
#define N 200001
#define fpr(i,a,b) for(int i=a;i<b;i++)
#define fdr(i,a,b) for(int i=a;i>b;i--)
#define repp(i,a,b,d) for(int i=a;i<b;i+=d)
#define repd(i,a,b,d) for(int i=a;i>b;i-=d)
#define LLMIN LLONG_MIN
#define LLMAX LLONG_MAX
#define AKASH_PATEL ios_base::sync_with_stdio(false);
#define SVNIT_SURAT cin.tie(NULL);cout.tie(NULL);
#define mset(x,a) memset(x,a,sizeof(x));
#define nl cout<<'\n';
#define print(c) cout<<c<<'\n';
#define setp(n) cout << fixed << setprecision(n)
#define take_arr(a,n) fpr(i,0,n) cin>>a[i];
#define print_arr(a,n) for(int i=0;i<n;i++) {cout<<a[i]<<" ";} cout<<'\n';
#define take_mat(mat,n,m) fpr(i,0,n) fpr(j,0,m) cin>>mat[i][j];
#define set_mat(mat,n,m,k) fpr(i,0,n) fpr(j,0,m) mat[i][j]=k;
#define print_mat(dist,n,m) for(int i=0;i<n;i++){for(int j=0;j<m;j++){cout<<dist[i][j]<<" ";}cout<<'\n';}
template< class T > bool inside(T a, T b, T c) { return a<=b && b<=c; }
template< class T > bool odd(T a) { return a&1; }
template< class T > bool even(T a) { return !(a&1); }
#define pi
int main()
{
//#ifndef ONLINE_JUDGE
//    freopen("../ip.txt", "r", stdin);
//    freopen("../op.txt", "w", stdout);
//#endif
    AKASH_PATEL;
    SVNIT_SURAT;
    int t=1;
    //cin>>t;
    while(t--)
    {
        double r;
        cin>>r;
        setp(6)<<2*2 * asin(1.0)*r<<'\n';
    }
    return 0;
}





Measured memory_bytes: 3792
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef vector<int> vi;
typedef set<int> seti;
typedef vector<string> vs;

const int MOD = 1e9 + 7;
const int inf = 1e8;

int main() {
	string S;
	cin>>S;
	string ans = "None";
	for (char c = 'a'; c <= 'z'; ++c){
		if(S.find(c)==-1){
			ans=c;
			break;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
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 ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
typedef long long ll;
typedef long double ld;
int main(){
    ll n,m;cin>>n>>m;
    ll ans;
    if(n==1&&m==1){
        ans=1;
    }else if(n==1||m==1){
        ans=max(n,m)-2;
    }else{
        ans=(n-2)*(m-2);
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 3608
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
#include<list>

using namespace std;

typedef  long long int lint;

#define rep(i, n) for (lint i = 0; i < n; i++)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)
#define mp make_pair
#define IP pair<int,int>
#define enld endl

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

Measured memory_bytes: 3616
//author Forsaken
#define Hello the_cruel_world!
#pragma GCC optimize(2)
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cstring>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<utility>
#include<cmath>
#include<climits>
#include<deque>
#include<functional>
#include<numeric>
#define max(x,y) ((x) > (y) ? (x) : (y))
#define min(x,y) ((x) < (y) ? (x) : (y))
#define lowbit(x) ((x) & (-(x)))
#define FRIN freopen("C:\\Users\\Administrator.MACHENI-KA32LTP\\Desktop\\1.in", "r", stdin)
#define FROUT freopen("C:\\Users\\Administrator.MACHENI-KA32LTP\\Desktop\\1.out", "w", stdout)
#define FAST ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define outd(x) printf("%d\n", x)
#define outld(x) printf("%lld\n", x)
#define memset0(arr) memset(arr, 0, sizeof(arr))
#define il inline
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
const int maxn = 1e5;
const int INF = 0x7fffffff;
const int mod = 1e9 + 7;
const double eps = 1e-7;
const double Pi = acos(-1.0);
il int read_int() {
	char c;
	int ret = 0, sgn = 1;
	do { c = getchar(); } while ((c < '0' || c > '9') && c != '-');
	if (c == '-') sgn = -1; else ret = c - '0';
	while ((c = getchar()) >= '0' && c <= '9') ret = ret * 10 + (c - '0');
	return sgn * ret;
}
il ll read_ll() {
	char c;
	ll ret = 0, sgn = 1;
	do { c = getchar(); } while ((c < '0' || c > '9') && c != '-');
	if (c == '-') sgn = -1; else ret = c - '0';
	while ((c = getchar()) >= '0' && c <= '9') ret = ret * 10 + (c - '0');
	return sgn * ret;
}
il ll quick_pow(ll base, ll index, ll p) {
	ll res = 1;
	while (index) {
		if (index & 1)res = res * base % p;
		base = base * base % p;
		index >>= 1;
	}
	return res;
}
int arr[maxn + 5], n;
int main()
{
	n = read_int();
	for (int i = 1; i <= n; ++i)arr[i] = read_int();
	sort(arr + 1, arr + 1 + n);
	if (n & 1)outd(0);
	else {
		int u = arr[n / 2], v = arr[n / 2 + 1];
		if (u == v)outd(0);
		else outd(v - u);
	}
	//system("pause");
	return 0;
}

Measured memory_bytes: 640
import math

X = int(input())

cnt = 0

# 素数判定関数 素数:True, 素数じゃない:False
def prime(x):
  for i in range(2, math.floor(math.sqrt(x)) + 1):
    if x % i == 0:
      return False
  return True
      

for j in range(1000000000):
  if prime(X) == True:
    print(X)
    break
  else:
    X += 1

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define rep(i,n) for(lli i=0;i<n;i++)
#define repb(i,n) for(lli i=n-1;i>=0;i--)
#define pb push_back
#define mp make_pair
#define bg() begin()
#define en() end()
#define ft first
#define sc second
#define vect_lli_it vector<lli>::iterator
#define set_lli_it set<lli>::iterator
#define inf 1e18
#define all(X) X.begin(),X.end()
#define iterate(X) for(it=X.begin();it!=X.end();it++)
lli combi(lli n,lli k)
{
    lli ans=1;
    k=k>n-k?n-k:k;
    lli j=1;
    for(;j<=k;j++,n--)
    {
        if(n%j==0)
        {
            ans*=n/j;
        }else
        if(ans%j==0)
        {
            ans=ans/j*n;
        }else
        {
            ans=(ans*n)/j;
        }
    }
    return ans;
}
lli gcd(lli a, lli b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
lli findlcm(vector <lli> arr, lli n)
{
    lli ans = arr[0];
    for (lli i = 1; i < n; i++)
        ans = (((arr[i] * ans)) /
                (gcd(arr[i], ans)));

    return ans;
}
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
  cin>>s;
  lli check=0;
  rep(i,s.length()-1){
    if(s[i]==s[i+1]){
      check=1;
      break;
    }
  }
  if(check==1)
    cout<<"Bad";
  else
    cout<<"Good";
    return 0;
}


Measured memory_bytes: 256
n,m=map(int,input().split())
ab=[list(map(int,input().split())) for _ in range(n)]
ab.sort()
ans=0
for i in range(n):
    if ab[i][1]<m:
        ans+=ab[i][0]*ab[i][1]
        m-=ab[i][1]
    elif ab[i][1]>=m:
        ans+=ab[i][0]*m
        break
print(ans)

Measured memory_bytes: 27884
import java.util.ArrayList;
import java.util.Scanner;

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

		int x = scan.nextInt();
		int n = scan.nextInt();
		ArrayList<Integer> list = new ArrayList<Integer>();
		int abs = 99;
		int ans = 100;

		for(int i = 0;i < n;i++) {
			list.add(scan.nextInt());
		}

		for(int i = 0;i <= 200;i++) {
			if(!(list.contains(i))) {
				if(Math.abs(x - i) < abs) {
					abs = Math.abs(x - i);
					ans = i;
				}
			}
		}

		if(n == 0 || !(list.contains(x))) {
			System.out.println(x);
		}else {
			System.out.println(ans);
		}
	}
}


Measured memory_bytes: 36152
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>

using namespace std;

int main(void){
  string str;
  int ans=0,Jf,Oc,If;
  cin >>str;
  for(int i=1;i<str.size()-1;i++){
    if(str[i]=='O'){
      Oc=1;
      for(int j=i+1;str[j]=='O';j++)Oc++;
      Jf=1;
      for(int j=0;j<Oc;j++){
	if(str[i-1-j]!='J'){
	  Jf=0;
	  break;
	}
      }
      If=1;
      for(int j=0;j<Oc;j++){
	if(str[i+Oc+j]!='I'){
	  If=0;
	  break;
	}
      }
      if(Jf && If && ans<Oc) ans=Oc;
      i+=Oc;
    }
  }
  printf("%d\n",ans);
}

Measured memory_bytes: 0
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String[] price = String.valueOf(n).split("");

        if (n <= 1000) {
            System.out.println(1000 - n);
            return;
        }

        if (Integer.parseInt(price[1]) == 0 && Integer.parseInt(price[2]) == 0 && Integer.parseInt(price[3]) == 0) {
            System.out.println(0);
            return;
        }

        System.out.println((Integer.parseInt(price[0]) + 1) * 1000 - n);
    }
}

Measured memory_bytes: 27108
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
const long long INF = 1e18;

int main() {
	int n;
	cin >> n;
	vector<long long> a1(n), a2(n), a3(n);
	priority_queue<long long, vector<long long>, greater<long long>> pq1;
	priority_queue<long long> pq3;
	long long s1 = 0, s3 = 0;
	for (int i = 0; i < n; i++) {
		cin >> a1[i];
		pq1.push(a1[i]);
		s1 += a1[i];
	}
	for (int i = 0; i < n; i++) {
		cin >> a2[i];
	}
	for (int i = 0; i < n; i++) {
		cin >> a3[i];
		pq3.push(a3[i]);
		s3 += a3[i];
	}
	vector<long long> aux1(n+1), aux2(n+1);
	aux1[0] = s1;
	for (int i = 0; i < n; i++) {
		pq1.push(a2[i]);
		s1 += a2[i];
		s1 -= pq1.top(); pq1.pop();
		aux1[i+1] = s1;
	}
	aux2[n] = s3;
	for (int i = 0; i < n; i++) {
		pq3.push(a2[n-1-i]);
		s3 += a2[n-1-i];
		s3 -= pq3.top(); pq3.pop();
		aux2[n-1-i] = s3;
	}
	long long ans = -INF;
	for (int i = 0; i <= n; i++) {
		ans = max(ans, aux1[i] - aux2[i]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 8336
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1 << 30;
#define MOD 1000000007LL
#define PI 3.141592653589793
#define endl "\n"

const int D = 60;
const int MAX_N = 200005;
vvi to(D, vi(MAX_N));

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N, K;
  cin >> N >> K;
  for(int i = 0; i < N; i++){
    cin >> to.at(0).at(i);
    to.at(0).at(i)--;
  }

  for(int i = 0; i < D-1; i++){
    for(int j = 0; j < N; j++){
      to.at(i+1).at(j) = to.at(i).at(to.at(i).at(j)); //jから2^i回進んだ先から、さらに2^i回進んだ先
    }
  }
  int now = 0;
  int i = 0;
  while(K > 0){
    if(K & 1){
      now = to.at(i).at(now);
    }
    i++;
    K >>= 1;
  }
  cout << now + 1 << endl;
}

Measured memory_bytes: 50776
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Read();
            if (s == "Sunny")
            {
                WriteLine("Cloudy");
            }
            else if(s == "Cloudy")
            {
                WriteLine("Rainy");
            }
            else
            {
                WriteLine("Sunny");
            }
        }


        private static string Read() { return ReadLine(); }
        private static string[] Reads() { return (Read().Split()); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }


        public static bool IsPrime(int num)
        {
            if (num < 2) return false;
            else if (num == 2) return true;
            else if (num % 2 == 0) return false;

            double sqrtNum = Sqrt(num);
            for (int i = 3; i <= sqrtNum; i += 2)
            {
                if (num % i == 0)
                {
                    return false;
                }
            }
            return true;
        }

        //最大公約数
        public static int Gcd(int a, int b)
        {
            if (a < b)
            {
                return Gcd(b, a);
            }
            while (b != 0)
            {
                var reminder = a % b;
                a = b;
                b = reminder;
            }
            return a;
        }

        //最小公倍数
        public static int Lcm(int a, int b)
        {
            return a * b / Gcd(a, b);
        }

        //文字数を数える
        public static int CountChar(string s, char c)
        {
            return s.Length - s.Replace(c.ToString(), "").Length;
        }
        public static void debuglist(List<int> x)
        {
            foreach (var item in x)
            {
                WriteLine(item);
            }
        }
        public static void debuglist(List<string> x)
        {
            foreach (var item in x)
            {
                WriteLine(item);
            }
        }
        public static void debugarray(int[] x)
        {
            foreach (var item in x)
            {
                WriteLine(item);
            }
        }
        public static void debugarray(string[] x)
        {
            foreach (var item in x)
            {
                WriteLine(item);
            }
        }
    }
}


Measured memory_bytes: 11092
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
mod2 = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
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 I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    h = I()
    def f(i):
        if i < 1:
            return 0
        return f(i//2) * 2 + 1

    return f(h)


print(main())





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

using namespace std;

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

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main() {
  int N;
  cin >> N;
  int ans = 0;
  for (int i = 1; i * i <= N; ++i) {
    ans = i * i;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let x: i64 = iterator.next().unwrap().parse().unwrap();
    let y: i64 = iterator.next().unwrap().parse().unwrap();

    let ans =
        if x == y {
            0
        } else if x == 0 && y > 0 {
            y
        } else if x == 0 && y < 0 {
            -y + 1
        } else if x > 0 && y == 0 {
            x + 1
        } else if x > 0 && y > 0 {
            if x <= y {
                y - x
            } else {
                x - y + 2
            }
        } else if x > 0 && y < 0 {
            if x <= -y {
                (-y) - x + 1
            } else {
                x - (-y) + 1
            }
        } else if x < 0 && y == 0 {
            -x
        } else if x < 0 && y > 0 {
            if -x <= y {
                y - (-x) + 1
            } else {
                (-x) - y + 1
            }
        } else {
            if -x <= -y {
                (-y) - (-x) + 2
            } else {
                (-x) - (-y)
            }
        };

    return ans.to_string();
}


Measured memory_bytes: 4352
n = gets.to_i
x = gets.chomp
xs = x.to_i(2)
xc = x.count('1')
def mpow(n, p, mod)
  r = 1
  while p > 0
    r = r * n % mod if p & 1 == 1
    n = n * n % mod
    p >>= 1
  end
  r
end
@h = {0=>0, 1=>1, 2=>1}
def popcount(u)
  return @h[u] if @h[u]
  a = u % u.to_s(2).count('1')
  @h[u] = 1 + popcount(a)
end
xsp = xs % (xc + 1)
if xc == 1
  xsm = 0
else
  xsm = xs % (xc - 1)
end
n.times do |i|
  if x[i] == '0'
    y = xsp + mpow(2, n - i - 1, xc + 1)
    y = mpow(y, 1, xc + 1)
  elsif xc == 1
    puts '0'
    next
  else
    y = xsm - mpow(2, n - i - 1, xc - 1)
    y = mpow(y, 1, xc - 1)
  end
  puts popcount(y) + 1
end

Measured memory_bytes: 15820
#include<bits/stdc++.h>
#define lowbit(x) ((x)&(-x))
#define ll long long
using namespace std;
int n,m,a[100100];
ll c[2][100100],s,t,ans;
void add(int id,int le,int ri,ll val){
	for(;ri;ri-=lowbit(ri)) c[id][ri]+=val;
	le--;if(le==0) return;
	for(;le;le-=lowbit(le)) c[id][le]-=val;
}
ll get(int id,int x){
	ll tot=0;
	for(;x<=m;x+=lowbit(x)) tot+=c[id][x];
	return tot;
}
ll gans(int x){
	ll ans=0;
	ans+=get(0,x);
	ans+=(ll)(x)*get(1,x);
	return ans;
}
int main(){
	#ifdef FILIN
		#ifndef DavidDesktop
			freopen(FILIN,"r",stdin);
			freopen(FILOUT,"w",stdout);
		#endif
	#endif
	ios::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n>>m;
	for(int i=1;i<=n;i++) cin>>a[i];
	for(int i=1;i<n;i++){
		s=a[i];t=a[i+1];
		if(s<t){
			add(0,1,s,t-s);
			add(0,s+1,t,t+1);
			add(1,s+1,t,-1);
			add(0,t+1,m,t-s);
		}
		else{
			add(0,1,t,t+1);
			add(1,1,t,-1);
			add(0,t+1,s,t+m-s);
			add(0,s+1,m,t+m+1);
			add(1,s+1,m,-1);
		}
	}
	ans=1e18;
	for(int i=1;i<=m;i++) ans=min(ans,gans(i));
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 5548
import java.util.Arrays;
import java.util.Scanner;

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

        int N = scanner.nextInt();
        long[] L = new long[N];

        for (int i = 0 ; i < N ; i++) {
            L[i] = scanner.nextLong();
        }

        int count = 0;

        for (int i = 0 ; i < N - 2 ; i++) {
            for (int j = i + 1 ; j < N - 1 ; j++) {
                for (int k = j + 1 ; k < N ; k++) {
                    long[] l = new long[3];
                    l[0] = L[i];
                    l[1] = L[j];
                    l[2] = L[k];
                    Arrays.sort(l);
                    if (L[i] != L[j] && L[j] != L[k] && L[k] != L[i] && l[0] + l[1] > l[2]) {
//                        System.out.printf("%d %d %d%n", i + 1, j + 1, k + 1);
                        count++;
                    }
                }
            }
        }

        System.out.println(count);
    }
}


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

int main()
{
  int a, b, ans;
  int d;
  while (cin >> a >> b)
  {
    ans = a +  b;
    d = 0;
    while (ans > 0)
    {
      d++;
      ans = ans / 10;
    }
    cout << d << endl;
  }
}

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

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

int main() {

    string s, t; cin >> s >> t;

    int n = s.length();
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        if (s[i] != t[i]) ans++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 3916
#define _USE_MATH_DEFINES

#include <iostream>
#include <cmath>
#include <iomanip>

int main()
{
    double r = 0;

    // input
    std::cin >> r;

    if (r <= 0 || r >= 10000)
    {
        std::cout << "Error : out of range!" << std::endl;
        return -1;
    }

    // output
    std::cout << std::fixed << std::setprecision(6) << r * r * M_PI << " ";
    std::cout << std::fixed << std::setprecision(6) << 2 * r * M_PI << std::endl;

    return 0;
}


Measured memory_bytes: 3212
# import sys
# sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]


def solve():
    n = II()
    C = []
    for i in range(n):
        a, b = MI()
        C.append((a, b))
    C = sorted(C, key=lambda x:x[1])
    # print(C)

    ctime = 0
    for a, b in C:
        # print(a, b)
        ctime += a
        if ctime > b:
            print('No')
            return
    print('Yes')

if __name__ == '__main__':
    solve()


Measured memory_bytes: 33380
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

class Salesman {
    private long sales;
    boolean isAchieved;

    Salesman(long price, long goodsnum){
        this.sales += price * goodsnum;
        this.isAchieved = this.sales >= 1000000;
    }
    void addSales(long price, long number) {
        this.sales += price * number;
        this.isAchieved = this.sales >= 1000000;
    }
}

public class Main{
    public static void main(String[] args) {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb = new StringBuilder();
        StringTokenizer st;
        try {
            while (true) {
                String line;
                long price,goodsnum;
                int num;
                int n = Integer.parseInt(br.readLine());
                if(n ==0){
                    break;
                }
                LinkedHashMap<Integer, Salesman> list = new LinkedHashMap<>();

                for (int i = 0; i < n; i++) {
                    line = br.readLine();
                    st = new StringTokenizer(line);
                    num = Integer.parseInt(st.nextToken());
                    price = Long.parseLong(st.nextToken());
                    goodsnum= Long.parseLong(st.nextToken());
                    if(list.containsKey(num)){
                        list.get(num).addSales(price,goodsnum);
                    }else{
                        list.put(num,new Salesman(price,goodsnum));
                    }
                }

                boolean isExist = false;
                for (Map.Entry<Integer, Salesman> entry : list.entrySet()) {
                    if(entry.getValue().isAchieved){
                        System.out.println(entry.getKey());
                        isExist = true;
                    }
                }
                if (!isExist){
                    System.out.println("NA");
                }
            }


        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}

Measured memory_bytes: 25508
#include<bits/stdc++.h>
using namespace std;
int main(void){
    int num;
    vector<int> mt(10);
    for(int i=0;i<10;i++){
        cin>>num;
        mt.push_back(num);
    }
    sort(mt.rbegin(),mt.rend());
    printf("%d\n%d\n%d\n",mt[0],mt[1],mt[2]);
    return 0;
}


Measured memory_bytes: 3228
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define rep(i,m,n) for(int i=(int)(m);i<(int)(n);++i)
#define rREP(i,m,n) for(int (i)=(n)-1; (i)>=(m);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 1000000001;
constexpr ll mod = 1000000007;
constexpr double PI = 3.1415926535897932;

template<class T>inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T>inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

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

int main() {
	init();
	
	int h, w; cin >> h >> w;
	vector<string>vec(h);
	rep(i, 0, h)cin >> vec[i];
	bool is = true;
	rep(i, 0, h) {
		rep(j, 0, w) {
			if (vec[i][j] == '.')continue;
			bool ok = false;
			rep(k, 0, 4) {
				int nx = j + dx[k], ny = i + dy[k];
				if (out(ny, nx, h, w))continue;
				if (vec[ny][nx] == '#')ok = true;
			}
			if (!ok)is = false;
		}
	}
	cout << (is ? "Yes" : "No") << "\n";

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
const int MAX = 510000;

int main() {
  vector<vector<int>> c(3, vector<int>(3));
  for (int i=0; i<3; i++) {
    for (int j=0; j<3; j++) cin >> c[i][j];
  }
  vector<int> a(3), b(3);
  a[0] = 0;
  for (int i=0; i<3; i++) b[i] = c[0][i]-a[0];
  for (int i=1; i<3; i++) a[i] = c[i][0]-b[0];
  bool correct = true;
  for (int i=0; i<3; i++) {
    for (int j=0; j<3; j++) {
      if (a[i]+b[j]!=c[i][j]) {
        correct = false;
        break;
      }
    }
    if (!correct) break;
  }
  if (correct) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

#define                           int                         long long
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<int,int>
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);




using namespace std;

const int inf=1e18;
const int mod=1e9+7;
const int M=100009;
inline int bigmod(int B,int P){int R=1;while(P>0){if(P&1){R=(R*B)%mod;}P>>=1;B=(B*B)%mod;}return R;}


 main()

{
    fast
    int a,b;
    cin>>a>>b;
    int x=a+b;
    int y=a-b;
    int z=(a*b);
    int ses=max(x,y);
    ses=max(ses,z);
    cout<<ses<<endl;


















    return 0;

}













Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <list>
#include <map>
#include <string>
#include <functional>
#include <math.h>
#include <utility>
using namespace std;
int N,M,A[1000],B,V[1000]={};
int main()
{
	cin>>N>>M;
	for(int i=0;i<N;i++)cin>>A[i];
	for(int i=0;i<M;i++){
		cin>>B;
		for(int j=0;j<N;j++)
			if(A[j]<=B){V[j]++;break;}
	}
	int ans=-1,mn=0;
	for(int i=0;i<N;i++){
		if(mn<V[i]){ans=i;mn=V[i];}
	}
	cout<<++ans<<endl;
}

Measured memory_bytes: 1168
#include <bits/stdc++.h>
#define int long long
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define ms(v,x) memset(v,x,sizeof(v))
#define pii pair<int,int>
#define ff first
#define ss second
#define frr(s,n) for(int i=s;i<n;i++)
#define inf 10000000000 //1e10
using namespace std;
inline int mod(int n, int m){ int ret = n%m; if(ret < 0) ret += m; return ret; }


int32_t main(){
    fastio;
    int n;
    cin >> n;
    int ch[n][3];
    for(int i=0;i<n;i++)
        cin >> ch[i][0] >> ch[i][1] >> ch[i][2];

    int dp[n][3];
    dp[0][0] = ch[0][0];
    dp[0][1] = ch[0][1];
    dp[0][2] = ch[0][2];

    for(int i=1;i<n;i++){
        for(int j=0;j<3;j++){
            dp[i][j] = ch[i][j]+max(dp[i-1][(j+1)%3],dp[i-1][(j+2)%3]);
        }
    }
    cout << max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2])) << endl;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define INIT(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define INIT2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

#define umap unordered_map
//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
ll sum(ll a[],ll N){ return accumulate(a,a+N,0LL);}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a/gcd(a,b)*b;}

ll N,M;
ll d[2000];
bool negative[2000];
ll a[3000],b[3000],c[3000];
ll inf = 1000000000000;

int main(){
  cin>>N>>M;
  d[1] = 0;
  for(int i=2;i<=N;++i){ d[i]=inf;  }
  REP(i,M){
    cin >> a[i] >> b[i] >> c[i];
    c[i] = -c[i];
  }
  REP(count,N-1){
    bool fin = true;
    REP(i,M){
      if(d[ a[i] ]==inf){ continue;}
      ll d_cand = d[ a[i] ] + c[i];
      if(d_cand < d[b[i]]){
        d[ b[i] ] = d_cand;
        fin = false;
      }
    }
    if(fin){ break;}
  }
  ll ans = d[N];
  
  for(int i=1;i<=N;++i){ negative[i] = false;}
  REP(count,N){
    REP(i,M){
	  if(d[ a[i] ]==inf){ continue;}
      ll d_cand = d[ a[i] ] + c[i];
      if(d_cand < d[b[i] ]){
        d[b[i]]= d_cand;
        negative[b[i]]=true;
      }
      if(negative[ a[i] ]){
        negative[ b[i] ]=true;
      }
    }
  }
  if(negative[N]){ cout << "inf\n"; }
  else{ cout << -ans <<"\n";}
  
}





Measured memory_bytes: 256