akhauriyash/Code-Regression huggingface dataset:
#![allow(non_snake_case, unused_mut)]
//use petgraph::unionfind::UnionFind;
use proconio::fastout;
use proconio::marker::*;
//use std::collections::HashMap;
//use std::collections::HashSet;

#[fastout()]
fn main() {
    proconio::input! {
        S:Chars
    }
    let mut r = 0usize;
    let mut l = 0usize;
    let mut start = 0usize;
    let mut ans = vec![0usize; S.len()];
    for i in 0..S.len() {
        if S[i] == 'L' {
            l += 1;
        }
        if S[i] == 'R' {
            if l == 0 {
                r += 1;
            } else {
                // println!("{},{},{}", start, r, l);
                // 集計。start+rの位置とその右に集まる。
                if (r + l) % 2 == 0 {
                    ans[start + r - 1] = (r + l) / 2;
                    ans[start + r] = (r + l) / 2;
                } else {
                    if r % 2 == 0 {
                        ans[start + r - 1] = (r + l) / 2;
                        ans[start + r] = (r + l) / 2 + 1;
                    } else {
                        ans[start + r - 1] = (r + l) / 2 + 1;
                        ans[start + r] = (r + l) / 2;
                    }
                }
                start = i;
                r = 1;
                l = 0;
            }
        }
    }
    if (r + l) % 2 == 0 {
        ans[start + r - 1] = (r + l) / 2;
        ans[start + r] = (r + l) / 2;
    } else {
        if r % 2 == 0 {
            ans[start + r - 1] = (r + l) / 2;
            ans[start + r] = (r + l) / 2 + 1;
        } else {
            ans[start + r - 1] = (r + l) / 2 + 1;
            ans[start + r] = (r + l) / 2;
        }
    }
    for i in 0..S.len() {
        print!("{} ", ans[i]);
    }
}


Measured memory_bytes: 3268
#include <iostream>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <utility>
#include <typeinfo>
using namespace std;

#define MOD 1000000007
#define INF 1e9+7
#define INF_LONG 1e18
#define rep(i, n) for(int i=0; i<n; ++i)
#define rrep(i, m, n) for(int i=m; i<n; ++i)
typedef long long ll;

#define MAX_N 200000
#define MAX_M 100000
#define MAX_V 100
#define MAX_E 100
#define MAX_Q 100000

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

int ddx[] = {-1, 0, 1, 0, -1, 1, -1, 1};
int ddy[] = {0, -1, 0, 1, 1, 1, -1, -1};

ll gcd(ll x, ll y) {
  if(y==0) return x;
  else return gcd(y, x%y);
}

ll lcm(ll x, ll y) {
  return (x*y)/gcd(x, y);
}

//--------------------------

int main() {

  int n; cin >> n;
  int x[n]; rep(i, n) cin >> x[i];
  int sum = 0;
  int min = INF;

  rep(i, 101) {
    sum = 0;
    rep(j, n) {
      sum += (x[j]-i)*(x[j]-i);
    }
    if(min>sum) min = sum;
  }

  cout << min << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <complex>
#include <valarray>
#include <fstream>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <random>

#define _overload(a, b, c, d, ...) d
#define _rep1(X, A, Y) for (int (X) = (A);(X) <= (Y);++(X))
#define _rep2(X, Y) for (int (X) = 0;(X) < (Y);++(X))
#define rep(...) _overload(__VA_ARGS__, _rep1, _rep2)(__VA_ARGS__)
#define rrep(X,Y) for (int (X) = Y-1;(X) >= 0;--(X))
#define all(X) (X).begin(),(X).end()
#define len(X) ((int)(X).size())
#define mod(n, m) (((n)%(m)+(m))%m)
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
const int INFINT = 1 << 30;                          // 1.07x10^ 9
const ll INFLL = 1LL << 60;                          // 1.15x10^18
const double EPS = 1e-10;
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

const int MAX_N = 20;
int N;
int A[MAX_N], B[MAX_N], C[MAX_N];

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

  cin >> N;
  rep(i, N) cin >> A[i];
  rep(i, N) cin >> B[i];
  rep(i, N-1) cin >> C[i];

  rep(i, N) --A[i];

  int ans = B[A[0]];
  for (int i = 1; i < N; ++i) {
    ans += B[A[i]];
    if (A[i]-A[i-1] == 1) ans += C[A[i-1]];
  }

  cout << ans << endl;

  return 0;
}


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

long long int n,m,k,gt[200010],tu[200010],c[200010],mod,i,ans;

long long int p(long long int a,long long int b)
{
	if (b==0) return 1;
	if (b==1) return a;
	long long int x=p(a,b/2);x=(x*x)%mod;
	if (b%2==0) return x;else return (x*a)%mod;
}

signed main()
{
    ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	cin>>n>>m>>k;
	mod=998244353;ans=0;
	gt[0]=1;
	for (i=1;i<n;i++) gt[i]=(gt[i-1]*i)%mod;
	tu[0]=1;
	for (i=1;i<n;i++) tu[i]=(tu[i-1]*(n-i))%mod;
	for (i=0;i<n;i++) c[i]=(tu[i]*p(gt[i],mod-2))%mod;
	for (i=0;i<k+1;i++) ans=(ans+(c[i]*p(m-1,n-i-1))%mod)%mod;
	ans=(ans*m)%mod;
	cout<<ans;
}


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

int main()
{
	int Soma;
	int Subtrai;
	int Multiplica;
	int A,B;
	
	cin>>A>>B;
	
	Soma = A+B;
	Subtrai = A-B;
	Multiplica= A*B;
	
	if(Soma > Subtrai && Soma > Multiplica){
		cout<<Soma<<endl;
	}
	else
	{
		if(Subtrai > Multiplica){
			cout<<Subtrai<<endl;
		}
		else{
			cout<<Multiplica<<endl;
		}
	}
	
	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;
using P=pair<int,int>;


int main(){
   int n; cin>>n;
   vector<int> a(n);
   rep(i,n) cin>>a[i];
   vector<int> b(n);
   rep(i,n) b[i]=a[i];
   sort(b.begin(),b.end());
   rep(i,n){
      if(a[i]!=b[n-1]) cout<<b[n-1]<<endl;
      else cout<<b[n-2]<<endl;
   }
   return 0;
}

   


Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main(){    
  ll A, B, C, D;
  cin >> A >> B >> C >> D;
  if(B <= C || D <= A) cout << 0 << endl;
  else if(A <=  C && C <= B && B <= D) cout << B - C << endl;
  else if(A <= C && D <= B) cout << D - C << endl;
  else if(C <= A && B <= D) cout << B - A << endl;
  else if(C <= A && A <= D && D <= B) cout << D - A << endl;
  
}


Measured memory_bytes: 256
import bisect
N = int(input())
A = sorted(list(map(int,input().split())))

ans = 0
for k in range(N-1,-1,-1):
    t = A[k]
    for d in range(1,32):
        if A[0] <= 2**d - t <= A[k]:
            i = bisect.bisect_left(A,2**d-t)
            if A[i] == 2**d-t and k != i:
                ans += 1
                A[k] += 0.01
                A[i] -= 0.01

print(ans)


Measured memory_bytes: 97412
#include<stdio.h>
 
int min(int x,int y)
{
    if(y<x) return y;
    return x;
}
 
int main(void)
{
    int i,j,N,M,d[1000],C[1000],dp[1001][1001],s;
    scanf("%d%d",&N,&M);
    for(i=0;i<N;i++)
    {
        scanf("%d",&d[i]);
    }
    for(i=0;i<M;i++)
    {
        scanf("%d",&C[i]);
    }
    dp[0][0]=0;
    for(i=1;i<N+1;i++)
    {
        dp[i][i]=dp[i-1][i-1]+d[i-1]*C[i-1];
    }
    for(i=1;i<M+1;i++)
    {
        dp[0][i]=0;
    }
    for(i=1;i<N+1;i++)
    {
        for(j=i+1;j<M+1;j++)
        {
            dp[i][j]=min(dp[i-1][j-1]+d[i-1]*C[j-1],dp[i][j-1]);
        }
    }
    s=-1;
    for(i=N;i<M+1;i++)
    {
        if(s<0 || dp[N][i]<s) s=dp[N][i];
    }
    printf("%d\n",s);
    return 0;
}

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

int main(void){
    int n,k;
    cin >> n >> k;
    vector<int> x(n);
    for(int i=0; i<n; i++){
        cin >> x.at(i);
    }

    long long ans = 9223372036854775807;
    int dis;
    for(int i=0; i<=n-k; i++){

        dis = x.at(i+k-1) - x.at(i) + min(abs(x.at(i)), abs(x.at(i+k-1)));

        if(dis < ans){
            ans = dis;
        }
    }

    cout << ans << endl;

    return 0;

}

Measured memory_bytes: 640
def solve():
    N, *sl = map(lambda x: int(x), open(0).read().split())
    ans = "Yes"
    s_max = sl[0]
    for i in range(1, N):
        a = sl[i]
        if s_max > a + 1:
            ans = "No"
            break
        s_max = max(s_max, a)
    print(ans)  
if __name__ == '__main__':
    solve()

Measured memory_bytes: 14108
input = gets.chomp
a,b,c,d = input.split.collect{ |item| item.to_i}

result = 0
abmax = b-a+1
cmin = a%c == 0 ? a/c : a/c + 1
cmax = b/c
pop_for_c = cmax - cmin + 1
pop_for_c = 0 if cmin > cmax
dmin = a%d == 0 ? a/d : a/d + 1
dmax = b/d
pop_for_d = dmax - dmin + 1
pop_for_d = 0 if dmin > dmax

cd = c.lcm(d)
cdmin = a%(cd) == 0 ? a/(cd) : a/(cd)+1
cdmax = b/(cd)
plus_for_cd = cdmax - cdmin + 1
plus_for_cd = 0 if cdmin > cdmax

result = abmax - pop_for_c - pop_for_d + plus_for_cd
puts result

Measured memory_bytes: 3836
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
	string s;
	cin>>s;
	sort(s.begin(),s.end());
	if(s=="abc"){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
	return 0;
}

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

vector<vector<int>> adj;
vector<int> dp;

int longestPath(int node) {
    if(dp[node] >= 0) return dp[node];
    dp[node] = 0;
    for(int neigh : adj[node])
        dp[node] = max(longestPath(neigh) + 1, dp[node]);
    return dp[node];
}

int main() {
    int n, m;
    cin>>n>>m;
    adj.resize(n);
    dp.resize(n, -1);
    for(int i=0; i<m; i++) {
        int u, v;
        cin>>u>>v;
        adj[u-1].push_back(v-1);
    }
    int ans = 0;
    for(int i=0; i<n; i++) ans = max(longestPath(i), ans);
    cout<< ans <<endl;
    return 0;
}


Measured memory_bytes: 8192
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#include <list>

using namespace std;

typedef long long ll;
typedef long double ld;

#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define mii map<int,int>
#define mis map<int,string>
#define msi map<string,int>
#define mll map<ll,ll>
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep1(i,n) for(int i=1; i<=(int)(n); i++)
#define all(c) c.begin(),c.end()
#define srta(a) sort(all(a))
#define srtd(a) sort(all(a),greater<型>())
#define rvs(s) reverse(all(s))
#define psb push_back
#define ppb pop_back
#define isu isupper
#define isl islower
#define lb(a,k) lower_bound(all(a),k)
#define ub(a,k) upper_bound(all(a),k)
#define bs(a,k) binary_search(all(a),k)

const int I_INF = 1001001001;
const ll LL_INF = 1001001001001001001;
const ld EPS = 0.001;



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

    int ans = 0;
    int rem = (N%1000);
    ans = 1000 - (rem > 0 ? rem : 1000);
    cout << ans << endl;
}


Measured memory_bytes: 3608
N, K = map(int, input().split())
A = [int(i) for i in input().split()]
A.sort()

s = sum(A)
i = 1
q1 = []
q2 = []
while i * i <= s :
    if s % i == 0 :
        q1.append(i)
        if i * i != s :
            q2.append(s//i)
    i += 1
prime = q2 + q1[::-1]

def solve() :
    for p in prime :
        m = [a%p for a in A]
        m.sort()
        
        dpl = [0] * N
        dpr = [0] * N
        
        dpl[N-1] = p - m[N-1]
        dpr[0] = m[0]
        for i in range(N-2, -1, -1) :
            dpl[i] = dpl[i+1] + p - m[i]
        for i in range(1, N) :
            dpr[i] = dpr[i-1] + m[i]
        n = float('inf')
        for i in range(1, N) :
            n = min(n, max(dpl[i], dpr[i-1]))
        if n <= K :
            return p
            
print(solve())

Measured memory_bytes: 43372
#include<bits/stdc++.h>
using namespace std;
int main(){
    string a;
    cin>>a;
    int cnt=0;
    for(int i=0;i<a.size();i++){
        if(a[i]=='C'){
            cnt=1;
        }
        if(a[i]=='F'&&cnt==1){
            cout<<"Yes";
            return 0;
        }
    }
    cout<<"No";
    return 0;
}

Measured memory_bytes: 384
##templete
n, k = gets.chomp.split(" ").map { |e|  e.to_i }
s = gets.chomp

nums = []
num = "1"
count = 0

for i in 0..n-1 do
  if s[i] == num
    count += 1
  else
    nums.push(count)
    num = ((num.to_i + 1) % 2).to_s  #文字の切り替え
    count = 1
  end
end

nums.push(count)

if nums.length % 2 == 0
  nums.push(0)
end

add = 2 * k + 1

left = 0
right = 0
tmp = 0 # [reft, right)のsum
ans = 0

0.step(nums.length-1, 2) do |i|

  nextleft = i
  nextright = [i + add, nums.length].min

  # 左端の移動
  while nextleft > left
    tmp -= nums[left]
    left += 1
  end

  # 右端の移動
  while nextright > right
    tmp += nums[right]
    right += 1
  end
  ans = ans > tmp ? ans : tmp
end

puts ans


Measured memory_bytes: 2812
package main

import (
	"bytes"
	"fmt"
)

func main() {
	var s string
	fmt.Scan(&s)
	var buffer bytes.Buffer
	for i := 0; i < len(s); i++ {
		if i%2 == 0 {
			buffer.WriteByte(s[i])
		}
	}
	fmt.Println(buffer.String())
}


Measured memory_bytes: 1664
#include <iostream>
using namespace std;
int main(void){
    int a,b,c,d,p;
    int X,Y;
    cin >> a >> b >> c >> d >> p;
    X = a*p;
    if(p<=c){
        Y = b;
    }else{
        Y = b + (p-c)*d;
    }
    if(X<Y){
        cout << X <<endl;
    }else{
        cout << Y << endl;
    }
    
}


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

# define REP(i,n) for(int i=0; i<n; i++)

using namespace std;

int main(){
	string s, sub, po;
	int K, len;
	vector<string> subs, sorted;
	
	cin >> s >> K;
	len = s.length();
	K--;
	
	REP(i,len){
		sub = s[i];
		subs.push_back(sub);
		for (int l=1; l<=4; l++){
			if (i+l<len){
				sub += s[i+l];
				subs.push_back(sub);
			}
		}
	}
	
	sort(subs.begin(), subs.end() );
	
	po = subs.front();
	sorted.push_back(subs.front());
	
	REP(i,subs.size()){
		//cout << po << " " << subs[i] << " " << subs[i].length();
		if (subs[i]!=po){
			sorted.push_back(subs[i]);
			//cout << " pushed " << subs[i];
			po = subs[i];
		}
		//cout << endl;
	}
	
	//REP(i, sorted.size()) cout << sorted[i] << " ";
	//cout << endl;
	
	cout << sorted[K] << endl;
  	
  	return 0;
}


Measured memory_bytes: 1916
#include<iostream>

using namespace std;

int main(){

	int A, B;
  	cin >> A >> B;
  	int count = 0;
  
  	int outlet = 1;
  
  	while( B > outlet ){
     	outlet = outlet - 1;
      	outlet = outlet + A;
      	count = count + 1;
    }
  
  cout << count << endl;
  
  
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;

int main(){
  int n, k, q;
  cin >> n >> k >> q;
  vector<int> p(n, k-q);
  rep(i, q){
    int a;
    cin >> a;
    a--;
    p[a]++;
  }
  
  rep(i, n){
    if (p[i] > 0) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 3756
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics; 

class _Class
{
  void _Do()
  {
    var N = Split.ints()[0];
    var a = Split.ints();
    long ret = 0;
    for (int i=0;i<N;i++ )
    {
      for(;;)
      {
        if (a[i] % 2 == 1)
          break;
        a[i] /= 2;
        ret++;
      }
    }
    Console.WriteLine(ret);
  }


  //
  static void Main(string[] args)
  {
    _(args);
    new _Class()._Do();
  }

  [Conditional("DEBUG")]
  static void _(string[] args)
  {
    if (args.Length != 0 && File.Exists(args[0]))
      Console.SetIn(new StreamReader(args[0]));
    else
      Console.Error.WriteLine("in");
  }
}

static class Split
{


  // 1
  public static string[] strings()
  {
    return Console.ReadLine().Split();
  }


  // [2.1] -2,147,483,648 ~ +2,147,483,647
  public static int[] ints()
  {
    var _s = Console.ReadLine().Split();

    var x = new int[_s.Length];
    for (var i = 0; i < _s.Length; i++)
      x[i] = int.Parse(_s[i]);

    return x;
  }

  // [2.2] 
  // -9,223,372,036,854,775,808 ~ 
  // +9,223,372,036,854,775,807
  public static long[] longs()
  {
    var _s = Console.ReadLine().Split();

    var x = new long[_s.Length];
    for (var i = 0; i < _s.Length; i++)
      x[i] = long.Parse(_s[i]);

    return x;
  }

  public static double[] doubles()
  {
    var _s = Console.ReadLine().Split();

    var x = new double[_s.Length];
    for (var i = 0; i < _s.Length; i++)
      x[i] = double.Parse(_s[i]);

    return x;
  }

  public static BigInteger[] bigs()
  {
    var _s = Console.ReadLine().Split();

    var x = new BigInteger[_s.Length];
    for (var i = 0; i < _s.Length; i++)
      x[i] = BigInteger.Parse(_s[i]);

    return x;
  }
}

Measured memory_bytes: 11744
#D
w,h=map(int,input().split())
s=[input() for i in range(w)]
t=[[[],[]] for j in range(w)]
for i in range(w):
    k=0
    for j in range(h):
        if s[i][j]==".":
            k+=1
        else:
            t[i][0]+=[k for _ in range(k)]+[0]
            k=0
    t[i][0]+=[k for _ in range(k)]
for i in range(h):
    k=0
    for j in range(w):
        if s[j][i]==".":
            k+=1
        else:
            for l in range(1,k+1):
                t[j-l][1]+=[k]
            t[j][1]+=[0]
            k=0
    for l in range(1,k+1):
        t[w-l][1]+=[k]
answer=0
for i in range(w):
    for j in range(h):
        answer=max(t[i][0][j]+t[i][1][j],answer)
print(answer-1)

Measured memory_bytes: 236292
#![allow(unused_imports)]
#![allow(unused_macros)]
use std::cmp::{max, min};
use std::collections::*;
use std::io::{stdin, Read};

#[allow(unused_macros)]
macro_rules! parse {
    ($it: ident ) => {};
    ($it: ident, ) => {};
    ($it: ident, $var:ident : $t:tt $($r:tt)*) => {
        let $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
    ($it: ident, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
}

#[allow(unused_macros)]
macro_rules! parse_val {
    ($it: ident, [$t:tt; $len:expr]) => {
        (0..$len).map(|_| parse_val!($it, $t)).collect::<Vec<_>>();
    };
    ($it: ident, ($($t: tt),*)) => {
        ($(parse_val!($it, $t)),*)
    };
    ($it: ident, u1) => {
        $it.next().unwrap().parse::<usize>().unwrap() -1
    };
    ($it: ident, $t: ty) => {
        $it.next().unwrap().parse::<$t>().unwrap()
    };
}

#[cfg(debug_assertions)]
macro_rules! debug {
    ($( $args:expr ),*) => { eprintln!( $( $args ),* ); }
}

#[cfg(not(debug_assertions))]
macro_rules! debug {
    ($( $args:expr ),*) => {
        ()
    };
}

fn solve(s: &str) {
    let mut it = s.split_whitespace();
    parse!(it, l: usize, r: usize, d: usize);
    println!("{}", r / d - (l - 1) / d);
}

fn main() {
    let mut s = String::new();
    stdin().read_to_string(&mut s).unwrap();
    solve(&s);
}

#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn test_input() {
        let s = "
        ";
        solve(s);
    }
}


Measured memory_bytes: 2044
S = input()

if S == "abc":
    print("Yes")
elif S == "bac":
    print("Yes")
elif S == "acb":
    print("Yes")
elif S == "bca":
    print("Yes")
elif S == "cab":
    print("Yes")
elif S == "cba":
    print("Yes")
else:
    print("No")


Measured memory_bytes: 8976
n = int(input())
l = list(map(int, input().split()))
l.sort()
fir = l[0]
sec = l[1]
lfir = []
for i in range(1,int(fir**.5)+2):
  if fir % i == 0:
    lfir.append(i)
    lfir.append(fir//i)
for i in range(1,int(sec**.5)+2):
  if sec % i == 0:
    lfir.append(i)
    lfir.append(sec//i)
ok = 1
lfir = sorted(list(set(lfir)))
for i in lfir:
  cnt = 0
  for j in l:
    if j%i:
      cnt += 1
  if cnt < 2:
    ok = i
print(ok)

Measured memory_bytes: 14584
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
#define ll  long long
#define vi vector<int>
#define loop(i,n) for(int i=0;i<n;i++)
#define loop1(i,n) for(int i=1;i<=n;i++)
#define revloop(i,n) for(int i=n-1;i>=0;i--)
#define revloop1(i,n) for(int i=n;i>=1;i--)
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define vpii vector< pair<int,int> >
#define ff first
#define ss second
#define print(x) printf("%.9Lf\n",x)
#define MOD 1000000007
#define MAX 100005
#define MAX6 1000005
#define MAX3 1005
#define nw cout<<endl
#define lc 2*node+1
#define rc 2*node+2
#define PRINT(v) for(int i=0;i!=v.size();i++)cout<<v[i]<<" "
#define modInverse(x) power(x,MOD-2)
#define MINIMUM -100000000000000
#define svec(vct) sort(vct.begin(),vct.end())
#define what_is(qq) cerr << #qq << " is " << qq << endl
#define BIG 1e11
#define S1(xz) scanf("%d",&xz)
using namespace std;
#define MAX4 1025
#define LOW -10000000000


int main()
{

    //freopen("A.in","r",stdin);
    //freopen("B.out","w",stdout);

    int T,x,y,z;

    //scanf("%d",&T);
    T=1;
    for(int tc=1; tc<=T; tc++)
    {
        int a,b;cin>>a>>b;
        cout<<max(a-b,(max(a*b,a+b)))<<endl;













    }



}


Measured memory_bytes: 256
/* Dynamic Programming implementation of LCS problem */
#include<iostream>
#include<cstring>
#include<cstdlib>
using namespace std;

/* Returns length of LCS for X[0..m-1], Y[0..n-1] */
void lcs( char *X, char *Y, int m, int n )
{
   int L[m+1][n+1];

   /* Following steps build L[m+1][n+1] in bottom up fashion. Note
      that L[i][j] contains length of LCS of X[0..i-1] and Y[0..j-1] */
   for (int i=0; i<=m; i++)
   {
     for (int j=0; j<=n; j++)
     {
       if (i == 0 || j == 0)
         L[i][j] = 0;
       else if (X[i-1] == Y[j-1])
         L[i][j] = L[i-1][j-1] + 1;
       else
         L[i][j] = max(L[i-1][j], L[i][j-1]);
     }
   }

   // Following code is used to print LCS
   int index = L[m][n];

   // Create a character array to store the lcs string
   char lcs[index+1];
   lcs[index] = '\0'; // Set the terminating character

   // Start from the right-most-bottom-most corner and
   // one by one store characters in lcs[]
   int i = m, j = n;
   while (i > 0 && j > 0)
   {
      // If current character in X[] and Y are same, then
      // current character is part of LCS
      if (X[i-1] == Y[j-1])
      {
          lcs[index-1] = X[i-1]; // Put current character in result
          i--; j--; index--;     // reduce values of i, j and index
      }

      // If not same, then find the larger of two and
      // go in the direction of larger value
      else if (L[i-1][j] > L[i][j-1])
         i--;
      else
         j--;
   }

   // Print the lcs
   cout <<lcs;
}

/* Driver program to test above function */
int main()
{

  char X[3001],Y[3001];
  cin>>X>>Y;
  int m = strlen(X);
  int n = strlen(Y);
  lcs(X, Y, m, n);
  return 0;
}


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

using ll = long long;

template <typename T> T inf;
template <> constexpr int inf<int> = 1e9;
template <> constexpr ll inf<ll> = 1e18;

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    for(int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    sort(A.begin(), A.end());
    int last = 0;
    ll sum = 0;
    for(int i = 0; i + 1 < N; ++i) {
        if((sum + A[i]) * 2 < A[i + 1]) {
            last = i + 1;
        }
        sum += A[i];
    }
    cout << N - last << endl;
}


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

using namespace std;

const int maxn = 400;
const int inf = 0x3f3f3f3f;
int n, m, l, a, b, c, dist[maxn][maxn], x[maxn][maxn], q, s, t;

int main() {
	ios::sync_with_stdio(false); cin.tie(0);
	cin >> n >> m >> l;
	memset(dist, inf, sizeof(dist));
	memset(x, inf, sizeof(x));
	for (int i = 0; i < m; ++i) {
		cin >> a >> b >> c;
		if (c > l) continue;
		dist[a][b] = dist[b][a] = c;
	}
	for (int k = 1; k <= n; ++k) {
		for (int i = 1; i <= n; ++i) {
			for (int j = 1; j <= n; ++j) {
				dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
			}
		}
	}
	for (int i = 1; i <= n; ++i) {
		for (int j = 1; j <= n; ++j) {
			if (dist[i][j] <= l) x[i][j] = 1;
		}
	}
	for (int k = 1; k <= n; ++k) {
		for (int i = 1; i <= n; ++i) {
			for (int j = 1; j <= n; ++j) {
				x[i][j] = min(x[i][j], x[i][k] + x[k][j]);
			}
		}
	}
	cin >> q;
	while (q--) {
		cin >> s >> t;
		int ans = (x[s][t] > n ? 0 : x[s][t]);
		cout << (ans - 1) << '\n';
	}
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
const int MAXN=10001;
int a[MAXN],b[MAXN];
int main()
{
	int n,m,x,y;
	cin>>n>>m>>x>>y;
	for(int i=0;i<n;i++)
	scanf("%d",&a[i]);
	for(int i=0;i<m;i++)
	scanf("%d",&b[i]);
	sort(a,a+n);
	sort(b,b+m);
	int flag=0;
	for(int i=a[n-1]+1;i<=b[0];i++)
	{
		if(x<i&&y>=i)
		{
			flag=1;
			break;
		}
	}
	if(flag)
	cout<<"No War"<<endl;
	else
	cout<<"War"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
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<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const ll MOD = 1000000007;
const double EPS = 1e-9;
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;



int main(void) {

    int h,w;
    cin>>h>>w;
    vvi a(h,vi(w));
    vvi b(h,vi(w));
    rep(i,h)rep(j,w)cin>>a[i][j];
    rep(i,h)rep(j,w)cin>>b[i][j];

    vvi v(h,vi(w));
    const int D=80*160+10;
    rep(i,h)rep(j,w)v[i][j]=abs(a[i][j]-b[i][j]);

    bitset<D*2> dp[h+10][w+10];
    
    dp[0][0][D+v[0][0]]=1;
    dp[0][0][D-v[0][0]]=1;


    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(i)dp[i][j] |= dp[i-1][j] << v[i][j];
            if(i)dp[i][j] |= dp[i-1][j] >> v[i][j];
            if(j)dp[i][j] |= dp[i][j-1] << v[i][j];
            if(j)dp[i][j] |= dp[i][j-1] >> v[i][j];
        }
    }
    
    for(int i=0;i<D;i++){
        if(dp[h-1][w-1][D+i]||dp[h-1][w-1][D-i]){
            fin(i);
            break;
        }
    }
}


Measured memory_bytes: 25728
N = int(input())
a = [0]
for i in range(N):
    a.append(int(input()))
haspushed = [0]*(N+1)
reach = 0
itr = 1
i = a[1]
haspushed[1] = 1
while haspushed[i] == 0:
    haspushed[i] = 1
    if i == 2:
        reach=1
        break
    i = a[i]
    itr += 1

if reach == 1:
    print(itr)
else:
    print(-1)

Measured memory_bytes: 7848
#!/usr/bin/env python
import os
import sys
from io import BytesIO, IOBase


def main():
    s=input()
    print("ABC" if s=="ARC" else "ARC")

# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()

Measured memory_bytes: 62528
#include <iostream>
#include <vector>

using namespace std;
using ll = long long;
const int limit = 100010;
using edge = struct {int to; ll cost;};

vector<edge> tree[limit];
ll depth[limit];

void dfs(int v, int p, ll d) {
    depth[v] = d;
    for (auto &e : tree[v]) {
        if (e.to == p) continue;
        dfs(e.to, v, d + e.cost);
    }
}

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

    for (int i = 0; i < n - 1; ++i) {
        int a, b, c;
        cin >> a >> b >> c;
        a--, b--;
        tree[a].push_back({b, c});
        tree[b].push_back({a, c});
    }

    int q, k;
    cin >> q >> k;
    k--;

    dfs(k, -1, 0);
    for (int i = 0; i < q; ++i) {
        int x, y;
        cin >> x >> y;
        x--, y--;
        cout << depth[x] + depth[y] << endl;
    }

    return 0;
}

Measured memory_bytes: 14336
#include<cstdio>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main(){
	int h,w; scanf("%d%d",&h,&w);

	static int a[1000][1000];
	int row[1000]={},col[1000]={};
	rep(i,h) rep(j,w) {
		scanf("%d",a[i]+j);
		if(a[i][j]==0){
			row[i]++;
			col[j]++;
		}
	}

	rep(i,h) rep(j,w) printf("%d%c",(row[i]+col[j]+a[i][j]+1)%2,j<w-1?' ':'\n');

	return 0;
}

Measured memory_bytes: 4676
#include <bits/stdc++.h>
using namespace std;
using vec = vector<int>;
using intk = int64_t;

int main() {
	int N,M;
  cin >> N>>M;
  vec S(M,0);
  for(int i=0;i<N;i++){
   int k;
    cin >> k;
    vec A(k);
    for(int j=0;j<k;j++) cin >> A[j];
    for(int j=0;j<k;j++){
	S[A[j]-1]++;
    }
  }
  int ans =0;
  
  for(int i=0;i<M;i++){
    if(S[i] == N) ans++;
  }
  cout << ans <<endl;
}
  


Measured memory_bytes: 256
fn read() -> (String, String) {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let mut ite = s.trim().split_whitespace();
    let a = ite.next().unwrap().to_string();
    let b = ite.next().unwrap().to_string();
    (a, b)
}

fn main() {
    let (a, b) = read();
    println!("{}", if a == b { "H" } else { "D" });
}

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


void solve() {
	string s;
	int n, k, cnt = 0, ans = 0, sz = 0;

	cin >> n >> k >> s;

	char ls = s[0];
	for (auto c : s) {
		if (c != ls) {
			ans += cnt - 1;
			++sz;
			cnt = 0;
		}
		++cnt; ls = c;
	}
	ans += cnt - 1;
	++sz;
	//cout << ans << endl;
	for (++k; --k;)
		if (sz >= 3)++++ans, ----sz;
		else if (sz > 1)--sz, ++ans;

	cout << ans << endl;
}
int main() {
	solve();
	return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
      	String message = "";
        if (a < 1200) {
            message = "ABC";
        } else {
            message = "ARC";
        }
      System.out.println(message);
    }
}

Measured memory_bytes: 21588
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def abc138_d():
    N, _ = map(int, readline().strip().split())
    input_data = list(map(int, read().split()))
    AB = iter(input_data[:N+N-2])
    PX = iter(input_data[N+N-2:])

    # 隣接リスト作成
    graph = [[] for _ in range(N+1)]
    for a, b in zip(AB, AB):
        graph[a].append(b)
        graph[b].append(a)

    # クエリをもとにスコア加算　※頂点pだけに加算し、子へは加算しない
    val = [0] * (N+1)
    for p, x in zip(PX, PX):
        val[p] += x

    # DFSで根元から順に足していく
    stack = [1]
    visited = [False] * (N+1)
    visited[1] = True
    while stack:
        x = stack.pop()
        for y in graph[x]:
            if visited[y]: continue
            stack.append(y)
            visited[y] = True
            val[y] += val[x]

    print(*val[1:], sep=' ')

abc138_d()

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

int main(){

  int64_t X, K, D;
  cin >> X >> K >> D;

  int64_t n;
  int64_t Z0;

  if (X < 0){
    X = -X;
  }
  
  // 距離が0を下回る回数
  n = X / D;
  if (n*D != X){
    n++;
  }

  // n > Kなら0を下回れないので絶対値を計算して終了
  if (n > K){
    n = K;
    Z0 = X - n*D;
    if (Z0 < 0){
      Z0 = -Z0;
    }
    cout << Z0 << endl;
    return 0;
  }

  Z0 = X - n * D;

  // (nが偶数かつKも偶数) || (nが奇数 && Kも奇数)なら後は行って元の位置に戻るだけ
  if (((n ^ K) & 1) == 0){
    ;
  }else{
    // もう一回移動しなければならない
    if (Z0 >= 0){
      Z0 -= D;
    }else{
      Z0 += D;
    }
  }

  if (Z0 < 0){
    Z0 = -Z0;
  }
  cout << Z0 << endl;
  
  return 0;
}


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

int main()
{
  int k;
  cin>>k;
  
  int a,b;
  cin>>a>>b;
  
  int x;
  for(int i=a;i<=b;i++)
  {
       if(i%k==0)
         x++;
  }
  
  
  if(x>0)
    cout<<"OK"<<endl;
  else
    cout<<"NG"<<endl;
  
  return 0;}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define INF 100000000
typedef long long ll;

int main(){
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<min(a,b)+min(c,d)<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
#include <deque>
#include <stack>
#include <queue>
#define ll long long
#define start() ll z;scanf("%d",&z);while(z--)
#define fo(var, start, end) for(var = start; var < end; var++)
#define foo(var, start, end) for(var = start; var < = end; var++)
#define fi(var, end, start) for(var = end; var >=start ; var--)
using namespace std;
void solve(){
}
int main() {
//    start(){
//        solve();
//    }
    int a,b;
    scanf("%d%d",&a,&b);
    if(a<=b) printf("unsafe");
    else printf("safe");
    return 0;
}

Measured memory_bytes: 3228
#include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define FOR(x,st,n) for(int x = (st); x < (n); ++ x)
#define mem0(a) memset(a,0,sizeof(a))
#define mem_1(a) memset(a,-1,sizeof(a))
#define mem0x(a) memset(a,0x3f,sizeof(a))
#define MAX(a,b) (a)>(b)?(a):(b)
#define MIN(a,b) (a)<(b)?(a):(b)
#define INF 0x7f7f7f7f
using namespace std;


typedef long long ll;
//typedef __int64_t i64;
typedef long long unsigned llu;
typedef pair<int,int> P;
typedef vector<P> vp;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vi> vvi;
const int N = 50001;

//int n,m,q,k,sum=0;

//int cot[N];


int main(){
    
    int n,m,q;
    int a,b,c,tmp;
    ll sum;

    //string opt;
    cin>>n>>m;
    sum=0;
    priority_queue<int,vi,greater<int>> pq;
    FOR(i,0,n){
        cin>>tmp;
        sum+=tmp;
        
        if(n>m && m!=0){
            if(pq.size()<m ){
                pq.push(tmp);
                continue;
            }
            if(pq.size()==m ){
                if(tmp<  pq.top()) continue;

                pq.pop();
                pq.push(tmp);
            }
        }

    }
    if(m>=n){
        cout<<0<<endl;
        return 0;
    }

   // cout<<m<<" "<<pq.size()<<endl;
    while(!pq.empty()){
        
        sum-= pq.top();
        pq.pop();
    }
    printf("%lld\n",sum);
    
    return 0;
}


Measured memory_bytes: 1400
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define P pair<int,int>
const LL inf = 0x3f3f3f3f;
const LL mod = 1e9+7;
const LL N = 1e5+10;
template <typename tp> inline void read(tp &x)
{
	x=0;char c=getchar();int f=0;
	for(;c>'9'||c<'0';f|=(c=='-'),c=getchar());
	for(;c<='9'&&c>='0';x=(x<<3)+(x<<1)+c-'0',c=getchar());
	if(f) x=-x;
}
int n,m,ans;
int from,to,now[N],q[N];
int main()
{
	read(n),read(m);
	for(int i=1;i<=n;i++) q[i]=1; now[1]=1;
	for(int i=1;i<=m;i++)
	{
		read(from),read(to);
		if(q[from]==1&&now[from]==1) now[from]=0,now[to]=1;
		else if(now[from]==1) now[to]=1;
		q[from]--,q[to]++;
	}
	for(int i=1;i<=n;i++) if(now[i]) ans++;
	printf("%d\n",ans);
	return 0;
}

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

int main() {
ll a=100;
ll x;
cin>>x;
ll count=0;
while (a<x)
{
  count++;
  a*=1.01;
}
cout<<count<<endl;


}
/*vector <int> a(3);
for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }*/

Measured memory_bytes: 3636
#include <stdio.h>
#include <math.h>
#include <string.h>
#define pai 3.1415926535

	int main(void) {
		int N;
		scanf("%d", &N);
		if (N / 100 == N % 10) {
			printf("Yes");
		}
		else {
			printf("No");
		}
		return 0;
}
	

Measured memory_bytes: 128
#include <stdio.h>
int fibonacci(int *, int);
  
int main(){
  int f[45];
  int i,n;
    
  scanf("%d",&n); 
  for(i = 0;i <= n;i++){ 
    f[i] = 0;
  }
    printf("%d\n",fibonacci(f, n));

    
  return 0;
}

int fibonacci(int *f, int n){
  if(n == 0 || n == 1){
    return f[n] = 1;
  }
  else if(f[n] != 0) return f[n];
  else return f[n] = fibonacci(f, n - 2) + fibonacci(f, n - 1);
}



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

int main() {
    int w = 1, h = 1;
    while (w != 0 && h != 0) {
        cin >> h >> w;
        if (w == 0 && h == 0) break;
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                cout << '#';
            }
            cout << '\n';
        }
        cout << '\n';
    }
}


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

int main(){
  int N;
  cin >> N;
  vector<int> B(N-1);
  for(int i=0;i<N-1;i++){
    cin >> B.at(i);
  }
  long long sum=B.at(0)+B.at(N-2);
  for(int i=0;i<N-2;i++){
    sum+=min(B.at(i),B.at(i+1));
  }
  cout << sum << endl;
}   

Measured memory_bytes: 3604
#include <bits/stdc++.h>
  using namespace std;
#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007


int main() {
	
	int A,B,C;
	cin>>A>>B>>C;
	if(A==B&&B==C){
		ce("Yes")
	}else{
		ce("No")
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb          emplace_back
#define ll          long long
#define fi          first
#define se          second
#define mp          make_pair

using namespace std;

const int N = 2007;
typedef pair<int, int> pii;
const int mod = int(1e9) + 7;

int n, m, u, v, trace[N];
pii e[N];
vector<int> a[N], path;

void DFS(int u) {
    for(int v: a[u]) {
        if(trace[v] == -1) {
            trace[v] = u;
            DFS(v);
        }
    }
}

bool Check(vector<int>& d) {
    vector<int> in(n + 1, 0), out(n + 1, 0);
    for(int i = 1; i <= m; ++i) {
        if(trace[e[i].fi] == -2 && trace[e[i].se] == -2) {
            ++out[e[i].fi], ++in[e[i].se];
        }
    }
    for(int x: d)
        if(in[x] == 1 && out[x] == 1) continue;
        else return 0;
    return 1;
}

void Find(int s, int t) {
    memset(&trace, -1, sizeof trace);
    trace[s] = -2;
    DFS(s); path.clear();
    if(trace[t] == -1) return;
    while(t != s) {
        path.pb(t);
        t = trace[t];
    }
    path.pb(s);
    for(int x: path) trace[x] = -2;
    if(!Check(path)) return;
    cout << path.size() << '\n';
    reverse(path.begin(), path.end());
    for(int x: path) cout << x << '\n';
    exit(0);
}

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    #define Task        "test"
    if(fopen(Task".inp", "r")) {
        freopen(Task".inp", "r", stdin);
        freopen(Task".out", "w", stdout);
    }
    cin >> n >> m;
    for(int i = 1; i <= m; ++i) {
        cin >> u >> v; e[i] = mp(u, v);
    }
    for(int i = 1; i <= m; ++i) {
        for(int j = 1; j <= n; ++j) a[j].clear();
        for(int j = 1; j <= m; ++j) if(j != i) a[e[j].fi].pb(e[j].se);
        Find(e[i].se, e[i].fi);
    }
    cout << -1;
}


Measured memory_bytes: 384
n = int(input())
d = [list(map(int,input().split())) for _ in range(n)]
num = 0
ans = 0

for i in range(n):
    d1, d2 = d[i]
    if d1==d2:
        num += 1
        ans = max(ans, num)
    else:
        num = 0

if ans>=3:
    print("Yes")
else:
    print("No")

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

function main()
	k = readline() |> parseInt
	n = 50
	println(50)
	p = div(k,50)
	q = k%50
	for i in 0:n-2
		if i<q
			print(n-1+(p+1)*n-k+p," ")
		else
			print(n-1+p*n-k+p," ")
		end
	end
	if n-1<q
		println(n-1+(p+1)*n-k+p)
	else
		println(n-1+p*n-k+p)
	end
end

main()

Measured memory_bytes: 111500
#include <bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define rep(i,N) for(long long i = 0; i < (long long)(N); i++)
#define repr(i,N) for(long long i = (long long)(N) - 1; i >= 0; i--)
#define rep1(i,N) for(long long i = 1; i <= (long long)(N) ; i++)
#define repr1(i,N) for(long long i = (N) ; (long long)(i) > 0 ; i--)
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
using namespace std; void solve();
using ll = long long; template<class T = ll> using V = vector<T>;
using vi = V<int>; using vl = V<>; using vvi = V< V<int> >;
constexpr int inf = 1001001001; constexpr ll infLL = (1LL << 61) - 1;
struct IoSetupNya {IoSetupNya() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(7);} } iosetupnya;
template<typename T, typename U> inline bool amin(T &x, U y) { return (y < x) ? (x = y, true) : false; }
template<typename T, typename U> inline bool amax(T &x, U y) { return (x < y) ? (x = y, true) : false; }
template<typename T, typename U> ostream& operator <<(ostream& os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<typename T, typename U> istream& operator >>(istream& is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator <<(ostream& os, const vector<T> &v) { int s = (int)v.size(); rep(i,s) os << (i ? " " : "") << v[i]; return os; }
template<typename T> istream& operator >>(istream& is, vector<T> &v) { for(auto &x : v) is >> x; return is; }
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}
#ifdef NyaanDebug
  #include "NyaanDebug.h"
  #define trc(...) do { cerr << #__VA_ARGS__ << " = "; dbg_out(__VA_ARGS__);} while(0)
  #define trca(v,N) do { cerr << #v << " = "; array_out(v , N);cout << endl;} while(0)
#else
  #define trc(...)
  #define trca(...)
  int main(){solve();}
#endif

using P = pair<ll,ll>; using vp = V<P>;
constexpr int MOD = /**/ 1000000007; //*/ 998244353;
////////////////////////////////

// c++17での名前衝突を避けるためdefine
#define gcd nyagcd
#define lcm nyalcm
ll nyagcd(ll x, ll y){
  ll z;
  if(x > y) swap(x,y);
  while(x){
    x = y % (z = x); y = z;
  }    
  return y;
}
ll nyalcm(ll x,ll y){
  return 1LL * x / gcd(x,y) * y;
}

void solve(){
  inl(N , M);
  vl a(N); in(a);
  ll nya = 1;
  rep(i , N){
    nya = lcm(nya , a[i] / 2);
    if(nya > M) die(0);
  }
  rep(i , N){
    if(nya % a[i] == 0) die(0);
  }
  if(nya == M) die(1);
  M -= nya;
  nya *= 2;
  out(M / nya + 1);
}

Measured memory_bytes: 1024