akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

int main()
{
    long long int n, m;
    cin >> n >> m;
    
    if(m > n * 2)
    {
        m = m - n * 2;
        cout << n + m / 4;
    }
    else
    {
        cout << m / 2;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001;
const int mINF = -1001001001;
string print(string, int, int);
string reverse(string, int, int);
string replace(string, int, int, string);

string print(string str, int a,int b) {
  string ans="";
  for(int i = a; i < b+1; i++) {
    ans += str[i];
  }
  return ans ;
}
string reverse(string str, int a, int b) {
  string ans="";
  REP(i,a) {
    ans+=str[i];
  }
  for(int i=b;i>=a;i--) {
    ans+=str[i];
  }
  for(int i=b+1;i < str.length();i++) {
    ans+=str[i];
  }
  return ans;
}
string replace(string str, int a, int b, string p) {
  string ans="";
  REP(i,str.length()) {
    if(a<=i&&i<=b) {
      ans+=p[i-a];
    } else {
      ans+=str[i];
    }
  }
  return ans;
}

int main() {
ll n;
double sum;
double ave;
double cost;
  while(1) {
  
  
  cin >> n;
  if(n==0) break;
  sum = 0;
  ll s[n];
  REP(i,n) {
    cin >> s[i]; 
    sum += s[i];
  }
  
  ave = sum/(double)n;
  cost = 0;
  REP(i,n) {
    cost += pow((s[i]-ave),2.0)/(double)n;
  }
  cost = sqrt(cost);
  cout << setprecision(12) << cost << endl;
}

  
  return 0;
}



Measured memory_bytes: 3292
#include<bits/stdc++.h>
#include<bitset>
#include<string>
using namespace std;
#include <numeric> 
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using pi=pair<long long,long long>;
#define pii 3.1415926536
#define binary
#define mod 1000000007
typedef long long ll;
typedef long double ld;
bool sortbysec(const pair<long long,long long> &a, 
              const pair<long long,long long> &b) 
{ 
    return (a.first < b.first); 
}
bool compare(const pair<pair<ll,ll>,ll> &a,const pair<pair<ll,ll>,ll>&b)
{
    if(a.first.first==b.first.first)return (a.first.second<b.first.second);
    return (a.first.first < b.first.first); 
}
 int lcm(int a, int b)  
 {  
    return (a*b)/__gcd(a, b);  
 }  
 int Kad(ll dp[],ll n)
{
  ll curr_max=0,maxx=INT_MIN;
  for(int i=0;i<n;i++)
  {
    curr_max=curr_max+dp[i];
    if(curr_max>maxx)
      maxx=curr_max;

    if(curr_max<0)
      curr_max=0;
   
  }

  return maxx;
}

/*void dfs(int u)
{
    vis[u]=true;
    //cout<<u<<" ";
    std::vector<ll> ::iterator i;
     for (i = g[u].begin(); i != g[u].end(); ++i) 
        if (!vis[*i]) 
            dfs(*i); 
    for(int i=1;i<g[u].size();i++)
    {
        if(!vis[g[u][i]])
        {
            dfs(i);
        }
    }
}*/
ll solve(std::vector<ll> &v,int sum)
{
  unordered_map<ll,ll> m;
  ll curr=0;
  ll ans=0;
  for(ll i=0;i<v.size();i++)
  {
    curr+=v[i];
    if(curr==sum)
      ans++;
    if(m.find(curr)!=m.end())
    {
      ans+=m[curr];
    }
    m[curr]++;
  }
  return ans;
}
int main()
{
 #ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  freopen("error.txt", "w", stderr);
  #endif  
 
  IOS;
  ll n;
  cin>>n;
  ll a[n];
  for (int i = 0; i < n; ++i)
  {
cin>>a[i];
  }
  //sort(a,a+n);
  ll ans=0;
  set<int> s;
  for(int i=0;i<n;i++)
  {
    for(int j=i+1;j<n;j++)
    {
      for(int k=j+1;k<n;k++)
      {
        if((a[i]+a[j])>a[k] && (a[i]+a[k])>a[j] && (a[k]+a[j])>a[i] && (a[i]!=a[j] && a[j]!=a[k] && a[i]!=a[k]))
        {
          ans++;
        }
      }
    }
  }
  cout<<ans<<endl;

}

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

const ll INF = 1e18;
const int MAXN = 1e2;
const int MAXV = MAXN * 1e3;
struct item{
	int w; int v;
};

int main(){
	
	int n,limW;
	cin >> n >> limW;
	vector<item> items(n);
	rep(i,n){
		int w,v;
		cin >> w >> v;
		items[i] = item{w,v};
	}
	
	vector<vector<ll>> dp(n, vector<ll>(MAXV+1,INF));
	dp[0][0] = 0;
	dp[0][items[0].v] = items[0].w;
	rep(i,n-1){
		rep(j,MAXV+1){
			if(j-items[i+1].v >= 0){
				dp[i+1][j] = min(dp[i][j], dp[i][j-items[i+1].v] + items[i+1].w);
			}
			else{
				dp[i+1][j] = dp[i][j];
			}
		}
	}	

	ll res = 0;
	for(int j = MAXV; j >= 0; j--){
		if(dp[n-1][j] <= limW){
			res = j;
			break;
		}
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 79488
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,x,y,z,cnt=0;
  cin>>n;
  vector<pair<int,pair<int,int> > > p(n);
  for(int i=0;i<n;++i){
    cin>>x>>y>>z;
    p[i].first=x;
    p[i].second.first=y;
    p[i].second.second=z;
    if(p[i].first>p[i].second.first) swap(p[i].first,p[i].second.first);
    if(p[i].second.first>p[i].second.second) swap(p[i].second.first,p[i].second.second);
    if(p[i].first>p[i].second.first) swap(p[i].first,p[i].second.first);
  }
  sort(p.begin(),p.end());
  for(int i=0;i<n-1;++i){
    if(p[i]==p[i+1]) ++cnt;
  }
  cout<<cnt<<endl;
  return 0;
}



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

int main()
{
  string S;
  cin >> S;
  
  for(int i = 0; i < S.size(); i++){
   if(i%2 == 0){
     if(S.at(i) == 'L'){
       cout << "No" << endl;
       return 0;
     }
   } else{
     if(S.at(i) == 'R'){
       cout << "No" << endl;
       return 0;
     }
   }
  }    
  cout << "Yes" << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <functional>
using namespace std;


string IntToString(int number) {
    stringstream ss;
    ss << number;
    return ss.str();
}

int main(){
    int n, m;
    while(cin >> n >> m, n+m){
        vector<int> nums, numList;
        nums.push_back(n);
        numList.push_back(n);
        string s = IntToString(n);
        while(1){
            for(int i=0; i < s.size()-m; i++) s += "0";
            sort(s.begin(), s.end());
            int minNum = atoi(s.c_str());
            sort(s.begin(), s.end(), greater<int>());
            int maxNum = atoi(s.c_str());

            n = maxNum - minNum;
            if(binary_search(nums.begin(), nums.end(), n)){numList.push_back(n); break;}
            else {nums.push_back(n); numList.push_back(n);}
            s = IntToString(n);
            sort(nums.begin(), nums.end());
        }
        int firstPoint=0, secondPoint=0;
        bool isFirst = true;
        for(int i=0; i < numList.size(); i++){
            if(numList[i] == n && isFirst){firstPoint = i; isFirst = false;}
            else if(numList[i] == n && !isFirst){secondPoint = i; break;}
        }
        cout << firstPoint << " " << n << " " << secondPoint-firstPoint << endl;
    }
}

Measured memory_bytes: 1252
H, W = map(int, input().split())
N = int(input())
A = [int(i) for i in input().split()]

B = []
for i in range(N):
    B += [i + 1] * A[i]
    
for h in range(H):
    if h % 2 == 0:
        print(' '.join(map(str, B[: W])))
        del B[: W]
    else:
        print(' '.join(map(str, B[: W][::-1])))
        del B[: W]

Measured memory_bytes: 3444
#pragma region
#include <bits/stdc++.h>
using namespace std;
inline void ci(void){
  return;
}
template <typename First, typename... Rest>
void ci(First& first, Rest&... rest){
  cin >> first;
  ci(rest...);
  return;
}
inline void co(void){
  cout << "\n";
  return;
}
template <typename First, typename... Rest>
void co(First first, Rest... rest){
  cout << first << " ";
  co(rest...);
  return;
}
#define ll long long
#define ld long double
#define st string
#define dl double
#define wh while
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define tp tuple
#define ft first
#define sc second
#define ve vector
#define tos to_string
#define len length
#define rt return 0
#define br break
#define con continue
#define lcm(n, m) (n * m / gcd(n, m))
#define np next_permutation
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define repill(i, m, n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define repll(i, n) repill(i, 0, n)
#define revi(i, m, n) for(int i=(int)(m);i>(int)(n);i--)
#define rev(i, n) revi(i, 0, n)
#define revill(i, m, n) for(ll i=(ll)(m);i>(ll)(n);i--)
#define revll(i, n) revill(i, 0, n)
#define sz(v) ((int)(v).size()) 
#define each(i, n) for(auto&& i: n)
#define all(n) (n.begin(), n.end())
#define allr(n) (n.rbegin(), n.rend())
#define sp(n) cout << fixed << setprecision(n)
#pragma endregion
// sqrt ルート, int 2*10^9, gcd　最大公約数
// __builtin_popcount bitの個数

int main() {
  int N;
  ci(N);
  if(N == 1){
    co(N);
    rt;
  }
  rep(i, 8){
    if(N < pow(2, i)){
      co(pow(2, (i - 1)));
      rt;
    }
  }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void){
    // Your code here!
    int N, K, min = 100000, result;
    int S[100000];
    scanf("%d %d",&N,&K);
    for(int i = 0; i < N; i++) scanf("%d",&S[i]);
    int i = 0;
    while(S[i++] != 1);
    for(int j = 1; j <= K; j++) //Kの内何番目がiか
    {
        if(i + K-j <= N && i - (j-1) >= 1)
        {
            result = 1 + (int)((i-1-(j-1))/(K-1)) + ((i-1-(j-1))%(K-1) != 0) + (int)((N-i-(K-j))/(K-1)) + ((N-i-(K-j))%(K-1) != 0);
            //printf("%d\n",result);
            if(min > result) min = result;
        }
    }
    printf("%d\n",min);
}

Measured memory_bytes: 512
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define index(xs, x) (int)(lower_bound(all(xs), x) - xs.begin())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

int N, M;
vector<P> G[100000];
bool used[100000];
long long A[100000];

void dfs(int x, long long pos) {
  used[x] = true;
  A[x] = pos;
  for (P p : G[x]) {
    int t = p._1;
    long long d = pos+p._2;
    if (used[t]) {
      if (A[t] != d) {
        cout << "No\n";
        exit(0);
      }
      continue;
    }
    dfs(t, d);
  }
}
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> N >> M;
  rep(i, M) {
    int s, t, d;
    cin >> s >> t >> d;
    s--, t--;
    G[s].pb(P(t, d));
    G[t].pb(P(s, -d));
  }
  rep(i, N) if (!used[i]) {
    dfs(i, 0);
  }
  cout << "Yes\n";
  return 0;
}


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

        int main() {
          int A,B;
          cin>> A>>B; 
          
          
          
          /*
          vector<int> A(N);
          
          for(int i=0; i<N; i++){
                cin>> A.at(i); 
          }
          */
          
          cout<< max(A-2*B,0) << endl;

        }

Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>

using namespace std;

constexpr long long INF = 10000000000LL;

int main() {

    int H, W;
    cin >> H >> W;

    vector<vector<long long>> G(10, vector<long long>(10));
    for (int i = 0; i < 10; i++) for (int j = 0; j < 10; j++) cin >> G[i][j];
    for (int k = 0; k < 10; k++)
        for (int i = 0; i < 10; i++)
            for (int j = 0; j < 10; j++)
                G[i][j] = min(G[i][j],
                              G[i][k] +
                              G[k][j]);

    long long ans = 0;
    for (int i = 0; i < H * W; i++) {
        long long d;
        cin >> d;
        if (d != -1) ans += G[d][1];
    }

    cout << ans << endl;

    return 0;
}
































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

int main(){
  int A, B, C, X, Y;
  cin >> A >> B >> C >> X >> Y;
  int rmax = max(2*X, 2*Y);
  int Anum = 0, Bnum = 0;
  int min = A*X + B*Y;

  int r = rmax;
  while(r >= 0){
    //r枚のABを買うとき
    Anum = r/2;
    Bnum = r/2;
    int money = r * C;
    if(X - Anum > 0) money += (X - Anum) * A;
    if(Y - Bnum > 0) money += (Y - Bnum) * B;
    if(min > money) min = money;
    r--;
  }
  cout << min << endl;
}

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

int main(void) {
  int n, count4 = 0, count2 = 0, oddscount = 0;
  cin >> n;
  long long array[n];
  for (int i = 0; i < n; i++) {
    cin >> array[i];
    if (array[i] % 2 == 0) {
      if (array[i] % 4 != 0)
        count2++;
      if (array[i] % 4 == 0)
        count4++;

    } else {
      oddscount++;
    }
  }
  
  if (count2 == 0) {
    if (count4 - oddscount >= -1) {
      cout << "Yes" << endl;
      return 0;
    } else {
      cout << "No" << endl;
    }
  } else {
    if (count4 - oddscount >= 0) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }

  return 0;
}


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

int main() {
  double weight;
  while(cin >> weight) {
    if(weight <= 48.00) {
      cout << "light fly" << endl;
    }
    else if(weight <= 51.00) {
      cout << "fly" << endl;
    }
    else if(weight <= 54.00) {
      cout << "bantam" << endl;
    }
    else if(weight <= 57.00) {
      cout << "feather" << endl;
    }
    else if(weight <= 60.00) {
      cout << "light" << endl;
    }
    else if(weight <= 64.00) {
      cout << "light welter" << endl;
    }
    else if(weight <= 69.00) {
      cout << "welter" << endl;
    }
    else if(weight <= 75.00) {
      cout << "light middle" << endl;
    }
    else if(weight <= 81.00) {
      cout << "middle" << endl;
    }
    else if(weight <= 91.00) {
      cout << "light heavy" << endl;
    }
    else {
      cout << "heavy" << endl;
    }
  }
}

Measured memory_bytes: 0
fun main (args : Array<String>) {
	val n = readLine()!!.toString()
	var result : String = ""
	for (i in n) {
		if (i.toString() == "1") {
			result += "9"
		} else if (i.toString() == "9") {
			result += "1"
		}
	}
	println("${result}")
}

Measured memory_bytes: 33688
fun main(args: Array<String>) {

    val (W, H, x, y) = readLine()!!.split(" ").map { Integer.parseInt(it).toDouble() }
    print((W * H) / 2L)
    print(" ")
    if (x == 0.0 || y == 0.0) {
        print(0)
        return
    }

    if (((W / x) == 2.0) && (H / y) == 2.0) {
        print(1)
    } else {
        print(0)
    }
}

Measured memory_bytes: 38004
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int a,b,c;cin>>a>>b>>c;
	int ans;
	for(int i=1;i<=min(a,b);i++){
		if(a%i==0&&b%i==0)ans=a*b/i/i;
	}
	cout<<c*ans<<endl;
	return 0;
}

Measured memory_bytes: 3088
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i=0; i < n; i++)
#define repd(i, n) for (int i = n-1; i > -1; i--)
#define repran(i, a,b) for (int i = a; i<b;i++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
const int MAX_N = 3010;
int a[MAX_N];
bool cache[MAX_N][MAX_N];
ll dp[MAX_N][MAX_N];

ll dfs(int i, int j){
    if (i == j) return dp[i][j]=a[i];
    if (cache[i][j]) return dp[i][j];
    dp[i][j] = max(a[i]-dfs(i+1, j), a[j]-dfs(i, j-1));
    cache[i][j] = 1;
    return dp[i][j];
}

int main()
{
    int n;
    cin >> n;
    rep(i, n) cin >> a[i];
    rep(i, n) rep(j, n) dp[i][j] = 0, cache[i][j] = 0;
    dfs(0, n-1);
    cout << dp[0][n-1] << endl;

}

Measured memory_bytes: 83192
/* kadai 3_2
   nabe9393 */
 
#include<stdio.h>
 
int main(void){
  int number_pen;
  scanf("%d", &number_pen); //入力
  if (number_pen % 10 == 3){ //１のくらいが３の時はBON
    printf("bon\n");
  }
  else if (number_pen % 10 == 0 || number_pen % 10 == 1 || number_pen % 10 == 6 || number_pen % 10 == 8){ //1のくらいが0,1,6,8の時はPON
    printf("pon\n");
  }
  else{ //それ以外はHON
    printf("hon\n"); 
  }
  return 0;
}

Measured memory_bytes: 1604
#include <iostream>

using namespace std;

int
main()
{
  int A[9], b[10];
  int N;
  int is_open[9];

  for ( int i = 0 ; i < 3 ; i++ ) {
    cin >> A[i*3] >> A[i*3+1] >> A[i*3+2];
  }
  
  cin >> N;
  
  for ( int i = 0 ; i < N ; i++ ) {
    cin >> b[i];
  }
  
  for ( int i = 0 ; i < 9 ; i++ ) is_open[i] = 0;
  
  for ( int i = 0 ; i < N ; i++ ) {
    int tmp = b[i];
    
    for ( int j = 0 ; j < 9 ; j++ ) {
      if ( tmp == A[j] ) { is_open[j] = 1; break; }
    }
  }
  
  if (( is_open[0] && is_open[1] && is_open[2] ) ||
      ( is_open[3] && is_open[4] && is_open[5] ) ||
      ( is_open[6] && is_open[7] && is_open[8] ) ||
      ( is_open[0] && is_open[3] && is_open[6] ) ||
      ( is_open[1] && is_open[4] && is_open[7] ) ||
      ( is_open[2] && is_open[5] && is_open[8] ) || 
      ( is_open[0] && is_open[4] && is_open[8] ) ||
      ( is_open[2] && is_open[4] && is_open[6] )) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<utility>
#include<numeric>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<tuple>
#include<stack>
#include<queue>
#include<functional>
#include<iterator>
#include<cmath>
#include<cctype>

using namespace std;

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

const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = INF+7;

struct edge{int to,cost;};
	
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);

	int n,c,k;
	cin >> n >> c >> k;

	int t[n];
	for(int i=0;i<n;i++){
		cin >> t[i];
	}
	sort(t,t+n);
	
	int ans=1;
//	for(int i=0;i<n;){
//		auto e=upper_bound(t,t+n,t[i]+k);
//		i+=min(e-t,c);
//		ans++;
//	}
	int a=0,i=1;
	while(true){
		if(a+i == n) break;
		if(i<c && t[a]+k>=t[a+i]){
			i++;
		}else{
			ans++;
			a=a+i;
			i=1;
		}
	}
	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 640
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int c =0;
		for (int i=1;i<=n;i++) {
			int x  = sc.nextInt();
			if(i%2!=0 && x%2!=0) {
				c++;}}
		System.out.println(c);
	}

}


Measured memory_bytes: 35668
def renzoku(S):
    N = len(S)
    ans = []
    tmp = [0] * N
    for i in range(N-1):
        if S[i] == S[i+1]:
          tmp[i+1] = tmp[i] + 1  
    for i in range(N-1):
        if tmp[i] < tmp[i+1]:
            pass
        else:
            ans.append(  (S[i], tmp[i]+1)  )
    
    i = N-1
    ans.append(  (S[i], tmp[i]+1)  )
    # print(tmp)
    # print(ans)
    # return ""
    return ans


if __name__ =="__main__":
    N,K = map(int, input().split())
    S = input()
    ans = 0

    ren = renzoku(S)
    num = [ r[1] for r in ren]
    typ = [ r[0] for r in ren]
    numnew = len(ren)

    i = 0
    j = -1
    if typ[i] == "0":
        j = K*2 - 1
        pass
    else:
        j = K*2 
        pass

    if numnew <= j:
        # intS = list(map(lambda x: 1 if x=="1" else 0 , S))
        print(N)
        exit()
    

    # print("renzoku: ", ren)
    tmp = 0
    p = i
    # print("i, j: ", i, j)
    while p <= j:
        tmp += num[p]
        p += 1
    
    # print("tmp: ", tmp)
    ans = max(ans, tmp)
    while True:
        i += 1
        ans = max(ans, tmp)
        if typ[i] == "0":
            tmp -= num[i-1] 
        else:
            tmp -= num[i-1]
            prevJ = j
            j = min(j+2, numnew-1) # new J 
            for p in range(prevJ+1, j+1):
                tmp += num[p]
            ans = max(ans, tmp)
        if j == numnew -1:
            break
    print(ans)
            


Measured memory_bytes: 60212
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <set>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)

int main(void){
	int X;	cin >> X;
	vector<bool> ex(X+1);

	ex[1] = 1;
	for (int b = 2; b <= X; b++)	{
		int v = b * b;
		while (v <= X)	{
			ex[v] = 1;
			v *= b;
		}
	}
	REPS(i, X)	if (ex[i])	{
			cout << i << endl;
			return 0;
	}
}


Measured memory_bytes: 256
/*input
4 4
1 9 3 5
*/
#include<bits/stdc++.h>
#define N 100015
#define int long long
using namespace std;
int n, m, a[N], ans;
priority_queue<int> pq;
main(){
	ios_base::sync_with_stdio(false);
	cin >> n >> m;
	for(int i = 0;i < n;++i)
	{
		int x;
		cin >> x;
		pq.push(x);
	}
	for(int i = 0;i < m;++i)
	{
		int y = pq.top();
		pq.pop();
		y /= 2;
		pq.push(y);
	}
	for(int i = 0;i < n;++i)
	{
		int z = pq.top();
		ans += floor(z);
		pq.pop();
	}
	cout << ans;
}

Measured memory_bytes: 1400
import java.util.Scanner;

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

		if (N < 10) {
			System.out.println(R + 100 * (10 - N));
		} else {
			System.out.println(R);
		}
	}
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
constexpr long double EPS = 1e-15;
const long double PI = acos(-1);
constexpr int inf = 1e9;
constexpr ll INF = 2e18;
constexpr ll MOD = 1e9+7;
constexpr ll MOD1 = 998244353;
typedef pair<ll,ll> P;
//#define all(v) (v).begin(), (v).end()
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
//#define mp make_pair
int n;
ll a[510];
ll k;
void input() {
    cin >> n >> k;
    REP(i,n) cin >> a[i];
}

bool ok(ll d) {
    // cout << "looking " << d << endl;
    ll b[510];
    ll sum = 0;
    REP(i,n) {
        b[i] = a[i] % d;
        sum += b[i];
    }
    sort(b,b+n);
    reverse(b,b+n);
    // REP(i,n) cout << b[i] << " ";
    // cout << endl;
    ll ad = 0;
    ll ret = inf;
    REP(i,n) {
        ad += d - b[i];
        sum -= b[i];
        if (ad == sum) {
            ret = min(ret, ad);
        }
    }
    if (ret == inf) return 1;
    // cout << " ret -> " << ret << endl;
    return ret <= k;
}

void solve() {
    ll sum = 0;
    ll ans = 0;
    REP(i,n) sum += a[i];
    for (ll i = 1; i * i <= sum; i++) {
        if (sum % i != 0) continue;
        if (ok(i)) {
            ans = max(ans,i);
        }
        if (ok(sum / i)) {
            ans = max(ans, sum / i);
        }
    }
    cout << ans << endl;
}

int main(int argc, char *argv[]){
    input();
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
    int i,j;
    int count[6] = {0};
    int n ;
    double len;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%lf",&len);
        if(len < 165.0)
            count[0]++;
        else if(len < 170.0)
            count[1]++;
        else if(len < 175.0)
            count[2]++;
        else if(len < 180.0)
            count[3]++;
        else if(len < 185.0)
            count[4]++;
        else
            count[5]++;
    }
    for(i=0;i<6;i++){
        printf("%d:",i+1);
        for(j=0;j<count[i];j++)
            printf("*");
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 2604
#include<iostream>
#include<cmath>
using namespace std;
typedef long long ll;

int main(void){
  ll n; cin>>n;
  ll ret=0;
  for(ll i=1; i<sqrt(n); ++i){
    if( n % i == 0 && (n/i-1) != i ){
      ret += (n/i)-1;
    }
  }
  cout<< ret <<endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define up(i,a,b) for(int (i) = (a);(i)<=(b);++(i))
#define down(i,b,a) for(int (i) = (b);i>=(a);--i)
#define debug(x) cerr << (x) << '\n';
#define bits(x,i) ((x >> i) & 1)
using namespace std;
set<string> s;
int n;
int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin >> n;
	for(int i=1;i<=n;++i){
		string x;cin >> x;
		s.insert(x); 
	}
	cout << s.size();
}

Measured memory_bytes: 19248
#include<iostream>
#include<algorithm>
#include<string.h>
#include<set>
#include<vector>
using namespace std;

int main(){
    long long a,b,c,d,e,f;
    cin>>a>>b>>c;
    if(a%2==0||b%2==0||c%2==0){
        cout<<0<<endl;
        return 0;
    }else{
        cout<<min(a*b,min(a*c,b*c))<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(V) V.begin(),V.end()
using ll = long long;
const ll MOD = 1000000007;

int main() {
	string S, T, U;
	cin >> S >> T;
	int ss, ts;
	cin >> ss >> ts;
	cin >> U;
	if (U == T)cout << ss << " " << ts - 1 << endl;
	else if (U == S)cout << ss - 1 << " " << ts << endl;
	else cout << ss << " " << ts << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int heap[500001];
int root;
int n,a,temp;
string s;
bool flag;

void maxHeapify(int i){
	int l=i*2+1;//?????????
	int r=i*2+2;//?????????
	int largest=i;
	//l<=n?????????????????????????????????????????????????¶?????????????????????????????????????
	if(l<=n&&heap[l]>heap[i])largest=l;
	if(r<=n&&heap[r]>heap[largest])largest=r;
	
	if(largest!=i){
		temp=heap[i];
		heap[i]=heap[largest];
		heap[largest]=temp;
		maxHeapify(largest);
	}
}

void buildMaxHeap(){
	for(int i=n/2;i>=0;i--){//n/2??¨????????????????????????????????????????????¢?´¢????????????
		maxHeapify(i);
	}
}

int main(){
	cin >> n;
	for(int i=0;i<n;i++){
		cin >>heap[i];
	}
	buildMaxHeap();
	for(int i=0;i<n;i++){
		cout << " "<<heap[i];
	}
	cout << endl;
}

Measured memory_bytes: 5072
N, M = gets.split.map(&:to_i)
C = M.times.map{|i| j, y = gets.split.map(&:to_i); {year: y, pref: j } }
S = C.group_by {|c| c[:pref] }
(1 .. N).each do |j|
  if S[j]
    S[j].sort_by!{|c| c[:year] }
    S[j].each_with_index do |c,k|
      c[:id] = sprintf("%06d%06d",c[:pref], k+1)
    end
  end
end
puts C.map{|c| c[:id] }



Measured memory_bytes: 55676
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

using ll = long long;
using P = std::pair<ll, ll>;

constexpr ll INF = 1ll<<60;

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; }

template<class S, class T>
std::ostream& operator<< ( std::ostream& out, const std::pair<S,T>& a )
{ std::cout << '(' << a.first << ", " << a.second << ')'; return out; }

template<class T>
std::ostream &operator<< ( std::ostream& out, const std::vector<T>& a )
{ std::cout << '['; rep( i, a.size() ){ std::cout << a[i]; if( i != a.size()-1 ) std::cout << ", "; } std::cout << ']'; return out; }

ll N, K;
ll a[20];
ll ans = INF;

int main()
{
  std::cin >> N >> K;

  rep( i, N )
    std::cin >> a[i];

  rep( i, 1<<N )
  {
    ll k = __builtin_popcount(i);

    if( k < K )
      continue;

    std::vector<ll> vs;

    rep( j, N ) if( i>>j&1 )
      vs.emplace_back( j );

    ll sum = 0, ma = 0;
    ll p = 0;

    rep( j, N )
    {
      if( j == vs[p] )
      {
        sum += std::max( 0ll, ma+1-a[j] );
        chmax( ma, ma+1 );
        
        ++p;
      }

      chmax( ma, a[j] );
    }

    chmin( ans, sum );
  }

  std::cout << ans << std::endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int 
#define ar array
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define mx *max_element
#define mn *min_element
#define fo(i,n) for(ll i=0;i<n;i++)
#define all(x) x.begin(),x.end()
#define sortall(x) sort(all(x))
#define precision cout<<fixed<<setprecision(10)
#define w(t) ll t;cin>>t;while(t--)
#define setbits(x) __builtin_popcountll(x)
const double pi=3.1415926535897932384626;
//const ll mod = 998244353;
const ll mod=1e9+7;
int main()
{
  IOS
  string s;
  cin>>s;
  ll ans=0,c=0;
  fo(i,3){
    if(s[i]=='R')
        c++;
    else{
        ans=max(ans,c);
        c=0;
    }
  }
  ans=max(ans,c);
  cout<<ans;
  return 0;
}

Measured memory_bytes: 3648
#include<iostream>


int main() {
	long long n = 0, x = 0;
	int countf = 0;
	int count = 0;
	long long a[200] = {};
	std::cin >> n;
	for (int i = 0; i < n; i++) {
		std::cin >> a[i];
	}

	for (int j = 0; j < n; j++) {
		for (long long k = 0; k < 9999999999; k++) {
			x = a[j] % 2;
			if (x == 0) {
				countf++;
			}
			else {
				break;
			}
			a[j] = a[j] / 2;
		}

		if (j == 0) { count = countf; }
		if (count >= countf) {
			count = countf;
		}
		countf = 0;			
	}
	std::cout << count << std::endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    string s;
    cin>>s;
        if(s[0]=='R')
        {
            if(s[1]=='R')
            {
                if(s[2]=='R')
                {
                    cout<<3<<endl;
                }
                else
                {
                    cout<<2<<endl;
                }
            }
            else
            {
                cout<<1<<endl;
            }
        }
        else
        {
            if(s[1]=='R')
            {
                if(s[2]=='S')
                {
                    cout<<1<<endl;
                }
                else
                {
                    cout<<2<<endl;
                }
            }
            else
            {
                if(s[2]=='S')
                {
                    cout<<0<<endl;
                }
                else
                {
                    cout<<1<<endl;                }
            }
        }
    
    return 0;
}

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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main(){
    gearup;
    int n;cin >> n;
    vl a(n);
    rep(i,n)cin>>a[i];
    vl l(n+1),r(n+1);
    rep(i,n)l[i+1]=__gcd(l[i],a[i]); //l(p)=[0,p)の区間のgcd
    for(int i=n-1;i>=0;i--) r[i] = __gcd(r[i+1],a[i]); //r(p)=[p, の区間のgcd

    ll res = 1;
    rep(i,n)res=max(res,__gcd(l[i],r[i+1]));
    out(res);
}



Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=200005;
int n;
LL a[N],sum[N],v;
int x[5]={0};
LL calc(int i){
	return sum[x[i]]-sum[x[i-1]];
}
LL llabs(LL x){
	return x<0?-x:x;
}
bool cmp(int a,int b){
	return calc(a)<calc(b);
}
bool cmp2(int a,int b){
	return calc(a)>calc(b);
}
void move(int id,int d){
	if (d==1){
		if (x[id+1]-x[id]>1)
			x[id]++;
	}
	else {
		if (x[id]-x[id-1]>1)
			x[id]--;
	}
}
LL trys(){
	LL ans=1e17;
	int y[5];
	for (int i=0;i<5;i++)
		y[i]=x[i];
	for (int i=1;i<=20;i++){
		int id[5]={0,1,2,3,4};
		sort(id+1,id+5,cmp);
		ans=min(ans,llabs(calc(id[1])-calc(id[4])));
		int r=rand()%6;
		if (r==0){
			LL val=calc(1);
			if (val>v)
				move(1,-1);
			else
				move(1,1);
		}
		if (r==1){
			LL val=calc(4);
			if (val>v)
				move(3,1);
			else
				move(3,-1);
		}
		if (r>1){
			r-=2;
			int k=r&1?2:3;
			r/=2;
			LL val=calc(k);
			if (r){
				if (val>v)
					move(k-1,1);
				else
					move(k-1,-1);
			}
			else {
				if (val>v)
					move(k,-1);
				else
					move(k,1);
			}
		}
	}
	for (int i=0;i<5;i++)
		x[i]=y[i];
	return ans;
}
LL solve(){
	for (int i=1;i<=n;i++)
		sum[i]=sum[i-1]+a[i];
	v=sum[n]/4;
	for (int i=1;i<=3;i++){
		x[i]=x[i-1]+1;
		while (x[i]<n+i-4&&sum[x[i]]-sum[x[i-1]]<=v)
			x[i]++;
	}
	x[4]=n;
	LL ans=1e17;
	for (int xxxx=1;xxxx<=n*4;xxxx++){
		ans=min(ans,trys());
		int id[5]={0,1,2,3,4};
		sort(id+1,id+5,cmp);
		ans=min(ans,llabs(calc(id[1])-calc(id[4])));
		int j=1;
		while (j<=4&&(id[j]==1||x[id[j]-1]-x[id[j]-2]==1))
			j++;
		if (j>4)
			break;
		x[id[j]-1]--;
	}
	return ans;
}
LL solve2(){
	for (int i=1;i<=n;i++)
		sum[i]=sum[i-1]+a[i];
	v=sum[n]/4;
	for (int i=1;i<=3;i++){
		x[i]=x[i-1]+1;
		while (x[i]<n+i-4&&sum[x[i+1]]-sum[x[i]]<=v)
			x[i]++;
	}
	x[4]=n;
	LL ans=1e17;
	for (int xxxx=1;xxxx<=n*4;xxxx++){
		int id[5]={0,1,2,3,4};
		sort(id+1,id+5,cmp2);
		ans=min(ans,llabs(calc(id[1])-calc(id[4])));
		int j=1;
		while (j<=4&&(id[j]==1||x[id[j]-1]-x[id[j]-2]==1))
			j++;
		if (j>4)
			break;
		x[id[j]-1]--;
	}
	return ans;
}
int main(){
	srand(19260817);
	scanf("%d",&n);
	for (int i=1;i<=n;i++)
		scanf("%lld",&a[i]);
	LL ans=1e17;
	ans=min(ans,solve());
	for (int i=1;i<=n/2;i++)
		swap(a[i],a[n-i+1]);
	ans=min(ans,solve());
	ans=min(ans,solve2());
	for (int i=1;i<=n/2;i++)
		swap(a[i],a[n-i+1]);
	ans=min(ans,solve2());
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 3456
#include<iostream>
#include<string>
#include<algorithm>
#include<bits/stdc++.h>
#include<vector>
 
using namespace std;
int MOD=1000000007;

int main(){
    int a,b,c,ans=0; cin >> a >> b >> c;
    for(int i=a; i<=b; i++){
        if(c%i==0) ans+=1;
    }
    cout << ans << endl;
	}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
using namespace std;
 
#define ff first
#define ss second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define boost ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define check(x) cout << #x << " : " << (x) << endl
#define all(v) v.begin(),v.end() 
#define endl '\n'  
typedef long long ll; 
typedef unsigned long long ull; 
typedef long double ld;
typedef pair< ll , ll > mypair;
typedef priority_queue <ll> max_heap;
typedef priority_queue <mypair, vector<mypair>, greater<mypair> > min_heap;
const ll mod=1e9+7;
const ll inf=1e16;
const ll N=5e5+10;

struct point
{
    long double x,y;
    int get_quad()
    {
        if(x>=0 and y>=0 ) return 0;
        if(x<=0 and y>=0) return 1;
        if(x<=0 and y<=0) return 2;
        if(x>=0 and y<=0 ) return 3;

    }
    bool operator < ( point &other)
    {
        int q1=get_quad();
        int q2=other.get_quad();
        if(q1!=q2) return q1<q2;
        if(q1==0)
        {
            return abs(y/x) < abs(other.y/other.x);
        }
        if(q1==1)
        {
            return abs(y/x) > abs(other.y/other.x);
        }
        if(q1==2)
        {
            return abs(y/x) < abs(other.y/other.x);
        }
        if(q1==3)
        {   
            return abs(y/x) > abs(other.y/other.x);
        }   
    }
    point operator + (const point &other)
    {
        point a=point{x+other.x,y+other.y};
        return a;
    }
    point operator - (const point &other)
    {
        point a=point{x-other.x,y-other.y};
        return a;
    }   

};

long double dist(point a ,point b=point{0,0})
{
    return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
} 

int main()
{
    boost;
    int n;
    cin>>n;
    point a[n];
    for(auto &i:a)
    {
        cin>>i.x>>i.y;
    }
    sort(a,a+n);
    long double ans=0;
    for(int i=0;i<n;i++)
    {
        int now=i;
        point temp=point{0,0};
        for(int j=0;j<n;j++)
        {
            temp=temp+a[now];
            ans=max(ans,dist(temp));
            now++;
            now%=n;
        }
    }
    cout<<fixed<<setprecision(30)<<(ans);
    return 0;
}


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

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

  vector<int> card(N);
  
  for (int i = 0; i < N; i++) {
    cin >> card.at(i);
  }
  
  sort(card.begin(), card.end());
  reverse(card.begin(), card.end());

  int alice = 0,bob =0;
  
  for (int i = 0; i < N; i++) {
    if (i % 2 == 0) {
      alice += card.at(i);
    }
    else {
      bob += card.at(i);
    }
  }
  cout << alice - bob << endl;
}

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

const int maxn = 2003;

const int mod = 1e9+7;

int a[maxn];
int cnt[maxn];


int Pow(int x,int k) {
	int res = 1;
	while (k) {
		if (k&1) {
			res = 1ll * res * x % mod;
		}
		x = 1ll * x * x % mod;
		k >>= 1;
	}
	return res;
}

void add(int &x, int y) {
	x += y % mod;
	if (x >= mod) x -= mod;
}

int main() {
	int n = 0;
	int k = 0;
	cin >> n >> k;
	for(int i=0;i<n;i++) {
		cin >> a[i];
		cnt[a[i]]++;
	}

	int t = 0;
	for(int i=1;i<=2000;i++) {
		cnt[i] += cnt[i-1];
	}

	int res = 0;

	int kk = (1ll * k * (k-1) / 2) % mod;

	for(int i=0;i<n;i++) {
		int cnt1 = 0;
		for(int j=i+1;j<n;j++) {
			if (a[j] < a[i]) {
				cnt1 ++;
			}			
		}
		int cnt2 = 0;
		if (a[i] == 0) cnt2 = 0;
		else cnt2 = cnt[a[i] - 1];
		int tmp = (1ll * cnt1 * k) % mod;
		int tmp1 = (1ll * cnt2 * kk) % mod;
		add(res, tmp + tmp1);
	}

	cout <<res;
	return 0;
}


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

#define FOR(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
#define REP(i,n) FOR(i,0,n)
using ll = long long;
int main() {
  string s; cin >> s;
  if (s.size() < 26) {
    map<int,bool> mp; REP(i,s.size()) mp[s[i] - 'a'] = true;
    for (int i = 0; i < 26; ++i) if (!mp[i]) { s.push_back(i+'a'); break;}
  } else {
    string max = "zyxwvutsrqponmlkjihgfedcba";
    if (s == max) {cout << -1 << endl;return 0;}
    vector<int> v;
    int ans; char c;
    for (int i = 25; i >= 0; i--) {
      v.push_back(s[i]-'a');
      if (s[i] > s[i-1]) {
        c = 'a'+*(upper_bound(v.begin(),v.end(),s[i-1]-'a'));
        ans = i-1;
        break;
      }
    }
    s = s.substr(0,ans); s.push_back(c);
  }
  cout << s << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
  int h,w;
  bool f;

  while(cin>>h>>w,(h||w)){
    
    for(int i=1; i<=h; i++){
      
      if((i%2)==0){ f=false; }
      else{f=true;}
      for(int j=1; j<=w; j++){
	if(f){
	  cout<<"#";
	  f=false;
	}
	else{
	  cout<<".";
	  f=true;
	}
      }
      cout<<endl;
    }
      cout<<endl;
  }

  return 0;
}



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

int main(){
    int a,b;
    char m;
     
    
    while (1){
       cin >> a >> m>> b ;
       if (m =='?') break;{
       }if (m == '+'){
        cout << a+b << endl;
       }else if (m == '-'){
        cout << a-b << endl;
       }else if(m =='*'){
        cout << a*b << endl;
       }else if(m == '/'){
        cout << a/b << endl;
       }
    }
return 0;
}


Measured memory_bytes: 3104
import java.util.Scanner

object Main {
  def main(args: Array[String]) {
    val result = solve(new Scanner(System.in))
    if (result.length > 0) println(result)
  }

  def solve(in: String): String = solve(new Scanner(in))

  def solve(sc: Scanner): String = {
    val ab = Array.fill(2)(sc.nextInt)

    ((ab.sum + 1) / 2).toString
  }
}


Measured memory_bytes: 27320
#include<bits/stdc++.h>
#define V vector
#define VI vector<int>
#define VVI vector<vector<int>>
#define REP(i,n) for(int i=0;i<(n);i++)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define MOD 1000000007
#define INF 1e9
#define F first
#define S second
#define All(x) (x).begin(),(x).end()
using namespace std;
const double PI = acos(-1);
typedef long long ll;

constexpr ll COM_MAX = (ll)1e6+100;
vector<ll> fac(COM_MAX),finv(COM_MAX),inv(COM_MAX);
void comb_init(){
  fac[0]=fac[1]=1;
  finv[0]=finv[1]=1;
  inv[1]=1;
  for(int i=2;i<COM_MAX;++i){
    fac[i]=fac[i-1]*i%MOD;
    inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
    finv[i]=finv[i-1]*inv[i]%MOD;
  }
}
// 二項係数計算
ll comb(ll n,ll k){
  if(n<k)return 0;
  if(n<0||k<0)return 0;
  return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}

int main(void){
  comb_init();
  ll nc=1;
  int X,Y;
  cin>>X>>Y;
  int cntX=0,cntY=0;
  while(1){
    if(X>=Y){
      X-=2;Y-=1;
      cntX++;
    }else{
      X-=1;Y-=2;
      cntY++;
    }
    if(X==0&&Y==0){
      break;
    }else if(X<0||Y<0){
      cout<<0<<endl;
      return 0;
    }
  }
  cout<<comb(cntX+cntY,cntX)<<endl;
  //cout<<cntX<<endl<<cntY<<endl;
}

Measured memory_bytes: 23808
n=int(input())
l=list(set([int(input()) for d in range(n)]))  
a=l[0]
def gcd(a,s):
  a,s=min(a,s),max(a,s)
  if a==0:return s
  else:return gcd(s%a,a)

for i in l[1:]:
  a=a*i//gcd(a,i)
print(a)

Measured memory_bytes: 3060
#include <iostream>

int main() {
	int n[5];
	for(int i=0; i<5; i++)
		std::cin >> n[i];
	for(int i=4; i>0; i--){
		for(int j=0; j<i; j++){
			if(n[j] < n[j+1]){
				int t = n[j];
				n[j] = n[j+1];
				n[j+1] = t;
			}
		}
	}
	for(int i=0; i<5; i++){
		std::cout << n[i];
		if(i<4)
			std::cout << ' ';
		else
			std::cout << std::endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<string>
#include<cstring>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<bitset>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<long long, int> ll_i;

#define PI 3.141592653589793238462643383279
#define mod 1000000007LL
#define rep(i, n) for(i = 0;i < n;++i)
#define rep1(i, n) for(i = 1;i < n;++i)
#define per(i, n) for(i = n - 1;i > -1;--i)
#define int(x) int x; scanf("%d",&x)
#define int2(x, y) int x, y; scanf("%d%d",&x, &y)
#define int3(x, y, z) int x, y, z; scanf("%d%d%d",&x, &y, &z)
#define int4(v, x, y, z) int v, x, y, z; scanf("%d%d%d%d", &v, &x, &y, &z)
#define int5(v, w, x, y, z) int v, w, x, y, z; scanf("%d%d%d%d%d", &v, &w, &x, &y, &z)
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define kabe puts("---------------------------")
#define kara puts("")
#define debug(x) cout << " --- " << (x) << "\n"
#define debug2(x, y) cout << " --- " << (x) << " " << (y) << "\n"
#define debug3(x, y, z) cout << " --- " << (x) << " " << (y) << " " << (z) << "\n"
#define X first
#define Y second
#define eps 0.0001
#define prid(x) printf("%.15lf\n", x)

int t[100000];

signed main(void){
  int i, j;
  for(int testcase = 0;testcase >= 0;testcase++){
    int3(n, c, k);
    rep(i, n)scanf("%d", t+i);
    sort(t, t + i);

    int res = 0, now = -k, cnt = 0;
    for(i = 0;i < n;++i){
      if(cnt > 0 && cnt < c && t[i] <= now + k)++cnt;
      else{
        now = t[i];
        ++res;
        cnt = 1;
      }
    }
    pri(res);

/*/

//*/ break;
  }
  return 0;
}


Measured memory_bytes: 640
#include "bits/stdc++.h"

#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

using namespace std;

using LL = long long int;
using LD = long double;

using pii = pair<int, int>;
using pll = pair<LL, LL>;
using pdd = pair<double, double>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vl = vector<LL>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vs = vector<string>;
using vb = vector<bool>;
using vvb = vector<vb>;

const int INF = (1 << 30) - 1;
const LL INF64 = ((LL)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
LL gcd(LL x, LL y) { return y ? gcd(y, x % y) : x; }

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

	int rectangle = 0, diamondShape = 0;

	int a, b, c; char c1, c2;
	while (cin >> a >> c1 >> b >> c2 >> c) {
		if (a == b) {
			diamondShape++;
		} else if (a * a + b * b == c * c) {
			rectangle++;
		}
	}

	cout << rectangle << endl;
	cout << diamondShape << endl;
	return 0;
}

Measured memory_bytes: 3136
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	int a, b;
	cin >> a >> b;
	cout << (a - 1) * (b - 1) << endl;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
def sort_number(N,S):
    a=1
    for k in range(0,N,1):
        j=min(S)
        r=S.pop(0)
        if j!=r:
            l=0
            for i in S:
                if i < r:l+=1
            a+=l*math.factorial(N-k-1)
    return a
# 整数の入力
import math
N = int(input())
P = [int(i) for i in input().split()]
Q = [int(i) for i in input().split()]
a=sort_number(N,P)
b=sort_number(N,Q)
c=int(math.fabs(a-b))
print(c)


Measured memory_bytes: 3064
h,w = map(int,input().split())
m = [input() for _ in range(h)]
vx = [0,1,1,1,0,-1,-1,-1]
vy = [1,1,0,-1,-1,-1,0,1]
ans = [['#']*w for _ in range(h)]
for i in range(h):
    for j in range(w):
        if m[i][j] == '#':
            ans[i][j] = '#'
            continue
        count = 0
        for k in range(8):
            ny = vy[k] + i
            nx = vx[k] + j
            if 0<=ny and ny<h and 0<=nx and nx<w:
                if m[ny][nx] == '#':
                    count += 1
        ans[i][j] = str(count)
for i in ans:
    print(''.join(i))

Measured memory_bytes: 9196
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int MOD = 1e9 + 7;
const int INF32 = 1<<30;
const ll INF64 = 1LL<<60;

int main()
{
	#ifndef ONLINE_JUDGE
	freopen(".in.txt", "r", stdin);
	freopen(".out.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n, x, t; cin >> n >> x >> t;
	cout << (n/x + (n % x != 0)) * t;

	return 0;
}

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

function main()
	k,t = readline() |> split |> parseMap
	a = readline() |> split |> parseMap
	m = 0
	for i in 1:t
		m = max(m,2*a[i]-k-1)
	end
	println(m)
end
main()


Measured memory_bytes: 167528