akhauriyash/Code-Regression huggingface dataset:
public class Main {


  private static void solve() {
    char[] s = ns();
    int n = s.length;
    for (int i = 1; i <= n; i ++) {
      for (int j = i; j < n; j ++) {
        String a = new String(s, 0, i);
        String b = new String(s, j, n - j);
        if ((a + b).equals("keyence")) {
          System.out.println("YES");
          return;
        }
      }
    }
    System.out.println("NO");
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}


Measured memory_bytes: 23508
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;


int main() {
  ll n; cin >> n;
  vi vec(n);
  rep(i,n){
    ll x ; cin >> x;
    vec.at(i) = x;
  }
  
  sort(all(vec));
  
  bool flag = true;
  
  rep(i,n-1){
    if(vec.at(i)==vec.at(i+1)){
      flag = false;
      cout << "NO" << endl;
      break;
    }
  }
  
  if(flag) cout << "YES" << endl;
}
  
  

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


int main(){
    int n, p_single, count = 0;
    deque<int> p;
    std::cin >> n;

    std::cin >> p_single;
    p.push_back(p_single);

    std::cin >> p_single;
    p.push_back(p_single);

    std::cin >> p_single;
    p.push_back(p_single);

    for(int i = 3; i <= n; i++){
        if(p[0] < p[1] && p[1] < p[2]){
            count++;
        }else if(p[0] > p[1] && p[1] > p[2]){
            count++;
        }
        if(i != n){
            std::cin >> p_single;
            p.push_back(p_single);
            p.pop_front();
        }
    }

    std::cout << count;


}

Measured memory_bytes: 3596
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#include<cassert>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define rreps(X,S,Y) for (int (X) = (Y)-1;(X) >= (S);--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())
#define Endl endl

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T> using vv=vector<vector<T>>;
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
#define out(args...){vector<string> a_r_g_s=s_p_l_i_t(#args, ','); e_r_r(a_r_g_s.begin(), args); }
vector<string> s_p_l_i_t(const string &s, char c){vector<string> v;int d=0,f=0;string t;for(char c:s){if(!d&&c==',')v.pb(t),t="";else t+=c;if(c=='\"'||c=='\'')f^=1;if(!f&&c=='(')++d;if(!f&&c==')')--d;}v.pb(t);return move(v);}
void e_r_r(vector<string>::iterator it) {}
template<typename T, typename... Args> void e_r_r(vector<string>::iterator it, T a, Args... args){ if(*it==" 1"||*it=="1") cerr<<endl; else cerr << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << ", "; e_r_r(++it, args...);}
template<typename T>vector<T> table(int n, T v){ return vector<T>(n, v);}
template <class... Args> auto table(int n, Args... args){auto val = table(args...); return vector<decltype(val)>(n, move(val));}
const ll MOD=1e9+7;

int main(){
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(0);
	int n;
	cin>>n;
	map<ll,ll> d,e;
	rep(i,n){
		ll x;
		cin>>x;
		++d[x];
	}
	int m;
	cin>>m;
	rep(i,m){
		ll x;
		cin>>x;
		++e[x];
	}
	int f=1;
	for(pll p:e)if(p.Y>d[p.X]) f=0;
	cout<<(f?"YES":"NO")<<endl;
  return 0;
}


Measured memory_bytes: 25216
#include<iostream>
#include<cstdio>
#include<queue>
#include<vector>
#include<string.h>

using namespace std;


long long N,M;


int main()
{
  cin >> N >> M;
  
  priority_queue<long long> qu;
  
  long int i,j;

  for(i=0;i<N;i++)
  {
    cin >> j;
    qu.push(j);
  }
  
  for(i=0;i<M;i++)
  {
    j=qu.top();
    qu.pop();
    
    j=j/2;
    qu.push(j);    
  }

  j=0;
  for(i=0;i<N;i++)
  {
    j+=qu.top();
    qu.pop();
  }
    
  cout << j;


 return 0; 
}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using vll = vector<ll> ;
#define all(v) v.begin(),v.end()
const ll mod = 1e9+7;

ll Pow(ll a,ll b){
    ll res=1ll;
    a%=mod;
    while(b){
        if (b & 1)
            res = (1ll*res * a) % (1ll*mod);
        a = (1ll*a * a) % (1ll*mod);
        b >>= 1ll;
    }
    return 1ll*res%mod;
}

int main(){
  int N;cin>>N;
  vector<ll> A(N);rep(i,N)cin>>A[i];
  vector<ll> d0(65),d1(65);
  ll ans = 0;
  rep(i,N){
    bitset<65> a(A[i]);
    rep(j,65){
      d0[j] += (a[j]==0);
      d1[j] += (a[j]==1);
    }
  }
  //rep(i,60) cout<< "i " << i << " d0 " << d0[i] << " d1 " <<  d1[i] << endl;
  rep(i,65){
    ans += Pow(2,i) * (d0[i] * d1[i] % mod) % mod;
    ans %= mod;
  }
  cout << ans << endl;
}

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

import static java.lang.System.in;

public class Main {
    public static void main(String[] args)throws IOException{
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        char[] s = sc.next().toCharArray();
        LinkedList<Character> res = new LinkedList<>();
        int right=0;
        for(int i=n-1;i>=0;i--){
            if(s[i]==')') right++;
            else{
                if(right>0) right--;
                else{
                    res.add(')');
                }
            }
            res.addFirst(s[i]);
        }
        StringBuilder ans = new StringBuilder();
        for(int i=0;i<right;i++) ans.append('(');
        while(res.size()>0) ans.append(res.poll());
        System.out.println(ans.toString());
    }
}


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

int main() {
  long long N,A,B;
  
  cin>>N>>A>>B;
  
  long long a,b;
  long long result=0;
  a=N/(A+B);
  result+=a*A;
  b=N-N/(A+B)*(A+B);
  result+=b>A?A:b;
  cout<<result<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
#include<random>
#include<ctime>
using namespace std;

const long long int mod=1000000007;
const long long int INF=99999999999999999;
struct edge {
long long int to;
};

string str[202],str2;
long long int n,m=0,res[202][202]={},res2=0,sum,now=1,before[202][202]={},result=-1,memores=0;

queue<long long int>que[202],memo[202],task,nexttask,out[202];
int main() {
	cout << fixed << setprecision(10);
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>str[i];
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(str[i][j]=='1')que[i].push(j);
        }
        memo[i]=que[i];
        out[i]=que[i];
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            que[j]=memo[j];
        }
        while(!task.empty()){task.pop();}
        task.push(i);
        while(!nexttask.empty())nexttask.pop();
        res[i][i]=1;
        memores=1;
        //for(int j=0;j<n;j++){
            
            
            while(!task.empty()){
                while(!que[task.front()].empty()){
                    //cout<<"!";
                    if(res[i][que[task.front()].front()]==res[i][task.front()]){goto next;}
                    else if(res[i][que[task.front()].front()]==0){
                        //cout<<"?";
                        nexttask.push(que[task.front()].front());
                        res[i][que[task.front()].front()]=res[i][task.front()]+1;
                    }
                    //cout<<memores<<"task"<<task.front()<<" que[task]"<<que[task.front()].front()<<endl;;
                    que[task.front()].pop();
                }
                task.pop();
                if(task.empty()&&!nexttask.empty()){memores++;task=nexttask;while(!nexttask.empty())nexttask.pop();}
            }
            //for(int k=0;k<n;k++){cout<<i<<":"<<k<<":"<<res[i][k]<<" ";}
            //cout<<endl;
        //}
        
        result=max(memores,result);
        next:
        m++;
    }
    cout<<result;
} 


Measured memory_bytes: 2176
use std::io;
use std::str::FromStr;

static MOD: u64 = 1_000_000_007;

fn input<T:FromStr>() -> T {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.trim().parse().ok().unwrap()
}

fn binary_power(x: u64, n: u64) -> u64 {
    if n == 0 {
      return 1;
    }
    if n % 2 == 0 {
      return (binary_power(x, n / 2) % 13).pow(2) % 13;
    } else {
      return binary_power(x, n - 1) % 13 * x % 13;
    }
}

fn remainder(n: char, digit: u64) -> Vec<u64> {
    let mut remainders = vec![0u64; 13];
    if n == '?' {
        for i in 0..10 {
            let remainder = binary_power(10, digit) * i % 13;
            remainders[remainder as usize] += 1
        }
    } else {
        let remainder = binary_power(10, digit) * (n as u64 - 48) % 13;
        remainders[remainder as usize] = 1;
    }    
    remainders
}

fn main() {
    let s: String = input();
    let s: Vec<char> = s.chars().collect();
    let mut dp: Vec<Vec<u64>> = vec![vec![0; 13]; s.len()];
    dp[s.len() - 1] = remainder(s[s.len() - 1], 0);
    for i in (0..(s.len() - 1)).rev() {
        for j in 0..13 {
            let remainders = remainder(s[i], (s.len() - 1 - i) as u64);
            for k in 0..13 {
                let r = (13 + j - k) % 13;
                dp[i][j] += dp[i+1][r] % MOD * remainders[k] % MOD;
            }
            
        }
    }
    // println!("{:?}", dp);
    println!("{:?}", dp[0][5] % MOD);
}


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

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

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template<typename T> vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts> auto make_v(size_t a,Ts... ts){   return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...)); }
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){ for(auto &e:t) fill_v(e,v); }
template<typename T,typename U,typename... V> typename enable_if<is_same<T, U>::value!=0>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V> typename enable_if<is_same<T, U>::value==0>::type fill_v(U &u,const V... v){ for(auto &e:u) fill_v<T>(e,v...);}
//FUNCTION

//BELOW
void solve(void)
{
  string O,E;
  cin>>O;
  cin>>E;
  for (int i = 0; i < O.size(); i++)
  {
    cout<<O[i];
    if((O.size() > E.size() && i != O.size()-1)||O.size() == E.size())cout<<E[i];
  }
  cout<<endl;

  return;
}

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

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

  return 0;
}


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

using namespace std;

using int64 = long long;

int main() {
  int N, T;
  cin >> N >> T;
  int ret = 1 << 30;
  while(N--) {
    int c, t;
    cin >> c >> t;
    if(t <= T) ret = min(ret, c);
  }
  if(ret == (1 << 30)) cout << "TLE" << endl;
  else cout << ret << endl;
}


Measured memory_bytes: 256
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr = input.trim().split("\n");
var n=arr.shift()-0;
var a=arr.shift().split(" ").map(Number);
var b=[];
var memo="";
for(var i=0;i<a.length;i++){
   if(a[i]!==memo)b.push(a[i]);
   memo=a[i];
}
console.log(b.join(" "));


Measured memory_bytes: 39352
from sys import stdin
import numpy as np
#L = int(stdin.readline().rstrip().split()[0])
A = [int(x) for x in stdin.readline().rstrip().split()]
# N, X = [int(x) for x in stdin.readline().rstrip().split()]
# S = stdin.readline().rstrip().split()[0]

ans = "Yes"

if A[0]!=A[1]:
  ans ="No"
elif A[0]!=A[2]:
  ans="No"
elif A[1]!=A[2]:
  ans="No"
print(ans)

Measured memory_bytes: 21544
S = input()
S1 = ''
S2 = ''
for i in range(len(S)):
    if i % 2 ==0 :
        S1 += '0'
        S2 += '1'
    else :
        S1 += '1'
        S2 += '0'
min1 = 0
for i in range(len(S)):
    if S[i] != S1[i]:
        min1 += 1
min2 = 0
for i in range(len(S)):
    if S[i] != S2[i]:
        min2 += 1 
print(min(min1,min2))


Measured memory_bytes: 3316
#include <bits/stdc++.h>
 
using namespace std;
inline void prep ()
{
  cin.tie (0);
  cin.sync_with_stdio (0);
};
const double pi = acos(-1.);
//printf(%.12lf\n,mid);
// __builtin_popcount(int) count 1's in binary
// get decimal part of number
/*
double intpart;
double thiss = modf((double)(n*m)/(double)k, &intpart);
*/
// round = (int)(num+.5)
long long mod = 1000000007;
 
// 32 mil = ~1 sec 
long long mymod(long long num){
  if (num< 0 && !(num%mod == 0)){
    if (mod == 1){
      return 0;
    }
    return mod-abs(num)%mod;
  }else{
    return num%mod;
  }
}
 
/*string sentence = And I feel fine...;
    istringstream iss(sentence);
*/  
 
double eps = .000000001;

int main ()
{
  prep();
  int n, q;
  cin >> n >> q;
  int arr[n];
  long long evens[n] = {0};
  long long odds[n] = {0};
  long long sum[n] = {0};
  for (int i=0; i<n; i++){
      cin >> arr[i];
      sum[i] = arr[i];
      if (i%2== 0){
          evens[i] = arr[i];
      }else{
          odds[i] = arr[i];
      }
  }
  for (int i=1; i<n; i++){
      sum[i] += sum[i-1];
      evens[i] += evens[i-1];
      odds[i] += odds[i-1];
  }
  vector<pair<int, int> > intervals;
  vector<long long> sums;
  for (int i=1; i<=n/2+n%2; i++){
      int other = i;
      // binary search left
      int bottom = max(n-i-other, 0);
      int top = n-i-1;
      int l, r;
      int l2, r2;
      int lastl = 0;
      int lastr = 0;
      long long firstel, lastel;
      if (bottom == 0){
          firstel = -10000000000000;
          l = 0;
      }else{
          firstel = arr[bottom-1];
          l = arr[bottom-1]+1;
      }
      if (i == 1){
          lastel = 10000000000000;
           r = 1000000001;
      }else{
          lastel = arr[top+1];
           r = arr[top+1]-1;
      }
      
      // search for l
      while (l <= r){
          int mid = (l+r)/2;
          
          int diffbot = max(mid-arr[bottom], 0);
          int difftop = max(arr[top]-mid, 0);
          long long othertop = lastel-mid;
          long long otherbot = mid-firstel;
          if (difftop >= otherbot){
              l = mid+1;
          }else{
              lastl = mid;
              r = mid-1;
          }
      }
      //cout << lastl  << endl;
      intervals.push_back({lastl, i-1});
      long long tot = sum[n-1]-sum[n-i-1];
      if (bottom > 0){
          if (n%2 == 0){
              tot += odds[bottom-1];
          }else{
              tot += evens[bottom-1];
          }
          
      }
      sums.push_back(tot);
  }
  reverse(intervals.begin(), intervals.end());
  for (int i=0; i<q; i++){
      int xx;
      cin >> xx;
      vector<pair<int, int> >::iterator it = upper_bound(intervals.begin(), intervals.end(), make_pair(xx, 1000000001));
      it--;
      cout << sums[(*it).second] << '\n';
  }
  return 0; 
}


Measured memory_bytes: 5492
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <complex>
#include <vector>
#include<limits>
#include<iomanip>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;

const long double pi = 3.141592653589793;

#define debug(x) cout << #x << " = " << (x) << endl;
#define rep(i, n) for(int i = 0;i < n;i++)
#define repi(i, j, n) for(int i = j;i < n;i++)
#define pb push_back
#define mp make_pair
#define mod 998244353
#define F first
#define S second

string s;int k, n;

/*
  --- 0 111111  ----------
      i'     i     (j)

      i(3) j(3) k(5)
*/

unordered_map<ll, int> dp;
ll state_to_num(int i, int j, int k) {
  return 1LL*i*1E10 + 1LL*j*1E6 + k;
}

int combinations(int i, int j, int k) {
  if(i < 0) return 1;
  if(dp.count(state_to_num(i, j, k)) == 1) {
    return dp[state_to_num(i, j, k)];
  }

  int id = i;
  while(id >= 0 && s[id] == '1') id--;
  if(id == -1) return 1;
  int ans = 0;
  for(int ps = 0;ps <= (i-id+j);ps++) {
    if(ps <= j) {
      ans += combinations(id-1, ps, k);
    } else if(ps-j <= k) {
      ans += combinations(id-1, ps, k-ps+j);
    }
    ans %= mod;
  }
  return dp[state_to_num(i, j, k)] = ans;
}

int main() {

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

 cin>>s>>k;
 n = s.size();
 k = min(k, n*n);

 cout << combinations(n-1, 0, k) << endl;

 return 0;
}


Measured memory_bytes: 31788
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <tuple>
#include <bitset>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>

int main() {
	constexpr long long int mod = 1000000007LL;
	int h, w; std::cin >> h >> w;
	std::vector<std::string> state(h); for (auto& line : state) std::cin >> line;
	std::vector<std::vector<long long int>> memo(h + 1, std::vector<long long int>(w + 1, 0));
	memo[1][1] = 1;
	for (auto i = 1; i <= h; ++i) {
		for (auto j = 1; j <= w; ++j) if (state[i - 1][j - 1] == '.') {
			memo[i][j] += memo[i - 1][j] + memo[i][j - 1];
			memo[i][j] %= mod;
		}
	}
	std::cout << memo.back().back() << std::endl;
}

Measured memory_bytes: 9216
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <algorithm>
#include <list>
#include <cmath>
#include <iomanip>

int main()
{
    long double x1,y1,x2,y2;
    std::cin >> x1 >> y1 >> x2 >> y2;
    std::cout << std::setprecision(10) << std::sqrt(std::pow(std::abs(x1-x2),2)+std::pow(std::abs(y2-y1),2)) << std::endl;

    return 0;
}



Measured memory_bytes: 3296
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

int a[101];
int main(){
    int n;
    cin>>n;
    rep(i,n) cin>>a[i];
    rep(i,n){
        for(int j=i-1;j>=0;--j){
            if(a[j]>a[j+1]) swap(a[j],a[j+1]);
            else break;
        }
        rep(j,n) cout<<a[j]<<(j==n-1?"":" ");
        cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 3112
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>
#include <set>

using namespace std;
using ll = long long;
const int MOD=1000000007;

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

vector<vector<int> > vvi;
vector<vector<vector<int> > > vvvi;

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

int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }



int main(int argc, char**argv){
    int n;
    cin >> n;
    string s;
    cin >> s;

    vector<int> east(n+1, 0), west(n+1, 0);
    for (int i = 0; i < n; i++){
        if (s[i] == 'W'){
            west[i+1] = west[i] + 1;
            east[i+1] = east[i];
        }else{
            west[i+1] = west[i];
            east[i+1] = east[i] + 1;
        }
    }

    ll ans = 99999999;
    for (int i = 0; i < n; i++){
        ll val = west[i] - west[0] + east[n] - east[i+1];
        ans = min(ans, val);
    }
    cout << ans << endl;

    return 0;
}



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

using namespace std;

int main() {
  int N, sum = 0, max_length = 0;
  
  cin >> N;
  
  for (int i = 0; i < N; i++) {
    int in;
    
    cin >> in;
    
    sum += in;
    max_length = max(max_length, in);
  }
  
  sum -= max_length;
  
  if (sum > max_length) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_map>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>
#include<iomanip>
#include<bitset>

using namespace std;

#define ll long long int

ll const MOD = 1000000007;
ll const INF = (long long int)1 << 61;

ll mypow(ll x,ll n){
    ll ret = 1;
    while(n > 0){
        if(n&1){
            ret = (ret*x)%MOD;
        }
        x = (x*x)%MOD;
        n >>= 1;
    }
    return ret;
}

int tryquery(string &s,ll x,vector<char> &a,vector<char> &b,ll n,ll q){
    for(int i = 0; i < q; i++){
        if(s[x] == a[i]){
            if(b[i] == 'L'){
                x--;
            }else{
                x++;
            }
            if(x < 0){
                return -1;
            }else if(x >= n){
                return 1;
            }
        }
    }
    return 0;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n,q;
    cin >> n >> q;

    string str;
    cin >> str;

    vector<char> a(q),b(q);
    for(int i = 0; i < q; i++){
        cin >> a[i] >> b[i];
    }

    ll lok = -1;
    ll lng = n;

    while(abs(lok-lng) > 1){
        ll lmiddle = (lok+lng)/2;
        if(tryquery(str,lmiddle,a,b,n,q) < 0){
            lok = lmiddle;
        }else{
            lng = lmiddle;
        }
    }

    ll rok = n;
    ll rng = -1;

    while(abs(rok - rng) > 1){
        ll rmiddle = (rok + rng)/2;
        if(tryquery(str,rmiddle,a,b,n,q) > 0){
            rok = rmiddle;
        }else{
            rng = rmiddle;
        }
    }

    cout << rok - lok - 1 << endl;

    return 0;
}

Measured memory_bytes: 976
#include <iostream>
#include <cmath>
#include <map>
#include <utility>
#include <list>
#include <string>
#include <vector>
#include <algorithm>
#include <set>

using namespace std;

#define LL long long

int main() {
    int a[5];
    
    int total = 0;
    int mdiff = 0;
    for (int i=0; i < 5; i++) {
        int t;
        cin >> t;
        int diff = ceil((double)t / 10) * 10 - t;
        if (diff > mdiff) {
            mdiff = diff;
        }
        total += ceil((double)t / 10) * 10;
    }
    total -= mdiff;

    cout << total << endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  int x,y;
  int a,i;
  int max,min;
  int result,flag;
  
  while(scanf("%d%d",&x,&y)!=EOF){
    flag=0;
    if(x>y){
      max=x;
      min=y;
    }
    else{
      max=y;
      min=x;
    }
    for(i=1;i<=max;i++){
      if(max%i==0){
	a=max/i;
	if(min%a==0){
	  result=a;
	  flag++;
	  break;
	}
	else{
	  if(a*min==max && i!=1){
	    if(a<min)
	      result=a;
	    else
	      result=min;
	    flag++;
	  }
	}
      }
    }
    if(flag==0)
      result=1;
    printf("%d %d\n",result,x/result*y);
  }
  return(0);
}

Measured memory_bytes: 0
def down(H, n):
  x = min(H)
  n += x
  for i in range(len(H)):
    H[i] -= x
  return H, n

N = int(input())
H = list(map(int, input().split()))
n = 0
H, n = down(H, n)

while not all(h == 0 for h in H):
  L = []
  H0 =[]
  for h in H:
    if h != 0:
      L.append(h)
    else:
      if L:
        L, n = down(L, n)
      H0 += L
      H0.append(0)
      L = []
  if L:
    L, n = down(L, n)
    H0 += L
  H = H0

print(n)

Measured memory_bytes: 9180
N, M, X = map(int, input().split())
A = list(map(int, input().split()))

left, right = 0, 0
for i in range(M):
    if A[i] < X:
        left += 1
    if A[i] > X:
        right += 1

ans = min(left, right)
print(ans)


Measured memory_bytes: 2940
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<pint> vpint;
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)

int main(void){
	string s; cin >> s;
	int ans[30];
	rep(i, 30) ans[i] = 0;
	rep(i, s.size()){
		ans[s[i] - 'a']++;
	}
	rep(i, 26){
		if(ans[i] % 2 == 1){
			printf("No\n");
			return 0;
		}
	}
	printf("Yes\n");
	return 0;
}

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

int main() {
  string S;
  cin >> S;
  if (S.at(0) == S.at(1) || S.at(1) == S.at(2) || S.at(2) == S.at(3)) {
    cout << "Bad" << endl;
  } else {
    cout << "Good" << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int,int>;

const long long INF = 1LL << 60;

int main(){
    long long  N,A,B; cin >> N >> A >> B;
    if (A==0 && B==0) cout << 0 << endl;
    else{
        long long  n = N/(A+B);
        long long ans = 0;
        if (N%(A+B)<=A) ans = n*A + N%(A+B);
        else ans = n*A+A;
        cout << ans << endl;
    }
}


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

int main(){
    int r,c;
    cin >> r >> c;
    vector<vector<int> > t(r+1, vector<int>(c+1,0));
    for(int i=0; i<r; i++){
        for(int j=0; j<c; j++){
            cin >> t[i][j];
            t[r][j] += t[i][j];
            t[i][c] += t[i][j];
            t[r][c] += t[i][j];
        }
    }

    for(int i=0; i<=r; i++){
        for(int j=0; j<c; j++){
            cout << t[i][j] << " ";
        }
        cout << t[i][c] << endl;
    }
    return 0;
}

Measured memory_bytes: 3120
using static System.Math;
using System;

public class hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var m = int.Parse(line[1]);
        var p = int.Parse(line[2]);
        var s = new int[m];
        for (int i = 0; i < m; i++)
        {
            var w = int.Parse(Console.ReadLine().Trim()) - p;
            if (w < 0) w += n;
            s[i] = w;
        }
        Array.Sort(s);
        var ans = getAns(n, m, s);
        Console.WriteLine(ans * 100);
    }
    static int getAns(int n, int m, int[] s)
    {
        var ans = s[m - 1];
        ans = Min(ans, n - s[0]);
        for (int i = 0; i <= m - 2; i++)
        {
            ans = Min(ans, 2 * s[i] + n - s[i + 1]);
            ans = Min(ans, 2 * (n - s[m - 1 - i]) + s[m - 2 - i]);
        }
        return ans;
    }
}



Measured memory_bytes: 17940
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <array>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <set>
#include <math.h>
#include <queue>
#include <stdio.h>
#include <sstream>
using namespace std;
using i64 = int64_t;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep2(i, x, n) for(int i=x;i<n;++i)

int main()
{   
    int n;
    cin >> n;
    double odd_cnt = 0;
    double total_cnt = 0;
    rep2(i,1,n+1)
    {
        if(i%2==1) odd_cnt += 1;
        total_cnt += 1;
    }
    cout << odd_cnt/total_cnt << endl;
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define int lint
typedef long long lint;
typedef pair<int,int> P;
const int    INF=(int)1e9;
const int    MOD=(int)1e9+7;
const double EPS=(double)1e-10;
#define equals(a,b) (fabs((a)-(b))<EPS)
struct Accelerate_Cin{
    Accelerate_Cin(){
        cin.tie(0);ios::sync_with_stdio(0);cout<<fixed<<setprecision(20);
    };
};

//幾何学テンプレート

//点
class Point{
public:
  double x,y;

  Point(double x = 0,double y = 0):x(x), y(y){};

  Point operator + (Point p) {return Point (x+p.x, y+p.y);}
  Point operator - (Point p) {return Point (x-p.x, y-p.y);}
  Point operator * (double a) {return Point(a*x, a*y);}
  Point operator / (double a) {return Point(x/a,y/a);}

  double abs(){return (norm());}
  double norm(){return x*x+y*y;}

  bool operator < (const Point &p)const{
    return x!=p.x ? x<p.x:y<p.y;
  }
  bool operator > (const Point &p)const{
    return x!=p.x ? x>p.x:y>p.y;
  }
  bool operator == (const Point &p)const{
    return fabs(x-p.x)<EPS && fabs(y-p.y)<EPS;
  }
};

//ベクトル
typedef Point Vector;

//内積
double dot(Vector a,Vector b){
  return a.x*b.x+a.y*b.y;
}

//外積
double cross(Vector a,Vector b){
  return a.x*b.y-a.y*b.x;
}

//線分
struct Segment{Point p1,p2;};

//直線
typedef Segment Line;

//円
class Circle{
public:
  Point c;   //中心
  double r;  //半径
  Circle(Point c=Point(),double r=0.0):c(c),r(r){}
};

//多角形
typedef vector<Point> Polygon;

//ある直線/線分に対する、ある点の反射を求める。

//ある点から、直線/線分に対する射影を求める。
Point project(Segment s, Point p){
  Vector base=s.p2-s.p1;
  double r=dot(p-s.p1,base)/base.norm();
  return s.p1+base*r;
}

Point reflect(Segment s, Point p){
  return p+(project(s,p)-p)*2.0;
}


signed main(){
  double x1,y1,x2,y2;cin>>x1>>y1>>x2>>y2;
  Segment s={Point(x1,y1),Point(x2,y2)};

  int q;cin>>q;
  queue<Point>que;
  for(int i=0;i<q;i++){
    double x,y;cin>>x>>y;
    que.push(reflect(s,Point(x,y)));
  }

  while(!que.empty()){
    Point ans=que.front();que.pop();
    cout<<fixed<<setprecision(10)<<ans.x<<" "<<ans.y<<endl;
  }
  return 0;
}



Measured memory_bytes: 3316
#include<iostream>

using namespace std;

int main() {
    int N, len,tmp;
    string S;
    cin >> N >> S;
    len = S.length();


    for (int i = 0; i < len; ++i) {
        tmp = S[i] + N;
        if (tmp >= 91) {
            tmp -= 26;
        }
        printf("%c", tmp);
    }
    return 0;
}

Measured memory_bytes: 256
<?php
	$data = explode(" ", trim(fgets(STDIN)));
	$h = $data[0];
	$w = $data[1];
	
	for($i=0; $i<$h; $i++){
	    $a = trim(fgets(STDIN));
	    for($j=0; $j<$w; $j++){
	        if($a[$j] == '#') $b[$i][$j] = true;
	        else $b[$i][$j] = false;
	    }
	    $b[$i][$w] = false;
	}
	for($j=0; $j<$w; $j++) $b[$h][$j] = false;
	
	$f = true;
	$i = 0;
	$j = 0;
	while($f && ($i<$h - 1 || $j<$w - 1)){
	    $tmpi = $i;
	    $tmpj = $j;
	    $f = false;
	    if($b[$i+1][$j] && $b[$i][$j+1]) break;
	    if($b[$i+1][$j]){
	        $tmpi++;
	        $f = true;
	        if($j>0 && $b[$i+1][$j-1]) $f = false;
	    }
	    if($b[$i][$j+1]){
	        $tmpj++;
	        $f = true;
	        if($i>0 && $b[$i-1][$j+1]) $f = false;
	    }
	    $i = $tmpi;
	    $j = $tmpj;
	}
	if($f) echo "Possible";
	else echo "Impossible";
	
?>

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

typedef long double LD;
typedef long long ll;
typedef map<int,int> mii;
typedef pair<int,int> pii;
typedef vector<pii> vpii;

#define pb              push_back
#define mp              make_pair
#define F               first
#define S               second
#define mod             1000000007
#define INF             2147483647
#define endl            "\n"
#define FasterIO        ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0) ;
#define precision(a)    cout << fixed << setprecision(a)
#define bug(a,b)        cout<<a<<"\t"<<b<<"\n";
#define Case(a,b)       cout<<"Case "<<a<<": "<<b<<"\n";
#define reset(a,b)      memset(a,b,sizeof(a));
#define For(x,n)        for(int i=x; i<n; i++)

const int MAXN = 1000005;
const int SQRTN = 1003;
const int LOGN = 22;
const double PI=acos(-1);

int strtoint(string str){
    stringstream ss(str);
    int x = 0;
    ss >> x ;
    return x ;
}
string intostr(int x){
    stringstream ss;
    ss << x;
    string str = ss.str();
    return str;
}
void rem(string &s, const string &c) {
	auto pos = s.find(c);
	if (pos == string::npos) {
		cout << -1 << endl;
		exit(0);
	}
	s.erase(0, pos + 1);
}
void println (int n){
    cout<<n<<"\n";
}
void printvec(vector <int> &a){
    for (int i=0;i<a.size();i++){
        cout<<a[i]<<" ";
    }
    cout<<"\n";
}

void printgraph(vector <int> g[],int e){
    for (int i=0;i<e;i++){
        cout<<i<<" --> ";
        for (int j=0;j<g[i].size();j++){
            cout<<g[i][j]<<" ";
        }
        cout<<"\n";
    }
}

void printmap (map <int,int> &mymap){
    for (auto itr = mymap.begin(); itr != mymap.end(); ++itr) {
        cout << '\t' << itr->first
             << '\t' << itr->second << '\n';
    }
    cout << "\n";
}



void solve(){
    int n;
    cin>>n;
    int v[n+1][3];

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

    int temp[n][3];
    temp[0][0] = v[0][0];
    temp[0][1] = v[0][1];
    temp[0][2] = v[0][2];
    for (int i=1;i<n;i++){

        temp[i][0] = v[i][0] + max(temp[i - 1][1], temp[i - 1][2]);
        temp[i][1] = v[i][1] + max(temp[i - 1][0], temp[i - 1][2]);
        temp[i][2] = v[i][2] + max(temp[i - 1][1], temp[i - 1][0]);


        /*for (int x=0;x<n;x++){
            for (int y=0;y<3;y++){
                cout<<temp[x][y]<<" ";
            }
            cout<<endl;
        }*/



    }


    cout << max({temp[n - 1][0], temp[n - 1][1], temp[n - 1][2]});


}


int main(){
    //FasterIO;

    solve();
    return 0;
}


Measured memory_bytes: 5924
#include<iostream>
using namespace std;
int main(){
    int a,b;
    cin >>a >>b;
    while(a!=0||b!=0){
        int i,j,k;
        int m=0;
        for(i=1;i<=a;i++){
            for(j=i+1;j<=a;j++){
        for(k=j+1;k<=a;k++){
            if(i+j+k==b) m++;
        }
            }
        }
        
    cout << m << endl;
    
    cin >>a >>b;
    }
    return 0;
}


Measured memory_bytes: 3076
#include<stdio.h>
int main(void){
	int score[3];
	int i;
	while(1){
		scanf("%d %d %d",&score[0],&score[1],&score[2]);

		if(score[0] < 0 && score[1] < 0 && score[2] < 0){
			break;
		}
		else if(score[0] < 0 || score[1] < 0){
			printf("F\n");
		}
		else if(score[0] + score[1] >= 80){
			printf("A\n");
		}
		else if(score[0] + score[1]<80 && score[0] + score[1] >= 65){
			printf("B\n");
		}
		else if(score[0] + score[1] < 65 && score[0] + score[1] >= 50){
			printf("C\n");
		}
		else if(score[0] + score[1] < 50 && score[0] + score[1] >= 30){
			if(score[2] >= 50){
				printf("C\n");
			}
			else{
				printf("D\n");
			}
		}
		else{
			printf("F\n");
		}
	}
	return 0;
}

Measured memory_bytes: 584
#include<bits/stdc++.h>
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifndef ONLINE_JUDGE
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
typedef long long ll;
typedef pair<int,int> pie;
const int nax = 1e5+500;
vector<int> vertices[nax];
bool visited[nax];
//vector<int> good(nax);
int ans = 0;
int n, m;
vector<int> h(nax);
void dfs(int u) {
	if(visited[u]) return;
	visited[u] = 1;
	bool isGood = 1;
	for(auto it:vertices[u]) {
		if(h[it] >= h[u]) isGood = 0;
		if(!visited[it]) dfs(it);
	}
	if(isGood) ++ans;
}
int main() {
	cin >> n >> m;
	for(int i=1;i<=n;i++) {
		cin >> h[i];
	}
	for(int i=0;i<m;i++) {
		int u,v;
		cin >> u >> v;
		vertices[u].push_back(v);
		vertices[v].push_back(u);
	}
	for(int i=1;i<=n;i++) {
		if(!visited[i]) {
			dfs(i);
		}
	}
	cout<<ans;
}


Measured memory_bytes: 10492
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val a = sc.nextInt()
  val b = sc.nextInt()
  val c = sc.nextInt()
  val x = sc.nextInt()
  val xs = for {
    a <- (0 to a).toIterator.map(_ * 500)
    b <- (0 to b).toIterator.map(_ * 100)
    c <- (0 to c).toIterator.map(_ * 50)
    xs = List(a, b, c) if xs.sum == x
  } yield {
    xs
  }
  val ret = xs.toList.length
  println(ret)
}


Measured memory_bytes: 42080
#include<bits/stdc++.h>
using namespace std;
int main(){long long n,i,k,j;
cin>>n>>k;
double a[n],s=0,p,r=0,b[n+1]={0};
for(i=0;i<n;i++){
    cin>>p;
    a[i]=(p+1)/2;
}
b[0]=0;b[1]=a[0];for(i=2;i<=n;i++){
    b[i]=a[i-1]+b[i-1];

}for(j=0;j<=n-k;j++){
    s=b[j+k]-b[j];
    if(s>r)
    r=s;
}cout.precision(10);
cout<<fixed<<r;
    return 0;
  
}


Measured memory_bytes: 3328
// #include "pch.h"
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <climits>
#include <string>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <ctime>
#include <cassert>
#include <fstream>
#include <stack>
#include <random>

typedef long long ll;
typedef std::pair<int, int> Pii;
typedef std::pair<long long, long long> Pll;
typedef std::pair<double, double> Pdd;

#define rip(i, n, s) for (int i = (s);i < (int)( n ); i++)
#define all(a) a.begin(), a.end()
#define MM << " " <<

template<typename T>
using MaxHeap = std::priority_queue<T>;
template<typename T>
using MinHeap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template<typename T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template<typename T>
void vdeb(std::vector<T> &da) {
    for (int i = 0;i < da.size();i++) {
        if (i == da.size() - 1) std::cout << da[i];
        else std::cout << da[i] << ' ';
    }
    std::cout << '\n';
}
template<typename T>
void vdeb(std::vector<std::vector<T>> &da) {
    for (int i = 0;i < da.size();i++) {
        std::cout << i << ' ';
        vdeb(da[i]);
    }
    std::cout << '\n';
}

using namespace std;

const ll MOD = 1000000007;

int main() {
    int n; cin >> n;
    vector<ll> dp(n+1);
    dp[0] = 1;
    ll su = 0;
    rip(i,n+1,2) {
        dp[i] = su%MOD;
        su += dp[i-2];
    }
    // vdeb(dp);
    cout << dp[n] << endl;
}

Measured memory_bytes: 3636
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>
#include <set>
#include <map>

#define oo 2000000001
#define MAX_N 200000

using namespace std;

char G[6][7];

int main()
{
    int H, W, K, i, j, mask_rows, mask_cols, choices, black_squares;

    scanf("%d%d%d", &H, &W, &K);
    for(i = 0; i < H; ++i)
        scanf("%s", G[i]);

    choices = 0;
    for(mask_rows = 0; mask_rows < (1 << H); ++mask_rows)
        for(mask_cols = 0; mask_cols < (1 << W); ++mask_cols){
            black_squares = 0;
            for(i = 0; i < H; ++i)
                for(j = 0; j < W; ++j)
                    if((mask_rows & (1 << i)) + (mask_cols & (1 << j)) == 0 && G[i][j] == '#')
                        ++black_squares;
            if(black_squares == K)
                ++choices;
        }

    printf("%d", choices);

    return 0;
}


Measured memory_bytes: 1728
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int a = s.length();
		int z = 0;
		for(int i = 0; i < s.length(); i++) {
			if(s.charAt(i) == 'A') {
				a = Math.min(a, i);
			}
			if(s.charAt(i) == 'Z') {
				z = Math.max(z, i);
			}
		}
		int ans = z - a + 1;
		System.out.println(ans);
	}

}


Measured memory_bytes: 25648
# include<iostream>
using namespace std;
int main()
{	 ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long long int a,b,c,d,l,r;
       cin>>a>>b>>c>>d;
       l=a+b;
       r=c+d;
       if(l==r)
        cout<<"Balanced";
 if(l>r)
        cout<<"Left";
 if(l<r)
        cout<<"Right";
	  return 0;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
field = [list(input()) for i in range(n)]
flg = True
dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]
for i in range(n):
    for j in range(m):
        if field[i][j] == "#":
            f = 0
            for k in range(4):
            # 移動した後の点を (nx, ny) とする
                nx = i + dx[k]
                ny = j + dy[k]
                if 0 <= nx and nx < n and 0 <= ny and ny < m and field[nx][ny] == "#":
                    f += 1
            if f==False:
                flg = False
                
print("Yes" if flg else "No")

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

#define MAX 100

char m[MAX][MAX];
int h, w;
int f(int, int);

int main(void) {
	int cnt;
	while (cin >> h >> w, (h || w)) {
		cnt = 0;
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				cin >> m[i][j];
			}
		}

		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				if (m[i][j] != 'x') {
					cnt++;
					f(i, j);
				}
			}
		}
		cout << cnt << endl;
	}

	return 0;
}

int f(int x, int y) {
	char c = m[x][y];
	m[x][y] = 'x';

	if (x > 0) {
		if(m[x - 1][y] == c) f(x - 1, y);
	}
	if (x < h - 1) {
		if (m[x + 1][y] == c) f(x + 1, y);
	}
	if (y > 0) {
		if (m[x][y - 1] == c) f(x, y - 1);
	}
	if (y < w - 1) {
		if (m[x][y + 1] == c) f(x, y + 1);
	}
	return 0;
}

Measured memory_bytes: 1636
import math


def resolve():
    import sys
    input = sys.stdin.readline
    # row = [int(x) for x in input().rstrip().split(" ")]
    # n = int(input().rstrip())
    nmx = [int(x) for x in input().rstrip().split(" ")]
    x = nmx[2]
    a_list = [int(x) for x in input().rstrip().split(" ")]


    left_cost = sum(1 for a in a_list if a < x)
    right_cost = len(a_list) - left_cost

    ans = left_cost if left_cost < right_cost else right_cost

    print(ans)




if __name__ == "__main__":
    resolve()


Measured memory_bytes: 9008
#include<cstdio>
#include<iostream>
#include<map>
#include<set>
#include<vector>
#include<cstring>
#include<cassert>
#include<sstream>
#include<cmath>
#include<algorithm>
#include<queue>
#include<limits>
#include<ctime>
#include<stack>
#include<bits/stdc++.h>
#include<string>
#include<stdlib.h>
#include<stdio.h>
typedef long long ll;

using namespace std;
bool prima(ll x){
	int count=0;
	for(int i=2;i<=x/2;i++){
		if(x%i==0){
			count++;
		}
	}
	if(x<2){
		return false;
	}
	if(x>=2 and count==0){
		return true;
	}
	if(x>=2 and count>0){
		return false;
	}
}
int main(){
	int n;
	cin>>n;
	int i=n;
	while(!prima(i)){
		i++;
	}
	cout<<i;
}



Measured memory_bytes: 3584