akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#include "random"
#include <unistd.h>

using namespace std;

#define ll long long
#define vi vector<int>
#define vl vector<long long>
#define vvi vector<vi>
#define pi  pair<int,int>
#define mp  make_pair
#define pb  push_back
#define MOD int(1e9) + 7
#define PAI  3.1415926535
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define chmax(x, y) x = max(x,y)
#define chmin(x, y) x = min(x,y)
#define pr(x) cout << x << endl
#define Endl endl
#define rep(i, n) for(int i = 0 ; i < n; ++i)

const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const int ddx[8] = {-1,0,1,-1,1,-1,0,1};
const int ddy[8] = {-1,-1,-1,0,0,1,1,1};
const int inf = 99999999;
const ll linf = 1LL << 62;

ll gcd(ll a,ll b){
  if(a < b)swap(a , b);
  if(a % b != 0) return(gcd(b, a%b));
  return b;
}

ll lcm(ll a,ll b){
  if(a < b)swap(a , b);
  return (a / gcd(a , b)) * b;
}

int Uniform_Random(int a, int b){ // (a <= x <= b)

  random_device rd;
  mt19937 mt(rd());
  
  uniform_int_distribution<int> rv1(a, b);
  return rv1(mt);
  
}
 
int main(){
  
  int n, k;  cin >> n >> k;
  string s; cin >> s;

  s[k - 1] = tolower(s[k - 1]);
  cout << s << endl;

  return 0; 
}






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

int main() {
  int N;
  cin>>N;
  
  int ans=0;
  for(int i=0;i<N;++i){
    for(int j=0;j<N;++j){
      if(4*i+7*j==N){
        ++ans;
      }
    }
  }
  
  if(ans)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;

int main() {
    ll x;
    cin >> x;
    out(1-x);
    re0;
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define fs first
#define fst first
#define sc second
#define snd second
#define sz(X) (int)(X).size()
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define fornr(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define forab(i, a, b) for(int i = int(a); i < int(b); i++)
#define all(X) X.begin(), X.end()

typedef long long ll;

typedef pair<int, int> pii;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef double dbl;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<int> vi;

const ll MOD1 = 1e9 + 7;
const ll MOD2 = 1e9 + 9;
const ll p = 31;
const ll K = 2e9;

vpll sufHashes(string s){
    int n = s.length();
    vpll h(n);
    ll h1 = 0, h2 = 0;
    fornr(i, n){
        ll x = s[i] - 'a' + 1;
        h1 = (h1 * p + x) % MOD1;
        h2 = (h2 * p + x) % MOD2;
        h[i] = {h1, h2};
    }
    h.pb({0, 0});
    return h;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout.precision(20);
    int n;
    cin >> n;
    vector<string> a(n);
    forn(i, n) cin >> a[i];
    vector<vector<pair<ll, ll>>> h;
    unordered_set<ll> hashes;
    vector<vi> pos(n, vi(26, 1e9));
    forn(i, n) {
        forn(j, a[i].length()) {
            int c = a[i][j] - 'a';
            if (pos[i][c] == 1e9) pos[i][c] = j;
        }
    }
    forn(i, n) {
        h.pb(sufHashes(a[i]));
        hashes.insert(h[i][0].fst * K + h[i][0].snd);
    }
    ll ans = 0;
    forn(i, n) {
        int l = a[i].length();
        forab(j, 1, sz(a[i])) {
            l--;
            pair<ll, ll> h0 = h[i][j + 1];
            forn(c, 26) {
                if (pos[i][c] <= j) {
                    pair<ll, ll> H = {(h0.fst * p + c + 1) % MOD1, (h0.snd * p + c + 1) % MOD2};
                    if (hashes.count(H.fst * K + H.snd)) {
                        ans++;
                    }
                }
            }
        }
    }
    cout << ans << '\n';
    return 0;
}

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

int main() {
    string S; cin >> S;

    if (S == "Sunny") {
        cout << "Cloudy" << endl;
    }
    else if (S == "Cloudy") {
        cout << "Rainy" << endl;
    }
    else if (S == "Rainy") {
        cout << "Sunny" << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char a[100][100];
int h,w;
int ok(int x,int y)
{
    if(x>=0&&x<h&&y>=0&&y<w&&a[x][y]=='#')
        return 1;
    return 0;
}
int main()
{
    while(cin>>h>>w)
    {
        int flag=1;
        for(int i=0;i<h;i++)
            for(int j=0;j<w;j++)
            cin>>a[i][j];
        for(int i=0;i<h;i++)
            for(int j=0;j<w;j++)
            if(a[i][j]=='#')
            {
                if(!ok(i-1,j)&&!ok(i+1,j)&&!ok(i,j-1)&&!ok(i,j+1))
                    flag=0;
            }
        if(flag)
            cout<<"Yes\n";
        else
            cout<<"No\n";
    }
    return 0;
}


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

int main(){
  int N;
  string str;
  cin >> N >> str;
  int count = 0, ans = 0;
  for(int i = 0; i < str.size(); i++){
    if(str.at(i) == 'I'){
      count++;
    }
    else{
      count--;
    }
    ans = max(count,ans);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
N = int(input())
s = input()
#print(s)
d = ['S','W']
for i in d:
    for j in d:
        ans = [i,j]
        for k in range(2,N):
            if s[k-1] == 'o':
                if ans[-1] == ans[-2]:
                    ans.append('S')
                else:
                    ans.append('W')
            else:
                if ans[-1] == ans[-2]:
                    ans.append('W')
                else:
                    ans.append('S')

        #print(ans)
        if s[0] == 'o':
            if ans[0] == ans[1]:
                val1 = 'S'
            else:
                val1 = 'W'
        else:
            if ans[0] == ans[1]:
                val1 = 'W'
            else:
                val1 = 'S'
        if s[-1] == 'o':
            if ans[-1] == ans[-2]:
                val2 = 'S'
            else:
                val2 = 'W'
        else:
            if ans[-2] == ans[-1]:
                val2 = 'W'
            else:
                val2 = 'S'
        if val1 == ans[-1] and val2 == ans[0]:
            print(''.join(ans))
            exit()



print(-1)


Measured memory_bytes: 93348
s=input()
if (s.count('E')>0 and s.count('W')>0 and s.count('N')>0 and s.count('S')>0):
    print('Yes')
elif ((s.count('E')==0 and s.count('W')==0)) and ((s.count('N')>0 and s.count('S')>0)):
    print('Yes')
elif ((s.count('N')==0 and s.count('S')==0)) and ((s.count('E')>0 and s.count('W')>0)):
    print('Yes')
elif (s.count('E')==0 and s.count('W')==0 and s.count('N')==0 and s.count('S')==0):
    print('Yes')
else:
    print('No')

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

#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, a, b) for (int i = (int)(a); i >= (int)b; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define rep(i, l, r) for (int i = (l); i <= (r); i++)
#define per(i, r, l) for (int i = (r); i >= (l); i--)
#define ms(x, y) memset(x, y, sizeof(x))
#define SZ(x) ((int)(x).size())

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

i64 n, k;

i64 myabs(i64 a) {return (a>0?a:-a);}

int main() {
	ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(10);
    cout << fixed;
#ifdef LOCAL_DEFINE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

	cin >> n >> k;
	n %= k;
	while (2*n >= k) {
		if (2*n == k || n == 2*k) break;
		n = myabs(n-k);
	}
	cout << n << '\n';

#ifdef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main()
{
	int n, m;
	char a[60][60];
	std::cin >> n >> m;
	
	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < m; ++j)
		{
			std::cin >> a[i][j];
		}
	}
	
	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < m; ++j)
		{
			if (a[i][j] != '#')
			{
				int count = 0;
				
				if (i + 1 < n)
				{
					if (a[i + 1][j] == '#')
						++count;
				}
				if (i - 1 >= 0)
				{
					if (a[i - 1][j] == '#')
						++count;
				}
				if (j + 1 < m)
				{
					if (a[i][j + 1] == '#')
						++count;
				}
				if (j - 1 >= 0)
				{
					if (a[i][j - 1] == '#')
						++count;
				}
				if (i + 1 < n && j + 1 < m)
				{
					if (a[i + 1][j + 1] == '#')
						++count;
				}
				if (i + 1 < n && j - 1 >= 0)
				{
					if (a[i + 1][j - 1] == '#')
						++count;
				}
				if (i - 1 >= 0 && j + 1 < m)
				{
					if (a[i - 1][j + 1] == '#')
						++count;
				}
				if (i - 1 >= 0 && j - 1 >= 0)
				{
					if (a[i - 1][j - 1] == '#')
						++count;
				}
				
				a[i][j] = count + '0';
			}
		}
	}
	
	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < m; ++j)
		{
			std::cout << a[i][j];
		}
		
		std::cout << "\n";
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int MAX_N=1010,X=(int)1e9+10;
int N,Min,Max; string x;
int a[MAX_N];

void solve(){
    for (int i=0;i<N;++i){
        if (a[i]==X){
            if (i&&a[i-1]==X){
                cout << "none" << '\n';
                return;
            }
            continue;
        }
        if (i&1){
            if (i&&a[i-1]!=X&&a[i]<=a[i-1]){
                cout << "none" << '\n';
                return;
            }
            if (i<N-1&&a[i+1]!=X&&a[i]<=a[i+1]){
                cout << "none" << '\n';
                return;
            }
        } else {
            if (i&&a[i-1]!=X&&a[i-1]<=a[i]){
                cout << "none" << '\n';
                return;
            }
            if (i<N-1&&a[i+1]!=X&&a[i+1]<=a[i]){
                cout << "none" << '\n';
                return;
            }
        }
    }
    Min=-X,Max=X;
    for (int i=0;i<N;++i) if (a[i]==X){
        if (i&1){
            Min=max(Min,a[i-1]);
            if (i<N-1) Min=max(Min,a[i+1]);
        } else {
            if (i) Max=min(Max,a[i-1]);
            if (i<N-1) Max=min(Max,a[i+1]);
        }
    }
    if (Max-Min==2) cout << Min+1 << '\n';
    if (2<Max-Min) cout << "ambiguous" << '\n';
    if (Max-Min<2) cout << "none" << '\n';
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(cin >> N,N){
        for (int i=0;i<N;++i){
            cin >> x;
            a[i]=(x=="x"?X:stoi(x));
        }
        solve();
    }
}


Measured memory_bytes: 3108
#include<bits/stdc++.h>							
typedef long long ll;
#define pb push_back
#define mod 1000000007ll
const ll maxn = 9e18;
using namespace std;
const ll maxsize = 100000009;



void solve() {
	string s;
	cin >> s;
	int n = s.length();
	string t(n,'x');
	cout << t << endl;
}


int main() {
	ios_base :: sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cout.precision(35);
	int t;
	solve();
	return 0;
}
 
 
 


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

int main(){
	int n,l;
	cin >> n >> l;
	vector<string> s(n);
	rep(i,n){
		cin >> s[i];
	}
	sort(s.begin(),s.end());
	string ans = "";
	rep(i,n){
		ans += s[i];
	}
	cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<P> vp;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define sz size()
#define endl "\n"
#define print(X) cout << (X) << "\n"
// // #define input(X) getline(cin,X)
static const int INF = 1e+9+7;
static const ll INFL = 1e+18+7;
ll n,m,l;
string s,t;
ll d[200010],e[200010],dp[1001][1001];
char field[200][200];

int main(){
  ll ans = 0;
  cin >> n >> m;
  rep(i,0,n)cin >> d[i];
  rep(i,0,n){
    ll ans1 = 0, ans2 = 0;
    if(d[i] > m){
      ans1 = d[i] - m;
      d[i] -= ans1;
    }
    if(d[i]+d[i+1] > m){
      ans2 = d[i] + d[i+1] - m;
      d[i+1] -= ans2;
    }
    ans += ans1 + ans2;
  }
  print(ans);
  return 0;
}

Measured memory_bytes: 2304
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE']
require 'prime'

def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def sum(a) a.inject(:+) end

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

def small(a,b) return (a<b)? a:b end

x,y = inp
if(y&1 == 0)
  if(y >= x*2 and y <= x*4)
    puts "Yes"
  else
    puts "No"
  end
else
  puts "No"
end

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

int main(){
    int n;
    cin >> n;
    if (n<105)
        cout << 0;

        else if (n>=105&&n<135)
            cout << 1;
            else if(n >=135&&n<165)
                cout << 2;
                else if(n>=165&&n<189)
                    cout << 3;
                    else if(n>=189&&n<195)
                        cout << 4;
                        else
                            cout << 5;
}

Measured memory_bytes: 256
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
	mod = 10^9+7
	n = readline() |> parseInt
	a = readline() |> split |> parseMap
	ct = zeros(Int,60)
	ans = zeros(Int,60)
	for i in 1:n
		for r in 0:59
			if (a[i]>>r)%2 == 0
				ans[60-r] += ct[60-r]
			else
				ans[60-r] += i-1-ct[60-r]
			end
			if (a[i]>>r)%2 == 1
				ct[60-r] += 1
			end
		end
	end
	s = 0
	for r in 0:59
		tmp = ans[60-r]
		for iter in 1:r
			tmp = (tmp*2)%mod
		end
		s = (s+tmp)%mod
	end
	println(s)
end

main()



Measured memory_bytes: 176272
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <map>
#include <algorithm>
#include <stdio.h>

int main(void){
  int n,ac,wa,tle,re;
  std::cin >> n;
  std::vector<std::string> s(n);
  for(int i=0;i<n;i++){
    std::cin >> s[i];
  }

  ac=std::count(s.begin(), s.end(), "AC");
  wa=std::count(s.begin(), s.end(), "WA");
  tle=std::count(s.begin(), s.end(), "TLE");
  re=std::count(s.begin(), s.end(), "RE");

  std::cout << "AC x " << ac << std::endl;
  std::cout << "WA x " << wa << std::endl;
  std::cout << "TLE x " << tle << std::endl;
  std::cout << "RE x " << re << std::endl;

  return 0;
}

Measured memory_bytes: 6424
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author anand.oza
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CCandles solver = new CCandles();
        solver.solve(1, in, out);
        out.close();
    }

    static class CCandles {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt(), k = in.nextInt();

            int[] x = new int[n];
            for (int i = 0; i < n; i++) {
                x[i] = in.nextInt();
            }

            int answer = Integer.MAX_VALUE;

            for (int i = 0; i + k - 1 < n; i++) {
                int j = i + k - 1;
                int a = x[i], b = x[j];
                int cost;
                if (a > 0 && b < 0 || a < 0 && b > 0) {
                    cost = Math.abs(a) + Math.abs(b) + Math.min(Math.abs(a), Math.abs(b));
                } else {
                    cost = Math.max(Math.abs(a), Math.abs(b));
                }

                answer = Math.min(answer, cost);
            }

            out.println(answer);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

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

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

    }
}



Measured memory_bytes: 35124
#include <bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#define FPEN freopen("in.txt", "r", stdin);
#define TEST(...)                                                              \
    { printf("! "), printf(__VA_ARGS__); }
#else
#define TEST(...)
#define FPEN
#endif
const int maxn = 200009;
typedef long long i64;
typedef pair<i64, i64> pi64;
typedef pair<int, int> pi;
const i64 MOD = 119 << 23 | 1;
class {
  public:
    int d[100][11], s[100];
    i64 ans;
    void dfs(int u, int v, int k) {
        if (u == -1)
            return;
        if (v - 1 >= 0) {
            if (d[u][v - 1] < k) {
                k -= d[u][v - 1];
            } else {
                ans = ans * 10 + v - 1;
                dfs(u - 1, v - 1, k);
                return;
            }
        }
        if (d[u][v] < k)
            k -= d[u][v];
        else {
            ans = ans * 10 + v;
            dfs(u - 1, v, k);
            return;
        }
        ans = ans * 10 + v + 1;
        dfs(u - 1, v + 1, k);
    }
    void solve() {
        for (int i = 0; i <= 9; ++i)
            d[0][i] = 1;
        s[0] = 9;
        for (int i = 1; i <= 99; ++i) {
            for (int j = 0; j <= 9; ++j) {
                d[i][j] = d[i - 1][j];
                if (j - 1 >= 0)
                    d[i][j] += d[i - 1][j - 1];
                if (j + 1 <= 9)
                    d[i][j] += d[i - 1][j + 1];
                if (j != 0)
                    s[i] += d[i][j];
            }
        }
        int k;
        cin >> k;
        for (int i = 0; i < 100; ++i) {
            if (s[i] >= k) {
                for (int j = 1; j <= 9; ++j) {
                    if (d[i][j] < k) {
                        k -= d[i][j];
                    } else {
                        ans = j;
                        dfs(i - 1, j, k);
                        break;
                    }
                }
                break;
            } else {
                k -= s[i];
            }
        }
        cout << ans << "\n";
    }
} NSPACE;
int main() {
    FPEN;
    ios_base::sync_with_stdio(false);
    cout.tie(0);
    cin.tie(0);
    NSPACE.solve();
}

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

  for(i = 0;;i++){
    scanf("%d%d",&h,&w);
    
    if(h==0 && w==0)break;
    
    for(j = 0;j < h;j++){
      for(k = 0;k < w;k++){
	if((j + k) % 2 == 0)
	  printf("#");
	else
	  printf(".");
      }
      printf("\n");
    }
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 572
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll arr[120];
ll nCr(ll n, ll r)
{
    ll C[r+1];
    memset(C, 0, sizeof(C));
    C[0] = 1;
    for (ll i = 1; i <= n; i++)
    {
        for (ll j = min(i, r); j > 0; j--)
            C[j] = (C[j] + C[j-1]);

    }
    return C[r];
}

bool cmp(pair<long double,ll>&l,pair<long double,ll> &r)
{
    if(l.first<r.first)
        return 1;
    if(l.first>r.first)
        return 0;
    if(l.second<r.second)
        return 1;
    return 0;
}



ll ans2 = 0,tmp=0,ave= 0;
ll COM(ll n, ll k){
    ll num=1;
    for(int i=0;i<k;i++) {
        num *= n-i;
        num /= (1+i);
    }
    return num;
}
vector<ll>V;
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    long double sum=0,cnt=0;
    vector<pair<long double,ll> >ans;
    ll n,a,b;
    cin>>n>>a>>b;
    for(int i=0; i<n; i++)
        {cin>>arr[i];
        V.push_back(arr[i]);
        }
    sort(arr,arr+n);
    for(int i=n-1; i>=0; i--)
    {
        sum+=arr[i];
        cnt++;
        if(cnt>b)
            break;
        if(cnt>=a)
        {
            int t=0;
            for(int j=i-1; j>=0; j--)
            {
                if(arr[i]==arr[j])
                    t++;
            }
            int t2=0;
            for(int j=i; j<n; j++)
            {
                if(arr[i]==arr[j])
                    t2++;
            }
            ans.push_back({sum/cnt,nCr(t2+t,t2)});

        }
    }

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


     ll id1 = lower_bound(V.begin(), V.end(), V[n-a])-V.begin();
    if(id1!=n-a) {
        ll id2 = lower_bound(V.begin(), V.end(), V[n-a]+1)-V.begin();
        ans2 += COM(id2-id1, id2-(n-a));
        //cout << id2-id1 << " " << id2-(N-A) << " " << COM(id2-id1, id2-(N-A)) << endl;
        if(V[n-a]==V[n-1]) {
            for(int i=n-a-1;i>=max(n-b, id1);i--) {
                tmp = COM(id2-id1, id2-i);
                //if(tmp<0) tmp += MOD;
                ans2 += tmp;
                //cout << id2-id1 << " " << id2-i << " " << tmp << endl;
            }
        }
    }





   





    sort(ans.begin(),ans.end(),cmp);
    int sz=ans.size();
    cout<<setprecision(6)<<fixed<<ans[sz-1].first<<endl;
    //cout<<ans[sz-1].second<<endl;
    cout << setprecision(18) << max(1LL, ans2) << endl;
    return 0;
}



Measured memory_bytes: 3804
#pragma GCC optimize("O2")

#include <bits/stdc++.h>
#ifdef DEBUG
    #include "debug.hpp"
#endif

using namespace std;

#define all(c) (c).begin(), (c).end()
#define traverse(c, it) for(auto it = (c).begin(); it != (c).end(); it++)
#define rep(i, N) for(int i = 0; i < (N); i++)
#define rep1(i, N) for(int i = 1; i <= (N); i++)
#define rep2(i, s, e) for(int i = (s); i <= (e); i++)
#define rep3(i, s, e, d) for(int i = (s); (d) >= 0 ? i <= (e) : i >= (e); i += (d))
#define pb push_back


#ifdef DEBUG
    #define debug(x...) {dbg::depth++; string dbg_vals = dbg::to_string(x); dbg::depth--; dbg::fprint(__func__, __LINE__, #x, dbg_vals);}
    #define light_debug(x) {dbg::light = 1; dbg::dout << __func__ << ":" << __LINE__ << "  " << #x << " = " << x << endl; dbg::light = 0;}
#else
    #define debug(x...)
    #define light_debug(x) 
#endif

template<typename T>
T& ckmin(T& a, T b){ return a = a > b ? b : a; }

template<typename T>
T& ckmax(T& a, T b){ return a = a < b ? b : a; }

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

namespace ioUtils {

    char vector_delimiter = ' ';

    template<typename T>
    istream& operator >>(istream&, vector<T>&);

    template<typename... Ts>
    istream& operator >>(istream& is, pair<Ts...>& p){
        is >> p.first >> p.second;
        return is;
    }

    template<typename T> 
    istream& operator >>(istream& is, vector<T>& v){
        for(auto& e : v) is >> e;
	       return is;
    }

    template<typename T>
    ostream& operator <<(ostream&, vector<T>&);

    template<typename... Ts>
    ostream& operator <<(ostream& os, pair<Ts...>& p){
        os << p.first << " " << p.second;
        return os;
    }

    template<typename T>
    ostream& operator <<(ostream& os, vector<T>& v){
        for(auto&& e : v) os << e << vector_delimiter;
        return os;   
    }   
}

using namespace ioUtils;

signed main(){

    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    #ifdef DEBUG
        freopen("debug", "w", stderr);
    #endif
    int N, K;
    cin >> N >> K; 
    vi a(N);
    cin >> a;

    vector<bool> dp(K + 1);

    rep(i, a[0]) dp[i] = 0;

    rep2(i, a[0], K)
    	for(int x : a)
    			dp[i] = dp[i] || ((x <= i) && !dp[i - x]);

    cout << (dp[K] ? "First" : "Second") << '\n';

    #ifdef DEBUG
        dbg::dout << "\nExecution time: " << clock() << "ms\n";
    #endif

    return 0;
}


Measured memory_bytes: 3588
#include<queue>
#include<cstdio>
#include<cstring>
#include<string>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long LL;
int read()
{
	int s=0,c=getchar(),f=1;
	while(c<48||c>57)
	{
		if(c==45) f=-1;
		c=getchar();
	}
	while(c>=48&&c<=57) s=(s<<3)+(s<<1)+(c^48),c=getchar();
	return s*f;
}
void write(int x)
{
	if(x>=10) write(x/10);
	putchar(x%10+48);
}
void W(int x)
{
	if(x<0) x=-x,putchar(45);
	write(x);
}
int ans[1111],A[1111];
bool vis[1111];
int main()
{
	int N=read();
	bool OK=false;
	for(int i=1;i<=N;++i)
	{
		A[i]=read();
		if(A[i]>i) OK=true;
	}
	if(OK)
	{
		puts("-1");
		return 0;
	}
	for(int i=N;i;--i)
	{
		int lll=i;
		for(int j=N;j;--j)if(!vis[j])
		{
			if(A[j]==lll)
			{
				vis[j]=true;
				break;
			}
			else --lll;
		}
		ans[i]=lll;
	}
	for(int i=1;i<=N;++i) write(ans[i]),puts("");
	return 0;
}

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

const int MOD =1000000007;
ll inv[200005];

void inv_init(){
    inv[1]=1LL;
    for(int i=2; i<=BMAX; i++){
        inv[i] = MOD - (MOD/i) * inv[MOD%i] % MOD;
    }
    return;
}

ll combi(ll n, ll a){
    if(n<a)return 0LL;
    if(n<0 || a<0)return 0LL;
    
    ll rtn = 1;
    for(int i=0; i<a; i++){
        rtn *= n-i;
        rtn %= MOD;
        rtn *= inv[i+1];
        rtn %= MOD;
    }
    return rtn;
}

ll powmod(ll a, ll n, ll mod = MOD) {
    ll rtn = 1;
    while (n > 0) {
        if (n & 1) rtn = rtn * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return rtn;
}


int main(){
    ll n,a,b;
    cin>>n>>a>>b;
    inv_init();
    
    ll ans = powmod(2,n,MOD);
    ans += MOD - combi(n,a);
    ans += MOD - combi(n,b);
    ans += MOD - 1;
    ans %= MOD;
    
    cout << ans << endl;
}

Measured memory_bytes: 5152
/*
 * Segment Tree
 * Construction: O(n)
 * Update:       O(log n)
 * Query:        O(log n)
 */

#include <functional>
#include <iostream>
#include <vector>
#include <climits>
using namespace std;

class SegmentTree {
    const int n; // array size
    const int M; // initial value

    int (*f)(int, int); // operation

public:
    vector<int> t; // tree

    SegmentTree(int n, int M, int (*f)(int, int)) : n(n), M(M), f(f), t(2 * n, M) {}

    void build() { // build the tree
        for (int i = n - 1; i > 0; --i)
            t[i] = f(t[i << 1], t[i << 1 | 1]);
    }

    void update(int k, int val) { // set val at k th
        k += n;
        for (t[k] = val; k > 1; k >>= 1)
            t[k >> 1] = f(t[k], t[k ^ 1]);
    }

    int query(int l, int r) { // query on interval [l, r)
        int res = M;
        for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
            if (l & 1) res = f(res, t[l++]);
            if (r & 1) res = f(res, t[--r]);
        }
        return res;
    }
};

void rmq() {
    int n, q;
    cin >> n >> q;
    SegmentTree T(n, INT_MAX, [](int a, int b) { return min(a, b); });
    T.build();

    while (q--) {
        int com, x, y;
        cin >> com >> x >> y;
        if (com)
            cout << T.query(x, y + 1) << endl;
        else
            T.update(x, y);
    }
}

void rsq() {
    int n, q;
    cin >> n >> q;
    SegmentTree T(n, 0, [](int a, int b) { return a + b; });
    T.build();

    while (q--) {
        int com, x, y;
        cin >> com >> x >> y;
        if (com) cout << T.query(x, y + 1) << endl;
        else T.update(x, T.t[x + n] + y);
    }
}

int main() {
    rmq();
    //rsq();
}



Measured memory_bytes: 3560
n,k,q=list(map(int,input().split()))
a=[int(input()) for _ in range(q)]
c=q-k
if c<0:
    for _ in range(n):
        print("Yes")

    exit()
cal=[0 for _ in range(n)]
for i in a:
    cal[i-1]+=1
for i in range(n):
    if cal[i]>c:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 8640
#include <bits/stdc++.h>
using namespace std;
int gcd(long long a, long long b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);  
      
} 

long long	lcm( long long	a, long long	b ){
    return a / gcd(a, b)*b;
}


int main() {
    long long A, B, C, D;
    
    long long count = 0;
    cin >> A >> B >> C >> D;

    count = B/C - (A-1) / C;
    count += B/D- (A-1) / D;
    count -= B / lcm(D, C) - (A - 1) / lcm(D, C);
    cout << B - A + 1 - count << endl;

    // LONG Problem
}

Measured memory_bytes: 256
#include<stdio.h>

int selectionSort(int A[],int N){
	int i, j, t, sw = 0, minj;
	for(i = 0; i < N - 1; i++){
		minj = i;
		for( j = i; j < N; j++){
			if(A[j] < A[minj]) minj = j;
		}
		t = A[i]; A[i] = A[minj]; A[minj] = t;
		if( i != minj) sw++;
	}
	return sw;
}

int main(){
	int A[100], N, i, sw;
	scanf("%d",&N);
	for(i = 0; i < N; i++) scanf("%d",&A[i]);
	sw = selectionSort(A,N);
	for( i = 0;i < N;i++){
		if( i > 0) printf(" ");
		printf("%d",A[i]);
	}
	printf("\n");
	printf("%d\n",sw);
	return 0;
}


Measured memory_bytes: 2112
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn=1e5+5;
const int mod=1e9+7;


int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll x;
	cin>>x;
	ll sum=100;
	ll cnt=0;
	while(sum<x)
    {
        sum+=1ll*sum*0.01;
        cnt++;
    }
    cout<<cnt<<'\n';

}


Measured memory_bytes: 3652
#include<stdio.h>
#include<math.h>

int main()
{
	int g;/*入力*/
	int i,j,count,rui[10],use[10]={0};/*2の累乗,使用したか否か*/

	for(i=0;i<10;i++)
		rui[i]=(int)pow(2.0,i);

	while(scanf("%d",&g) != EOF)
	{
		if(g>1023)
			continue;
		for(i=0;i<10;i++)
			use[i]=0;
		j=0;
		count =0;
		
		do
		{
			if(g>rui[9])
			{
				g-=rui[9];
				++use[9];
				j++;
			}
			for(i=1;i<10;i++)
			{
				if(g<rui[i])
				{
					g-=rui[i-1];
					++use[i-1];
					j++;
					break;
				}
			}
		}while(g);

		for(i=0;i<10;i++)
		{
			if(use[i])
			{
				count++;
				if(j==count)
				{
					printf("%d\n",rui[i]);
					break;
				}
				else
				{
					printf("%d ",rui[i]);
				}
			}
		}
	}
	
	return 0;
}

Measured memory_bytes: 636
def comb_mod(n,m,mod):
  p = q = 1
  for i in range(m):
    p = p*(n-i) % mod
    q = q*(i+1) % mod
  return p* pow(q,mod-2,mod) % mod

n,a,b = map(int,input().split())
mod = 10**9 +7
print( (pow(2,n,mod)-1 -comb_mod(n,a,mod) -comb_mod(n,b,mod) ) % mod )


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <string>
#include <math.h>
#include <map>
#include <numeric>
#include <stack>
#include <queue>
#include <functional>
#include <stdio.h>
#include <queue>
#define ll long long
#define pl pair<ll,ll>
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vvvl vector<vector<vector<ll> > >
#define vd vector<double>
#define vvd vector<vector<double> >
#define vvvd vector<vector<vector<double> > >
#define vb vector<bool>
#define vvb vector<vector<bool> >
#define vvvb vector<vector<vector<bool> > >
#define rep(i,a) for(ll i = 0;i<a;++i)
#define rep1(i,a) for(ll i = 1;i<a;++i)
#define rrep(i,a) for(ll i = a;i>=0;--i)
#define mod 1000000007
#define inf 10010010010
using namespace std;

//O(logB)
ll mpow(ll a, ll b, ll m){
	if (!b) return 1 % m;
	if (b == 1) return a % m;
	if (b % 2) return (a*mpow(a, b - 1, m)) % m;
	else return mpow((a*a) % m, b / 2, m) % m;
}

bool isKaibun(string s,ll l,ll r){
    for(ll i=l;i<=r;++i){
        if(s[i] != s[r-(i-l)]) return false;
    }
    return true;
}

int main(){
    ll n;
    cin>>n;
    vl a(n);
    rep(i,n) cin>>a[i];
    map<ll,ll> count;
    rep(i,n) count[a[i]]++;
    ll ans = 0;
    for(pair<ll,ll> ngo:count){
        if(ngo.second >= 2){
            ans += (ngo.second*(ngo.second-1))/2;
        }
    }
    rep(i,n){
        cout<<ans-count[a[i]]+1<<endl;
    }
    return 0;
}


Measured memory_bytes: 11008
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt(); 
    double K = sc.nextInt();
    double tmpK = K;
    double sum = 0;
    for(double i = 1 ; i < N + 1; i++){
      int count = 0;
      while(K>i){
        K = K/2;
        count++;
        // System.out.println(K);    
      }
      // System.out.println("count::"+count); 
      // System.out.println(Math.pow(0.5,count)); 
      sum = sum  + (1 / (double)N) * Math.pow(0.5,count);
      // System.out.println(sum); 
      K = tmpK;
      count = 0;
      
    }
    System.out.println(sum);    
  
  }
}




Measured memory_bytes: 21460
from itertools import product

class DP:
    def __init__(self, value, variety, coins):
        self.value = value
        self.variety = variety
        self.coins = coins
        self.DP = [[0 for _ in range(value + 1)] for _ in range(variety)]
        self.DPinit()

    def DPinit(self):
        for row in self.DP:
            row[1] = 1
        self.DP[0] = [i for i in range(self.value + 1)]

    def DPcomp(self):
        for (m, n) in product(list(range(1, self.variety)),list(range(self.value + 1))):
                self.DP[m][n] = self.numberOfCoin(m, n)

    def numberOfCoin(self, m, n):
        if n >= self.coins[m]:
            return min(self.DP[m - 1][n], self.DP[m][n - self.coins[m]] + 1)
        else:
            return self.DP[m - 1][n]

    def answer(self):
        self.DPcomp()
        return self.DP[self.variety - 1][self.value]


if __name__ == "__main__":
    status = list(map(int,input().split()))
    coins = list(map(int,input().split()))
    dp = DP(status[0],status[1],coins)
    print(dp.answer())

Measured memory_bytes: 47252
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vvi vector<vi>
#define vvl vector<vl>
#define pii pair<int, int>
#define pli pair<ll, int>
#define pb push_back

#define mp make_pair
#define all(a) (a).begin(),(a).end()

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

ll gcd(ll a, ll b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}

ll keta(ll n){
  string s = to_string(n);
  ll num = s.size();
  return num;
}

const ll INF = 1LL << 60;

const int dh[4] = {1,0,-1,0};
const int dw[4] = {0,1,0,-1};

struct Edge{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w){}
};
using Graph = vector<vector<Edge>>;
using P = pair<ll, int>;

int main(){
  int n; ll k; cin >> n >> k;
  vl a(n);
  rep(i,n){
    cin >> a[i];
    a[i]--;
  }
  vl s(n+1); rep(i,n) s[i+1] = (s[i] + a[i])%k;

  map<ll,int> C;
  queue<int> q;
  ll ans = 0LL;
  rep(i,n+1) {
    ans += C[s[i]];
    C[s[i]]++;
    q.push(s[i]);
    // 長さが k 以上隔てたペアはカウントしないようにする
    if(q.size() == k){
      C[q.front()]--;
      q.pop();
    }
  }

  cout << ans << endl;
}


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

using namespace std;

int binarySearch(vector<long long int> &v, long long int key);
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  vector<long long int> as(n+1, 0), bs(m+1, 0);
  long long int asum = 0, bsum = 0;

  for (int i = 1; i <= n; ++i) {
    int a;
    cin >> a;
    asum += a;
    as[i] = asum;
  }
  for (int i = 1; i <= m; ++i) {
    int b;
    cin >> b;
    bsum += b;
    bs[i] = bsum;
  }

  int ans = 0;
  for (int i = 0; i <= n; ++i) {
    long long int krem = k - as[i];
    if (krem < 0) continue;

    int j = binarySearch(bs, krem);
    if (ans < i+j) {
      ans = i+j;
    }
  }

  cout << ans << endl;

  return 0;
}

int binarySearch(vector<long long int> &v, long long int key) {
  int left = 0, right = v.size();
  while (left < right - 1) {
    int center = (left + right) / 2;
    if (v[center] > key) {
      right = center;
    } else {
      left = center;
    }
  }
  return left;
}

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

int main() {
  int x;
  cin >> x;
  int ans = 0;
  if(400 <= x && x <= 599) ans = 8;
  else if(600 <= x && x <= 799) ans = 7;
  else if(800 <= x && x <= 999) ans = 6;
  else if(1000 <= x && x <= 1199) ans = 5;
  else if(1200 <= x && x <= 1399) ans = 4;
  else if(1400 <= x && x <= 1599) ans = 3;
  else if(1600 <= x && x <= 1799) ans = 2;
  else if(1800 <= x && x <= 1999) ans = 1;
  
  cout << ans << endl;
  return 0;
}

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

using namespace std;
using ll = long long;
int n, m, v, p;
const int maxn = 1e5+7;
vector<ll>a;
ll pre[maxn];
int main()
{
	ios::sync_with_stdio(false);cin.tie(0);
	cin >> n >> m >> v >> p;
	a.resize(n);
	for(auto &u:a){
		cin >> u;
	}
	sort(a.begin(), a.end(), [&](int a, int b){
		return a > b;
	});
	for(int i=0; i<n; ++i){
		pre[i+1] = pre[i]+a[i];
	}
	ll ans = p;
	for(int i=p; i<n; ++i){
		if(a[i]+m<a[p-1])break;
		ll cur = v-(n-(i-p+1));
		if(cur<=0){
			ans ++;
			continue;
		}
		if(cur*m<=(i-p+1)*(a[i]+m)-(pre[i]-pre[p-1]))ans++;
	}
	cout << ans; 
} 

Measured memory_bytes: 1792
import java.util.*;

public class Main {

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

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

        if (a <= b * c) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }



        sc.close();

        }

    }



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

int abs(int a, int b) {
  if (a >= b) return a - b;
  else return b - a;
}

ll dp[2][100005];

int main() {
  int n, w;
  cin >> n >> w;
  rep(i, w+1) dp[0][i] == 0;
  int wi; ll vi;
  rep(i, n) {
    cin >> wi >> vi;
    rep(j, w+1) {
      if (j < wi) dp[1][j] = dp[0][j];
      else dp[1][j] = max(dp[0][j-wi] + vi, dp[0][j]);
    }
    rep(j, w+1) dp[0][j] = dp[1][j];
  }
  ll max = 0;
  rep(i, w) if (dp[1][i+1] > max) max = dp[1][i+1];
  cout << max << endl;
}


Measured memory_bytes: 1792
import java.util.*;

public class Main {
	public static void main(String[] orgs) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long L[] = new long[N+1];
		L[0] = 2;
		L[1] = 1;
		for(int i = 2; i <= N; i++){
			L[i] = L[i-1] + L[i-2];
		}
		System.out.println(L[N]);
	}
}
	


Measured memory_bytes: 23764
// Mahesh Sharma
// Beauty is in the struggle!
#include<bits/stdc++.h>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cctype>
#include <cstring>
#include <memory.h>
#include <cassert>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>

using namespace std;
// using namespace __gnu_pbds;

#define ford(i, a, b, c)        for(int i=(a); i<(b); i+=(c))
#define fori(i, a, b)           ford(i,a,b,1)
#define rep(i, n)               fori(i,0,n)
#define ifor(i, a, b)           for(int i=(a); i>=(b); i--)
#define si(x)                   ((int)x.size())
#define SS                      ({int x;scanf("%d",&x);x;})
#define pb                      push_back
#define mp                      make_pair
#define all(a)                  a.begin(),a.end()
#define inf                     (int)1e9
#define linf                    (long long)1e18
#define V                       vector
#define S                       string
#define XX                      first
#define YY                      second
#define PVI(v)                  rep(i, si(v)) cout<<v[i]<<" "; puts("")
#define PPI(p)                  cout<<"("<<p.first<<", "<<p.second<<")\n"
#define PVPI(v)                 rep(i, si(v)) cout<<"("<<v[i].first<<", "<<v[i].second<<")"<<(i==si(v)-1?"":", ");puts("")
#define PA(arr1, arr2)          for(auto it = arr1; it != arr2; it++) cout<<*it<<" "; puts("");

typedef V<int> vi;
typedef V<S> vs;
typedef long long ll;
typedef pair<int,int> pii;
const int MOD7 = 1000000000+7;
const int MOD9 = 1000000000+9;
/* ################### Program Body starts here ################ */

int a[200000];

ll ff(ll h) {
    return h==1?1:(1+2*ff(h/2));
}
int main() {
    ll h;
    cin>>h;
    cout<<ff(h)<<"\n";
}


Measured memory_bytes: 256
n, a, b = map(int, input().split())

if abs(a - b) % 2 == 0:
    ans = abs(a - b) // 2
else:
    if a <= n - b:
        ans = a-1 + (b - a) // 2 + 1
    else:
        ans = n-b + (b-a) // 2 +1
print(ans)


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

int main()
{
	int64_t n, k, r, s, p;
	string t;
	cin >> n >> k >> r >> s >> p >> t;

	vector<string> puni(k);
	for (int64_t i = 0; i < n; i++)
	{
		puni[i % k] += t[i];
	}

	vector<int64_t> ps({r, s, p});

	auto rsp = [](char c) {
		if (c == 'r')
		{
			return 0;
		}
		if (c == 's')
		{
			return 1;
		}
		if (c == 'p')
		{
			return 2;
		}
		return -1;
	};

	int64_t ans = 0;

	for (auto &&str : puni)
	{
		int64_t point = ps[(rsp(str[0]) + 2) % 3];
		for (int64_t i = 1, f = 0; i < str.size(); i++)
		{
			if (str[i - 1] == str[i] && f)
			{
				point += ps[(rsp(str[i]) + 2) % 3];
				f = 0;
			}
			else if (str[i - 1] == str[i])
			{

				f = 1;
			}
			else
			{
				point += ps[(rsp(str[i]) + 2) % 3];
				f = 0;
			}
		}
		ans += point;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 5120
import sys
input = sys.stdin.readline
from collections import Counter
def main():
    N = int(input())
    C = list(input().rstrip())
    D = Counter(C)
    E = D['R']
    CNT = 0
    for i in range(E):
        if C[i] == 'W':
            CNT += 1
    print(CNT)

if __name__ == '__main__':
    main()

Measured memory_bytes: 11060
#include <iostream>
#include <vector>
#include <complex>
#include <algorithm>
#include <cstdio>
 
using namespace std;
 
typedef complex<long double> P;
 
const long double EPS = 1e-10;
 
namespace std 
{
	bool operator <(const P &p1, const P &p2) 
	{
		if (p1.real() != p2.real()) return p1.real() < p2.real();
		return p1.imag() < p2.imag();
	}
};
 
// 按照y坐标排序
bool cmp(const P &p1, const P &p2) 
{
	return p1.imag() < p2.imag();
}
 
// 在pa和pb这两点决定的线上，横坐标为x的点的y坐标
long double calc_y_when_x_equals(const P &pa, const P &pb, long double x) 
{
	P d = pb - pa;
	if (abs(d.real()) < EPS) 
	{
		if (arg(d) < 0) return -EPS;
		else return EPS;
	}
	return pa.imag() + d.imag() * ((x - pa.real()) / d.real());
}
 
bool solve() 
{
	int W, H, N;
	cin >> W >> H >> N;
	if (!W && !H && !N) return false;
	N *= 2;
 
	vector<P> ps(N);
	for (int i = 0; i < N; ++i) 
	{
		int x, y;
		cin >> x >> y;
		ps[i] = P(x, y);
	}
	// 将四个顶点算在内的任意两点组成直线在y轴上的截距，它们相邻构成区间
	vector<P> events;
	for (int i = 0; i < N; ++i) 
	{
		for (int j = i + 1; j < N; ++j) 
		{
			events.push_back(P(0, calc_y_when_x_equals(ps[i], ps[j], 0)));
		}
		events.push_back(P(0, calc_y_when_x_equals(ps[i], P(W, 0), 0)));
		events.push_back(P(0, calc_y_when_x_equals(ps[i], P(W, H), 0)));
	}
	events.push_back(P(0, 0));
	events.push_back(P(0, H));
	sort(events.begin(), events.end(), cmp);
	// 区间收集完毕
	const int M = events.size();
	long double ans = 0;
	for (int i = 0; i < M - 1; ++i) 
	{
		const P &pa = events[i];
		const P &pb = events[i + 1];
		if (pa.imag() < 0) continue;
		if (pb.imag() > H) break;
		if (pb.imag() - pa.imag() < EPS) continue;
		const P m = (pa + pb) / (long double)2.0;
		long double upper = 0, lower = 0;
		vector<pair<long double, P>> v;
		for (const P &p : ps) 
		{
			const P d = p - m;
			v.push_back(make_pair(arg(d), p));	// 极角
		}
		sort(v.begin(), v.end());
		lower = min<long double>(H, max<long double>(0, calc_y_when_x_equals(m, v[N / 2 - 1].second, W)));	// 在右边的长度下界
		upper = min<long double>(H, max<long double>(0, calc_y_when_x_equals(m, v[N / 2].second, W)));		// 在右边的长度上界
		long double add = (pb.imag() - pa.imag()) * (upper - lower);	// 左边的长度乘以右边的长度，积分的思想
		ans += abs(add);
	}
	printf("%.10Lf\n", ans / H / H);
	return true;
}
 
///////////////////////////SubMain//////////////////////////////////
int main(int argc, char *argv[])
{
	cin.tie(0);
	ios::sync_with_stdio(0);
 
	while (solve());
	return 0;
}



Measured memory_bytes: 4492
N, M = map(int, input().split())
s = [list(map(int, l)) for l in [input().split() for j in range(M)]]
p = list(map(int, input().split()))
ans = 0

for j in range(2 ** N):
    pat = [0 for i in range(N)]
    for k in range(N):
        if ((j >> k) & 1):
            pat[k] = 1
    if sum([1 for i in range(M) if sum([1 for l in s[i][1:] if pat[l-1] == 1]) % 2 == p[i] ]) == M:
        ans += 1
print(ans)


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

int main(){
  int n;
  cin>>n;
  int ans=n%10;
  if(ans==0||ans==1||ans==6||ans==8){
    cout<<"pon"<<endl;
  }
  else if(ans==3) cout<<"bon"<<endl;
  else cout<<"hon"<<endl;
  return 0;
}

Measured memory_bytes: 3588
#
# abc065 a
#

import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """4 3 6"""
        output = """safe"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """6 5 1"""
        output = """delicious"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """3 7 12"""
        output = """dangerous"""
        self.assertIO(input, output)


def resolve():
    X, A, B = map(int, input().split())

    if A-B >= 0:
        print("delicious")
    elif B-A <= X:
        print("safe")
    else:
        print("dangerous")


if __name__ == "__main__":
    # unittest.main()
    resolve()


Measured memory_bytes: 16156
#include <bits/stdc++.h>
using namespace std;
string x;
int y,k[12];

int main(){
    cin>>x;
    for (int i=0; i<x.length(); i++) {
        if (x[i]=='A'||x[i]=='T'||x[i]=='C'||x[i]=='G') {
            k[y]++;
        }else{
            y++;
        }
    }
    sort(k, k+12);
    cout<<k[11]<<endl;
}

Measured memory_bytes: 256